basctl/source/basicide/basicrenderable.cxx     |    2 +-
 dbaccess/source/ui/browser/brwview.cxx         |    2 +-
 dbaccess/source/ui/browser/sbagrid.cxx         |    2 --
 dbaccess/source/ui/inc/sbagrid.hxx             |    2 --
 dbaccess/source/ui/uno/ColumnControl.cxx       |    2 +-
 forms/source/richtext/richtextcontrol.cxx      |    2 +-
 forms/source/solar/component/navbarcontrol.cxx |    2 +-
 include/svx/fmgridif.hxx                       |    3 ---
 include/toolkit/awt/vclxdevice.hxx             |    5 -----
 include/toolkit/awt/vclxwindow.hxx             |    3 ---
 sc/source/ui/unoobj/docuno.cxx                 |    2 +-
 sd/source/ui/unoidl/unomodel.cxx               |    2 +-
 sd/source/ui/view/DocumentRenderer.cxx         |    2 +-
 starmath/source/unomodel.cxx                   |    2 +-
 svx/source/fmcomp/fmgridif.cxx                 |    8 +++-----
 sw/source/core/view/printdata.cxx              |    2 +-
 sw/source/uibase/uno/unotxdoc.cxx              |    2 +-
 toolkit/source/awt/vclxdevice.cxx              |    3 ---
 toolkit/source/awt/vclxgraphics.cxx            |    2 +-
 toolkit/source/awt/vclxtoolkit.cxx             |    2 +-
 toolkit/source/awt/vclxwindow.cxx              |    4 ----
 toolkit/source/controls/stdtabcontroller.cxx   |    2 +-
 toolkit/source/hatchwindow/hatchwindow.cxx     |    2 +-
 toolkit/source/helper/unowrapper.cxx           |    2 +-
 toolkit/source/helper/vclunohelper.cxx         |   10 +++++-----
 25 files changed, 24 insertions(+), 48 deletions(-)

New commits:
commit 172aedbc51e4bd972bef3f94d562e09ee7bc8355
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Jan 12 13:48:24 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 13 12:53:27 2023 +0000

    XUnoTunnel->dynamic_cast in VCLXDevice
    
    Change-Id: I9fa06600d3b9a2172a1818f89a3b9c06d65c8c54
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145467
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basctl/source/basicide/basicrenderable.cxx 
b/basctl/source/basicide/basicrenderable.cxx
index 79e381399703..648f234cbdb0 100644
--- a/basctl/source/basicide/basicrenderable.cxx
+++ b/basctl/source/basicide/basicrenderable.cxx
@@ -88,7 +88,7 @@ VclPtr< Printer > Renderable::getPrinter() const
 
     if( aValue >>= xRenderDevice )
     {
-        VCLXDevice* pDevice = 
comphelper::getFromUnoTunnel<VCLXDevice>(xRenderDevice);
+        VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>(xRenderDevice.get());
         VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice() : 
VclPtr< OutputDevice >();
         pPrinter = dynamic_cast<Printer*>(pOut.get());
     }
diff --git a/dbaccess/source/ui/browser/brwview.cxx 
b/dbaccess/source/ui/browser/brwview.cxx
index 9d6d3c95d67d..3bfb7eac9a2d 100644
--- a/dbaccess/source/ui/browser/brwview.cxx
+++ b/dbaccess/source/ui/browser/brwview.cxx
@@ -251,7 +251,7 @@ SbaGridControl* UnoDataBrowserView::getVclControl() const
             Reference< css::awt::XWindowPeer >  xPeer = m_xGrid->getPeer();
             if ( xPeer.is() )
             {
-                SbaXGridPeer* pPeer = 
comphelper::getFromUnoTunnel<SbaXGridPeer>(xPeer);
+                SbaXGridPeer* pPeer = dynamic_cast<SbaXGridPeer*>(xPeer.get());
                 UnoDataBrowserView* pTHIS = 
const_cast<UnoDataBrowserView*>(this);
                 if ( pPeer )
                 {
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx 
b/dbaccess/source/ui/browser/sbagrid.cxx
index c3b52a9cfcc5..9db34b530119 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -462,8 +462,6 @@ Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
         Sequence { cppu::UnoType<css::frame::XDispatch>::get() });
 }
 
