framework/inc/uielement/rootitemcontainer.hxx                     |    3 --
 framework/source/fwi/uielement/rootitemcontainer.cxx              |   11 
+---------
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |    7 +++---
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |    7 +++---
 4 files changed, 11 insertions(+), 17 deletions(-)

New commits:
commit 8f35bb1fcc9c1efd7edc52efbfc33509de2c00f2
Author:     Arkadiy Illarionov <qar...@gmail.com>
AuthorDate: Sat Sep 7 16:25:24 2019 +0300
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Sep 11 23:45:08 2019 +0200

    tdf#39593 Drop RootItemContainer::GetImplementation
    
    Replace with comphelper::getUnoTunnelImplementation.
    Also use isUnoTunnelId().
    
    Change-Id: I014d27fd985836e9232b7f4772696b946eec907e
    Reviewed-on: https://gerrit.libreoffice.org/78745
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/framework/inc/uielement/rootitemcontainer.hxx 
b/framework/inc/uielement/rootitemcontainer.hxx
index ce0aa4a426ec..a0238b94579e 100644
--- a/framework/inc/uielement/rootitemcontainer.hxx
+++ b/framework/inc/uielement/rootitemcontainer.hxx
@@ -69,8 +69,7 @@ class RootItemContainer final : private cppu::BaseMutex,
         virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes(  ) 
override;
 
         // XUnoTunnel
-        static FWI_DLLPUBLIC const css::uno::Sequence< sal_Int8 >&   
GetUnoTunnelId() throw();
-        static FWI_DLLPUBLIC RootItemContainer*                                
   GetImplementation( const css::uno::Reference< css::uno::XInterface >& 
rxIFace ) throw();
+        static FWI_DLLPUBLIC const css::uno::Sequence< sal_Int8 >&   
getUnoTunnelId() throw();
         sal_Int64                                                   SAL_CALL 
getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override;
 
         // XIndexContainer
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx 
b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 4571b3b61603..f7e7eb28dbb7 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -142,7 +142,7 @@ Reference< XIndexAccess > 
RootItemContainer::deepCopyContainer( const Reference<
 // XUnoTunnel
 sal_Int64 RootItemContainer::getSomething( const css::uno::Sequence< sal_Int8 
>& rIdentifier )
 {
-    if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( 
RootItemContainer::GetUnoTunnelId().getConstArray(), 
rIdentifier.getConstArray(), 16 ) ) )
+    if( isUnoTunnelId<RootItemContainer>(rIdentifier) )
         return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr 
>( this ));
     return 0;
 }
@@ -152,18 +152,11 @@ namespace
     class theRootItemContainerUnoTunnelId : public rtl::Static< 
UnoTunnelIdInit, theRootItemContainerUnoTunnelId > {};
 }
 
-const Sequence< sal_Int8 >& RootItemContainer::GetUnoTunnelId() throw()
+const Sequence< sal_Int8 >& RootItemContainer::getUnoTunnelId() throw()
 {
     return theRootItemContainerUnoTunnelId::get().getSeq();
 }
 
-RootItemContainer* RootItemContainer::GetImplementation( const 
css::uno::Reference< css::uno::XInterface >& rxIFace ) throw()
-{
-    css::uno::Reference< css::lang::XUnoTunnel > xUT( rxIFace, 
css::uno::UNO_QUERY );
-    return xUT.is() ? reinterpret_cast< RootItemContainer* 
>(sal::static_int_cast< sal_IntPtr >(
-                          xUT->getSomething( 
RootItemContainer::GetUnoTunnelId() ))) : nullptr;
-}
-
 // XElementAccess
 sal_Bool SAL_CALL RootItemContainer::hasElements()
 {
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index b629dbaefca3..36631222539e 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -60,6 +60,7 @@
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
 #include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <memory>
 
 using namespace css;
@@ -427,7 +428,7 @@ void 
ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
                         {
                             MenuConfiguration aMenuCfg( m_xContext );
                             Reference< XIndexAccess > xContainer( 
aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xContainer );
                             if ( pRootItemContainer )
                                 aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             else
@@ -446,7 +447,7 @@ void 
ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
                         {
                             Reference< XIndexContainer > xIndexContainer( 
static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
                             ToolBoxConfiguration::LoadToolBox( m_xContext, 
xInputStream, xIndexContainer );
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xIndexContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer );
                             aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             return;
                         }
@@ -463,7 +464,7 @@ void 
ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
                         {
                             Reference< XIndexContainer > xIndexContainer( 
static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
                             StatusBarConfiguration::LoadStatusBar( m_xContext, 
xInputStream, xIndexContainer );
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xIndexContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer );
                             aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             return;
                         }
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx 
b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 01dcf13246c1..9f309f7d7656 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -49,6 +49,7 @@
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/sequence.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <vcl/svapp.hxx>
 #include <rtl/ref.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -347,7 +348,7 @@ void UIConfigurationManager::impl_requestUIElementData( 
sal_Int16 nElementType,
                         {
                             MenuConfiguration aMenuCfg( m_xContext );
                             Reference< XIndexAccess > xContainer( 
aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream ));
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xContainer );
                             if ( pRootItemContainer )
                                 aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             else
@@ -366,7 +367,7 @@ void UIConfigurationManager::impl_requestUIElementData( 
sal_Int16 nElementType,
                         {
                             Reference< XIndexContainer > xIndexContainer( 
static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
                             ToolBoxConfiguration::LoadToolBox( m_xContext, 
xInputStream, xIndexContainer );
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xIndexContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer );
                             aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             return;
                         }
@@ -383,7 +384,7 @@ void UIConfigurationManager::impl_requestUIElementData( 
sal_Int16 nElementType,
                         {
                             Reference< XIndexContainer > xIndexContainer( 
static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
                             StatusBarConfiguration::LoadStatusBar( m_xContext, 
xInputStream, xIndexContainer );
-                            RootItemContainer* pRootItemContainer = 
RootItemContainer::GetImplementation( xIndexContainer );
+                            auto pRootItemContainer = 
comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer );
                             aUIElementData.xSettings.set( static_cast< 
OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), 
UNO_QUERY );
                             return;
                         }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to