diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-04-25 19:36:21 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-04-27 11:17:19 +0200 |
commit | dfdc165a48d711b867961d1f75ee36a1c9596dc0 (patch) | |
tree | 1c8918f0f4e9aab009334d0d64a29c3debffa767 /svx | |
parent | 406d5fd8135c75653a7d420ce61f63968675baf9 (diff) |
restore and deprecate FillBitmapURL
FillBitmapURL was restored so when setting the property, it loads
the Bitmap from the provided URL and creates a XBitmap. Get is
not supported anymore however.
Change-Id: Ie250d9f751ba33fc45b759dd3a773b4ec5c864d3
Reviewed-on: https://gerrit.libreoffice.org/53443
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/xoutdev/xattrbmp.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx index bad890bdc1a5..c4328daef724 100644 --- a/svx/source/xoutdev/xattrbmp.cxx +++ b/svx/source/xoutdev/xattrbmp.cxx @@ -38,6 +38,7 @@ #include <vcl/salbtype.hxx> #include <vcl/bitmapaccess.hxx> #include <vcl/BitmapTools.hxx> +#include <vcl/GraphicLoader.hxx> #include <vcl/dibtools.hxx> #include <libxml/xmlwriter.h> @@ -262,8 +263,8 @@ bool XFillBitmapItem::QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId) const aInternalName = GetName(); } - if( nMemberId == MID_BITMAP || - nMemberId == 0 ) + if (nMemberId == MID_BITMAP || + nMemberId == 0) { xBmp.set(GetGraphicObject().GetGraphic().GetXGraphic(), uno::UNO_QUERY); } @@ -294,9 +295,11 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) nMemberId &= ~CONVERT_TWIPS; OUString aName; + OUString aURL; css::uno::Reference< css::awt::XBitmap > xBmp; css::uno::Reference< css::graphic::XGraphic > xGraphic; + bool bSetURL = false; bool bSetName = false; bool bSetBitmap = false; @@ -304,9 +307,21 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) bSetName = (rVal >>= aName); else if( nMemberId == MID_BITMAP ) { - bSetBitmap = (rVal >>= xBmp); - if ( !bSetBitmap ) - bSetBitmap = (rVal >>= xGraphic ); + if (rVal.has<OUString>()) + { + bSetURL = true; + aURL = rVal.get<OUString>(); + } + else if (rVal.has<uno::Reference<awt::XBitmap>>()) + { + bSetBitmap = true; + xBmp = rVal.get<uno::Reference<awt::XBitmap>>(); + } + else if (rVal.has<uno::Reference<graphic::XGraphic>>()) + { + bSetBitmap = true; + xGraphic = rVal.get<uno::Reference<graphic::XGraphic>>(); + } } else { @@ -320,6 +335,8 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) bSetName = (aPropSeq[n].Value >>= aName); else if ( aPropSeq[n].Name == "Bitmap" ) bSetBitmap = (aPropSeq[n].Value >>= xBmp); + else if ( aPropSeq[n].Name == "FillBitmapURL" ) + bSetURL = (aPropSeq[n].Value >>= aURL); } } } @@ -328,7 +345,15 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) { SetName( aName ); } - if( bSetBitmap ) + if (bSetURL && !aURL.isEmpty()) + { + Graphic aGraphic = vcl::graphic::loadFromURL(aURL); + if (aGraphic) + { + maGraphicObject.SetGraphic(aGraphic.GetXGraphic()); + } + } + else if( bSetBitmap ) { if (xBmp.is()) { |