diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-08-26 17:54:50 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-08-26 19:21:06 +0200 |
commit | 3341986547b69bcb4c38e4ccb2f0853a3a569bb5 (patch) | |
tree | c27f228f983fbe00a4e09c410bd44dee6eb29652 /toolkit/source/controls | |
parent | 568eea45de027c418bffdb8b9886fe38f9de8d8f (diff) |
tdf#93998 toolkit: restore support for setting dialog background from shape
Regression from commit fb29e6eeeaad5255bb924ff59162a83ed80bfb0a (svx:
removing GraphicURL and OWN_ATTR_GRAFURL, fix writerfilter, 2018-03-08),
the problem was that an in-document macro tried to assign a bitmap shape
to a dialog background, which broke during the image handling rework.
Note that in this case the actual type of the "URL" is not interesting,
we can just return an XGraphic and then take it on the other side as
well, without re-introducing the intentionally removed graphic URLs
which point to memory addresses.
This also made it necessary to extend
UnoDialogControl::ImplModelPropertiesChanged(), so that in case a
graphic is assigned to the dialog model, then the dialog model -> dialog
sync code doesn't just copy over the empty image URL string. With this,
finally clicking on the button of the bugdoc makes the dialog show up
with the correct background.
Change-Id: Id78269643289efb435b96a6a0b9f8a93fa49ec04
Reviewed-on: https://gerrit.libreoffice.org/78153
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'toolkit/source/controls')
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index e67f33bef885..fa5a4a17efaa 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -278,8 +278,18 @@ void SAL_CALL UnoControlDialogModel::setFastPropertyValue_NoBroadcast( sal_Int32 if ( nHandle == BASEPROPERTY_IMAGEURL && ImplHasProperty( BASEPROPERTY_GRAPHIC ) ) { OUString sImageURL; - OSL_VERIFY( rValue >>= sImageURL ); - setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( mxGrfObj, sImageURL ) ) ); + uno::Reference<graphic::XGraphic> xGraphic; + if (rValue >>= sImageURL) + { + setPropertyValue( + GetPropertyName(BASEPROPERTY_GRAPHIC), + uno::makeAny(ImageHelper::getGraphicAndGraphicObjectFromURL_nothrow( + mxGrfObj, sImageURL))); + } + else if (rValue >>= xGraphic) + { + setPropertyValue("Graphic", uno::makeAny(xGraphic)); + } } } catch( const css::uno::Exception& ) @@ -616,7 +626,7 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang { Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY ); bool bOwnModel = xModel.get() == getModel().get(); - if ( bOwnModel && rEvt.PropertyName == "ImageURL" ) + if (bOwnModel && rEvt.PropertyName == "ImageURL" && !ImplHasProperty(BASEPROPERTY_GRAPHIC)) { OUString aImageURL; Reference< graphic::XGraphic > xGraphic; @@ -629,6 +639,15 @@ void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChang ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), true ); break; } + else if (bOwnModel && rEvt.PropertyName == "Graphic") + { + uno::Reference<graphic::XGraphic> xGraphic; + if (ImplGetPropertyValue("Graphic") >>= xGraphic) + { + ImplSetPropertyValue("Graphic", uno::makeAny(xGraphic), true); + } + break; + } } ControlContainerBase::ImplModelPropertiesChanged(rEvents); } |