sw: add a new .uno:TextFormFields UNO command

Desktop / LibreOffice - Miklos Vajna [collabora.com] - 28 November 2022 10:18 UTC

Currently .uno:TextFormField can be used to insert a new fieldmark, but then there is no way to update it. Also, there is no way to update several fieldmarks at the same time.

Given that the "ADDON" field type in a field mark can be used by extensions like Zotero, it's useful in case these fieldmarks can be not only inserted, but they can be also updated. This works by (in the LOK case) calling getCommandValues() with .uno:TextFormFields, and then once the client generates the new expanded values, there is no way to insert these updated expanded values into the document currently.

Fix this by adding a new .uno:TextFormFields UNO command that can update all fieldmarks matching a certain prefix (looking at their field command). This allows e.g. updating all Zotero citations or the bibliography, but the API is generic to support any kind of ADDON fields. Similar to insertion, the content can be multi-paragraph, formatted HTML.

This required adjusting SfxUnoAnyItem::CreateDefault(), this way an UNO command parameter can be an array of beans::PropertyValues, which is how the client can provide details of multiple fieldmarks.

Change-Id: I44a1b1495ead79b92ccd0c9f6412a34cbec5d68b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143361

7765b442e130 sw: add a new .uno:TextFormFields UNO command
sfx2/source/view/frame.cxx | 5 ++-
sw/inc/cmdid.h | 2 +
sw/qa/uibase/shells/shells.cxx | 63 ++++++++++++++++++++++++++++++++
sw/sdi/_textsh.sdi | 6 +++
sw/sdi/swriter.sdi | 18 +++++++++
sw/source/uibase/shells/textfld.cxx | 73 +++++++++++++++++++++++++++++++++++++
6 files changed, 166 insertions(+), 1 deletion(-)

Upstream: cgit.freedesktop.org


  • Share