toolkit/inc/awt/vclxwindows.hxx | 3 +++ toolkit/source/awt/vclxtoolkit.cxx | 3 ++- toolkit/source/awt/vclxwindows.cxx | 11 +++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-)
New commits: commit feb8b833a6245d42400f42a0bc789dc84594ee6f Author: Stephan Bergmann <[email protected]> AuthorDate: Thu Dec 1 14:58:10 2022 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Thu Dec 22 15:05:22 2022 +0000 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 <[email protected]> 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;
