diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-11-30 13:58:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-11-30 16:51:00 +0100 |
commit | afb362c60a18243621834dcf2b30672be6eed76f (patch) | |
tree | 1aab9ef6ab0153ceef05dab58a22c69e85866ba6 /comphelper | |
parent | 12d8dc31b003f6a4d466d3547ab342b85ac84bf0 (diff) |
sfx2: extend .uno:SetDocumentProperties to update custom doc props
Scripting clients (like the LOK API) had a way to get all custom
properties where the name matches a certain prefix, but setting such
properties was not possible.
.uno:SetDocumentProperties can already show a dialog to edit properties
interactively and had a parameter to set some properties in a
non-interactive way, but there doesn't seem to be a way to influence
custom properties there without using the internal API.
Fix the problem by adding a new UpdatedProperties parameter that allows
removing all old custom properties matching the prefix and adding new
ones with a single UNO command dispatch.
This is meant to be the write side of the reading commit
5e8f6dcb8ce00d2d5e35b3cf5654187b3068276c (sw lok,
.uno:SetDocumentProperties: expose value of custom document properties,
2022-11-29).
Change-Id: Ib7450d4d21285d9a73758e1c172543521fc07cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143491
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/sequenceashashmap.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx index b18202aab5f5..3bbce289ffe0 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -367,6 +367,14 @@ 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::stringstream s; + boost::property_tree::write_json(s, aNodeValue); + std::vector<beans::PropertyValue> aPropertyValues = JsonToPropertyValues(s.str().c_str()); + aValue.Value <<= comphelper::containerToSequence(aPropertyValues); + } else if (rType == "[][]com.sun.star.beans.PropertyValue") { aNodeValue = rPair.second.get_child("value", aNodeNull); |