From ce32856bfe51ee844f6374ba2161eae821f9df61 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 23 Feb 2023 10:33:51 +0200 Subject: [PATCH] drop OComponentHelper in XMLFilterDialogComponent nothing seems to be using the aggregation here - as expected, this is not the kind of thing that is aggregated Change-Id: I8abc4f4db0dc9447e4018330bba86f3579bb21c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147503 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../xsltdialog/xmlfilterdialogcomponent.cxx | 102 +++--------------- 1 file changed, 16 insertions(+), 86 deletions(-) diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index 6f4b1db3453b..5cf047d07e41 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -17,11 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include - #include #include -#include +#include #include #include #include @@ -44,33 +42,19 @@ using namespace ::com::sun::star::frame; namespace { -class XMLFilterDialogComponentBase -{ -protected: - ::osl::Mutex maMutex; -}; - -class XMLFilterDialogComponent : public XMLFilterDialogComponentBase, - public OComponentHelper, - public css::ui::dialogs::XExecutableDialog, - public XServiceInfo, - public XInitialization, - public XTerminateListener +class XMLFilterDialogComponent : public comphelper::WeakComponentImplHelper< + css::ui::dialogs::XExecutableDialog, + XServiceInfo, + XInitialization, + XTerminateListener> { public: explicit XMLFilterDialogComponent( const Reference< XComponentContext >& rxContext ); - // XInterface - virtual Any SAL_CALL queryInterface( const Type& aType ) override; - virtual Any SAL_CALL queryAggregation( Type const & rType ) override; - virtual void SAL_CALL acquire() noexcept override; - virtual void SAL_CALL release() noexcept override; - protected: // XTypeProvider virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override; - virtual Sequence< Type > SAL_CALL getTypes() override; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; @@ -91,7 +75,7 @@ protected: /** Called in dispose method after the listeners were notified. */ - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock& rGuard) override; private: css::uno::Reference mxParent; /// parent window @@ -103,59 +87,13 @@ private: } XMLFilterDialogComponent::XMLFilterDialogComponent(const css::uno::Reference< XComponentContext >& rxContext) - : OComponentHelper(maMutex) - , mxContext(rxContext) + : mxContext(rxContext) { Reference< XDesktop2 > xDesktop = Desktop::create( rxContext ); Reference< XTerminateListener > xListener( this ); xDesktop->addTerminateListener( xListener ); } -// XInterface -Any SAL_CALL XMLFilterDialogComponent::queryInterface( const Type& aType ) -{ - return OComponentHelper::queryInterface( aType ); -} - - -Any SAL_CALL XMLFilterDialogComponent::queryAggregation( Type const & rType ) -{ - if (rType == cppu::UnoType::get()) - { - void * p = static_cast< css::ui::dialogs::XExecutableDialog * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType::get()) - { - void * p = static_cast< XServiceInfo * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType::get()) - { - void * p = static_cast< XInitialization * >( this ); - return Any( &p, rType ); - } - else if (rType == cppu::UnoType::get()) - { - void * p = static_cast< XTerminateListener * >( this ); - return Any( &p, rType ); - } - return OComponentHelper::queryAggregation( rType ); -} - - -void SAL_CALL XMLFilterDialogComponent::acquire() noexcept -{ - OComponentHelper::acquire(); -} - - -void SAL_CALL XMLFilterDialogComponent::release() noexcept -{ - OComponentHelper::release(); -} - - OUString SAL_CALL XMLFilterDialogComponent::getImplementationName() { return "com.sun.star.comp.ui.XSLTFilterDialog"; @@ -168,18 +106,6 @@ Sequence< sal_Int8 > SAL_CALL XMLFilterDialogComponent::getImplementationId() } -Sequence< Type > XMLFilterDialogComponent::getTypes() -{ - return { cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get(), - cppu::UnoType::get() }; -} - Sequence< OUString > SAL_CALL XMLFilterDialogComponent::getSupportedServiceNames() { return { "com.sun.star.ui.dialogs.XSLTFilterDialog" }; @@ -192,12 +118,16 @@ sal_Bool SAL_CALL XMLFilterDialogComponent::supportsService(const OUString& Serv /** Called in dispose method after the listeners were notified. */ -void SAL_CALL XMLFilterDialogComponent::disposing() +void XMLFilterDialogComponent::disposing(std::unique_lock& rGuard) { - ::SolarMutexGuard aGuard; + rGuard.unlock(); + { + ::SolarMutexGuard aGuard; - if (mxDialog) - mxDialog->response(RET_CLOSE); + if (mxDialog) + mxDialog->response(RET_CLOSE); + } + rGuard.lock(); }