diff options
-rw-r--r-- | include/svl/hint.hxx | 2 | ||||
-rw-r--r-- | sw/inc/fmtfld.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 7 |
3 files changed, 8 insertions, 4 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx index f93c9196c9a2..98c37e4b7baa 100644 --- a/include/svl/hint.hxx +++ b/include/svl/hint.hxx @@ -157,6 +157,7 @@ enum class SfxHintId { SwTableHeadingChange, SwVirtPageNumHint, SwAutoFormatUsedHint, + SwFormatField, ThisIsAnSdrHint, ThisIsAnSfxEventHint @@ -246,6 +247,7 @@ inline std::basic_ostream<charT, traits> & operator <<( return stream << "SwNavigatorSelectOutlinesWithSelections"; case SfxHintId::SwCollectTextMarks: return stream << "SwCollectTextMarks"; case SfxHintId::SwCollectTextTOXMarksForLayout: return stream << "SwCollectTextTOXMarksForLayout"; + case SfxHintId::SwFormatField: return stream << "SwFormatField"; case SfxHintId::ThisIsAnSdrHint: return stream << "SdrHint"; default: return stream << "unk(" << std::to_string(int(id)) << ")"; } diff --git a/sw/inc/fmtfld.hxx b/sw/inc/fmtfld.hxx index c9f7d756c0b9..5df4f0beaf57 100644 --- a/sw/inc/fmtfld.hxx +++ b/sw/inc/fmtfld.hxx @@ -196,7 +196,8 @@ class SW_DLLPUBLIC SwFormatFieldHint final : public SfxHint public: SwFormatFieldHint( const SwFormatField* pField, SwFormatFieldHintWhich nWhich, const SwView* pView = nullptr) - : m_pField(pField) + : SfxHint(SfxHintId::SwFormatField) + , m_pField(pField) , m_nWhich(nWhich) , m_pView(pView) {} diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 95eaea2a5557..8a2ab40317ed 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -355,8 +355,9 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } } - else if ( const SwFormatFieldHint * pFormatHint = dynamic_cast<const SwFormatFieldHint*>(&rHint) ) + else if ( rHint.GetId() == SfxHintId::SwFormatField ) { + const SwFormatFieldHint * pFormatHint = static_cast<const SwFormatFieldHint*>(&rHint); SwFormatField* pField = const_cast <SwFormatField*>( pFormatHint->GetField() ); switch ( pFormatHint->Which() ) { @@ -1470,9 +1471,9 @@ class FieldDocWatchingStack : public SfxListener virtual void Notify(SfxBroadcaster&, const SfxHint& rHint) override { - const SwFormatFieldHint* pHint = dynamic_cast<const SwFormatFieldHint*>(&rHint); - if (!pHint) + if ( rHint.GetId() != SfxHintId::SwFormatField ) return; + const SwFormatFieldHint* pHint = static_cast<const SwFormatFieldHint*>(&rHint); bool bAllInvalidated = false; if (pHint->Which() == SwFormatFieldHintWhich::REMOVED) |