diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-01 14:58:10 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-22 15:05:22 +0000 |
commit | feb8b833a6245d42400f42a0bc789dc84594ee6f (patch) | |
tree | 1eefe8ccde04f2ae15b617c379b52bcc886c6eb6 | |
parent | 37ca1154f392dd9eefad8250509652b845434793 (diff) |
loplugin:unocast (VCLXDialog)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: Ia3bf3f52845884e68094b966ad3bd49ad82688a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144749
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | toolkit/inc/awt/vclxwindows.hxx | 3 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 3 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 11 |
3 files changed, 16 insertions, 1 deletions
diff --git a/toolkit/inc/awt/vclxwindows.hxx b/toolkit/inc/awt/vclxwindows.hxx index 821418638492..983bcff726b4 100644 --- a/toolkit/inc/awt/vclxwindows.hxx +++ b/toolkit/inc/awt/vclxwindows.hxx @@ -121,6 +121,9 @@ public: VCLXDialog(); virtual ~VCLXDialog() override; + sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override; + static css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); + // css::awt::XDialog2 virtual void SAL_CALL endDialog( ::sal_Int32 Result ) override; virtual void SAL_CALL setHelpId( const OUString& Id ) override; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 7a3e3e7cfbcb..fd86d5e371b9 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -139,6 +139,7 @@ #include <comphelper/interfacecontainer3.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/profilezone.hxx> +#include <comphelper/servicehelper.hxx> #include <helper/msgbox.hxx> #include <helper/scrollabledialog.hxx> @@ -1545,7 +1546,7 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( rtl::Reference<VCLXWindow>* ppNewCom // which creates a component object. css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( false ); if ( xWinPeer.is() ) - *ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() ); + *ppNewComp = comphelper::getFromUnoTunnel< VCLXDialog >( xWinPeer ); else *ppNewComp = new VCLXDialog; } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index d8b3c8109c8a..7cf80879148a 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/awt/TextAlign.hpp> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/servicehelper.hxx> #include <sal/log.hxx> #include <awt/vclxwindows.hxx> @@ -2223,6 +2224,16 @@ VCLXDialog::~VCLXDialog() SAL_INFO("toolkit", __FUNCTION__); } +sal_Int64 VCLXDialog::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl( + aIdentifier, this, comphelper::FallbackToGetSomethingOf<VCLXWindow>{}); +} + +css::uno::Sequence<sal_Int8> const & VCLXDialog::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) { SolarMutexGuard aGuard; |