sw/source/core/edit/edlingu.cxx |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

New commits:
commit c4c3d1b575ba46f181a15d5c4b66c52a3020194d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Sep 27 20:39:43 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Sep 28 13:52:57 2022 +0200

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

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 94d691b9ac87..294d6ffede72 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -529,7 +529,7 @@ void SwHyphIter::Ignore()
     DelSoftHyph( *pCursor );
 
     // and continue
-    pCursor->Start()->nContent = pCursor->End()->nContent;
+    pCursor->Start()->SetContent( pCursor->End()->GetContentIndex() );
     pCursor->SetMark();
 }
 
@@ -568,7 +568,7 @@ void SwHyphIter::InsertSoftHyph( const sal_Int32 nHyphPos )
     {
         SwDoc *pDoc = pMySh->GetDoc();
         DelSoftHyph( *pCursor );
-        pSttPos->nContent += nHyphPos;
+        pSttPos->AdjustContent( +nHyphPos );
         SwPaM aRg( *pSttPos );
         pDoc->getIDocumentContentOperations().InsertString( aRg, 
OUString(CHAR_SOFTHYPHEN) );
     }
@@ -863,7 +863,7 @@ void SwEditShell::HandleCorrectionError(const OUString& 
aText, SwPosition aPos,
     while (pChar && *pChar-- == CH_TXTATR_INWORD)
         ++nRight;
 
-    aPos.nContent = nBegin + nLeft;
+    aPos.SetContent( nBegin + nLeft );
     SwPaM* pCursor = GetCursor();
     *pCursor->GetPoint() = aPos;
     pCursor->SetMark();
@@ -875,8 +875,8 @@ void SwEditShell::HandleCorrectionError(const OUString& 
aText, SwPosition aPos,
                             ? nLineEnd : (nBegin + nLen - nLeft - nRight);
     Push();
     pCursor->DeleteMark();
-    SwContentIndex& rContent = GetCursor()->GetPoint()->nContent;
-    rContent = nWordStart;
+    SwPosition& rPtPos = *GetCursor()->GetPoint();
+    rPtPos.SetContent(nWordStart);
     SwRect aStartRect;
     SwCursorMoveState aState;
     aState.m_bRealWidth = true;
@@ -890,7 +890,7 @@ void SwEditShell::HandleCorrectionError(const OUString& 
aText, SwPosition aPos,
     SwContentFrame *const pContentFrame = 
pContentNode->getLayoutFrame(GetLayout(), pCursor->GetPoint(), pPt ? &tmp : 
nullptr);
 
     pContentFrame->GetCharRect( aStartRect, *pCursor->GetPoint(), &aState );
-    rContent = nWordEnd - 1;
+    rPtPos.SetContent(nWordEnd - 1);
     SwRect aEndRect;
     pContentFrame->GetCharRect( aEndRect, *pCursor->GetPoint(),&aState );
     rSelectRect = aStartRect.Union( aEndRect );
@@ -1149,8 +1149,8 @@ void SwEditShell::ApplyChangedSentence(const 
svx::SpellPortions& rNewPortions, b
             }
             if ( !pCursor->HasMark() )
                 pCursor->SetMark();
-            pCursor->GetPoint()->nContent = aCurrentOldPosition->nLeft;
-            pCursor->GetMark()->nContent = aCurrentOldPosition->nRight;
+            pCursor->GetPoint()->SetContent( aCurrentOldPosition->nLeft );
+            pCursor->GetMark()->SetContent( aCurrentOldPosition->nRight );
             sal_uInt16 nScriptType = 
SvtLanguageOptions::GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage 
);
             sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
             switch(nScriptType)
@@ -1188,8 +1188,8 @@ void SwEditShell::ApplyChangedSentence(const 
svx::SpellPortions& rNewPortions, b
         SpellContentPositions::const_iterator aCurrentEndPosition = 
rLastPositions.end();
         --aCurrentEndPosition;
         SpellContentPositions::const_iterator aCurrentStartPosition = 
rLastPositions.begin();
-        pCursor->GetPoint()->nContent = aCurrentStartPosition->nLeft;
-        pCursor->GetMark()->nContent = aCurrentEndPosition->nRight;
+        pCursor->GetPoint()->SetContent( aCurrentStartPosition->nLeft );
+        pCursor->GetMark()->SetContent( aCurrentEndPosition->nRight );
 
         // delete the sentence completely
         mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
@@ -1417,8 +1417,7 @@ bool SwSpellIter::SpellSentence(svx::SpellPortions& 
rPortions, bool bIsGrammarCh
                 --nSentenceEnd;
             if( pCursor->End()->GetContentIndex() < nSentenceEnd )
             {
-                pCursor->End()->nContent.Assign(
-                    pCursor->End()->GetNode().GetContentNode(), nSentenceEnd);
+                pCursor->End()->SetContent(nSentenceEnd);
             }
         }
 
@@ -1606,7 +1605,7 @@ void    SwSpellIter::AddPortion(uno::Reference< 
XSpellAlternatives > const & xAl
             // select until the end of the current redline
             const sal_Int32 nEnd = aEnd.GetContentIndex() < 
aNextRedline.nRight ?
                         aEnd.GetContentIndex() : aNextRedline.nRight;
-            pCursor->GetPoint()->nContent.Assign( pTextNode, nEnd );
+            pCursor->GetPoint()->SetContent( nEnd );
             CreatePortion(xAlt, pGrammarResult, false, true);
             aStart = *pCursor->End();
             // search for next redline
@@ -1683,7 +1682,7 @@ void    SwSpellIter::AddPortion(uno::Reference< 
XSpellAlternatives > const & xAl
                 // select until the end of the current redline
                 const sal_Int32 nEnd = aEnd.GetContentIndex() < 
aNextRedline.nRight ?
                             aEnd.GetContentIndex() : aNextRedline.nRight;
-                pCursor->GetPoint()->nContent.Assign( pTextNode, nEnd );
+                pCursor->GetPoint()->SetContent( nEnd );
                 CreatePortion(xAlt, pGrammarResult, false, true);
                 aStart = *pCursor->End();
                 // search for next redline

Reply via email to