From 4cfcc9ac37b90ce64c8402a41eb4638adb185b5c Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 13 Dec 2022 10:51:31 +0100 Subject: loplugin:unocast (framework::Desktop) (See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: Ifcf713b0543e78a124f613bcbda496069a280dab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144762 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- framework/source/services/desktop.cxx | 10 ++++++++++ framework/source/services/sessionlistener.cxx | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'framework') diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 048b677c9daa..d58eaa9334c7 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -335,6 +336,15 @@ void Desktop::shutdown() xSfxTerminator->notifyTermination(aEvent); } +sal_Int64 Desktop::getSomething(css::uno::Sequence const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence const & Desktop::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + namespace { class QuickstartSuppressor diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 188b082fe94c..01c8218b087d 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -342,7 +343,7 @@ void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); // honestly: how many implementations of XDesktop will we ever have? // so casting this directly to the implementation - Desktop* pDesktop(dynamic_cast(xDesktop.get())); + Desktop* pDesktop(comphelper::getFromUnoTunnel(xDesktop)); if(pDesktop) { SAL_INFO("fwk.session", " XDesktop is a framework::Desktop -- good."); -- cgit