summaryrefslogtreecommitdiff
path: root/sw/source/uibase/docvw/edtwin.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-01-29 11:38:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-01-30 11:36:50 +0100
commit6792aa49a5a7eba601693734a164ab45042c580b (patch)
tree41f88b660d477168b708a327151863648bd31c6a /sw/source/uibase/docvw/edtwin.cxx
parentc42f60e2b9a521005e1263e781c878e2598b44df (diff)
don't scroll to cursor during GetSurroundingText
lock against scrolling to cursor if the IM requests the surrounding text around the cursor seen on launching a menu from a sidebar comment's menubutton in writer if the cursor is a scroll-off page position in the main document Change-Id: I325004987f576df65188629bf6fb63e0ed0be9bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110153 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/docvw/edtwin.cxx')
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 143a3259a991..cfef52b581d4 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6461,6 +6461,9 @@ OUString SwEditWin::GetSurroundingText() const
rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR );
else if( !rSh.HasSelection() )
{
+ bool bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView(true);
+
SwPosition *pPos = rSh.GetCursor()->GetPoint();
const sal_Int32 nPos = pPos->nContent.GetIndex();
@@ -6474,6 +6477,9 @@ OUString SwEditWin::GetSurroundingText() const
pPos->nContent = nPos;
rSh.ClearMark();
rSh.HideCursor();
+
+ if (bUnLockView)
+ rSh.LockView(false);
}
return sReturn;
@@ -6490,6 +6496,9 @@ Selection SwEditWin::GetSurroundingTextSelection() const
}
else
{
+ bool bUnLockView = !rSh.IsViewLocked();
+ rSh.LockView(true);
+
// Return the position of the visible cursor in the sentence
// around the visible cursor.
SwPosition *pPos = rSh.GetCursor()->GetPoint();
@@ -6503,6 +6512,9 @@ Selection SwEditWin::GetSurroundingTextSelection() const
rSh.ClearMark();
rSh.ShowCursor();
+ if (bUnLockView)
+ rSh.LockView(false);
+
return Selection( nPos - nStartPos, nPos - nStartPos );
}
}