sw/source/core/undo/untbl.cxx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
New commits: commit ffbd28d9799f9d2c25b6274d9f9ef689b507cc12 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Fri Oct 7 08:30:12 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Oct 7 09:37:35 2022 +0200 simplify some node manipulation in SwUndoTextToTable Change-Id: I4893d17591dadc3a4cdcad26f9e04b26435f5151 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141040 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 cff290bce21f..7549433a05d1 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -763,17 +763,15 @@ void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) rDoc.TableToText( pTNd, 0x0b == m_cSeparator ? 0x09 : m_cSeparator ); // join again at start? - SwPaM aPam(rDoc.GetNodes().GetEndOfContent()); - SwPosition *const pPos = aPam.GetPoint(); if( m_nSttContent ) { - pPos->Assign(nTableNd); + SwPaM aPam(rDoc.GetNodes(), nTableNd); if (aPam.Move(fnMoveBackward, GoInContent)) { SwNode & rIdx = aPam.GetPoint()->GetNode(); // than move, relatively, the Cursor/etc. again - RemoveIdxRel( rIdx.GetIndex()+1, *pPos ); + RemoveIdxRel( rIdx.GetIndex()+1, *aPam.GetPoint() ); rIdx.GetContentNode()->JoinNext(); } @@ -782,16 +780,15 @@ void SwUndoTextToTable::UndoImpl(::sw::UndoRedoContext & rContext) // join again at end? if( m_bSplitEnd ) { - pPos->Assign( m_nEndNode ); - SwTextNode* pTextNd = pPos->GetNode().GetTextNode(); + SwPosition aEndPos( rDoc.GetNodes(), m_nEndNode ); + SwTextNode* pTextNd = aEndPos.GetNode().GetTextNode(); if( pTextNd && pTextNd->CanJoinNext() ) { - aPam.GetMark()->nContent.Assign( nullptr, 0 ); - aPam.GetPoint()->nContent.Assign( nullptr, 0 ); + aEndPos.nContent.Assign( nullptr, 0 ); // than move, relatively, the Cursor/etc. again - pPos->SetContent(pTextNd->GetText().getLength()); - RemoveIdxRel( m_nEndNode + 1, *pPos ); + aEndPos.SetContent(pTextNd->GetText().getLength()); + RemoveIdxRel( m_nEndNode + 1, aEndPos ); pTextNd->JoinNext(); }