diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-23 13:57:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-23 15:19:43 +0200 |
commit | 0925dc81415276932aef66107b2d924b22c02d1e (patch) | |
tree | 3ea39ece7f2491b99a102b51a9395cbf5cc70ed9 /sw/source/uibase/uiview | |
parent | fc10c4a3a7700fc96890149ae9095206b5e67685 (diff) |
Use more SwPosition::Adjust
to keep the internal fields of SwPosition in sync.
Change-Id: I9a9889a819a3998aa4ff2188a2dc3e0cb2ec6888
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138727
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/uiview')
-rw-r--r-- | sw/source/uibase/uiview/viewling.cxx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index c98e9056bfc1..45b1851ad3c5 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -186,10 +186,11 @@ void SwView::ExecLingu(SfxRequest &rReq) // check for unexpected error case OSL_ENSURE(pTextNode && pTextNode->GetText().getLength() >= nPointIndex, "text missing: corrupted node?" ); - if (!pTextNode || pTextNode->GetText().getLength() < nPointIndex) - nPointIndex = 0; // restore cursor to its original position - m_pWrtShell->GetCursor()->GetPoint()->nContent.Assign( pTextNode, nPointIndex ); + if (!pTextNode || pTextNode->GetText().getLength() < nPointIndex) + m_pWrtShell->GetCursor()->GetPoint()->Assign( aPointNodeIndex ); + else + m_pWrtShell->GetCursor()->GetPoint()->Assign( *pTextNode, nPointIndex ); } // enable all, restore view and cursor position @@ -511,8 +512,8 @@ void SwView::InsertThesaurusSynonym( const OUString &rSynonmText, const OUString // adjust existing selection SwPaM *pCursor = m_pWrtShell->GetCursor(); - pCursor->GetPoint()->nContent -= nRight; - pCursor->GetMark()->nContent += nLeft; + pCursor->GetPoint()->AdjustContent(-nRight); + pCursor->GetMark()->AdjustContent(nLeft); } m_pWrtShell->Insert( rSynonmText ); |