diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-01-19 14:05:58 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-01-19 15:00:41 +0000 |
commit | 1786cd0687c5223821e673fe4d2f7b2ff65deb00 (patch) | |
tree | 33598de5ea40ba2ceb6b5d62ab7480c5d778daf2 /stoc | |
parent | 8e4740e7a93a03ca0faab40b163a1ec7da806a72 (diff) |
Base IdlReflectionServiceImpl on WeakComponentImplHelper
...rather than on the deprecated OComponentHelper
Change-Id: Icb83d3cc0a0588a703a9041c00730b2a8d8bb90b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145789
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 23 | ||||
-rw-r--r-- | stoc/source/corereflection/crefl.cxx | 47 |
2 files changed, 9 insertions, 61 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 05975d3d24b7..03d844de3cc9 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -28,7 +28,7 @@ #include <uno/mapping.hxx> #include <uno/dispatcher.h> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/component.hxx> +#include <cppuhelper/compbase.hxx> #include <rtl/ustring.hxx> #include <rtl/ref.hxx> @@ -74,10 +74,10 @@ typedef std::unordered_map< OUString, css::uno::WeakReference< css::reflection:: class IdlReflectionServiceImpl - : public ::cppu::OComponentHelper - , public css::reflection::XIdlReflection - , public css::container::XHierarchicalNameAccess - , public css::lang::XServiceInfo + : public ::cppu::WeakComponentImplHelper< + css::reflection::XIdlReflection, + css::container::XHierarchicalNameAccess, + css::lang::XServiceInfo> { ::osl::Mutex _aComponentMutex; css::uno::Reference< css::container::XHierarchicalNameAccess > _xTDMgr; @@ -102,23 +102,14 @@ public: explicit IdlReflectionServiceImpl( const css::uno::Reference< css::uno::XComponentContext > & xContext ); virtual ~IdlReflectionServiceImpl() override; - // 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; - - // some XComponent part from OComponentHelper - virtual void SAL_CALL dispose() override; + // WeakComponentImplHelper + virtual void SAL_CALL disposing() override; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - // XTypeProvider - virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - // XIdlReflection virtual css::uno::Reference< css::reflection::XIdlClass > SAL_CALL forName( const OUString & rTypeName ) override; virtual css::uno::Reference< css::reflection::XIdlClass > SAL_CALL getType( const css::uno::Any & rObj ) override; diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx index af1854e7e3b4..4f396065b478 100644 --- a/stoc/source/corereflection/crefl.cxx +++ b/stoc/source/corereflection/crefl.cxx @@ -45,7 +45,7 @@ namespace stoc_corefl IdlReflectionServiceImpl::IdlReflectionServiceImpl( const Reference< XComponentContext > & xContext ) - : OComponentHelper( _aComponentMutex ) + : WeakComponentImplHelper( _aComponentMutex ) { xContext->getValueByName( "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) >>= _xTDMgr; @@ -54,53 +54,10 @@ IdlReflectionServiceImpl::IdlReflectionServiceImpl( IdlReflectionServiceImpl::~IdlReflectionServiceImpl() {} -// XInterface - -Any IdlReflectionServiceImpl::queryInterface( const Type & rType ) -{ - Any aRet( ::cppu::queryInterface( - rType, - static_cast< XIdlReflection * >( this ), - static_cast< XHierarchicalNameAccess * >( this ), - static_cast< XServiceInfo * >( this ) ) ); - - return (aRet.hasValue() ? aRet : OComponentHelper::queryInterface( rType )); -} - -void IdlReflectionServiceImpl::acquire() noexcept -{ - OComponentHelper::acquire(); -} - -void IdlReflectionServiceImpl::release() noexcept -{ - OComponentHelper::release(); -} - -// XTypeProvider - -Sequence< Type > IdlReflectionServiceImpl::getTypes() -{ - static OTypeCollection s_aTypes( - cppu::UnoType<XIdlReflection>::get(), - cppu::UnoType<XHierarchicalNameAccess>::get(), - cppu::UnoType<XServiceInfo>::get(), - OComponentHelper::getTypes() ); - - return s_aTypes.getTypes(); -} - -Sequence< sal_Int8 > IdlReflectionServiceImpl::getImplementationId() -{ - return css::uno::Sequence<sal_Int8>(); -} - // XComponent -void IdlReflectionServiceImpl::dispose() +void IdlReflectionServiceImpl::disposing() { - OComponentHelper::dispose(); - MutexGuard aGuard( _aComponentMutex ); _aElements.clear(); #ifdef TEST_LIST_CLASSES |