diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2022-01-04 14:20:41 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-02-14 11:25:45 +0100 |
commit | b5bd00921e268332e590e7ba63a8a9876418a975 (patch) | |
tree | 4e011873fed7a2bc02806425cee2f44b10e5fef9 /sc | |
parent | 9e17c698b3a8ed396363661f9d42f1b488e51419 (diff) |
lokCalcRTL: negate mouse event X for chart and controls
Conflicts:
sc/source/ui/unoobj/docuno.cxx
Change-Id: I389047140d1a3d2c67a861a3e20f799206d937b6
(cherry picked from commit 0f2208a43861ebe94c4a2482a0cf7e5c63bb186e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129361
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index ff72026f3b88..6437dc81ed3e 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -727,8 +727,14 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt // check if user hit a chart which is being edited by him ScTabViewShell * pTabViewShell = pViewData->GetViewShell(); + SCTAB nTab = pViewData->GetTabNo(); LokChartHelper aChartHelper(pTabViewShell); - if (aChartHelper.postMouseEvent(nType, nX, nY, + 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); + int nDrawX = bDrawNegativeX ? -nX : nX; + if (aChartHelper.postMouseEvent(nType, nDrawX, nY, nCount, nButtons, nModifier, pViewData->GetPPTX(), pViewData->GetPPTY())) { @@ -736,21 +742,23 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt } 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(aPointTwip)) + if (LokChartHelper::HitAny(aPointTwipDraw)) return; } // Check if a control is hit Point aPointHMM = o3tl::convert(aPointTwip, o3tl::Length::twip, o3tl::Length::mm100); + Point aPointHMMDraw(bDrawNegativeX ? -aPointHMM.X() : aPointHMM.X(), aPointHMM.Y()); ScDrawLayer* pDrawLayer = pDocShell->GetDocument().GetDrawLayer(); - SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(pViewData->GetTabNo())); + SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(nTab)); SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView(); - if (LokControlHandler::postMouseEvent(pPage, pDrawView, *pGridWindow, nType, aPointHMM, nCount, nButtons, nModifier)) + if (LokControlHandler::postMouseEvent(pPage, pDrawView, *pGridWindow, nType, aPointHMMDraw, nCount, nButtons, nModifier)) return; // Calc operates in pixels... |