diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2022-01-04 14:20:41 +0530 |
---|---|---|
committer | Dennis Francis <dennis.francis@collabora.com> | 2022-02-04 19:22:47 +0100 |
commit | 8bd08a18bf58bafc0a68e86d1091295528e257b4 (patch) | |
tree | 5f00830d412e0e4641df7b30f151b8461b8e4671 /sc/source/ui | |
parent | 226847e385d021bf2feacdfa796b3eb7023d6f0f (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/source/ui')
-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 2525b360d1a3..7e149c8b7123 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... |