include/vcl/toolkit/dialog.hxx       |    2 
 vcl/inc/wizdlg.hxx                   |    2 
 vcl/source/control/roadmapwizard.cxx |   72 +++++++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 1 deletion(-)

New commits:
commit a5e2201643392d0509cb970faf1c1e7038d14f4e
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Fri Mar 3 08:13:58 2023 +0100
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Sat Mar 4 07:07:50 2023 +0000

    jsdialog: correct structure for RoadmapWizard
    
    Signed-off-by: Szymon Kłos <szymon.k...@collabora.com>
    Change-Id: Id9837c208653311608bf39d6066cbf1345efc565
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148214
    Tested-by: Jenkins

diff --git a/include/vcl/toolkit/dialog.hxx b/include/vcl/toolkit/dialog.hxx
index 31326106cbd5..679c0232ea30 100644
--- a/include/vcl/toolkit/dialog.hxx
+++ b/include/vcl/toolkit/dialog.hxx
@@ -101,6 +101,7 @@ protected:
     friend class SalInstanceBuilder;
     void set_action_area(VclButtonBox* pBox);
     void set_content_area(VclBox* pBox);
+    vcl::Window*    GetFirstControlForFocus();
 
 public:
     explicit        Dialog( vcl::Window* pParent, WinBits nStyle = 
WB_STDDIALOG, InitFlag eFlag = InitFlag::Default );
@@ -132,7 +133,6 @@ private:
     static void     ImplEndExecuteModal();
     void            ImplSetModalInputMode(bool bModal);
 
-    vcl::Window*    GetFirstControlForFocus();
 public:
 
     /// Commence execution of a modal dialog, disposes owner on failure
diff --git a/vcl/inc/wizdlg.hxx b/vcl/inc/wizdlg.hxx
index 04f6e88c4acd..1fd0f9bad41e 100644
--- a/vcl/inc/wizdlg.hxx
+++ b/vcl/inc/wizdlg.hxx
@@ -255,6 +255,8 @@ namespace vcl
         DECL_LINK(OnFinish, Button*, void);
 
         void     implConstruct( const WizardButtonFlags _nButtonFlags );
+
+        virtual void     DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) 
override;
     };
 
     /// helper class to temporarily suspend any traveling in the wizard
diff --git a/vcl/source/control/roadmapwizard.cxx 
b/vcl/source/control/roadmapwizard.cxx
index 49c28de9bfe9..0aef0d00527e 100644
--- a/vcl/source/control/roadmapwizard.cxx
+++ b/vcl/source/control/roadmapwizard.cxx
@@ -20,6 +20,7 @@
 
 #include <vcl/toolkit/roadmap.hxx>
 #include <tools/debug.hxx>
+#include <tools/json_writer.hxx>
 #include <osl/diagnose.h>
 
 #include <strings.hrc>
@@ -798,6 +799,77 @@ namespace vcl
         return RoadmapWizardUIObject::create;
     }
 
+    namespace
+    {
+        bool isButton(WindowType eType)
+        {
+            return eType == WindowType::PUSHBUTTON || eType == 
WindowType::OKBUTTON
+                || eType == WindowType::CANCELBUTTON || eType == 
WindowType::HELPBUTTON;
+        }
+    }
+
+    void RoadmapWizard::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+    {
+        rJsonWriter.put("id", get_id());
+        rJsonWriter.put("type", "dialog");
+        rJsonWriter.put("title", GetText());
+
+        OUString sDialogId = OStringToOUString(GetHelpId(), 
RTL_TEXTENCODING_ASCII_US);
+        sal_Int32 nStartPos = sDialogId.lastIndexOf('/');
+        nStartPos = nStartPos >= 0 ? nStartPos + 1 : 0;
+        rJsonWriter.put("dialogid", sDialogId.copy(nStartPos));
+
+        vcl::Window* pFocusControl = GetFirstControlForFocus();
+        if (pFocusControl)
+            rJsonWriter.put("init_focus_id", pFocusControl->get_id());
+
+        {
+            auto childrenNode = rJsonWriter.startArray("children");
+
+            auto containerNode = rJsonWriter.startStruct();
+            rJsonWriter.put("id", "container");
+            rJsonWriter.put("type", "container");
+            rJsonWriter.put("vertical", true);
+
+            {
+                auto containerChildrenNode = 
rJsonWriter.startArray("children");
+
+                // tabpages
+                for (int i = 0; i < GetChildCount(); i++)
+                {
+                    vcl::Window* pChild = GetChild(i);
+
+                    if (!isButton(pChild->GetType()) && pChild != mpViewWindow)
+                    {
+                        auto childNode = rJsonWriter.startStruct();
+                        pChild->DumpAsPropertyTree(rJsonWriter);
+                    }
+                }
+
+                // buttons
+                {
+                    auto buttonsNode = rJsonWriter.startStruct();
+                    rJsonWriter.put("id", "buttons");
+                    rJsonWriter.put("type", "buttonbox");
+                    rJsonWriter.put("layoutstyle", "end");
+                    {
+                        auto buttonsChildrenNode = 
rJsonWriter.startArray("children");
+                        for (int i = 0; i < GetChildCount(); i++)
+                        {
+                            vcl::Window* pChild = GetChild(i);
+
+                            if (isButton(pChild->GetType()))
+                            {
+                                auto childNode = rJsonWriter.startStruct();
+                                pChild->DumpAsPropertyTree(rJsonWriter);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
 }   // namespace vcl
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to