diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-15 18:00:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-15 21:08:42 +0200 |
commit | 45c7f90951b6b9f2e78e6803948d58f16d3cb859 (patch) | |
tree | 478306f6acffedf10aa03a0c799542c5d52191e6 /sw | |
parent | 8d0e40b331cf45b59dc14351eb0ca06aba41ebb0 (diff) |
use more SwPosition::AdjustContent
part of hiding the internals of SwPosition
Change-Id: I9f91933e0d31b455a49e4872281c4a46d518d418
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140026
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/bookmark.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index 6796d672387f..5e5ee08b7a22 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -184,7 +184,7 @@ namespace { SwPaM aStartPaM(start); io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, startChar); - start.nContent -= startChar.getLength(); // restore, it was moved by InsertString + start.AdjustContent( -startChar.getLength() ); // restore, it was moved by InsertString // do not manipulate via reference directly but call SetMarkStartPos // which works even if start and end pos were the same rField.SetMarkStartPos( start ); @@ -197,7 +197,7 @@ namespace io_rDoc.getIDocumentContentOperations().InsertString(aStartPaM, OUString(CH_TXT_ATR_FIELDSEP)); if (!pSepPos || rEnd < *pSepPos) { // rEnd is not moved automatically if it's same as insert pos - ++rEnd.nContent; + rEnd.AdjustContent(1); } } assert(pSepPos == nullptr || (start < *pSepPos && *pSepPos <= rEnd)); @@ -214,7 +214,7 @@ namespace io_rDoc.getIDocumentContentOperations().InsertString(aEndPaM, OUString(aEndMark)); if (aEndMark != CH_TXT_ATR_FORMELEMENT) { - ++rEnd.nContent; // InsertString didn't move non-empty mark + rEnd.AdjustContent(1); // InsertString didn't move non-empty mark } else { // InsertString moved the mark's end, not its start @@ -853,13 +853,13 @@ namespace sw::mark if(nStart + 1 < pTextNode->GetText().getLength() && nEnd <= pTextNode->GetText().getLength() && nEnd > nStart + 2) { - SwPaM aFieldPam(GetMarkStart().nNode, nStart + 1, - GetMarkStart().nNode, nEnd - 1); + SwPaM aFieldPam(GetMarkStart().GetNode(), nStart + 1, + GetMarkStart().GetNode(), nEnd - 1); m_pDocumentContentOperationsManager->ReplaceRange(aFieldPam, sNewContent, false); } else { - SwPaM aFieldStartPam(GetMarkStart().nNode, nStart + 1); + SwPaM aFieldStartPam(GetMarkStart().GetNode(), nStart + 1); m_pDocumentContentOperationsManager->InsertString(aFieldStartPam, sNewContent); } |