XUnoTunnel->dynamic_cast in OContentHelper

Change-Id: I3788af96cc8664d8afda2bd5eeaf85e9cd0cf374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145618
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-01-14 12:32:23 +02:00
parent 654f972a97
commit 45a2d738c4
4 changed files with 3 additions and 21 deletions

View File

@@ -105,12 +105,6 @@ css::uno::Sequence< OUString > SAL_CALL OContentHelper::getSupportedServiceNames
}
const css::uno::Sequence<sal_Int8> & OContentHelper::getUnoTunnelId()
{
static const comphelper::UnoIdInit aId;
return aId.getSeq();
}
css::uno::Sequence<sal_Int8> OContentHelper::getImplementationId()
{
return css::uno::Sequence<sal_Int8>();
@@ -552,12 +546,6 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent
}
}
// css::lang::XUnoTunnel
sal_Int64 OContentHelper::getSomething( const Sequence< sal_Int8 > & rId )
{
return comphelper::getSomethingImpl(rId, this);
}
Reference< XInterface > SAL_CALL OContentHelper::getParent( )
{
::osl::MutexGuard aGuard(m_aMutex);

View File

@@ -533,7 +533,7 @@ void ODefinitionContainer::implAppend(const OUString& _rName, const Reference< X
// #i44786#
lcl_ensureName( _rxNewObject, _rName );
::rtl::Reference< OContentHelper > pContent = comphelper::getFromUnoTunnel<OContentHelper>( _rxNewObject );
::rtl::Reference< OContentHelper > pContent = dynamic_cast<OContentHelper*>( _rxNewObject.get() );
if ( pContent.is() )
{
TContentPtr pImpl = pContent->getImpl();
@@ -592,7 +592,7 @@ void ODefinitionContainer::approveNewObject(const OUString& _sName,const Referen
DBA_RES( RID_STR_NAME_ALREADY_USED ),
*this );
::rtl::Reference< OContentHelper > pContent( comphelper::getFromUnoTunnel<OContentHelper>( _rxObject ) );
::rtl::Reference< OContentHelper > pContent( dynamic_cast<OContentHelper*>( _rxObject.get() ) );
if ( !pContent.is() )
throw IllegalArgumentException(
DBA_RES( RID_STR_OBJECT_CONTAINER_MISMATCH ),

View File

@@ -668,7 +668,7 @@ OUString SAL_CALL ODocumentContainer::composeHierarchicalName( const OUString& i
::rtl::Reference<OContentHelper> pContent;
try
{
pContent = comphelper::getFromUnoTunnel<OContentHelper>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ));
pContent = dynamic_cast<OContentHelper*>(const_cast<ODocumentContainer*>(this)->implGetByName( _sName, true ).get());
}
catch(const Exception&)
{

View File

@@ -25,7 +25,6 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
@@ -80,7 +79,6 @@ namespace dbaccess
, css::beans::XPropertiesChangeNotifier
, css::beans::XPropertyContainer
, css::lang::XInitialization
, css::lang::XUnoTunnel
, css::container::XChild
, css::sdbcx::XRename
> OContentHelper_COMPBASE;
@@ -155,10 +153,6 @@ namespace dbaccess
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
// css::lang::XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
// css::container::XChild
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;