diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2022-11-30 13:58:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-12-06 16:03:28 +0000 |
commit | 6004550c5a5fefe532dd73cceb163055fa475217 (patch) | |
tree | 661e44c8adafbed7fe3a87ae0c4ea1bb495fbf3a /comphelper | |
parent | a61a4da16ef2fea05787fa57c45cde11eb72e11e (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).
(cherry picked from commit afb362c60a18243621834dcf2b30672be6eed76f)
Change-Id: Ib7450d4d21285d9a73758e1c172543521fc07cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143708
Tested-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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 957c76feceac..6d2379de5abb 100644 --- a/comphelper/source/misc/sequenceashashmap.cxx +++ b/comphelper/source/misc/sequenceashashmap.cxx @@ -365,6 +365,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); |