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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-02-23 10:33:51 +02:00
parent 78a158211b
commit ce32856bfe

View file

@ -17,11 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <osl/mutex.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/component.hxx>
#include <comphelper/compbase.hxx>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <cppuhelper/supportsservice.hxx>
@ -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<std::mutex>& rGuard) override;
private:
css::uno::Reference<css::awt::XWindow> 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<css::ui::dialogs::XExecutableDialog>::get())
{
void * p = static_cast< css::ui::dialogs::XExecutableDialog * >( this );
return Any( &p, rType );
}
else if (rType == cppu::UnoType<XServiceInfo>::get())
{
void * p = static_cast< XServiceInfo * >( this );
return Any( &p, rType );
}
else if (rType == cppu::UnoType<XInitialization>::get())
{
void * p = static_cast< XInitialization * >( this );
return Any( &p, rType );
}
else if (rType == cppu::UnoType<XTerminateListener>::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<XComponent>::get(),
cppu::UnoType<XTypeProvider>::get(),
cppu::UnoType<XAggregation>::get(),
cppu::UnoType<XWeak>::get(),
cppu::UnoType<XServiceInfo>::get(),
cppu::UnoType<XInitialization>::get(),
cppu::UnoType<XTerminateListener>::get(),
cppu::UnoType<css::ui::dialogs::XExecutableDialog>::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<std::mutex>& rGuard)
{
::SolarMutexGuard aGuard;
rGuard.unlock();
{
::SolarMutexGuard aGuard;
if (mxDialog)
mxDialog->response(RET_CLOSE);
if (mxDialog)
mxDialog->response(RET_CLOSE);
}
rGuard.lock();
}