[Libreoffice-commits] core.git: 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  |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

New commits:
commit b6295e4a1b7735c148174f44f6d28221f4f52302
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:33 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/+/86499
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx
index 65b44d7efc11..98738d814a7e 100644
--- a/include/sfx2/sidebar/Deck.hxx
+++ b/include/sfx2/sidebar/Deck.hxx
@@ -66,6 +66,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 a015b0db2bd6..563f1e229a60 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -36,7 +36,9 @@
 #include <vcl/scrbar.hxx>
 #include <vcl/commandevent.hxx>
 #include <vcl/IDialogRenderable.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
 #include <tools/svborder.hxx>
+#include <boost/property_tree/ptree.hpp>
 #include <sal/log.hxx>
 
 using namespace css;
@@ -189,6 +191,42 @@ void Deck::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