tdf#39593 Remove dbaccess::OContentHelper::getImplementation
Replace with comphelper::getUnoTunnelImplementation.
Change-Id: I533bfcd3959037a2621eb3fd42bf7172b5396c5f
Reviewed-on: https://gerrit.libreoffice.org/74539
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx
index 479bcdd..b8e7502 100644
--- a/dbaccess/source/core/dataaccess/ContentHelper.cxx
+++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx
@@ -83,7 +83,7 @@
IMPLEMENT_SERVICE_INFO1(OContentHelper,"com.sun.star.comp.sdb.Content","com.sun.star.ucb.Content");
css::uno::Sequence<sal_Int8> OContentHelper::getUnoTunnelImplementationId()
css::uno::Sequence<sal_Int8> OContentHelper::getUnoTunnelId()
{
static cppu::OImplementationId aId;
return aId.getImplementationId();
@@ -541,23 +541,12 @@
// css::lang::XUnoTunnel
sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
{
if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(), rId.getConstArray(), 16 ) )
if (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
return reinterpret_cast<sal_Int64>(this);
return 0;
}
OContentHelper* OContentHelper::getImplementation( const Reference< XInterface >& _rxComponent )
{
OContentHelper* pContent( nullptr );
Reference< XUnoTunnel > xUnoTunnel( _rxComponent, UNO_QUERY );
if ( xUnoTunnel.is() )
pContent = reinterpret_cast< OContentHelper* >( xUnoTunnel->getSomething( getUnoTunnelImplementationId() ) );
return pContent;
}
Reference< XInterface > SAL_CALL OContentHelper::getParent( )
{
::osl::MutexGuard aGuard(m_aMutex);
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index c099c0f..1e0249f 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/ucb/CommandInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/sdb/ErrorCondition.hpp>
#include <comphelper/servicehelper.hxx>
#include <comphelper/types.hxx>
#include <ucbhelper/contentidentifier.hxx>
@@ -530,7 +531,7 @@
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
::rtl::Reference< OContentHelper > pContent = OContentHelper::getImplementation( _rxNewObject );
::rtl::Reference< OContentHelper > pContent = comphelper::getUnoTunnelImplementation<OContentHelper>( _rxNewObject );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -589,7 +590,7 @@
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
::rtl::Reference< OContentHelper > pContent( OContentHelper::getImplementation( _rxObject ) );
::rtl::Reference< OContentHelper > pContent( comphelper::getUnoTunnelImplementation<OContentHelper>( _rxObject ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 9e9a1f8..54e338b 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -37,6 +37,7 @@
#include <strings.hrc>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <vcl/svapp.hxx>
@@ -633,9 +634,7 @@
::rtl::Reference<OContentHelper> pContent;
try
{
Reference<XUnoTunnel> xUnoTunnel(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ), UNO_QUERY );
if ( xUnoTunnel.is() )
pContent = reinterpret_cast<OContentHelper*>(xUnoTunnel->getSomething(OContentHelper::getUnoTunnelImplementationId()));
pContent = comphelper::getUnoTunnelImplementation<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
}
catch(const Exception&)
{
diff --git a/dbaccess/source/core/inc/ContentHelper.hxx b/dbaccess/source/core/inc/ContentHelper.hxx
index a1cd45c..93290fd 100644
--- a/dbaccess/source/core/inc/ContentHelper.hxx
+++ b/dbaccess/source/core/inc/ContentHelper.hxx
@@ -133,7 +133,7 @@
// css::lang::XTypeProvider
virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override;
static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
// css::lang::XServiceInfo
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
@@ -163,7 +163,7 @@
// css::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
static OContentHelper* getImplementation( const css::uno::Reference< css::uno::XInterface >& _rxComponent );
static css::uno::Sequence< sal_Int8 > getUnoTunnelId();
// css::container::XChild
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;