comphelper/source/misc/sequenceashashmap.cxx | 8 ++++++++ 1 file changed, 8 insertions(+)
New commits: commit cccbf8608f3b76651993bc8576c672367c228fa2 Author: Skyler Grey <skyler.g...@collabora.com> AuthorDate: Wed Oct 9 16:29:30 2024 +0000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Oct 16 13:15:39 2024 +0200 feat(json): Allow serializing any Previously, as far as I can tell, there was no way to send a Size in a .uno command (as would be needed in, say, '.uno:InsertAVMedia'). We do, however, already have a way to send an `[]any`, and we can use a similar method to allow sending arbitrary types with `any` rather than `[]any`. To use this, the type you really want to send has to be wrapped in any, so for example... { type: "any", value: { type: "com.sun.star.awt.Size", value: { Width: { type: "long", value: 0, }, Height: { type: "long", value: 0, } } } } Change-Id: Ic33594dee955d475d81733adb21950c0458435e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174740 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index 270c005db259..3c3ae6547ebe 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -356,6 +356,14 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson aValue.Value <<= aSeqByte; } } + else if (rType == "any") + { + aNodeValue = rPair.second.get_child("value", aNodeNull); + if (aNodeValue != aNodeNull && !aNodeValue.empty()) + { + aValue.Value = jsonToUnoAny(aNodeValue); + } + } else if (rType == "[]any") { aNodeValue = rPair.second.get_child("value", aNodeNull);