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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Mar 19 17:46:18 UTC 2019


 sw/source/ui/fldui/flddinf.cxx            |  262 ++++++++-----------
 sw/source/ui/fldui/flddinf.hxx            |   26 -
 sw/source/ui/fldui/flddok.cxx             |  411 +++++++++++++-----------------
 sw/source/ui/fldui/flddok.hxx             |   41 +-
 sw/source/ui/fldui/fldpage.cxx            |    2 
 sw/source/ui/fldui/fldpage.hxx            |    2 
 sw/source/uibase/inc/numfmtlb.hxx         |   97 ++++++-
 sw/source/uibase/utlui/numfmtlb.cxx       |   99 +++++--
 sw/uiconfig/swriter/ui/flddocinfopage.ui  |  136 ++++++++-
 sw/uiconfig/swriter/ui/flddocumentpage.ui |  198 +++++++++++---
 sw/uiconfig/swriter/ui/fldrefpage.ui      |    4 
 11 files changed, 761 insertions(+), 517 deletions(-)

New commits:
commit 31b017e31f4802f6d56acaa7b717fb84e4b6e318
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 19 15:11:23 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Mar 19 18:46:05 2019 +0100

    weld SwFieldDokInfPage
    
    Change-Id: I468f6927f089db19c3b461d965b1dc6222f65716
    Reviewed-on: https://gerrit.libreoffice.org/69428
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 13659f395655..340daf1470da 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -58,41 +58,28 @@ void FillFieldSelect(weld::TreeView& rListBox)
         rListBox.append_text(SwResId(FLD_SELECT[i]));
 }
 
-SwFieldDokInfPage::SwFieldDokInfPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
-    :  SwFieldPage(pParent, "FieldDocInfoPage",
-        "modules/swriter/ui/flddocinfopage.ui", pCoreSet)
-    , pSelEntry(nullptr)
+SwFieldDokInfPage::SwFieldDokInfPage(TabPageParent pParent, const SfxItemSet *const pCoreSet)
+    :  SwFieldPage(pParent, "modules/swriter/ui/flddocinfopage.ui", "FieldDocInfoPage", pCoreSet)
     , nOldSel(0)
     , nOldFormat(0)
+    , m_xTypeTLB(m_xBuilder->weld_tree_view("type"))
+    , m_xSelection(m_xBuilder->weld_widget("selectframe"))
+    , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
+    , m_xFormat(m_xBuilder->weld_widget("formatframe"))
+    , m_xFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("format")))
+    , m_xFixedCB(m_xBuilder->weld_check_button("fixed"))
 {
-    get(m_pTypeTLB, "type");
-    get(m_pSelection, "selectframe");
-    get(m_pFormat, "formatframe");
-    get(m_pSelectionLB, "select");
-    FillFieldSelect(*m_pSelectionLB);
-    get(m_pFormatLB, "format");
-    get(m_pFixedCB, "fixed");
-
-    long nHeight = m_pTypeTLB->GetTextHeight() * 20;
-    m_pTypeTLB->set_height_request(nHeight);
-    m_pSelectionLB->set_height_request(nHeight);
-    m_pFormatLB->set_height_request(nHeight);
-
-    long nWidth = m_pTypeTLB->LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
-    m_pTypeTLB->set_width_request(nWidth);
-    m_pFormatLB->set_width_request(nWidth);
-    m_pSelectionLB->set_width_request(nWidth);
-
-    m_pTypeTLB->SetSelectionMode(SelectionMode::Single);
-    m_pTypeTLB->SetStyle(m_pTypeTLB->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL);
-    m_pTypeTLB->SetOptimalImageIndent();
-    // Don't set font, so that the control's font is adopted!
-    // Otherwise at wrong font bug to OV.
-    m_pTypeTLB->SetSpaceBetweenEntries(0);
-
-    m_pTypeTLB->SetNodeDefaultImages();
+    m_xTypeTLB->make_sorted();
+    FillFieldSelect(*m_xSelectionLB);
+
+    auto nWidth = LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
+    auto nHeight = m_xTypeTLB->get_height_rows(20);
+    m_xTypeTLB->set_size_request(nWidth, nHeight);
+    m_xFormatLB->get_widget().set_size_request(nWidth, nHeight);
+    m_xSelectionLB->set_size_request(nWidth, nHeight);
+
     //enable 'active' language selection
-    m_pFormatLB->SetShowLanguageControl(true);
+    m_xFormatLB->SetShowLanguageControl(true);
 
     const SfxUnoAnyItem* pItem = pCoreSet
         ? pCoreSet->GetItem<SfxUnoAnyItem>(SID_DOCINFO, false)
@@ -106,31 +93,16 @@ SwFieldDokInfPage::~SwFieldDokInfPage()
     disposeOnce();
 }
 
-void SwFieldDokInfPage::dispose()
-{
-    m_pTypeTLB.clear();
-    m_pSelection.clear();
-    m_pSelectionLB.clear();
-    m_pFormat.clear();
-    m_pFormatLB.clear();
-    m_pFixedCB.clear();
-    SwFieldPage::dispose();
-}
-
 void SwFieldDokInfPage::Reset(const SfxItemSet* )
 {
     Init(); // general initialisation
 
     // initialise TypeListBox
-    m_pTypeTLB->SetUpdateMode(false);
-    m_pTypeTLB->Clear();
-    pSelEntry = nullptr;
+    m_xTypeTLB->freeze();
+    m_xTypeTLB->clear();
+    m_xSelEntry.reset();
 
     // display SubTypes in TypeLB
-    SvTreeListEntry* pEntry = nullptr;
-
-    SvTreeListEntry* pInfo = nullptr;
-
     sal_uInt16 nSubType = USHRT_MAX;
     if (IsFieldEdit())
     {
@@ -140,17 +112,17 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* )
         {
             m_sOldCustomFieldName = static_cast<const SwDocInfoField*>(pCurField)->GetName();
         }
-        m_pFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+        m_xFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
         SwWrtShell *pSh = GetWrtShell();
         if(pSh)
         {
             const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
             if(pFormat)
-                m_pFormatLB->SetLanguage(pFormat->GetLanguage());
+                m_xFormatLB->SetLanguage(pFormat->GetLanguage());
         }
     }
 
-    sal_Int32 nSelEntryData = LISTBOX_ENTRY_NOTFOUND;
+    sal_Int32 nSelEntryData = -1;
     const OUString sUserData = GetUserData();
     sal_Int32 nIdx{ 0 };
     if (sUserData.getToken(0, ';', nIdx).equalsIgnoreAsciiCase(USER_DATA_VERSION_1))
@@ -160,10 +132,12 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* )
 
     std::vector<OUString> aLst;
     GetFieldMgr().GetSubTypes(TYP_DOCINFOFLD, aLst);
+    std::unique_ptr<weld::TreeIter> xEntry(m_xTypeTLB->make_iterator());
     for(size_t i = 0; i < aLst.size(); ++i)
     {
         if (!IsFieldEdit() || nSubType == i)
         {
+            const OUString sId(OUString::number(i));
             if (DI_CUSTOM == i)
             {
                 if(xCustomPropertySet.is() )
@@ -173,19 +147,23 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* )
 
                     if( rProperties.getLength() )
                     {
-                        pInfo = m_pTypeTLB->InsertEntry(SwResId(STR_CUSTOM_FIELD));
-                        pInfo->SetUserData(reinterpret_cast<void*>(USHRT_MAX));
+                        std::unique_ptr<weld::TreeIter> xInfo(m_xTypeTLB->make_iterator());
 
+                        OUString sText(SwResId(STR_CUSTOM_FIELD));
+                        OUString sEntryId(OUString::number(USHRT_MAX));
+                        m_xTypeTLB->insert(nullptr, -1, &sText, &sEntryId, nullptr,
+                                           nullptr, nullptr, false, xInfo.get());
                         for (sal_Int32 n=0; n < rProperties.getLength(); n++)
                         {
                             const OUString sEntry = rProperties[n].Name;
-                            pEntry = m_pTypeTLB->InsertEntry(sEntry, pInfo);
+
+                            m_xTypeTLB->insert(xInfo.get(), -1, &sEntry, &sId,
+                                               nullptr, nullptr, nullptr, false, xEntry.get());
                             if (m_sOldCustomFieldName == sEntry)
                             {
-                                pSelEntry = pEntry;
-                                m_pTypeTLB->Expand( pInfo );
+                                m_xSelEntry = m_xTypeTLB->make_iterator(xEntry.get());
+                                m_xTypeTLB->expand_row(*xInfo);
                             }
-                            pEntry->SetUserData(reinterpret_cast<void*>(i));
                         }
                     }
                 }
@@ -194,84 +172,81 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* )
             {
                 if (!(IsFieldDlgHtmlMode() && (i == DI_EDIT || i == DI_THEMA || i == DI_PRINT)))
                 {
-                    pEntry = m_pTypeTLB->InsertEntry(aLst[i]);
-                    pEntry->SetUserData(reinterpret_cast<void*>(i));
+                    m_xTypeTLB->insert(nullptr, -1, &aLst[i], &sId,
+                                       nullptr, nullptr, nullptr, false, xEntry.get());
                 }
             }
-            if(static_cast<size_t>(nSelEntryData) == i)
-                pSelEntry = pEntry;
+            if (static_cast<size_t>(nSelEntryData) == i)
+                m_xSelEntry = std::move(xEntry);
         }
     }
 
+    m_xTypeTLB->thaw();
+
     // select old Pos
-    if (pSelEntry != nullptr)
+    if (m_xSelEntry)
     {
-        m_pTypeTLB->Select(pSelEntry);
-        nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData()));
+        m_xTypeTLB->select(*m_xSelEntry);
+        nSubType = m_xTypeTLB->get_id(*m_xSelEntry).toUInt32();
     }
-    else if ( m_pTypeTLB->GetEntry(0) )
+    else
     {
-        pSelEntry = m_pTypeTLB->GetEntry(0);
-        nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData()));
+        m_xSelEntry = m_xTypeTLB->make_iterator();
+        if (m_xTypeTLB->get_iter_first(*m_xSelEntry))
+            nSubType = m_xTypeTLB->get_id(*m_xSelEntry).toUInt32();
+        else
+            m_xSelEntry.reset();
     }
 
     FillSelectionLB(nSubType);
-    if ( pSelEntry )
-        TypeHdl(nullptr);
+    if (m_xSelEntry)
+        TypeHdl(*m_xTypeTLB);
 
