[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source
Pranam Lashkari (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 5 12:21:15 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 cb2e6cbd490804fc2d29171b982b14aedd37dc65
Author: Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Fri Jan 22 01:27:28 2021 +0530
Commit: Pranam Lashkari <lpranam at collabora.com>
CommitDate: Fri Feb 5 13:20:40 2021 +0100
prevent reference range resetting on panning in mobile
Change-Id: Ic6cabe1d4e5a1e7c4d42294550d654e38e27db22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109769
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 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 c3473afaebbf..35bce5d35625 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1429,6 +1429,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 09b9cc19ae94..0b09d46554b9 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)
{
@@ -474,8 +485,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