diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2019-09-07 16:25:24 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-09-11 23:45:08 +0200 |
commit | 8f35bb1fcc9c1efd7edc52efbfc33509de2c00f2 (patch) | |
tree | f458cb7569e3b9a6bd38d70ee11da1e730760a5d /framework/source | |
parent | 157420e496ddebd7101d88ba8d07164d3971ad22 (diff) |
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 <sbergman@redhat.com>
Diffstat (limited to 'framework/source')
3 files changed, 10 insertions, 15 deletions
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; } |