sw/source/core/undo/unovwr.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
New commits: commit 90b4e348114cc9d060ce056690858c4849ed8b2e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Sep 5 13:45:11 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Sep 5 15:39:39 2022 +0200 use more SwPosition::Assign part of hiding the internals of SwPosition Change-Id: I9f41fcd023c90c9611fc38ae8961984900108422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139435 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index f74c13f76ee2..b585ac6a5d13 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -264,20 +264,20 @@ void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext) SwCursor& rCurrentPam(rContext.GetCursorSupplier().CreateNewShellCursor()); rCurrentPam.DeleteMark(); - rCurrentPam.GetPoint()->nNode = m_nStartNode; + rCurrentPam.GetPoint()->Assign(m_nStartNode); SwTextNode* pTextNd = rCurrentPam.GetPointNode().GetTextNode(); assert(pTextNd); - SwContentIndex& rIdx = rCurrentPam.GetPoint()->nContent; + SwPosition& rPtPos = *rCurrentPam.GetPoint(); if( m_pRedlSaveData ) { - rIdx.Assign( pTextNd, m_nStartContent ); + rPtPos.SetContent( m_nStartContent ); rCurrentPam.SetMark(); - rCurrentPam.GetMark()->nContent += m_aDelStr.getLength(); + rCurrentPam.GetMark()->AdjustContent( m_aDelStr.getLength() ); rDoc.getIDocumentRedlineAccess().DeleteRedline( rCurrentPam, false, RedlineType::Any ); rCurrentPam.DeleteMark(); } - rIdx.Assign( pTextNd, !m_aDelStr.isEmpty() ? m_nStartContent+1 : m_nStartContent ); + rPtPos.SetContent( !m_aDelStr.isEmpty() ? m_nStartContent+1 : m_nStartContent ); bool bOldExpFlg = pTextNd->IsIgnoreDontExpand(); pTextNd->SetIgnoreDontExpand( true ); @@ -286,15 +286,15 @@ void SwUndoOverwrite::RedoImpl(::sw::UndoRedoContext & rContext) { // do it individually, to keep the attributes! OUString const ins( - pTextNd->InsertText( OUString(m_aInsStr[n]), rIdx, + pTextNd->InsertText( OUString(m_aInsStr[n]), rPtPos, SwInsertFlags::EMPTYEXPAND) ); assert(ins.getLength() == 1); // cannot fail (void) ins; if( n < m_aDelStr.getLength() ) { - rIdx -= 2; - pTextNd->EraseText( rIdx, 1 ); - rIdx += n+1 < m_aDelStr.getLength() ? 2 : 1; + rPtPos.AdjustContent(-2); + pTextNd->EraseText( rPtPos, 1 ); + rPtPos.AdjustContent( n+1 < m_aDelStr.getLength() ? 2 : 1 ); } } pTextNd->SetIgnoreDontExpand( bOldExpFlg );