sw/inc/IDocumentMarkAccess.hxx                          |    4 ++--
 sw/inc/doc.hxx                                          |    4 ++--
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    4 ++--
 sw/source/core/doc/docbm.cxx                            |    8 ++++----
 sw/source/core/doc/doccorr.cxx                          |   12 ++++++------
 sw/source/core/doc/docedt.cxx                           |    4 ++--
 sw/source/core/doc/docnum.cxx                           |    2 +-
 sw/source/core/docnode/section.cxx                      |    2 +-
 sw/source/core/inc/MarkManager.hxx                      |    4 ++--
 sw/source/core/inc/mvsave.hxx                           |    2 +-
 sw/source/core/txtnode/ndtxt.cxx                        |    4 ++--
 sw/source/core/undo/undobj.cxx                          |    3 +--
 12 files changed, 26 insertions(+), 27 deletions(-)

New commits:
commit e0db029cd33fce069d168853fd07c801162aef5a
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Aug 25 15:11:08 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 25 17:59:10 2022 +0200

    use SwNode instead of SwNodeIndex in CorrAbs/CorrRel
    
    part of the process of hiding the internals of SwPosition
    
    Change-Id: Id00dc63fd30ea9cf015b9d5f69ee8eb82dc52228
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138834
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index ca63a45c7ce8..93690fb2b305 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -197,7 +197,7 @@ class IDocumentMarkAccess
             @param nOffset
             [in] the offset by which the mark gets positioned of rNewPos
         */
-        virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode,
+        virtual void correctMarksAbsolute(const SwNode& rOldNode,
             const SwPosition& rNewPos,
             const sal_Int32 nOffset) =0;
 
@@ -215,7 +215,7 @@ class IDocumentMarkAccess
             [in] the offset by which the mark gets positioned of rNewPos in 
addition to
                  its old position in the paragraph
         */
