From 76cf7c6fc071c76675fef80bf55be473efef6296 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 8 Dec 2024 21:43:14 +0500 Subject: [PATCH] Simplify UcbContentProviderProxy Change-Id: I7366e31dc167707adf2c614049cee852e44d7ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178097 Reviewed-by: Mike Kaganski Tested-by: Jenkins --- ucb/source/core/provprox.cxx | 42 ++++-------------------------------- ucb/source/core/provprox.hxx | 19 +++++----------- 2 files changed, 9 insertions(+), 52 deletions(-) diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx index 54ba56b33165..863e3c1469b1 100644 --- a/ucb/source/core/provprox.cxx +++ b/ucb/source/core/provprox.cxx @@ -108,31 +108,12 @@ UcbContentProviderProxy::~UcbContentProviderProxy() // XInterface methods. -void SAL_CALL UcbContentProviderProxy::acquire() - noexcept -{ - OWeakObject::acquire(); -} - -void SAL_CALL UcbContentProviderProxy::release() - noexcept -{ - OWeakObject::release(); -} // virtual Any SAL_CALL UcbContentProviderProxy::queryInterface( const Type & rType ) { - Any aRet = cppu::queryInterface( rType, - static_cast< XTypeProvider * >( this ), - static_cast< XServiceInfo * >( this ), - static_cast< XContentProvider * >( this ), - static_cast< XParameterizedContentProvider * >( this ), - static_cast< XContentProviderSupplier * >( this ) ); - - if ( !aRet.hasValue() ) - aRet = OWeakObject::queryInterface( rType ); + Any aRet = UcbContentProviderProxy_BASE::queryInterface(rType); if ( !aRet.hasValue() ) { @@ -148,28 +129,13 @@ UcbContentProviderProxy::queryInterface( const Type & rType ) // XTypeProvider methods. - -XTYPEPROVIDER_COMMON_IMPL( UcbContentProviderProxy ); - - Sequence< Type > SAL_CALL UcbContentProviderProxy::getTypes() { // Get original provider and forward the call... - Reference< XTypeProvider > xProvider( getContentProvider(), UNO_QUERY ); - if ( xProvider.is() ) - { + if (Reference xProvider{ getContentProvider(), UNO_QUERY }) return xProvider->getTypes(); - } - else - { - static cppu::OTypeCollection s_aCollection( - CPPU_TYPE_REF( XTypeProvider ), - CPPU_TYPE_REF( XServiceInfo ), - CPPU_TYPE_REF( XContentProvider ), - CPPU_TYPE_REF( XParameterizedContentProvider ), - CPPU_TYPE_REF( XContentProviderSupplier ) ); - return s_aCollection.getTypes(); - } + + return UcbContentProviderProxy_BASE::getTypes(); } diff --git a/ucb/source/core/provprox.hxx b/ucb/source/core/provprox.hxx index 746c9b63d801..a5486a48f81e 100644 --- a/ucb/source/core/provprox.hxx +++ b/ucb/source/core/provprox.hxx @@ -55,16 +55,12 @@ public: - -class UcbContentProviderProxy : - public cppu::OWeakObject, - public css::lang::XTypeProvider, - public css::lang::XServiceInfo, - public css::ucb::XContentProviderSupplier, - public css::ucb::XContentProvider, - public css::ucb::XParameterizedContentProvider +using UcbContentProviderProxy_BASE = comphelper::WeakImplHelper; +class UcbContentProviderProxy : public UcbContentProviderProxy_BASE { - std::mutex m_aMutex; OUString m_aService; OUString m_aTemplate; OUString m_aArguments; @@ -86,13 +82,8 @@ public: // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; - virtual void SAL_CALL acquire() - noexcept override; - virtual void SAL_CALL release() - noexcept override; // XTypeProvider - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; // XServiceInfo