From 99ac0876bd2e9307c6edd4872a130d10436b0452 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 20 Jan 2023 15:01:26 +0100 Subject: Base BaseControl on WeakComponentImplHelper ...rather than on the deprecated OComponentHelper. Various classes like BaseContainerControl, FrameControl, and ProgressBar, all deriving from BaseControl, had been found to implement their respective queryInterface in a way that is incompatible with the XAggregation protocol inherited via OComponentHelper. It looks like no code actually made use of the XAggregation offered by this class hierarchy, so the easiest fix for those queryInterface implementations appears to switch from OComponentHelper to WeakComponentImplHelper. Ideally, BaseControl would derive from WeakComponentImplHelper covering all the UNO interface classes from which it currently derives manually. But changing that manual implementation across the BaseControl class Hierarchy looks tricky, so merely introduce an "empty" WeakComponentImplHelper<> for now and keep all the manual stuff, and leave proper clean up for later. Change-Id: I1aa8b06f78700008f844415818f4a5801daa89b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145902 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- UnoControls/source/controls/progressmonitor.cxx | 48 +++++++------------------ 1 file changed, 13 insertions(+), 35 deletions(-) (limited to 'UnoControls/source/controls/progressmonitor.cxx') diff --git a/UnoControls/source/controls/progressmonitor.cxx b/UnoControls/source/controls/progressmonitor.cxx index cf9160ee4556..a22bbd620060 100644 --- a/UnoControls/source/controls/progressmonitor.cxx +++ b/UnoControls/source/controls/progressmonitor.cxx @@ -112,20 +112,20 @@ ProgressMonitor::~ProgressMonitor() // XInterface Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType ) { - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn; - css::uno::Reference< XInterface > xDel = BaseContainerControl::impl_getDelegator(); - if ( xDel.is() ) - { - // If a delegator exists, forward question to its queryInterface. - // Delegator will ask its own queryAggregation! - aReturn = xDel->queryInterface( rType ); - } - else + // Ask for my own supported interfaces ... + // Attention: XTypeProvider and XInterface are supported by WeakComponentImplHelper! + Any aReturn ( ::cppu::queryInterface( rType , + static_cast< XLayoutConstrains* > ( this ) , + static_cast< XButton* > ( this ) , + static_cast< XProgressMonitor* > ( this ) + ) + ); + + // If searched interface not supported by this class ... + if ( !aReturn.hasValue() ) { - // If a delegator is unknown, forward question to own queryAggregation. - aReturn = queryAggregation( rType ); + // ... ask baseclasses. + aReturn = BaseControl::queryInterface( rType ); } return aReturn; @@ -163,28 +163,6 @@ Sequence< Type > SAL_CALL ProgressMonitor::getTypes() return ourTypeCollection.getTypes(); } -// XAggregation -Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) -{ - // Ask for my own supported interfaces ... - // Attention: XTypeProvider and XInterface are supported by OComponentHelper! - Any aReturn ( ::cppu::queryInterface( aType , - static_cast< XLayoutConstrains* > ( this ) , - static_cast< XButton* > ( this ) , - static_cast< XProgressMonitor* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( !aReturn.hasValue() ) - { - // ... ask baseclasses. - aReturn = BaseControl::queryAggregation( aType ); - } - - return aReturn; -} - // XProgressMonitor void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, -- cgit