diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-01-20 15:01:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-01-20 17:18:27 +0000 |
commit | 99ac0876bd2e9307c6edd4872a130d10436b0452 (patch) | |
tree | 1fe8230f4c19d18fbb4cfce30164e018ec188db3 /UnoControls/source/controls/progressmonitor.cxx | |
parent | 46f64f6df4a7e545114c4ec92598f6634d38b04b (diff) |
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<XServiceInfo,
XPaintListener, XWindowListener, ...> 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 <sbergman@redhat.com>
Diffstat (limited to 'UnoControls/source/controls/progressmonitor.cxx')
-rw-r--r-- | UnoControls/source/controls/progressmonitor.cxx | 48 |
1 files changed, 13 insertions, 35 deletions
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, |