sw/inc/pam.hxx                                          |    4 +---
 sw/qa/core/macros-test.cxx                              |    2 +-
 sw/source/core/crsr/crsrsh.cxx                          |    2 +-
 sw/source/core/crsr/pam.cxx                             |   16 ++++++++--------
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    4 ++--
 sw/source/core/doc/DocumentRedlineManager.cxx           |    2 +-
 sw/source/core/doc/dbgoutsw.cxx                         |    2 +-
 sw/source/core/doc/docedt.cxx                           |    8 ++++----
 sw/source/core/edit/eddel.cxx                           |    4 ++--
 sw/source/core/layout/fly.cxx                           |    2 +-
 sw/source/core/txtnode/ndtxt.cxx                        |    2 +-
 sw/source/core/undo/undobj.cxx                          |    2 +-
 sw/source/core/undo/unins.cxx                           |    2 +-
 sw/source/filter/xml/swxml.cxx                          |    4 ++--
 14 files changed, 27 insertions(+), 29 deletions(-)

New commits:
commit e49156aff90861cb5e488bab5e83cb7a00f109df
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Aug 1 10:52:49 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 2 21:38:43 2022 +0200

    introduce SwPosition::GetContentNode
    
    as part of the process of hiding the internals of SwPosition
    
    largely done by doing:
    git grep -lF 'nContent.GetContentNode' | xargs perl -pi -e
                's/\bnContent\.GetContentNode/GetContentNode/g'
    
    Change-Id: I50bcde481a4a2785062b974fb81465a401b0a3e6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137700
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index c8ff813893d4..fef6206cb95e 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -72,14 +72,12 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
 
 
     SwNodeOffset GetNodeIndex() const { return nNode.GetIndex(); }
-
-    // Gets pointer on NodesArray.
     const SwNodes& GetNodes() const { return nNode.GetNodes(); }
     SwNodes& GetNodes() { return nNode.GetNodes(); }
-
     SwNode& GetNode() const { return nNode.GetNode(); }
 
 
