sc/source/ui/view/viewdata.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 1380a8290b799f44ef767e2fb6813e3cd387ff6c
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jan 5 21:05:50 2024 +0900
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jan 8 11:05:12 2024 +0100

    sc: LOK work-around for mouse click selecting the wrong cell
    
    Don't increase the cell selection if we detect the mouse click
    was out of the screen (grid window) area. Only do this when LOK
    is enabled.
    
    Change-Id: I97922e9d02500d7cedeaa5fa29d4ca344950ff47
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161662
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 57ef3e5487d0..8fc254aa8fce 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2849,15 +2849,19 @@ void ScViewData::GetPosFromPixel( tools::Long nClickX, 
tools::Long nClickY, ScSp
         }
     }
 
+    bool bLOK = comphelper::LibreOfficeKit::isActive();
     //  cells too big?
-    if ( rPosX == nStartPosX && nClickX > 0 )
+    // Work-around this for LOK, because the screen size is in not set 
correctly
+    // for all views and we will geturn the wrong position in case we send a 
click
+    // that is outside the set screen grid area
+    if (rPosX == nStartPosX && nClickX > 0 && !bLOK)
     {
          if (pView)
             aScrSize.setWidth( pView->GetGridWidth(eHWhich) );
          if ( nClickX > aScrSize.Width() )
             ++rPosX;
     }
-    if ( rPosY == nStartPosY && nClickY > 0 )
+    if (rPosY == nStartPosY && nClickY > 0 && !bLOK)
     {
         if (pView)
             aScrSize.setHeight( pView->GetGridHeight(eVWhich) );

Reply via email to