include/editeng/unoprnms.hxx | 1 include/svx/unoshprp.hxx | 1 offapi/com/sun/star/drawing/FillProperties.idl | 8 +++++ svx/source/xoutdev/xattrbmp.cxx | 37 ++++++++++++++++++++----- sw/inc/unoprnms.hxx | 1 sw/source/core/unocore/unomapproperties.hxx | 1 6 files changed, 43 insertions(+), 6 deletions(-)
New commits: commit dfdc165a48d711b867961d1f75ee36a1c9596dc0 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Apr 25 19:36:21 2018 +0900 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 <c...@libreoffice.org> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx index 5e56fdd5d2d1..d90be0f6b45d 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -35,6 +35,7 @@ #define UNO_NAME_FILLHATCH "FillHatch" #define UNO_NAME_FILLHATCHNAME "FillHatchName" #define UNO_NAME_FILLBITMAP "FillBitmap" +#define UNO_NAME_FILLBITMAPURL "FillBitmapURL" #define UNO_NAME_FILLBITMAPNAME "FillBitmapName" #define UNO_NAME_FILLGRADIENTSTEPCOUNT "FillGradientStepCount" #define UNO_NAME_FILLBACKGROUND "FillBackground" diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx index 56050252fd58..1794f1d9d96d 100644 --- a/include/svx/unoshprp.hxx +++ b/include/svx/unoshprp.hxx @@ -258,6 +258,7 @@ FILL_PROPERTIES_DEFAULTS \ { OUString(UNO_NAME_FILLBACKGROUND), XATTR_FILLBACKGROUND , cppu::UnoType<bool>::get(), 0, 0}, \ { OUString(UNO_NAME_FILLBITMAP), XATTR_FILLBITMAP , cppu::UnoType<css::awt::XBitmap>::get() , 0, MID_BITMAP}, \ + { OUString(UNO_NAME_FILLBITMAPURL), XATTR_FILLBITMAP , cppu::UnoType<OUString>::get(), 0, MID_BITMAP }, \ { OUString(UNO_NAME_FILLBITMAPNAME), XATTR_FILLBITMAP , ::cppu::UnoType<OUString>::get(), 0, MID_NAME }, \ { OUString(UNO_NAME_FILLGRADIENTSTEPCOUNT), XATTR_GRADIENTSTEPCOUNT , ::cppu::UnoType<sal_Int16>::get(), 0, 0}, \ { OUString(UNO_NAME_FILLGRADIENT), XATTR_FILLGRADIENT , ::cppu::UnoType<css::awt::Gradient>::get(), 0, MID_FILLGRADIENT}, \ diff --git a/offapi/com/sun/star/drawing/FillProperties.idl b/offapi/com/sun/star/drawing/FillProperties.idl index 8897a826a07a..a1fdbf41189f 100644 --- a/offapi/com/sun/star/drawing/FillProperties.idl +++ b/offapi/com/sun/star/drawing/FillProperties.idl @@ -104,6 +104,14 @@ published service FillProperties /** If the property #FillStyle is set to FillStyle::BITMAP, this is a URL to the bitmap used. + + @deprecated as of LibreOffice 6.1, use FillBitmap + + Note the new behaviour since it this was deprecated: + This property can only be set and only external URLs are + supported (no more vnd.sun.star.GraphicObject scheme). When a + URL is set, then it will load the bitmap and set the FillBitmap + property. */ [optional, property] string FillBitmapURL; 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()) { diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index c314a4a021d4..9ef136eccd26 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -606,6 +606,7 @@ #define UNO_NAME_SW_FILLCOLOR UNO_NAME_FILLCOLOR #define UNO_NAME_SW_FILLBACKGROUND UNO_NAME_FILLBACKGROUND #define UNO_NAME_SW_FILLBITMAP UNO_NAME_FILLBITMAP +#define UNO_NAME_SW_FILLBITMAPURL UNO_NAME_FILLBITMAPURL #define UNO_NAME_SW_FILLBITMAPNAME UNO_NAME_FILLBITMAPNAME #define UNO_NAME_SW_FILLGRADIENTSTEPCOUNT UNO_NAME_FILLGRADIENTSTEPCOUNT #define UNO_NAME_SW_FILLGRADIENT UNO_NAME_FILLGRADIENT diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 1c2cf138a03b..f5d422b43efc 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -500,6 +500,7 @@ FILL_PROPERTIES_SW_DEFAULTS \ { OUString(UNO_NAME_SW_FILLBACKGROUND), XATTR_FILLBACKGROUND, cppu::UnoType<bool>::get(), 0, 0}, \ { OUString(UNO_NAME_SW_FILLBITMAP), XATTR_FILLBITMAP, cppu::UnoType<css::awt::XBitmap>::get(), 0, MID_BITMAP}, \ + { OUString(UNO_NAME_SW_FILLBITMAPURL), XATTR_FILLBITMAP, cppu::UnoType<OUString>::get(), 0, MID_BITMAP }, \ { OUString(UNO_NAME_SW_FILLBITMAPNAME), XATTR_FILLBITMAP, cppu::UnoType<OUString>::get(), 0, MID_NAME }, \ { OUString(UNO_NAME_SW_FILLGRADIENTSTEPCOUNT), XATTR_GRADIENTSTEPCOUNT, cppu::UnoType<sal_Int16>::get(), 0, 0}, \ { OUString(UNO_NAME_SW_FILLGRADIENT), XATTR_FILLGRADIENT, cppu::UnoType<css::awt::Gradient>::get(), 0, MID_FILLGRADIENT}, \ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits