diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-01-19 14:50:55 +0000 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2021-01-20 19:02:42 +0100 |
commit | b99a8a17f91033c9955be8c874012a6762138af4 (patch) | |
tree | e20a0871dcdc9e4f2d6732004579cfd284e50b68 /sw | |
parent | 01fffa977e28b2a671f195daa3a1aaa4cbe3b258 (diff) |
tdf#135377 keep the correct index selected
Change-Id: I8737b64300e4bb3a3441c1ec43620b2acea31d2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109589
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 7697e4413da7..431ce1d8ec59 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -712,8 +712,11 @@ void SwFieldVarPage::FillFormatLB(SwFieldTypesEnum nTypeId) if (!IsFieldEdit() || bSpecialFormat) { OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND)); + int nOldIndex = rWidget.get_selected_index(); rWidget.insert(0, SwResId(FMT_MARK_TEXT), &sId, nullptr, nullptr); rWidget.insert(1, SwResId(FMT_USERVAR_CMD), &sId, nullptr, nullptr); + if (nOldIndex != -1) + rWidget.select(nOldIndex + 2); } } break; @@ -723,7 +726,10 @@ void SwFieldVarPage::FillFormatLB(SwFieldTypesEnum nTypeId) if (!IsFieldEdit() || bSpecialFormat) { OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND)); + int nOldIndex = rWidget.get_selected_index(); rWidget.insert(0, SwResId(FMT_SETVAR_TEXT), &sId, nullptr, nullptr); + if (nOldIndex != -1) + rWidget.select(nOldIndex + 1); } } break; @@ -731,14 +737,20 @@ void SwFieldVarPage::FillFormatLB(SwFieldTypesEnum nTypeId) case SwFieldTypesEnum::Formel: { OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND)); + int nOldIndex = rWidget.get_selected_index(); rWidget.insert(0, SwResId(FMT_GETVAR_NAME), &sId, nullptr, nullptr); + if (nOldIndex != -1) + rWidget.select(nOldIndex + 1); } break; case SwFieldTypesEnum::Get: { OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND)); + int nOldIndex = rWidget.get_selected_index(); rWidget.insert(0, SwResId(FMT_GETVAR_NAME), &sId, nullptr, nullptr); + if (nOldIndex != -1) + rWidget.select(nOldIndex + 1); } break; |