summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-25 23:45:22 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-04-28 03:31:59 +0200
commita6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f (patch)
treef1ad4d49dff3cb9eb0121389999030841409a7e0
parente71d05eaa9a8c9e628b256f3e889b85ac11ed474 (diff)
[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>
-rw-r--r--editeng/source/uno/unonrule.cxx17
-rw-r--r--offapi/com/sun/star/text/NumberingLevel.idl13
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/source/core/unocore/unosett.cxx29
4 files changed, 57 insertions, 3 deletions
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 7f97607c1f99..3acef998e3d1 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -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);
diff --git a/offapi/com/sun/star/text/NumberingLevel.idl b/offapi/com/sun/star/text/NumberingLevel.idl
index 1fc2865080a0..92a08931a147 100644
--- a/offapi/com/sun/star/text/NumberingLevel.idl
+++ b/offapi/com/sun/star/text/NumberingLevel.idl
@@ -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;
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 9ef136eccd26..960a73e19c24 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -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"
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 3825caeb1951..a283a7954e7d 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -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))