SwNumFormat: Modify no more ...

Change-Id: Icda36d5226a2eca63b9ed56ac9ac5be768a4d117
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104977
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
This commit is contained in:
Bjoern Michaelsen 2020-10-28 21:21:42 +01:00
parent 5a8d347131
commit 22ca1a3c64
2 changed files with 13 additions and 11 deletions

View file

@ -57,7 +57,7 @@ class SW_DLLPUBLIC SwNumFormat final : public SvxNumberFormat, public SwClient
using SvxNumberFormat::operator ==;
using SvxNumberFormat::operator !=;
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) override;
virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
public:
SwNumFormat();

View file

@ -278,24 +278,26 @@ void SwNumFormat::SetCharFormat( SwCharFormat* pChFormat)
EndListeningAll();
}
void SwNumFormat::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
void SwNumFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy)
return;
// Look for the NumRules object in the Doc where this NumFormat is set.
// The format does not need to exist!
const SwCharFormat* pFormat = nullptr;
sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
switch( nWhich )
switch(pLegacy->GetWhich())
{
case RES_ATTRSET_CHG:
case RES_FMT_CHG:
pFormat = GetCharFormat();
break;
case RES_ATTRSET_CHG:
case RES_FMT_CHG:
pFormat = GetCharFormat();
break;
}
if( pFormat && !pFormat->GetDoc()->IsInDtor() )
UpdateNumNodes( *const_cast<SwDoc*>(pFormat->GetDoc()) );
if(pFormat && !pFormat->GetDoc()->IsInDtor())
UpdateNumNodes(*const_cast<SwDoc*>(pFormat->GetDoc()));
else
CheckRegistration( pOld );
CheckRegistration(pLegacy->m_pOld);
}
OUString SwNumFormat::GetCharFormatName() const