include/vcl/combobox.hxx | 3 +++ vcl/source/control/combobox.cxx | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
New commits: commit 22c336d2f2b92a0ce00c292fe76bb4b494c31cc3 Author: Szymon Kłos <[email protected]> AuthorDate: Tue Feb 25 13:01:20 2020 +0100 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Jul 2 08:22:08 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]> 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: */ _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
