summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-01-09 16:43:11 +0000
committerMichael Meeks <michael.meeks@collabora.com>2020-01-09 23:30:43 +0100
commitc6c92d01e6f6d8a962c9f452e8fb32cb3e3a41b1 (patch)
treefbef22e34040675dae7e7c48b407461f870b902a /sfx2
parent02b9ea64850f33df7b3c89c24a2cafbaeab0f85b (diff)
lok: simplify jsdialog creation for sidebar panels.
Remove some layers of nested and/or un-necessary content, also simplifies client-side JS. Change-Id: I67347035ceb9dbee9c62c99624b5084883d4e61a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86498 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/Deck.cxx37
1 files changed, 37 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 60ea6b71ebba..6def9683727e 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -36,6 +36,7 @@
#include <vcl/scrbar.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/IDialogRenderable.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
#include <tools/svborder.hxx>
#include <sal/log.hxx>
@@ -180,6 +181,42 @@ void Deck::Resize()
Window::Resize();
}
+/*
+ * Get the ordering as is shown in the layout, and our type as 'deck'
+ * also elide nested panel windows.
+ */
+boost::property_tree::ptree Deck::DumpAsPropertyTree()
+{
+ boost::property_tree::ptree aTree;
+ aTree.put("id", get_id()); // TODO could be missing - sort out
+ aTree.put("type", "deck");
+ aTree.put("text", GetText());
+ aTree.put("enabled", IsEnabled());
+
+ boost::property_tree::ptree aChildren;
+ for (auto &it : maPanels)
+ {
+ if (it->IsLurking())
+ continue;
+
+ // collapse the panel itself out
+ auto xContent = it->GetElementWindow();
+ if (!xContent.is())
+ continue;
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContent);
+ if (!pWindow)
+ continue;
+
+ boost::property_tree::ptree aChild = pWindow->DumpAsPropertyTree();
+ aChild.put("text", it->GetText());
+ aChild.put("type", "panel");
+ aChildren.push_back(std::make_pair("", aChild));
+ }
+
+ aTree.add_child("children", aChildren);
+ return aTree;
+}
+
bool Deck::ProcessWheelEvent(CommandEvent const * pCommandEvent)
{
if ( ! mpVerticalScrollBar)