SvxDrawPage does not need to use aggregation

we use custom subclasses when we want to modify behaviour

Change-Id: I1aef9e87c76ea97f1868134f5e1ac0e317b5c698
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2023-09-05 11:38:10 +02:00
parent d8dbf35c48
commit 5fac945201
10 changed files with 19 additions and 72 deletions

View File

@@ -74,6 +74,10 @@ bool ImplInheritanceHelper::VisitCXXRecordDecl(const CXXRecordDecl* cxxRecordDec
.Namespace("pcr")
.GlobalNamespace())
return true;
if (loplugin::DeclCheck(cxxRecordDecl).Class("SdDrawPage").GlobalNamespace())
return true;
if (loplugin::DeclCheck(cxxRecordDecl).Class("SdMasterPage").GlobalNamespace())
return true;
// check if this class extends cppu::WeakImplHelper
if (!loplugin::isDerivedFrom(cxxRecordDecl, [](Decl const* decl) -> bool {

View File

@@ -21,14 +21,14 @@
#include <com/sun/star/form/XFormsSupplier2.hpp>
#include <svx/unopage.hxx>
#include <comphelper/uno3.hxx>
#include <svx/svxdllapi.h>
// SvxFmDrawPage
class SVXCORE_DLLPUBLIC SvxFmDrawPage :public SvxDrawPage
,public css::form::XFormsSupplier2
typedef cppu::ImplInheritanceHelper<SvxDrawPage, css::form::XFormsSupplier2> SvxFmDrawPage_Base;
class SVXCORE_DLLPUBLIC SvxFmDrawPage : public SvxFmDrawPage_Base
{
protected:
@@ -44,14 +44,8 @@ public:
SvxFmDrawPage( SdrPage* pPage );
virtual ~SvxFmDrawPage() noexcept override;
// UNO binding
DECLARE_UNO3_AGG_DEFAULTS(SvxFmDrawPage, SvxDrawPage)
virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
// XFormsSupplier
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override;

View File

@@ -32,7 +32,7 @@
#include <svx/svdobjkind.hxx>
#include <rtl/ref.hxx>
#include <cppuhelper/implbase7.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/servicehelper.hxx>
#include <memory>
@@ -48,7 +48,7 @@ class SvxShapeConnector;
enum class SdrInventor : sal_uInt32;
class SVXCORE_DLLPUBLIC SvxDrawPage : protected cppu::BaseMutex,
public ::cppu::WeakAggImplHelper7< css::drawing::XDrawPage,
public ::cppu::WeakImplHelper< css::drawing::XDrawPage,
css::drawing::XShapeGrouper,
css::drawing::XShapes2,
css::drawing::XShapes3,
@@ -97,9 +97,6 @@ class SVXCORE_DLLPUBLIC SvxDrawPage : protected cppu::BaseMutex,
UNO3_GETIMPLEMENTATION_DECL( SvxDrawPage )
// XInterface
virtual void SAL_CALL release() noexcept override;
// XShapes
virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;

View File

@@ -22,6 +22,7 @@
#include <svx/unopage.hxx>
#include <com/sun/star/report/XSection.hpp>
#include <cppuhelper/weakref.hxx>
namespace reportdesign
{

View File

@@ -110,9 +110,6 @@ public:
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
virtual void SAL_CALL release() noexcept override;
css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
// XShapeCombiner
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL combine( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
@@ -181,8 +178,6 @@ public:
virtual void SAL_CALL acquire() noexcept override;
virtual void SAL_CALL release() noexcept override;
css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
@@ -240,8 +235,6 @@ public:
virtual void SAL_CALL acquire() noexcept override;
virtual void SAL_CALL release() noexcept override;
css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & rType) override;
// XTypeProvider
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;

View File

@@ -44,6 +44,7 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <comphelper/sequence.hxx>
#include <sfx2/infobar.hxx>
#include <sfx2/dispatch.hxx>

View File

@@ -512,12 +512,8 @@ rtl::Reference<SdrObject> SdGenericDrawPage::CreateSdrObject_( const Reference<
}
// XInterface
Any SAL_CALL SdGenericDrawPage::queryInterface( const uno::Type & rType )
Any SdGenericDrawPage::queryInterface(const uno::Type & rType)
{
return SvxFmDrawPage::queryInterface(rType);
}
css::uno::Any SdGenericDrawPage::queryAggregation(css::uno::Type const & rType) {
Any aAny;
if (rType == cppu::UnoType<beans::XPropertySet>::get())
@@ -564,7 +560,7 @@ css::uno::Any SdGenericDrawPage::queryAggregation(css::uno::Type const & rType)
return Any( Reference< XAnimationNodeSupplier >( this ) );
}
else
return SvxFmDrawPage::queryAggregation( rType );
return SvxFmDrawPage::queryInterface( rType );
return aAny;
}
@@ -1880,13 +1876,6 @@ void SdGenericDrawPage::SetHeight( sal_Int32 nHeight )
refreshpage( &rDoc, ePageKind );
}
// XInterface
void SdGenericDrawPage::release() noexcept
{
OWeakAggObject::release();
}
// XComponent
void SdGenericDrawPage::disposing() noexcept
{
@@ -2069,10 +2058,6 @@ SdDrawPage::~SdDrawPage() noexcept
// XInterface
Any SAL_CALL SdDrawPage::queryInterface( const uno::Type & rType )
{
return SdGenericDrawPage::queryInterface(rType);
}
css::uno::Any SdDrawPage::queryAggregation(css::uno::Type const & rType) {
if( rType == cppu::UnoType<drawing::XMasterPageTarget>::get() )
{
return Any( Reference< drawing::XMasterPageTarget >( this ) );
@@ -2087,7 +2072,7 @@ css::uno::Any SdDrawPage::queryAggregation(css::uno::Type const & rType) {
}
}
return SdGenericDrawPage::queryAggregation( rType );
return SdGenericDrawPage::queryInterface( rType );
}
void SAL_CALL SdDrawPage::acquire() noexcept
@@ -2670,10 +2655,6 @@ SdMasterPage::~SdMasterPage() noexcept
// XInterface
Any SAL_CALL SdMasterPage::queryInterface( const uno::Type & rType )
{
return SdGenericDrawPage::queryInterface(rType);
}
css::uno::Any SdMasterPage::queryAggregation(css::uno::Type const & rType) {
::SolarMutexGuard aGuard;
throwIfDisposed();
@@ -2691,7 +2672,7 @@ css::uno::Any SdMasterPage::queryAggregation(css::uno::Type const & rType) {
GetPage() && GetPage()->GetPageKind() != PageKind::Handout) )
aAny <<= Reference< presentation::XPresentationPage >( this );
else
return SdGenericDrawPage::queryAggregation( rType );
return SdGenericDrawPage::queryInterface( rType );
return aAny;
}

View File

@@ -28,7 +28,7 @@ using ::com::sun::star::uno::Any;
using ::com::sun::star::form::XFormsSupplier2;
SvxFmDrawPage::SvxFmDrawPage( SdrPage* pInPage ) :
SvxDrawPage( pInPage )
SvxFmDrawPage_Base( pInPage )
{
}
@@ -41,24 +41,6 @@ css::uno::Sequence< sal_Int8 > SAL_CALL SvxFmDrawPage::getImplementationId()
return css::uno::Sequence<sal_Int8>();
}
Any SAL_CALL SvxFmDrawPage::queryAggregation( const css::uno::Type& _rType )
{
Any aRet = ::cppu::queryInterface ( _rType
, static_cast< XFormsSupplier2* >( this )
, static_cast< XFormsSupplier* >( this )
);
if ( !aRet.hasValue() )
aRet = SvxDrawPage::queryAggregation( _rType );
return aRet;
}
css::uno::Sequence< css::uno::Type > SAL_CALL SvxFmDrawPage::getTypes( )
{
return comphelper::concatSequences(SvxDrawPage::getTypes(),
css::uno::Sequence { cppu::UnoType<css::form::XFormsSupplier2>::get() });
}
rtl::Reference<SdrObject> SvxFmDrawPage::CreateSdrObject_( const css::uno::Reference< css::drawing::XShape > & xDescr )
{
OUString aShapeType( xDescr->getShapeType() );

View File

@@ -82,12 +82,6 @@ SvxDrawPage::~SvxDrawPage() noexcept
}
}
// XInterface
void SvxDrawPage::release() noexcept
{
OWeakAggObject::release();
}
// XComponent
void SvxDrawPage::disposing() noexcept
{

View File

@@ -30,17 +30,17 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/uno/XAggregation.hpp>
#include <cppuhelper/implbase.hxx>
class SdrMarkList;
class SdrView;
class SwDoc;
class SwXShape;
typedef cppu::AggImplInheritanceHelper2
typedef cppu::ImplInheritanceHelper
<
SvxFmDrawPage,
css::container::XEnumerationAccess,