-    m_pTypeTLB->SetUpdateMode(true);
-    m_pTypeTLB->SetSelectHdl(LINK(this, SwFieldDokInfPage, TypeHdl));
-    m_pTypeTLB->SetDoubleClickHdl(LINK(this, SwFieldDokInfPage, TreeListBoxInsertHdl));
-    m_pSelectionLB->SetSelectHdl(LINK(this, SwFieldDokInfPage, SubTypeHdl));
-    m_pSelectionLB->SetDoubleClickHdl(LINK(this, SwFieldDokInfPage, ListBoxInsertHdl));
-    m_pFormatLB->SetDoubleClickHdl(LINK(this, SwFieldDokInfPage, ListBoxInsertHdl));
+    m_xTypeTLB->connect_changed(LINK(this, SwFieldDokInfPage, TypeHdl));
+    m_xTypeTLB->connect_row_activated(LINK(this, SwFieldDokInfPage, TreeViewInsertHdl));
+    m_xSelectionLB->connect_changed(LINK(this, SwFieldDokInfPage, SubTypeHdl));
+    m_xSelectionLB->connect_row_activated(LINK(this, SwFieldDokInfPage, TreeViewInsertHdl));
+    m_xFormatLB->connect_row_activated(LINK(this, SwFieldDokInfPage, TreeViewInsertHdl));
 
     if (IsFieldEdit())
     {
-        nOldSel = m_pSelectionLB->GetSelectedEntryPos();
+        nOldSel = m_xSelectionLB->get_selected_index();
         nOldFormat = GetCurField()->GetFormat();
-        m_pFixedCB->SaveValue();
+        m_xFixedCB->save_state();
     }
 }
 
-IMPL_LINK_NOARG(SwFieldDokInfPage, TypeHdl, SvTreeListBox*, void)
+IMPL_LINK_NOARG(SwFieldDokInfPage, TypeHdl, weld::TreeView&, void)
 {
-    // save old ListBoxPos
-    SvTreeListEntry* pOldEntry = pSelEntry;
-
     // current ListBoxPos
-    pSelEntry = m_pTypeTLB->FirstSelected();
-
-    if(!pSelEntry)
+    if (!m_xTypeTLB->get_selected(m_xSelEntry.get()))
     {
-        pSelEntry = m_pTypeTLB->GetEntry(0);
-        m_pTypeTLB->Select(pSelEntry);
+        m_xTypeTLB->get_iter_first(*m_xSelEntry);
+        m_xTypeTLB->select(*m_xSelEntry);
     }
-    else if (pOldEntry != pSelEntry)
-        FillSelectionLB(static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData())));
-
-    SubTypeHdl(*m_pSelectionLB);
+    FillSelectionLB(m_xTypeTLB->get_id(*m_xSelEntry).toUInt32());
+    SubTypeHdl(*m_xSelectionLB);
 }
 
-IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, weld::TreeView&, void)
 {
-    sal_uInt16 nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData()));
-    sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
+    sal_uInt16 nSubType = m_xTypeTLB->get_id(*m_xSelEntry).toUInt32();
+    sal_Int32 nPos = m_xSelectionLB->get_selected_index();
     sal_uInt16 nExtSubType;
     SvNumFormatType nNewType = SvNumFormatType::ALL;
 
     if (nSubType != DI_EDIT)
     {
-        if (nPos == LISTBOX_ENTRY_NOTFOUND)
+        if (nPos == -1)
         {
-            if (!m_pSelectionLB->GetEntryCount())
+            if (!m_xSelectionLB->n_children())
             {
-                m_pFormatLB->Clear();
-                m_pFormat->Enable(false);
+                m_xFormatLB->clear();
+                m_xFormat->set_sensitive(false);
                 if( nSubType == DI_CUSTOM )
                 {
                     //find out which type the custom field has - for a start set to DATE format
-                    const OUString sName = m_pTypeTLB->GetEntryText(pSelEntry);
+                    const OUString sName = m_xTypeTLB->get_text(*m_xSelEntry);
                     try
                     {
                         uno::Any aVal = xCustomPropertySet->getPropertyValue( sName );
@@ -299,7 +274,7 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
             nPos = 0;
         }
 
-        nExtSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+        nExtSubType = m_xSelectionLB->get_id(nPos).toUInt32();
     }
     else
         nExtSubType = DI_SUB_TIME;
@@ -308,8 +283,8 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
     bool bEnable = false;
     bool bOneArea = false;
 
-    if (m_pFormatLB->IsEnabled())
-        nOldType = m_pFormatLB->GetFormatType();
+    if (m_xFormatLB->get_active())
+        nOldType = m_xFormatLB->GetFormatType();
 
     switch (nExtSubType)
     {
@@ -328,14 +303,14 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
     }
     if (nNewType == SvNumFormatType::ALL)
     {
-        m_pFormatLB->Clear();
+        m_xFormatLB->clear();
     }
     else
     {
         if (nOldType != nNewType)
         {
-            m_pFormatLB->SetFormatType(nNewType);
-            m_pFormatLB->SetOneArea(bOneArea);
+            m_xFormatLB->SetFormatType(nNewType);
+            m_xFormatLB->SetOneArea(bOneArea);
         }
         bEnable = true;
     }
@@ -346,10 +321,10 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
 
     if (IsFieldEdit())
     {
-        nPos = m_pSelectionLB->GetSelectedEntryPos();
-        if (nPos != LISTBOX_ENTRY_NOTFOUND )
+        nPos = m_xSelectionLB->get_selected_index();
+        if (nPos != -1)
         {
-            nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+            nSubType = m_xSelectionLB->get_id(nPos).toUInt32();
 
             nOldSubType &= ~DI_SUB_FIXED;
             if (nOldSubType == nSubType)
@@ -360,28 +335,26 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, ListBox&, void)
                     if(pSh)
                     {
                         SvNumberFormatter* pFormatter = pSh->GetNumberFormatter();
-                        LanguageType eLang = m_pFormatLB->GetCurLanguage();
+                        LanguageType eLang = m_xFormatLB->GetCurLanguage();
                         if (nNewType == SvNumFormatType::DATE)
                             nFormat = pFormatter->GetFormatIndex( NF_DATE_SYSTEM_SHORT, eLang);
                         else if (nNewType == SvNumFormatType::TIME)
                             nFormat = pFormatter->GetFormatIndex( NF_TIME_HHMM, eLang);
                     }
                 }
-                m_pFormatLB->SetDefFormat(nFormat);
+                m_xFormatLB->SetDefFormat(nFormat);
             }
         }
         else if( (nSubType == DI_CUSTOM)  && (nNewType != SvNumFormatType::ALL) )
         {
-            m_pFormatLB->SetDefFormat(nFormat);
+            m_xFormatLB->SetDefFormat(nFormat);
         }
     }
 
-    m_pFormat->Enable(bEnable);
+    m_xFormat->set_sensitive(bEnable);
 
-    if (bEnable && m_pFormatLB->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
-    {
-        m_pFormatLB->SelectEntryPos(0);
-    }
+    if (bEnable && m_xFormatLB->get_selected_index() == -1)
+        m_xFormatLB->select(0);
 }
 
 sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
@@ -394,15 +367,15 @@ sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
     if (nSubType == USHRT_MAX)  // Info-Text
         nSubType = DI_SUBTYPE_BEGIN;
 
-    m_pSelectionLB->Clear();
+    m_xSelectionLB->clear();
 
     sal_uInt16 nSize = 0;
-    sal_Int32 nSelPos = LISTBOX_ENTRY_NOTFOUND;
+    sal_Int32 nSelPos = -1;
     sal_uInt16 nExtSubType = IsFieldEdit() ? (static_cast<SwDocInfoField*>(GetCurField())->GetSubType() & 0xff00) : 0;
 
     if (IsFieldEdit())
     {
-        m_pFixedCB->Check((nExtSubType & DI_SUB_FIXED) != 0);
+        m_xFixedCB->set_active((nExtSubType & DI_SUB_FIXED) != 0);
         nExtSubType = ((nExtSubType & ~DI_SUB_FIXED) >> 8) - 1;
     }
 
@@ -413,12 +386,12 @@ sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
     else
     {
         nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
-        for (sal_uInt16 i = 0; i < nSize; i++)
+        for (sal_uInt16 i = 0; i < nSize; ++i)
         {
-            sal_Int32 nPos = m_pSelectionLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
-            m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId(nTypeId, i)));
+            OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, i)));
+            m_xSelectionLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
             if (IsFieldEdit() && i == nExtSubType)
-                nSelPos = nPos;
+                nSelPos = i;
         }
     }
 
@@ -426,48 +399,49 @@ sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
 
     if (nSize)
     {
-        if (!m_pSelectionLB->GetSelectedEntryCount())
-            m_pSelectionLB->SelectEntryPos(nSelPos == USHRT_MAX ? 0 : nSelPos);
-
+        if (m_xSelectionLB->get_selected_index() == -1)
+            m_xSelectionLB->select(nSelPos == USHRT_MAX ? 0 : nSelPos);
         bEnable = true;
     }
 
-    m_pSelection->Enable(bEnable);
+    m_xSelection->set_sensitive(bEnable);
 
     return nSize;
 }
 
 bool SwFieldDokInfPage::FillItemSet(SfxItemSet* )
 {
-    if (!pSelEntry || static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData())) == USHRT_MAX)
+    if (!m_xSelEntry)
         return false;
 
-    sal_uInt16 nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(pSelEntry->GetUserData()));
+    sal_uInt16 nSubType = m_xTypeTLB->get_id(*m_xSelEntry).toUInt32();
+    if (nSubType == USHRT_MAX)
+        return false;
 
     sal_uInt32 nFormat = 0;
 
-    sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
+    sal_Int32 nPos = m_xSelectionLB->get_selected_index();
 
     OUString aName;
     if (DI_CUSTOM == nSubType)
-        aName = m_pTypeTLB->GetEntryText(pSelEntry);
+        aName = m_xTypeTLB->get_text(*m_xSelEntry);
 
-    if (nPos != LISTBOX_ENTRY_NOTFOUND)
-        nSubType |= static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+    if (nPos != -1)
+        nSubType |= m_xSelectionLB->get_id(nPos).toUInt32();
 
-    if (m_pFixedCB->IsChecked())
+    if (m_xFixedCB->get_active())
         nSubType |= DI_SUB_FIXED;
 
