summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-09-20 10:42:54 +0200
committerBjoern Michaelsen <bjoern.michaelsen@libreoffice.org>2020-09-27 23:02:33 +0200
commitb3fa0c06fe153737a125c9ba6f8fcc7d0a4d391d (patch)
treeb3a4b995597832a3a24274d5e0658342c3824139
parent3f7b48c4a726f51bdc5c78886957c08506e4d336 (diff)
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.michaelsen@libreoffice.org>
-rw-r--r--sw/inc/swtable.hxx2
-rw-r--r--sw/source/core/table/swtable.cxx41
2 files changed, 26 insertions, 17 deletions
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 )