diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-11-25 16:32:37 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-25 17:52:36 +0100 |
commit | 1e83197fdd4263ca4817a6ac16f274aaee3e66fd (patch) | |
tree | 90bb75aaba4193b79bc09078fbcaa8cdb08d38f0 /comphelper/source | |
parent | fd05a0f9ccebaee6f0175281fdeb6fe3f3168fd2 (diff) |
comphelper: support property values arrays in JsonToPropertyValues()
Needed for an uncoming .uno:TextFormFields uno command where one of the
parameters has the []com.sun.star.beans.PropertyValues type at an UNO
level, and we can't provide JSON at the moment that would express that.
Change-Id: I288a540b2fcac0e5a4a82bca235199c559ba2d0c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143302
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/misc/sequenceashashmap.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 34a6a0c8a580..b18202aab5f5 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -31,6 +31,7 @@ #include <comphelper/propertysequence.hxx> #include <sal/log.hxx> #include <o3tl/string_view.hxx> +#include <comphelper/sequence.hxx> using namespace com::sun::star; @@ -366,6 +367,19 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson aValue.Value <<= aSeq; } } + else if (rType == "[][]com.sun.star.beans.PropertyValue") + { + aNodeValue = rPair.second.get_child("value", aNodeNull); + std::vector<uno::Sequence<beans::PropertyValue>> aSeqs; + for (const auto& rItem : aNodeValue) + { + std::stringstream s; + boost::property_tree::write_json(s, rItem.second); + std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(s.str().c_str()); + aSeqs.push_back(comphelper::containerToSequence(aPropertyValues)); + } + aValue.Value <<= comphelper::containerToSequence(aSeqs); + } else SAL_WARN("comphelper", "JsonToPropertyValues: unhandled type '" << rType << "'"); aArguments.push_back(aValue); |