sw/source/core/crsr/swcrsr.cxx                |    2 +-
 sw/source/core/doc/DocumentRedlineManager.cxx |   10 +++++-----
 sw/source/core/doc/docbm.cxx                  |   13 +++++++------
 sw/source/core/doc/textboxhelper.cxx          |   14 ++------------
 sw/source/core/layout/frmtool.cxx             |    2 +-
 sw/source/filter/ww8/wrtww8.cxx               |    2 +-
 6 files changed, 17 insertions(+), 26 deletions(-)

New commits:
commit 390c7b97ad674a8281735980120733a48e5d89a3
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Aug 19 10:32:42 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 19 13:39:00 2022 +0200

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

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 884d9f7fedd3..b888a062e516 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1500,7 +1500,7 @@ bool SwCursor::SelectWordWT( SwViewShell const * 
pViewShell, sal_Int16 nWordType
                         // if it covers only the word: in that case we select
                         // the comment anchor as well.
                         bool bStartMatch = GetMark()->GetNode() == 
pAnnotationMark->GetMarkStart().GetNode() &&
-                            GetMark()->nContent == 
pAnnotationMark->GetMarkStart().nContent;
+                            GetMark()->GetContentIndex() == 
pAnnotationMark->GetMarkStart().GetContentIndex();
                         bool bEndMatch = GetPoint()->GetNode() == 
pAnnotationMark->GetMarkEnd().GetNode() &&
                             GetPoint()->GetContentIndex() + 1 == 
pAnnotationMark->GetMarkEnd().GetContentIndex();
                         if (bStartMatch && bEndMatch)
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx 
b/sw/source/core/doc/DocumentRedlineManager.cxx
index 01e780c1d265..6670aca270ed 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1303,7 +1303,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
         }
         else
         {
-            if( pStt->nContent > pTextNode->Len() )
+            if( pStt->GetContentIndex() > pTextNode->Len() )
             {
                 OSL_ENSURE( false, "Redline start: index after text" );
                 pStt->nContent = pTextNode->Len();
@@ -1312,7 +1312,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
         pTextNode = pEnd->GetNode().GetTextNode();
         if( pTextNode == nullptr )
         {
-            if( pEnd->nContent > 0 )
+            if( pEnd->GetContentIndex() > 0 )
             {
                 OSL_ENSURE( false, "Redline end: non-text-node with content" );
                 pEnd->nContent = 0;
@@ -1320,7 +1320,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
         }
         else
         {
-            if( pEnd->nContent > pTextNode->Len() )
+            if( pEnd->GetContentIndex() > pTextNode->Len() )
             {
                 OSL_ENSURE( false, "Redline end: index after text" );
                 pEnd->nContent = pTextNode->Len();
@@ -1678,7 +1678,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
                     break;
 
                 case SwComparePosition::CollideEnd:
-                    if (pRStt->nContent != 0)
+                    if (pRStt->GetContentIndex() != 0)
                     {   // tdf#147466 HACK: don't combine in this case to 
avoid the tdf#119571 code from *undeleting* section nodes
                         break;
                     }
@@ -2230,7 +2230,7 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* 
pNewRedl, bool const bCall
         {
             if ( bCallDelete && RedlineType::Delete == pNewRedl->GetType() )
             {
-                if ( pStt->nContent != 0 )
+                if ( pStt->GetContentIndex() != 0 )
                 {
                     // tdf#119571 update the style of the joined paragraph
                     // after a partially deleted paragraph to show its correct 
style
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 2da73745fb2f..52461872b6e0 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -190,7 +190,7 @@ namespace
         return oContentIdx.has_value()
                ? ( rPos.GetNode() > rNdIdx
                    || ( rPos.GetNode() == rNdIdx
-                        && rPos.nContent >= *oContentIdx ) )
+                        && rPos.GetContentIndex() >= *oContentIdx ) )
                : rPos.GetNode() >= rNdIdx;
     }
 
@@ -199,7 +199,7 @@ namespace
         return rPos.GetNode() < rNdIdx
                || ( oContentIdx.has_value()
                     && rPos.GetNode() == rNdIdx
-                    && rPos.nContent < *oContentIdx );
+                    && rPos.GetContentIndex() < *oContentIdx );
     }
 
     bool lcl_MarkOrderingByStart(const ::sw::mark::MarkBase *const pFirst,
@@ -998,11 +998,11 @@ namespace sw::mark
         if ( oEndContentIdx.has_value()
              && ( ( rbIsOtherPosInRange
                     && pMark->GetMarkPos().GetNode() == rEnd
-                    && pMark->GetMarkPos().nContent == *oEndContentIdx )
+                    && pMark->GetMarkPos().GetContentIndex() == 
*oEndContentIdx )
                   || ( rbIsPosInRange
                        && pMark->IsExpanded()
                        && pMark->GetOtherMarkPos().GetNode() == rEnd
-                       && pMark->GetOtherMarkPos().nContent == *oEndContentIdx 
) ) )
+                       && pMark->GetOtherMarkPos().GetContentIndex() == 
*oEndContentIdx ) ) )
         {
             rbIsPosInRange = true;
             rbIsOtherPosInRange = true;
@@ -1029,7 +1029,7 @@ namespace sw::mark
                                   || pMark->IsExpanded()
                                   || !oStartContentIdx.has_value()
                                   || pMark->GetMarkPos().nNode != rStt
-                                  || pMark->GetMarkPos().nContent != 
*oStartContentIdx;
+                                  || pMark->GetMarkPos().GetContentIndex() != 
*oStartContentIdx;
                     break;
                 default:
                     bDeleteMark = true;
@@ -1782,7 +1782,8 @@ namespace
 {
     bool lcl_Greater( const SwPosition& rPos, const SwNode& rNdIdx, 
std::optional<sal_Int32> oContentIdx )
     {
-        return rPos.GetNode() > rNdIdx || ( oContentIdx && rPos.GetNode() == 
rNdIdx && rPos.nContent > *oContentIdx );
+        return rPos.GetNode() > rNdIdx ||
+                ( oContentIdx && rPos.GetNode() == rNdIdx && 
rPos.GetContentIndex() > *oContentIdx );
     }
 }
 
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index ad74f855d01f..909d818c54cd 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1638,12 +1638,7 @@ bool SwTextBoxHelper::isAnchorSyncNeeded(const 
SwFrameFormat* pFirst, const SwFr
         {
             if (rShapeAnchor.GetContentAnchor() && 
rFrameAnchor.GetContentAnchor())
             {
-                if (rShapeAnchor.GetContentAnchor()->nContent
-                    != rFrameAnchor.GetContentAnchor()->nContent)
-                    return true;
-
-                if (rShapeAnchor.GetContentAnchor()->nNode
-                    != rFrameAnchor.GetContentAnchor()->nNode)
+                if (*rShapeAnchor.GetContentAnchor() != 
*rFrameAnchor.GetContentAnchor())
                     return true;
 
                 return false;
@@ -1666,12 +1661,7 @@ bool SwTextBoxHelper::isAnchorSyncNeeded(const 
SwFrameFormat* pFirst, const SwFr
         {
             if (rShapeAnchor.GetContentAnchor() && 
rFrameAnchor.GetContentAnchor())
             {
-                if (rShapeAnchor.GetContentAnchor()->nContent
-                    != rFrameAnchor.GetContentAnchor()->nContent)
-                    return true;
-
-                if (rShapeAnchor.GetContentAnchor()->nNode
-                    != rFrameAnchor.GetContentAnchor()->nNode)
+                if (*rShapeAnchor.GetContentAnchor() != 
*rFrameAnchor.GetContentAnchor())
                     return true;
 
                 return false;
diff --git a/sw/source/core/layout/frmtool.cxx 
b/sw/source/core/layout/frmtool.cxx
index cb16a9f59deb..c9ec9c9a2de8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -1337,7 +1337,7 @@ bool IsAnchoredObjShown(SwTextFrame const& rFrame, 
SwFormatAnchor const& rAnchor
         {
             ret = (&pAnchor->GetNode() == pMergedPara->pFirstNode
                     && (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
-                        || pAnchor->nContent == 0))
+                        || pAnchor->GetContentIndex() == 0))
                 || (&pAnchor->GetNode() == pMergedPara->pLastNode
                     && (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA
                         || pAnchor->GetContentIndex() == 
pMergedPara->pLastNode->Len()));
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 50db68474cf1..d2eb7a99e95c 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1436,7 +1436,7 @@ void WW8Export::AppendBookmarks( const SwTextNode& rNd, 
sal_Int32 nCurrentPos, s
         if(rBkmk.IsExpanded())
             pOPos = &rBkmk.GetOtherMarkPos();
         if( pOPos && pOPos->GetNode() == pPos->GetNode() &&
-            pOPos->nContent < pPos->nContent )
+            pOPos->GetContentIndex() < pPos->GetContentIndex() )
         {
             pPos = pOPos;
             pOPos = &rBkmk.GetMarkPos();

Reply via email to