diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-22 16:45:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-06-25 10:16:37 +0200 |
commit | 01e37e3e5626551b6e8d261e357afcea1ba7c758 (patch) | |
tree | bbd1bd5402b07c44747d7962a9db48f9c04c1de0 /vcl/source/window/toolbox2.cxx | |
parent | e318d5d8146d18e2c76e23f2e3c39527f2af9f36 (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 'vcl/source/window/toolbox2.cxx')
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 3d1bcd7d1739..6ee94e7b0ae5 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -39,6 +39,7 @@ #include <toolbox.h> #include <unotools/confignode.hxx> +#include <tools/json_writer.hxx> using namespace vcl; @@ -1745,34 +1746,25 @@ void ToolBox::WillUsePopupMode( bool b ) mpData->mbWillUsePopupMode = b; } -boost::property_tree::ptree ToolBox::DumpAsPropertyTree() +void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { - boost::property_tree::ptree aTree(DockingWindow::DumpAsPropertyTree()); - boost::property_tree::ptree aChildren; + DockingWindow::DumpAsPropertyTree(rJsonWriter); - boost::property_tree::ptree::const_assoc_iterator found = aTree.find("children"); - if (found == aTree.not_found()) + auto childrenNode = rJsonWriter.startNode("children"); + for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i) { - for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i) + ToolBoxItemType type = GetItemType(i); + if (type == ToolBoxItemType::BUTTON) { - ToolBoxItemType type = GetItemType(i); - if (type == ToolBoxItemType::BUTTON) - { - boost::property_tree::ptree aEntry; - int nId = GetItemId(i); - if (!IsItemVisible(nId)) - continue; - aEntry.put("type", "toolitem"); - aEntry.put("text", GetItemText(nId)); - aEntry.put("command", GetItemCommand(nId)); - aChildren.push_back(std::make_pair("", aEntry)); - } + auto childNode = rJsonWriter.startNode(""); + int nId = GetItemId(i); + if (!IsItemVisible(nId)) + continue; + rJsonWriter.put("type", "toolitem"); + rJsonWriter.put("text", GetItemText(nId)); + rJsonWriter.put("command", GetItemCommand(nId)); } - - aTree.add_child("children", aChildren); } - - return aTree; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |