sw/inc/undobj.hxx              |    3 ++-
 sw/source/core/undo/undobj.cxx |    4 ++--
 sw/source/core/undo/unsect.cxx |    4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

New commits:
commit aad60d4a5b584e08e01c35eeace6434b83199989
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Aug 6 13:54:33 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Aug 7 10:25:27 2022 +0200

    make RestoreSection take a SwNode, not an SwNodeIndex
    
    as part of the process of hiding the internals of SwPosition
    
    Change-Id: I7ba9a9ef81c78445328f3397f352e103e997cde6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137906
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 624b1ca4f2a6..2dd2d9b36610 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -36,6 +36,7 @@ class SwDoc;
 class SwTextFormatColl;
 class SwFrameFormat;
 class SwFormatAnchor;
+class SwNode;
 class SwNodeIndex;
 class SwNodeRange;
 class SwRedlineData;
@@ -215,7 +216,7 @@ public:
     void SaveSection( const SwNodeIndex& rSttIdx );
     void SaveSection(const SwNodeRange& rRange, bool bExpandNodes = true);
     void RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, sal_uInt16 nSectType 
);
-    void RestoreSection(SwDoc* pDoc, const SwNodeIndex& rInsPos, bool 
bForceCreateFrames = false);
+    void RestoreSection(SwDoc* pDoc, const SwNode& rInsPos, bool 
bForceCreateFrames = false);
 
     const SwHistory* GetHistory() const { return m_pHistory.get(); }
           SwHistory* GetHistory()       { return m_pHistory.get(); }
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 947a26ec41da..f9a1c452adc7 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1290,14 +1290,14 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, 
SwNodeIndex* pIdx,
     SwStartNode* pSttNd = SwNodes::MakeEmptySection( aSttIdx,
                                             
static_cast<SwStartNodeType>(nSectType) );
 
-    RestoreSection( pDoc, SwNodeIndex( *pSttNd->EndOfSectionNode() ));
+    RestoreSection( pDoc, *pSttNd->EndOfSectionNode() );
 
     if( pIdx )
         *pIdx = *pSttNd;
 }
 
 void SwUndoSaveSection::RestoreSection(
-        SwDoc *const pDoc, const SwNodeIndex& rInsPos, bool bForceCreateFrames)
+        SwDoc *const pDoc, const SwNode& rInsPos, bool bForceCreateFrames)
 {
     if( NODE_OFFSET_MAX == m_nStartPos )        // was there any content?
         return;
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index b7cb3d835933..c0b61815f4ff 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -578,7 +578,7 @@ void SwUndoUpdateIndex::UndoImpl(::sw::UndoRedoContext & 
rContext)
         SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
         
rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_TEXT));
     m_pSaveSectionUpdated->SaveSection(SwNodeRange(first, last), false);
-    m_pSaveSectionOriginal->RestoreSection(&rDoc, first, true);
+    m_pSaveSectionOriginal->RestoreSection(&rDoc, first.GetNode(), true);
     // delete before restoring nested undo, so its node indexes match
     SwNodeIndex const del(*pDeletionPrevention);
     SwDoc::CorrAbs(del, del, 
SwPosition(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(), 
SwNodeOffset(0)), true);
@@ -599,7 +599,7 @@ void SwUndoUpdateIndex::RedoImpl(::sw::UndoRedoContext & 
rContext)
         SwNodeIndex(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode()),
         
rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_TEXT));
     m_pSaveSectionOriginal->SaveSection(SwNodeRange(first, last), false);
-    m_pSaveSectionUpdated->RestoreSection(&rDoc, first, true);
+    m_pSaveSectionUpdated->RestoreSection(&rDoc, first.GetNode(), true);
     // delete before restoring nested undo, so its node indexes match
     SwNodeIndex const del(*pDeletionPrevention);
     SwDoc::CorrAbs(del, del, 
SwPosition(*rDoc.GetNodes()[m_nStartIndex]->EndOfSectionNode(), 
SwNodeOffset(0)), true);

Reply via email to