sw/source/filter/basflt/fltshell.cxx   |    2 +-
 sw/source/filter/basflt/shellio.cxx    |   10 +++-------
 sw/source/filter/docx/swdocxreader.cxx |   28 ++++++++++++----------------
 3 files changed, 16 insertions(+), 24 deletions(-)

New commits:
commit 58931af8d567c532a27f548bdbbde75a203b0c17
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Aug 26 09:45:04 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 26 11:16:44 2022 +0200

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

diff --git a/sw/source/filter/basflt/fltshell.cxx 
b/sw/source/filter/basflt/fltshell.cxx
index 0c4dde61b69f..ead53b0efe8e 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -608,7 +608,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& 
rTmpPos,
                             // Adjust the start of the range to actually cover 
the comment, similar
                             // to what the UI and the UNO API does.
                             aRegion.SetMark();
-                            --aRegion.Start()->nContent;
+                            aRegion.Start()->AdjustContent(-1);
                         }
 
                         
m_rDoc.getIDocumentMarkAccess()->makeAnnotationMark(aRegion, OUString());
diff --git a/sw/source/filter/basflt/shellio.cxx 
b/sw/source/filter/basflt/shellio.cxx
index cf45397a58de..9ffb0f253886 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -203,13 +203,12 @@ ErrCode SwReader::Read( const Reader& rOptions )
             if( !pCNd && nullptr == ( pCNd = SwNodes::GoPrevious( &aEndPos ) ))
                 pCNd = mxDoc->GetNodes().GoNext( &aEndPos );
 
-            pPam->GetPoint()->nNode = aEndPos;
             const sal_Int32 nLen = pCNd->Len();
             if( nLen < nEndContent )
                 nEndContent = 0;
             else
                 nEndContent = nLen - nEndContent;
-            pPam->GetPoint()->nContent.Assign( pCNd, nEndContent );
+            pPam->GetPoint()->Assign( *pCNd, nEndContent );
 
             const SwStartNode* pTableBoxStart = pCNd->FindTableBoxStartNode();
             if ( pTableBoxStart )
@@ -225,13 +224,10 @@ ErrCode SwReader::Read( const Reader& rOptions )
         if( mpCursor )
         {
             *pUndoPam->GetMark() = *pPam->GetPoint();
-            ++pUndoPam->GetPoint()->nNode;
+            pUndoPam->GetPoint()->Adjust(SwNodeOffset(1));
             SwNode& rNd = pUndoPam->GetPointNode();
             if( rNd.IsContentNode() )
-                pUndoPam->GetPoint()->nContent.Assign(
-                                    static_cast<SwContentNode*>(&rNd), 
nSttContent );
-            else
-                pUndoPam->GetPoint()->nContent.Assign( nullptr, 0 );
+                pUndoPam->GetPoint()->SetContent( nSttContent );
 
             bool bChkHeaderFooter = rNd.FindHeaderStartNode() ||
                                    rNd.FindFooterStartNode();
diff --git a/sw/source/filter/docx/swdocxreader.cxx 
b/sw/source/filter/docx/swdocxreader.cxx
index 4e71a7fd7f85..1fc6b563ef9f 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -182,34 +182,30 @@ bool SwDOCXReader::MakeEntries( SwDoc *pD, SwTextBlocks 
&rBlocks )
             // Get content
             SwPaM aPam( aStart );
             {
-                SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
-                ++rIdx;
-                pCNd = rIdx.GetNode().GetTextNode();
+                SwNodeIndex aIdx( aPam.GetPoint()->GetNode(), SwNodeOffset(1) 
);
+                pCNd = aIdx.GetNode().GetTextNode();
                 if( nullptr == pCNd )
                 {
-                    pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl 
);
-                    rIdx = *pCNd;
+                    pCNd = pD->GetNodes().MakeTextNode( aIdx.GetNode(), pColl 
);
                 }
             }
 
-            aPam.GetPoint()->nContent.Assign( pCNd, 0 );
+            aPam.GetPoint()->Assign( *pCNd );
             aPam.SetMark();
             {
-                SwNodeIndex& rIdx = aPam.GetPoint()->nNode;
-                rIdx = aStart.GetNode().EndOfSectionIndex() - 1;
+                SwNodeIndex aIdx( *aStart.GetNode().EndOfSectionNode(), 
SwNodeOffset(-1) );
                 // don't add extra empty text node if exist (.dotx but not 
.dotm)
-                if( rIdx.GetNode().GetTextNode() &&
-                    rIdx.GetNode().GetTextNode()->GetText().isEmpty() )
-                    rIdx = aStart.GetNode().EndOfSectionIndex() - 2;
-                pCNd = rIdx.GetNode().GetContentNode();
+                if( aIdx.GetNode().GetTextNode() &&
+                    aIdx.GetNode().GetTextNode()->GetText().isEmpty() )
+                    aIdx = aStart.GetNode().EndOfSectionIndex() - 2;
+                pCNd = aIdx.GetNode().GetContentNode();
                 if( nullptr == pCNd )
                 {
-                    ++rIdx;
-                    pCNd = pD->GetNodes().MakeTextNode( rIdx.GetNode(), pColl 
);
-                    rIdx = *pCNd;
+                    ++aIdx;
+                    pCNd = pD->GetNodes().MakeTextNode( aIdx.GetNode(), pColl 
);
                 }
             }
-            aPam.GetPoint()->nContent.Assign( pCNd, pCNd->Len() );
+            aPam.GetPoint()->Assign( *pCNd, pCNd->Len() );
 
             if( bIsAutoText )
             {

Reply via email to