diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-01 15:26:11 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-16 20:17:51 +0000 |
commit | 068187a898cdd2e26e9b16c348ecc1ed2dee3f29 (patch) | |
tree | cc83d91484d9ca589b37f659186b0326c050d199 | |
parent | 88b4f966202717cd4ad38a30a8eda22c3e69ed35 (diff) |
loplugin:unocast (VCLXWindow)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: Ic151fd657cb780291009ee4c9db51a35dfa7f357
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144335
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/source/uibase/docvw/SidebarWinAcc.cxx | 3 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx b/sw/source/uibase/docvw/SidebarWinAcc.cxx index f489bc140b6b..740c3f175ec3 100644 --- a/sw/source/uibase/docvw/SidebarWinAcc.cxx +++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx @@ -22,6 +22,7 @@ #include <viewsh.hxx> #include <accmap.hxx> +#include <comphelper/servicehelper.hxx> #include <toolkit/awt/vclxaccessiblecomponent.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> @@ -38,7 +39,7 @@ class SidebarWinAccessibleContext : public VCLXAccessibleComponent explicit SidebarWinAccessibleContext( sw::annotation::SwAnnotationWin& rSidebarWin, SwViewShell& rViewShell, const SwFrame* pAnchorFrame ) - : VCLXAccessibleComponent( dynamic_cast<VCLXWindow*>(rSidebarWin.CreateAccessible().get()) ) + : VCLXAccessibleComponent( comphelper::getFromUnoTunnel<VCLXWindow>(rSidebarWin.CreateAccessible()) ) , mrViewShell( rViewShell ) , mpAnchorFrame( pAnchorFrame ) { diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 080847154cb2..2874087e14ef 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -26,6 +26,7 @@ #include <awt/vclxtopwindow.hxx> #include <awt/vclxwindows.hxx> +#include <comphelper/servicehelper.hxx> #include <toolkit/dllapi.h> #include <vcl/menu.hxx> @@ -179,7 +180,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); if( xPeer.is() ) { - bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() )); + bool bSameInstance( pVCLXWindow == comphelper::getFromUnoTunnel< VCLXWindow >( xPeer )); SAL_WARN_IF( !bSameInstance, "toolkit.helper", "UnoWrapper::SetWindowInterface: there is already a WindowPeer/ComponentInterface for this VCL window" ); if ( bSameInstance ) return; |