sw/inc/node.hxx                 |    1 +
 sw/source/core/doc/docruby.cxx  |    2 +-
 sw/source/core/docnode/node.cxx |    9 +++++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 0c6c95b545b6d4bced699e6f7d9e1d9c679b893e
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Sep 22 15:44:01 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Sep 23 08:02:39 2022 +0200

    add a new SwContentNode::GoNext variant
    
    that takes a SwPosition and keeps the nNode and nContent fields there in
    sync.
    this is part of the process of hiding the internals of SwPosition.
    
    Change-Id: I1996e588703ca2400fa84e979c72cc5382e5b700
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140435
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 68a33263124f..e6176ce5b91b 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -415,6 +415,7 @@ public:
     void MakeEndIndex( SwContentIndex * pIdx )     { pIdx->Assign( this, Len() 
); }
 
     bool GoNext(SwContentIndex *, SwCursorSkipMode nMode ) const;
+    bool GoNext(SwPosition*, SwCursorSkipMode nMode ) const;
     bool GoPrevious(SwContentIndex *, SwCursorSkipMode nMode ) const;
 
     /// @see GetFrameOfModify
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 07c11097f81c..1a1b84ffd7f4 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -303,7 +303,7 @@ bool SwDoc::SelectNextRubyChars( SwPaM& rPam, 
SwRubyListEntry& rEntry )
                     nWordEnd = nEnd;
             }
         }
-        pTNd->GoNext( &pPos->nContent, SwCursorSkipMode::Chars );
+        pTNd->GoNext( pPos, SwCursorSkipMode::Chars );
         nStart = pPos->GetContentIndex();
     }
 
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 04d9e3f354bd..34586965475a 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1284,6 +1284,15 @@ SwFormatColl *SwContentNode::ChgFormatColl( SwFormatColl 
*pNewColl )
     return pOldColl;
 }
 
+bool SwContentNode::GoNext(SwPosition* pPos, SwCursorSkipMode nMode ) const
+{
+    if (!GoNext(&pPos->nContent, nMode))
+        return false;
+    if (pPos->nContent.GetContentNode() != &pPos->GetNode())
+        pPos->nNode.Assign(*pPos->nContent.GetContentNode());
+    return true;
+}
+
 bool SwContentNode::GoNext(SwContentIndex * pIdx, SwCursorSkipMode nMode ) 
const
 {
     bool bRet = true;

Reply via email to