[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/sfx2 sfx2/source

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 9 22:31:15 UTC 2020


 include/sfx2/sidebar/Deck.hxx |    2 ++
 sfx2/source/sidebar/Deck.cxx  |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

New commits:
commit c6c92d01e6f6d8a962c9f452e8fb32cb3e3a41b1
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jan 9 16:43:11 2020 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jan 9 23:30:43 2020 +0100

    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 at gmail.com>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index 4c9558a1966b..23540f017172 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -68,6 +68,8 @@ public:
     virtual bool EventNotify(NotifyEvent& rEvent) override;
     virtual void Resize() override;
 
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
+
     static void PrintWindowSubTree (vcl::Window* pRoot, int nIndentation);
 
     sal_Int32 GetMinimalWidth() const { return mnMinimalWidth; }
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)


More information about the Libreoffice-commits mailing list