-    nPos = m_pFormatLB->GetSelectedEntryPos();
-    if(nPos != LISTBOX_ENTRY_NOTFOUND)
-        nFormat = m_pFormatLB->GetFormat();
+    nPos = m_xFormatLB->get_selected_index();
+    if(nPos != -1)
+        nFormat = m_xFormatLB->GetFormat();
 
-    if (!IsFieldEdit() || nOldSel != m_pSelectionLB->GetSelectedEntryPos() ||
-        nOldFormat != nFormat || m_pFixedCB->IsValueChangedFromSaved()
+    if (!IsFieldEdit() || nOldSel != m_xSelectionLB->get_selected_index() ||
+        nOldFormat != nFormat || m_xFixedCB->get_state_changed_from_saved()
         || (DI_CUSTOM == nSubType && aName != m_sOldCustomFieldName ))
     {
         InsertField(TYP_DOCINFOFLD, nSubType, aName, OUString(), nFormat,
-                ' ', m_pFormatLB->IsAutomaticLanguage());
+                ' ', m_xFormatLB->IsAutomaticLanguage());
     }
 
     return false;
@@ -476,7 +450,7 @@ bool SwFieldDokInfPage::FillItemSet(SfxItemSet* )
 VclPtr<SfxTabPage> SwFieldDokInfPage::Create( TabPageParent pParent,
                                             const SfxItemSet *const pAttrSet)
 {
-    return VclPtr<SwFieldDokInfPage>::Create( pParent.pParent, pAttrSet );
+    return VclPtr<SwFieldDokInfPage>::Create(pParent, pAttrSet);
 }
 
 sal_uInt16 SwFieldDokInfPage::GetGroup()
@@ -484,10 +458,10 @@ sal_uInt16 SwFieldDokInfPage::GetGroup()
     return GRP_REG;
 }
 
-void    SwFieldDokInfPage::FillUserData()
+void SwFieldDokInfPage::FillUserData()
 {
-    SvTreeListEntry* pEntry = m_pTypeTLB->FirstSelected();
-    sal_uInt16 nTypeSel = pEntry ? sal::static_int_cast< sal_uInt16 >(reinterpret_cast< sal_uIntPtr >(pEntry->GetUserData())) : USHRT_MAX;
+    int nEntry = m_xTypeTLB->get_selected_index();
+    sal_uInt16 nTypeSel = nEntry != -1 ? m_xTypeTLB->get_id(nEntry).toUInt32() : USHRT_MAX;
     SetUserData(USER_DATA_VERSION ";" + OUString::number( nTypeSel ));
 }
 
diff --git a/sw/source/ui/fldui/flddinf.hxx b/sw/source/ui/fldui/flddinf.hxx
index d583f53fd88e..f62b340811c2 100644
--- a/sw/source/ui/fldui/flddinf.hxx
+++ b/sw/source/ui/fldui/flddinf.hxx
@@ -35,22 +35,22 @@ namespace com{namespace sun{ namespace star{ namespace beans{
 
 class SwFieldDokInfPage : public SwFieldPage
 {
-    VclPtr<SvTreeListBox>      m_pTypeTLB;
-    VclPtr<VclContainer>       m_pSelection;
-    VclPtr<ListBox>            m_pSelectionLB;
-    VclPtr<VclContainer>       m_pFormat;
-    VclPtr<NumFormatListBox>   m_pFormatLB;
-    VclPtr<CheckBox>           m_pFixedCB;
-
-    SvTreeListEntry*        pSelEntry;
+    std::unique_ptr<weld::TreeIter> m_xSelEntry;
     css::uno::Reference < css::beans::XPropertySet > xCustomPropertySet;
 
     sal_Int32               nOldSel;
     sal_uLong               nOldFormat;
     OUString                m_sOldCustomFieldName;
 
-    DECL_LINK(TypeHdl, SvTreeListBox*, void);
-    DECL_LINK(SubTypeHdl, ListBox&, void);
+    std::unique_ptr<weld::TreeView> m_xTypeTLB;
+    std::unique_ptr<weld::Widget> m_xSelection;
+    std::unique_ptr<weld::TreeView> m_xSelectionLB;
+    std::unique_ptr<weld::Widget> m_xFormat;
+    std::unique_ptr<SwNumFormatTreeView> m_xFormatLB;
+    std::unique_ptr<weld::CheckButton> m_xFixedCB;
+
+    DECL_LINK(TypeHdl, weld::TreeView&, void);
+    DECL_LINK(SubTypeHdl, weld::TreeView&, void);
 
     sal_Int32               FillSelectionLB(sal_uInt16 nSubTypeId);
 
@@ -58,10 +58,8 @@ protected:
     virtual sal_uInt16      GetGroup() override;
 
 public:
-                        SwFieldDokInfPage(vcl::Window* pWindow, const SfxItemSet* pSet);
-
-                        virtual ~SwFieldDokInfPage() override;
-    virtual void        dispose() override;
+    SwFieldDokInfPage(TabPageParent pWindow, const SfxItemSet* pSet);
+    virtual ~SwFieldDokInfPage() override;
 
     static VclPtr<SfxTabPage>  Create(TabPageParent pParent, const SfxItemSet* rAttrSet);
 
diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx
index cee592194eb6..79fcafeee97c 100644
--- a/sw/source/uibase/inc/numfmtlb.hxx
+++ b/sw/source/uibase/inc/numfmtlb.hxx
@@ -84,6 +84,7 @@ public:
     void SetAutomaticLanguage(bool bSet) { bUseAutomaticLanguage = bSet; }
     bool IsAutomaticLanguage()const { return bUseAutomaticLanguage; }
     SvNumFormatType GetFormatType() const { return nCurrFormatType; }
+    LanguageType GetCurLanguage() const { return eCurLanguage;}
     void SetLanguage(LanguageType eSet)  { eCurLanguage = eSet; }
     void SetShowLanguageControl(bool bSet) { bShowLanguageControl = bSet; }
     void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
diff --git a/sw/uiconfig/swriter/ui/flddocinfopage.ui b/sw/uiconfig/swriter/ui/flddocinfopage.ui
index f27cc6776d27..9354b258e4da 100644
--- a/sw/uiconfig/swriter/ui/flddocinfopage.ui
+++ b/sw/uiconfig/swriter/ui/flddocinfopage.ui
@@ -1,7 +1,31 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore2">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore3">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkBox" id="FieldDocInfoPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -22,13 +46,37 @@
             <property name="hexpand">True</property>
             <property name="top_padding">6</property>
             <child>
-              <object class="vcllo-SvTreeListBox" id="type:border">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="type">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore1</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">True</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection1"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
                 </child>
               </object>
             </child>
@@ -38,9 +86,9 @@
           <object class="GtkLabel" id="label1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" context="flddocinfopage|label1">_Type</property>
             <property name="use_underline">True</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -67,15 +115,37 @@
             <property name="hexpand">True</property>
             <property name="top_padding">6</property>
             <child>
-              <object class="GtkTreeView" id="select:border">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="model">liststore1</property>
-                <property name="show_expanders">False</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection3"/>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="select">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore2</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection2"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
                 </child>
               </object>
             </child>
@@ -85,9 +155,9 @@
           <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" context="flddocinfopage|label2">S_elect</property>
             <property name="use_underline">True</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -121,12 +191,38 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="swlo-NumFormatListBox" id="format:border">
+                  <object class="GtkScrolledWindow">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <property name="dropdown">False</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <object class="GtkTreeView" id="format">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="model">liststore3</property>
+                        <property name="headers_visible">False</property>
+                        <property name="headers_clickable">False</property>
+                        <property name="search_column">0</property>
+                        <property name="show_expanders">False</property>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" id="treeview-selection3"/>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                            <child>
+                              <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -158,9 +254,9 @@
           <object class="GtkLabel" id="label3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" context="flddocinfopage|label3">F_ormat</property>
             <property name="use_underline">True</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -174,19 +270,13 @@
       </packing>
     </child>
   </object>
-  <object class="GtkTreeStore" id="liststore1">
-    <columns>
-      <!-- column-name gchararray1 -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkSizeGroup" id="sizegroup1">
     <property name="mode">both</property>
     <property name="ignore_hidden">True</property>
     <widgets>
-      <widget name="type:border"/>
-      <widget name="select:border"/>
-      <widget name="format:border"/>
+      <widget name="type"/>
+      <widget name="select"/>
+      <widget name="format"/>
     </widgets>
   </object>
 </interface>
commit 263684239168d88ae42637f72640048bd04e1aec
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 19 10:48:01 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Mar 19 18:45:53 2019 +0100

    weld SwFieldDokPage
    
    Change-Id: Ie6c450b9f9f704d75bf9e9f6b3c6ab890fc04f8d
    Reviewed-on: https://gerrit.libreoffice.org/69418
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 2b68cecac158..7cee887a6687 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -32,48 +32,44 @@
 #define USER_DATA_VERSION_1 "1"
 #define USER_DATA_VERSION USER_DATA_VERSION_1
 
-SwFieldDokPage::SwFieldDokPage(vcl::Window* pParent, const SfxItemSet *const pCoreSet)
-    : SwFieldPage(pParent, "FieldDocumentPage",
-        "modules/swriter/ui/flddocumentpage.ui", pCoreSet)
+SwFieldDokPage::SwFieldDokPage(TabPageParent pParent, const SfxItemSet *const pCoreSet)
+    : SwFieldPage(pParent, "modules/swriter/ui/flddocumentpage.ui",
+                  "FieldDocumentPage", pCoreSet)
     , nOldSel(0)
     , nOldFormat(0)
+    , m_xTypeLB(m_xBuilder->weld_tree_view("type"))
+    , m_xSelection(m_xBuilder->weld_widget("selectframe"))
+    , m_xSelectionLB(m_xBuilder->weld_tree_view("select"))
+    , m_xValueFT(m_xBuilder->weld_label("valueft"))
+    , m_xValueED(m_xBuilder->weld_entry("value"))
+    , m_xLevelFT(m_xBuilder->weld_label("levelft"))
+    , m_xLevelED(m_xBuilder->weld_spin_button("level"))
+    , m_xDateFT(m_xBuilder->weld_label("daysft"))
+    , m_xTimeFT(m_xBuilder->weld_label("minutesft"))
+    , m_xDateOffsetED(m_xBuilder->weld_spin_button("offset"))
+    , m_xFormat(m_xBuilder->weld_widget("formatframe"))
+    , m_xFormatLB(m_xBuilder->weld_tree_view("format"))
+    , m_xNumFormatLB(new SwNumFormatTreeView(m_xBuilder->weld_tree_view("numformat")))
+    , m_xFixedCB(m_xBuilder->weld_check_button("fixed"))
 {
-    get(m_pSelection, "selectframe");
-    get(m_pFormat, "formatframe");
-    get(m_pTypeLB, "type");
-    m_pTypeLB->SetStyle(m_pTypeLB->GetStyle() | WB_SORT);
-    get(m_pSelectionLB, "select");
-    get(m_pValueFT, "valueft");
-    get(m_pValueED, "value");
-    get(m_pLevelFT, "levelft");
-    get(m_pLevelED, "level");
-    get(m_pDateFT, "daysft");
-    get(m_pTimeFT, "minutesft");
-    get(m_pDateOffsetED, "offset");
-    get(m_pFormatLB, "format");
-    m_pFormatLB->SetStyle(m_pFormatLB->GetStyle() | WB_SORT);
-    get(m_pNumFormatLB, "numformat");
-    get(m_pFixedCB, "fixed");
-
-    long nHeight = m_pTypeLB->GetTextHeight() * 20;
-    m_pTypeLB->set_height_request(nHeight);
-    m_pSelectionLB->set_height_request(nHeight);
-    m_pFormatLB->set_height_request(nHeight);
-
-    long nWidth = m_pTypeLB->LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
-    m_pTypeLB->set_width_request(nWidth);
-    m_pSelectionLB->set_width_request(nWidth);
-    m_pFormatLB->set_width_request(nWidth);
-
-    m_pSelectionLB->SetDoubleClickHdl(LINK(this, SwFieldDokPage, ListBoxInsertHdl));
-    m_pFormatLB->SetDoubleClickHdl(LINK(this, SwFieldDokPage, ListBoxInsertHdl));
-    m_pNumFormatLB->SetDoubleClickHdl(LINK(this, SwFieldDokPage, NumFormatHdl));
-
-    m_pLevelED->SetMax(MAXLEVEL);
-    m_pDateOffsetED->SetMin(LONG_MIN);
-    m_pDateOffsetED->SetMax(LONG_MAX);
+    m_xTypeLB->make_sorted();
+    m_xFormatLB->make_sorted();
+
+    auto nWidth = LogicToPixel(Size(FIELD_COLUMN_WIDTH, 0), MapMode(MapUnit::MapAppFont)).Width();
+    auto nHeight = m_xTypeLB->get_height_rows(20);
+
+    m_xTypeLB->set_size_request(nWidth, nHeight);
+    m_xSelectionLB->set_size_request(nWidth, nHeight);
+    m_xFormatLB->set_size_request(nWidth, nHeight);
+
+    m_xSelectionLB->connect_row_activated(LINK(this, SwFieldDokPage, TreeViewInsertHdl));
+    m_xFormatLB->connect_row_activated(LINK(this, SwFieldDokPage, TreeViewInsertHdl));
+    m_xNumFormatLB->connect_row_activated(LINK(this, SwFieldDokPage, NumFormatHdl));
+
+    m_xLevelED->set_max(MAXLEVEL);
+    m_xDateOffsetED->set_range(INT_MIN, INT_MAX);
     //enable 'active' language selection
-    m_pNumFormatLB->SetShowLanguageControl(true);
+    m_xNumFormatLB->SetShowLanguageControl(true);
 }
 
 SwFieldDokPage::~SwFieldDokPage()
@@ -81,38 +77,16 @@ SwFieldDokPage::~SwFieldDokPage()
     disposeOnce();
 }
 
-void SwFieldDokPage::dispose()
-{
-    m_pTypeLB.clear();
-    m_pSelection.clear();
-    m_pSelectionLB.clear();
-    m_pValueFT.clear();
-    m_pValueED.clear();
-    m_pLevelFT.clear();
-    m_pLevelED.clear();
-    m_pDateFT.clear();
-    m_pTimeFT.clear();
-    m_pDateOffsetED.clear();
-    m_pFormat.clear();
-    m_pFormatLB.clear();
-    m_pNumFormatLB.clear();
-    m_pFixedCB.clear();
-    SwFieldPage::dispose();
-}
-
-
 void SwFieldDokPage::Reset(const SfxItemSet* )
 {
-    SavePos(m_pTypeLB);
+    SavePos(*m_xTypeLB);
     Init(); // general initialisation
 
     // initialise TypeListBox
     const SwFieldGroupRgn& rRg = SwFieldMgr::GetGroupRange(IsFieldDlgHtmlMode(), GetGroup());
 
-    m_pTypeLB->SetUpdateMode(false);
-    m_pTypeLB->Clear();
-
-    sal_Int32 nPos;
+    m_xTypeLB->freeze();
+    m_xTypeLB->clear();
 
     if (!IsFieldEdit())
     {
@@ -129,15 +103,13 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
                 case TYP_PAGENUMBERFLD:
                     if (!bPage)
                     {
-                        nPos = m_pTypeLB->InsertEntry(SwResId(FMT_REF_PAGE));
-                        m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(USHRT_MAX));
+                        m_xTypeLB->append(OUString::number(USHRT_MAX), SwResId(FMT_REF_PAGE));
                         bPage = true;
                     }
                     break;
 
                 default:
-                    nPos = m_pTypeLB->InsertEntry(SwFieldMgr::GetTypeStr(i));
-                    m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+                    m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
                     break;
             }
         }
@@ -150,9 +122,8 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
             nTypeId = TYP_DATEFLD;
         if (nTypeId == TYP_FIXTIMEFLD)
             nTypeId = TYP_TIMEFLD;
-        nPos = m_pTypeLB->InsertEntry(SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
-        m_pTypeLB->SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
-        m_pNumFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
+        m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
+        m_xNumFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
         SwWrtShell *pSh = GetWrtShell();
         if(!pSh)
             pSh = ::GetActiveWrtShell();
@@ -160,17 +131,19 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
         {
             const SvNumberformat* pFormat = pSh->GetNumberFormatter()->GetEntry(pCurField->GetFormat());
             if(pFormat)
-                m_pNumFormatLB->SetLanguage(pFormat->GetLanguage());
+                m_xNumFormatLB->SetLanguage(pFormat->GetLanguage());
         }
     }
 
+
+    m_xTypeLB->thaw();
+
     // select old Pos
-    RestorePos(m_pTypeLB);
+    RestorePos(*m_xTypeLB);
 
-    m_pTypeLB->SetUpdateMode(true);
-    m_pTypeLB->SetDoubleClickHdl(LINK(this, SwFieldDokPage, ListBoxInsertHdl));
-    m_pTypeLB->SetSelectHdl(LINK(this, SwFieldDokPage, TypeHdl));
-    m_pFormatLB->SetSelectHdl(LINK(this, SwFieldDokPage, FormatHdl));
+    m_xTypeLB->connect_row_activated(LINK(this, SwFieldDokPage, TreeViewInsertHdl));
+    m_xTypeLB->connect_changed(LINK(this, SwFieldDokPage, TypeHdl));
+    m_xFormatLB->connect_changed(LINK(this, SwFieldDokPage, FormatHdl));
 
     if( !IsRefresh() )
     {
@@ -181,40 +154,42 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
             const sal_uInt16 nVal = static_cast< sal_uInt16 >(sUserData.getToken(0, ';', nIdx).toInt32());
             if(nVal != USHRT_MAX)
             {
-                for(sal_Int32 i = 0; i < m_pTypeLB->GetEntryCount(); i++)
-                    if(nVal == static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(i))))
+                for (int i = 0, nEntryCount = m_xTypeLB->n_children(); i < nEntryCount; i++)
+                {
+                    if (nVal == m_xTypeLB->get_id(i).toUInt32())
                     {
-                        m_pTypeLB->SelectEntryPos(i);
+                        m_xTypeLB->select(i);
                         break;
                     }
+                }
             }
         }
     }
