include/vcl/combobox.hxx | 3 +++ vcl/source/control/combobox.cxx | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
New commits: commit 0c9c1bcbeb937ac9fae785b9f890de18ccbf3e28 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Feb 25 13:01:20 2020 +0100 Commit: Jan Holesovsky <[email protected]> CommitDate: Fri Aug 14 22:40:55 2020 +0200 jsdialog: export combobox entries Change-Id: Ic0a3c93020c7c915fd908fe994ec0a3a900358eb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97625 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100469 Reviewed-by: Jan Holesovsky <[email protected]> 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: */ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
