Kaydet (Commit) dfdc165a authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

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/53443Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 406d5fd8
......@@ -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"
......
......@@ -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}, \
......
......@@ -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;
......
......@@ -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())
{
......
......@@ -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
......
......@@ -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}, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment