sw/source/core/crsr/bookmark.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit 45c7f90951b6b9f2e78e6803948d58f16d3cb859 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Sep 15 18:00:52 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Sep 15 21:08:42 2022 +0200 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.gran...@collabora.co.uk> 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); }