diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-05-27 23:57:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-28 18:01:54 +0200 |
commit | 2cb410d1a7e39f01bd1e8488b220d1bc6d9674a3 (patch) | |
tree | 61967a0c1f35efd34338fb5eaff4aabbd418fc44 /sw | |
parent | aea4dd58521b5621463c653a47275808a315edd6 (diff) |
avoid dynamic_cast in ModifyChangedHint
Change-Id: I78d9fc4984bf4313222c943816f81d31924dff26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168133
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/calbck.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docftn.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/node.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/fields/ddetbl.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/pagedesc.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 3 |
6 files changed, 11 insertions, 6 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 59a20220da1d..37e8b9ed62da 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -78,7 +78,7 @@ namespace sw }; struct ModifyChangedHint final: SfxHint { - ModifyChangedHint(const SwModify* pNew) : m_pNew(pNew) {}; + ModifyChangedHint(const SwModify* pNew) : SfxHint(SfxHintId::SwModifyChanged), m_pNew(pNew) {}; const SwModify* m_pNew; }; // Observer pattern using svl implementation diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index f211dcdcc9f4..690eff41bae0 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -259,8 +259,9 @@ void SwEndNoteInfo::SwClientNotify( const SwModify& rModify, const SfxHint& rHin CheckRegistration( pLegacyHint->m_pOld ); } } - else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) + else if (rHint.GetId() == SfxHintId::SwModifyChanged) { + auto pModifyChangedHint = static_cast<const sw::ModifyChangedHint*>(&rHint); auto pNew = const_cast<sw::BroadcastingModify*>(static_cast<const sw::BroadcastingModify*>(pModifyChangedHint->m_pNew)); if(m_pAnchorFormat == &rModify) m_pAnchorFormat = static_cast<SwCharFormat*>(pNew); diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 240fb569a89a..ffa6679a5e05 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1190,8 +1190,9 @@ void SwContentNode::SwClientNotify( const SwModify&, const SfxHint& rHint) static_cast<const sw::AutoFormatUsedHint&>(rHint).CheckNode(this); return; } - else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) + else if (rHint.GetId() == SfxHintId::SwModifyChanged) { + auto pModifyChangedHint = static_cast<const sw::ModifyChangedHint*>(&rHint); m_pCondColl = const_cast<SwFormatColl*>(static_cast<const SwFormatColl*>(pModifyChangedHint->m_pNew)); } else if(auto pCondCollCondChgHint = dynamic_cast<const sw::CondCollCondChg*>(&rHint)) diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 816abd07cae7..7a93abe3108e 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -117,8 +117,9 @@ void SwDDETable::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) { pGatherDdeTablesHint->m_rvTables.push_back(this); } - else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) + else if (rHint.GetId() == SfxHintId::SwModifyChanged) { + auto pModifyChangedHint = static_cast<const sw::ModifyChangedHint*>(&rHint); if(m_pDDEType == &rModify) m_pDDEType = const_cast<SwDDEFieldType*>(static_cast<const SwDDEFieldType*>(pModifyChangedHint->m_pNew)); } diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index f9679bb2a8e7..8471cb62ebc4 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -304,8 +304,9 @@ void SwPageDesc::SwClientNotify(const SwModify& rModify, const SfxHint& rHint) m_FirstMaster.SwClientNotify(rModify, rHint); m_FirstLeft.SwClientNotify(rModify, rHint); } - else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) + else if(rHint.GetId() == SfxHintId::SwModifyChanged) { + auto pModifyChangedHint = static_cast<const sw::ModifyChangedHint*>(&rHint); if(m_pTextFormatColl == &rModify) m_pTextFormatColl = static_cast<const SwTextFormatColl*>(pModifyChangedHint->m_pNew); else diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 1cacb1ed3891..908068239da4 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1608,8 +1608,9 @@ void SwXDocumentIndexMark::Impl::Invalidate() void SwXDocumentIndexMark::Impl::Notify(const SfxHint& rHint) { - if(auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint)) + if(rHint.GetId() == SfxHintId::SwModifyChanged) { + auto pModifyChangedHint = static_cast<const sw::ModifyChangedHint*>(&rHint); if(auto pNewType = dynamic_cast<const SwTOXType*>(pModifyChangedHint->m_pNew)) m_pTOXType = pNewType; |