framework/inc/uielement/constitemcontainer.hxx        |    6 ------
 framework/inc/uielement/itemcontainer.hxx             |    3 ---
 framework/source/fwi/uielement/constitemcontainer.cxx |   14 +-------------
 framework/source/fwi/uielement/itemcontainer.cxx      |    8 +-------
 framework/source/fwi/uielement/rootitemcontainer.cxx  |    2 +-
 5 files changed, 3 insertions(+), 30 deletions(-)

New commits:
commit 81fd038c81e5ebbb8a52d9b2fbdca1fd48f445e3
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sat Jan 14 12:51:03 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jan 17 07:48:50 2023 +0000

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

diff --git a/framework/inc/uielement/constitemcontainer.hxx 
b/framework/inc/uielement/constitemcontainer.hxx
index e25edc57fc7a..2cec0b9a3017 100644
--- a/framework/inc/uielement/constitemcontainer.hxx
+++ b/framework/inc/uielement/constitemcontainer.hxx
@@ -23,7 +23,6 @@
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XFastPropertySet.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
 
 #include <rtl/ustring.hxx>
 #include <cppuhelper/implbase.hxx>
@@ -38,7 +37,6 @@ class RootItemContainer;
 class ItemContainer;
 class ConstItemContainer final : public ::cppu::WeakImplHelper<
                                                     
css::container::XIndexAccess,
-                                                    css::lang::XUnoTunnel      
 ,
                                                     
css::beans::XFastPropertySet,
                                                     css::beans::XPropertySet >
 {
@@ -51,10 +49,6 @@ class ConstItemContainer final : public 
::cppu::WeakImplHelper<
         ConstItemContainer( const css::uno::Reference< 
css::container::XIndexAccess >& rSourceContainer, bool bFastCopy = false );
         virtual ~ConstItemContainer() override;
 
-        // XUnoTunnel
-        static const css::uno::Sequence< sal_Int8 >&   getUnoTunnelId() 
noexcept;
-        sal_Int64                                                   SAL_CALL 
getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override;
-
         // XIndexAccess
         virtual sal_Int32 SAL_CALL getCount() override;
 
diff --git a/framework/inc/uielement/itemcontainer.hxx 
b/framework/inc/uielement/itemcontainer.hxx
index 5d5bc9c85c41..927beea584af 100644
--- a/framework/inc/uielement/itemcontainer.hxx
+++ b/framework/inc/uielement/itemcontainer.hxx
@@ -43,9 +43,6 @@ class ItemContainer final : public ::cppu::WeakImplHelper< 
css::container::XInde
 
         //  XInterface, XTypeProvider
 
-        // XUnoTunnel
-        static const css::uno::Sequence< sal_Int8 >&   getUnoTunnelId() 
noexcept;
-
         // XIndexContainer
         virtual void SAL_CALL insertByIndex( sal_Int32 Index, const 
css::uno::Any& Element ) override;
 
diff --git a/framework/source/fwi/uielement/constitemcontainer.cxx 
b/framework/source/fwi/uielement/constitemcontainer.cxx
index 7e43a5009c36..cab82acd870c 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -147,7 +147,7 @@ Reference< XIndexAccess > 
ConstItemContainer::deepCopyContainer( const Reference
     Reference< XIndexAccess > xReturn;
     if ( rSubContainer.is() )
     {
-        ItemContainer*      pSource = 
comphelper::getFromUnoTunnel<ItemContainer>( rSubContainer );
+        ItemContainer* pSource = dynamic_cast<ItemContainer*>( 
rSubContainer.get() );
         rtl::Reference<ConstItemContainer> pSubContainer;
         if ( pSource )
             pSubContainer = new ConstItemContainer( *pSource );
@@ -159,18 +159,6 @@ Reference< XIndexAccess > 
ConstItemContainer::deepCopyContainer( const Reference
     return xReturn;
 }
 
-// XUnoTunnel
-sal_Int64 ConstItemContainer::getSomething( const css::uno::Sequence< sal_Int8 
>& rIdentifier )
-{
-    return comphelper::getSomethingImpl(rIdentifier, this);
-}
-
-const Sequence< sal_Int8 >& ConstItemContainer::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theConstItemContainerUnoTunnelId;
-    return theConstItemContainerUnoTunnelId.getSeq();
-}
-
 // XElementAccess
 sal_Bool SAL_CALL ConstItemContainer::hasElements()
 {
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx 
b/framework/source/fwi/uielement/itemcontainer.cxx
index 389bbaeaaf9d..bc0116b2f3f7 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -122,7 +122,7 @@ Reference< XIndexAccess > ItemContainer::deepCopyContainer( 
const Reference< XIn
     Reference< XIndexAccess > xReturn;
     if ( rSubContainer.is() )
     {
-        ConstItemContainer* pSource = 
comphelper::getFromUnoTunnel<ConstItemContainer>( rSubContainer );
+        ConstItemContainer* pSource = dynamic_cast<ConstItemContainer*>( 
rSubContainer.get() );
         rtl::Reference<ItemContainer> pSubContainer;
         if ( pSource )
             pSubContainer = new ItemContainer( *pSource, rMutex );
@@ -134,12 +134,6 @@ Reference< XIndexAccess > 
ItemContainer::deepCopyContainer( const Reference< XIn
     return xReturn;
 }
 
-const Sequence< sal_Int8 >& ItemContainer::getUnoTunnelId() noexcept
-{
-    static const comphelper::UnoIdInit theItemContainerUnoTunnelId;
-    return theItemContainerUnoTunnelId.getSeq();
-}
-
 // XElementAccess
 sal_Bool SAL_CALL ItemContainer::hasElements()
 {
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx 
b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 50ecd0d53bde..db267f54a658 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -126,7 +126,7 @@ Reference< XIndexAccess > 
RootItemContainer::deepCopyContainer( const Reference<
     Reference< XIndexAccess > xReturn;
     if ( rSubContainer.is() )
     {
-        ConstItemContainer* pSource = 
comphelper::getFromUnoTunnel<ConstItemContainer>( rSubContainer );
+        ConstItemContainer* pSource = dynamic_cast<ConstItemContainer*>( 
rSubContainer.get() );
         rtl::Reference<ItemContainer> pSubContainer;
         if ( pSource )
             pSubContainer = new ItemContainer( *pSource, m_aShareMutex );

Reply via email to