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

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 2 17:47:59 UTC 2021


 sc/source/ui/inc/select.hxx   |    1 +
 sc/source/ui/view/gridwin.cxx |   15 +++++++++++++++
 sc/source/ui/view/select.cxx  |   13 ++++++++++++-
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 4f5a71397dec1dbe5f711b1be67d1ee50e3bfd5e
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Fri Feb 5 15:00:31 2021 +0530
Commit:     Pranam Lashkari <lpranam at collabora.com>
CommitDate: Fri Apr 2 19:47:27 2021 +0200

    prevent reference range resetting on panning in mobile
    
    Change-Id: Ic6cabe1d4e5a1e7c4d42294550d654e38e27db22
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110458
    Tested-by: Jenkins
    Reviewed-by: Pranam Lashkari <lpranam at collabora.com>
    (cherry picked from commit 72fa32f6d9ad2c0fe8aa03f60797aa13c11e2085)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113533
    Tested-by: Pranam Lashkari <lpranam at collabora.com>

diff --git a/sc/source/ui/inc/select.hxx b/sc/source/ui/inc/select.hxx
index d1da97b13137..55b1572aaa35 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 cf781d0319b4..b27d3e35e877 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1396,6 +1396,21 @@ void ScGridWindow::LogicMouseMove(const MouseEvent& rMouseEvent)
 
 void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt )
 {
+    if (SfxLokHelper::getDeviceFormFactor() == LOKDeviceFormFactor::MOBILE)
+    {
+        ScViewFunc* pView = mrViewData.GetView();
+        ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+        bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
+
+        Point aPos(rMEvt.GetPosPixel());
+        SCCOL nPosX;
+        SCROW nPosY;
+        mrViewData.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 1a51dd50d9fc..9f5e2a139abe 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -415,6 +415,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();
@@ -466,7 +477,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)
             {


More information about the Libreoffice-commits mailing list