diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2023-08-17 10:21:57 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2023-08-21 15:18:50 +0200 |
commit | f30141e05ab47b3673d1bdb06776bbcd8e43a85b (patch) | |
tree | ab9cd912a996b3372b1ac8d7b20914714a8c5ae0 /vcl | |
parent | 352bcab5bc59ef3e0042328503c6535e28dce931 (diff) |
jsdialog: dump vertical tab control
Change-Id: I673199dfd7e95bfdb748791db094e7a1c3e74dba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155759
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Attila Szűcs <attila.szucs@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/verticaltabctrl.hxx | 4 | ||||
-rw-r--r-- | vcl/source/control/ivctrl.cxx | 44 |
2 files changed, 48 insertions, 0 deletions
diff --git a/vcl/inc/verticaltabctrl.hxx b/vcl/inc/verticaltabctrl.hxx index 2575fc4ebe9b..242c445f839d 100644 --- a/vcl/inc/verticaltabctrl.hxx +++ b/vcl/inc/verticaltabctrl.hxx @@ -22,6 +22,8 @@ #include <memory> #include <string_view> +#include <tools/json_writer.hxx> + #include <vcl/dllapi.h> #include <vcl/toolkit/ivctrl.hxx> #include <vcl/layout.hxx> @@ -79,6 +81,8 @@ public: vcl::Window* GetPageParent() { return m_xBox.get(); } + virtual void DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) override; + virtual FactoryFunction GetUITestFactory() const override; }; diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index b344e270572e..4b6973f8e916 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -627,6 +627,50 @@ void VerticalTabControl::SetPageText(std::string_view rPageId, const OUString& r pData->pEntry->SetText(rText); } +void VerticalTabControl::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) +{ + rJsonWriter.put("id", get_id()); + rJsonWriter.put("type", "tabcontrol"); + rJsonWriter.put("vertical", true); + rJsonWriter.put("selected", GetCurPageId()); + + { + auto childrenNode = rJsonWriter.startArray("children"); + for (int i = 0; i < GetPageCount(); i++) + { + VclPtr<vcl::Window> pChild = GetPage(GetPageId(i)); + + if (pChild) + { + if (!pChild->GetChildCount()) + continue; + + auto aChildNode = rJsonWriter.startStruct(); + pChild->DumpAsPropertyTree(rJsonWriter); + } + } + } + { + auto tabsNode = rJsonWriter.startArray("tabs"); + for(int i = 0; i < GetPageCount(); i++) + { + VclPtr<vcl::Window> pChild = GetPage(GetPageId(i)); + + if (pChild) + { + if (!pChild->GetChildCount()) + continue; + + auto aTabNode = rJsonWriter.startStruct(); + auto sId = GetPageId(i); + rJsonWriter.put("text", GetPageText(sId)); + rJsonWriter.put("id", sId); + rJsonWriter.put("name", GetPageText(sId)); + } + } + } +} + FactoryFunction VerticalTabControl::GetUITestFactory() const { return VerticalTabControlUIObject::create; |