summaryrefslogtreecommitdiff
path: root/sw/sdi
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-12-14 16:06:37 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-12-14 19:17:56 +0000
commit724180ec495a696c79332653cb6fb52ecfbccc29 (patch)
treeb78c416b7a54e9454bf344f0b2b8a7d8b0cab995 /sw/sdi
parent705594fc805012b5bf6167d7f9fee63bb1b90a1b (diff)
sw: add a new .uno:UpdateBookmarks UNO command
Current the .uno:InsertBookmark command allows inserting a bookmark with a provided content into the document, but an existing bookmark can't be updated similarly. This is a problem in case Zotero citations are to be modeled with bookmarks. Another trouble is that bookmarks don't have dummy characters, so we need to be careful to replace the content in a way that maintains these bookmarks, a naive delete + insert will collapse them. Fix the problem by introducing a new .uno:UpdateBookmarks command, somewhat similar to what commit 7765b442e13048f857fd7ee49ced1731caee297e (sw: add a new .uno:TextFormFields UNO command, 2022-11-28) did. As usual, the provided new text is meant to be HTML, which allows multi-paragraph, formatted content. Change-Id: Id5bb3fd2fd9e147d98709b5a7e0c322e73c6d283 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144167 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/sdi')
-rw-r--r--sw/sdi/_textsh.sdi6
-rw-r--r--sw/sdi/swriter.sdi14
2 files changed, 20 insertions, 0 deletions
diff --git a/sw/sdi/_textsh.sdi b/sw/sdi/_textsh.sdi
index 98e32d3d58dc..f9b3c84cd207 100644
--- a/sw/sdi/_textsh.sdi
+++ b/sw/sdi/_textsh.sdi
@@ -146,6 +146,12 @@ interface BaseText
StateMethod = GetState ;
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
+ FN_UPDATE_BOOKMARKS
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
FN_SET_REMINDER
[
ExecMethod = Execute ;
diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi
index 2471dfcd9fb6..37cb0d36e029 100644
--- a/sw/sdi/swriter.sdi
+++ b/sw/sdi/swriter.sdi
@@ -2586,6 +2586,20 @@ SfxVoidItem EditBookmark FN_EDIT_BOOKMARK
GroupId = SfxGroupId::Insert;
]
+SfxVoidItem UpdateBookmarks FN_UPDATE_BOOKMARKS
+(SfxStringItem BookmarkNamePrefix FN_PARAM_1, SfxUnoAnyItem Bookmarks FN_PARAM_2)
+[
+ AutoUpdate = FALSE,
+ FastCall = FALSE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+
+ GroupId = SfxGroupId::Insert;
+]
+
SfxVoidItem SetReminder FN_SET_REMINDER
[