diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-02-25 13:01:20 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-07-02 08:22:08 +0200 |
commit | 22c336d2f2b92a0ce00c292fe76bb4b494c31cc3 (patch) | |
tree | 692378fbe49fb2ff7702260f98a752a8219576dd | |
parent | db9744e527fad959418d3a21f3295acc863b20d9 (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>
-rw-r--r-- | include/vcl/combobox.hxx | 3 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 29 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 1cd67d70a10d..83f8beef71e9 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -23,6 +23,7 @@ #include <memory> #include <vcl/dllapi.h> #include <vcl/edit.hxx> +#include <boost/property_tree/ptree.hpp> #define COMBOBOX_APPEND (SAL_MAX_INT32) #define COMBOBOX_ENTRY_NOTFOUND (SAL_MAX_INT32) @@ -183,6 +184,8 @@ public: virtual bool set_property(const OString &rKey, const OUString &rValue) override; virtual FactoryFunction GetUITestFactory() const override; + + virtual boost::property_tree::ptree DumpAsPropertyTree() override; }; #endif // _COMBOBOX_HXX diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index a7618222b517..45f6e78b5569 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1555,4 +1555,33 @@ FactoryFunction ComboBox::GetUITestFactory() const return ComboBoxUIObject::create; } +boost::property_tree::ptree ComboBox::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree(Control::DumpAsPropertyTree()); + boost::property_tree::ptree aEntries; + + for (int i = 0; i < GetEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetEntry(i)); + aEntries.push_back(std::make_pair("", aEntry)); + } + + aTree.add_child("entries", aEntries); + + boost::property_tree::ptree aSelected; + + for (int i = 0; i < GetSelectedEntryCount(); ++i) + { + boost::property_tree::ptree aEntry; + aEntry.put("", GetSelectedEntryPos(i)); + aSelected.push_back(std::make_pair("", aEntry)); + } + + aTree.put("selectedCount", GetSelectedEntryCount()); + aTree.add_child("selectedEntries", aSelected); + + return aTree; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |