include/svl/hint.hxx                 |   24 ++++++++++++++++++--
 include/svl/lstner.hxx               |    3 ++
 include/svx/svdview.hxx              |    2 +
 svx/source/svdraw/svdviter.cxx       |    3 +-
 sw/inc/fmtfld.hxx                    |   26 +++++++++++++++------
 sw/inc/frmfmt.hxx                    |   42 +++++++++++++++++++++++++----------
 sw/source/core/draw/dcontact.cxx     |   36 ++++++++++++++++++++----------
 sw/source/core/fields/ddetbl.cxx     |    3 +-
 sw/source/core/inc/fieldhint.hxx     |    3 +-
 sw/source/core/layout/fly.cxx        |    6 +++--
 sw/source/core/txtnode/atrfld.cxx    |   34 ++++++++++++++++++++--------
 sw/source/filter/basflt/fltshell.cxx |    8 +++++-
 12 files changed, 142 insertions(+), 48 deletions(-)

New commits:
commit ce29e6299932fc079b05b60662ba95c8342990bc
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 15 10:28:30 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jul 15 23:02:36 2022 +0200

    tdf#119840 elide some dynamic_cast cost
    
    when opening a large writer file, shaves off about 5% off load time
    
    Change-Id: I501d0ebfbaec572e7c93c1dbc3f0cfaab3938f20
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137099
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 12f66eb5323a..f46df6a34342 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -24,6 +24,7 @@
 
 #include <svl/svldllapi.h>
 
+/// hint ids, mostly used to avoid dynamic_cast of SfxHint
 enum class SfxHintId {
     NONE,
     Dying,
@@ -119,8 +120,27 @@ enum class SfxHintId {
     SwLegacyModify,
     SwCollectTextMarks,
     SwCollectTextTOXMarksForLayout,
-
-    ThisIsAnSdrHint // used to avoid dynamic_cast
+    SwDrawFrameFormat,
+    SwCheckDrawFrameFormatLayer,
+    SwContactChanged,
+    SwDrawFormatLayoutCopy,
+    SwRestoreFlyAnchor,
+    SwCreatePortion,
+    SwCollectTextObjects,
+    SwGetZOrder,
+    SwGetObjectConnected,
+    SwFindSdrObject,
+    SwWW8AnchorConv,
+    SwField,
+    SwFindFormatForField,
+    SwFindFormatForPostItId,
+    SwCollectPostIts,
+    SwHasHiddenInformationNotes,
+    SwGatherNodeIndex,
+    SwGatherRefFields,
+    SwGatherFields,
+
+    ThisIsAnSdrHint
 };
 
 template< typename charT, typename traits >
diff --git a/include/svl/lstner.hxx b/include/svl/lstner.hxx
index 1b0e8806376b..f9a35f10a84a 100644
--- a/include/svl/lstner.hxx
+++ b/include/svl/lstner.hxx
@@ -68,6 +68,9 @@ public:
     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
 
     void                RemoveBroadcaster_Impl( SfxBroadcaster& rBC );
+
+    /// Used to avoid cost of dynamic_cast in SdrViewIter::ImpFindView
+    virtual bool        IsSdrView() const { return false; }
 };
 
 #endif
diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx
index 166990985830..e43b1bf00d0b 100644
--- a/include/svx/svdview.hxx
+++ b/include/svx/svdview.hxx
@@ -160,6 +160,8 @@ public:
 
     virtual ~SdrView() override;
 
+    virtual bool IsSdrView() const final { return true; }
+
     // The default value for all dispatchers is activated. If the app for 
example
     // wants to intervene in MouseDispatcher for special treatment, you have to
     // deactivate the MouseDispatcher with the help of the method below and 
