sw/source/core/undo/undobj1.cxx |   15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

New commits:
commit 46159a67dd45a604a0197a26d177d6e9dce62d96
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Sep 5 15:00:08 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Sep 6 08:56:53 2022 +0200

    use more SwPosition::Assign
    
    part of hiding the internals of SwPosition
    
    Change-Id: I878f32139a82eab4a9f77673ebaadb1f1f1007f2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139441
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index 3b7e0289b74d..8ece221511f8 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -115,12 +115,10 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & 
rContext, bool bShowSelFrame)
     }
     else
     {
-        SwPosition aNewPos(pDoc->GetNodes().GetEndOfContent());
-        aNewPos.nNode = m_nNodePagePos;
+        SwPosition aNewPos(*pDoc->GetNodes()[m_nNodePagePos]);
         if ((RndStdIds::FLY_AS_CHAR == m_nRndId) || (RndStdIds::FLY_AT_CHAR == 
m_nRndId))
         {
-            aNewPos.nContent.Assign( aNewPos.GetNode().GetContentNode(),
-                                    m_nContentPos );
+            aNewPos.SetContent( m_nContentPos );
         }
         aAnchor.SetAnchor( &aNewPos );
     }
@@ -254,8 +252,7 @@ void SwUndoFlyBase::DelFly( SwDoc* pDoc )
         {
             // Pointer to 0, do not delete
             const_cast<SwFormatFlyCnt&>(pAttr->GetFlyCnt()).SetFlyFormat();
-            SwContentIndex aIdx( pPos->nContent );
-            pTextNd->EraseText( aIdx, 1 );
+            pTextNd->EraseText( *pPos, 1 );
         }
     }
     else if (RndStdIds::FLY_AT_CHAR == m_nRndId)
@@ -339,10 +336,6 @@ void SwUndoInsLayFormat::RepeatImpl(::sw::RepeatContext & 
rContext)
         (RndStdIds::FLY_AS_CHAR == aAnchor.GetAnchorId()))
     {
         SwPosition aPos( *rContext.GetRepeatPaM().GetPoint() );
-        if (RndStdIds::FLY_AT_PARA == aAnchor.GetAnchorId())
-        {
-            aPos.nContent.Assign( nullptr, 0 );
-        }
         aAnchor.SetAnchor( &aPos );
     }
     else if( RndStdIds::FLY_AT_FLY == aAnchor.GetAnchorId() )
@@ -540,7 +533,7 @@ void SwUndoSetFlyFormat::GetAnchor( SwFormatAnchor& rAnchor,
                 }
                 else
                 {
-                    aPos.nContent.Assign(pNd->GetTextNode(), nContent);
+                    aPos.SetContent(nContent);
                 }
             }
             if ( pNd )

Reply via email to