From 49c968cccfa3f6b2dd0476313190ed3d1d81b3f5 Mon Sep 17 00:00:00 2001 From: Henry Castro Date: Thu, 17 Oct 2019 19:03:42 -0400 Subject: lok: dump as property tree the valueset control In order to create a container element at client side dialog using DialogWizard. It is required to send the items of the valueset control. Change-Id: Ib0fdc444c7126e6888e37c8a01f8e7f04c641d18 Reviewed-on: https://gerrit.libreoffice.org/81042 Tested-by: Jenkins Reviewed-by: Henry Castro --- include/svtools/valueset.hxx | 1 + include/vcl/image.hxx | 2 +- svtools/source/control/valueset.cxx | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index ec8daf986478..3855795d0627 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -295,6 +295,7 @@ public: virtual void RequestHelp( const HelpEvent& rHEvt ) override; virtual void StateChanged( StateChangedType nStateChange ) override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual boost::property_tree::ptree DumpAsPropertyTree() override; virtual void Select(); virtual void UserDraw( const UserDrawEvent& rUDEvt ); diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx index 1267e1a439e5..07ea7a7764b3 100644 --- a/include/vcl/image.hxx +++ b/include/vcl/image.hxx @@ -71,7 +71,7 @@ public: return !(Image::operator==(rImage)); } - SAL_DLLPRIVATE OUString GetStock() const; + OUString GetStock() const; void Draw(OutputDevice* pOutDev, const Point& rPos, DrawImageFlags nStyle, const Size* pSize = nullptr); diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 94c3cac34afd..494583799287 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -1433,6 +1433,28 @@ void ValueSet::DataChanged( const DataChangedEvent& rDataChangedEvent ) } } +boost::property_tree::ptree ValueSet::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree(Control::DumpAsPropertyTree()); + boost::property_tree::ptree aEntries; + + const size_t nSize = mItemList.size(); + + for ( size_t nIt = 0; nIt < nSize; ++nIt ) + { + boost::property_tree::ptree aEntry; + ValueSetItem* pItem = mItemList[nIt].get(); + aEntry.put("id", pItem->mnId); + aEntry.put("text", pItem->maText); + aEntry.put("image", pItem->maImage.GetStock()); + aEntries.push_back(std::make_pair("", aEntry)); + } + + aTree.put("type", "valueset"); + aTree.add_child("entries", aEntries); + return aTree; +} + void ValueSet::Select() { maSelectHdl.Call( this ); -- cgit