summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-16 23:01:10 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-16 22:15:19 +0100
commita81e957f5026373f3935390c786c21416fc74fcc (patch)
treea6852bb6c2c8c99e6f848217588c0944dcb3dcd9 /sc
parent7060192b6facd92cadb5bb084052903f2695d67d (diff)
lok: handle mouse/keyboard events in Math embedded in Calc
And extract the identical code used in all components into static SfxLokHelper methods. Change-Id: I6556b1b996936835ecfc0d59e2c1dd1ef6380db2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142793 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx39
1 files changed, 6 insertions, 33 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 614eed94d891..bb8a1ce81e7b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -635,20 +635,10 @@ VclPtr<vcl::Window> ScModelObj::getDocWindow()
if (!pViewShell)
return VclPtr<vcl::Window>();
- ScViewData* pViewData = &pViewShell->GetViewData();
-
- VclPtr<vcl::Window> pWindow;
- if (pViewData)
- {
- pWindow = pViewData->GetActiveWin();
+ if (VclPtr<vcl::Window> pWindow = SfxLokHelper::getInPlaceDocWindow(pViewShell))
+ return pWindow;
- LokChartHelper aChartHelper(pViewData->GetViewShell());
- vcl::Window* pChartWindow = aChartHelper.GetWindow();
- if (pChartWindow)
- pWindow = pChartWindow;
- }
-
- return pWindow;
+ return pViewShell->GetViewData().GetActiveWin();
}
Size ScModelObj::getDocumentSize()
@@ -740,32 +730,15 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt
if (!pGridWindow)
return;
- // check if user hit a chart which is being edited by him
- ScTabViewShell * pTabViewShell = pViewData->GetViewShell();
SCTAB nTab = pViewData->GetTabNo();
const ScDocument& rDoc = pDocShell->GetDocument();
- // In LOK RTL mode draw/svx operates in negative X coordinates
- // But the coordinates from client is always positive, so negate nX for draw.
bool bDrawNegativeX = rDoc.IsNegativePage(nTab);
- LokChartHelper aChartHelper(pTabViewShell, bDrawNegativeX);
- int nDrawX = bDrawNegativeX ? -nX : nX;
- if (aChartHelper.postMouseEvent(nType, nDrawX, nY,
- nCount, nButtons, nModifier,
- pViewData->GetPPTX(), pViewData->GetPPTY()))
- {
+ if (SfxLokHelper::testInPlaceComponentMouseEventHit(pViewShell, nType, nX, nY, nCount,
+ nButtons, nModifier, pViewData->GetPPTX(),
+ pViewData->GetPPTY(), bDrawNegativeX))
return;
- }
Point aPointTwip(nX, nY);
- Point aPointTwipDraw(nDrawX, nY);
-
- // check if the user hit a chart which is being edited by someone else
- // and, if so, skip current mouse event
- if (nType != LOK_MOUSEEVENT_MOUSEMOVE)
- {
- if (LokChartHelper::HitAny(aPointTwipDraw, bDrawNegativeX))
- return;
- }
// Check if a control is hit
Point aPointHMM = o3tl::convert(aPointTwip, o3tl::Length::twip, o3tl::Length::mm100);