sw/source/core/text/frmform.cxx |   13 +++++++------
 sw/source/core/text/porlay.hxx  |    4 ++--
 sw/source/core/text/txtfrm.cxx  |    2 +-
 3 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit e8c2ae74ea433d9d75baf7ff8a349a0c86ace657
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Apr 13 10:32:21 2022 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Apr 13 15:52:08 2022 +0200

    give SwParaPortion a const GetDelta() and non-const SetDelta()
    
    instead of two GetDeltas() one of which is non-const and returning a
    reference that can be used to modify the delta
    
    no logic change intended
    
    Change-Id: Ia5788bfffd169a589eb9b9b141b60575ab165391
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132953
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 6b28e2fc1d69..861d143dc96a 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -214,7 +214,7 @@ bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst)
             if( pPara )
             {
                 pPara->GetReformat() = SwCharRange();
-                pPara->GetDelta() = 0;
+                pPara->SetDelta(0);
             }
         }
 
@@ -312,7 +312,7 @@ bool SwTextFrame::CalcFollow(TextFrameIndex const nTextOfst)
             if( pPara )
             {
                 pPara->GetReformat() = SwCharRange();
-                pPara->GetDelta() = 0;
+                pPara->SetDelta(0);
             }
         }
 
@@ -775,7 +775,7 @@ void SwTextFrame::SetOffset_(TextFrameIndex const nNewOfst)
         SwCharRange &rReformat = pPara->GetReformat();
         rReformat.Start() = TextFrameIndex(0);
         rReformat.Len() = TextFrameIndex(GetText().getLength());
-        pPara->GetDelta() = sal_Int32(rReformat.Len());
+        pPara->SetDelta(sal_Int32(rReformat.Len()));
     }
     InvalidateSize();
 }
@@ -1059,7 +1059,7 @@ void SwTextFrame::FormatAdjust( SwTextFormatter &rLine,
     // are valid now
     pPara->GetReformat() = SwCharRange();
     bool bDelta = pPara->GetDelta() != 0;
-    pPara->GetDelta() = 0;
+    pPara->SetDelta(0);
 
     if( rLine.IsStop() )
     {
@@ -1300,7 +1300,8 @@ bool SwTextFrame::FormatLine( SwTextFormatter &rLine, 
const bool bPrev )
     }
 
     // Calculating the good ol' nDelta
-    pPara->GetDelta() -= sal_Int32(pNew->GetLen()) - sal_Int32(nOldLen);
+    const sal_Int32 nDiff = sal_Int32(pNew->GetLen()) - sal_Int32(nOldLen);
+    pPara->SetDelta(pPara->GetDelta() - nDiff);
 
     // Stop!
     if( rLine.IsStop() )
@@ -2077,7 +2078,7 @@ bool SwTextFrame::FormatQuick( bool bForceQuickFormat )
 
     // Delete reformat
     pPara->GetReformat() = SwCharRange();
-    pPara->GetDelta() = 0;
+    pPara->SetDelta(0);
 
     return true;
 }
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index eb0d5e8bf768..3960671fcca6 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -286,8 +286,8 @@ public:
     const SwRepaint& GetRepaint() const { return m_aRepaint; }
     SwCharRange& GetReformat() { return m_aReformat; }
     const SwCharRange& GetReformat() const { return m_aReformat; }
-    tools::Long& GetDelta() { return m_nDelta; }
-    const tools::Long& GetDelta() const { return m_nDelta; }
+    void SetDelta(tools::Long nDelta) { m_nDelta = nDelta; }
+    tools::Long GetDelta() const { return m_nDelta; }
     SwScriptInfo& GetScriptInfo() { return m_aScriptInfo; }
     const SwScriptInfo& GetScriptInfo() const { return m_aScriptInfo; }
 
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index dafcd98a8561..76f05e2c8d80 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1710,7 +1710,7 @@ void SwTextFrame::InvalidateRange_( const SwCharRange 
&aRange, const tools::Long
         // linelengths are being added, that's why it's negative
         // if chars have been added and positive, if chars have
         // deleted
-        pPara->GetDelta() += nD;
+        pPara->SetDelta(pPara->GetDelta() + nD);
         bInv = true;
     }
     SwCharRange &rReformat = pPara->GetReformat();

Reply via email to