sw/source/core/undo/untbl.cxx | 41 +++++++++++++++++------------------------ sw/source/core/undo/untblk.cxx | 3 +-- 2 files changed, 18 insertions(+), 26 deletions(-)
New commits: commit cb38ff2ea917c5f7440f3d421a707cb53c1aa068 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Aug 30 15:13:28 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Aug 30 19:05:42 2022 +0200 use more SwPosition::Assign part of hiding the internals of SwPosition Change-Id: I8858193e94fe34f1fe13d1aaaf7c7b1ed364af61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139045 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index b7b5871e30e0..98122704058d 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -336,9 +336,6 @@ void SwUndoInsTable::RedoImpl(::sw::UndoRedoContext & rContext) return; SwPaM aPam( *pTableNode->EndOfSectionNode(), *pTableNode, SwNodeOffset(1) ); - SwContentNode* pCNd = aPam.GetMarkContentNode(); - if( pCNd ) - aPam.GetMark()->nContent.Assign( pCNd, 0 ); if( m_pRedlineData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() ) ) { @@ -468,9 +465,9 @@ void SwUndoTableToText::UndoImpl(::sw::UndoRedoContext & rContext) SwNodeIndex aFrameIdx( rDoc.GetNodes(), m_nStartNode ); SwNodeIndex aEndIdx( rDoc.GetNodes(), m_nEndNode ); - pPam->GetPoint()->nNode = aFrameIdx; + pPam->GetPoint()->Assign( aFrameIdx ); pPam->SetMark(); - pPam->GetPoint()->nNode = aEndIdx; + pPam->GetPoint()->Assign( aEndIdx ); rDoc.DelNumRules( *pPam ); pPam->DeleteMark(); @@ -517,9 +514,9 @@ void SwUndoTableToText::UndoImpl(::sw::UndoRedoContext & rContext) // Is a table selection requested? pPam->DeleteMark(); - pPam->GetPoint()->nNode = *pTableNd->EndOfSectionNode(); + pPam->GetPoint()->Assign( *pTableNd->EndOfSectionNode() ); pPam->SetMark(); - pPam->GetPoint()->nNode = *pPam->GetPointNode().StartOfSectionNode(); + pPam->GetPoint()->Assign( *pPam->GetPointNode().StartOfSectionNode() ); pPam->Move( fnMoveForward, GoInContent ); pPam->Exchange(); pPam->Move( fnMoveBackward, GoInContent ); @@ -650,8 +647,7 @@ void SwUndoTableToText::RedoImpl(::sw::UndoRedoContext & rContext) SwDoc & rDoc = rContext.GetDoc(); SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); - pPam->GetPoint()->nNode = m_nStartNode; - pPam->GetPoint()->nContent.Assign( nullptr, 0 ); + pPam->GetPoint()->Assign( m_nStartNode ); SwNodeIndex aSaveIdx( pPam->GetPoint()->GetNode(), -1 ); pPam->SetMark(); // log off all indices @@ -686,7 +682,7 @@ void SwUndoTableToText::RepeatImpl(::sw::RepeatContext & rContext) if( pTableNd ) { // move cursor out of table - pPam->GetPoint()->nNode = *pTableNd->EndOfSectionNode(); + pPam->GetPoint()->Assign( *pTableNd->EndOfSectionNode() ); pPam->Move( fnMoveForward, GoInContent ); pPam->SetMark(); pPam->DeleteMark(); @@ -774,12 +770,12 @@ void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) pPos->Assign(nTableNd); if (aPam.Move(fnMoveBackward, GoInContent)) { - SwNodeIndex & rIdx = aPam.GetPoint()->nNode; + SwNode & rIdx = aPam.GetPoint()->GetNode(); // than move, relatively, the Cursor/etc. again RemoveIdxRel( rIdx.GetIndex()+1, *pPos ); - rIdx.GetNode().GetContentNode()->JoinNext(); + rIdx.GetContentNode()->JoinNext(); } } @@ -2176,8 +2172,7 @@ void SwUndoTableNumFormat::UndoImpl(::sw::UndoRedoContext & rContext) SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); - pPam->GetPoint()->nNode = m_nNode + 1; - pPam->GetPoint()->nContent.Assign( pTextNd, 0 ); + pPam->GetPoint()->Assign( m_nNode + 1 ); } namespace { @@ -2229,7 +2224,7 @@ void SwUndoTableNumFormat::RedoImpl(::sw::UndoRedoContext & rContext) SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); - pPam->GetPoint()->nNode = m_nNode; + pPam->GetPoint()->Assign( m_nNode ); SwNode * pNd = & pPam->GetPoint()->GetNode(); SwStartNode* pSttNd = pNd->FindSttNodeByType( SwTableBoxStartNode ); @@ -2305,8 +2300,7 @@ void SwUndoTableNumFormat::RedoImpl(::sw::UndoRedoContext & rContext) } if( !pNd->IsContentNode() ) - pNd = rDoc.GetNodes().GoNext( &pPam->GetPoint()->nNode ); - pPam->GetPoint()->nContent.Assign( static_cast<SwContentNode*>(pNd), 0 ); + pNd = rDoc.GetNodes().GoNext( pPam->GetPoint() ); } void SwUndoTableNumFormat::SetBox( const SwTableBox& rBox ) @@ -2450,7 +2444,7 @@ void SwUndoTableCpyTable::UndoImpl(::sw::UndoRedoContext & rContext) { // The aPam.Point is at the moment at the last position of the new content and has to be // moved to the first position of the old content for the SwUndoDelete operation - aPam.GetPoint()->Assign(aPam.GetPoint()->nNode.GetNode(), SwNodeOffset(1)); + aPam.GetPoint()->Assign(aPam.GetPoint()->GetNode(), SwNodeOffset(1)); } pUndo = std::make_unique<SwUndoDelete>(aPam, SwDeleteFlags::Default, bDeleteCompleteParagraph, true); } @@ -2669,11 +2663,11 @@ std::unique_ptr<SwUndo> SwUndoTableCpyTable::PrepareRedline( SwDoc* pDoc, const { // If the content is not merged, the end of the insertion is at the end of the node // _before_ the given position rPos - --aInsertEnd.nNode; + aInsertEnd.Adjust(SwNodeOffset(-1)); pText = aInsertEnd.GetNode().GetTextNode(); if( pText ) { - aInsertEnd.nContent.Assign(pText, pText->GetText().getLength()); + aInsertEnd.SetContent(pText->GetText().getLength()); if( !bRedo && rPos.GetNode().GetTextNode() ) { // Try to merge, if not called by Redo() rJoin = true; @@ -2914,7 +2908,7 @@ void SwUndoSplitTable::RedoImpl(::sw::UndoRedoContext & rContext) SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); - pPam->GetPoint()->nNode = m_nTableNode; + pPam->GetPoint()->Assign( m_nTableNode ); pDoc->SplitTable( *pPam->GetPoint(), m_nMode, m_bCalcNewSize ); ClearFEShellTabCols(*pDoc, nullptr); @@ -3033,11 +3027,10 @@ void SwUndoMergeTable::RedoImpl(::sw::UndoRedoContext & rContext) SwPaM *const pPam(& rContext.GetCursorSupplier().CreateNewShellCursor()); pPam->DeleteMark(); - pPam->GetPoint()->nNode = m_nTableNode; if( m_bWithPrev ) - pPam->GetPoint()->nNode = m_nTableNode + 3; + pPam->GetPoint()->Assign( m_nTableNode + 3 ); else - pPam->GetPoint()->nNode = m_nTableNode; + pPam->GetPoint()->Assign( m_nTableNode ); pDoc->MergeTable( *pPam->GetPoint(), m_bWithPrev, m_nMode ); diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index 1ecf62309204..f6cd1c07f243 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -374,9 +374,8 @@ void SwUndoInserts::RedoImpl(::sw::UndoRedoContext & rContext) SwCursor& rPam(rContext.GetCursorSupplier().CreateNewShellCursor()); SwDoc& rDoc = rPam.GetDoc(); rPam.DeleteMark(); - rPam.GetPoint()->nNode = m_nSttNode - m_nNodeDiff; + rPam.GetPoint()->Assign( m_nSttNode - m_nNodeDiff, m_nSttContent ); SwContentNode* pCNd = rPam.GetPointContentNode(); - rPam.GetPoint()->nContent.Assign( pCNd, m_nSttContent ); SwTextFormatColl* pSavTextFormatColl = m_pTextFormatColl; if( m_pTextFormatColl && pCNd && pCNd->IsTextNode() )