-UNO3_GETIMPLEMENTATION2_IMPL(SbaXGridPeer, FmXGridPeer);
-
 VclPtr<FmGridControl> SbaXGridPeer::imp_CreateControl(vcl::Window* pParent, 
WinBits nStyle)
 {
     return VclPtr<SbaGridControl>::Create( m_xContext, pParent, this, nStyle);
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx 
b/dbaccess/source/ui/inc/sbagrid.hxx
index 0d22f6dceec1..5dbffa6717a2 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -107,8 +107,6 @@ namespace dbaui
 
         virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() 
override;
 
-        UNO3_GETIMPLEMENTATION_DECL(SbaXGridPeer)
-
         // css::frame::XDispatch
         virtual void SAL_CALL dispatch(const css::util::URL& aURL, const 
css::uno::Sequence< css::beans::PropertyValue >& aArgs) override;
         virtual void SAL_CALL addStatusListener(const css::uno::Reference< 
css::frame::XStatusListener > & xControl, const css::util::URL& aURL) override;
diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx 
b/dbaccess/source/ui/uno/ColumnControl.cxx
index 9295b9954333..e7cde998d323 100644
--- a/dbaccess/source/ui/uno/ColumnControl.cxx
+++ b/dbaccess/source/ui/uno/ColumnControl.cxx
@@ -77,7 +77,7 @@ void SAL_CALL OColumnControl::createPeer(const Reference< 
XToolkit >& /*rToolkit
     vcl::Window* pParentWin = nullptr;
     if (rParentPeer.is())
     {
-        VCLXWindow* pParent = 
comphelper::getFromUnoTunnel<VCLXWindow>(rParentPeer);
+        VCLXWindow* pParent = dynamic_cast<VCLXWindow*>(rParentPeer.get());
         if (pParent)
             pParentWin = pParent->GetWindow();
     }
diff --git a/forms/source/richtext/richtextcontrol.cxx 
b/forms/source/richtext/richtextcontrol.cxx
index f26efbc3e289..cb4bb3e5357c 100644
--- a/forms/source/richtext/richtextcontrol.cxx
+++ b/forms/source/richtext/richtextcontrol.cxx
@@ -176,7 +176,7 @@ namespace frm
         vcl::Window* pParentWin = nullptr;
         if ( _rParentPeer.is() )
         {
-            VCLXWindow* pParentXWin = 
comphelper::getFromUnoTunnel<VCLXWindow>( _rParentPeer );
+            VCLXWindow* pParentXWin = dynamic_cast<VCLXWindow*>( 
_rParentPeer.get() );
             if ( pParentXWin )
                 pParentWin = pParentXWin->GetWindow();
             DBG_ASSERT( pParentWin, "ORichTextControl::createPeer: could not 
obtain the VCL-level parent window!" );
diff --git a/forms/source/solar/component/navbarcontrol.cxx 
b/forms/source/solar/component/navbarcontrol.cxx
index 27a23c364f6a..ebea47d469a4 100644
--- a/forms/source/solar/component/navbarcontrol.cxx
+++ b/forms/source/solar/component/navbarcontrol.cxx
@@ -116,7 +116,7 @@ namespace frm
         vcl::Window* pParentWin = nullptr;
         if ( _rParentPeer.is() )
         {
-            VCLXWindow* pParentXWin = 
comphelper::getFromUnoTunnel<VCLXWindow>( _rParentPeer );
+            VCLXWindow* pParentXWin = dynamic_cast<VCLXWindow*>( 
_rParentPeer.get() );
             if ( pParentXWin )
                 pParentWin = pParentXWin->GetWindow();
             DBG_ASSERT( pParentWin, "ONavigationBarControl::createPeer: could 
not obtain the VCL-level parent window!" );
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index f3e7f25cd32f..e3cce3952b3a 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -378,9 +378,6 @@ public:
     // late constructor, to always be called after the real constructor!
     void Create(vcl::Window* pParent, WinBits nStyle);
 
-// css::lang::XUnoTunnel
-    UNO3_GETIMPLEMENTATION_DECL(FmXGridPeer)
-
 // css::form::XGridPeer
     virtual css::uno::Reference< css::container::XIndexContainer > SAL_CALL 
getColumns(  ) override;
     virtual void SAL_CALL setColumns( const css::uno::Reference< 
css::container::XIndexContainer >& aColumns ) override final;
diff --git a/include/toolkit/awt/vclxdevice.hxx 
b/include/toolkit/awt/vclxdevice.hxx
index c24b79be110c..08a12a65353e 100644
--- a/include/toolkit/awt/vclxdevice.hxx
+++ b/include/toolkit/awt/vclxdevice.hxx
@@ -22,7 +22,6 @@
 
 #include <toolkit/dllapi.h>
 #include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <vcl/virdev.hxx>
@@ -34,7 +33,6 @@
 class TOOLKIT_DLLPUBLIC VCLXDevice :
                     public cppu::WeakImplHelper<
                         css::awt::XDevice,
-                        css::lang::XUnoTunnel,
                         css::awt::XUnitConversion>
 {
     friend class VCLXGraphics;
@@ -50,9 +48,6 @@ public:
     void                    SetOutputDevice( const VclPtr<OutputDevice> 
&pOutDev ) { mpOutputDevice = pOutDev; }
     const VclPtr<OutputDevice>& GetOutputDevice() const { return 
mpOutputDevice; }
 
-    // css::lang::XUnoTunnel
-    UNO3_GETIMPLEMENTATION_DECL(VCLXDevice)
-
     // css::awt::XDevice,
     css::uno::Reference< css::awt::XGraphics >    SAL_CALL createGraphics(  ) 
override;
     css::uno::Reference< css::awt::XDevice >      SAL_CALL createDevice( 
sal_Int32 nWidth, sal_Int32 nHeight ) override;
diff --git a/include/toolkit/awt/vclxwindow.hxx 
b/include/toolkit/awt/vclxwindow.hxx
index 9f3226ee6add..30073236aa8a 100644
--- a/include/toolkit/awt/vclxwindow.hxx
+++ b/include/toolkit/awt/vclxwindow.hxx
@@ -141,9 +141,6 @@ public:
 
     bool IsDisposed() const;
 
-    // css::lang::XUnoTunnel
-    UNO3_GETIMPLEMENTATION_DECL(VCLXWindow)
-
     // css::lang::XEventListener
     virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) 
override;
 
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index c9f8aa64204e..0fbfc7d12157 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1461,7 +1461,7 @@ static OutputDevice* lcl_GetRenderDevice( const 
uno::Sequence<beans::PropertyVal
             uno::Reference<awt::XDevice> xRenderDevice(rProp.Value, 
uno::UNO_QUERY);
             if ( xRenderDevice.is() )
             {
-                VCLXDevice* pDevice = 
comphelper::getFromUnoTunnel<VCLXDevice>( xRenderDevice );
+                VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( 
xRenderDevice.get() );
                 if ( pDevice )
                 {
                     pRet = pDevice->GetOutputDevice().get();
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index edcaa3a4fdfc..d68c4cf4a2f8 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1855,7 +1855,7 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 
nRenderer, const uno::Any& r
     if( !(xRenderDevice.is() && nPageNumber && ( nPageNumber <= 
mpDoc->GetSdPageCount( ePageKind ) )) )
         return;
 
-    VCLXDevice* pDevice = comphelper::getFromUnoTunnel<VCLXDevice>( 
xRenderDevice );
+    VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
     VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice() : 
VclPtr< OutputDevice >();
 
     if( !pOut )
diff --git a/sd/source/ui/view/DocumentRenderer.cxx 
b/sd/source/ui/view/DocumentRenderer.cxx
index 3d58ef849104..8ba5df1b948c 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1193,7 +1193,7 @@ public:
 
         if (aDev >>= xRenderDevice)
         {
-            VCLXDevice* pDevice = 
comphelper::getFromUnoTunnel<VCLXDevice>(xRenderDevice);
+            VCLXDevice* pDevice = 
dynamic_cast<VCLXDevice*>(xRenderDevice.get());
             VclPtr< OutputDevice > pOut = pDevice ? pDevice->GetOutputDevice()
                                                   : VclPtr< OutputDevice >();
             mpPrinter = dynamic_cast<Printer*>(pOut.get());
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index b7a92567fe25..985c2971f035 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -956,7 +956,7 @@ void SAL_CALL SmModel::render(
     if (!xRenderDevice.is())
         return;
 
-    VCLXDevice*   pDevice = comphelper::getFromUnoTunnel<VCLXDevice>( 
xRenderDevice );
+    VCLXDevice*   pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
     VclPtr< OutputDevice> pOut = pDevice ? pDevice->GetOutputDevice()
                                          : VclPtr< OutputDevice >();
     if (!pOut)
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index b6737c2dbe88..05ccd00c75c9 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -472,7 +472,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< 
css::awt::XToolkit >&
     vcl::Window* pParentWin = nullptr;
     if (rParentPeer.is())
     {
-        VCLXWindow* pParent = 
comphelper::getFromUnoTunnel<VCLXWindow>(rParentPeer);
+        VCLXWindow* pParent = dynamic_cast<VCLXWindow*>(rParentPeer.get());
         if (pParent)
             pParentWin = pParent->GetWindow();
     }
@@ -495,7 +495,7 @@ void SAL_CALL FmXGridControl::createPeer(const Reference< 
css::awt::XToolkit >&
 //      if (--m_nPeerCreationLevel == 0)
     {
         DBG_ASSERT(getPeer().is(), "FmXGridControl::createPeer : something 
went wrong ... no top level peer !");
-        pPeer = comphelper::getFromUnoTunnel<FmXGridPeer>(getPeer());
+        pPeer = dynamic_cast<FmXGridPeer*>(getPeer().get());
 
         setPosSize( maComponentInfos.nX, maComponentInfos.nY, 
maComponentInfos.nWidth, maComponentInfos.nHeight, css::awt::PosSize::POSSIZE );
 
@@ -967,7 +967,7 @@ sal_Bool SAL_CALL FmXGridControl::supportsMode(const 
OUString& Mode)
 
 void SAL_CALL FmXGridControl::setFocus()
 {
-    FmXGridPeer* pPeer = comphelper::getFromUnoTunnel<FmXGridPeer>(getPeer());
+    rtl::Reference<FmXGridPeer> pPeer = 
dynamic_cast<FmXGridPeer*>(getPeer().get());
     if (pPeer)
     {
         VclPtr<FmGridControl> xGrid = pPeer->GetAs<FmGridControl>();
@@ -1079,8 +1079,6 @@ FmXGridPeer::~FmXGridPeer()
     setColumns(Reference< XIndexContainer > ());
 }
 
-UNO3_GETIMPLEMENTATION2_IMPL(FmXGridPeer, VCLXWindow);
-
 // XEventListener
 
 void FmXGridPeer::disposing(const EventObject& e)
diff --git a/sw/source/core/view/printdata.cxx 
b/sw/source/core/view/printdata.cxx
index 95504f6b1b79..490d647d12e0 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -433,7 +433,7 @@ bool SwPrintUIOptions::processPropertiesAndCheckFormat( 
const uno::Sequence< bea
     VclPtr< OutputDevice > pOut;
     if (xRenderDevice.is())
     {
-        VCLXDevice*     pDevice = comphelper::getFromUnoTunnel<VCLXDevice>( 
xRenderDevice );
+        VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
         if (pDevice)
             pOut = pDevice->GetOutputDevice();
     }
diff --git a/sw/source/uibase/uno/unotxdoc.cxx 
b/sw/source/uibase/uno/unotxdoc.cxx
index 22d70bc112da..176bc8db2748 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2281,7 +2281,7 @@ static VclPtr< OutputDevice > lcl_GetOutputDevice( const 
SwPrintUIOptions &rPrin
     aAny >>= xRenderDevice;
     if (xRenderDevice.is())
     {
-        VCLXDevice*     pDevice = comphelper::getFromUnoTunnel<VCLXDevice>( 
xRenderDevice );
+        VCLXDevice* pDevice = dynamic_cast<VCLXDevice*>( xRenderDevice.get() );
         pOut = pDevice ? pDevice->GetOutputDevice() : VclPtr< OutputDevice >();
     }
 
diff --git a/toolkit/source/awt/vclxdevice.cxx 
b/toolkit/source/awt/vclxdevice.cxx
index 5b83b9e62047..c4ed98146713 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -45,9 +45,6 @@ VCLXDevice::~VCLXDevice()
     mpOutputDevice.reset();
 }
 
-// css::lang::XUnoTunnel
-UNO3_GETIMPLEMENTATION_IMPL( VCLXDevice );
-
 // css::awt::XDevice,
 css::uno::Reference< css::awt::XGraphics > VCLXDevice::createGraphics(  )
 {
diff --git a/toolkit/source/awt/vclxgraphics.cxx 
b/toolkit/source/awt/vclxgraphics.cxx
index 3707f573b064..bbbb75e0545d 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -258,7 +258,7 @@ void VCLXGraphics::copy( const uno::Reference< awt::XDevice 
>& rxSource, sal_Int
 
     if ( mpOutputDevice )
     {
-        VCLXDevice* pFromDev = comphelper::getFromUnoTunnel<VCLXDevice>( 
rxSource );
+        VCLXDevice* pFromDev = dynamic_cast<VCLXDevice*>( rxSource.get() );
         DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
         if ( pFromDev )
         {
diff --git a/toolkit/source/awt/vclxtoolkit.cxx 
b/toolkit/source/awt/vclxtoolkit.cxx
index b361a20e3d3d..e890e24a6bdc 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1848,7 +1848,7 @@ css::uno::Reference< css::awt::XWindowPeer > 
VCLXToolkit::ImplCreateWindow(
     VclPtr<vcl::Window> pParent;
     if ( rDescriptor.Parent.is() )
     {
-        VCLXWindow* pParentComponent = 
comphelper::getFromUnoTunnel<VCLXWindow>( rDescriptor.Parent );
+        VCLXWindow* pParentComponent = dynamic_cast<VCLXWindow*>( 
rDescriptor.Parent.get() );
 
         // #103939# Don't throw assertion, may be it's a system dependent 
window, used in ImplCreateWindow.
         // DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
diff --git a/toolkit/source/awt/vclxwindow.cxx 
b/toolkit/source/awt/vclxwindow.cxx
index d00bcf7f7cec..284ffb75326b 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -903,10 +903,6 @@ Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) 
const
 }
 
 
-// css::lang::XUnoTunnel
-UNO3_GETIMPLEMENTATION2_IMPL(VCLXWindow, VCLXDevice);
-
-
 // css::lang::Component
 void VCLXWindow::dispose(  )
 {
diff --git a/toolkit/source/controls/stdtabcontroller.cxx 
b/toolkit/source/controls/stdtabcontroller.cxx
index c900d6d155a4..554fcfb3c76b 100644
--- a/toolkit/source/controls/stdtabcontroller.cxx
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -142,7 +142,7 @@ void StdTabController::ImplActivateControl( bool bFirst ) 
const
             Reference< XWindowPeer >  xCP = pControls[nCtrl]->getPeer();
             if ( xCP.is() )
             {
-                VCLXWindow* pC = comphelper::getFromUnoTunnel<VCLXWindow>( xCP 
);
+                VCLXWindow* pC = dynamic_cast<VCLXWindow*>( xCP.get() );
                 if ( pC && pC->GetWindow() && ( pC->GetWindow()->GetStyle() & 
WB_TABSTOP ) )
                 {
                     pC->GetWindow()->GrabFocus();
diff --git a/toolkit/source/hatchwindow/hatchwindow.cxx 
b/toolkit/source/hatchwindow/hatchwindow.cxx
index b421e13091f2..4685126b203d 100644
--- a/toolkit/source/hatchwindow/hatchwindow.cxx
+++ b/toolkit/source/hatchwindow/hatchwindow.cxx
@@ -47,7 +47,7 @@ void VCLXHatchWindow::initializeWindow( const uno::Reference< 
awt::XWindowPeer >
     SolarMutexGuard aGuard;
 
     VclPtr<vcl::Window> pParent;
-    VCLXWindow* pParentComponent = comphelper::getFromUnoTunnel<VCLXWindow>( 
xParent );
+    VCLXWindow* pParentComponent = dynamic_cast<VCLXWindow*>( xParent.get() );
 
     if ( pParentComponent )
         pParent = pParentComponent->GetWindow();
diff --git a/toolkit/source/helper/unowrapper.cxx 
b/toolkit/source/helper/unowrapper.cxx
index 080847154cb2..0fa36e82cab4 100644
--- a/toolkit/source/helper/unowrapper.cxx
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -163,7 +163,7 @@ VclPtr<vcl::Window> UnoWrapper::GetWindow(const 
css::uno::Reference<css::awt::XW
 
 void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const 
css::uno::Reference< css::awt::XWindowPeer> & xIFace )
 {
-    VCLXWindow* pVCLXWindow = comphelper::getFromUnoTunnel<VCLXWindow>( xIFace 
);
+    VCLXWindow* pVCLXWindow = dynamic_cast<VCLXWindow*>( xIFace.get() );
 
     assert( pVCLXWindow && "must be a VCLXWindow subclass" );
     if ( !pVCLXWindow )
diff --git a/toolkit/source/helper/vclunohelper.cxx 
b/toolkit/source/helper/vclunohelper.cxx
index bd2e55007350..bac88c66268a 100644
--- a/toolkit/source/helper/vclunohelper.cxx
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -104,19 +104,19 @@ css::uno::Reference< css::awt::XBitmap> 
VCLUnoHelper::CreateBitmap( const Bitmap
 
 vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< 
css::awt::XWindow>& rxWindow )
 {
-    VCLXWindow* pVCLXWindow = comphelper::getFromUnoTunnel<VCLXWindow>( 
rxWindow );
+    VCLXWindow* pVCLXWindow = dynamic_cast<VCLXWindow*>( rxWindow.get() );
     return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr;
 }
 
 vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< 
css::awt::XWindow2>& rxWindow )
 {
-    VCLXWindow* pVCLXWindow = comphelper::getFromUnoTunnel<VCLXWindow>( 
rxWindow );
+    VCLXWindow* pVCLXWindow = dynamic_cast<VCLXWindow*>( rxWindow.get() );
     return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr;
 }
 
 vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< 
css::awt::XWindowPeer>& rxWindow )
 {
-    VCLXWindow* pVCLXWindow = comphelper::getFromUnoTunnel<VCLXWindow>( 
rxWindow );
+    VCLXWindow* pVCLXWindow = dynamic_cast<VCLXWindow*>( rxWindow.get() );
     return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr;
 }
 
@@ -149,7 +149,7 @@ css::uno::Reference< css::awt::XWindow> 
VCLUnoHelper::GetInterface( vcl::Window*
 OutputDevice* VCLUnoHelper::GetOutputDevice( const css::uno::Reference< 
css::awt::XDevice>& rxDevice )
 {
     VclPtr<OutputDevice> pOutDev;
-    VCLXDevice* pDev = comphelper::getFromUnoTunnel<VCLXDevice>( rxDevice );
+    VCLXDevice* pDev = dynamic_cast<VCLXDevice*>( rxDevice.get() );
     if ( pDev )
         pOutDev = pDev->GetOutputDevice();
     return pOutDev;
@@ -158,7 +158,7 @@ OutputDevice* VCLUnoHelper::GetOutputDevice( const 
css::uno::Reference< css::awt
 OutputDevice* VCLUnoHelper::GetOutputDevice( const css::uno::Reference< 
css::awt::XGraphics>& rxGraphics )
 {
     OutputDevice* pOutDev = nullptr;
-    VCLXGraphics* pGrf = comphelper::getFromUnoTunnel<VCLXGraphics>( 
rxGraphics );
+    VCLXGraphics* pGrf = dynamic_cast<VCLXGraphics*>( rxGraphics.get() );
     if ( pGrf )
         pOutDev = pGrf->GetOutputDevice();
     return pOutDev;

Reply via email to