you have
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index ff2d6da5f7a3..3ad7cb40f86e 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -122,7 +122,8 @@ SdrView* SdrViewIter::ImpFindView()
         while (mnListenerNum < nLsCnt)
         {
             SfxListener* pLs = mpModel->GetListener(mnListenerNum);
-            mpCurrentView = dynamic_cast<SdrView*>(pLs);
+            mpCurrentView
+                = pLs ? (pLs->IsSdrView() ? static_cast<SdrView*>(pLs) : 
nullptr) : nullptr;
 
             if (mpCurrentView)
             {
diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx
index 5687eaa2ec4d..08b58ec0b953 100644
--- a/sw/inc/fmtfld.hxx
+++ b/sw/inc/fmtfld.hxx
@@ -42,36 +42,48 @@ namespace sw {
     struct FindFormatForFieldHint final : SfxHint {
         const SwField* m_pField;
         SwFormatField*& m_rpFormat;
-        FindFormatForFieldHint(const SwField* pField, SwFormatField*& 
rpFormat) : m_pField(pField), m_rpFormat(rpFormat) {};
+        FindFormatForFieldHint(const SwField* pField, SwFormatField*& rpFormat)
+            : SfxHint(SfxHintId::SwFindFormatForField), m_pField(pField), 
m_rpFormat(rpFormat) {};
     };
     struct FindFormatForPostItIdHint final : SfxHint {
         const sal_uInt32 m_nPostItId;
         SwFormatField*& m_rpFormat;
-        FindFormatForPostItIdHint(const sal_uInt32 nPostItId, SwFormatField*& 
rpFormat) : m_nPostItId(nPostItId), m_rpFormat(rpFormat) {};
+        FindFormatForPostItIdHint(const sal_uInt32 nPostItId, SwFormatField*& 
rpFormat)
+            : SfxHint(SfxHintId::SwFindFormatForPostItId), 
m_nPostItId(nPostItId), m_rpFormat(rpFormat) {};
     };
     struct CollectPostItsHint final : SfxHint {
         std::vector<SwFormatField*>& m_rvFormatFields;
         IDocumentRedlineAccess const& m_rIDRA;
         const bool m_bHideRedlines;
-        CollectPostItsHint(std::vector<SwFormatField*>& rvFormatFields, 
IDocumentRedlineAccess const& rIDRA, bool bHideRedlines) : 
m_rvFormatFields(rvFormatFields), m_rIDRA(rIDRA), 
m_bHideRedlines(bHideRedlines) {};
+        CollectPostItsHint(std::vector<SwFormatField*>& rvFormatFields, 
IDocumentRedlineAccess const& rIDRA, bool bHideRedlines)
+            : SfxHint(SfxHintId::SwCollectPostIts),
+              m_rvFormatFields(rvFormatFields), m_rIDRA(rIDRA), 
m_bHideRedlines(bHideRedlines) {};
     };
     struct HasHiddenInformationNotesHint final : SfxHint {
         bool& m_rbHasHiddenInformationNotes;
-        HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes) : 
m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {};
+        HasHiddenInformationNotesHint(bool& rbHasHiddenInformationNotes)
+            : SfxHint(SfxHintId::SwHasHiddenInformationNotes),
+              m_rbHasHiddenInformationNotes(rbHasHiddenInformationNotes) {};
     };
     struct GatherNodeIndexHint final : SfxHint {
         std::vector<SwNodeOffset>& m_rvNodeIndex;
-        GatherNodeIndexHint(std::vector<SwNodeOffset>& rvNodeIndex) : 
m_rvNodeIndex(rvNodeIndex) {};
+        GatherNodeIndexHint(std::vector<SwNodeOffset>& rvNodeIndex)
+            : SfxHint(SfxHintId::SwGatherNodeIndex),
+              m_rvNodeIndex(rvNodeIndex) {};
     };
     struct GatherRefFieldsHint final : SfxHint {
         std::vector<SwGetRefField*>& m_rvRFields;
         const sal_uInt16 m_nType;
-        GatherRefFieldsHint(std::vector<SwGetRefField*>& rvRFields, const 
sal_uInt16 nType) : m_rvRFields(rvRFields), m_nType(nType) {};
+        GatherRefFieldsHint(std::vector<SwGetRefField*>& rvRFields, const 
sal_uInt16 nType)
+            : SfxHint(SfxHintId::SwGatherRefFields),
+              m_rvRFields(rvRFields), m_nType(nType) {};
     };
     struct GatherFieldsHint final : SfxHint {
         const bool m_bCollectOnlyInDocNodes;
         std::vector<SwFormatField*>& m_rvFields;
-        GatherFieldsHint(std::vector<SwFormatField*>& rvFields, bool 
bCollectOnlyInDocNodes = true) : 
m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), m_rvFields(rvFields) {};
+        GatherFieldsHint(std::vector<SwFormatField*>& rvFields, bool 
bCollectOnlyInDocNodes = true)
+            : SfxHint(SfxHintId::SwGatherFields),
+              m_bCollectOnlyInDocNodes(bCollectOnlyInDocNodes), 
m_rvFields(rvFields) {};
     };
     struct GatherDdeTablesHint final : SfxHint {
         std::vector<SwDDETable*>& m_rvTables;
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index bc0944fa39fe..1b40dd012224 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -49,7 +49,8 @@ namespace sw
     struct SW_DLLPUBLIC FindSdrObjectHint final : SfxHint
     {
         SdrObject*& m_rpObject;
-        FindSdrObjectHint(SdrObject*& rpObject) : m_rpObject(rpObject) {};
+        FindSdrObjectHint(SdrObject*& rpObject)
+            : SfxHint(SfxHintId::SwFindSdrObject), m_rpObject(rpObject) {};
         virtual ~FindSdrObjectHint() override;
     };
 }
@@ -279,26 +280,33 @@ namespace sw
     struct DrawFrameFormatHint final: SfxHint
     {
         DrawFrameFormatHintId m_eId;
-        DrawFrameFormatHint(DrawFrameFormatHintId eId) : m_eId(eId) {};
+        DrawFrameFormatHint(DrawFrameFormatHintId eId)
+            : SfxHint(SfxHintId::SwDrawFrameFormat), m_eId(eId) {};
         virtual ~DrawFrameFormatHint() override;
     };
     struct CheckDrawFrameFormatLayerHint final: SfxHint
     {
         bool* m_bCheckControlLayer;
-        CheckDrawFrameFormatLayerHint(bool* bCheckControlLayer) : 
m_bCheckControlLayer(bCheckControlLayer) {};
+        CheckDrawFrameFormatLayerHint(bool* bCheckControlLayer)
+            : SfxHint(SfxHintId::SwCheckDrawFrameFormatLayer),
+              m_bCheckControlLayer(bCheckControlLayer) {};
         virtual ~CheckDrawFrameFormatLayerHint() override;
     };
     struct ContactChangedHint final: SfxHint
     {
         SdrObject** m_ppObject;
-        ContactChangedHint(SdrObject** ppObject) : m_ppObject(ppObject) {};
+        ContactChangedHint(SdrObject** ppObject)
+            : SfxHint(SfxHintId::SwContactChanged),
+              m_ppObject(ppObject) {};
         virtual ~ContactChangedHint() override;
     };
     struct DrawFormatLayoutCopyHint final : SfxHint
     {
         SwDrawFrameFormat& m_rDestFormat;
         SwDoc& m_rDestDoc;
-        DrawFormatLayoutCopyHint(SwDrawFrameFormat& rDestFormat, SwDoc& 
rDestDoc) : m_rDestFormat(rDestFormat), m_rDestDoc(rDestDoc) {};
+        DrawFormatLayoutCopyHint(SwDrawFrameFormat& rDestFormat, SwDoc& 
rDestDoc)
+            : SfxHint(SfxHintId::SwDrawFormatLayoutCopy),
+              m_rDestFormat(rDestFormat), m_rDestDoc(rDestDoc) {};
         virtual ~DrawFormatLayoutCopyHint() override;
     };
     enum class WW8AnchorConv
@@ -321,38 +329,50 @@ namespace sw
     struct SW_DLLPUBLIC WW8AnchorConvHint final : SfxHint
     {
         WW8AnchorConvResult& m_rResult;
-        WW8AnchorConvHint(WW8AnchorConvResult& rResult) : m_rResult(rResult) 
{};
+        WW8AnchorConvHint(WW8AnchorConvResult& rResult)
+            : SfxHint(SfxHintId::SwWW8AnchorConv),
+              m_rResult(rResult) {};
         virtual ~WW8AnchorConvHint() override;
     };
     struct RestoreFlyAnchorHint final : SfxHint
     {
         const Point m_aPos;
-        RestoreFlyAnchorHint(Point aPos) : m_aPos(aPos) {};
+        RestoreFlyAnchorHint(Point aPos)
+            : SfxHint(SfxHintId::SwRestoreFlyAnchor),
+              m_aPos(aPos) {};
         virtual ~RestoreFlyAnchorHint() override;
     };
     struct CreatePortionHint final : SfxHint
     {
         SwDrawContact** m_ppContact;
-        CreatePortionHint(SwDrawContact** ppContact) : m_ppContact(ppContact) 
{};
+        CreatePortionHint(SwDrawContact** ppContact)
+            : SfxHint(SfxHintId::SwCreatePortion),
+              m_ppContact(ppContact) {};
         virtual ~CreatePortionHint() override;
     };
     struct CollectTextObjectsHint final : SfxHint
     {
         std::list<SdrTextObj*>& m_rTextObjects;
-        CollectTextObjectsHint(std::list<SdrTextObj*>& rTextObjects) : 
m_rTextObjects(rTextObjects) {};
+        CollectTextObjectsHint(std::list<SdrTextObj*>& rTextObjects)
+            : SfxHint(SfxHintId::SwCollectTextObjects),
+              m_rTextObjects(rTextObjects) {};
         virtual ~CollectTextObjectsHint() override;
     };
     struct GetZOrderHint final : SfxHint
     {
         sal_uInt32& m_rnZOrder;
-        GetZOrderHint(sal_uInt32& rnZOrder) : m_rnZOrder(rnZOrder) {};
+        GetZOrderHint(sal_uInt32& rnZOrder)
+            : SfxHint(SfxHintId::SwGetZOrder),
+              m_rnZOrder(rnZOrder) {};
         virtual ~GetZOrderHint() override;
     };
     struct GetObjectConnectedHint final : SfxHint
     {
         bool& m_risConnected;
         const SwRootFrame* m_pRoot;
-        GetObjectConnectedHint(bool& risConnected, const SwRootFrame* pRoot) : 
m_risConnected(risConnected), m_pRoot(pRoot) {};
+        GetObjectConnectedHint(bool& risConnected, const SwRootFrame* pRoot)
+            : SfxHint(SfxHintId::SwGetObjectConnected),
+              m_risConnected(risConnected), m_pRoot(pRoot) {};
         virtual ~GetObjectConnectedHint() override;
     };
 }
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 54e156710de0..1ca90b18eec9 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -421,13 +421,15 @@ namespace
 void SwContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
 {
     // this does not call SwClient::SwClientNotify and thus doesn't handle 
RES_OBJECTDYING as usual. Is this intentional?
-    if (auto pFindSdrObjectHint = dynamic_cast<const 
sw::FindSdrObjectHint*>(&rHint))
+    if (rHint.GetId() == SfxHintId::SwFindSdrObject)
     {
+        auto pFindSdrObjectHint = static_cast<const 
sw::FindSdrObjectHint*>(&rHint);
         if(!pFindSdrObjectHint->m_rpObject)
             pFindSdrObjectHint->m_rpObject = GetMaster();
     }
-    else if (auto pWW8AnchorConvHint = dynamic_cast<const 
sw::WW8AnchorConvHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwWW8AnchorConv)
     {
+        auto pWW8AnchorConvHint = static_cast<const 
sw::WW8AnchorConvHint*>(&rHint);
         // determine anchored object
         SwAnchoredObject* pAnchoredObj(nullptr);
         {
@@ -664,8 +666,9 @@ void SwFlyDrawContact::GetAnchoredObjs( 
std::vector<SwAnchoredObject*>& _roAncho
 void SwFlyDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& 
rHint)
 {
     SwContact::SwClientNotify(rMod, rHint);
-    if(auto pGetZOrdnerHint = dynamic_cast<const sw::GetZOrderHint*>(&rHint))
+    if(rHint.GetId() == SfxHintId::SwGetZOrder)
     {
+        auto pGetZOrdnerHint = static_cast<const sw::GetZOrderHint*>(&rHint);
         // #i11176#
         // This also needs to work when no layout exists. Thus, for
         // FlyFrames an alternative method is used now in that case.
@@ -1512,8 +1515,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
         // #i51474#
         GetAnchoredObj(nullptr)->ResetLayoutProcessBools();
     }
-    else if (auto pDrawFrameFormatHint = dynamic_cast<const 
sw::DrawFrameFormatHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwDrawFrameFormat)
     {
+        auto pDrawFrameFormatHint = static_cast<const 
sw::DrawFrameFormatHint*>(&rHint);
         switch(pDrawFrameFormatHint->m_eId)
         {
             case sw::DrawFrameFormatHintId::DYING:
@@ -1548,19 +1552,22 @@ void SwDrawContact::SwClientNotify(const SwModify& 
rMod, const SfxHint& rHint)
                 ;
         }
     }
-    else if (auto pCheckDrawFrameFormatLayerHint = dynamic_cast<const 
sw::CheckDrawFrameFormatLayerHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwCheckDrawFrameFormatLayer)
     {
+        auto pCheckDrawFrameFormatLayerHint = static_cast<const 
sw::CheckDrawFrameFormatLayerHint*>(&rHint);
         *(pCheckDrawFrameFormatLayerHint->m_bCheckControlLayer) |= 
(GetMaster() && CheckControlLayer(GetMaster()));
     }
-    else if (auto pContactChangedHint = dynamic_cast<const 
sw::ContactChangedHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwContactChanged)
     {
+        auto pContactChangedHint = static_cast<const 
sw::ContactChangedHint*>(&rHint);
         if(!*pContactChangedHint->m_ppObject)
             *pContactChangedHint->m_ppObject = GetMaster();
         auto pObject = *pContactChangedHint->m_ppObject;
         Changed(*pObject, SdrUserCallType::Delete, 
pObject->GetLastBoundRect());
     }
-    else if (auto pDrawFormatLayoutCopyHint = dynamic_cast<const 
sw::DrawFormatLayoutCopyHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwDrawFormatLayoutCopy)
     {
+        auto pDrawFormatLayoutCopyHint = static_cast<const 
sw::DrawFormatLayoutCopyHint*>(&rHint);
         const SwDrawFrameFormat& rFormat = static_cast<const 
SwDrawFrameFormat&>(rMod);
         new SwDrawContact(
                 &pDrawFormatLayoutCopyHint->m_rDestFormat,
@@ -1573,8 +1580,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
         if(rFormat.IsPosAttrSet())
             pDrawFormatLayoutCopyHint->m_rDestFormat.PosAttrSet();
     }
-    else if (auto pRestoreFlyAnchorHint = dynamic_cast<const 
sw::RestoreFlyAnchorHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwRestoreFlyAnchor)
     {
+        auto pRestoreFlyAnchorHint = static_cast<const 
sw::RestoreFlyAnchorHint*>(&rHint);
         SdrObject* pObj = GetMaster();
         if(GetAnchorFrame() && !pObj->IsInserted())
         {
@@ -1584,8 +1592,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
         }
         pObj->SetRelativePos(pRestoreFlyAnchorHint->m_aPos);
     }
-    else if (auto pCreatePortionHint = dynamic_cast<const 
sw::CreatePortionHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwCreatePortion)
     {
+        auto pCreatePortionHint = static_cast<const 
sw::CreatePortionHint*>(&rHint);
         if(*pCreatePortionHint->m_ppContact)
             return;
         *pCreatePortionHint->m_ppContact = this; // This is kind of 
ridiculous: the FrameFormat doesn't even hold a pointer to the contact itself,  
but here we are leaking it out randomly
@@ -1597,8 +1606,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
             MoveObjToVisibleLayer(GetMaster());
         }
     }
-    else if (auto pCollectTextObjectsHint = dynamic_cast<const 
sw::CollectTextObjectsHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwCollectTextObjects)
     {
+        auto pCollectTextObjectsHint = static_cast<const 
sw::CollectTextObjectsHint*>(&rHint);
         auto pSdrO = GetMaster();
         if(!pSdrO)
             return;
@@ -1620,14 +1630,16 @@ void SwDrawContact::SwClientNotify(const SwModify& 
rMod, const SfxHint& rHint)
                 pCollectTextObjectsHint->m_rTextObjects.push_back(pTextObj);
         }
     }
-    else if (auto pGetZOrdnerHint = dynamic_cast<const 
sw::GetZOrderHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwGetZOrder)
     {
+        auto pGetZOrdnerHint = static_cast<const sw::GetZOrderHint*>(&rHint);
         auto pFormat(dynamic_cast<const SwFrameFormat*>(&rMod));
         if(pFormat->Which() == RES_DRAWFRMFMT)
             pGetZOrdnerHint->m_rnZOrder = GetMaster()->GetOrdNum();
     }
-    else if (auto pConnectedHint = dynamic_cast<const 
sw::GetObjectConnectedHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwGetObjectConnected)
     {
+        auto pConnectedHint = static_cast<const 
sw::GetObjectConnectedHint*>(&rHint);
         pConnectedHint->m_risConnected |= (GetAnchorFrame() != nullptr);
     }
 }
diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx
index b1576e1a1589..31f46e08fe36 100644
--- a/sw/source/core/fields/ddetbl.cxx
+++ b/sw/source/core/fields/ddetbl.cxx
@@ -97,8 +97,9 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, 
const SfxHint& rHint)
                 SwTable::SwClientNotify(rModify, rHint);
         }
     }
