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/framecontrol.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/framecontrol.cxx')
-rw-r--r-- | UnoControls/source/controls/framecontrol.cxx | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx index 73decca46274..54a0f36f6d05 100644 --- a/UnoControls/source/controls/framecontrol.cxx +++ b/UnoControls/source/controls/framecontrol.cxx @@ -73,20 +73,23 @@ FrameControl::~FrameControl() Any SAL_CALL FrameControl::queryInterface( const Type& rType ) { - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - Any aReturn; - Reference< XInterface > xDel = BaseControl::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< XControlModel* > ( this ) , + static_cast< XConnectionPointContainer* > ( 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 = OPropertySetHelper::queryInterface( rType ); + if ( !aReturn.hasValue() ) + { + aReturn = BaseControl::queryInterface( rType ); + } } return aReturn; @@ -127,32 +130,6 @@ Sequence< Type > SAL_CALL FrameControl::getTypes() return ourTypeCollection.getTypes(); } -// XAggregation - -Any SAL_CALL FrameControl::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< XControlModel* > ( this ) , - static_cast< XConnectionPointContainer* > ( this ) - ) - ); - - // If searched interface not supported by this class ... - if ( !aReturn.hasValue() ) - { - // ... ask baseclasses. - aReturn = OPropertySetHelper::queryInterface( aType ); - if ( !aReturn.hasValue() ) - { - aReturn = BaseControl::queryAggregation( aType ); - } - } - - return aReturn; -} - OUString FrameControl::getImplementationName() { return "stardiv.UnoControls.FrameControl"; |