sw/inc/strings.hrc | 1 + sw/inc/swundo.hxx | 1 + sw/source/core/doc/doc.cxx | 9 +++++---- sw/source/core/undo/undobj.cxx | 3 +++ 4 files changed, 10 insertions(+), 4 deletions(-)
New commits: commit aee3a02d9537b75a08bf57272a1614c9038b6d1a Author: Oliver Specht <[email protected]> AuthorDate: Thu Mar 20 15:15:51 2025 +0100 Commit: Gabor Kelemen <[email protected]> CommitDate: Mon Mar 24 17:13:46 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 <[email protected]> Tested-by: Gabor Kelemen <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183191 Tested-by: allotropia jenkins <[email protected]> diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 07e5f2b8fc55..96c7a4ba9493 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -1503,6 +1503,7 @@ #define STR_TABLE_PANEL_ALIGN_CENTER NC_("sidebartableedit|aligncenterlabel", "Center") #define STR_TABLE_PANEL_ALIGN_MANUAL NC_("sidebartableedit|alignmanuallabel", "Manual") +#define STR_UNDO_CONVERT_FIELD_TO_TEXT NC_("STR_UNDO_CONVERT_FIELD_TO_TEXT", "Convert field to text") #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx index dc91de5aff4d..2f6f460b5188 100644 --- a/sw/inc/swundo.hxx +++ b/sw/inc/swundo.hxx @@ -180,6 +180,7 @@ enum class SwUndoId CHANGE_THEME = 148, DELETE_SECTIONS = 149, FLYFRMFMT_DECORATIVE = 150, + CONVERT_FIELD_TO_TEXT = 151, }; OUString GetUndoComment(SwUndoId eId); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 65a327c243a8..92c1e096cba7 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -1642,7 +1642,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); @@ -1710,15 +1710,16 @@ 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; } + 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(); @@ -1812,7 +1813,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 9e057d73e256..6a4a08961f3b 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -685,6 +685,9 @@ OUString GetUndoComment(SwUndoId eId) case SwUndoId::FLYFRMFMT_DECORATIVE: pId = STR_UNDO_FLYFRMFMT_DECORATIVE; break; + case SwUndoId::CONVERT_FIELD_TO_TEXT: + pId = STR_UNDO_CONVERT_FIELD_TO_TEXT; + break; } assert(pId);
