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:01:56 +0100 |
commit | 291d337093dc04916b35052dbad9f13253387a2a (patch) | |
tree | 663055ddc224c03663b6e1678e9bfa9cc0e8c8ba /sw | |
parent | b998e3c8da56e544b829cc6461af7f9db12e9d80 (diff) |
tdf#135377 keep the correct index selected
Change-Id: I8737b64300e4bb3a3441c1ec43620b2acea31d2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109588
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 98fe430c2d3b..b26b52ef1993 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; |