sw/inc/swtable.hxx               |    2 -
 sw/source/core/table/swtable.cxx |   41 +++++++++++++++++++++++----------------
 2 files changed, 26 insertions(+), 17 deletions(-)

New commits:
commit b3fa0c06fe153737a125c9ba6f8fcc7d0a4d391d
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sun Sep 20 10:42:54 2020 +0200
Commit:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
CommitDate: Sun Sep 27 23:02:33 2020 +0200

    SwTable: Replace Modify with SwClientNotify
    
    Change-Id: Ia5eccf6d13bac6a15079ad3f8c7dcbaef519c317
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103065
    Tested-by: Jenkins
    Reviewed-by: Bjoern Michaelsen <bjoern.michael...@libreoffice.org>

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index a0deaf01e892..ef04b527b65b 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -136,7 +136,7 @@ protected:
     bool        m_bModifyLocked   :1;
     bool        m_bNewModel       :1; // false: old SubTableModel; true: new 
RowSpanModel
 
-    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) 
override;
+    virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
 
 public:
     enum SearchType
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index a379e6d0aa6c..a14e8060b429 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -338,30 +338,39 @@ static void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const 
long nOld,
     }
 }
 
-void SwTable::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
+void SwTable::SwClientNotify(const SwModify&, const SfxHint& rHint)
 {
+    auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+    if(!pLegacy)
+        return;
     // catch SSize changes, to adjust the lines/boxes
-    const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0 ;
+    const sal_uInt16 nWhich = pLegacy->m_pOld ? pLegacy->m_pOld->Which() : 
pLegacy->m_pNew ? pLegacy->m_pNew->Which() : 0;
     const SwFormatFrameSize* pNewSize = nullptr, *pOldSize = nullptr;
-
-    if( RES_ATTRSET_CHG == nWhich )
+    switch(nWhich)
     {
-        if (pOld && pNew && SfxItemState::SET == static_cast<const 
SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState(
-            RES_FRM_SIZE, false, reinterpret_cast<const 
SfxPoolItem**>(&pNewSize)))
+        case RES_ATTRSET_CHG:
         {
-            pOldSize = &static_cast<const 
SwAttrSetChg*>(pOld)->GetChgSet()->GetFrameSize();
+            if (pLegacy->m_pOld && pLegacy->m_pNew
+                    && SfxItemState::SET == static_cast<const 
SwAttrSetChg*>(pLegacy->m_pNew)->GetChgSet()->GetItemState(
+                            RES_FRM_SIZE,
+                            false,
+                            reinterpret_cast<const SfxPoolItem**>(&pNewSize)))
+            {
+                pOldSize = &static_cast<const 
SwAttrSetChg*>(pLegacy->m_pOld)->GetChgSet()->GetFrameSize();
+            }
         }
+        break;
+        case RES_FRM_SIZE:
+        {
+            pOldSize = static_cast<const SwFormatFrameSize*>(pLegacy->m_pOld);
+            pNewSize = static_cast<const SwFormatFrameSize*>(pLegacy->m_pNew);
+        }
+        break;
+        default:
+            CheckRegistration(pLegacy->m_pOld);
     }
-    else if( RES_FRM_SIZE == nWhich )
-    {
-        pOldSize = static_cast<const SwFormatFrameSize*>(pOld);
-        pNewSize = static_cast<const SwFormatFrameSize*>(pNew);
-    }
-    else
-        CheckRegistration( pOld );
-
     if (pOldSize && pNewSize && !m_bModifyLocked)
-        AdjustWidths( pOldSize->GetWidth(), pNewSize->GetWidth() );
+        AdjustWidths(pOldSize->GetWidth(), pNewSize->GetWidth());
 }
 
 void SwTable::AdjustWidths( const long nOld, const long nNew )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to