From b5bd00921e268332e590e7ba63a8a9876418a975 Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Tue, 4 Jan 2022 14:20:41 +0530 Subject: 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 --- sc/source/ui/unoobj/docuno.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'sc/source') 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... -- cgit