tdf#39593 Remove GetImplementation from ConstItemContainer and ItemContainer
Replace with comphelper::getUnoTunnelImplementation.
Change-Id: I87e1d3afd3a742926c7054179092d3b58b6b4563
Reviewed-on: https://gerrit.libreoffice.org/74310
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/framework/inc/uielement/constitemcontainer.hxx b/framework/inc/uielement/constitemcontainer.hxx
index 5efc22b..9ed2769 100644
--- a/framework/inc/uielement/constitemcontainer.hxx
+++ b/framework/inc/uielement/constitemcontainer.hxx
@@ -56,8 +56,7 @@
virtual ~ConstItemContainer() override;
// XUnoTunnel
static const css::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
static ConstItemContainer* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace ) throw();
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw();
sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier ) override;
// XIndexAccess
diff --git a/framework/inc/uielement/itemcontainer.hxx b/framework/inc/uielement/itemcontainer.hxx
index d3fb00b..156d7ff 100644
--- a/framework/inc/uielement/itemcontainer.hxx
+++ b/framework/inc/uielement/itemcontainer.hxx
@@ -48,8 +48,7 @@
// XInterface, XTypeProvider
// XUnoTunnel
static const css::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
static ItemContainer* GetImplementation( const css::uno::Reference< css::uno::XInterface >& rxIFace ) throw();
static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() throw();
// 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 d1e45af..03d638f 100644
--- a/framework/source/fwi/uielement/constitemcontainer.cxx
+++ b/framework/source/fwi/uielement/constitemcontainer.cxx
@@ -151,7 +151,7 @@
Reference< XIndexAccess > xReturn;
if ( rSubContainer.is() )
{
ItemContainer* pSource = ItemContainer::GetImplementation( rSubContainer );
ItemContainer* pSource = comphelper::getUnoTunnelImplementation<ItemContainer>( rSubContainer );
ConstItemContainer* pSubContainer( nullptr );
if ( pSource )
pSubContainer = new ConstItemContainer( *pSource );
@@ -166,7 +166,7 @@
// XUnoTunnel
sal_Int64 ConstItemContainer::getSomething( const css::uno::Sequence< sal_Int8 >& rIdentifier )
{
if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ConstItemContainer::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) )
if( ( rIdentifier.getLength() == 16 ) && ( 0 == memcmp( ConstItemContainer::getUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) )
{
return reinterpret_cast< sal_Int64 >( this );
}
@@ -178,18 +178,11 @@
class theConstItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theConstItemContainerUnoTunnelId > {};
}
const Sequence< sal_Int8 >& ConstItemContainer::GetUnoTunnelId() throw()
const Sequence< sal_Int8 >& ConstItemContainer::getUnoTunnelId() throw()
{
return theConstItemContainerUnoTunnelId::get().getSeq();
}
ConstItemContainer* ConstItemContainer::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< ConstItemContainer* >(sal::static_int_cast< sal_IntPtr >(
xUT->getSomething( ConstItemContainer::GetUnoTunnelId() ))) : nullptr;
}
// XElementAccess
sal_Bool SAL_CALL ConstItemContainer::hasElements()
{
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx
index 50f8b5a..8401274 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -120,7 +120,7 @@
Reference< XIndexAccess > xReturn;
if ( rSubContainer.is() )
{
ConstItemContainer* pSource = ConstItemContainer::GetImplementation( rSubContainer );
ConstItemContainer* pSource = comphelper::getUnoTunnelImplementation<ConstItemContainer>( rSubContainer );
ItemContainer* pSubContainer( nullptr );
if ( pSource )
pSubContainer = new ItemContainer( *pSource, rMutex );
@@ -137,18 +137,11 @@
class theItemContainerUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theItemContainerUnoTunnelId > {};
}
const Sequence< sal_Int8 >& ItemContainer::GetUnoTunnelId() throw()
const Sequence< sal_Int8 >& ItemContainer::getUnoTunnelId() throw()
{
return theItemContainerUnoTunnelId::get().getSeq();
}
ItemContainer* ItemContainer::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< ItemContainer* >(sal::static_int_cast< sal_IntPtr >(
xUT->getSomething( ItemContainer::GetUnoTunnelId() ))) : nullptr;
}
// XElementAccess
sal_Bool SAL_CALL ItemContainer::hasElements()
{
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 9467230..5b33022 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -128,7 +128,7 @@
Reference< XIndexAccess > xReturn;
if ( rSubContainer.is() )
{
ConstItemContainer* pSource = ConstItemContainer::GetImplementation( rSubContainer );
ConstItemContainer* pSource = comphelper::getUnoTunnelImplementation<ConstItemContainer>( rSubContainer );
ItemContainer* pSubContainer( nullptr );
if ( pSource )
pSubContainer = new ItemContainer( *pSource, m_aShareMutex );