-    else if(auto pFieldHint = dynamic_cast<const SwFieldHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwField)
     {
+        auto pFieldHint = static_cast<const SwFieldHint*>(&rHint);
         pFieldHint->m_pPaM->DeleteMark(); // TODO: this is really hackish
         // replace DDETable by real table
         NoDDETable();
diff --git a/sw/source/core/inc/fieldhint.hxx b/sw/source/core/inc/fieldhint.hxx
index f71970f89130..27d31f86f647 100644
--- a/sw/source/core/inc/fieldhint.hxx
+++ b/sw/source/core/inc/fieldhint.hxx
@@ -32,7 +32,8 @@ public:
     SwRootFrame const* m_pLayout;
 
     SwFieldHint(SwPaM* const pPaM, SwRootFrame const* const pLayout)
-        : m_pPaM(pPaM)
+        : SfxHint(SfxHintId::SwField)
+        , m_pPaM(pPaM)
         , m_pLayout(pLayout)
     {
     }
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index afe143f158a9..bc73c7463c37 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -728,14 +728,16 @@ void SwFlyFrame::SwClientNotify(const SwModify& rMod, 
const SfxHint& rHint)
         // #i87645# - reset flags for the layout process (only if something 
has been invalidated)
         ResetLayoutProcessBools();
     }
