summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/select.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/select.cxx')
-rw-r--r--sc/source/ui/view/select.cxx16
1 files changed, 13 insertions, 3 deletions
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();
}