diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-09-04 11:11:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-09-05 08:10:26 +0200 |
commit | ac9eaf5d11e5f44d7faa628233438a3b1bb89d6f (patch) | |
tree | a4ecd3dc27a4d24176442ebe6f9aedc9ad05cd8f /sfx2/source/doc | |
parent | 0266763e05d1ca9413321533dcea73c4643db476 (diff) |
use less dynamic_cast when broadcasting SfxHint
Change-Id: If4d33cbbf36a9ad495b80a7347b39d0f4bc0405e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172857
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/printhelper.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/doc/sfxbasemodel.cxx | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 8ef4d4eb1e4d..ddb766e72225 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -756,9 +756,13 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { - const SfxPrintingHint* pPrintHint = dynamic_cast<const SfxPrintingHint*>(&rHint); + if (rHint.GetId() != SfxHintId::ThisIsAnSfxEventHint) + return; + const SfxEventHint& rEventHint = static_cast<const SfxEventHint&>(rHint); + if (rEventHint.GetEventId() != SfxEventHintId::PrintDoc) + return; + const SfxPrintingHint* pPrintHint = static_cast<const SfxPrintingHint*>(&rHint); if ( &rBC != m_pObjectShell.get() - || !pPrintHint || pPrintHint->GetWhich() == SFX_PRINTABLESTATE_CANCELJOB ) return; diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index a217dc252a85..2db0f2b857a3 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2983,8 +2983,8 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , } Any aSupplement; - if (const SfxPrintingHint* pPrintingHint = dynamic_cast<const SfxPrintingHint*>(&rHint)) - aSupplement <<= pPrintingHint->GetWhich(); + if (rNamedHint.GetEventId() == SfxEventHintId::PrintDoc) + aSupplement <<= static_cast<const SfxPrintingHint*>(&rHint)->GetWhich(); const SfxViewEventHint* pViewHint = dynamic_cast<const SfxViewEventHint*>(&rHint); postEvent_Impl( rNamedHint.GetEventName(), pViewHint ? pViewHint->GetController() : Reference< frame::XController2 >(), aSupplement ); } |