sw/source/uibase/shells/textfld.cxx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
New commits: commit 60be9811555b935d6860157ebf26fac6b48327ac Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jan 12 15:49:03 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jan 13 07:13:24 2023 +0000 sw, FN_DELETE_TEXT_FORMFIELDS: allow deleting all fieldmarks As suggested at <https://gerrit.libreoffice.org/c/core/+/145347/1#message-d2e88d8a1923f0fa5d2869b8d92e1d25d15ac645>, in case the provided prefix is empty, then don't try to look up ODF_CODE_PARAM and don't compare it with the provided prefix. This allows deleting all fieldmarks in the document, which is probably intended with an empty prefix. Change-Id: Ic3015925165a9abc13a30889c36c667b10996c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145409 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index d4b9e92c5416..77d68cddf3d7 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -962,17 +962,20 @@ FIELD_INSERT: continue; } - auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM); - if (itParam == pFieldmark->GetParameters()->end()) + if (!aFieldCommandPrefix.isEmpty()) { - continue; - } + auto itParam = pFieldmark->GetParameters()->find(ODF_CODE_PARAM); + if (itParam == pFieldmark->GetParameters()->end()) + { + continue; + } - OUString aCommand; - itParam->second >>= aCommand; - if (!aCommand.startsWith(aFieldCommandPrefix)) - { - continue; + OUString aCommand; + itParam->second >>= aCommand; + if (!aCommand.startsWith(aFieldCommandPrefix)) + { + continue; + } } aRemovals.push_back(pFieldmark);