diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-05-27 21:13:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-28 09:58:48 +0200 |
commit | 25caf7dfd01534f9cdb044676c05c798fac96917 (patch) | |
tree | a2fcf9ead905fa1d7c35fd263e3849801243e3bc /sw/source/uibase/docvw | |
parent | e7fcca88ce9acc78a402c5929d063e3cfc573be4 (diff) |
avoid dynamic_cast in PostItMgr
Change-Id: Ieb571b8f39de1ffbc5cf1ce257204dca9bdb649e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168121
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
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) |