sw/source/core/unocore/unobkm.cxx        |    4 +--
 sw/source/core/unocore/unochart.cxx      |    6 ++---
 sw/source/core/unocore/unocrsr.cxx       |   34 +++++++++++++++----------------
 sw/source/core/unocore/unocrsrhelper.cxx |    6 ++---
 sw/source/core/unocore/unoobj2.cxx       |    4 +--
 sw/source/core/unocore/unoparagraph.cxx  |    4 +--
 6 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 7f322d29bed638cfc19a7eed6bb22a70ec762c51
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Aug 26 10:44:27 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Aug 26 18:05:02 2022 +0200

    use more SwPosition::Assign
    
    as part of the process of hiding the internals of SwPosition
    
    Change-Id: I90e950897a079823820bbb8849c68548f1698df6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138873
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/core/unocore/unobkm.cxx 
b/sw/source/core/unocore/unobkm.cxx
index 41170b0be66c..248d1fc820ad 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -822,7 +822,7 @@ SwXFieldmark::GetCommand(IFieldmark const& rMark)
 {
     SwPosition const sepPos(sw::mark::FindFieldSep(rMark));
     SwPosition start(rMark.GetMarkStart());
-    ++start.nContent;
+    start.AdjustContent(1);
     return SwXTextRange::CreateXTextRange(*GetDoc(), start, &sepPos);
 }
 
@@ -830,7 +830,7 @@ uno::Reference<text::XTextRange>
 SwXFieldmark::GetResult(IFieldmark const& rMark)
 {
     SwPosition sepPos(sw::mark::FindFieldSep(rMark));
-    ++sepPos.nContent;
+    sepPos.AdjustContent(1);
     SwPosition const& rEnd(rMark.GetMarkEnd());
     return SwXTextRange::CreateXTextRange(*GetDoc(), sepPos, &rEnd);
 }
