diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-09 18:44:28 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2021-01-10 12:24:57 +0100 |
commit | bc8146713bfda2a1c3d0a5f313de79d3f997a6bf (patch) | |
tree | a58c5134742c1fff109c5a59eadd7f7768d00f5a /vcl | |
parent | c5c0f8df855dfd4478c57170e251e4a9bcff1c10 (diff) |
jsdialog: export correct children for toolbox
if toolbox has children it means we have embedded widgets
so don't export notmal 'toolitem' entries
Change-Id: Ia1bd3323cf3606b923a4b30e1147633dcac24a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109036
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 18cd1481d014..4336a0975901 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1731,19 +1731,22 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) { DockingWindow::DumpAsPropertyTree(rJsonWriter); - auto childrenNode = rJsonWriter.startArray("children"); - for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i) + if (!GetChildCount()) { - ToolBoxItemType type = GetItemType(i); - if (type == ToolBoxItemType::BUTTON) + auto childrenNode = rJsonWriter.startArray("children"); + for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i) { - auto childNode = rJsonWriter.startStruct(); - int nId = GetItemId(i); - if (!IsItemVisible(nId)) - continue; - rJsonWriter.put("type", "toolitem"); - rJsonWriter.put("text", GetItemText(nId)); - rJsonWriter.put("command", GetItemCommand(nId)); + ToolBoxItemType type = GetItemType(i); + if (type == ToolBoxItemType::BUTTON) + { + auto childNode = rJsonWriter.startStruct(); + int nId = GetItemId(i); + if (!IsItemVisible(nId)) + continue; + rJsonWriter.put("type", "toolitem"); + rJsonWriter.put("text", GetItemText(nId)); + rJsonWriter.put("command", GetItemCommand(nId)); + } } } } |