diff options
author | Pranam Lashkari <lpranam@collabora.com> | 2021-01-22 01:27:28 +0530 |
---|---|---|
committer | Pranam Lashkari <lpranam@collabora.com> | 2021-02-05 13:20:40 +0100 |
commit | cb2e6cbd490804fc2d29171b982b14aedd37dc65 (patch) | |
tree | 0cbf85ce7647da8e45f534ab94180dab9796f9ac /sc | |
parent | 770fa01933b2829a29e7e683487d5c9bd31fa0c3 (diff) |
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@gmail.com>
Reviewed-by: Pranam Lashkari <lpranam@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/select.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/view/select.cxx | 16 |
3 files changed, 29 insertions, 3 deletions
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(); } |