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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 21 18:02:41 UTC 2021


 include/svl/hint.hxx                     |    1 +
 sw/inc/calbck.hxx                        |    2 +-
 sw/inc/swevent.hxx                       |    4 ++--
 sw/source/core/access/accframebase.cxx   |    3 ++-
 sw/source/core/access/accnotextframe.cxx |    3 ++-
 sw/source/core/access/acctable.cxx       |    3 ++-
 sw/source/core/access/acctextframe.cxx   |    3 ++-
 sw/source/core/attr/calbck.cxx           |   27 +++++++++++++++------------
 sw/source/core/attr/format.cxx           |    4 ++--
 sw/source/core/crsr/bookmrk.cxx          |    6 ++++--
 sw/source/core/crsr/crsrsh.cxx           |    4 ++--
 sw/source/core/doc/acmplwrd.cxx          |    4 ++--
 sw/source/core/doc/docftn.cxx            |    3 ++-
 sw/source/core/doc/fmtcol.cxx            |    6 +++---
 sw/source/core/doc/lineinfo.cxx          |    4 ++--
 sw/source/core/doc/notxtfrm.cxx          |    4 ++--
 sw/source/core/doc/number.cxx            |    4 ++--
 sw/source/core/docnode/node.cxx          |    3 ++-
 sw/source/core/docnode/section.cxx       |    8 ++++----
 sw/source/core/draw/dcontact.cxx         |    3 ++-
 sw/source/core/fields/ddetbl.cxx         |    3 ++-
 sw/source/core/fields/docufld.cxx        |    4 ++--
 sw/source/core/fields/expfld.cxx         |    6 ++++--
 sw/source/core/fields/reffld.cxx         |    4 ++--
 sw/source/core/fields/usrfld.cxx         |    9 ++++++---
 sw/source/core/layout/atrfrm.cxx         |    7 ++++---
 sw/source/core/layout/fly.cxx            |    3 ++-
 sw/source/core/layout/flycnt.cxx         |    4 ++--
 sw/source/core/layout/flyincnt.cxx       |    4 ++--
 sw/source/core/layout/flylay.cxx         |    6 ++++--
 sw/source/core/layout/pagechg.cxx        |    3 ++-
 sw/source/core/layout/pagedesc.cxx       |    3 ++-
 sw/source/core/layout/sectfrm.cxx        |    3 ++-
 sw/source/core/layout/tabfrm.cxx         |   11 ++++++-----
 sw/source/core/layout/wsfrm.cxx          |    8 ++++----
 sw/source/core/table/swtable.cxx         |    8 ++++----
 sw/source/core/text/txtfrm.cxx           |    3 ++-
 sw/source/core/tox/tox.cxx               |    3 ++-
 sw/source/core/txtnode/atrfld.cxx        |    3 ++-
 sw/source/core/txtnode/atrftn.cxx        |    4 ++--
 sw/source/core/txtnode/atrref.cxx        |    4 ++--
 sw/source/core/txtnode/fmtatr2.cxx       |   10 ++++++----
 sw/source/core/txtnode/ndtxt.cxx         |    3 ++-
 sw/source/core/txtnode/txtatr2.cxx       |    8 ++++----
 sw/source/core/undo/rolbck.cxx           |    6 ++++--
 sw/source/core/undo/unattr.cxx           |    6 ++++--
 sw/source/core/undo/undobj1.cxx          |    6 ++++--
 sw/source/core/unocore/unochart.cxx      |    2 +-
 sw/source/core/unocore/unofield.cxx      |    3 ++-
 sw/source/core/unocore/unoidx.cxx        |    3 ++-
 sw/source/filter/basflt/fltshell.cxx     |    3 ++-
 51 files changed, 147 insertions(+), 105 deletions(-)

New commits:
commit 7d188fe4639717df47e2ff72d8c1295e23862ef9
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jun 21 14:38:19 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jun 21 20:01:56 2021 +0200

    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 at collabora.co.uk>

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 1ba7d8d71477..58a57fcd1df9 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 05bb89d103ee..274af330fe13 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -751,9 +751,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 00eeed63ec70..d2c3f427687b 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 9d300621da0e..f69764b9035b 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -410,9 +410,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;
@@ -733,9 +733,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 1f0632850ad2..512ce30da3ff 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 f4b959014575..84a7cfd2d293 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -84,8 +84,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 da5bc1c31272..dfaef977b10a 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 6fa74682c675..25e03b9b4c8f 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 052626d8ac82..2f3694e47145 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2567,8 +2567,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 dff33525670d..384c79615348 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3292,9 +3292,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();
 
@@ -3926,9 +3926,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?
@@ -5440,8 +5440,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 cb03f3a9e1c0..a312c98f25c2 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -475,9 +475,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())
@@ -2332,9 +2332,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 64632d69e583..c2f3b3bd9764 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;
@@ -2172,9 +2172,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 ce0d6cc99c2f..1fd412c2e811 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 021da63a54e3..d789f91f171b 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 cb3a7d9830b2..170f67e974e8 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -5314,8 +5314,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 d15dbc6cd0c1..79ce7706b241 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 e90e274f04c4..18b140e745e9 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -898,8 +898,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);


More information about the Libreoffice-commits mailing list