[Libreoffice-commits] core.git: include/svx svx/source

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 28 08:28:35 UTC 2019


 include/svx/xfillit0.hxx     |    1 +
 svx/source/xoutdev/xattr.cxx |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

New commits:
commit 5bc3ef9b93cfa2372ec5553affb14741db50bb2d
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Nov 22 12:57:00 2019 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Nov 28 09:27:56 2019 +0100

    jsdialogs: dumpAsJSON for FillStyle
    
    Change-Id: I0dc130c295b416b5b9e3071a0ec81dae0ce851fb
    Reviewed-on: https://gerrit.libreoffice.org/83876
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/svx/xfillit0.hxx b/include/svx/xfillit0.hxx
index a1772092f991..e0855dfb7c56 100644
--- a/include/svx/xfillit0.hxx
+++ b/include/svx/xfillit0.hxx
@@ -48,6 +48,7 @@ public:
     virtual sal_uInt16          GetValueCount() const override;
 
     void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+    virtual boost::property_tree::ptree dumpAsJSON() const override;
 };
 
 #endif
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index e443ce84cd26..48eb70474e28 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1834,6 +1834,40 @@ void XFillStyleItem::dumpAsXml(xmlTextWriterPtr pWriter) const
     xmlTextWriterEndElement(pWriter);
 }
 
+boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
+{
+    boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
+
+    if (Which() == XATTR_FILLSTYLE)
+        aTree.put("which", ".uno:FillStyle");
+
+    OUString sValue;
+
+    switch( GetValue() )
+    {
+        case drawing::FillStyle_NONE:
+            sValue = "NONE";
+            break;
+        case drawing::FillStyle_SOLID:
+            sValue = "SOLID";
+            break;
+        case drawing::FillStyle_GRADIENT:
+            sValue = "GRADIENT";
+            break;
+        case drawing::FillStyle_HATCH:
+            sValue = "HATCH";
+            break;
+        case drawing::FillStyle_BITMAP:
+            sValue = "BITMAP";
+            break;
+        default: break;
+    }
+
+    aTree.put("data", sValue);
+
+    return aTree;
+}
+
 
 SfxPoolItem* XFillColorItem::CreateDefault() { return new XFillColorItem; }
 


More information about the Libreoffice-commits mailing list