sd/source/ui/inc/unopage.hxx    |    6 ++++++
 sd/source/ui/unoidl/unopage.cxx |   18 +++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit ede696562a38a8ffe5c27b397108ee1f59716ae3
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Thu Jan 19 08:41:32 2023 +0100
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Jan 19 09:38:57 2023 +0000

    Fix SdGenericDrawPage et al queryAggregation
    
    The base SvxDrawPage uses WeakAggImplHelper7, so (for better or worse) 
derives
    from XAggregation, but SdGenericDrawPage and its derived classes 
(SdDrawPage,
    SdMasterPage) failed to properly implement the XAggregation protocol.
    
    When fixing this, it became apparent that SdGenericDrawPage::queryInterface 
had
    erroneously delegated to SvxDrawPage::queryInterface rather than to the
    intermediary SvxFmDrawPage::queryInterface, so that querying for e.g.
    XFormsSupplier had only worked by accident:  
SdGenericDrawPage::queryInterface
    didn't support it, so delegated to SvxDrawPage::queryInterface, which didn't
    support it, so delegated to WeakAggImplHelper7::queryInterface, which didn't
    support it, so delegated to OWeakAggObject::queryInterface, which (as there 
was
    no delegator set) delegated to the most derived 
SvxFmDrawPage::queryAggregation,
    which supports it.
    
    Change-Id: Ia7154d62e493238738e6d15dea2f01a437a70bff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145763
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/sd/source/ui/inc/unopage.hxx b/sd/source/ui/inc/unopage.hxx
index 1eb3cb6d83b1..b6a6f0d6d9b6 100644
--- a/sd/source/ui/inc/unopage.hxx
+++ b/sd/source/ui/inc/unopage.hxx
@@ -112,6 +112,8 @@ public:
     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;
     virtual void SAL_CALL split( const css::uno::Reference< 
css::drawing::XShape >& xGroup ) override;
@@ -179,6 +181,8 @@ 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;
@@ -236,6 +240,8 @@ 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;
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 4831b29bb53d..ae05e5ce79ed 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -509,6 +509,10 @@ rtl::Reference<SdrObject> 
SdGenericDrawPage::CreateSdrObject_( const Reference<
 // XInterface
 Any SAL_CALL 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())
@@ -555,7 +559,7 @@ Any SAL_CALL SdGenericDrawPage::queryInterface( const 
uno::Type & rType )
             return Any( Reference< XAnimationNodeSupplier >( this ) );
     }
     else
-        return SvxDrawPage::queryInterface( rType );
+        return SvxFmDrawPage::queryAggregation( rType );
 
     return aAny;
 }
@@ -2041,6 +2045,10 @@ 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 ) );
@@ -2055,7 +2063,7 @@ Any SAL_CALL SdDrawPage::queryInterface( const uno::Type 
& rType )
         }
     }
 
-    return SdGenericDrawPage::queryInterface( rType );
+    return SdGenericDrawPage::queryAggregation( rType );
 }
 
 void SAL_CALL SdDrawPage::acquire() noexcept
@@ -2638,6 +2646,10 @@ 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();
@@ -2655,7 +2667,7 @@ Any SAL_CALL SdMasterPage::queryInterface( const 
uno::Type & rType )
                GetPage()  && GetPage()->GetPageKind() != PageKind::Handout) )
         aAny <<= Reference< presentation::XPresentationPage >( this );
     else
-        return SdGenericDrawPage::queryInterface( rType );
+        return SdGenericDrawPage::queryAggregation( rType );
 
     return aAny;
 }

Reply via email to