[Libreoffice-commits] core.git: sw/source

Bjoern Michaelsen (via logerrit) logerrit at kemper.freedesktop.org
Sun Dec 13 23:58:46 UTC 2020


 sw/source/core/inc/cntfrm.hxx   |    2 -
 sw/source/core/layout/wsfrm.cxx |   63 ++++++++++++++++++++--------------------
 sw/source/core/text/txtfrm.cxx  |    8 ++---
 3 files changed, 38 insertions(+), 35 deletions(-)

New commits:
commit d6bb7239d8746cae0b0868f4cb0925db7fcaeb53
Author:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
AuthorDate: Sun Dec 13 23:53:04 2020 +0100
Commit:     Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
CommitDate: Mon Dec 14 00:58:09 2020 +0100

    SwContentFrame: Modify no more
    
    Change-Id: I934e5f096b7e650fe95d62b0030cbbe3a90daf6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107667
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 3b85365d3668..937f40c1751e 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -56,7 +56,7 @@ class SAL_DLLPUBLIC_RTTI SwContentFrame: public SwFrame, public SwFlowFrame
 protected:
     void MakePrtArea( const SwBorderAttrs & );
 
-    virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) override;
+    virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
     virtual SwTwips ShrinkFrame( SwTwips, bool bTst = false, bool bInfo = false ) override;
     virtual SwTwips GrowFrame  ( SwTwips, bool bTst = false, bool bInfo = false ) override;
 
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 472c0bf619e8..8d64d23fc7dd 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2322,76 +2322,79 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
     return nReal;
 }
 
-void SwContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
+void SwContentFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
+    auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+    if(!pLegacy)
+        return;
     sal_uInt8 nInvFlags = 0;
-
-    if( pNew && RES_ATTRSET_CHG == pNew->Which() && pOld )
+    if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which() && pLegacy->m_pOld)
     {
-        SfxItemIter aNIter( *static_cast<const SwAttrSetChg*>(pNew)->GetChgSet() );
-        SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
+        auto& rOldSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pOld);
+        auto& rNewSetChg = *static_cast<const SwAttrSetChg*>(pLegacy->m_pNew);
+        SfxItemIter aOIter(*rOldSetChg.GetChgSet());
+        SfxItemIter aNIter(*rNewSetChg.GetChgSet());
         const SfxPoolItem* pNItem = aNIter.GetCurItem();
         const SfxPoolItem* pOItem = aOIter.GetCurItem();
-        SwAttrSetChg aOldSet( *static_cast<const SwAttrSetChg*>(pOld) );
-        SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
+        SwAttrSetChg aOldSet(rOldSetChg);
+        SwAttrSetChg aNewSet(rNewSetChg);
         do
         {
             UpdateAttr_(pOItem, pNItem, nInvFlags, &aOldSet, &aNewSet);
             pNItem = aNIter.NextItem();
             pOItem = aOIter.NextItem();
-        } while (pNItem);
-        if ( aOldSet.Count() || aNewSet.Count() )
-            SwFrame::Modify( &aOldSet, &aNewSet );
+        } while(pNItem);
+        if(aOldSet.Count() || aNewSet.Count())
+            SwFrame::Modify(&aOldSet, &aNewSet);
     }
     else
-        UpdateAttr_( pOld, pNew, nInvFlags );
+        UpdateAttr_(pLegacy->m_pOld, pLegacy->m_pNew, nInvFlags);
 
-    if ( nInvFlags == 0 )
+    if(nInvFlags == 0)
         return;
 
-    SwPageFrame *pPage = FindPageFrame();
-    InvalidatePage( pPage );
-    if ( nInvFlags & 0x01 )
+    SwPageFrame* pPage = FindPageFrame();
+    InvalidatePage(pPage);
+    if(nInvFlags & 0x01)
         SetCompletePaint();
-    if ( nInvFlags & 0x02 )
+    if(nInvFlags & 0x02)
         InvalidatePos_();
-    if ( nInvFlags & 0x04 )
+    if(nInvFlags & 0x04 )
         InvalidateSize_();
-    if ( nInvFlags & 0x88 )
+    if(nInvFlags & 0x88)
     {
-        if( IsInSct() && !GetPrev() )
+        if(IsInSct() && !GetPrev())
         {
-            SwSectionFrame *pSect = FindSctFrame();
-            if( pSect->ContainsAny() == this )
+            SwSectionFrame* pSect = FindSctFrame();
+            if(pSect->ContainsAny() == this)
             {
                 pSect->InvalidatePrt_();
-                pSect->InvalidatePage( pPage );
+                pSect->InvalidatePage(pPage);
             }
         }
         InvalidatePrt_();
     }
     SwFrame* pNextFrame = GetIndNext();
-    if ( pNextFrame && nInvFlags & 0x10)
+    if(pNextFrame && nInvFlags & 0x10)
     {
         pNextFrame->InvalidatePrt_();
-        pNextFrame->InvalidatePage( pPage );
+        pNextFrame->InvalidatePage(pPage);
     }
-    if ( pNextFrame && nInvFlags & 0x80 )
+    if(pNextFrame && nInvFlags & 0x80)
     {
         pNextFrame->SetCompletePaint();
     }
-    if ( nInvFlags & 0x20 )
+    if(nInvFlags & 0x20)
     {
         SwFrame* pPrevFrame = GetPrev();
-        if ( pPrevFrame )
+        if(pPrevFrame)
         {
             pPrevFrame->InvalidatePrt_();
-            pPrevFrame->InvalidatePage( pPage );
+            pPrevFrame->InvalidatePage(pPage);
         }
     }
-    if ( nInvFlags & 0x40 )
+    if(nInvFlags & 0x40)
         InvalidateNextPos();
-
 }
 
 void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pNew,
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 4e2d8af0bcb9..59b287e66498 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1957,7 +1957,7 @@ static bool hasA11yRelevantAttribute( const std::vector<sal_uInt16>& rWhichFmtAt
 // as their implementation of SwClientNotify is SwClient's which calls Modify.
 // Therefore we also don't need to call SwClient::SwClientNotify(rModify, rHint)
 // because that's all it does, and this implementation calls
-// SwContentFrame::Modify() when appropriate.
+// SwContentFrame::SwClientNotifyy() when appropriate.
 void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
 {
     SfxPoolItem const* pOld(nullptr);
@@ -2011,7 +2011,7 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
                 return;
             }
         }
-        SwContentFrame::Modify( pOld, pNew );
+        SwContentFrame::SwClientNotify(rModify, sw::LegacyModifyHint(pOld, pNew));
         if( nWhich == RES_FMT_CHG && getRootFrame()->GetCurrShell() )
         {
             // collection has changed
@@ -2536,11 +2536,11 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
                     }
                     if (aOldSet.Count() || aNewSet.Count())
                     {
-                        SwContentFrame::Modify( &aOldSet, &aNewSet );
+                        SwContentFrame::SwClientNotify(rModify, sw::LegacyModifyHint(&aOldSet, &aNewSet));
                     }
                 }
                 else
-                    SwContentFrame::Modify( pOld, pNew );
+                    SwContentFrame::SwClientNotify(rModify, sw::LegacyModifyHint(pOld, pNew));
             }
 
             if (isA11yRelevantAttribute(nWhich))


More information about the Libreoffice-commits mailing list