[Libreoffice-commits] core.git: sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 19 19:52:50 UTC 2021


 sw/source/ui/fldui/fldvar.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit f994017159d27faaa6678db9a2a658ace1f871d3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Jan 19 14:50:55 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jan 19 20:52:04 2021 +0100

    tdf#135377 keep the correct index selected
    
    Change-Id: I8737b64300e4bb3a3441c1ec43620b2acea31d2c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109638
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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;
 


More information about the Libreoffice-commits mailing list