diff --git a/sw/source/core/unocore/unochart.cxx 
b/sw/source/core/unocore/unochart.cxx
index 18ad4c75b316..dfbe2a78c44a 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -393,7 +393,7 @@ static void GetFormatAndCreateCursorFromRangeRep(
             if(pBRBox)
             {
                 pUnoCursor->SetMark();
-                pUnoCursor->GetPoint()->nNode = *pBRBox->GetSttNd();
+                pUnoCursor->GetPoint()->Assign( *pBRBox->GetSttNd() );
                 pUnoCursor->Move( fnMoveForward, GoInNode );
                 SwUnoTableCursor& rCursor =
                     dynamic_cast<SwUnoTableCursor&>(*pUnoCursor);
@@ -2501,8 +2501,8 @@ void SwChartDataSequence::ExtendTo( bool bExtendCol,
         const SwTableBox *pNewStartBox = pTable->GetTableBox( aNewStartCell );
         const SwTableBox *pNewEndBox   = pTable->GetTableBox( aNewEndCell );
         pUnoTableCursor->SetMark();
-        pUnoTableCursor->GetPoint()->nNode = *pNewEndBox->GetSttNd();
-        pUnoTableCursor->GetMark()->nNode  = *pNewStartBox->GetSttNd();
+        pUnoTableCursor->GetPoint()->Assign( *pNewEndBox->GetSttNd() );
+        pUnoTableCursor->GetMark()->Assign( *pNewStartBox->GetSttNd() );
         pUnoTableCursor->Move( fnMoveForward, GoInNode );
         pUnoTableCursor->MakeBoxSels();
     }
diff --git a/sw/source/core/unocore/unocrsr.cxx 
b/sw/source/core/unocore/unocrsr.cxx
index 5b0e3f0865f5..ef86e56ff806 100644
--- a/sw/source/core/unocore/unocrsr.cxx
+++ b/sw/source/core/unocore/unocrsr.cxx
@@ -71,12 +71,12 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
     {
         SwDoc& rDoc = GetDoc();
         SwNodeIndex aOldIdx( *rDoc.GetNodes()[ GetSavePos()->nNode ] );
-        SwNodeIndex& rPtIdx = GetPoint()->nNode;
+        SwPosition& rPtPos = *GetPoint();
         SwStartNode *pOldSttNd = aOldIdx.GetNode().StartOfSectionNode(),
-                    *pNewSttNd = rPtIdx.GetNode().StartOfSectionNode();
+                    *pNewSttNd = rPtPos.GetNode().StartOfSectionNode();
         if( pOldSttNd != pNewSttNd )
         {
-            bool bMoveDown = GetSavePos()->nNode < rPtIdx.GetIndex();
+            bool bMoveDown = GetSavePos()->nNode < rPtPos.GetNodeIndex();
             bool bValidPos = false;
 
             // search the correct surrounded start node - which the index
@@ -85,15 +85,15 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
                 pOldSttNd = pOldSttNd->StartOfSectionNode();
 
             // is the new index inside this surrounded section?
-            if( rPtIdx > *pOldSttNd &&
-                rPtIdx < pOldSttNd->EndOfSectionIndex() )
+            if( rPtPos.GetNode() > *pOldSttNd &&
+                rPtPos.GetNode() < *pOldSttNd->EndOfSectionNode() )
             {
                 // check if it a valid move inside this section
                 // (only over SwSection's !)
                 const SwStartNode* pInvalidNode;
                 do {
                     pInvalidNode = nullptr;
-                    pNewSttNd = rPtIdx.GetNode().StartOfSectionNode();
+                    pNewSttNd = rPtPos.GetNode().StartOfSectionNode();
 
                     const SwStartNode *pSttNd = pNewSttNd, *pEndNd = pOldSttNd;
                     if( pSttNd->EndOfSectionIndex() >
@@ -113,20 +113,20 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
                     {
                         if( bMoveDown )
                         {
-                            rPtIdx.Assign( *pInvalidNode->EndOfSectionNode(), 
1 );
+                            rPtPos.Assign( *pInvalidNode->EndOfSectionNode(), 
1 );
 
-                            if( !rPtIdx.GetNode().IsContentNode() &&
-                                ( !rDoc.GetNodes().GoNextSection( &rPtIdx ) ||
-                                  rPtIdx > pOldSttNd->EndOfSectionIndex() ) )
+                            if( !rPtPos.GetNode().IsContentNode() &&
+                                ( !rDoc.GetNodes().GoNextSection( &rPtPos ) ||
+                                  rPtPos.GetNode() > 
*pOldSttNd->EndOfSectionNode() ) )
                                 break;
                         }
                         else
                         {
-                            rPtIdx.Assign( *pInvalidNode, -1 );
+                            rPtPos.Assign( *pInvalidNode, -1 );
 
-                            if( !rPtIdx.GetNode().IsContentNode() &&
-                                ( !SwNodes::GoPrevSection( &rPtIdx ) ||
-                                  rPtIdx < *pOldSttNd ) )
+                            if( !rPtPos.GetNode().IsContentNode() &&
+                                ( !SwNodes::GoPrevSection( &rPtPos ) ||
+                                  rPtPos.GetNode() < *pOldSttNd ) )
                                 break;
                         }
                     }
@@ -138,12 +138,12 @@ bool SwUnoCursor::IsSelOvr( SwCursorSelOverFlags eFlags )
             if( bValidPos )
             {
                 SwContentNode* pCNd = GetPointContentNode();
-                GetPoint()->nContent.Assign( pCNd, (pCNd && !bMoveDown) ? 
pCNd->Len() : 0);
+                GetPoint()->SetContent( (pCNd && !bMoveDown) ? pCNd->Len() : 
0);
             }
             else
             {
-                rPtIdx = GetSavePos()->nNode;
-                GetPoint()->nContent.Assign( GetPointContentNode(), 
GetSavePos()->nContent );
+                rPtPos.Assign( GetSavePos()->nNode );
+                GetPoint()->SetContent( GetSavePos()->nContent );
                 return true;
             }
         }
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index dbd944334f5e..2148b6cfb3fb 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -1154,12 +1154,12 @@ void InsertFile(SwUnoCursor* pUnoCursor, const 
OUString& rURL,
     {
         ++aSave;
         pUnoCursor->SetMark();
-        pUnoCursor->GetMark()->nNode = aSave;
+        pUnoCursor->GetMark()->Assign( aSave );
 
         SwContentNode* pCntNode = aSave.GetNode().GetContentNode();
         if( !pCntNode )
             nContent = 0;
-        pUnoCursor->GetMark()->nContent.Assign( pCntNode, nContent );
+        pUnoCursor->GetMark()->SetContent( nContent );
     }
 }
 
@@ -1452,7 +1452,7 @@ void makeTableRowRedline( SwTableLine& rTableLine,
             pDoc->getIDocumentContentOperations().InsertString( aPaM,
                     OUStringChar(CH_TXT_TRACKED_DUMMY_CHAR) );
             aPaM.SetMark();
-            aPaM.GetMark()->nContent.Assign(aPaM.GetPointContentNode(), 0);
+            aPaM.GetMark()->SetContent(0);
             makeRedline(aPaM, RedlineType::TableRowInsert == eType
                     ? u"Insert"
                     : u"Delete", rRedlineProperties);
diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index cec097c7faba..9faa447cda10 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -558,7 +558,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
         bool bMovedFromTable = false;
         if (CursorType::SelectionInTable != m_eCursorType && pTableNode)
         {
-            aNewCursor->GetPoint()->nNode = pTableNode->EndOfSectionIndex();
+            aNewCursor->GetPoint()->Assign( pTableNode->EndOfSectionIndex() );
             aNewCursor->Move(fnMoveForward, GoInNode);
             bMovedFromTable = true;
         }
@@ -587,7 +587,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
         if (pTableNode && (&pTableNode->GetTable() != m_pOwnTable))
         {
             // this is a foreign table: go to end
-            rUnoCursor.GetPoint()->nNode = pTableNode->EndOfSectionIndex();
+            rUnoCursor.GetPoint()->Assign( pTableNode->EndOfSectionIndex() );
             if (!rUnoCursor.Move(fnMoveForward, GoInNode))
             {
                 return nullptr;
diff --git a/sw/source/core/unocore/unoparagraph.cxx 
b/sw/source/core/unocore/unoparagraph.cxx
index 05eb06e58056..866d5aad23f2 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -276,10 +276,10 @@ bool SwXParagraph::SelectPaM(SwPaM & rPaM)
         return false;
     }
 
-    *rPaM.GetPoint() = SwPosition( *pTextNode );
+    rPaM.GetPoint()->Assign( *pTextNode );
     // set selection to the whole paragraph
     rPaM.SetMark();
-    rPaM.GetMark()->nContent = pTextNode->GetText().getLength();
+    rPaM.GetMark()->SetContent( pTextNode->GetText().getLength() );
     return true;
 }
 

Reply via email to