sw/inc/ndtxt.hxx                  |    2 +-
 sw/source/core/doc/docfmt.cxx     |    4 ++--
 sw/source/core/table/swtable.cxx  |    7 +++----
 sw/source/core/txtnode/ndtxt.cxx  |    3 +--
 sw/source/core/txtnode/thints.cxx |    2 +-
 sw/source/core/undo/unattr.cxx    |    6 ++----
 6 files changed, 10 insertions(+), 14 deletions(-)

New commits:
commit b9a45cca8a0014d975f6e3d16c94cfe08c52a8bb
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Aug 15 17:42:25 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 16 18:22:39 2022 +0200

    pass sal_Int32 to DontExpandormat
    
    instead of SwContentIndex.
    Part of the process of hiding the implementation of SwPosition.
    
    Change-Id: I69d2a92093109b52b21c558f8ea8e3ae486fe1ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138319
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index f9da070ae25e..8715f0e7e98e 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -366,7 +366,7 @@ public:
     SwContentNode *AppendNode( const SwPosition & );
 
     /// When appropriate set DontExpand-flag at INet or character styles 
respectively.
-    bool DontExpandFormat( const SwContentIndex& rIdx, bool bFlag = true,
+    bool DontExpandFormat( sal_Int32 nContentIdx, bool bFlag = true,
                         bool bFormatToTextAttributes = true );
 
     enum GetTextAttrMode {
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index c6399b31344f..43e1e24e9b25 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -288,7 +288,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
             {
                 nPtPos = nMkPos = rSt.GetIndex();
                 if( bTextAttr )
-                    pTextNd->DontExpandFormat( rSt );
+                    pTextNd->DontExpandFormat( nPtPos );
             }
         }
 
@@ -1702,7 +1702,7 @@ bool SwDoc::DontExpandFormat( const SwPosition& rPos, 
bool bFlag )
     SwTextNode* pTextNd = rPos.GetNode().GetTextNode();
     if( pTextNd )
     {
-        bRet = pTextNd->DontExpandFormat( rPos.nContent, bFlag );
+        bRet = pTextNd->DontExpandFormat( rPos.GetContentIndex(), bFlag );
         if( bRet && GetIDocumentUndoRedo().DoesUndo() )
         {
             GetIDocumentUndoRedo().AppendUndo( 
std::make_unique<SwUndoDontExpandFormat>(rPos) );
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 9386c3f31470..1863316d1531 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2218,7 +2218,7 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& 
rText, const Color* pCol,
         // Reset DontExpand-Flags before exchange, to retrigger expansion
         {
             SwContentIndex aResetIdx( aIdx, n );
-            pTNd->DontExpandFormat( aResetIdx, false, false );
+            pTNd->DontExpandFormat( aResetIdx.GetIndex(), false, false );
         }
 
         if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && 
!pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
@@ -2284,10 +2284,9 @@ static void ChgNumToText( SwTableBox& rBox, sal_uLong 
nFormat )
         if( sText != sTmp )
         {
             // exchange text
-            SwContentIndex aIdx( pTNd, sText.getLength() );
             // Reset DontExpand-Flags before exchange, to retrigger expansion
-            pTNd->DontExpandFormat( aIdx, false, false );
-            aIdx = 0;
+            pTNd->DontExpandFormat( sText.getLength(), false, false );
+            SwContentIndex aIdx( pTNd, 0 );
             pTNd->EraseText( aIdx, SAL_MAX_INT32, SwInsertFlags::EMPTYEXPAND );
             pTNd->InsertText( sTmp, aIdx, SwInsertFlags::EMPTYEXPAND );
         }
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4a00177b97a8..b567ec4d17cc 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -1640,10 +1640,9 @@ void SwTextNode::ChgTextCollUpdateNum( const 
SwTextFormatColl *pOldColl,
 
 // If positioned exactly at the end of a CharStyle or Hyperlink,
 // set its DontExpand flag.
-bool SwTextNode::DontExpandFormat( const SwContentIndex& rIdx, bool bFlag,
+bool SwTextNode::DontExpandFormat( sal_Int32 nIdx, bool bFlag,
                                 bool bFormatToTextAttributes )
 {
-    const sal_Int32 nIdx = rIdx.GetIndex();
     if (bFormatToTextAttributes && nIdx == m_Text.getLength())
     {
         FormatToTextAttr( this );
diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 3c189cbb55e9..aac947bbe844 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -1985,7 +1985,7 @@ bool SwTextNode::SetAttr(
                 {
                     SwContentIndex aIndex( this, nStt );
                     RstTextAttr( aIndex, nEnd - nStt, RES_TXTATR_CHARFMT );
-                    DontExpandFormat( aIndex );
+                    DontExpandFormat( aIndex.GetIndex() );
                 }
                 else
                 {
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 1101d12899c1..5d3341960dbb 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -570,10 +570,8 @@ void SwUndoResetAttr::UndoImpl(::sw::UndoRedoContext & 
rContext)
     if ((RES_CONDTXTFMTCOLL == m_nFormatId) &&
         (m_nSttNode == m_nEndNode) && (m_nSttContent == m_nEndContent)) {
         SwTextNode* pTNd = rDoc.GetNodes()[ m_nSttNode ]->GetTextNode();
-        if( pTNd ) {
-            SwContentIndex aIdx( pTNd, m_nSttContent );
-            pTNd->DontExpandFormat( aIdx, false );
-        }
+        if( pTNd )
+            pTNd->DontExpandFormat( m_nSttContent, false );
     }
 
     AddUndoRedoPaM(rContext);

Reply via email to