sd/source/ui/unoidl/SdUnoDrawView.cxx |    2 +-
 sd/source/ui/unoidl/unocpres.cxx      |    4 +---
 sd/source/ui/unoidl/unocpres.hxx      |    5 -----
 sd/source/ui/unoidl/unolayer.cxx      |   13 ++++++-------
 sd/source/ui/unoidl/unolayer.hxx      |    4 ----
 5 files changed, 8 insertions(+), 20 deletions(-)

New commits:
commit fc83e664fc119bf3d8a5a0bcc4d15a8e788d57fb
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Jan 20 13:40:33 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Jan 22 19:10:45 2023 +0000

    XUnoTunnel->dynamic_cast in SdXCustomPresentation
    
    Change-Id: I4841e93b9e15b3406f588bbbc6da9d91a2143350
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145971
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index 1f9bde3b98da..13a634f289b4 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -59,8 +59,6 @@ SdXCustomPresentation::~SdXCustomPresentation() noexcept
 {
 }
 
-UNO3_GETIMPLEMENTATION_IMPL( SdXCustomPresentation );
-
 // XServiceInfo
 OUString SAL_CALL SdXCustomPresentation::getImplementationName()
 {
@@ -317,7 +315,7 @@ void SAL_CALL SdXCustomPresentationAccess::insertByName( 
const OUString& aName,
 
     uno::Reference< container::XIndexContainer > xContainer;
     if( (aElement >>= xContainer) && xContainer.is() )
-        pXShow = 
comphelper::getFromUnoTunnel<SdXCustomPresentation>(xContainer);
+        pXShow = dynamic_cast<SdXCustomPresentation*>(xContainer.get());
 
     if( nullptr == pXShow )
         throw lang::IllegalArgumentException();
diff --git a/sd/source/ui/unoidl/unocpres.hxx b/sd/source/ui/unoidl/unocpres.hxx
index e32dce956e2f..fba0f5fa5002 100644
--- a/sd/source/ui/unoidl/unocpres.hxx
+++ b/sd/source/ui/unoidl/unocpres.hxx
@@ -22,7 +22,6 @@
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/interfacecontainer3.hxx>
 #include <osl/mutex.hxx>
 
@@ -39,7 +38,6 @@ class SdCustomShow;
 
 class SdXCustomPresentation :   public ::cppu::WeakImplHelper< 
css::container::XIndexContainer,
                                                                 
css::container::XNamed,
-                                                                
css::lang::XUnoTunnel,
                                                                 
css::lang::XComponent,
                                                                 
css::lang::XServiceInfo >
 {
@@ -62,9 +60,6 @@ public:
     void SetSdCustomShow( SdCustomShow* pShow ) noexcept { mpSdCustomShow = 
pShow; }
     SdXImpressDocument* GetModel() const noexcept { return mpModel; }
 
-    // uno helper
-    UNO3_GETIMPLEMENTATION_DECL(SdXCustomPresentation)
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;
commit 3b7c9d40cb15d3c2bc2ec047edc1592a767f5f23
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Jan 20 13:38:56 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Jan 22 19:10:35 2023 +0000

    XUnoTunnel->dynamic_cast in SdLayer
    
    Change-Id: Id61d38dd9f3066d07ec325494753cd9096152e9a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145970
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx 
b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index 7714032637c4..115a58f84b31 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -130,7 +130,7 @@ void SdUnoDrawView::setActiveLayer (const 
Reference<drawing::XLayer>& rxLayer)
     if ( ! rxLayer.is())
         return;
 
-    SdLayer* pLayer = comphelper::getFromUnoTunnel<SdLayer> (rxLayer);
+    SdLayer* pLayer = dynamic_cast<SdLayer*> (rxLayer.get());
     if (pLayer == nullptr)
         return;
 
diff --git a/sd/source/ui/unoidl/unolayer.cxx b/sd/source/ui/unoidl/unolayer.cxx
index 0706ff552941..0db58c58e5a4 100644
--- a/sd/source/ui/unoidl/unolayer.cxx
+++ b/sd/source/ui/unoidl/unolayer.cxx
@@ -88,9 +88,6 @@ SdLayer::~SdLayer() noexcept
 {
 }
 
-// uno helper
-UNO3_GETIMPLEMENTATION_IMPL( SdLayer );
-
 // XServiceInfo
 OUString SAL_CALL SdLayer::getImplementationName()
 {
@@ -456,7 +453,7 @@ void SAL_CALL SdLayerManager::remove( const uno::Reference< 
drawing::XLayer >& x
     if( mpModel == nullptr )
         throw lang::DisposedException();
 
-    SdLayer* pSdLayer = comphelper::getFromUnoTunnel<SdLayer>(xLayer);
+    SdLayer* pSdLayer = dynamic_cast<SdLayer*>(xLayer.get());
 
     if(pSdLayer && GetView())
     {
@@ -476,8 +473,10 @@ void SAL_CALL SdLayerManager::attachShapeToLayer( const 
uno::Reference< drawing:
     if( mpModel == nullptr )
         throw lang::DisposedException();
 
-    SdLayer* pSdLayer = comphelper::getFromUnoTunnel<SdLayer>(xLayer);
-    SdrLayer* pSdrLayer = pSdLayer?pSdLayer->GetSdrLayer():nullptr;
+    SdLayer* pSdLayer = dynamic_cast<SdLayer*>(xLayer.get());
+    if(pSdLayer==nullptr)
+        return;
+    SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer();
     if(pSdrLayer==nullptr)
         return;
 
@@ -662,7 +661,7 @@ bool compare_layers (const 
uno::WeakReference<uno::XInterface>& xRef, void const
     uno::Reference<uno::XInterface> xLayer (xRef);
     if (xLayer.is())
     {
-        SdLayer* pSdLayer = comphelper::getFromUnoTunnel<SdLayer> (xRef);
+        SdLayer* pSdLayer = dynamic_cast<SdLayer*> (xLayer.get());
         if (pSdLayer != nullptr)
         {
             SdrLayer* pSdrLayer = pSdLayer->GetSdrLayer ();
diff --git a/sd/source/ui/unoidl/unolayer.hxx b/sd/source/ui/unoidl/unolayer.hxx
index 48160449f8d6..fe343bba438b 100644
--- a/sd/source/ui/unoidl/unolayer.hxx
+++ b/sd/source/ui/unoidl/unolayer.hxx
@@ -42,7 +42,6 @@ enum LayerAttribute { VISIBLE, PRINTABLE, LOCKED };
 class SdLayer : public ::cppu::WeakImplHelper< css::drawing::XLayer,
                                                 css::lang::XServiceInfo,
                                                 css::container::XChild,
-                                                css::lang::XUnoTunnel,
                                                 css::lang::XComponent >
 {
 public:
@@ -52,9 +51,6 @@ public:
     // intern
     SdrLayer* GetSdrLayer() const noexcept { return pLayer; }
 
-    // uno helper
-    UNO3_GETIMPLEMENTATION_DECL( SdLayer )
-
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() override;
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 
override;

Reply via email to