diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-01-20 13:30:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-01-20 14:34:40 +0000 |
commit | 8be6e5dcba0fd262421c59364a463e87ef85fe74 (patch) | |
tree | 24fdbe06c8d384da0ea0f6ebb2e1f181a2be2f16 /vcl/source | |
parent | 44c75d56cd441ad3d174db75a6e5ae672b7d2a08 (diff) |
Base GraphicDescriptor on OWeakObject
...rather than on the legacy OWeakAggObject.
It was found that e.g. Graphic, deriving from GraphicDescriptor, was
implementing queryInterface in a way that is incompatible with XAggregation
protocol inherited via OWeakAggObject. It looks like no code actually made use
of the XAggregation offered by this class hierarchy, so the easiest fix for that
queryInterface implementation appears to switch from OWeakAggObject to
OWeakObject.
Change-Id: I54514db32b731b9fa83831a1071da6f665fdf25e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145891
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/graphic/UnoGraphic.cxx | 14 | ||||
-rw-r--r-- | vcl/source/graphic/UnoGraphicDescriptor.cxx | 14 |
2 files changed, 8 insertions, 20 deletions
diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index a1150e26ca69..f26640563862 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -50,7 +50,7 @@ void Graphic::init(const ::Graphic& rGraphic) unographic::GraphicDescriptor::init(maGraphic); } -uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType ) +uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType ) { uno::Any aAny; if( rType == cppu::UnoType<graphic::XGraphic>::get()) @@ -59,20 +59,14 @@ uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType ) aAny <<= uno::Reference< awt::XBitmap >( this ); else if( rType == cppu::UnoType<lang::XUnoTunnel>::get()) aAny <<= uno::Reference< lang::XUnoTunnel >(this); + else if( rType == cppu::UnoType<graphic::XGraphicTransformer>::get()) + aAny <<= uno::Reference< graphic::XGraphicTransformer >(this); else - aAny = ::unographic::GraphicDescriptor::queryAggregation( rType ); + aAny = ::unographic::GraphicDescriptor::queryInterface( rType ); return aAny; } -uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType ) -{ - css::uno::Any aReturn = ::unographic::GraphicDescriptor::queryInterface( rType ); - if ( !aReturn.hasValue() ) - aReturn = ::cppu::queryInterface ( rType, static_cast< graphic::XGraphicTransformer*>( this ) ); - return aReturn; -} - void SAL_CALL Graphic::acquire() noexcept { diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx index b9daeeab6b61..40f205bfdb64 100644 --- a/vcl/source/graphic/UnoGraphicDescriptor.cxx +++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx @@ -157,7 +157,7 @@ void GraphicDescriptor::implCreate( SvStream& rIStm, const OUString* pURL ) } -uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) +uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) { uno::Any aAny; @@ -172,29 +172,23 @@ uno::Any SAL_CALL GraphicDescriptor::queryAggregation( const uno::Type & rType ) else if( rType == cppu::UnoType<beans::XMultiPropertySet>::get()) aAny <<= uno::Reference< beans::XMultiPropertySet >(this); else - aAny = OWeakAggObject::queryAggregation( rType ); + aAny = OWeakObject::queryInterface( rType ); return aAny; } -uno::Any SAL_CALL GraphicDescriptor::queryInterface( const uno::Type & rType ) -{ - return OWeakAggObject::queryInterface( rType ); -} - - void SAL_CALL GraphicDescriptor::acquire() noexcept { - OWeakAggObject::acquire(); + OWeakObject::acquire(); } void SAL_CALL GraphicDescriptor::release() noexcept { - OWeakAggObject::release(); + OWeakObject::release(); } |