-        virtual void correctMarksRelative(const SwNodeIndex& rOldNode,
+        virtual void correctMarksRelative(const SwNode& rOldNode,
             const SwPosition& rNewPos,
             const sal_Int32 nOffset) =0;
 
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 5f2cf5d2bd12..f6e31d3d7d57 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -999,7 +999,7 @@ public:
 
     // Set everything in rOldNode on rNewPos + Offset.
     void CorrAbs(
-        const SwNodeIndex& rOldNode,
+        const SwNode& rOldNode,
         const SwPosition& rNewPos,
         const sal_Int32 nOffset = 0,
         bool bMoveCursor = false );
@@ -1019,7 +1019,7 @@ public:
 
     // Set everything in rOldNode to relative Pos.
     void CorrRel(
-        const SwNodeIndex& rOldNode,
+        const SwNode& rOldNode,
         const SwPosition& rNewPos,
         const sal_Int32 nOffset = 0,
         bool bMoveCursor = false );
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 2ce53a29ea9c..d751ac3d19f9 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2279,7 +2279,7 @@ bool DocumentContentOperationsManager::DelFullPara( 
SwPaM& rPam )
         // move bookmarks, redlines etc.
         if (aRg.aStart == aRg.aEnd) // only first CorrAbs variant handles this
         {
-            m_rDoc.CorrAbs( aRg.aStart, *rPam.GetPoint(), 0, true );
+            m_rDoc.CorrAbs( aRg.aStart.GetNode(), *rPam.GetPoint(), 0, true );
         }
         else
         {
@@ -2705,7 +2705,7 @@ void DocumentContentOperationsManager::MoveAndJoin( 
SwPaM& rPaM, SwPosition& rPo
     if( pTextNd && pTextNd->CanJoinNext( &aNxtIdx ) )
     {
         {   // Block so SwContentIndex into node is deleted before Join
-            m_rDoc.CorrRel( aNxtIdx,
+            m_rDoc.CorrRel( aNxtIdx.GetNode(),
                             SwPosition( *pTextNd, 
pTextNd->GetText().getLength() ),
                             0, true );
         }
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 027cc884ce08..8e2f0868c560 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -877,11 +877,11 @@ namespace sw::mark
     }
 
     void MarkManager::correctMarksAbsolute(
-        const SwNodeIndex& rOldNode,
+        const SwNode& rOldNode,
         const SwPosition& rNewPos,
         const sal_Int32 nOffset)
     {
-        const SwNode* const pOldNode = &rOldNode.GetNode();
+        const SwNode* const pOldNode = &rOldNode;
         SwPosition aNewPos(rNewPos);
         aNewPos.nContent += nOffset;
         bool isSortingNeeded = false;
@@ -922,9 +922,9 @@ namespace sw::mark
         lcl_DebugMarks(m_vAllMarks);
     }
 
-    void MarkManager::correctMarksRelative(const SwNodeIndex& rOldNode, const 
SwPosition& rNewPos, const sal_Int32 nOffset)
+    void MarkManager::correctMarksRelative(const SwNode& rOldNode, const 
SwPosition& rNewPos, const sal_Int32 nOffset)
     {
-        const SwNode* const pOldNode = &rOldNode.GetNode();
+        const SwNode* const pOldNode = &rOldNode;
         SwPosition aNewPos(rNewPos);
         aNewPos.nContent += nOffset;
         bool isSortingNeeded = false;
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index fea2385108d3..2af89d1cdf37 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -165,12 +165,12 @@ void PaMCorrAbs( const SwPaM& rRange,
     }
 }
 
-void SwDoc::CorrAbs(const SwNodeIndex& rOldNode,
+void SwDoc::CorrAbs(const SwNode& rOldNode,
     const SwPosition& rNewPos,
     const sal_Int32 nOffset,
     bool bMoveCursor)
 {
-    SwContentNode *const pContentNode( rOldNode.GetNode().GetContentNode() );
+    const SwContentNode *const pContentNode( rOldNode.GetContentNode() );
     SwPaM const aPam(rOldNode, 0,
                      rOldNode, pContentNode ? pContentNode->Len() : 0);
     SwPosition aNewPos(rNewPos);
@@ -238,11 +238,11 @@ void SwDoc::CorrAbs(
     }
 }
 
-void PaMCorrRel( const SwNodeIndex &rOldNode,
+void PaMCorrRel( const SwNode &rOldNode,
                  const SwPosition &rNewPos,
                  const sal_Int32 nOffset )
 {
-    const SwNode* pOldNode = &rOldNode.GetNode();
+    const SwNode* pOldNode = &rOldNode;
     SwPosition aNewPos( rNewPos );
     const SwDoc& rDoc = pOldNode->GetDoc();
 
@@ -302,7 +302,7 @@ void PaMCorrRel( const SwNodeIndex &rOldNode,
     }
 }
 
-void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
+void SwDoc::CorrRel(const SwNode& rOldNode,
     const SwPosition& rNewPos,
     const sal_Int32 nOffset,
     bool bMoveCursor)
@@ -315,7 +315,7 @@ void SwDoc::CorrRel(const SwNodeIndex& rOldNode,
         for(SwRangeRedline* p : rTable)
         {
             // lies on the position ??
-            lcl_PaMCorrRel1( p, &rOldNode.GetNode(), aNewPos, 
aNewPos.GetContentIndex() + nOffset );
+            lcl_PaMCorrRel1( p, &rOldNode, aNewPos, aNewPos.GetContentIndex() 
+ nOffset );
         }
 
         // To-Do - need to add here 'SwExtraRedlineTable' also ?
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 439ea42a1173..9be8bcccae63 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -414,7 +414,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
                 pOldTextNd->CutText( pTextNd, aAlphaIdx, 
SwContentIndex(pOldTextNd),
                                     pOldTextNd->Len() );
                 SwPosition aAlphaPos( aIdx, aAlphaIdx );
-                rDoc.CorrRel( rPam.GetPoint()->nNode, aAlphaPos, 0, true );
+                rDoc.CorrRel( rPam.GetPoint()->GetNode(), aAlphaPos, 0, true );
 
                 // move all Bookmarks/TOXMarks
                 if( !pContentStore->Empty() )
@@ -471,7 +471,7 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
                 }
             }
 
-            rDoc.CorrRel( aIdx, *rPam.GetPoint(), 0, true );
+            rDoc.CorrRel( aIdx.GetNode(), *rPam.GetPoint(), 0, true );
             // #i100466# adjust given <rPam>, if it does not belong to the 
cursors
             if ( pDelNd == rPam.GetBound().GetContentNode() )
             {
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index c468d526249b..e41549d75e83 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -2232,7 +2232,7 @@ bool SwDoc::MoveParagraphImpl(SwPaM& rPam, SwNodeOffset 
const nOffset,
                         pPos->Adjust(SwNodeOffset(1));
                     }
                 }
-                CorrRel( aIdx, aInsPos );
+                CorrRel( aIdx.GetNode(), aInsPos );
 
                 if (pCNd)
                     pCNd->JoinNext();
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index f6a1297fb704..a2f7d37ef581 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -1282,7 +1282,7 @@ static void lcl_UpdateLinksInSect( const SwBaseLink& 
rUpdLnk, SwSectionNode& rSe
                         pPam->Move( fnMoveBackward, GoInNode );
                         pPam->SetMark(); // Rewire both SwPositions
 
-                        pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, true );
+                        pDoc->CorrAbs( aSave.GetNode(), *pPam->GetPoint(), 0, 
true );
                         pDoc->GetNodes().Delete( aSave );
                     }
                     oCpyRg.reset();
diff --git a/sw/source/core/inc/MarkManager.hxx 
b/sw/source/core/inc/MarkManager.hxx
index 9aaf7c352e58..d362036b5464 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -60,8 +60,8 @@ namespace sw::mark {
 
             virtual void repositionMark(::sw::mark::IMark* io_pMark, const 
SwPaM& rPaM) override;
             virtual bool renameMark(::sw::mark::IMark* io_pMark, const 
OUString& rNewName) override;
-            virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, 
const SwPosition& rNewPos, const sal_Int32 nOffset) override;
-            virtual void correctMarksRelative(const SwNodeIndex& rOldNode, 
const SwPosition& rNewPos, const sal_Int32 nOffset) override;
+            virtual void correctMarksAbsolute(const SwNode& rOldNode, const 
SwPosition& rNewPos, const sal_Int32 nOffset) override;
+            virtual void correctMarksRelative(const SwNode& rOldNode, const 
SwPosition& rNewPos, const sal_Int32 nOffset) override;
 
             virtual void deleteMarks(const SwNode& rStt,
                                     const SwNode& rEnd,
diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx
index 43f996816ebb..024276b78ccd 100644
--- a/sw/source/core/inc/mvsave.hxx
+++ b/sw/source/core/inc/mvsave.hxx
@@ -151,7 +151,7 @@ void PaMCorrAbs( const SwPaM& rRange,
                  const SwPosition& rNewPos );
 
 /// Sets all PaMs in OldNode to relative Pos
-void PaMCorrRel( const SwNodeIndex &rOldNode,
+void PaMCorrRel( const SwNode &rOldNode,
                  const SwPosition &rNewPos,
                  const sal_Int32 nOffset = 0 );
 
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index ecaecb08f30f..ec9ce2f88756 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1050,7 +1050,7 @@ SwContentNode *SwTextNode::JoinNext()
         if( pTextNode->HasAnyIndex() )
         {
             // move all ShellCursor/StackCursor/UnoCursor out of delete range
-            rDoc.CorrAbs( aIdx, SwPosition( *this ), nOldLen, true );
+            rDoc.CorrAbs( aIdx.GetNode(), SwPosition( *this ), nOldLen, true );
         }
         SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
         auto eRecreateMerged(eOldMergeFlag == SwNode::Merge::First
@@ -1165,7 +1165,7 @@ void SwTextNode::JoinPrev()
         if( pTextNode->HasAnyIndex() )
         {
             // move all ShellCursor/StackCursor/UnoCursor out of delete range
-            rDoc.CorrAbs( aIdx, SwPosition( *this ), nLen, true );
+            rDoc.CorrAbs( aIdx.GetNode(), SwPosition( *this ), nLen, true );
         }
         SwNode::Merge const eOldMergeFlag(pTextNode->GetRedlineMergeFlag());
         if (eOldMergeFlag == SwNode::Merge::First
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 909860f3bb46..ea154db35016 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -153,8 +153,7 @@ void SwUndo::RemoveIdxRel( SwNodeOffset nIdx, const 
SwPosition& rPos )
 {
     // Move only the Cursor. Bookmarks/TOXMarks/etc. are done by the 
corresponding
     // JoinNext/JoinPrev
-    SwNodeIndex aIdx( rPos.GetNode().GetNodes(), nIdx );
-    ::PaMCorrRel( aIdx, rPos );
+    ::PaMCorrRel( *rPos.GetNode().GetNodes()[nIdx], rPos );
 }
 
 SwUndo::SwUndo(SwUndoId const nId, const SwDoc* pDoc)

Reply via email to