diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-02-25 13:01:20 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2020-08-14 22:40:55 +0200 |
commit | 0c9c1bcbeb937ac9fae785b9f890de18ccbf3e28 (patch) | |
tree | 4f2bb4d47421cf3d67540918345ffdc59823894a | |
parent | Instant update shadow fields in sidebar (diff) | |
download | core-0c9c1bcbeb937ac9fae785b9f890de18ccbf3e28.tar.gz core-0c9c1bcbeb937ac9fae785b9f890de18ccbf3e28.zip |
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/+/100469
Reviewed-by: Jan Holesovsky <kendy@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 9dc14739f4e1..62569fc8d0c1 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 99203e61b793..944860e0ca74 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1562,4 +1562,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: */ |