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

New commits:
commit e1abdcef4404c2a1b8d6d87ae295451a457aeae4
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Fri Jan 5 21:05:50 2024 +0900
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Jan 9 14:25:43 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161816
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 25e602669e80..d09c0a9e0aec 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2851,15 +2851,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