From a6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Wed, 25 Apr 2018 23:45:22 +0900 Subject: [API CHANGE] deprecate and revert GraphicURL prop. NumberingLevel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tomaž Vajngerl --- editeng/source/uno/unonrule.cxx | 17 ++++++++++++++++- offapi/com/sun/star/text/NumberingLevel.idl | 13 ++++++++++++- sw/inc/unoprnms.hxx | 1 + sw/source/core/unocore/unosett.cxx | 29 ++++++++++++++++++++++++++++- 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 #include #include +#include #include #include @@ -352,10 +353,24 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex(const Sequence>= 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 xBitmap; - if(aVal >>= xBitmap) + if (aVal >>= xBitmap) { uno::Reference 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

This is only valid if the numbering type is com::sun::star::style::NumberingType::BITMAP.

+ + @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. + +

This is only valid if the numbering type is + com::sun::star::style::NumberingType::BITMAP.

*/ [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 #include #include +#include #include #include #include @@ -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)) -- cgit