-    TypeHdl(*m_pTypeLB);
+    TypeHdl(*m_xTypeLB);
 
     if (IsFieldEdit())
     {
-        nOldSel = m_pSelectionLB->GetSelectedEntryPos();
+        nOldSel = m_xSelectionLB->get_selected_index();
         nOldFormat = GetCurField()->GetFormat();
-        m_pFixedCB->SaveValue();
-        m_pValueED->SaveValue();
-        m_pLevelED->SaveValue();
-        m_pDateOffsetED->SaveValue();
+        m_xFixedCB->save_state();
+        m_xValueED->save_value();
+        m_xLevelED->save_value();
+        m_xDateOffsetED->save_value();
     }
 }
 
-IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
 {
     // save old ListBoxPos
     const sal_Int32 nOld = GetTypeSel();
 
     // current ListBoxPos
-    SetTypeSel(m_pTypeLB->GetSelectedEntryPos());
+    SetTypeSel(m_xTypeLB->get_selected_index());
 
-    if(GetTypeSel() == LISTBOX_ENTRY_NOTFOUND)
+    if(GetTypeSel() == -1)
     {
         SetTypeSel(0);
-        m_pTypeLB->SelectEntryPos(0);
+        m_xTypeLB->select(0);
     }
 
     if (nOld == GetTypeSel())
@@ -222,13 +197,13 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
 
     size_t nCount;
 
-    m_pDateFT->Hide();
-    m_pTimeFT->Hide();
+    m_xDateFT->hide();
+    m_xTimeFT->hide();
 
-    sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+    sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
 
     // fill Selection-Listbox
-    m_pSelectionLB->Clear();
+    m_xSelectionLB->clear();
 
     if (nTypeId != USHRT_MAX)
     {
@@ -240,49 +215,44 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
         else
             nCount = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
 
-        size_t nPos;
-
-        for(size_t i = 0; i < nCount; ++i)
+        for (size_t i = 0; i < nCount; ++i)
         {
             if (!IsFieldEdit())
             {
+                OUString sId(OUString::number(i));
                 if (nTypeId != TYP_AUTHORFLD)
-                    nPos = m_pSelectionLB->InsertEntry(aLst[i]);
+                    m_xSelectionLB->append(sId, aLst[i]);
                 else
-                    nPos = m_pSelectionLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
-
-                m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+                    m_xSelectionLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
             }
             else
             {
                 bool bInsert = false;
 
+                OUString sId(OUString::number(i));
+
                 switch (nTypeId)
                 {
                     case TYP_DATEFLD:
                     case TYP_TIMEFLD:
-                        nPos = m_pSelectionLB->InsertEntry(aLst[i]);
-                        m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+                        m_xSelectionLB->append(sId, aLst[i]);
                         if (static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && !i)
-                            m_pSelectionLB->SelectEntryPos(nPos);
+                            m_xSelectionLB->select_id(sId);
                         if (!static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && i)
-                            m_pSelectionLB->SelectEntryPos(nPos);
+                            m_xSelectionLB->select_id(sId);
                         break;
-
                     case TYP_EXTUSERFLD:
                     case TYP_DOCSTATFLD:
-                        nPos = m_pSelectionLB->InsertEntry(aLst[i]);
-                        m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+                        m_xSelectionLB->append(sId, aLst[i]);
                         if (GetCurField()->GetSubType() == i)
-                            m_pSelectionLB->SelectEntryPos(nPos);
+                            m_xSelectionLB->select_id(sId);
                         break;
 
                     case TYP_AUTHORFLD:
                     {
                         const OUString sFormat(GetFieldMgr().GetFormatStr(nTypeId, i));
-                        nPos = m_pSelectionLB->InsertEntry(sFormat);
-                        m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
-                        m_pSelectionLB->SelectEntry(GetFieldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
+                        m_xSelectionLB->append(sId, sFormat);
+                        m_xSelectionLB->select_text(GetFieldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
                         break;
                     }
 
@@ -293,30 +263,29 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
                 }
                 if (bInsert)
                 {
-                    nPos = m_pSelectionLB->InsertEntry(aLst[i]);
-                    m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+                    m_xSelectionLB->append(sId, aLst[i]);
                     break;
                 }
             }
         }
-        m_pSelectionLB->SetSelectHdl(Link<ListBox&,void>());
+        m_xSelectionLB->connect_changed(Link<weld::TreeView&,void>());
     }
     else
     {
         AddSubType(TYP_PAGENUMBERFLD);
         AddSubType(TYP_PREVPAGEFLD);
         AddSubType(TYP_NEXTPAGEFLD);
-        nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(0)));
+        nTypeId = m_xSelectionLB->get_id(0).toUInt32();
         nCount = 3;
-        m_pSelectionLB->SetSelectHdl(LINK(this, SwFieldDokPage, SubTypeHdl));
+        m_xSelectionLB->connect_changed(LINK(this, SwFieldDokPage, SubTypeHdl));
     }
 
     bool bEnable = nCount != 0;
 
-    if (bEnable && !m_pSelectionLB->GetSelectedEntryCount())
-        m_pSelectionLB->SelectEntryPos(0);
+    if (bEnable && m_xSelectionLB->get_selected_index() == -1)
+        m_xSelectionLB->select(0);
 
-    m_pSelection->Enable( bEnable );
+    m_xSelection->set_sensitive( bEnable );
 
     // fill Format-Listbox
     sal_Int32 nSize = FillFormatLB(nTypeId);
@@ -334,13 +303,12 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
 
             nFormatType = SvNumFormatType::DATE;
 
-            m_pDateFT->Show();
+            m_xDateFT->show();
 
-            m_pDateOffsetED->SetFirst(-31);    // one month
-            m_pDateOffsetED->SetLast(31);
+            m_xDateOffsetED->set_range(-31, 31);    // one month
 
             if (IsFieldEdit())
-                m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() / 24 / 60);
+                m_xDateOffsetED->set_value( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() / 24 / 60);
             break;
 
         case TYP_TIMEFLD:
@@ -348,51 +316,49 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
 
             nFormatType = SvNumFormatType::TIME;
 
-            m_pTimeFT->Show();
+            m_xTimeFT->show();
 
-            m_pDateOffsetED->SetFirst(-1440);  // one day
-            m_pDateOffsetED->SetLast(1440);
+            m_xDateOffsetED->set_range(-1440, 1440);  // one day
 
             if (IsFieldEdit())
-                m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() );
+                m_xDateOffsetED->set_value( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() );
             break;
 
         case TYP_PREVPAGEFLD:
         case TYP_NEXTPAGEFLD:
             if (IsFieldEdit())
             {
-                const sal_uInt16 nTmp = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(
-                                        m_pFormatLB->GetSelectedEntryPos() )));
+                const sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
 
                 if(SVX_NUM_CHAR_SPECIAL != nTmp)
                 {
                     sal_Int32 nOff = GetCurField()->GetPar2().toInt32();
                     if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
-                        m_pValueED->SetText(
+                        m_xValueED->set_text(
                             OUString::number(nOff - 1) );
                     else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
-                        m_pValueED->SetText(
+                        m_xValueED->set_text(
                             OUString::number(nOff + 1) );
                     else
-                        m_pValueED->SetText(OUString());
+                        m_xValueED->set_text(OUString());
                 }
                 else
-                    m_pValueED->SetText(static_cast<SwPageNumberField*>(GetCurField())->GetUserString());
+                    m_xValueED->set_text(static_cast<SwPageNumberField*>(GetCurField())->GetUserString());
             }
             bValue = true;
             break;
 
         case TYP_CHAPTERFLD:
-            m_pValueFT->SetText(SwResId(STR_LEVEL));
+            m_xValueFT->set_label(SwResId(STR_LEVEL));
             if (IsFieldEdit())
-                m_pLevelED->SetText(OUString::number(static_cast<SwChapterField*>(GetCurField())->GetLevel(GetWrtShell()->GetLayout()) + 1));
+                m_xLevelED->set_text(OUString::number(static_cast<SwChapterField*>(GetCurField())->GetLevel(GetWrtShell()->GetLayout()) + 1));
             bLevel = true;
             break;
 
         case TYP_PAGENUMBERFLD:
-            m_pValueFT->SetText( SwResId( STR_OFFSET ));
+            m_xValueFT->set_label( SwResId( STR_OFFSET ));
             if (IsFieldEdit())
-                m_pValueED->SetText(GetCurField()->GetPar2());
+                m_xValueED->set_text(GetCurField()->GetPar2());
             bValue = true;
             break;
 
@@ -410,60 +376,58 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
     {
         if (IsFieldEdit())
         {
-            m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+            m_xNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
 
-            if (m_pNumFormatLB->GetFormatType() == (SvNumFormatType::DATE|SvNumFormatType::TIME))
+            if (m_xNumFormatLB->GetFormatType() == (SvNumFormatType::DATE|SvNumFormatType::TIME))
             {
                 // always set Format-Type because otherwise when date/time formats are combined,
                 // both formats would be displayed at the same time
-                m_pNumFormatLB->SetFormatType(SvNumFormatType::ALL);
-                m_pNumFormatLB->SetFormatType(nFormatType);
+                m_xNumFormatLB->SetFormatType(SvNumFormatType::ALL);
+                m_xNumFormatLB->SetFormatType(nFormatType);
                 // set correct format once again
-                m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+                m_xNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
             }
         }
         else
-            m_pNumFormatLB->SetFormatType(nFormatType);
+            m_xNumFormatLB->SetFormatType(nFormatType);
 
-        m_pNumFormatLB->SetOneArea(bOneArea);
+        m_xNumFormatLB->SetOneArea(bOneArea);
     }
 
-    m_pFormatLB->Show(!bNumFormat);
-    m_pNumFormatLB->Show(bNumFormat);
+    m_xFormatLB->set_visible(!bNumFormat);
+    m_xNumFormatLB->set_visible(bNumFormat);
 
-    m_pValueFT->Show(bValue);
-    m_pValueED->Show(bValue);
-    m_pLevelFT->Show(bLevel);
-    m_pLevelED->Show(bLevel);
-    m_pDateOffsetED->Show(bOffset);
-    m_pFixedCB->Show(!bValue && !bLevel && !bOffset);
+    m_xValueFT->set_visible(bValue);
+    m_xValueED->set_visible(bValue);
+    m_xLevelFT->set_visible(bLevel);
+    m_xLevelED->set_visible(bLevel);
+    m_xDateOffsetED->set_visible(bOffset);
+    m_xFixedCB->set_visible(!bValue && !bLevel && !bOffset);
 
-    m_pFormat->Enable(bFormat);
-    m_pFixedCB->Enable(bFixed);
+    m_xFormat->set_sensitive(bFormat);
+    m_xFixedCB->set_sensitive(bFixed);
 
     if (IsFieldEdit())
-        m_pFixedCB->Check( (GetCurField()->GetFormat() & AF_FIXED) != 0 && bFixed );
-
-    if (m_pNumFormatLB->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
-        m_pNumFormatLB->SelectEntryPos(0);
-    m_pValueFT->Enable(bValue || bLevel || bOffset);
-    m_pValueED->Enable(bValue);
+        m_xFixedCB->set_active((GetCurField()->GetFormat() & AF_FIXED) != 0 && bFixed);
 
+    if (m_xNumFormatLB->get_selected_index() == -1)
+        m_xNumFormatLB->select(0);
+    m_xValueFT->set_sensitive(bValue || bLevel || bOffset);
+    m_xValueED->set_sensitive(bValue);
 }
 
 void SwFieldDokPage::AddSubType(sal_uInt16 nTypeId)
 {
-    const sal_Int32 nPos = m_pSelectionLB->InsertEntry(SwFieldType::GetTypeStr(nTypeId));
-    m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(nTypeId));
+    m_xSelectionLB->append(OUString::number(nTypeId), SwFieldType::GetTypeStr(nTypeId));
 }
 
-IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, weld::TreeView&, void)
 {
-    sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
-    if(nPos == LISTBOX_ENTRY_NOTFOUND)
+    sal_Int32 nPos = m_xSelectionLB->get_selected_index();
+    if(nPos == -1)
         nPos = 0;
 
-    const sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+    const sal_uInt16 nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
     FillFormatLB(nTypeId);
 
     const char* pTextRes = nullptr;
@@ -475,8 +439,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, ListBox&, void)
 
     case TYP_PREVPAGEFLD:
     case TYP_NEXTPAGEFLD:
-        pTextRes = SVX_NUM_CHAR_SPECIAL == static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(
-                                        m_pFormatLB->GetSelectedEntryPos() )))
+        pTextRes = SVX_NUM_CHAR_SPECIAL == m_xFormatLB->get_selected_id().toUInt32()
                         ? STR_VALUE : STR_OFFSET;
         break;
 
@@ -486,102 +449,101 @@ IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, ListBox&, void)
     }
 
     if (pTextRes)
