sc/source/ui/unoobj/docuno.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 8bd08a18bf58bafc0a68e86d1091295528e257b4
Author:     Dennis Francis <[email protected]>
AuthorDate: Tue Jan 4 14:20:41 2022 +0530
Commit:     Dennis Francis <[email protected]>
CommitDate: Fri Feb 4 19:22:47 2022 +0100

    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 <[email protected]>

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...

Reply via email to