sw/inc/strings.hrc                  |    1 +
 sw/inc/swundo.hxx                   |    1 +
 sw/source/core/undo/undobj.cxx      |    3 +++
 sw/source/uibase/shells/textsh1.cxx |    8 +++++---
 4 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 0449583616bf1a73936229ec2aa333b5ecf5e882
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Wed Mar 1 20:02:19 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Mar 2 07:01:08 2023 +0000

    sw: fix undo comment of FN_UPDATE_BOOKMARK
    
    It's an update and the name was not set. One has to dispatch
    .uno:UpdateBookmark to see this in action, which does something if the
    cursor is inside an exiting bookmark.
    
    Change-Id: Ib9c54a28c5410cc001468952cfd8577a9412d664
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148073
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 40cbb9acb8c4..8b8b1df2731c 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -438,6 +438,7 @@
 #define STR_INSERT_GLOSSARY                     NC_("STR_INSERT_GLOSSARY", 
"Insert AutoText")
 #define STR_DELBOOKMARK                         NC_("STR_DELBOOKMARK", "Delete 
bookmark: $1")
 #define STR_INSBOOKMARK                         NC_("STR_INSBOOKMARK", "Insert 
bookmark: $1")
+#define STR_UPDATE_BOOKMARK                     NC_("STR_UPDATE_BOOKMARK", 
"Update bookmark: $1")
 #define STR_SORT_TBL                            NC_("STR_SORT_TBL", "Sort 
table")
 #define STR_SORT_TXT                            NC_("STR_SORT_TXT", "Sort 
text")
 #define STR_INSTABLE_UNDO                       NC_("STR_INSTABLE_UNDO", 
"Insert table: $1$2$3")
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index 61261fb9769b..d4da619560cc 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -170,6 +170,7 @@ enum class SwUndoId
     UPDATE_FORM_FIELD,                 // 138
     UPDATE_FORM_FIELDS,                // 139
     DELETE_FORM_FIELDS,                // 140
+    UPDATE_BOOKMARK,                   // 141
 };
 
 OUString GetUndoComment(SwUndoId eId);
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 3c5f3844591e..d872bc812166 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -655,6 +655,9 @@ OUString GetUndoComment(SwUndoId eId)
         case SwUndoId::DELETE_FORM_FIELDS:
             pId = STR_UNDO_DELETE_FORM_FIELDS;
             break;
+        case SwUndoId::UPDATE_BOOKMARK:
+            pId = STR_UPDATE_BOOKMARK;
+            break;
     }
 
     assert(pId);
diff --git a/sw/source/uibase/shells/textsh1.cxx 
b/sw/source/uibase/shells/textsh1.cxx
index b68d5cd83baa..156572854c19 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -610,13 +610,15 @@ void UpdateBookmark(SfxRequest& rReq, SwWrtShell& rWrtSh)
         return;
     }
 
-    rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::INSBOOKMARK, 
nullptr);
+    SwRewriter aRewriter;
+    aRewriter.AddRule(UndoArg1, pBookmark->GetName());
+    
rWrtSh.GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::UPDATE_BOOKMARK, 
&aRewriter);
     rWrtSh.StartAction();
     comphelper::ScopeGuard g(
-        [&rWrtSh]
+        [&rWrtSh, &aRewriter]
         {
             rWrtSh.EndAction();
-            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSBOOKMARK, nullptr);
+            
rWrtSh.GetDoc()->GetIDocumentUndoRedo().EndUndo(SwUndoId::UPDATE_BOOKMARK, 
&aRewriter);
         });
 
 

Reply via email to