-        m_pValueFT->SetText(SwResId(pTextRes));
+        m_xValueFT->set_label(SwResId(pTextRes));
 }
 
 sal_Int32 SwFieldDokPage::FillFormatLB(sal_uInt16 nTypeId)
 {
     // fill Format-Listbox
-    m_pFormatLB->Clear();
+    m_xFormatLB->clear();
 
     if (nTypeId == TYP_AUTHORFLD)
-        return m_pFormatLB->GetEntryCount();
+        return m_xFormatLB->n_children();
 
     const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
 
     for( sal_uInt16 i = 0; i < nSize; ++i )
     {
-        const sal_Int32 nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
         const sal_uInt16 nFormatId = GetFieldMgr().GetFormatId( nTypeId, i );
-        m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>( nFormatId ));
+        OUString sId(OUString::number(nFormatId));
+        m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
         if (IsFieldEdit() && nFormatId == (GetCurField()->GetFormat() & ~AF_FIXED))
-            m_pFormatLB->SelectEntryPos( nPos );
+            m_xFormatLB->select_id(sId);
     }
 
-    if( nSize && !m_pFormatLB->GetSelectedEntryCount() )
+    if (nSize && m_xFormatLB->get_selected_index() == -1)
     {
-        m_pFormatLB->SelectEntry( SwResId(FMT_NUM_PAGEDESC) );
-        if( !m_pFormatLB->GetSelectedEntryCount() )
+        m_xFormatLB->select_text( SwResId(FMT_NUM_PAGEDESC) );
+        if (m_xFormatLB->get_selected_index() == -1)
         {
-            m_pFormatLB->SelectEntry( SwResId(FMT_NUM_ARABIC) );
-            if( !m_pFormatLB->GetSelectedEntryCount() )
-                m_pFormatLB->SelectEntryPos( 0 );
+            m_xFormatLB->select_text( SwResId(FMT_NUM_ARABIC) );
+            if (m_xFormatLB->get_selected_index() == -1)
+                m_xFormatLB->select( 0 );
         }
     }
 
-    FormatHdl(*m_pFormatLB);
+    FormatHdl(*m_xFormatLB);
 
     return nSize;
 }
 
-IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, weld::TreeView&, void)
 {
-    sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+    sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
 
     if (nTypeId == USHRT_MAX)
     {
-        sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
-        if(nPos == LISTBOX_ENTRY_NOTFOUND)
+        sal_Int32 nPos = m_xSelectionLB->get_selected_index();
+        if(nPos == -1)
             nPos = 0;
 
-        nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+        nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
     }
 
     if (nTypeId == TYP_NEXTPAGEFLD || nTypeId == TYP_PREVPAGEFLD)
     {
         // Prev/Next - PageNumFields special treatment:
-        sal_uInt16 nTmp = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(
-                                        m_pFormatLB->GetSelectedEntryPos() )));
-        const OUString sOldText( m_pValueFT->GetText() );
+        sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
+        const OUString sOldText( m_xValueFT->get_label() );
         const OUString sNewText( SwResId( SVX_NUM_CHAR_SPECIAL == nTmp  ? STR_VALUE
                                                          : STR_OFFSET ));
 
-        if( sOldText != sNewText )
-            m_pValueFT->SetText( sNewText );
+        if (sOldText != sNewText)
+            m_xValueFT->set_label(sNewText);
 
-        if (sOldText != m_pValueFT->GetText())
-            m_pValueED->SetText(OUString());
+        if (sOldText != m_xValueFT->get_label())
+            m_xValueED->set_text(OUString());
     }
 }
 
 bool SwFieldDokPage::FillItemSet(SfxItemSet* )
 {
-    sal_uInt16 nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel())));
+    sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
 
     if (nTypeId == USHRT_MAX)
     {
-        sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
-        if(nPos == LISTBOX_ENTRY_NOTFOUND)
+        sal_Int32 nPos = m_xSelectionLB->get_selected_index();
+        if(nPos == -1)
             nPos = 0;
-        nTypeId = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+        nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
     }
 
-    OUString aVal(m_pValueED->GetText());
+    OUString aVal(m_xValueED->get_text());
     sal_uLong nFormat = 0;
     sal_uInt16 nSubType = 0;
 
-    if (m_pFormatLB->IsEnabled())
+    if (m_xFormatLB->get_sensitive())
     {
-        sal_Int32 nPos = m_pFormatLB->GetSelectedEntryPos();
-        if(nPos != LISTBOX_ENTRY_NOTFOUND)
-            nFormat = reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(nPos));
+        sal_Int32 nPos = m_xFormatLB->get_selected_index();
+        if(nPos != -1)
+            nFormat = m_xFormatLB->get_id(nPos).toUInt32();
     }
 
-    if (m_pSelectionLB->IsEnabled())
+    if (m_xSelectionLB->get_sensitive())
     {
-        sal_Int32 nPos = m_pSelectionLB->GetSelectedEntryPos();
-        if(nPos != LISTBOX_ENTRY_NOTFOUND)
-            nSubType = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(nPos)));
+        sal_Int32 nPos = m_xSelectionLB->get_selected_index();
+        if(nPos != -1)
+            nSubType = m_xSelectionLB->get_id(nPos).toUInt32();
     }
 
     switch (nTypeId)
@@ -591,18 +553,18 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
             nSubType = 0;
             [[fallthrough]];
         case TYP_EXTUSERFLD:
-            nFormat |= m_pFixedCB->IsChecked() ? AF_FIXED : 0;
+            nFormat |= m_xFixedCB->get_active() ? AF_FIXED : 0;
             break;
 
         case TYP_FILENAMEFLD:
-            nFormat |= m_pFixedCB->IsChecked() ? FF_FIXED : 0;
+            nFormat |= m_xFixedCB->get_active() ? FF_FIXED : 0;
             break;
 
         case TYP_DATEFLD:
         case TYP_TIMEFLD:
         {
-            nFormat = m_pNumFormatLB->GetFormat();
-            long nVal = static_cast< long >(m_pDateOffsetED->GetValue());
+            nFormat = m_xNumFormatLB->GetFormat();
+            long nVal = static_cast< long >(m_xDateOffsetED->get_value());
             if (nTypeId == TYP_DATEFLD)
                 aVal = OUString::number(nVal * 60 * 24);
             else
@@ -618,14 +580,14 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
             if( SVX_NUM_CHAR_SPECIAL != nFormat &&
                 (TYP_PREVPAGEFLD == nTypeId || TYP_NEXTPAGEFLD == nTypeId))
             {
-                sal_Int32 nVal = m_pValueED->GetText().toInt32();
+                sal_Int32 nVal = m_xValueED->get_text().toInt32();
                 aVal = OUString::number(nVal);
             }
             break;
         }
 
         case TYP_CHAPTERFLD:
-            aVal = m_pLevelED->GetText();
+            aVal = m_xLevelED->get_text();
             break;
 
         default:
@@ -633,23 +595,23 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
     }
 
     if (!IsFieldEdit() ||
-        nOldSel != m_pSelectionLB->GetSelectedEntryPos() ||
+        nOldSel != m_xSelectionLB->get_selected_index() ||
         nOldFormat != nFormat ||
-        m_pFixedCB->IsValueChangedFromSaved() ||
-        m_pValueED->IsValueChangedFromSaved() ||
-        m_pLevelED->IsValueChangedFromSaved() ||
-        m_pDateOffsetED->IsValueChangedFromSaved())
+        m_xFixedCB->get_state_changed_from_saved() ||
+        m_xValueED->get_value_changed_from_saved() ||
+        m_xLevelED->get_value_changed_from_saved() ||
+        m_xDateOffsetED->get_value_changed_from_saved())
     {
-        InsertField(nTypeId, nSubType, OUString(), aVal, nFormat, ' ', m_pNumFormatLB->IsAutomaticLanguage());
+        InsertField(nTypeId, nSubType, OUString(), aVal, nFormat, ' ', m_xNumFormatLB->IsAutomaticLanguage());
     }
 
     return false;
 }
 
-VclPtr<SfxTabPage> SwFieldDokPage::Create( TabPageParent pParent,
-                                         const SfxItemSet *const pAttrSet)
+VclPtr<SfxTabPage> SwFieldDokPage::Create(TabPageParent pParent,
+                                          const SfxItemSet *const pAttrSet)
 {
-    return VclPtr<SwFieldDokPage>::Create( pParent.pParent, pAttrSet );
+    return VclPtr<SwFieldDokPage>::Create(pParent, pAttrSet);
 }
 
 sal_uInt16 SwFieldDokPage::GetGroup()
