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

New commits:
commit ec8ea016002e2521649e435fc28850ef3f8e5348
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Thu Mar 20 15:15:51 2025 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Fri Mar 21 09:35:40 2025 +0100

    tdf#165827 Assign id to ConvertFieldToText undo action
    
    Fixes "Replace $1 $2 $3" entry in undo dropdown.
    
    Change-Id: I108cf408ac4f703677d1b013864e6295f7b52e6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183173
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index 526c1f3ab8f6..e114be97f708 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -1549,6 +1549,7 @@
 
 #define STR_UNDO_MAKE_FOOTNOTES_ENDNOTES 
NC_("STR_UNDO_MAKE_FOOTNOTES_ENDNOTES", "Make all footnotes endnotes")
 #define STR_UNDO_MAKE_ENDNOTES_FOOTNOTES 
NC_("STR_UNDO_MAKE_ENDNOTES_FOOTNOTES", "Make all endnotes footnotes")
+#define STR_UNDO_CONVERT_FIELD_TO_TEXT NC_("STR_UNDO_CONVERT_FIELD_TO_TEXT", 
"Convert field to text")
 
 // To translators: title, text, question for confirmation whether to switch 
overwrite mode on
 #define STR_QUERY_INSMODE_TITLE NC_("STR_QUERY_INSMODE_TITLE", "You are 
switching to the overwrite mode")
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index 4641f0e9e9af..294578c16061 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -182,6 +182,7 @@ enum class SwUndoId
     FLYFRMFMT_DECORATIVE = 150,
     MAKE_FOOTNOTES_ENDNOTES = 151,
     MAKE_ENDNOTES_FOOTNOTES = 152,
+    CONVERT_FIELD_TO_TEXT = 153,
 };
 
 OUString GetUndoComment(SwUndoId eId);
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index dbfe2511dda3..2cd99f054eea 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -2002,7 +2002,7 @@ bool SwDoc::ConvertFieldToText(SwField& rField, 
SwRootFrame const& rLayout)
 {
     bool bRet = false;
     getIDocumentFieldsAccess().LockExpFields();
-    GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_REPLACE, nullptr );
+    GetIDocumentUndoRedo().StartUndo( SwUndoId::CONVERT_FIELD_TO_TEXT, nullptr 
);
 
     SwFieldType* pFieldType = rField.GetTyp();
     SwFormatField* pFormatField = pFieldType->FindFormatForField(&rField);
@@ -2070,7 +2070,7 @@ bool SwDoc::ConvertFieldToText(SwField& rField, 
SwRootFrame const& rLayout)
     }
     if( bRet )
         getIDocumentState().SetModified();
-    GetIDocumentUndoRedo().EndUndo( SwUndoId::UI_REPLACE, nullptr );
+    GetIDocumentUndoRedo().EndUndo( SwUndoId::CONVERT_FIELD_TO_TEXT, nullptr );
     getIDocumentFieldsAccess().UnlockExpFields();
     return bRet;
 }
@@ -2078,7 +2078,7 @@ bool SwDoc::ConvertFieldsToText(SwRootFrame const& 
rLayout)
 {
     bool bRet = false;
     getIDocumentFieldsAccess().LockExpFields();
-    GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_REPLACE, nullptr );
+    GetIDocumentUndoRedo().StartUndo( SwUndoId::CONVERT_FIELD_TO_TEXT, nullptr 
);
 
     const bool bOnlyConvertDBFields
         = 
officecfg::Office::Writer::FormLetter::ConvertToTextOnlyMMFields::get();
@@ -2172,7 +2172,7 @@ bool SwDoc::ConvertFieldsToText(SwRootFrame const& 
rLayout)
 
     if( bRet )
         getIDocumentState().SetModified();
-    GetIDocumentUndoRedo().EndUndo( SwUndoId::UI_REPLACE, nullptr );
+    GetIDocumentUndoRedo().EndUndo( SwUndoId::CONVERT_FIELD_TO_TEXT, nullptr );
     getIDocumentFieldsAccess().UnlockExpFields();
     return bRet;
 
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 93aad1069a57..e69bebbd8666 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -691,6 +691,9 @@ OUString GetUndoComment(SwUndoId eId)
         case SwUndoId::MAKE_ENDNOTES_FOOTNOTES:
             pId = STR_UNDO_MAKE_ENDNOTES_FOOTNOTES;
             break;
+        case SwUndoId::CONVERT_FIELD_TO_TEXT:
+            pId = STR_UNDO_CONVERT_FIELD_TO_TEXT;
+            break;
     }
 
     assert(pId);

Reply via email to