[API CHANGE] deprecate and revert GraphicURL prop. NumberingLevel

This deprecates the GraphicURL properties for NumberingLevel used
for bullet graphic. It also makes the proeprty work again, but
only setting it is supported.

Change-Id: I7727918677514b4846fd271ba606a0255bf9fe1b
Reviewed-on: https://gerrit.libreoffice.org/53458
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
Tomaž Vajngerl
2018-04-25 23:45:22 +09:00
committed by Tomaž Vajngerl
parent e71d05eaa9
commit a6a38c6de9
4 changed files with 57 additions and 3 deletions

View File

@@ -27,6 +27,7 @@
#include <vcl/svapp.hxx>
#include <vcl/graph.hxx>
#include <vcl/GraphicObject.hxx>
#include <vcl/GraphicLoader.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/unoprnms.hxx>
@@ -352,10 +353,24 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence<beans::Propert
continue;
}
}
else if ( rPropName == "GraphicURL" )
{
OUString aURL;
if (aVal >>= aURL)
{
Graphic aGraphic = vcl::graphic::loadFromURL(aURL);
if (aGraphic)
{
SvxBrushItem aBrushItem(aGraphic, GPOS_AREA, SID_ATTR_BRUSH);
aFmt.SetGraphicBrush(&aBrushItem);
}
continue;
}
}
else if ( rPropName == "GraphicBitmap" )
{
uno::Reference<awt::XBitmap> xBitmap;
if(aVal >>= xBitmap)
if (aVal >>= xBitmap)
{
uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
Graphic aGraphic(xGraphic);

View File

@@ -88,11 +88,22 @@ published service NumberingLevel
<p> This is only valid if the numbering type is
com::sun::star::style::NumberingType::BITMAP.</p>
@deprecated as of LibreOffice 6.1, use GraphicBitmap
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 an
URL is set, then it will load the bitmap and set the GraphicBitmap
property.
*/
[property] string GraphicURL;
/** the bitmap containing the bullet.
/** the graphic file that is used as the numbering symbol.
<p> This is only valid if the numbering type is
com::sun::star::style::NumberingType::BITMAP.</p>
*/
[optional, property] com::sun::star::awt::XBitmap GraphicBitmap;

View File

@@ -38,6 +38,7 @@
#define UNO_NAME_GRAPHIC_FILTER "GraphicFilter"
#define UNO_NAME_GRAPHIC_SIZE "GraphicSize"
#define UNO_NAME_GRAPHIC_BITMAP "GraphicBitmap"
#define UNO_NAME_GRAPHIC_URL "GraphicURL"
#define UNO_NAME_BULLET_ID "BulletId"
#define UNO_NAME_BULLET_CHAR "BulletChar"
#define UNO_NAME_BULLET_REL_SIZE "BulletRelSize"

View File

@@ -59,6 +59,7 @@
#include <editeng/flstitem.hxx>
#include <vcl/metric.hxx>
#include <vcl/graph.hxx>
#include <vcl/GraphicLoader.hxx>
#include <svtools/ctrltool.hxx>
#include <vcl/svapp.hxx>
#include <editeng/unofdesc.hxx>
@@ -1564,7 +1565,8 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
UNO_NAME_HEADING_STYLE_NAME, // 24
// these two are accepted but ignored for some reason
UNO_NAME_BULLET_REL_SIZE, // 25
UNO_NAME_BULLET_COLOR // 26
UNO_NAME_BULLET_COLOR, // 26
UNO_NAME_GRAPHIC_URL // 27
};
enum {
@@ -1999,6 +2001,31 @@ void SwXNumberingRules::SetPropertiesToNumFormat(
break;
case 26: // BulletColor - ignored too
break;
case 27: // UNO_NAME_GRAPHIC_URL
{
assert( !pDocShell );
OUString aURL;
if (pProp->Value >>= aURL)
{
if(!pSetBrush)
{
const SvxBrushItem* pOrigBrush = aFormat.GetBrush();
if(pOrigBrush)
{
pSetBrush = new SvxBrushItem(*pOrigBrush);
}
else
pSetBrush = new SvxBrushItem(OUString(), OUString(), GPOS_AREA, RES_BACKGROUND);
}
Graphic aGraphic = vcl::graphic::loadFromURL(aURL);
if (aGraphic)
pSetBrush->SetGraphic(aGraphic);
}
else
bWrongArg = true;
}
break;
}
}
if(!bExcept && !bWrongArg && (pSetBrush || pSetSize || pSetVOrient))