[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Thu Feb 11 12:54:40 UTC 2021


 sc/source/ui/inc/select.hxx   |    1 +
 sc/source/ui/view/gridwin.cxx |   15 +++++++++++++++
 sc/source/ui/view/select.cxx  |   16 +++++++++++++---
 3 files changed, 29 insertions(+), 3 deletions(-)

New commits:
commit 45fb849a44ca5be3f9dc1f9af5848279e02c77f5
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Fri Jan 22 01:27:28 2021 +0530
Commit:     Pranam Lashkari <lpranam at collabora.com>
CommitDate: Thu Feb 11 13:54:06 2021 +0100

    prevent reference range resetting on panning in mobile
    
    Change-Id: Ic6cabe1d4e5a1e7c4d42294550d654e38e27db22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110461
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Pranam Lashkari <lpranam at collabora.com>

diff --git a/sc/source/ui/inc/select.hxx b/sc/source/ui/inc/select.hxx
index d3071f31e344..3e8be2ffa017 100644
--- a/sc/source/ui/inc/select.hxx
+++ b/sc/source/ui/inc/select.hxx
@@ -70,6 +70,7 @@ public:
     virtual void    DeselectAll() override;
 
     bool            SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll );
+    bool            CheckRefBounds(SCCOL nPosX, SCROW nPosY);
 };
 
 class ScHeaderFunctionSet : public FunctionSet          // Column / row headers
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5a8bf3a1734f..c2a1a244f2e4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1418,6 +1418,21 @@ void ScGridWindow::LogicMouseMove(const MouseEvent& rMouseEvent)
 
 void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt )
 {
+    if (SfxLokHelper::getDeviceFormFactor() == LOKDeviceFormFactor::MOBILE)
+    {
+        ScViewFunc* pView = pViewData->GetView();
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
+
+        Point aPos(rMEvt.GetPosPixel());
+        SCCOL nPosX;
+        SCROW nPosY;
+        pViewData->GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY);
+
+        if (bRefMode && pView->GetFunctionSet().CheckRefBounds(nPosX, nPosY))
+            return;
+    }
+
     nNestedButtonState = ScNestedButtonState::Down;
 
     MouseEventState aState;
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index b165234df5c2..99d8707bce75 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -417,6 +417,17 @@ void ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool /* bDon
     SetCursorAtCell( nPosX, nPosY, bScroll );
 }
 
+bool ScViewFunctionSet::CheckRefBounds(SCCOL nPosX, SCROW nPosY)
+{
+    SCCOL startX = pViewData->GetRefStartX();
+    SCROW startY = pViewData->GetRefStartY();
+
+    SCCOL endX = pViewData->GetRefEndX();
+    SCROW endY = pViewData->GetRefEndY();
+
+    return nPosX >= startX && nPosX <= endX && nPosY >= startY && nPosY <= endY;
+}
+
 bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll )
 {
     ScTabView* pView = pViewData->GetView();
@@ -468,7 +479,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
     if (bRefMode)
     {
         // if no input is possible from this doc, don't move the reference cursor around
-        if ( !pScMod->IsModalMode(pViewData->GetSfxDocShell()) )
+        if ( !pScMod->IsModalMode(pViewData->GetSfxDocShell()) && (!CheckRefBounds(nPosX, nPosY) || SfxLokHelper::getDeviceFormFactor() != LOKDeviceFormFactor::MOBILE))
         {
             if (!bAnchor)
             {
@@ -476,8 +487,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll
                 pView->InitRefMode( nPosX, nPosY, pViewData->GetTabNo(), SC_REFTYPE_REF );
             }
 
-            if(SfxLokHelper::getDeviceFormFactor() != LOKDeviceFormFactor::MOBILE)
-                pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() );
+            pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() );
 
             pView->SelectionChanged();
         }


More information about the Libreoffice-commits mailing list