use cppu::WeakImplHelper in VCLXRegion

Change-Id: I93bb52b35b4c15dc93d7638d7fc1e00652a2a1e7
Reviewed-on: https://gerrit.libreoffice.org/80400
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-10-07 14:32:45 +02:00
parent e177139949
commit d3883e67bf
2 changed files with 4 additions and 37 deletions

View File

@@ -25,7 +25,7 @@
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx>
#include <osl/mutex.hxx>
#include <vcl/region.hxx>
@@ -34,10 +34,9 @@
// class VCLXRegion
class VCLXRegion final : public css::awt::XRegion,
public css::lang::XTypeProvider,
public css::lang::XUnoTunnel,
public ::cppu::OWeakObject
class VCLXRegion final : public cppu::WeakImplHelper<
css::awt::XRegion,
css::lang::XUnoTunnel>
{
::osl::Mutex maMutex;
vcl::Region maRegion;
@@ -50,18 +49,9 @@ public:
const vcl::Region& GetRegion() const { return maRegion; }
// css::uno::XInterface
css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
void SAL_CALL acquire() throw() override { OWeakObject::acquire(); }
void SAL_CALL release() throw() override { OWeakObject::release(); }
// css::lang::XUnoTunnel
UNO3_GETIMPLEMENTATION_DECL(VCLXRegion)
// css::lang::XTypeProvider
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
// css::awt::XRegion
css::awt::Rectangle SAL_CALL getBounds() override;
void SAL_CALL clear() override;

View File

@@ -34,32 +34,9 @@ VCLXRegion::~VCLXRegion()
{
}
// css::uno::XInterface
css::uno::Any VCLXRegion::queryInterface( const css::uno::Type & rType )
{
css::uno::Any aRet = ::cppu::queryInterface( rType,
static_cast< css::awt::XRegion* >(this),
static_cast< css::lang::XUnoTunnel* >(this),
static_cast< css::lang::XTypeProvider* >(this) );
return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
}
// css::lang::XUnoTunnel
UNO3_GETIMPLEMENTATION_IMPL( VCLXRegion );
IMPL_IMPLEMENTATION_ID( VCLXRegion )
// css::lang::XTypeProvider
css::uno::Sequence< css::uno::Type > VCLXRegion::getTypes()
{
static const css::uno::Sequence< css::uno::Type > aTypeList {
cppu::UnoType<css::lang::XTypeProvider>::get(),
cppu::UnoType<css::awt::XRegion>::get()
};
return aTypeList;
}
css::awt::Rectangle VCLXRegion::getBounds()
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );