diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 59af6a581a6b..31f4c69e162e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6435,9 +6435,7 @@ OUString SwEditWin::GetSurroundingText() const { bool bUnLockView = !rSh.IsViewLocked(); rSh.LockView(true); - - SwPosition *pPos = rSh.GetCursor()->GetPoint(); - const sal_Int32 nPos = pPos->nContent.GetIndex(); + rSh.Push(); // get the sentence around the cursor rSh.HideCursor(); @@ -6446,8 +6444,7 @@ OUString SwEditWin::GetSurroundingText() const rSh.GoEndSentence(); rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR ); - pPos->nContent = nPos; - rSh.ClearMark(); + rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.HideCursor(); if (bUnLockView) @@ -6479,13 +6476,13 @@ Selection SwEditWin::GetSurroundingTextSelection() const // around the visible cursor. SwPosition *pPos = rSh.GetCursor()->GetPoint(); const sal_Int32 nPos = pPos->nContent.GetIndex(); + rSh.Push(); rSh.HideCursor(); rSh.GoStartSentence(); const sal_Int32 nStartPos = rSh.GetCursor()->GetPoint()->nContent.GetIndex(); - pPos->nContent = nPos; - rSh.ClearMark(); + rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.ShowCursor(); if (bUnLockView) @@ -6507,14 +6504,11 @@ bool SwEditWin::DeleteSurroundingText(const Selection& rSelection) // rSelection is relative to the start of the sentence, so find that and // adjust the range by it - SwPosition *pPos = rSh.GetCursor()->GetPoint(); - const sal_Int32 nPos = pPos->nContent.GetIndex(); - + rSh.Push(); rSh.HideCursor(); rSh.GoStartSentence(); const sal_Int32 nStartPos = rSh.GetCursor()->GetPoint()->nContent.GetIndex(); - pPos->nContent = nPos; - rSh.ClearMark(); + rSh.Pop(SwCursorShell::PopMode::DeleteCurrent); rSh.ShowCursor(); if (rSh.SelectText(nStartPos + rSelection.Min(), nStartPos + rSelection.Max())) |