From 579d144290c1617fdb38d09b30900a6bbe390b8d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 19 Jan 2023 09:42:08 +0100 Subject: [PATCH] Fix some toolkit UnoControlBase derivates' queryAggregation The base UnoControl uses WeakAggImplHelper9, so (for better or worse) derives from XAggregation, but UnoGridControl, UnoRoadmapControl, and UnoTreeControl all failed to properly implement the XAggregation protocol. Change-Id: Ia1676782e616216f645dc86ba978c2f5887dc508 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145767 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- toolkit/inc/controls/roadmapcontrol.hxx | 4 +++- toolkit/source/controls/grid/gridcontrol.hxx | 4 ++-- toolkit/source/controls/roadmapcontrol.cxx | 9 ++++++++- toolkit/source/controls/tree/treecontrol.cxx | 4 ++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/toolkit/inc/controls/roadmapcontrol.hxx b/toolkit/inc/controls/roadmapcontrol.hxx index 2a4a1021e0ad..cfc7fbdb9c74 100644 --- a/toolkit/inc/controls/roadmapcontrol.hxx +++ b/toolkit/inc/controls/roadmapcontrol.hxx @@ -168,7 +168,9 @@ namespace toolkit // XTypeProvider DECLARE_XTYPEPROVIDER( ) - DECLARE_XINTERFACE() + DECLARE_UNO3_AGG_DEFAULTS(UnoRoadmapControl, UnoControlRoadmap_Base) + + css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & aType) override; // css::lang::XServiceInfo OUString SAL_CALL getImplementationName() override; diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx index 6b4f8152bbd0..435ff2fab089 100644 --- a/toolkit/source/controls/grid/gridcontrol.hxx +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -78,7 +78,7 @@ public: // = UnoGridControl -typedef ::cppu::ImplInheritanceHelper < UnoControlBase +typedef ::cppu::AggImplInheritanceHelper2 < UnoControlBase , css::awt::grid::XGridControl , css::awt::grid::XGridRowSelection > UnoGridControl_Base; diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 2640dc6b5b67..84d49a78f48b 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -362,7 +362,14 @@ static void lcl_throwIndexOutOfBoundsException( ) } IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase ) -IMPLEMENT_FORWARD_XINTERFACE2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase ) + +css::uno::Any UnoRoadmapControl::queryAggregation(css::uno::Type const & aType) { + auto ret = UnoControlRoadmap_Base::queryAggregation(aType); + if (!ret.hasValue()) { + ret = UnoControlRoadmap_IBase::queryInterface(aType); + } + return ret; +} sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& _rModel) diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index d4439a4ff1e3..43d353079f43 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include @@ -120,7 +120,7 @@ Reference< XPropertySetInfo > UnoTreeModel::getPropertySetInfo( ) namespace { -typedef ::cppu::ImplInheritanceHelper< UnoControlBase, css::awt::tree::XTreeControl > UnoTreeControl_Base; +typedef ::cppu::AggImplInheritanceHelper1< UnoControlBase, css::awt::tree::XTreeControl > UnoTreeControl_Base; class UnoTreeControl : public UnoTreeControl_Base { public: