summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2020-02-25 13:01:20 +0100
committerSzymon Kłos <szymon.klos@collabora.com>2020-07-07 08:35:17 +0200
commitf94fd72e87616e6c05a9ea07f21106f488234c15 (patch)
tree088f0481c8e75609676d2f706152eba6f8ebe919
parent70f9c3b8f03fb28215985a5b899bd8fae9cb3ac3 (diff)
jsdialog: export combobox entries
Change-Id: Ic0a3c93020c7c915fd908fe994ec0a3a900358eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97625 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97862 Tested-by: Jenkins
-rw-r--r--include/vcl/toolkit/combobox.hxx2
-rw-r--r--vcl/source/control/combobox.cxx22
2 files changed, 24 insertions, 0 deletions
diff --git a/include/vcl/toolkit/combobox.hxx b/include/vcl/toolkit/combobox.hxx
index 611bce590add..fe322fc2e188 100644
--- a/include/vcl/toolkit/combobox.hxx
+++ b/include/vcl/toolkit/combobox.hxx
@@ -187,6 +187,8 @@ public:
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual FactoryFunction GetUITestFactory() const override;
+
+ virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
};
#endif // _COMBOBOX_HXX
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 881acd2a654c..9942da05aaed 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -32,6 +32,7 @@
#include <listbox.hxx>
#include <controldata.hxx>
#include <comphelper/lok.hxx>
+#include <tools/json_writer.hxx>
namespace {
@@ -1539,4 +1540,25 @@ FactoryFunction ComboBox::GetUITestFactory() const
return ComboBoxUIObject::create;
}
+void ComboBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
+{
+ Control::DumpAsPropertyTree(rJsonWriter);
+
+ auto entriesNode = rJsonWriter.startNode("entries");
+ for (int i = 0; i < GetEntryCount(); ++i)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", GetEntry(i));
+ }
+
+ auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ for (int i = 0; i < GetSelectedEntryCount(); ++i)
+ {
+ auto entryNode = rJsonWriter.startNode("");
+ rJsonWriter.put("", GetSelectedEntryPos(i));
+ }
+
+ rJsonWriter.put("selectedCount", GetSelectedEntryCount());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */