summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-21 14:38:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-03 07:54:50 +0100
commit835e89e69765cc8262d1c5b4993caed976386ac4 (patch)
treef2b5601f7459a2d3a2d727b818b9f32e089a6571
parentxmlsec: fix OOXML signing with multiple certs, extend the test (diff)
downloadcore-835e89e69765cc8262d1c5b4993caed976386ac4.tar.gz
core-835e89e69765cc8262d1c5b4993caed976386ac4.zip
create SfxHintId::SwLegacyModify id
to avoid expensive dynamic_casts in writer Change-Id: Ic73ae7d4af985043f8533913b33939e3445ec7de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124592
-rw-r--r--include/svl/hint.hxx1
-rw-r--r--sw/inc/calbck.hxx2
-rw-r--r--sw/inc/swevent.hxx4
-rw-r--r--sw/source/core/access/accframebase.cxx3
-rw-r--r--sw/source/core/access/accnotextframe.cxx3
-rw-r--r--sw/source/core/access/acctable.cxx3
-rw-r--r--sw/source/core/access/acctextframe.cxx3
-rw-r--r--sw/source/core/attr/calbck.cxx27
-rw-r--r--sw/source/core/attr/format.cxx4
-rw-r--r--sw/source/core/crsr/bookmrk.cxx6
-rw-r--r--sw/source/core/crsr/crsrsh.cxx4
-rw-r--r--sw/source/core/doc/acmplwrd.cxx4
-rw-r--r--sw/source/core/doc/docftn.cxx3
-rw-r--r--sw/source/core/doc/fmtcol.cxx6
-rw-r--r--sw/source/core/doc/lineinfo.cxx4
-rw-r--r--sw/source/core/doc/notxtfrm.cxx4
-rw-r--r--sw/source/core/doc/number.cxx4
-rw-r--r--sw/source/core/docnode/node.cxx3
-rw-r--r--sw/source/core/docnode/section.cxx8
-rw-r--r--sw/source/core/draw/dcontact.cxx3
-rw-r--r--sw/source/core/fields/ddetbl.cxx3
-rw-r--r--sw/source/core/fields/docufld.cxx4
-rw-r--r--sw/source/core/fields/expfld.cxx6
-rw-r--r--sw/source/core/fields/reffld.cxx4
-rw-r--r--sw/source/core/fields/usrfld.cxx9
-rw-r--r--sw/source/core/layout/atrfrm.cxx7
-rw-r--r--sw/source/core/layout/fly.cxx3
-rw-r--r--sw/source/core/layout/flycnt.cxx4
-rw-r--r--sw/source/core/layout/flyincnt.cxx4
-rw-r--r--sw/source/core/layout/flylay.cxx6
-rw-r--r--sw/source/core/layout/pagechg.cxx3
-rw-r--r--sw/source/core/layout/pagedesc.cxx3
-rw-r--r--sw/source/core/layout/sectfrm.cxx3
-rw-r--r--sw/source/core/layout/tabfrm.cxx11
-rw-r--r--sw/source/core/layout/wsfrm.cxx8
-rw-r--r--sw/source/core/table/swtable.cxx8
-rw-r--r--sw/source/core/text/txtfrm.cxx3
-rw-r--r--sw/source/core/tox/tox.cxx3
-rw-r--r--sw/source/core/txtnode/atrfld.cxx3
-rw-r--r--sw/source/core/txtnode/atrftn.cxx4
-rw-r--r--sw/source/core/txtnode/atrref.cxx4
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx10
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx3
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx8
-rw-r--r--sw/source/core/undo/rolbck.cxx6
-rw-r--r--sw/source/core/undo/unattr.cxx6
-rw-r--r--sw/source/core/undo/undobj1.cxx6
-rw-r--r--sw/source/core/unocore/unochart.cxx2
-rw-r--r--sw/source/core/unocore/unofield.cxx3
-rw-r--r--sw/source/core/unocore/unoidx.cxx3
-rw-r--r--sw/source/filter/basflt/fltshell.cxx3
51 files changed, 147 insertions, 105 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 284ebe7200c4..337930335a0f 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -116,6 +116,7 @@ enum class SfxHintId {
SwSectionFrameMoveAndDelete,
SwNavigatorUpdateTracking,
SwNavigatorSelectOutlinesWithSelections,
+ SwLegacyModify,
ThisIsAnSdrHint // used to avoid dynamic_cast
};
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 0863b2da7f2f..2d873107e069 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -68,7 +68,7 @@ namespace sw
void ClientNotifyAttrChg(SwModify& rModify, const SwAttrSet& aSet, SwAttrSet& aOld, SwAttrSet& aNew);
struct LegacyModifyHint final: SfxHint
{
- LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : m_pOld(pOld), m_pNew(pNew) {};
+ LegacyModifyHint(const SfxPoolItem* pOld, const SfxPoolItem* pNew) : SfxHint(SfxHintId::SwLegacyModify), m_pOld(pOld), m_pNew(pNew) {};
sal_uInt16 GetWhich() const { return m_pOld ? m_pOld->Which() : m_pNew ? m_pNew->Which() : 0; };
virtual ~LegacyModifyHint() override;
const SfxPoolItem* m_pOld;
diff --git a/sw/inc/swevent.hxx b/sw/inc/swevent.hxx
index e18020320544..b25246cb2e12 100644
--- a/sw/inc/swevent.hxx
+++ b/sw/inc/swevent.hxx
@@ -118,9 +118,9 @@ struct SwCallMouseEvent final
virtual void SwClientNotify(const SwModify& rMod, const SfxHint& rHint) override
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
assert(EVENT_OBJECT_IMAGE == eType || EVENT_OBJECT_URLITEM == eType || EVENT_OBJECT_IMAGEMAP == eType);
SwClient::SwClientNotify(rMod, rHint);
bool bClear = !GetRegisteredIn();
diff --git a/sw/source/core/access/accframebase.cxx b/sw/source/core/access/accframebase.cxx
index c078bc2385f7..6f1e73a12338 100644
--- a/sw/source/core/access/accframebase.cxx
+++ b/sw/source/core/access/accframebase.cxx
@@ -213,8 +213,9 @@ void SwAccessibleFrameBase::Notify(const SfxHint& rHint)
{
EndListeningAll();
}
- else if(auto pLegacyModifyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyModifyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
const SwFlyFrame* pFlyFrame = static_cast<const SwFlyFrame*>(GetFrame());
if(nWhich == RES_NAME_CHANGED && pFlyFrame)
diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx
index d8f37887b4a4..8f42d72face2 100644
--- a/sw/source/core/access/accnotextframe.cxx
+++ b/sw/source/core/access/accnotextframe.cxx
@@ -87,8 +87,9 @@ void SwAccessibleNoTextFrame::Notify(const SfxHint& rHint)
{
if(rHint.GetId() == SfxHintId::Dying)
EndListeningAll();
- else if(auto pLegacyModifyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyModifyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
if (nWhich != RES_TITLE_CHANGED && nWhich != RES_DESCRIPTION_CHANGED)
return;
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 7fab0396050c..da48a7aadc12 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -638,8 +638,9 @@ void SwAccessibleTable::Notify(const SfxHint& rHint)
{
EndListeningAll();
}
- else if(auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyHint->GetWhich();
const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(GetFrame());
if(nWhich == RES_NAME_CHANGED && pTabFrame)
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index e4671bd44eb9..0f3b0b60bc84 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -67,8 +67,9 @@ void SwAccessibleTextFrame::Notify(const SfxHint& rHint)
{
if(rHint.GetId() == SfxHintId::Dying)
EndListeningAll();
- else if(auto pLegacyModifyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyModifyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyModifyHint->GetWhich();
const SwFlyFrame* pFlyFrame = static_cast<const SwFlyFrame*>(GetFrame());
switch(nWhich)
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index 3f4253cd2566..5f88e36abebc 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -37,8 +37,9 @@ namespace sw
{ return m_pToTell == nullptr || m_pToTell->GetInfo( rInfo ); }
void ListenerEntry::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
{
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
if (pLegacyHint->m_pNew && pLegacyHint->m_pNew->Which() == RES_OBJECTDYING)
{
auto pModifyChanged = CheckRegistration(pLegacyHint->m_pOld);
@@ -119,8 +120,10 @@ void SwClient::CheckRegistrationFormat(SwFormat& rOld)
void SwClient::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- if(auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
- CheckRegistration(pLegacyHint->m_pOld);
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ CheckRegistration(pLegacyHint->m_pOld);
};
void SwClient::StartListeningToSameModifyAs(const SwClient& other)
@@ -300,16 +303,16 @@ sw::ClientIteratorBase* sw::ClientIteratorBase::s_pClientIters = nullptr;
void SwModify::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- if(dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
- {
- DBG_TESTSOLARMUTEX();
- if(IsModifyLocked())
- return;
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
- LockModify();
- CallSwClientNotify(rHint);
- UnlockModify();
- }
+ DBG_TESTSOLARMUTEX();
+ if(IsModifyLocked())
+ return;
+
+ LockModify();
+ CallSwClientNotify(rHint);
+ UnlockModify();
}
void SwModify::CallSwClientNotify( const SfxHint& rHint ) const
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index d5c3a3833f0d..7efb53cd7e45 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -226,9 +226,9 @@ SwFormat::~SwFormat()
void SwFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
std::unique_ptr<SwAttrSetChg> pOldClientChg, pNewClientChg;
auto pDependsHint = std::make_unique<sw::LegacyModifyHint>(pLegacy->m_pOld, pLegacy->m_pNew);
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 3a22f54180c5..2178d0009273 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -342,8 +342,10 @@ namespace sw::mark
void MarkBase::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
CallSwClientNotify(rHint);
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(pLegacy && RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
{ // invalidate cached uno object
SetXBookmark(uno::Reference<text::XTextContent>(nullptr));
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index fbd4064e3d61..5f6db943d5dd 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -2484,9 +2484,9 @@ void SwCursorShell::SwClientNotify(const SwModify&, const SfxHint& rHint)
m_aGrfArrivedLnk.Call(*this);
return;
}
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
auto nWhich = pLegacy->GetWhich();
if(!nWhich)
nWhich = sal::static_int_cast<sal_uInt16>(RES_MSG_BEGIN);
diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index 08f796270a3e..65eb9193b679 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -132,9 +132,9 @@ SwAutoCompleteClient& SwAutoCompleteClient::operator=(const SwAutoCompleteClient
void SwAutoCompleteClient::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
switch(pLegacy->GetWhich())
{
case RES_REMOVE_UNO_OBJECT:
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 7f2b30ddc615..c78fd07e2d9a 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -227,8 +227,9 @@ void SwEndNoteInfo::UpdateFormatOrAttr()
void SwEndNoteInfo::SwClientNotify( const SwModify& rModify, const SfxHint& rHint)
{
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
switch(pLegacyHint->GetWhich())
{
case RES_ATTRSET_CHG:
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index a0dcda5cff88..bf7a8f02f78d 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -117,9 +117,9 @@ SwTextFormatColl::~SwTextFormatColl()
}
void SwTextFormatColl::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
- return;
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(GetDoc()->IsInDtor())
{
SwFormatColl::SwClientNotify(rModify, rHint);
diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx
index 2a9963f39cda..e77e14a174d8 100644
--- a/sw/source/core/doc/lineinfo.cxx
+++ b/sw/source/core/doc/lineinfo.cxx
@@ -114,9 +114,9 @@ void SwLineNumberInfo::SetCharFormat( SwCharFormat *pChFormat )
void SwLineNumberInfo::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
CheckRegistration( pLegacy->m_pOld );
SwDoc *pDoc = static_cast<SwCharFormat*>(GetRegisteredIn())->GetDoc();
SwRootFrame* pRoot = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index e4f2e071afba..309bac7725d1 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -750,9 +750,9 @@ void SwNoTextFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint
OnGraphicArrived();
return;
}
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
sal_uInt16 nWhich = pLegacy->GetWhich();
// #i73788#
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 5bc80fc99f3b..aae3d54e08d6 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -280,9 +280,9 @@ void SwNumFormat::SetCharFormat( SwCharFormat* pChFormat)
void SwNumFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
// Look for the NumRules object in the Doc where this NumFormat is set.
// The format does not need to exist!
const SwCharFormat* pFormat = nullptr;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 4f7b18ba3a68..b8f946bc2871 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1107,8 +1107,9 @@ void SwContentNode::UpdateAttr(const SwUpdateAttr& rUpdate)
void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint)
{
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyHint->GetWhich();
InvalidateInSwCache(nWhich);
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 9491b56b53c3..afa8b905e99e 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -405,9 +405,9 @@ void SwSection::SetEditInReadonly(bool const bFlag)
void SwSection::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
auto pOld = pLegacy->m_pOld;
auto pNew = pLegacy->m_pNew;
bool bUpdateFootnote = false;
@@ -728,9 +728,9 @@ void SwSectionFormat::MakeFrames()
void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
sal_uInt16 nWhich = pLegacy->GetWhich();
auto pOld = pLegacy->m_pOld;
auto pNew = pLegacy->m_pNew;
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index d2554e0ab5ae..ad377073a58e 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1397,8 +1397,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
SwClient::SwClientNotify(rMod, rHint); // needed as SwContact::SwClientNotify doesn't explicitly call SwClient::SwClientNotify
SwContact::SwClientNotify(rMod, rHint);
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
SAL_WARN_IF(mbDisconnectInProgress, "sw.core", "<SwDrawContact::Modify(..)> called during disconnection.");
const SfxPoolItem* pNew = pLegacyHint->m_pNew;
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index a131515eaa0e..d4496e40623c 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -85,8 +85,9 @@ SwDDETable::~SwDDETable()
void SwDDETable::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
{
- if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
switch(pLegacy->GetWhich())
{
case RES_UPDATEDDETBL:
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 388140e0a2d8..85f4bb6515f4 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2167,9 +2167,9 @@ std::unique_ptr<SwFieldType> SwRefPageGetFieldType::Copy() const
void SwRefPageGetFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
auto const ModifyImpl = [this](SwRootFrame const*const pLayout)
{
// first collect all SetPageRefFields
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 8b6917094f89..2a078ce5055e 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -273,9 +273,11 @@ std::unique_ptr<SwFieldType> SwGetExpFieldType::Copy() const
void SwGetExpFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
// do not expand anything else
- if(!pLegacy || (pLegacy->GetWhich() != RES_DOCPOS_UPDATE))
+ if(pLegacy->GetWhich() != RES_DOCPOS_UPDATE)
return;
CallSwClientNotify(rHint);
}
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 3b5854308810..2340c1313d0f 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1095,9 +1095,9 @@ void SwGetRefFieldType::UpdateGetReferences()
void SwGetRefFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy->m_pNew && !pLegacy->m_pOld)
// update to all GetReference fields
// hopefully, this codepath is soon dead code, and
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 9feb828a156b..fb1a7f8dc2f2 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -215,9 +215,12 @@ OUString SwUserFieldType::GetName() const
void SwUserFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if (pLegacy && !pLegacy->m_pOld && !pLegacy->m_pNew)
- m_bValidValue = false;
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
+ {
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if (!pLegacy->m_pOld && !pLegacy->m_pNew)
+ m_bValidValue = false;
+ }
CallSwClientNotify(rHint);
// update input fields that might be connected to the user field
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 5e7d6100bc0e..605da4a1e1bf 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -699,8 +699,9 @@ void SwFormatPageDesc::SwClientNotify(const SwModify&, const SfxHint& rHint)
// there could be an Undo-copy
RegisterToPageDesc(*pDesc);
}
- else if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(RES_OBJECTDYING == pLegacy->GetWhich())
{
m_pDefinedIn = nullptr;
@@ -2625,9 +2626,9 @@ bool SwFrameFormat::supportsFullDrawingLayerFillAttributeSet() const
void SwFrameFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nNewWhich = pLegacy->m_pNew ? pLegacy->m_pNew->Which() : 0;
const SwAttrSetChg* pNewAttrSetChg = nullptr;
const SwFormatHeader* pH = nullptr;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8181bd623d39..7c512b991699 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -660,8 +660,9 @@ bool SwFlyFrame::FrameSizeChg( const SwFormatFrameSize &rFrameSize )
void SwFlyFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
SwFlyFrameInvFlags eInvFlags = SwFlyFrameInvFlags::NONE;
if(pLegacy->m_pNew && pLegacy->m_pOld && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
{
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 22f4ac74567f..8cfb9524365c 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -85,9 +85,9 @@ SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pS
void SwFlyAtContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
const SwFormatAnchor* pAnch = pLegacy->m_pNew ? GetAnchorFromPoolItem(*pLegacy->m_pNew) : nullptr;
if(!pAnch)
{
diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index 461d2f779e1b..06ef88e74169 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -93,9 +93,9 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint,
void SwFlyInContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
std::pair<std::unique_ptr<SwAttrSetChg>, std::unique_ptr<SwAttrSetChg>> aTweakedChgs;
std::pair<const SfxPoolItem*, const SfxPoolItem*> aSuperArgs(nullptr, nullptr);
switch(pLegacy->GetWhich())
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index ea50b06ab364..aee8a93f423b 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -728,8 +728,10 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame
void SwFlyLayFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy || !pLegacy->m_pNew)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(!pLegacy->m_pNew)
return;
const auto pAnch = GetAnchorFromPoolItem(*pLegacy->m_pNew);
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index d699d59ecb80..af95881bcc86 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -509,8 +509,9 @@ void SwPageFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
// here, the page might be destroyed:
static_cast<SwRootFrame*>(GetUpper())->RemoveFootnotes(nullptr, false, true);
}
- else if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(auto pSh = getRootFrame()->GetCurrShell())
pSh->SetFirstVisPageInvalid();
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index c5c9c31ab7b9..036f20da411c 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -283,8 +283,9 @@ void SwPageDesc::RegisterChange()
/// special handling if the style of the grid alignment changes
void SwPageDesc::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
{
- if(auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
const sal_uInt16 nWhich = pLegacyHint->m_pOld
? pLegacyHint->m_pOld->Which()
: pLegacyHint->m_pNew
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 079e7de2b264..bc529bd28708 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2568,8 +2568,9 @@ void SwSectionFrame::CalcEndAtEndFlag()
void SwSectionFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- if(const auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
SwSectionFrameInvFlags eInvFlags = SwSectionFrameInvFlags::NONE;
if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
{
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 1626e4eac315..979ed834cd56 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3287,9 +3287,9 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
void SwTabFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
SwTabFrameInvFlags eInvFlags = SwTabFrameInvFlags::NONE;
bool bAttrSetChg = pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which();
@@ -3921,9 +3921,9 @@ void SwRowFrame::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
ReinitializeFrameSizeAttrFlags();
return;
}
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(!pLegacy->m_pNew)
{
// possibly not needed?
@@ -5435,8 +5435,9 @@ void SwCellFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
CheckDirChange();
return;
}
- else if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
const SfxPoolItem* pVertOrientItem = nullptr;
const SfxPoolItem* pProtectItem = nullptr;
const SfxPoolItem* pFrameDirItem = nullptr;
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index e7118b2516e5..b06b6a4fdd64 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -476,9 +476,9 @@ void SwTextFrame::CheckDirection( bool bVert )
void SwFrame::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
SwFrameInvFlags eInvFlags = SwFrameInvFlags::NONE;
if(pLegacy->m_pOld && pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which())
@@ -2344,9 +2344,9 @@ SwTwips SwContentFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo )
void SwContentFrame::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
SwContentFrameInvFlags eInvFlags = SwContentFrameInvFlags::NONE;
if(pLegacy->m_pNew && RES_ATTRSET_CHG == pLegacy->m_pNew->Which() && pLegacy->m_pOld)
{
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 84f5e5559ab4..4ddfb060fc8d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -315,9 +315,9 @@ static void lcl_ModifyBoxes( SwTableBoxes &rBoxes, const tools::Long nOld,
void SwTable::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
// catch SSize changes, to adjust the lines/boxes
const sal_uInt16 nWhich = pLegacy->GetWhich();
const SwFormatFrameSize* pNewSize = nullptr, *pOldSize = nullptr;
@@ -2182,9 +2182,9 @@ static void ChgNumToText( SwTableBox& rBox, sal_uLong nFormat )
// for detection of modifications (mainly TableBoxAttribute)
void SwTableBoxFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(IsModifyLocked() || !GetDoc() || GetDoc()->IsInDtor())
{
SwFrameFormat::SwClientNotify(rMod, rHint);
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 57ef2431daac..19abe46edc50 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -1979,8 +1979,9 @@ void SwTextFrame::SwClientNotify(SwModify const& rModify, SfxHint const& rHint)
sw::RedlineUnDelText const* pRedlineUnDelText(nullptr);
sal_uInt16 nWhich = 0;
- if (auto const pHint = dynamic_cast<sw::LegacyModifyHint const*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
pOld = pHint->m_pOld;
pNew = pHint->m_pNew;
nWhich = pHint->GetWhich();
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 30a5c6f9da35..986f60dfd5cd 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -154,8 +154,9 @@ SwTOXMark* SwTOXMark::Clone( SfxItemPool* ) const
void SwTOXMark::Notify(const SfxHint& rHint)
{
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
CallSwClientNotify(rHint);
if (pLegacyHint->m_pOld && (RES_REMOVE_UNO_OBJECT == pLegacyHint->m_pOld->Which()))
SetXTOXMark(css::uno::Reference<css::text::XDocumentIndexMark>(nullptr));
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 2124e55c7d65..05d10a2aae40 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -241,8 +241,9 @@ void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHin
pPaM->Move( fnMoveForward );
rDoc.getIDocumentContentOperations().DeleteRange( *pPaM );
rDoc.getIDocumentContentOperations().InsertString( *pPaM, aEntry );
- } else if (const auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>( &rHint ))
+ } else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
if( !mpTextField )
return;
UpdateTextNode(pLegacyHint->m_pOld, pLegacyHint->m_pNew);
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 2376ca3169c2..4a2f455d9b91 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -155,9 +155,9 @@ SwFormatFootnote* SwFormatFootnote::Clone( SfxItemPool* ) const
void SwFormatFootnote::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
CallSwClientNotify(rHint);
if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
SetXFootnote(css::uno::Reference<css::text::XFootnote>(nullptr));
diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx
index 8b11c4e525c7..e281803050e3 100644
--- a/sw/source/core/txtnode/atrref.cxx
+++ b/sw/source/core/txtnode/atrref.cxx
@@ -56,9 +56,9 @@ SwFormatRefMark* SwFormatRefMark::Clone( SfxItemPool* ) const
void SwFormatRefMark::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
CallSwClientNotify(rHint);
if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
SetXRefMark(css::uno::Reference<css::text::XTextContent>(nullptr));
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index afc82565c515..3ba9385f8ac4 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -86,8 +86,10 @@ SwFormatCharFormat* SwFormatCharFormat::Clone( SfxItemPool* ) const
// forward to the TextAttribute
void SwFormatCharFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(m_pTextAttribute && pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(m_pTextAttribute)
m_pTextAttribute->TriggerNodeUpdate(*pLegacy);
}
@@ -671,9 +673,9 @@ void Meta::NotifyChangeTextNode(SwTextNode *const pTextNode)
void Meta::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
CallSwClientNotify(rHint);
GetNotifier().Broadcast(SfxHint(SfxHintId::DataChanged));
if(RES_REMOVE_UNO_OBJECT == pLegacy->GetWhich())
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index b4b70f52c7f9..a0cc7337baa1 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5296,8 +5296,9 @@ void SwTextNode::TriggerNodeUpdate(const sw::LegacyModifyHint& rHint)
void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
{
- if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
TriggerNodeUpdate(*pLegacyHint);
}
else if (dynamic_cast<const SwAttrHint*>(&rHint))
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 71cbb16e2be7..96c905bb4d76 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -160,9 +160,9 @@ SwCharFormat* SwTextINetFormat::GetCharFormat()
void SwTextINetFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
const auto nWhich = pLegacy->GetWhich();
OSL_ENSURE(isCHRATR(nWhich) || (RES_OBJECTDYING == nWhich)
|| (RES_ATTRSET_CHG == nWhich) || (RES_FMT_CHG == nWhich),
@@ -201,9 +201,9 @@ SwTextRuby::~SwTextRuby()
void SwTextRuby::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
const auto nWhich = pLegacy->GetWhich();
SAL_WARN_IF( !isCHRATR(nWhich)
&& (RES_OBJECTDYING == nWhich)
diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx
index a1310936c851..402f1486654b 100644
--- a/sw/source/core/undo/rolbck.cxx
+++ b/sw/source/core/undo/rolbck.cxx
@@ -1387,8 +1387,10 @@ SwRegHistory::SwRegHistory( const SwNode& rNd, SwHistory* pHst )
void SwRegHistory::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if ( !(m_pHistory && pLegacyHint && pLegacyHint->m_pNew && pLegacyHint->m_pOld != pLegacyHint->m_pNew) )
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if ( !(m_pHistory && pLegacyHint->m_pNew && pLegacyHint->m_pOld != pLegacyHint->m_pNew) )
return;
if ( pLegacyHint->m_pNew->Which() < POOLATTR_END )
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 67b6f06a50a1..160a983b1c00 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -64,8 +64,10 @@ SwUndoFormatAttrHelper::SwUndoFormatAttrHelper(SwFormat& rFormat, bool bSvDrwPt)
void SwUndoFormatAttrHelper::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy || !pLegacy->m_pOld)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(!pLegacy->m_pOld)
return;
assert(pLegacy->m_pOld->Which() != RES_OBJECTDYING);
if(!pLegacy->m_pNew)
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index aa2d2d624fd2..bbbfaaa5ef3e 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -700,8 +700,10 @@ void SwUndoSetFlyFormat::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem )
void SwUndoSetFlyFormat::SwClientNotify(const SwModify&, const SfxHint& rHint)
{
- auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint);
- if(!pLegacy || !pLegacy->m_pOld)
+ if (rHint.GetId() != SfxHintId::SwLegacyModify)
+ return;
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
+ if(!pLegacy->m_pOld)
return;
const sal_uInt16 nWhich = pLegacy->m_pOld->Which();
if(nWhich < POOLATTR_END)
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 04e28ab30c4f..fc7b5414dc20 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2171,7 +2171,7 @@ void SwChartDataSequence::Notify( const SfxHint& rHint)
m_pTableCursor.reset(nullptr);
dispose();
}
- else if (dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
setModified( true );
}
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index a4f4cb597415..796ed4bf4576 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2629,8 +2629,9 @@ void SwXTextField::Impl::Notify(const SfxHint& rHint)
if(rHint.GetId() == SfxHintId::Dying)
Invalidate();
- else if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
switch(pLegacyHint->m_pOld ? pLegacyHint->m_pOld->Which() : 0)
{
case RES_REMOVE_UNO_OBJECT:
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 1b75e9fb0e24..b74faf87bdc4 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -359,8 +359,9 @@ public:
void SwXDocumentIndex::Impl::Notify(const SfxHint& rHint)
{
- if(auto pLegacy = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(pLegacy->m_pOld && pLegacy->m_pOld->Which() == RES_REMOVE_UNO_OBJECT)
m_pFormat = nullptr;
}
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e81bcec11df4..df41a5f03750 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -967,8 +967,9 @@ void SwFltAnchorListener::Notify(const SfxHint& rHint)
return;
m_pFltAnchor->SetFrameFormat(nullptr);
}
- else if (auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
+ else if (rHint.GetId() == SfxHintId::SwLegacyModify)
{
+ auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
if(pLegacyHint->m_pNew->Which() != RES_FMT_CHG)
return;
auto pFormatChg = dynamic_cast<const SwFormatChg*>(pLegacyHint->m_pNew);