+    const SwContentNode* GetContentNode() const { return 
nContent.GetContentNode(); }
     sal_Int32 GetContentIndex() const { return nContent.GetIndex(); }
     void SetMark(const sw::mark::IMark* pMark) { nContent.SetMark(pMark); }
     void SetRedline(SwRangeRedline* pRangeRedline) { 
nContent.SetRedline(pRangeRedline); }
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx
index 8d768a24ee1c..02d097a2a8bb 100644
--- a/sw/qa/core/macros-test.cxx
+++ b/sw/qa/core/macros-test.cxx
@@ -199,7 +199,7 @@ void SwMacrosTest::testBookmarkDeleteAndJoin()
     for (IDocumentMarkAccess::const_iterator_t i = rIDMA.getAllMarksBegin(); i 
!= rIDMA.getAllMarksEnd(); ++i)
     {
         // problem was that the nContent was pointing at deleted node
-        CPPUNIT_ASSERT_EQUAL((*i)->GetMarkStart().nContent.GetContentNode(),
+        CPPUNIT_ASSERT_EQUAL((*i)->GetMarkStart().GetContentNode(),
             static_cast<const 
SwContentNode*>((*i)->GetMarkStart().GetNode().GetContentNode()));
     }
 }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index f32d0a40ace9..e415a6c7fdc3 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3589,7 +3589,7 @@ static const SwStartNode* lcl_NodeContext( const SwNode& 
rNode )
 bool sw_PosOk(const SwPosition & aPos)
 {
     return nullptr != aPos.GetNode().GetContentNode() &&
-           aPos.nContent.GetContentNode();
+           aPos.GetContentNode();
 }
 
 /**
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 0698b3f6d3a6..9a37b1867587 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -106,8 +106,8 @@ bool SwPosition::operator<(const SwPosition &rPos) const
     {
         // note that positions with text node but no SwContentIndex registered 
are
         // created for text frames anchored at para (see SwXFrame::getAnchor())
-        SwContentNode const*const pThisReg(nContent.GetContentNode());
-        SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+        SwContentNode const*const pThisReg(GetContentNode());
+        SwContentNode const*const pOtherReg(rPos.GetContentNode());
         if (pThisReg && pOtherReg)
         {
             return (nContent < rPos.nContent);
@@ -127,8 +127,8 @@ bool SwPosition::operator>(const SwPosition &rPos) const
     {
         // note that positions with text node but no SwContentIndex registered 
are
         // created for text frames anchored at para (see SwXFrame::getAnchor())
-        SwContentNode const*const pThisReg(nContent.GetContentNode());
-        SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+        SwContentNode const*const pThisReg(GetContentNode());
+        SwContentNode const*const pOtherReg(rPos.GetContentNode());
         if (pThisReg && pOtherReg)
         {
             return (nContent > rPos.nContent);
@@ -148,8 +148,8 @@ bool SwPosition::operator<=(const SwPosition &rPos) const
     {
         // note that positions with text node but no SwContentIndex registered 
are
         // created for text frames anchored at para (see SwXFrame::getAnchor())
-        SwContentNode const*const pThisReg(nContent.GetContentNode());
-        SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+        SwContentNode const*const pThisReg(GetContentNode());
+        SwContentNode const*const pOtherReg(rPos.GetContentNode());
         if (pThisReg && pOtherReg)
         {
             return (nContent <= rPos.nContent);
@@ -169,8 +169,8 @@ bool SwPosition::operator>=(const SwPosition &rPos) const
     {
         // note that positions with text node but no SwContentIndex registered 
are
         // created for text frames anchored at para (see SwXFrame::getAnchor())
-        SwContentNode const*const pThisReg(nContent.GetContentNode());
-        SwContentNode const*const pOtherReg(rPos.nContent.GetContentNode());
+        SwContentNode const*const pThisReg(GetContentNode());
+        SwContentNode const*const pOtherReg(rPos.GetContentNode());
         if (pThisReg && pOtherReg)
         {
             return (nContent >= rPos.nContent);
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx 
b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 19aa8c27accc..6dfb312fefa9 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2420,7 +2420,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
         SwTextNode * pOrigNode = pTNd;
         assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
                *aSavePam.GetPoint() == rPos);
-        assert(aSavePam.GetPoint()->nContent.GetContentNode() == pOrigNode);
+        assert(aSavePam.GetPoint()->GetContentNode() == pOrigNode);
         assert(aSavePam.GetPoint()->nNode == rPos.GetNodeIndex());
         assert(rPos.GetNodeIndex() == pOrigNode->GetIndex());
 
@@ -2446,7 +2446,7 @@ bool DocumentContentOperationsManager::MoveRange( SwPaM& 
rPaM, SwPosition& rPos,
         //truncated node
         assert(*aSavePam.GetPoint() == *aSavePam.GetMark() &&
                *aSavePam.GetPoint() == rPos);
-        assert(aSavePam.GetPoint()->nContent.GetContentNode() == pOrigNode);
+        assert(aSavePam.GetPoint()->GetContentNode() == pOrigNode);
         assert(aSavePam.GetPoint()->nNode == rPos.GetNodeIndex());
         assert(rPos.GetNodeIndex() == pOrigNode->GetIndex());
         aSavePam.GetPoint()->nContent.Assign(pOrigNode, 0);
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index edf51f8eb0cc..ce9ff1be6d04 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -54,7 +54,7 @@ using namespace com::sun::star;
         void lcl_CheckPosition( const SwPosition* pPos )
         {
             assert(dynamic_cast<SwContentIndexReg*>(&pPos->GetNode())
-                    == pPos->nContent.GetContentNode());
+                    == pPos->GetContentNode());
 
             SwTextNode* pTextNode = pPos->GetNode().GetTextNode();
             if( pTextNode == nullptr )
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 3d84c57c4a12..9139da0996e1 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -321,7 +321,7 @@ static OUString lcl_dbg_out(const SwPosition & rPos)
         ", " +
         OUString::number(rPos.GetContentIndex()) +
         ": " +
-        
OUString::number(reinterpret_cast<sal_IntPtr>(rPos.nContent.GetContentNode()), 
16) +
+        OUString::number(reinterpret_cast<sal_IntPtr>(rPos.GetContentNode()), 
16) +
         " )";
 
     return aStr;
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 0ae0092bae49..3273cabe3332 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -426,9 +426,9 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
 
                 // If the passed PaM is not in the Cursor ring,
                 // treat it separately (e.g. when it's being called from 
AutoFormat)
-                if( pOldTextNd == rPam.GetBound().nContent.GetContentNode() )
+                if( pOldTextNd == rPam.GetBound().GetContentNode() )
                     rPam.GetBound() = aAlphaPos;
-                if( pOldTextNd == rPam.GetBound( false 
).nContent.GetContentNode() )
+                if( pOldTextNd == rPam.GetBound( false ).GetContentNode() )
                     rPam.GetBound( false ) = aAlphaPos;
             }
             // delete the Node, at last!
@@ -477,11 +477,11 @@ bool sw_JoinText( SwPaM& rPam, bool bJoinPrev )
 
             rDoc.CorrRel( aIdx, *rPam.GetPoint(), 0, true );
             // #i100466# adjust given <rPam>, if it does not belong to the 
cursors
-            if ( pDelNd == rPam.GetBound().nContent.GetContentNode() )
+            if ( pDelNd == rPam.GetBound().GetContentNode() )
             {
                 rPam.GetBound() = SwPosition( *pTextNd );
             }
-            if( pDelNd == rPam.GetBound( false ).nContent.GetContentNode() )
+            if( pDelNd == rPam.GetBound( false ).GetContentNode() )
             {
                 rPam.GetBound( false ) = SwPosition( *pTextNd );
             }
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index bc5356844665..3dbb4ef5d963 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -288,9 +288,9 @@ bool SwEditShell::Copy( SwEditShell& rDestShell )
     {
         for(SwPaM& rCmp : rDestShell.GetCursor()->GetRingContainer())
         {
-            OSL_ENSURE( rCmp.GetPoint()->nContent.GetContentNode()
+            OSL_ENSURE( rCmp.GetPoint()->GetContentNode()
                         == rCmp.GetContentNode(), "Point in wrong Node" );
-            OSL_ENSURE( rCmp.GetMark()->nContent.GetContentNode()
+            OSL_ENSURE( rCmp.GetMark()->GetContentNode()
                         == rCmp.GetContentNode(false), "Mark in wrong Node" );
         }
     }
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index fafe780d16f3..089d1e40e2fc 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -386,7 +386,7 @@ static SwPosition ResolveFlyAnchor(SwFrameFormat const& 
rFlyFrame)
         {
             return ResolveFlyAnchor(*pParent);
         }
-        else if (pPos->nContent.GetContentNode())
+        else if (pPos->GetContentNode())
         {
             return *pPos;
         }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 3f9439ad42df..1a18a1cdcbf2 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1447,7 +1447,7 @@ void SwTextNode::Update(
                 // the unused position must not be on a SwTextNode
                 bool const isOneUsed(&pRedl->GetBound() == pRedl->GetPoint());
                 assert(!pRedl->GetBound(!isOneUsed).GetNode().IsTextNode());
-                
assert(!pRedl->GetBound(!isOneUsed).nContent.GetContentNode()); (void)isOneUsed;
+                assert(!pRedl->GetBound(!isOneUsed).GetContentNode()); 
(void)isOneUsed;
             }
         }
 
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 10aab77a09e1..0cb620362a36 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -1566,7 +1566,7 @@ static bool IsAtEndOfSection(SwPosition const& rAnchorPos)
     assert(rAnchorPos.nNode <= node); // last valid anchor pos is last content
     return node == rAnchorPos.nNode
         // at-para fly has no SwContentIndex!
-        && (rAnchorPos.nContent == pNode->Len() || 
rAnchorPos.nContent.GetContentNode() == nullptr);
+        && (rAnchorPos.nContent == pNode->Len() || rAnchorPos.GetContentNode() 
== nullptr);
 }
 
 static bool IsAtStartOfSection(SwPosition const& rAnchorPos)
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index fc8aea7d2c2d..c03304e03b65 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -162,7 +162,7 @@ bool SwUndoInsert::CanGrouping( const SwPosition& rPos )
             if( !rTable.empty() )
             {
                 SwRedlineData aRData( RedlineType::Insert, 
rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
-                const SwContentNode* pIReg = rPos.nContent.GetContentNode();
+                const SwContentNode* pIReg = rPos.GetContentNode();
                 for(SwRangeRedline* pRedl : rTable)
                 {
                     SwContentIndex* pIdx = &pRedl->End()->nContent;
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 88dd11070e01..aaf206016603 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -93,7 +93,7 @@ static void lcl_EnsureValidPam( SwPaM& rPam )
     if( rPam.GetContentNode() != nullptr )
     {
         // set proper point content
-        if( rPam.GetContentNode() != 
rPam.GetPoint()->nContent.GetContentNode() )
+        if( rPam.GetContentNode() != rPam.GetPoint()->GetContentNode() )
         {
             rPam.GetPoint()->nContent.Assign( rPam.GetContentNode(), 0 );
         }
@@ -101,7 +101,7 @@ static void lcl_EnsureValidPam( SwPaM& rPam )
 
         // if mark is invalid, we delete it
         if( ( rPam.GetContentNode( false ) == nullptr ) ||
-            ( rPam.GetContentNode( false ) != 
rPam.GetMark()->nContent.GetContentNode() ) )
+            ( rPam.GetContentNode( false ) != rPam.GetMark()->GetContentNode() 
) )
         {
             rPam.DeleteMark();
         }

Reply via email to