summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-06-22 16:45:03 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-06-25 10:16:37 +0200
commit01e37e3e5626551b6e8d261e357afcea1ba7c758 (patch)
treebbd1bd5402b07c44747d7962a9db48f9c04c1de0 /svx
parente318d5d8146d18e2c76e23f2e3c39527f2af9f36 (diff)
use tools::JsonWriter for dumping property tree
Change-Id: I8f55af19ba10b71bd621e69b27000ab7cb565309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96677 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.cxx4
-rw-r--r--svx/source/sidebar/possize/PosSizePropertyPanel.hxx2
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx5
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx73
-rw-r--r--svx/source/tbxctrls/tbunocontroller.cxx38
5 files changed, 57 insertions, 65 deletions
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 248675f7ee1f..322e6700ad80 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -853,14 +853,14 @@ void PosSizePropertyPanel::executeSize()
}
}
-boost::property_tree::ptree PosSizePropertyPanel::DumpAsPropertyTree()
+void PosSizePropertyPanel::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
{
if (meDlgUnit != GetCurrentUnit(SfxItemState::DEFAULT, nullptr))
{
mpBindings->Update( SID_ATTR_METRIC );
}
- return PanelLayout::DumpAsPropertyTree();
+ PanelLayout::DumpAsPropertyTree(rJsonWriter);
}
void PosSizePropertyPanel::MetricState( SfxItemState eState, const SfxPoolItem* pState )
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
index 8abd1e0c86bb..a35c8a425878 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.hxx
@@ -66,7 +66,7 @@ public:
const SfxItemState eState,
const SfxPoolItem* pState) override;
- virtual boost::property_tree::ptree DumpAsPropertyTree() override;
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
SfxBindings* GetBindings() { return mpBindings;}
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 3d91e5cb823c..fcdd67efbe38 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -26,6 +26,7 @@
#include <vcl/settings.hxx>
#include <vcl/toolbox.hxx>
#include <svx/svxids.hrc>
+#include <tools/json_writer.hxx>
#define TMP_STR_BEGIN "["
#define TMP_STR_END "]"
@@ -579,9 +580,9 @@ FillControl::FillControl(vcl::Window* pParent, const css::uno::Reference<css::fr
SetOptimalSize();
}
-IMPL_STATIC_LINK(FillControl, DumpAsPropertyTreeHdl, boost::property_tree::ptree&, rTree, void)
+IMPL_STATIC_LINK(FillControl, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
- rTree.put("command", ".uno:FillStyle");
+ rJsonWriter.put("command", ".uno:FillStyle");
}
void FillControl::ReleaseFocus_Impl()
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 732ad7d9f835..d8e0e6d90991 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -98,9 +98,9 @@
#include <bitmaps.hlst>
#include <sal/log.hxx>
#include <unotools/collatorwrapper.hxx>
-#include <boost/property_tree/ptree.hpp>
#include <comphelper/lok.hxx>
+#include <tools/json_writer.hxx>
#define MAX_MRU_FONTNAME_ENTRIES 5
@@ -194,7 +194,7 @@ private:
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(ActivateHdl, weld::ComboBox&, bool);
DECL_LINK(FocusOutHdl, weld::Widget&, void);
- DECL_LINK(DumpAsPropertyTreeHdl, boost::property_tree::ptree&, void);
+ DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
DECL_LINK(CustomRenderHdl, weld::ComboBox::render_args, void);
DECL_LINK(CustomGetSizeHdl, OutputDevice&, Size);
@@ -366,7 +366,7 @@ public:
DECL_LINK(ActivateHdl, weld::ComboBox&, bool);
DECL_LINK(FocusInHdl, weld::Widget&, void);
DECL_LINK(FocusOutHdl, weld::Widget&, void);
- DECL_LINK(DumpAsPropertyTreeHdl, boost::property_tree::ptree&, void);
+ DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
};
class SvxFontNameBox_Impl final : public InterimItemWindow
@@ -1342,33 +1342,30 @@ Color SvxStyleBox_Base::TestColorsVisible(const Color &FontCol, const Color &Bac
return retCol;
}
-IMPL_LINK(SvxStyleBox_Base, DumpAsPropertyTreeHdl, boost::property_tree::ptree&, rTree, void)
+IMPL_LINK(SvxStyleBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
- boost::property_tree::ptree aEntries;
-
- for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", m_xWidget->get_text(i));
- aEntries.push_back(std::make_pair("", aEntry));
+ auto entriesNode = rJsonWriter.startNode("entries");
+ for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", m_xWidget->get_text(i));
+ }
}
- rTree.add_child("entries", aEntries);
-
- boost::property_tree::ptree aSelected;
-
int nActive = m_xWidget->get_active();
+ rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nActive == -1 ? 0 : 1));
- if (nActive != -1)
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", nActive);
- aSelected.push_back(std::make_pair("", aEntry));
+ auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ if (nActive != -1)
+ {
+ auto node = rJsonWriter.startNode("");
+ rJsonWriter.put("", static_cast<sal_Int32>(nActive));
+ }
}
- rTree.put("selectedCount", nActive == -1 ? 0 : 1);
- rTree.add_child("selectedEntries", aSelected);
- rTree.put("command", ".uno:StyleApply");
+ rJsonWriter.put("command", ".uno:StyleApply");
}
static bool lcl_GetDocFontList(const FontList** ppFontList, SvxFontNameBox_Base* pBox)
@@ -1711,32 +1708,30 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect)
}
}
-IMPL_LINK(SvxFontNameBox_Base, DumpAsPropertyTreeHdl, boost::property_tree::ptree&, rTree, void)
+IMPL_LINK(SvxFontNameBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
- boost::property_tree::ptree aEntries;
-
- for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", m_xWidget->get_text(i));
- aEntries.push_back(std::make_pair("", aEntry));
+ auto entriesNode = rJsonWriter.startNode("entries");
+ for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", m_xWidget->get_text(i));
+ }
}
- rTree.add_child("entries", aEntries);
-
- boost::property_tree::ptree aSelected;
-
int nSelectedEntry = m_xWidget->get_active();
- if (nSelectedEntry != -1)
+ rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nSelectedEntry == -1 ? 0 : 1));
+
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", m_xWidget->get_text(nSelectedEntry));
- aSelected.push_back(std::make_pair("", aEntry));
+ auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ if (nSelectedEntry != -1)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", m_xWidget->get_text(nSelectedEntry));
+ }
}
- rTree.put("selectedCount", nSelectedEntry == -1 ? 0 : 1);
- rTree.add_child("selectedEntries", aSelected);
- rTree.put("command", ".uno:CharFontName");
+ rJsonWriter.put("command", ".uno:CharFontName");
}
ColorWindow::ColorWindow(const OUString& rCommand,
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx
index 8e42177bfd79..f1d1db4522ee 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -34,6 +34,7 @@
#include <svtools/ctrltool.hxx>
#include <svtools/ctrlbox.hxx>
#include <svtools/toolboxcontroller.hxx>
+#include <tools/json_writer.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -41,7 +42,6 @@
#include <vcl/InterimItemWindow.hxx>
#include <sfx2/sidebar/SidebarToolBox.hxx>
-#include <boost/property_tree/ptree.hpp>
using namespace ::com::sun::star;
@@ -125,7 +125,7 @@ protected:
DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
DECL_LINK(ActivateHdl, weld::ComboBox&, bool);
DECL_LINK(FocusOutHdl, weld::Widget&, void);
- DECL_LINK(DumpAsPropertyTreeHdl, boost::property_tree::ptree&, void);
+ DECL_LINK(DumpAsPropertyTreeHdl, tools::JsonWriter&, void);
};
class SvxFontSizeBox_Impl final : public InterimItemWindow
@@ -337,33 +337,29 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
}
}
-IMPL_LINK(SvxFontSizeBox_Base, DumpAsPropertyTreeHdl, boost::property_tree::ptree&, rTree, void)
+IMPL_LINK(SvxFontSizeBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
- boost::property_tree::ptree aEntries;
-
- for (int i = 0, nCount = m_xWidget->get_count(); i < nCount; ++i)
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", m_xWidget->get_text(i));
- aEntries.push_back(std::make_pair("", aEntry));
+ auto entriesNode = rJsonWriter.startNode("entries");
+ for (int i = 0, nCount = m_xWidget->get_count(); i < nCount; ++i)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", m_xWidget->get_text(i));
+ }
}
- rTree.add_child("entries", aEntries);
-
- boost::property_tree::ptree aSelected;
-
int nActive = m_xWidget->get_active();
- if (nActive != -1)
+ rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nActive == -1 ? 0 : 1));
{
- boost::property_tree::ptree aEntry;
- aEntry.put("", nActive);
- aSelected.push_back(std::make_pair("", aEntry));
+ auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ if (nActive != -1)
+ {
+ auto node = rJsonWriter.startNode("");
+ rJsonWriter.put("", static_cast<sal_Int32>(nActive));
+ }
}
- rTree.put("selectedCount", nActive == -1 ? 0 : 1);
- rTree.add_child("selectedEntries", aSelected);
-
- rTree.put("command", ".uno:FontHeight");
+ rJsonWriter.put("command", ".uno:FontHeight");
}
FontHeightToolBoxControl::FontHeightToolBoxControl( const uno::Reference< uno::XComponentContext >& rxContext )