@@ -659,10 +621,9 @@ sal_uInt16 SwFieldDokPage::GetGroup()
 
 void    SwFieldDokPage::FillUserData()
 {
-    const sal_Int32 nEntryPos = m_pTypeLB->GetSelectedEntryPos();
-    const sal_uInt16 nTypeSel = ( LISTBOX_ENTRY_NOTFOUND == nEntryPos )
-        ? USHRT_MAX : sal::static_int_cast< sal_uInt16 >
-            (reinterpret_cast< sal_uIntPtr >(m_pTypeLB->GetEntryData( nEntryPos )));
+    const sal_Int32 nEntryPos = m_xTypeLB->get_selected_index();
+    const sal_uInt16 nTypeSel = ( -1 == nEntryPos )
+        ? USHRT_MAX : m_xTypeLB->get_id(nEntryPos).toUInt32();
     SetUserData(USER_DATA_VERSION ";" + OUString::number( nTypeSel ));
 }
 
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
index 1a07e5afdf93..8ee99cf74b27 100644
--- a/sw/source/ui/fldui/flddok.hxx
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -31,27 +31,27 @@
 
 class SwFieldDokPage : public SwFieldPage
 {
-    VclPtr<ListBox>            m_pTypeLB;
-    VclPtr<VclContainer>       m_pSelection;
-    VclPtr<ListBox>            m_pSelectionLB;
-    VclPtr<FixedText>          m_pValueFT;
-    VclPtr<Edit>               m_pValueED;
-    VclPtr<FixedText>          m_pLevelFT;
-    VclPtr<NumericField>       m_pLevelED;
-    VclPtr<FixedText>          m_pDateFT;
-    VclPtr<FixedText>          m_pTimeFT;
-    VclPtr<NumericField>       m_pDateOffsetED;
-    VclPtr<VclContainer>       m_pFormat;
-    VclPtr<ListBox>            m_pFormatLB;
-    VclPtr<NumFormatListBox>   m_pNumFormatLB;
-    VclPtr<CheckBox>           m_pFixedCB;
-
     sal_Int32               nOldSel;
     sal_uLong               nOldFormat;
 
-    DECL_LINK(TypeHdl, ListBox&, void);
-    DECL_LINK(FormatHdl, ListBox&, void);
-    DECL_LINK(SubTypeHdl, ListBox&, void);
+    std::unique_ptr<weld::TreeView> m_xTypeLB;
+    std::unique_ptr<weld::Widget> m_xSelection;
+    std::unique_ptr<weld::TreeView> m_xSelectionLB;
+    std::unique_ptr<weld::Label> m_xValueFT;
+    std::unique_ptr<weld::Entry> m_xValueED;
+    std::unique_ptr<weld::Label> m_xLevelFT;
+    std::unique_ptr<weld::SpinButton> m_xLevelED;
+    std::unique_ptr<weld::Label> m_xDateFT;
+    std::unique_ptr<weld::Label> m_xTimeFT;
+    std::unique_ptr<weld::SpinButton> m_xDateOffsetED;
+    std::unique_ptr<weld::Widget> m_xFormat;
+    std::unique_ptr<weld::TreeView> m_xFormatLB;
+    std::unique_ptr<SwNumFormatTreeView> m_xNumFormatLB;
+    std::unique_ptr<weld::CheckButton> m_xFixedCB;
+
+    DECL_LINK(TypeHdl, weld::TreeView&, void);
+    DECL_LINK(FormatHdl, weld::TreeView&, void);
+    DECL_LINK(SubTypeHdl, weld::TreeView&, void);
 
     void                AddSubType(sal_uInt16 nTypeId);
     sal_Int32           FillFormatLB(sal_uInt16 nTypeId);
@@ -60,10 +60,9 @@ protected:
     virtual sal_uInt16      GetGroup() override;
 
 public:
-                        SwFieldDokPage(vcl::Window* pWindow, const SfxItemSet * pSet);
+    SwFieldDokPage(TabPageParent pWindow, const SfxItemSet * pSet);
 
-                        virtual ~SwFieldDokPage() override;
-    virtual void        dispose() override;
+    virtual ~SwFieldDokPage() override;
 
     static VclPtr<SfxTabPage>  Create(TabPageParent pParent, const SfxItemSet* rAttrSet);
 
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 8c961cd6fe30..1fccc557c39b 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -385,7 +385,7 @@ void SwFieldPage::EnableInsert(bool bEnable)
     m_bInsert = bEnable;
 }
 
-IMPL_LINK_NOARG(SwFieldPage, NumFormatHdl, ListBox&, void)
+IMPL_LINK_NOARG(SwFieldPage, NumFormatHdl, weld::TreeView&, void)
 {
     InsertHdl(nullptr);
 }
diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx
index 650989d51f01..e640d409d7e2 100644
--- a/sw/source/ui/fldui/fldpage.hxx
+++ b/sw/source/ui/fldui/fldpage.hxx
@@ -57,7 +57,7 @@ protected:
     DECL_LINK( ListBoxInsertHdl, ListBox&, void );
     DECL_LINK( TreeViewInsertHdl, weld::TreeView&, void );
     DECL_LINK( TreeListBoxInsertHdl, SvTreeListBox*, bool );
-    DECL_LINK( NumFormatHdl, ListBox&, void );
+    DECL_LINK( NumFormatHdl, weld::TreeView&, void );
     void                InsertHdl(void *);
 
     void                Init();
diff --git a/sw/source/uibase/inc/numfmtlb.hxx b/sw/source/uibase/inc/numfmtlb.hxx
index 6d120242b18c..cee592194eb6 100644
--- a/sw/source/uibase/inc/numfmtlb.hxx
+++ b/sw/source/uibase/inc/numfmtlb.hxx
@@ -66,39 +66,113 @@ public:
     SAL_DLLPRIVATE static double   GetDefValue(const SvNumFormatType nFormatType);
 };
 
-class SW_DLLPUBLIC SwNumFormatListBox
+class SW_DLLPUBLIC SwNumFormatBase
 {
+protected:
     SvNumFormatType     nCurrFormatType;
     bool                mbCurrFormatTypeNeedsInit;
     sal_Int32           nStdEntry;
+    bool                bOneArea;
     sal_uInt32          nDefFormat;
     LanguageType        eCurLanguage;
+    bool                bShowLanguageControl; //determine whether the language control has
+                                              //to be shown in the number format dialog
     bool                bUseAutomaticLanguage;//determine whether language is automatically assigned
+public:
+    SwNumFormatBase();
+
+    void SetAutomaticLanguage(bool bSet) { bUseAutomaticLanguage = bSet; }
+    bool IsAutomaticLanguage()const { return bUseAutomaticLanguage; }
+    SvNumFormatType GetFormatType() const { return nCurrFormatType; }
+    void SetLanguage(LanguageType eSet)  { eCurLanguage = eSet; }
+    void SetShowLanguageControl(bool bSet) { bShowLanguageControl = bSet; }
+    void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
+
+    void SetFormatType(const SvNumFormatType nFormatType);
+    void SetDefFormat(const sal_uInt32 nDefFormat);
+    virtual sal_uInt32 GetFormat() const = 0;
+
+    virtual void Init();
+    void CallSelectHdl();
+
+    virtual void clear();
+    virtual int get_count() const = 0;
+    virtual int get_active() const = 0;
+    virtual OUString get_id(int nPos) const = 0;
+    virtual OUString get_text(int nPos) const = 0;
+    virtual weld::Widget& get_widget() const = 0;
+    virtual void append(const OUString& rId, const OUString& rText) = 0;
+    virtual void append_text(const OUString& rText) = 0;
+    virtual void insert_text(int nPos, const OUString& rText) = 0;
+    virtual void set_active(int nPos) = 0;
+    virtual void set_id(int nPos, const OUString& rId) = 0;
+    virtual ~SwNumFormatBase() {}
+};
 
+class SW_DLLPUBLIC SwNumFormatListBox : public SwNumFormatBase
+{
     std::unique_ptr<weld::ComboBox> mxControl;
 
     DECL_DLLPRIVATE_LINK( SelectHdl, weld::ComboBox&, void );
 
-    SAL_DLLPRIVATE void            Init();
+    virtual void Init() override;
 
 public:
     SwNumFormatListBox(std::unique_ptr<weld::ComboBox> xControl);
 
-    ~SwNumFormatListBox();
-
-    void            clear();
+    virtual sal_uInt32 GetFormat() const override;
+
+    virtual void clear() override;
+    virtual int get_count() const override { return mxControl->get_count(); }
+    virtual int get_active() const override { return mxControl->get_active(); }
+    virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
+    virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
+    virtual weld::Widget& get_widget() const override { return *mxControl; }
+    virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
+    virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
+    virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
+    virtual void set_active(int nPos) override { mxControl->set_active(nPos); }
+    virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
     void            show() { mxControl->show(); }
     void            hide() { mxControl->hide(); }
 
-    void            SetFormatType(const SvNumFormatType nFormatType);
-    void            SetDefFormat(const sal_uInt32 nDefFormat);
-    sal_uInt32      GetFormat() const;
+    void            set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
+    void            connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); }
+};
+
+class SW_DLLPUBLIC SwNumFormatTreeView : public SwNumFormatBase
+{
+    std::unique_ptr<weld::TreeView> mxControl;
 
-    void            CallSelectHdl();
+    DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
+
+    virtual void Init() override;
+
+public:
+    SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl);
+
+    virtual sal_uInt32 GetFormat() const override;
+
+    virtual void clear() override;
+    virtual int get_count() const override { return mxControl->n_children(); }
+    virtual int get_active() const override { return mxControl->get_selected_index(); }
+    virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
+    virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
+    virtual weld::Widget& get_widget() const override { return *mxControl; }
+    virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
+    virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
+    virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
+    virtual void set_active(int nPos) override { mxControl->select(nPos); }
+    virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
+    void            show() { mxControl->show(); }
+    void            hide() { mxControl->hide(); }
+    int             get_selected_index() const { return mxControl->get_selected_index(); }
+    void            set_visible(bool bVisible) { mxControl->set_visible(bVisible); }
+    void            select(int nPos) { mxControl->select(nPos); }
+    void            connect_row_activated(const Link<weld::TreeView&, void>& rLink) { mxControl->connect_row_activated(rLink); }
 
     void            set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
-    void            connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); }
-    weld::ComboBox& get_widget() const { return *mxControl; }
+    void            connect_changed(const Link<weld::TreeView&, void>& rLink) { mxControl->connect_changed(rLink); }
 };
 
 #endif
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx
index a7766a505a1b..bd14c4cce32a 100644
--- a/sw/source/uibase/utlui/numfmtlb.cxx
+++ b/sw/source/uibase/utlui/numfmtlb.cxx
@@ -454,18 +454,30 @@ void NumFormatListBox::Clear()
     nCurrFormatType = SvNumFormatType::ALL;
 }
 
-SwNumFormatListBox::SwNumFormatListBox(std::unique_ptr<weld::ComboBox> xControl)
+SwNumFormatBase::SwNumFormatBase()
     : nCurrFormatType(SvNumFormatType::ALL)
     , mbCurrFormatTypeNeedsInit(true)
     , nStdEntry(0)
+    , bOneArea(false)
     , nDefFormat(0)
+    , bShowLanguageControl(false)
     , bUseAutomaticLanguage(true)
-    , mxControl(std::move(xControl))
+{
+}
+
+SwNumFormatListBox::SwNumFormatListBox(std::unique_ptr<weld::ComboBox> xControl)
+    : mxControl(std::move(xControl))
 {
     Init();
 }
 
-void SwNumFormatListBox::Init()
+SwNumFormatTreeView::SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl)
+    : mxControl(std::move(xControl))
+{
+    Init();
+}
+
+void SwNumFormatBase::Init()
 {
     SwView *pView = GetActiveView();
 
@@ -476,15 +488,23 @@ void SwNumFormatListBox::Init()
 
     SetFormatType(SvNumFormatType::NUMBER);
     SetDefFormat(nDefFormat);
+}
+
+void SwNumFormatListBox::Init()
+{
+    SwNumFormatBase::Init();
 
     mxControl->connect_changed(LINK(this, SwNumFormatListBox, SelectHdl));
 }
 
-SwNumFormatListBox::~SwNumFormatListBox()
+void SwNumFormatTreeView::Init()
 {
+    SwNumFormatBase::Init();
+
+    mxControl->connect_changed(LINK(this, SwNumFormatTreeView, SelectHdl));
 }
 
