From 9bd3c25165447fb80b8f8cb8761943294e0a1502 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 6 Oct 2023 09:31:28 +0100 Subject: Related: cool#7373 add an SfxHintId::ThisIsAnSfxEventHint to avoid cost of dynamic_cast of SdrHint to SfxEventHint Change-Id: Ie0366b7d7ba828d8ffabeed4d65d7c7b275a3ed4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157620 Tested-by: Jenkins CollaboraOffice Reviewed-by: Noel Grandin --- sd/source/ui/view/ViewShellBase.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sd') diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx index 19be45aaca12..0f9123f5c374 100644 --- a/sd/source/ui/view/ViewShellBase.cxx +++ b/sd/source/ui/view/ViewShellBase.cxx @@ -401,10 +401,11 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) { SfxViewShell::Notify(rBC, rHint); - const SfxEventHint* pEventHint = dynamic_cast(&rHint); - if (pEventHint) + const SfxHintId nHintId = rHint.GetId(); + + if (nHintId == SfxHintId::ThisIsAnSfxEventHint) { - switch (pEventHint->GetEventId()) + switch (static_cast(rHint).GetEventId()) { case SfxEventHintId::OpenDoc: if( GetDocument() && GetDocument()->IsStartWithPresentation() ) @@ -423,8 +424,7 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) } else { - const SfxHintId nSlot = rHint.GetId(); - switch ( nSlot ) + switch (nHintId) { case SfxHintId::LanguageChanged: { -- cgit v1.2.3