From bf5499c600e78e6197f4852d6cbe91ba1e703dc1 Mon Sep 17 00:00:00 2001 From: Szymon Kłos Date: Thu, 28 Nov 2019 10:50:32 +0100 Subject: jsdialog: dump Sfx_Int__Items to JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6a1d2847251b90f86457b552e5354f5e179e1627 Reviewed-on: https://gerrit.libreoffice.org/83977 Tested-by: Jenkins Reviewed-by: Szymon Kłos --- include/svl/intitem.hxx | 3 +++ svl/source/items/intitem.cxx | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/svl/intitem.hxx b/include/svl/intitem.hxx index 8ecf53fadb08..c43add2013d7 100644 --- a/include/svl/intitem.hxx +++ b/include/svl/intitem.hxx @@ -90,6 +90,7 @@ public: { return new SfxUInt16Item(*this); } void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; }; @@ -105,6 +106,7 @@ public: { return new SfxInt32Item(*this); } void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; }; @@ -120,6 +122,7 @@ public: { return new SfxUInt32Item(*this); } void dumpAsXml(xmlTextWriterPtr pWriter) const override; + virtual boost::property_tree::ptree dumpAsJSON() const override; }; #endif // INCLUDED_SVL_INTITEM_HXX diff --git a/svl/source/items/intitem.cxx b/svl/source/items/intitem.cxx index f4016097637f..6bf9b2ef8300 100644 --- a/svl/source/items/intitem.cxx +++ b/svl/source/items/intitem.cxx @@ -107,6 +107,13 @@ void SfxUInt16Item::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } +boost::property_tree::ptree SfxUInt16Item::dumpAsJSON() const +{ + boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON(); + aTree.put("state", GetValue()); + return aTree; +} + // class SfxInt32Item @@ -124,6 +131,13 @@ void SfxInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } +boost::property_tree::ptree SfxInt32Item::dumpAsJSON() const +{ + boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON(); + aTree.put("state", GetValue()); + return aTree; +} + // class SfxUInt32Item @@ -141,6 +155,12 @@ void SfxUInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } +boost::property_tree::ptree SfxUInt32Item::dumpAsJSON() const +{ + boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON(); + aTree.put("state", GetValue()); + return aTree; +} SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue): SfxInt32Item(which, nValue) -- cgit v1.2.3