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

New commits:
commit b2b821715a3745718a941fa99dda92137c0f0c86
Author:     Vasily Melenchuk <vasily.melenc...@cib.de>
AuthorDate: Wed Apr 13 20:19:35 2022 +0300
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Fri Apr 15 18:02:00 2022 +0200

    tdf#148551: sw ui: set default format value for Insert Field dlg
    
    My previous implementation was changing current format selection
    only for field edit dialog. However it should be initialized also
    for insert field dlg. It is not always first element. Instead of
    older confusing approach right now there is a switch to set
    defaults: it is less confusing IMO.
    
    Change-Id: I189339ba66effc49267004a42345a28892cb693c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132980
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 2e7c1c67dbc2..4e65a7c3fb26 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -479,6 +479,19 @@ sal_Int32 SwFieldDokPage::FillFormatLB(SwFieldTypesEnum 
nTypeId)
     {
         m_xFormatLB->select_id(OUString::number(GetCurField()->GetFormat() & 
~AF_FIXED));
     }
+    else
+    {
+        // Select default selected value for "Insert" dialog
+        switch (nTypeId)
+        {
+            case SwFieldTypesEnum::PageNumber:
+            case SwFieldTypesEnum::DocumentStatistics:
+                m_xFormatLB->select_text(SwResId(FMT_NUM_PAGEDESC));
+                break;
+            default:
+                m_xFormatLB->select(0);
+        }
+    }
 
     FormatHdl(*m_xFormatLB);
 

Reply via email to