[Libreoffice-commits] core.git: editeng/source offapi/com sw/inc sw/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sat Apr 28 01:32:24 UTC 2018


 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(-)

New commits:
commit a6a38c6de9c18fd1269fc8cfc0e070ef429c8e2f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Wed Apr 25 23:45:22 2018 +0900

    [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 at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

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))


More information about the Libreoffice-commits mailing list