-void SwNumFormatListBox::SetFormatType(const SvNumFormatType nFormatType)
+void SwNumFormatBase::SetFormatType(const SvNumFormatType nFormatType)
 {
     if (!mbCurrFormatTypeNeedsInit &&
         (nCurrFormatType & nFormatType))   // there are mixed formats, like for example DateTime
@@ -599,7 +619,7 @@ void SwNumFormatListBox::SetFormatType(const SvNumFormatType nFormatType)
             nFormat != nSysShortDateFormat &&
             nFormat != nSysLongDateFormat)
         {
-            mxControl->append(OUString::number(nFormat), sValue);
+            append(OUString::number(nFormat), sValue);
 
             if( nFormat == pFormatter->GetStandardFormat(
                                     nFormatType, eCurLanguage ) )
@@ -608,16 +628,16 @@ void SwNumFormatListBox::SetFormatType(const SvNumFormatType nFormatType)
         }
     }
 
-    mxControl->append_text(SwResId(STR_DEFINE_NUMBERFORMAT));
+    append_text(SwResId(STR_DEFINE_NUMBERFORMAT));
 
-    mxControl->set_active(nStdEntry);
+    set_active(nStdEntry);
 
     nCurrFormatType = nFormatType;
     mbCurrFormatTypeNeedsInit = false;
 
 }
 
-void SwNumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
+void SwNumFormatBase::SetDefFormat(const sal_uInt32 nDefaultFormat)
 {
     if (nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
     {
@@ -638,11 +658,11 @@ void SwNumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
 
     sal_uInt32 nFormat = pFormatter->GetFormatForLanguageIfBuiltIn(nDefaultFormat, eCurLanguage);
 
-    for (sal_Int32 i = 0, nCount = mxControl->get_count(); i < nCount; ++i)
+    for (sal_Int32 i = 0, nCount = get_count(); i < nCount; ++i)
     {
-        if (nFormat == mxControl->get_id(i).toUInt32())
+        if (nFormat == get_id(i).toUInt32())
         {
-            mxControl->set_active(i);
+            set_active(i);
             nStdEntry = i;
             nDefFormat = GetFormat();
             return;
@@ -663,7 +683,7 @@ void SwNumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
     }
 
     sal_Int32 nPos = 0;
-    while (mxControl->get_id(nPos).toUInt32() == NUMBERFORMAT_ENTRY_NOT_FOUND)
+    while (get_id(nPos).toUInt32() == NUMBERFORMAT_ENTRY_NOT_FOUND)
         nPos++;
 
     if ( lcl_isSystemFormat(nDefaultFormat, pFormatter, eCurLanguage) )
@@ -671,9 +691,9 @@ void SwNumFormatListBox::SetDefFormat(const sal_uInt32 nDefaultFormat)
         sValue += SwResId(RID_STR_SYSTEM);
     }
 
-    mxControl->insert_text(nPos, sValue);   // Insert as first numeric entry
-    mxControl->set_id(nPos, OUString::number(nDefaultFormat));
-    mxControl->set_active(nPos);
+    insert_text(nPos, sValue);   // Insert as first numeric entry
+    set_id(nPos, OUString::number(nDefaultFormat));
+    set_active(nPos);
     nDefFormat = GetFormat();
 }
 
@@ -682,14 +702,18 @@ sal_uInt32 SwNumFormatListBox::GetFormat() const
     return mxControl->get_active_id().toUInt32();
 }
 
-void SwNumFormatListBox::CallSelectHdl()
+sal_uInt32 SwNumFormatTreeView::GetFormat() const
+{
+    return mxControl->get_selected_id().toUInt32();
+}
+
+void SwNumFormatBase::CallSelectHdl()
 {
-    const sal_Int32 nPos = mxControl->get_active();
+    const sal_Int32 nPos = get_active();
     OUString sDefine(SwResId( STR_DEFINE_NUMBERFORMAT ));
     SwView *pView = GetActiveView();
 
-    if( !pView || nPos != mxControl->get_count() - 1 ||
-        mxControl->get_text(nPos) != sDefine )
+    if (!pView || nPos != get_count() - 1 || get_text(nPos) != sDefine)
         return;
 
     SwWrtShell &rSh = pView->GetWrtShell();
@@ -714,13 +738,16 @@ void SwNumFormatListBox::CallSelectHdl()
                                         SID_ATTR_NUMBERFORMAT_INFO ) );
 
     if( (SvNumFormatType::DATE | SvNumFormatType::TIME) & nCurrFormatType )
-        aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false));
+        aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea));
 
-    aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, true));
+    aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl));
     aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage));
 
+    // force deselect to break mouse lock on selected entry
+    set_active(-1);
+
     SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
-    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(mxControl.get(), aCoreSet));
+    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(&get_widget(), aCoreSet));
 
     if (RET_OK == pDlg->Execute())
     {
@@ -745,7 +772,11 @@ void SwNumFormatListBox::CallSelectHdl()
             // SetDefFormat uses eCurLanguage to look for if this format already in the list
             SetDefFormat(nNumberFormat);
         }
-
+        if( bShowLanguageControl && SfxItemState::SET == pOutSet->GetItemState(
+            SID_ATTR_NUMBERFORMAT_ADD_AUTO, false, &pItem ))
+        {
+            bUseAutomaticLanguage = static_cast<const SfxBoolItem*>(pItem)->GetValue();
+        }
     }
     else
         SetDefFormat(nFormat);
@@ -757,11 +788,27 @@ IMPL_LINK_NOARG(SwNumFormatListBox, SelectHdl, weld::ComboBox&, void)
     CallSelectHdl();
 }
 
-void SwNumFormatListBox::clear()
+IMPL_LINK_NOARG(SwNumFormatTreeView, SelectHdl, weld::TreeView&, void)
+{
+    CallSelectHdl();
+}
+
+void SwNumFormatBase::clear()
 {
-    mxControl->clear();
     mbCurrFormatTypeNeedsInit = true;
     nCurrFormatType = SvNumFormatType::ALL;
 }
 
+void SwNumFormatListBox::clear()
+{
+    mxControl->clear();
+    SwNumFormatBase::clear();
+}
+
+void SwNumFormatTreeView::clear()
+{
+    mxControl->clear();
+    SwNumFormatBase::clear();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/uiconfig/swriter/ui/flddocumentpage.ui b/sw/uiconfig/swriter/ui/flddocumentpage.ui
index ff1a8dead329..b62a505c4f17 100644
--- a/sw/uiconfig/swriter/ui/flddocumentpage.ui
+++ b/sw/uiconfig/swriter/ui/flddocumentpage.ui
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
   <requires lib="LibreOffice" version="1.0"/>
@@ -9,6 +10,38 @@
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
   </object>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore2">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore3">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore4">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkBox" id="FieldDocumentPage">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -29,15 +62,37 @@
             <property name="hexpand">True</property>
             <property name="top_padding">6</property>
             <child>
-              <object class="GtkTreeView" id="type:border">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="search_column">0</property>
-                <property name="show_expanders">False</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="type">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore1</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection1"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
                 </child>
               </object>
             </child>
@@ -47,9 +102,9 @@
           <object class="GtkLabel" id="label1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" context="flddocumentpage|label1">_Type</property>
             <property name="use_underline">True</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -76,14 +131,37 @@
             <property name="hexpand">True</property>
             <property name="top_padding">6</property>
             <child>
-              <object class="GtkTreeView" id="select:border">
+              <object class="GtkScrolledWindow">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
-                <property name="show_expanders">False</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection3"/>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkTreeView" id="select">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="model">liststore2</property>
+                    <property name="headers_visible">False</property>
+                    <property name="headers_clickable">False</property>
+                    <property name="search_column">0</property>
+                    <property name="show_expanders">False</property>
+                    <child internal-child="selection">
+                      <object class="GtkTreeSelection" id="treeview-selection2"/>
+                    </child>
+                    <child>
+                      <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                        <child>
+                          <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                          <attributes>
+                            <attribute name="text">0</attribute>
+                          </attributes>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
                 </child>
               </object>
             </child>
@@ -93,9 +171,9 @@
           <object class="GtkLabel" id="label2">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" context="flddocumentpage|label2">S_elect</property>
             <property name="use_underline">True</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -137,15 +215,37 @@
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkTreeView" id="format:border">
+                      <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
-                        <property name="search_column">0</property>
-                        <property name="show_expanders">False</property>
-                        <child internal-child="selection">
-                          <object class="GtkTreeSelection" id="treeview-selection5"/>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkTreeView" id="format">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="model">liststore3</property>
+                            <property name="headers_visible">False</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="search_column">0</property>
+                            <property name="show_expanders">False</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection3"/>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext3"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
                         </child>
                       </object>
                       <packing>
@@ -155,14 +255,38 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="swlo-NumFormatListBox" id="numformat:border">
+                      <object class="GtkScrolledWindow">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
                         <property name="vexpand">True</property>
-                        <property name="entry_text_column">0</property>
-                        <property name="id_column">1</property>
-                        <property name="dropdown">False</property>
+                        <property name="shadow_type">in</property>
+                        <child>
+                          <object class="GtkTreeView" id="numformat">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="model">liststore4</property>
+                            <property name="headers_visible">False</property>
+                            <property name="headers_clickable">False</property>
+                            <property name="search_column">0</property>
+                            <property name="show_expanders">False</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection4"/>
+                            </child>
+                            <child>
+                              <object class="GtkTreeViewColumn" id="treeviewcolumn4">
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext4"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -178,9 +302,9 @@
               <object class="GtkLabel" id="label3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="flddocumentpage|label3">F_ormat</property>
                 <property name="use_underline">True</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -190,8 +314,6 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">0</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -207,8 +329,6 @@
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">1</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -220,16 +340,14 @@
               <object class="GtkLabel" id="levelft">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="flddocumentpage|levelft">Level</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">level</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -241,60 +359,51 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkSpinButton" id="offset">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="activates_default">True</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkLabel" id="daysft">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="flddocumentpage|daysft">Offs_et in days</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">offset</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">2</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
               <object class="GtkLabel" id="minutesft">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes" context="flddocumentpage|minutesft">Offs_et in minutes</property>
                 <property name="use_underline">True</property>
                 <property name="mnemonic_widget">offset</property>
+                <property name="xalign">0</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
           </object>
           <packing>
             <property name="left_attach">0</property>
             <property name="top_attach">2</property>
-            <property name="width">1</property>
-            <property name="height">1</property>
           </packing>
         </child>
         <child>
@@ -306,36 +415,31 @@

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list