-    else if (auto pGetZOrdnerHint = dynamic_cast<const 
sw::GetZOrderHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwGetZOrder)
     {
+        auto pGetZOrdnerHint = static_cast<const sw::GetZOrderHint*>(&rHint);
         const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
         if (rFormat.Which() == RES_FLYFRMFMT && 
rFormat.getIDocumentLayoutAccess().GetCurrentViewShell()) // #i11176#
             pGetZOrdnerHint->m_rnZOrder = GetVirtDrawObj()->GetOrdNum();
     }
-    else if (auto pConnectedHint = dynamic_cast<const 
sw::GetObjectConnectedHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwGetObjectConnected)
     {
+        auto pConnectedHint = static_cast<const 
sw::GetObjectConnectedHint*>(&rHint);
         const auto& rFormat(dynamic_cast<const SwFrameFormat&>(rMod));
         if (!pConnectedHint->m_risConnected && rFormat.Which() == 
RES_FLYFRMFMT && (!pConnectedHint->m_pRoot || pConnectedHint->m_pRoot == 
getRootFrame()))
             pConnectedHint->m_risConnected = true;
diff --git a/sw/source/core/txtnode/atrfld.cxx 
b/sw/source/core/txtnode/atrfld.cxx
index d6fab571bbe9..85d1eafc98c5 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -222,8 +222,9 @@ void SwFormatField::InvalidateField()
 void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& 
rHint )
 {
     SwClient::SwClientNotify(rModify, rHint);
-    if (const auto pFieldHint = dynamic_cast<const SwFieldHint*>( &rHint ))
+    if (rHint.GetId() == SfxHintId::SwField)
     {
+        const auto pFieldHint = static_cast<const SwFieldHint*>( &rHint );
         // replace field content by text
         SwPaM* pPaM = pFieldHint->m_pPaM;
         pPaM->DeleteMark(); // TODO: this is really hackish
@@ -241,42 +242,57 @@ void SwFormatField::SwClientNotify( const SwModify& 
rModify, const SfxHint& rHin
         pPaM->Move( fnMoveForward );
         rDoc.getIDocumentContentOperations().DeleteRange( *pPaM );
         rDoc.getIDocumentContentOperations().InsertString( *pPaM, aEntry );
-    } else if (rHint.GetId() == SfxHintId::SwLegacyModify)
+    }
+    else if (rHint.GetId() == SfxHintId::SwLegacyModify)
     {
         auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
         if( !mpTextField )
             return;
         UpdateTextNode(pLegacyHint->m_pOld, pLegacyHint->m_pNew);
-    } else if (const auto pFindForFieldHint = dynamic_cast<const 
sw::FindFormatForFieldHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwFindFormatForField)
     {
+        const auto pFindForFieldHint = static_cast<const 
sw::FindFormatForFieldHint*>( &rHint );
         if(pFindForFieldHint->m_rpFormat == nullptr && 
pFindForFieldHint->m_pField == GetField())
             pFindForFieldHint->m_rpFormat = this;
-    } else if (const auto pFindForPostItIdHint = dynamic_cast<const 
sw::FindFormatForPostItIdHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwFindFormatForPostItId)
     {
+        const auto pFindForPostItIdHint = static_cast<const 
sw::FindFormatForPostItIdHint*>( &rHint );
         auto pPostItField = dynamic_cast<SwPostItField*>(mpField.get());
         if(pPostItField && pFindForPostItIdHint->m_rpFormat == nullptr && 
pFindForPostItIdHint->m_nPostItId == pPostItField->GetPostItId())
             pFindForPostItIdHint->m_rpFormat = this;
-    } else if (const auto pCollectPostItsHint = dynamic_cast<const 
sw::CollectPostItsHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwCollectPostIts)
     {
+        const auto pCollectPostItsHint = static_cast<const 
sw::CollectPostItsHint*>( &rHint );
         if(GetTextField() && IsFieldInDoc() && 
(!pCollectPostItsHint->m_bHideRedlines || 
!sw::IsFieldDeletedInModel(pCollectPostItsHint->m_rIDRA, *GetTextField())))
             pCollectPostItsHint->m_rvFormatFields.push_back(this);
-    } else if (const auto pHasHiddenInfoHint = dynamic_cast<const 
sw::HasHiddenInformationNotesHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwHasHiddenInformationNotes)
     {
+        const auto pHasHiddenInfoHint = static_cast<const 
sw::HasHiddenInformationNotesHint*>( &rHint );
         if(!pHasHiddenInfoHint->m_rbHasHiddenInformationNotes && 
GetTextField() && IsFieldInDoc())
             pHasHiddenInfoHint->m_rbHasHiddenInformationNotes = true;
-    } else if (const auto pGatherNodeIndexHint = dynamic_cast<const 
sw::GatherNodeIndexHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwGatherNodeIndex)
     {
+        const auto pGatherNodeIndexHint = static_cast<const 
sw::GatherNodeIndexHint*>( &rHint );
         if(auto pTextField = GetTextField())
             
pGatherNodeIndexHint->m_rvNodeIndex.push_back(pTextField->GetTextNode().GetIndex());
-    } else if (const auto pGatherRefFieldsHint = dynamic_cast<const 
sw::GatherRefFieldsHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwGatherRefFields)
     {
+        const auto pGatherRefFieldsHint = static_cast<const 
sw::GatherRefFieldsHint*>( &rHint );
         if(!GetTextField() || pGatherRefFieldsHint->m_nType != 
GetField()->GetSubType())
             return;
         SwTextNode* pNd = GetTextField()->GetpTextNode();
         if(pNd && pNd->GetNodes().IsDocNodes())
             
pGatherRefFieldsHint->m_rvRFields.push_back(static_cast<SwGetRefField*>(GetField()));
-    } else if (const auto pGatherFieldsHint = dynamic_cast<const 
sw::GatherFieldsHint*>( &rHint ))
+    }
+    else if (rHint.GetId() == SfxHintId::SwGatherFields)
     {
+        const auto pGatherFieldsHint = static_cast<const 
sw::GatherFieldsHint*>( &rHint );
         if(pGatherFieldsHint->m_bCollectOnlyInDocNodes)
         {
             if(!GetTextField())
diff --git a/sw/source/filter/basflt/fltshell.cxx 
b/sw/source/filter/basflt/fltshell.cxx
index c6cd47ace34a..b4319e3d5a4f 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -892,8 +892,9 @@ void SwFltAnchorListener::Notify(const SfxHint& rHint)
 {
     if (rHint.GetId() == SfxHintId::Dying)
         m_pFltAnchor->SetFrameFormat(nullptr);
-    else if (auto pDrawFrameFormatHint = dynamic_cast<const 
sw::DrawFrameFormatHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwDrawFrameFormat)
     {
+        auto pDrawFrameFormatHint = static_cast<const 
sw::DrawFrameFormatHint*>(&rHint);
         if (pDrawFrameFormatHint->m_eId != sw::DrawFrameFormatHintId::DYING)
             return;
         m_pFltAnchor->SetFrameFormat(nullptr);
@@ -1042,8 +1043,11 @@ void FrameDeleteWatch::Notify(const SfxHint& rHint)
     bool bDying = false;
     if (rHint.GetId() == SfxHintId::Dying)
         bDying = true;
-    else if (auto pDrawFrameFormatHint = dynamic_cast<const 
sw::DrawFrameFormatHint*>(&rHint))
+    else if (rHint.GetId() == SfxHintId::SwDrawFrameFormat)
+    {
+        auto pDrawFrameFormatHint = static_cast<const 
sw::DrawFrameFormatHint*>(&rHint);
         bDying = pDrawFrameFormatHint->m_eId == 
sw::DrawFrameFormatHintId::DYING;
+    }
     if (bDying)
     {
         m_pFormat = nullptr;

Reply via email to