[Libreoffice-commits] core.git: extras/source include/vcl sc/inc sc/source sc/uiconfig sfx2/source solenv/bin solenv/sanitizers sw/source vcl/inc vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed May 1 13:56:34 UTC 2019


 extras/source/glade/libreoffice-catalog.xml.in  |    9 
 include/vcl/weld.hxx                            |   16 
 include/vcl/window.hxx                          |    1 
 sc/inc/scabstdlg.hxx                            |    4 
 sc/source/ui/attrdlg/scdlgfact.cxx              |    4 
 sc/source/ui/attrdlg/scdlgfact.hxx              |    4 
 sc/source/ui/dbgui/PivotLayoutDialog.cxx        |  405 ++++++++++--------------
 sc/source/ui/dbgui/PivotLayoutTreeList.cxx      |   61 +--
 sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx  |  129 +++----
 sc/source/ui/dbgui/PivotLayoutTreeListData.cxx  |   84 ++--
 sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx |   34 --
 sc/source/ui/dbgui/pvfundlg.cxx                 |    4 
 sc/source/ui/inc/PivotLayoutDialog.hxx          |  101 +++--
 sc/source/ui/inc/PivotLayoutTreeList.hxx        |   13 
 sc/source/ui/inc/PivotLayoutTreeListBase.hxx    |   50 +-
 sc/source/ui/inc/PivotLayoutTreeListData.hxx    |   14 
 sc/source/ui/inc/PivotLayoutTreeListLabel.hxx   |    8 
 sc/source/ui/inc/pvfundlg.hxx                   |    4 
 sc/source/ui/view/reffact.cxx                   |   10 
 sc/source/ui/view/tabvwshc.cxx                  |   32 -
 sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui  |  266 ++++++++++++---
 sfx2/source/dialog/basedlgs.cxx                 |    2 
 solenv/bin/native-code.py                       |    3 
 solenv/sanitizers/ui/modules/scalc.false        |    2 
 solenv/sanitizers/ui/modules/scalc.suppr        |    4 
 sw/source/ui/fldui/fldfunc.cxx                  |    3 
 vcl/inc/treeglue.hxx                            |   40 ++
 vcl/inc/window.h                                |    1 
 vcl/source/app/salvtables.cxx                   |   60 +++
 vcl/source/window/dlgctrl.cxx                   |   11 
 vcl/unx/gtk3/gtk3gtkinst.cxx                    |  159 +++++++++
 31 files changed, 979 insertions(+), 559 deletions(-)

New commits:
commit f82356d9a1ce1457593a5f42728e2962561328cf
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Apr 29 13:13:23 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed May 1 15:55:55 2019 +0200

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

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 5fce152c342c..50b8118b0b91 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -247,15 +247,6 @@
     <glade-widget-class title="Glossary Tree List" name="swuilo-SwGlTreeListBox"
                         generic-name="Glossary Tree List" parent="GtkTreeView"
                         icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="Pivot Table List" name="sclo-ScPivotLayoutTreeList"
-                        generic-name="Pivot Table List" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="Pivot Table Label List" name="sclo-ScPivotLayoutTreeListLabel"
-                        generic-name="Pivot Table Label List" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
-    <glade-widget-class title="Pivot Table Data List" name="sclo-ScPivotLayoutTreeListData"
-                        generic-name="Pivot Table Data List" parent="GtkTreeView"
-                        icon-name="widget-gtk-treeview"/>
     <glade-widget-class title="Sidebar Dial Control" name="svxlo-SidebarDialControl"
                         generic-name="Sidebar Dial Control" parent="GtkSpinner"
                         icon-name="widget-gtk-spinner"/>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ed3d69d5a652..4bc3e0893cf2 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -78,6 +78,7 @@ class VCL_DLLPUBLIC Widget
 protected:
     Link<Widget&, void> m_aFocusInHdl;
     Link<Widget&, void> m_aFocusOutHdl;
+    Link<Widget&, bool> m_aMnemonicActivateHdl;
     Link<const Size&, void> m_aSizeAllocateHdl;
     Link<const KeyEvent&, bool> m_aKeyPressHdl;
     Link<const KeyEvent&, bool> m_aKeyReleaseHdl;
@@ -161,6 +162,15 @@ public:
         m_aFocusOutHdl = rLink;
     }
 
+    // rLink is called when the mnemonic for the Widget is called.
+    // If rLink returns true the Widget will not automatically gain
+    // focus as normally occurs
+    virtual void connect_mnemonic_activate(const Link<Widget&, bool>& rLink)
+    {
+        assert(!m_aMnemonicActivateHdl.IsSet() || !rLink.IsSet());
+        m_aMnemonicActivateHdl = rLink;
+    }
+
     virtual void connect_size_allocate(const Link<const Size&, void>& rLink)
     {
         assert(!m_aSizeAllocateHdl.IsSet() || !rLink.IsSet());
@@ -655,6 +665,7 @@ public:
     virtual std::vector<int> get_selected_rows() const = 0;
     virtual void set_font_color(int pos, const Color& rColor) const = 0;
     virtual void scroll_to_row(int pos) = 0;
+    virtual int get_cursor_index() const = 0;
     virtual void set_cursor(int pos) = 0;
 
     //by text
@@ -801,6 +812,11 @@ public:
     OUString const& get_saved_value() const { return m_sSavedValue; }
     bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); }
 
+    // for dnd
+    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) = 0;
+    // for dragging and dropping between TreeViews, return the active source
+    virtual TreeView* get_drag_source() const = 0;
+
     using Widget::set_sensitive;
 };
 
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c109e80d982d..e2223af65950 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1577,6 +1577,7 @@ public:
     virtual bool IsChart() const { return false; }
 
     void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
+    void SetMnemonicActivateHdl(const Link<vcl::Window&, bool>& rLink);
 };
 
 }
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 7b2c458ee7eb..cb6ba6933ee7 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -472,12 +472,12 @@ public:
                                                                     const SfxItemSet& rArgSet,
                                                                     sal_uInt16 nSourceTab) = 0;
 
-    virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent,
+    virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Widget* pParent,
                                                                   const ScDPLabelDataVector& rLabelVec,
                                                                   const ScDPLabelData& rLabelData,
                                                                   const ScPivotFuncData& rFuncData ) = 0;
 
-    virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Window* pParent,
+    virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Widget* pParent,
                                                                   ScDPObject& rDPObj,
                                                                   const ScDPLabelData& rLabelData,
                                                                   const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 717e9d884ebf..057935500c69 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -884,7 +884,7 @@ VclPtr<AbstractScPivotFilterDlg> ScAbstractDialogFactory_Impl::CreateScPivotFilt
     return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(std::make_unique<ScPivotFilterDlg>(pParent, rArgSet, nSourceTab));
 }
 
-VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Window* pParent,
+VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Widget* pParent,
                                                                                     const ScDPLabelDataVector& rLabelVec,
                                                                                     const ScDPLabelData& rLabelData,
                                                                                     const ScPivotFuncData& rFuncData)
@@ -892,7 +892,7 @@ VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunction
     return VclPtr<AbstractScDPFunctionDlg_Impl>::Create(std::make_unique<ScDPFunctionDlg>(pParent, rLabelVec, rLabelData, rFuncData));
 }
 
-VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg(weld::Window* pParent,
+VclPtr<AbstractScDPSubtotalDlg> ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg(weld::Widget* pParent,
                                                                                     ScDPObject& rDPObj,
                                                                                     const ScDPLabelData& rLabelData,
                                                                                     const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 064866004d89..14d6b5317467 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -658,12 +658,12 @@ public:
     virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet,
                                                                     sal_uInt16 nSourceTab) override;
 
-    virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent,
+    virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Widget* pParent,
                                                                   const ScDPLabelDataVector& rLabelVec,
                                                                   const ScDPLabelData& rLabelData,
                                                                   const ScPivotFuncData& rFuncData ) override;
 
-    virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Window* pParent,
+    virtual VclPtr<AbstractScDPSubtotalDlg> CreateScDPSubtotalDlg(weld::Widget* pParent,
                                                                   ScDPObject& rDPObj,
                                                                   const ScDPLabelData& rLabelData,
                                                                   const ScPivotFuncData& rFuncData,
diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
index 9199d8039922..070c75c62714 100644
--- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx
@@ -68,96 +68,97 @@ ScRange lclGetRangeForNamedRange(OUString const & aName, const ScDocument* pDocu
 }
 
 ScPivotLayoutDialog::ScPivotLayoutDialog(
-                            SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
-                            ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable) :
-    ScAnyRefDlg           (pSfxBindings, pChildWindow, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayoutdialog.ui"),
-    maPivotTableObject    (*pPivotTableObject),
-    mpPreviouslyFocusedListBox(nullptr),
-    mpViewData            (pViewData),
-    mpDocument            (pViewData->GetDocument()),
-    mbNewPivotTable       (bNewPivotTable),
-    mpActiveEdit          (nullptr),
-    maAddressDetails      (mpDocument->GetAddressConvention(), 0, 0),
-    mbDialogLostFocus     (false)
-{
-    get(mpListBoxField,    "listbox-fields");
-    get(mpListBoxPage,     "listbox-page");
-    get(mpListBoxColumn,   "listbox-column");
-    get(mpListBoxRow,      "listbox-row");
-    get(mpListBoxData,     "listbox-data");
-
-    get(mpCheckIgnoreEmptyRows,     "check-ignore-empty-rows");
-    get(mpCheckTotalColumns,        "check-total-columns");
-    get(mpCheckAddFilter,           "check-add-filter");
-    get(mpCheckIdentifyCategories,  "check-identify-categories");
-    get(mpCheckTotalRows,           "check-total-rows");
-    get(mpCheckDrillToDetail,       "check-drill-to-details");
-
-    get(mpBtnOK,  "ok");
-    get(mpBtnCancel,  "cancel");
-
-    get(mpSourceRadioNamedRange, "source-radio-named-range");
-    get(mpSourceRadioSelection,  "source-radio-selection");
-    get(mpSourceListBox,         "source-list");
-    get(mpSourceEdit,            "source-edit");
-    get(mpSourceButton,          "source-button");
-
-    get(mpDestinationRadioNewSheet,   "destination-radio-new-sheet");
-    get(mpDestinationRadioNamedRange, "destination-radio-named-range");
-    get(mpDestinationRadioSelection,  "destination-radio-selection");
-    get(mpDestinationListBox,         "destination-list");
-    get(mpDestinationEdit,            "destination-edit");
-    get(mpDestinationButton,          "destination-button");
-
+                            SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
+                            ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bNewPivotTable)
+    : ScAnyRefDlgController(pSfxBindings, pChildWindow, pParent, "modules/scalc/ui/pivottablelayoutdialog.ui", "PivotTableLayout")
+    , maPivotTableObject(*pPivotTableObject)
+    , mpPreviouslyFocusedListBox(nullptr)
+    , mpViewData(pViewData)
+    , mpDocument(pViewData->GetDocument())
+    , mbNewPivotTable(bNewPivotTable)
+    , maAddressDetails(mpDocument->GetAddressConvention(), 0, 0)
+    , mbDialogLostFocus(false)
+    , mpActiveEdit(nullptr)
+    , mxListBoxField(new ScPivotLayoutTreeListLabel(m_xBuilder->weld_tree_view("listbox-fields")))
+    , mxListBoxPage(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-page")))
+    , mxListBoxColumn(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-column")))
+    , mxListBoxRow(new ScPivotLayoutTreeList(m_xBuilder->weld_tree_view("listbox-row")))
+    , mxListBoxData(new ScPivotLayoutTreeListData(m_xBuilder->weld_tree_view("listbox-data")))
+    , mxCheckIgnoreEmptyRows(m_xBuilder->weld_check_button("check-ignore-empty-rows"))
+    , mxCheckTotalColumns(m_xBuilder->weld_check_button("check-total-columns"))
+    , mxCheckAddFilter(m_xBuilder->weld_check_button("check-add-filter"))
+    , mxCheckIdentifyCategories(m_xBuilder->weld_check_button("check-identify-categories"))
+    , mxCheckTotalRows(m_xBuilder->weld_check_button("check-total-rows"))
+    , mxCheckDrillToDetail(m_xBuilder->weld_check_button("check-drill-to-details"))
+    , mxSourceRadioNamedRange(m_xBuilder->weld_radio_button("source-radio-named-range"))
+    , mxSourceRadioSelection(m_xBuilder->weld_radio_button("source-radio-selection"))
+    , mxSourceListBox(m_xBuilder->weld_combo_box("source-list"))
+    , mxSourceEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("source-edit")))
+    , mxSourceButton(new formula::WeldRefButton(m_xBuilder->weld_button("source-button")))
+    , mxDestinationRadioNewSheet(m_xBuilder->weld_radio_button("destination-radio-new-sheet"))
+    , mxDestinationRadioNamedRange(m_xBuilder->weld_radio_button("destination-radio-named-range"))
+    , mxDestinationRadioSelection(m_xBuilder->weld_radio_button("destination-radio-selection"))
+    , mxDestinationListBox(m_xBuilder->weld_combo_box("destination-list"))
+    , mxDestinationEdit(new formula::WeldRefEdit(m_xBuilder->weld_entry("destination-edit")))
+    , mxDestinationButton(new formula::WeldRefButton(m_xBuilder->weld_button("destination-button")))
+    , mxBtnOK(m_xBuilder->weld_button("ok"))
+    , mxBtnCancel(m_xBuilder->weld_button("cancel"))
+    , mxSourceFrame(m_xBuilder->weld_frame("frame2"))
+    , mxSourceLabel(mxSourceFrame->weld_label_widget())
+    , mxDestFrame(m_xBuilder->weld_frame("frame1"))
+    , mxDestLabel(mxDestFrame->weld_label_widget())
+    , mxOptions(m_xBuilder->weld_expander("options"))
+    , mxMore(m_xBuilder->weld_expander("more"))
+{
     // Source UI
-    Link<RadioButton&,void> aLink2 = LINK(this, ScPivotLayoutDialog, ToggleSource);
-    mpSourceRadioNamedRange->SetToggleHdl(aLink2);
-    mpSourceRadioSelection->SetToggleHdl(aLink2);
+    Link<weld::ToggleButton&,void> aLink2 = LINK(this, ScPivotLayoutDialog, ToggleSource);
+    mxSourceRadioNamedRange->connect_toggled(aLink2);
+    mxSourceRadioSelection->connect_toggled(aLink2);
 
-    mpSourceEdit->SetReferences(this, mpSourceRadioSelection);
-    mpSourceButton->SetReferences(this, mpSourceEdit);
+    mxSourceEdit->SetReferences(this, mxSourceLabel.get());
+    mxSourceButton->SetReferences(this, mxSourceEdit.get());
 
-    Link<Control&,void> aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler);
-    mpSourceEdit->SetGetFocusHdl(aLink);
-    mpSourceButton->SetGetFocusHdl(aLink);
+    Link<formula::WeldRefEdit&,void> aEditLink = LINK(this, ScPivotLayoutDialog, GetEditFocusHandler);
+    mxDestinationEdit->SetGetFocusHdl(aEditLink);
+    mxSourceEdit->SetGetFocusHdl(aEditLink);
 
-    aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler);
-    mpSourceEdit->SetLoseFocusHdl(aLink);
-    mpSourceButton->SetLoseFocusHdl(aLink);
+    aEditLink = LINK(this, ScPivotLayoutDialog, LoseEditFocusHandler);
+    mxDestinationEdit->SetLoseFocusHdl(aEditLink);
+    mxSourceEdit->SetLoseFocusHdl(aEditLink);
 
-    mpSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
-    mpSourceListBox->SetSelectHdl(LINK(this, ScPivotLayoutDialog, SourceListSelected));
+    mxSourceEdit->SetModifyHdl(LINK(this, ScPivotLayoutDialog, SourceEditModified));
+    mxSourceListBox->connect_changed(LINK(this, ScPivotLayoutDialog, SourceListSelected));
 
     // Destination UI
     aLink2 = LINK(this, ScPivotLayoutDialog, ToggleDestination);
-    mpDestinationRadioNewSheet->SetToggleHdl(aLink2);
-    mpDestinationRadioNamedRange->SetToggleHdl(aLink2);
-    mpDestinationRadioSelection->SetToggleHdl(aLink2);
+    mxDestinationRadioNewSheet->connect_toggled(aLink2);
+    mxDestinationRadioNamedRange->connect_toggled(aLink2);
+    mxDestinationRadioSelection->connect_toggled(aLink2);
 
-    mpDestinationEdit->SetReferences(this, mpDestinationRadioNewSheet);
-    mpDestinationButton->SetReferences(this, mpDestinationEdit);
+    mxDestinationEdit->SetReferences(this, mxDestLabel.get());
+    mxDestinationButton->SetReferences(this, mxDestinationEdit.get());
 
-    aLink = LINK(this, ScPivotLayoutDialog, GetFocusHandler);
-    mpDestinationEdit->SetGetFocusHdl(aLink);
-    mpDestinationButton->SetGetFocusHdl(aLink);
+    Link<formula::WeldRefButton&,void> aButtonLink = LINK(this, ScPivotLayoutDialog, GetButtonFocusHandler);
+    mxSourceButton->SetGetFocusHdl(aButtonLink);
+    mxDestinationButton->SetGetFocusHdl(aButtonLink);
 
-    aLink = LINK(this, ScPivotLayoutDialog, LoseFocusHandler);
-    mpDestinationEdit->SetLoseFocusHdl(aLink);
-    mpDestinationButton->SetLoseFocusHdl(aLink);
+    aButtonLink = LINK(this, ScPivotLayoutDialog, LoseButtonFocusHandler);
+    mxSourceButton->SetLoseFocusHdl(aButtonLink);
+    mxDestinationButton->SetLoseFocusHdl(aButtonLink);
 
     // Buttons
-    mpBtnCancel->SetClickHdl(LINK(this, ScPivotLayoutDialog, CancelClicked));
-    mpBtnOK->SetClickHdl(LINK(this, ScPivotLayoutDialog, OKClicked));
+    mxBtnCancel->connect_clicked(LINK(this, ScPivotLayoutDialog, CancelClicked));
+    mxBtnOK->connect_clicked(LINK(this, ScPivotLayoutDialog, OKClicked));
 
     // Initialize Data
     maPivotTableObject.FillOldParam(maPivotParameters);
     maPivotTableObject.FillLabelData(maPivotParameters);
 
-    mpListBoxField->Setup (this);
-    mpListBoxPage->Setup  (this, ScPivotLayoutTreeList::PAGE_LIST);
-    mpListBoxColumn->Setup(this, ScPivotLayoutTreeList::COLUMN_LIST);
-    mpListBoxRow->Setup   (this, ScPivotLayoutTreeList::ROW_LIST);
-    mpListBoxData->Setup  (this);
+    mxListBoxField->Setup (this);
+    mxListBoxPage->Setup  (this, ScPivotLayoutTreeList::PAGE_LIST);
+    mxListBoxColumn->Setup(this, ScPivotLayoutTreeList::COLUMN_LIST);
+    mxListBoxRow->Setup   (this, ScPivotLayoutTreeList::ROW_LIST);
+    mxListBoxData->Setup  (this);
 
     FillValuesToListBoxes();
 
@@ -165,19 +166,19 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
     const ScDPSaveData* pSaveData = maPivotTableObject.GetSaveData();
     if (pSaveData == nullptr)
     {
-        mpCheckAddFilter->Check(false);
-        mpCheckDrillToDetail->Check(false);
+        mxCheckAddFilter->set_active(false);
+        mxCheckDrillToDetail->set_active(false);
     }
     else
     {
-        mpCheckAddFilter->Check(pSaveData->GetFilterButton());
-        mpCheckDrillToDetail->Check(pSaveData->GetDrillDown());
+        mxCheckAddFilter->set_active(pSaveData->GetFilterButton());
+        mxCheckDrillToDetail->set_active(pSaveData->GetDrillDown());
     }
 
-    mpCheckIgnoreEmptyRows->Check(maPivotParameters.bIgnoreEmptyRows);
-    mpCheckIdentifyCategories->Check(maPivotParameters.bDetectCategories);
-    mpCheckTotalColumns->Check(maPivotParameters.bMakeTotalCol);
-    mpCheckTotalRows->Check(maPivotParameters.bMakeTotalRow);
+    mxCheckIgnoreEmptyRows->set_active(maPivotParameters.bIgnoreEmptyRows);
+    mxCheckIdentifyCategories->set_active(maPivotParameters.bDetectCategories);
+    mxCheckTotalColumns->set_active(maPivotParameters.bMakeTotalCol);
+    mxCheckTotalRows->set_active(maPivotParameters.bMakeTotalRow);
 
     SetupSource();
     SetupDestination();
@@ -185,43 +186,11 @@ ScPivotLayoutDialog::ScPivotLayoutDialog(
 
 ScPivotLayoutDialog::~ScPivotLayoutDialog()
 {
-    disposeOnce();
-}
-
-void ScPivotLayoutDialog::dispose()
-{
-    mpPreviouslyFocusedListBox.clear();
-    mpListBoxField.clear();
-    mpListBoxPage.clear();
-    mpListBoxColumn.clear();
-    mpListBoxRow.clear();
-    mpListBoxData.clear();
-    mpCheckIgnoreEmptyRows.clear();
-    mpCheckTotalColumns.clear();
-    mpCheckAddFilter.clear();
-    mpCheckIdentifyCategories.clear();
-    mpCheckTotalRows.clear();
-    mpCheckDrillToDetail.clear();
-    mpSourceRadioNamedRange.clear();
-    mpSourceRadioSelection.clear();
-    mpSourceListBox.clear();
-    mpSourceEdit.clear();
-    mpSourceButton.clear();
-    mpDestinationRadioNewSheet.clear();
-    mpDestinationRadioNamedRange.clear();
-    mpDestinationRadioSelection.clear();
-    mpDestinationListBox.clear();
-    mpDestinationEdit.clear();
-    mpDestinationButton.clear();
-    mpBtnOK.clear();
-    mpBtnCancel.clear();
-    mpActiveEdit.clear();
-    ScAnyRefDlg::dispose();
 }
 
 void ScPivotLayoutDialog::SetupSource()
 {
-    mpSourceListBox->Clear();
+    mxSourceListBox->clear();
 
     ScRange aSourceRange;
     OUString sSourceNamedRangeName;
@@ -234,21 +203,21 @@ void ScPivotLayoutDialog::SetupSource()
         if(!aSourceRange.IsValid())
         {
             // Source is probably a DB Range
-            mpSourceRadioNamedRange->Disable();
-            mpSourceRadioSelection->Disable();
+            mxSourceRadioNamedRange->set_sensitive(false);
+            mxSourceRadioSelection->set_sensitive(false);
             ToggleSource();
             return;
         }
         else
         {
             OUString aSourceRangeName = aSourceRange.Format(ScRefFlags::RANGE_ABS_3D, mpDocument, maAddressDetails);
-            mpSourceEdit->SetText(aSourceRangeName);
+            mxSourceEdit->SetText(aSourceRangeName);
         }
     }
     else
     {
-        mpSourceRadioNamedRange->Disable();
-        mpSourceRadioSelection->Disable();
+        mxSourceRadioNamedRange->set_sensitive(false);
+        mxSourceRadioSelection->set_sensitive(false);
         ToggleSource();
         return;
     }
@@ -264,7 +233,7 @@ void ScPivotLayoutDialog::SetupSource()
     {
         if (!aIterator.WasDBName())
         {
-            mpSourceListBox->InsertEntry(aEachName);
+            mxSourceListBox->append_text(aEachName);
             if (aEachRange == aSourceRange)
             {
                 sSourceNamedRangeName = aEachName;
@@ -275,25 +244,25 @@ void ScPivotLayoutDialog::SetupSource()
 
     if (bIsNamedRange)
     {
-        mpSourceListBox->SelectEntry(sSourceNamedRangeName);
-        mpSourceRadioNamedRange->Check();
+        mxSourceListBox->set_active_text(sSourceNamedRangeName);
+        mxSourceRadioNamedRange->set_active(true);
     }
     else
     {
-        mpSourceListBox->SelectEntryPos(0);
-        mpSourceRadioSelection->Check();
+        mxSourceListBox->set_active(0);
+        mxSourceRadioSelection->set_active(true);
     }
 
     // If entries - select first entry, otherwise disable the radio button.
-    if (mpSourceListBox->GetEntryCount() <= 0)
-        mpSourceRadioNamedRange->Disable();
+    if (mxSourceListBox->get_count() <= 0)
+        mxSourceRadioNamedRange->set_sensitive(false);
 
     ToggleSource();
 }
 
 void ScPivotLayoutDialog::SetupDestination()
 {
-    mpDestinationListBox->Clear();
+    mxDestinationListBox->clear();
 
     // Fill up named ranges
     ScAreaNameIterator aIterator(mpDocument);
@@ -304,20 +273,20 @@ void ScPivotLayoutDialog::SetupDestination()
     {
         if (!aIterator.WasDBName())
         {
-            mpDestinationListBox->InsertEntry(aName);
+            mxDestinationListBox->append_text(aName);
         }
     }
 
     // If entries - select first entry, otherwise disable the radio button.
-    if (mpDestinationListBox->GetEntryCount() > 0)
-        mpDestinationListBox->SelectEntryPos(0);
+    if (mxDestinationListBox->get_count() > 0)
+        mxDestinationListBox->set_active(0);
     else
-        mpDestinationRadioNamedRange->Disable();
+        mxDestinationRadioNamedRange->set_sensitive(false);
 
     //
     if (mbNewPivotTable)
     {
-        mpDestinationRadioNewSheet->Check();
+        mxDestinationRadioNewSheet->set_active(true);
     }
     else
     {
@@ -325,8 +294,8 @@ void ScPivotLayoutDialog::SetupDestination()
         {
             ScAddress aAddress(maPivotParameters.nCol, maPivotParameters.nRow, maPivotParameters.nTab);
             OUString aAddressString = aAddress.Format(ScRefFlags::ADDR_ABS_3D, mpDocument, maAddressDetails);
-            mpDestinationEdit->SetText(aAddressString);
-            mpDestinationRadioSelection->Check();
+            mxDestinationEdit->SetText(aAddressString);
+            mxDestinationRadioSelection->set_active(true);
         }
     }
 
@@ -335,11 +304,11 @@ void ScPivotLayoutDialog::SetupDestination()
 
 void ScPivotLayoutDialog::FillValuesToListBoxes()
 {
-    mpListBoxField->FillLabelFields(maPivotParameters.maLabelArray);
-    mpListBoxData->FillDataField(maPivotParameters.maDataFields);
-    mpListBoxColumn->FillFields(maPivotParameters.maColFields);
-    mpListBoxRow->FillFields(maPivotParameters.maRowFields);
-    mpListBoxPage->FillFields(maPivotParameters.maPageFields);
+    mxListBoxField->FillLabelFields(maPivotParameters.maLabelArray);
+    mxListBoxData->FillDataField(maPivotParameters.maDataFields);
+    mxListBoxColumn->FillFields(maPivotParameters.maColFields);
+    mxListBoxRow->FillFields(maPivotParameters.maRowFields);
+    mxListBoxPage->FillFields(maPivotParameters.maPageFields);
 }
 
 void ScPivotLayoutDialog::SetActive()
@@ -350,13 +319,13 @@ void ScPivotLayoutDialog::SetActive()
         if(mpActiveEdit != nullptr)
         {
             mpActiveEdit->GrabFocus();
-            if (mpActiveEdit == mpSourceEdit)
+            if (mpActiveEdit == mxSourceEdit.get())
                 UpdateSourceRange();
         }
     }
     else
     {
-        GrabFocus();
+        m_xDialog->grab_focus();
     }
 
     RefInputDone();
@@ -375,13 +344,13 @@ void ScPivotLayoutDialog::SetReference(const ScRange& rReferenceRange, ScDocumen
 
     OUString aReferenceString = rReferenceRange.Format(ScRefFlags::RANGE_ABS_3D, pDocument, maAddressDetails);
 
-    if (mpActiveEdit == mpSourceEdit)
+    if (mpActiveEdit == mxSourceEdit.get())
     {
-        mpSourceEdit->SetRefString(aReferenceString);
+        mxSourceEdit->SetRefString(aReferenceString);
     }
-    else if (mpActiveEdit == mpDestinationEdit)
+    else if (mpActiveEdit == mxDestinationEdit.get())
     {
-        mpDestinationEdit->SetRefString(aReferenceString);
+        mxDestinationEdit->SetRefString(aReferenceString);
     }
 }
 
@@ -401,17 +370,17 @@ void ScPivotLayoutDialog::ItemInserted(const ScItemValue* pItemValue, ScPivotLay
         case ScPivotLayoutTreeList::COLUMN_LIST:
         case ScPivotLayoutTreeList::PAGE_LIST:
         {
-            mpListBoxRow->RemoveEntryForItem(pItemValue);
-            mpListBoxColumn->RemoveEntryForItem(pItemValue);
-            mpListBoxPage->RemoveEntryForItem(pItemValue);
+            mxListBoxRow->RemoveEntryForItem(pItemValue);
+            mxListBoxColumn->RemoveEntryForItem(pItemValue);
+            mxListBoxPage->RemoveEntryForItem(pItemValue);
         }
         break;
         case ScPivotLayoutTreeList::LABEL_LIST:
         {
-            mpListBoxRow->RemoveEntryForItem(pItemValue);
-            mpListBoxColumn->RemoveEntryForItem(pItemValue);
-            mpListBoxPage->RemoveEntryForItem(pItemValue);
-            mpListBoxData->RemoveEntryForItem(pItemValue);
+            mxListBoxRow->RemoveEntryForItem(pItemValue);
+            mxListBoxColumn->RemoveEntryForItem(pItemValue);
+            mxListBoxPage->RemoveEntryForItem(pItemValue);
+            mxListBoxData->RemoveEntryForItem(pItemValue);
         }
         break;
         default:
@@ -426,23 +395,23 @@ void ScPivotLayoutDialog::UpdateSourceRange()
 
     ScSheetSourceDesc aSourceSheet = *maPivotTableObject.GetSheetDesc();
 
-    if (mpSourceRadioNamedRange->IsChecked())
+    if (mxSourceRadioNamedRange->get_active())
     {
-        OUString aEntryString = mpSourceListBox->GetSelectedEntry();
+        OUString aEntryString = mxSourceListBox->get_active_text();
         ScRange aSourceRange = lclGetRangeForNamedRange(aEntryString, mpDocument);
         if (!aSourceRange.IsValid() || aSourceSheet.GetSourceRange() == aSourceRange)
             return;
         aSourceSheet.SetRangeName(aEntryString);
     }
-    else if (mpSourceRadioSelection->IsChecked())
+    else if (mxSourceRadioSelection->get_active())
     {
-        OUString aSourceString = mpSourceEdit->GetText();
+        OUString aSourceString = mxSourceEdit->GetText();
         ScRange aSourceRange;
         ScRefFlags nResult = aSourceRange.Parse(aSourceString, mpDocument, maAddressDetails);
 
         bool bIsValid = (nResult & ScRefFlags::VALID) == ScRefFlags::VALID; // aSourceString is valid
 
-        mpSourceEdit->SetRefValid(true);
+        mxSourceEdit->SetRefValid(true);
 
         if (bIsValid)
         {
@@ -460,7 +429,7 @@ void ScPivotLayoutDialog::UpdateSourceRange()
 
         if (!aSourceRange.IsValid())
         {
-            mpSourceEdit->SetRefValid(false);
+            mxSourceEdit->SetRefValid(false);
             return;
         }
 
@@ -470,7 +439,7 @@ void ScPivotLayoutDialog::UpdateSourceRange()
         aSourceSheet.SetSourceRange(aSourceRange);
         if (aSourceSheet.CheckSourceRange() != nullptr)
         {
-            mpSourceEdit->SetRefValid(false);
+            mxSourceEdit->SetRefValid(false);
             return;
         }
     }
@@ -542,32 +511,32 @@ void ScPivotLayoutDialog::ApplyChanges()
 
 void ScPivotLayoutDialog::ApplySaveData(ScDPSaveData& rSaveData)
 {
-    rSaveData.SetIgnoreEmptyRows(mpCheckIgnoreEmptyRows->IsChecked());
-    rSaveData.SetRepeatIfEmpty(mpCheckIdentifyCategories->IsChecked());
-    rSaveData.SetColumnGrand(mpCheckTotalColumns->IsChecked());
-    rSaveData.SetRowGrand(mpCheckTotalRows->IsChecked());
-    rSaveData.SetFilterButton(mpCheckAddFilter->IsChecked());
-    rSaveData.SetDrillDown(mpCheckDrillToDetail->IsChecked());
+    rSaveData.SetIgnoreEmptyRows(mxCheckIgnoreEmptyRows->get_active());
+    rSaveData.SetRepeatIfEmpty(mxCheckIdentifyCategories->get_active());
+    rSaveData.SetColumnGrand(mxCheckTotalColumns->get_active());
+    rSaveData.SetRowGrand(mxCheckTotalRows->get_active());
+    rSaveData.SetFilterButton(mxCheckAddFilter->get_active());
+    rSaveData.SetDrillDown(mxCheckDrillToDetail->get_active());
 
     Reference<XDimensionsSupplier> xSource = maPivotTableObject.GetSource();
 
     ScPivotFieldVector aPageFieldVector;
-    mpListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
+    mxListBoxPage->PushEntriesToPivotFieldVector(aPageFieldVector);
     ScDPObject::ConvertOrientation(rSaveData, aPageFieldVector, DataPilotFieldOrientation_PAGE,
                                    xSource, maPivotParameters.maLabelArray);
 
     ScPivotFieldVector aColFieldVector;
-    mpListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
+    mxListBoxColumn->PushEntriesToPivotFieldVector(aColFieldVector);
     ScDPObject::ConvertOrientation(rSaveData, aColFieldVector, DataPilotFieldOrientation_COLUMN,
                                    xSource, maPivotParameters.maLabelArray);
 
     ScPivotFieldVector aRowFieldVector;
-    mpListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
+    mxListBoxRow->PushEntriesToPivotFieldVector(aRowFieldVector);
     ScDPObject::ConvertOrientation(rSaveData, aRowFieldVector, DataPilotFieldOrientation_ROW,
                                    xSource, maPivotParameters.maLabelArray);
 
     ScPivotFieldVector aDataFieldVector;
-    mpListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
+    mxListBoxData->PushEntriesToPivotFieldVector(aDataFieldVector);
     ScDPObject::ConvertOrientation(rSaveData, aDataFieldVector, DataPilotFieldOrientation_DATA,
                                    xSource, maPivotParameters.maLabelArray,
                                    &aColFieldVector, &aRowFieldVector, &aPageFieldVector);
@@ -611,17 +580,17 @@ bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNe
 {
     bToNewSheet = false;
 
-    if (mpDestinationRadioNamedRange->IsChecked())
+    if (mxDestinationRadioNamedRange->get_active())
     {
-        OUString aName = mpDestinationListBox->GetSelectedEntry();
+        OUString aName = mxDestinationListBox->get_active_text();
         aDestinationRange = lclGetRangeForNamedRange(aName, mpDocument);
         if (!aDestinationRange.IsValid())
             return false;
     }
-    else if (mpDestinationRadioSelection->IsChecked())
+    else if (mxDestinationRadioSelection->get_active())
     {
         ScAddress aAddress;
-        aAddress.Parse(mpDestinationEdit->GetText(), mpDocument, maAddressDetails);
+        aAddress.Parse(mxDestinationEdit->GetText(), mpDocument, maAddressDetails);
         aDestinationRange = ScRange(aAddress);
     }
     else
@@ -634,12 +603,12 @@ bool ScPivotLayoutDialog::GetDestination(ScRange& aDestinationRange, bool& bToNe
 
 ScItemValue* ScPivotLayoutDialog::GetItem(SCCOL nColumn)
 {
-    return mpListBoxField->GetItem(nColumn);
+    return mxListBoxField->GetItem(nColumn);
 }
 
 bool ScPivotLayoutDialog::IsDataElement(SCCOL nColumn)
 {
-    return mpListBoxField->IsDataElement(nColumn);
+    return mxListBoxField->IsDataElement(nColumn);
 }
 
 ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
@@ -649,99 +618,91 @@ ScDPLabelData& ScPivotLayoutDialog::GetLabelData(SCCOL nColumn)
 
 void ScPivotLayoutDialog::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
 {
-    return mpListBoxData->PushDataFieldNames(rDataFieldNames);
+    mxListBoxData->PushDataFieldNames(rDataFieldNames);
 }
 
-bool ScPivotLayoutDialog::Close()
+void ScPivotLayoutDialog::Close()
 {
-    return DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
+    DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
 }
 
-IMPL_LINK_NOARG( ScPivotLayoutDialog, OKClicked, Button*, void )
+IMPL_LINK_NOARG( ScPivotLayoutDialog, OKClicked, weld::Button&, void )
 {
     ApplyChanges();
-    Close();
+    m_xDialog->response(RET_OK);
+}
+
+IMPL_LINK_NOARG( ScPivotLayoutDialog, CancelClicked, weld::Button&, void )
+{
+    m_xDialog->response(RET_CANCEL);
 }
 
-IMPL_LINK_NOARG( ScPivotLayoutDialog, CancelClicked, Button*, void )
+IMPL_LINK(ScPivotLayoutDialog, GetEditFocusHandler, formula::WeldRefEdit&, rCtrl, void)
 {
-    Close();
+    mpActiveEdit = &rCtrl;
+    mpActiveEdit->SelectAll();
 }
 
-IMPL_LINK(ScPivotLayoutDialog, GetFocusHandler, Control&, rCtrl, void)
+IMPL_LINK(ScPivotLayoutDialog, GetButtonFocusHandler, formula::WeldRefButton&, rCtrl, void)
 {
     mpActiveEdit = nullptr;
 
-    if (&rCtrl == static_cast<Control*>(mpSourceEdit)  ||
-        &rCtrl == static_cast<Control*>(mpSourceButton))
-    {
-        mpActiveEdit = mpSourceEdit;
-    }
-    else if (&rCtrl == static_cast<Control*>(mpDestinationEdit)  ||
-             &rCtrl == static_cast<Control*>(mpDestinationButton))
-    {
-        mpActiveEdit = mpDestinationEdit;
-    }
+    if (&rCtrl == mxSourceButton.get())
+        mpActiveEdit = mxSourceEdit.get();
+    else if (&rCtrl == mxDestinationButton.get())
+        mpActiveEdit = mxDestinationEdit.get();
 
     if (mpActiveEdit)
-        mpActiveEdit->SetSelection(Selection(0, SELECTION_MAX));
+        mpActiveEdit->SelectAll();
+}
+
+IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseEditFocusHandler, formula::WeldRefEdit&, void)
+{
+    mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
 }
 
-IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseFocusHandler, Control&, void)
+IMPL_LINK_NOARG(ScPivotLayoutDialog, LoseButtonFocusHandler, formula::WeldRefButton&, void)
 {
-    mbDialogLostFocus = !IsActive();
+    mbDialogLostFocus = !m_xDialog->has_toplevel_focus();
 }
 
-IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceListSelected, ListBox&, void)
+IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceListSelected, weld::ComboBox&, void)
 {
     UpdateSourceRange();
 }
 
-IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceEditModified, Edit&, void)
+IMPL_LINK_NOARG(ScPivotLayoutDialog, SourceEditModified, formula::WeldRefEdit&, void)
 {
     UpdateSourceRange();
 }
 
-IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleSource, RadioButton&, void)
+IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleSource, weld::ToggleButton&, void)
 {
     ToggleSource();
 }
 
 void ScPivotLayoutDialog::ToggleSource()
 {
-    bool bNamedRange = mpSourceRadioNamedRange->IsChecked();
-    bool bSelection = mpSourceRadioSelection->IsChecked();
-    mpSourceListBox->Enable(bNamedRange);
-    mpSourceButton->Enable(bSelection);
-    mpSourceEdit->Enable(bSelection);
+    bool bNamedRange = mxSourceRadioNamedRange->get_active();
+    bool bSelection = mxSourceRadioSelection->get_active();
+    mxSourceListBox->set_sensitive(bNamedRange);
+    mxSourceButton->GetWidget()->set_sensitive(bSelection);
+    mxSourceEdit->GetWidget()->set_sensitive(bSelection);
     UpdateSourceRange();
 }
 
-IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleDestination, RadioButton&, void)
+IMPL_LINK_NOARG(ScPivotLayoutDialog, ToggleDestination, weld::ToggleButton&, void)
 {
     ToggleDestination();
 }
 
 void ScPivotLayoutDialog::ToggleDestination()
 {
-    bool bNamedRange = mpDestinationRadioNamedRange->IsChecked();
-    bool bSelection = mpDestinationRadioSelection->IsChecked();
-    mpDestinationListBox->Enable(bNamedRange);
-    mpDestinationButton->Enable(bSelection);
-    mpDestinationEdit->Enable(bSelection);
-}
-
-ScPivotLayoutTreeListBase* ScPivotLayoutDialog::FindListBoxFor(const SvTreeListEntry *pEntry)
-{
-    if (mpListBoxPage->HasEntry(pEntry))
-        return mpListBoxPage.get();
-    if (mpListBoxColumn->HasEntry(pEntry))
-        return mpListBoxColumn.get();
-    if (mpListBoxRow->HasEntry(pEntry))
-        return mpListBoxRow.get();
-    if (mpListBoxData->HasEntry(pEntry))
-        return mpListBoxData.get();
-    return nullptr;
+    bool bNamedRange = mxDestinationRadioNamedRange->get_active();
+    bool bSelection = mxDestinationRadioSelection->get_active();
+    mxDestinationListBox->set_sensitive(bNamedRange);
+    mxDestinationButton->GetWidget()->set_sensitive(bSelection);
+    mxDestinationEdit->GetWidget()->set_sensitive(bSelection);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
index 03ea8a98f709..19004643e846 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeList.cxx
@@ -19,17 +19,16 @@
 #include <pivot.hxx>
 #include <scabstdlg.hxx>
 
-VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeList,
-                         WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN)
-
-ScPivotLayoutTreeList::ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits) :
-    ScPivotLayoutTreeListBase(pParent, nBits)
+ScPivotLayoutTreeList::ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl)
+    : ScPivotLayoutTreeListBase(std::move(xControl))
 {
-    SetForceMakeVisible(true);
+    mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeList, KeyInputHdl));
+    mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeList, DoubleClickHdl));
 }
 
 ScPivotLayoutTreeList::~ScPivotLayoutTreeList()
-{}
+{
+}
 
 void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType)
 {
@@ -37,17 +36,17 @@ void ScPivotLayoutTreeList::Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListT
     meType = eType;
 }
 
-bool ScPivotLayoutTreeList::DoubleClickHdl()
+IMPL_LINK_NOARG(ScPivotLayoutTreeList, DoubleClickHdl, weld::TreeView&, void)
 {
-    SvTreeListEntry* pEntry = GetCurEntry();
-    if (!pEntry)
-        return false;
+    int nEntry = mxControl->get_cursor_index();
+    if (nEntry == -1)
+        return;
 
-    ScItemValue* pCurrentItemValue = static_cast<ScItemValue*>(pEntry->GetUserData());
+    ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
     ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
 
     if (mpParent->IsDataElement(rCurrentFunctionData.mnCol))
-        return false;
+        return;
 
     SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
     ScDPLabelData& rCurrentLabelData = mpParent->GetLabelData(nCurrentColumn);
@@ -58,20 +57,18 @@ bool ScPivotLayoutTreeList::DoubleClickHdl()
     mpParent->PushDataFieldNames(aDataFieldNames);
 
     ScopedVclPtr<AbstractScDPSubtotalDlg> pDialog(
-        pFactory->CreateScDPSubtotalDlg(GetFrameWeld(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames));
+        pFactory->CreateScDPSubtotalDlg(mxControl.get(), mpParent->maPivotTableObject, rCurrentLabelData, rCurrentFunctionData, aDataFieldNames));
 
     if (pDialog->Execute() == RET_OK)
     {
         pDialog->FillLabelData(rCurrentLabelData);
         rCurrentFunctionData.mnFuncMask = pDialog->GetFuncMask();
     }
-
-    return true;
 }
 
 void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
 {
-    Clear();
+    mxControl->clear();
     maItemValues.clear();
 
     for (ScPivotField& rField : rFieldVector)
@@ -79,13 +76,14 @@ void ScPivotLayoutTreeList::FillFields(ScPivotFieldVector& rFieldVector)
         OUString aLabel = mpParent->GetItem( rField.nCol )->maName;
         ScItemValue* pItemValue = new ScItemValue( aLabel, rField.nCol, rField.nFuncMask );
         maItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
-        InsertEntry(pItemValue->maName, nullptr, false, TREELIST_APPEND, pItemValue);
+        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+        mxControl->append(sId, pItemValue->maName);
     }
 }
 
-void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
+void ScPivotLayoutTreeList::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
 {
-    ScItemValue* pItemValue = static_cast<ScItemValue*>(pSource->GetUserData());
+    ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
     ScItemValue* pOriginalItemValue = pItemValue->mpOriginalItemValue;
 
     // Don't allow to add "Data" element to page fields
@@ -94,31 +92,32 @@ void ScPivotLayoutTreeList::InsertEntryForSourceTarget(SvTreeListEntry* pSource,
 
     mpParent->ItemInserted(pOriginalItemValue, meType);
 
-    sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
-    InsertEntryForItem(pOriginalItemValue, nPosition);
+    InsertEntryForItem(pOriginalItemValue, nTarget);
 }
 
-void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, sal_uLong nPosition)
+void ScPivotLayoutTreeList::InsertEntryForItem(const ScItemValue* pItemValue, int nPosition)
 {
     ScItemValue *pListItemValue = new ScItemValue(pItemValue);
     maItemValues.push_back(std::unique_ptr<ScItemValue>(pListItemValue));
-    OUString rName = pListItemValue->maName;
-    InsertEntry(rName, nullptr, false, nPosition, pListItemValue);
+    OUString sName = pListItemValue->maName;
+    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pListItemValue)));
+    mxControl->insert(nullptr, nPosition, &sName, &sId, nullptr, nullptr, nullptr, false, nullptr);
 }
 
-void ScPivotLayoutTreeList::KeyInput(const KeyEvent& rKeyEvent)
+IMPL_LINK(ScPivotLayoutTreeList, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
 {
     vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
     sal_uInt16 nCode = aCode.GetCode();
 
     if (nCode == KEY_DELETE)
     {
-        const SvTreeListEntry* pEntry = GetCurEntry();
-        if (pEntry)
-            GetModel()->Remove(pEntry);
-        return;
+        const int nEntry = mxControl->get_cursor_index();
+        if (nEntry != -1)
+            mxControl->remove(nEntry);
+        return true;
     }
-    SvTreeListBox::KeyInput(rKeyEvent);
+
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
index f9fdea939b90..1ca50da20e00 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx
@@ -14,24 +14,19 @@
 
 #include <vcl/treelistentry.hxx>
 
-ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType)
-    : SvTreeListBox(pParent, nBits)
+ScPivotLayoutTreeListBase::ScPivotLayoutTreeListBase(std::unique_ptr<weld::TreeView> xControl, SvPivotTreeListType eType)
+    : mxControl(std::move(xControl))
+    , maDropTargetHelper(*this)
     , meType(eType)
     , mpParent(nullptr)
 {
-    SetHighlightRange();
-    SetDragDropMode(DragDropMode::CTRL_MOVE | DragDropMode::APP_MOVE  | DragDropMode::APP_DROP);
+    mxControl->connect_focus_in(LINK(this, ScPivotLayoutTreeListBase, GetFocusHdl));
+    mxControl->connect_mnemonic_activate(LINK(this, ScPivotLayoutTreeListBase, MnemonicActivateHdl));
+    mxControl->connect_focus_out(LINK(this, ScPivotLayoutTreeListBase, LoseFocusHdl));
 }
 
 ScPivotLayoutTreeListBase::~ScPivotLayoutTreeListBase()
 {
-    disposeOnce();
-}
-
-void ScPivotLayoutTreeListBase::dispose()
-{
-    mpParent.clear();
-    SvTreeListBox::dispose();
 }
 
 void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
@@ -39,50 +34,58 @@ void ScPivotLayoutTreeListBase::Setup(ScPivotLayoutDialog* pParent)
     mpParent = pParent;
 }
 
-DragDropMode ScPivotLayoutTreeListBase::NotifyStartDrag(TransferDataContainer& /*aTransferDataContainer*/,
-                                                  SvTreeListEntry* /*pEntry*/ )
+ScPivotLayoutTreeDropTarget::ScPivotLayoutTreeDropTarget(ScPivotLayoutTreeListBase& rTreeView)
+    : DropTargetHelper(rTreeView.get_widget().get_drop_target())
+    , m_rTreeView(rTreeView)
 {
-    return GetDragDropMode();
 }
 
-void ScPivotLayoutTreeListBase::DragFinished(sal_Int8 /*nDropAction*/)
-{}
-
-bool ScPivotLayoutTreeListBase::NotifyAcceptDrop(SvTreeListEntry* /*pEntry*/)
+sal_Int8 ScPivotLayoutTreeDropTarget::AcceptDrop(const AcceptDropEvent& rEvt)
 {
-    return true;
+    // to enable the autoscroll when we're close to the edges
+    weld::TreeView& rWidget = m_rTreeView.get_widget();
+    rWidget.get_dest_row_at_pos(rEvt.maPosPixel, nullptr);
+    return DND_ACTION_MOVE;
 }
 
-TriState ScPivotLayoutTreeListBase::NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
-                                                SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
+sal_Int8 ScPivotLayoutTreeDropTarget::ExecuteDrop( const ExecuteDropEvent& rEvt )
 {
-    InsertEntryForSourceTarget(pSource, pTarget);
-    return TRISTATE_FALSE;
+    weld::TreeView& rWidget = m_rTreeView.get_widget();
+    weld::TreeView* pSource = rWidget.get_drag_source();
+    if (!pSource)
+        return DND_ACTION_NONE;
+
+    std::unique_ptr<weld::TreeIter> xTarget(rWidget.make_iterator());
+    int nTargetPos = -1;
+    if (rWidget.get_dest_row_at_pos(rEvt.maPosPixel, xTarget.get()))
+        nTargetPos = rWidget.get_iter_index_in_parent(*xTarget);
+    m_rTreeView.InsertEntryForSourceTarget(*pSource, nTargetPos);
+    return DND_ACTION_MOVE;
 }
 
-TriState ScPivotLayoutTreeListBase::NotifyCopying(SvTreeListEntry* /*pTarget*/, SvTreeListEntry* /*pSource*/,
-                                                 SvTreeListEntry*& /*rpNewParent*/, sal_uLong& /*rNewChildPos*/)
+bool ScPivotLayoutTreeListBase::HasEntry(const weld::TreeIter& rEntry)
 {
-    return TRISTATE_FALSE;
-}
+    std::unique_ptr<weld::TreeIter> xEntry(mxControl->make_iterator());
+    if (!mxControl->get_iter_first(*xEntry))
+        return false;
 
-bool ScPivotLayoutTreeListBase::HasEntry(const SvTreeListEntry* pEntry)
-{
-    SvTreeListEntry* pEachEntry;
-    for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
+    do
     {
-        if(pEachEntry == pEntry)
+        if (mxControl->iter_compare(*xEntry, rEntry))
             return true;
-    }
+    } while (mxControl->iter_next(*xEntry));
+
     return false;
 }
 
 void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector)
 {
-    SvTreeListEntry* pEachEntry;
-    for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
+    std::unique_ptr<weld::TreeIter> xEachEntry(mxControl->make_iterator());
+    if (!mxControl->get_iter_first(*xEachEntry))
+        return;
+    do
     {
-        ScItemValue* pItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
+        ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
         ScPivotFuncData& rFunctionData = pItemValue->maFunctionData;
 
         ScPivotField aField;
@@ -92,46 +95,44 @@ void ScPivotLayoutTreeListBase::PushEntriesToPivotFieldVector(ScPivotFieldVector
         aField.mnDupCount    = rFunctionData.mnDupCount;
         aField.maFieldRef    = rFunctionData.maFieldRef;
         rVector.push_back(aField);
-    }
+    } while (mxControl->iter_next(*xEachEntry));
 }
 
-void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(SvTreeListEntry* /*pSource*/, SvTreeListEntry* /*pTarget*/)
-{}
+void ScPivotLayoutTreeListBase::InsertEntryForSourceTarget(weld::TreeView& /*pSource*/, int /*nTarget*/)
+{
+}
 
 void ScPivotLayoutTreeListBase::RemoveEntryForItem(const ScItemValue* pItemValue)
 {
-    SvTreeListEntry* pEachEntry;
-    for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
-    {
-        ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
-        if (pEachItemValue == pItemValue)
-        {
-            GetModel()->Remove(pEachEntry);
-            return;
-        }
-    }
+    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+    int nPos = mxControl->find_id(sId);
+    if (nPos == -1)
+        return;
+    mxControl->remove(nPos);
 }
 
-void ScPivotLayoutTreeListBase::GetFocus()
+IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, GetFocusHdl, weld::Widget&, void)
 {
-    SvTreeListBox::GetFocus();
-
-    if (!mpParent || !mpParent->mpPreviouslyFocusedListBox)
+    if (!mpParent)
         return;
+    mpParent->mpPreviouslyFocusedListBox = this;
+}
 
-    if (GetGetFocusFlags() & GetFocusFlags::Mnemonic)
-    {
-        SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry();
-        if (pEntry)
-            InsertEntryForSourceTarget(pEntry, nullptr);
-        mpParent->mpPreviouslyFocusedListBox->GrabFocus();
-    }
+IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, MnemonicActivateHdl, weld::Widget&, bool)
+{
+    if (!mpParent || !mpParent->mpPreviouslyFocusedListBox)
+        return false;
+    weld::TreeView& rSource = mpParent->mpPreviouslyFocusedListBox->get_widget();
+    int nEntry = rSource.get_cursor_index();
+    if (nEntry != -1)
+        InsertEntryForSourceTarget(rSource, -1);
+    return true;
 }
 
-void ScPivotLayoutTreeListBase::LoseFocus()
+IMPL_LINK_NOARG(ScPivotLayoutTreeListBase, LoseFocusHdl, weld::Widget&, void)
 {
-    SvTreeListBox::LoseFocus();
-    if (mpParent)
-        mpParent->mpPreviouslyFocusedListBox = this;
+    if (!mpParent)
+        return;
+    mpParent->mpPreviouslyFocusedListBox = nullptr;
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
index 1fd8aad531f0..0c5b8d8320a2 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListData.cxx
@@ -21,9 +21,6 @@
 #include <globstr.hrc>
 #include <scresid.hxx>
 
-VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListData,
-                         WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN)
-
 namespace
 {
 
@@ -66,18 +63,23 @@ OUString lclCreateDataItemName(const PivotFunc nFunctionMask, const OUString& rN
 
 } // anonymous namespace
 
-ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(vcl::Window* pParent, WinBits nBits) :
-    ScPivotLayoutTreeListBase(pParent, nBits, DATA_LIST)
+ScPivotLayoutTreeListData::ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeView> xControl)
+    : ScPivotLayoutTreeListBase(std::move(xControl))
 {
-    SetForceMakeVisible(true);
+    mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeListData, KeyInputHdl));
+    mxControl->connect_row_activated(LINK(this, ScPivotLayoutTreeListData, DoubleClickHdl));
 }
 
 ScPivotLayoutTreeListData::~ScPivotLayoutTreeListData()
 {}
 
-bool ScPivotLayoutTreeListData::DoubleClickHdl()
+IMPL_LINK_NOARG(ScPivotLayoutTreeListData, DoubleClickHdl, weld::TreeView&, void)
 {
-    ScItemValue* pCurrentItemValue = static_cast<ScItemValue*>(GetCurEntry()->GetUserData());
+    int nEntry = mxControl->get_cursor_index();
+    if (nEntry == -1)
+        return;
+
+    ScItemValue* pCurrentItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(nEntry).toInt64());
     ScPivotFuncData& rCurrentFunctionData = pCurrentItemValue->maFunctionData;
 
     SCCOL nCurrentColumn = rCurrentFunctionData.mnCol;
@@ -86,7 +88,7 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
     ScAbstractDialogFactory* pFactory = ScAbstractDialogFactory::Create();
 
     ScopedVclPtr<AbstractScDPFunctionDlg> pDialog(
-        pFactory->CreateScDPFunctionDlg(GetFrameWeld(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
+        pFactory->CreateScDPFunctionDlg(mxControl.get(), mpParent->GetLabelDataVector(), rCurrentLabelData, rCurrentFunctionData));
 
     if (pDialog->Execute() == RET_OK)
     {
@@ -104,15 +106,13 @@ bool ScPivotLayoutTreeListData::DoubleClickHdl()
                                     rDFData.maName,
                                     rCurrentFunctionData.mnDupCount);
 
-        SetEntryText(GetCurEntry(), sDataItemName);
+        mxControl->set_text(nEntry, sDataItemName);
     }
-
-    return true;
 }
 
 void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
 {
-    Clear();
+    mxControl->clear();
     maDataItemValues.clear();
 
     for (ScPivotField& rField : rDataFields)
@@ -139,16 +139,20 @@ void ScPivotLayoutTreeListData::FillDataField(ScPivotFieldVector& rDataFields)
                                                        pItemValue->maFunctionData.mnDupCount);
 
         maDataItemValues.push_back(std::unique_ptr<ScItemValue>(pItemValue));
-        InsertEntry(sDataItemName, nullptr, false, TREELIST_APPEND, pItemValue);
+        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+        mxControl->append(sId, sDataItemName);
     }
 }
 
 void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames)
 {
-    SvTreeListEntry* pLoopEntry;
-    for (pLoopEntry = First(); pLoopEntry != nullptr; pLoopEntry = Next(pLoopEntry))
+    std::unique_ptr<weld::TreeIter> xLoopEntry(mxControl->make_iterator());
+    if (!mxControl->get_iter_first(*xLoopEntry))
+        return;
+
+    do
     {
-        ScItemValue* pEachItemValue = static_cast<ScItemValue*>(pLoopEntry->GetUserData());
+        ScItemValue* pEachItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xLoopEntry).toInt64());
         SCCOL nColumn = pEachItemValue->maFunctionData.mnCol;
 
         ScDPLabelData& rLabelData = mpParent->GetLabelData(nColumn);
@@ -166,31 +170,30 @@ void ScPivotLayoutTreeListData::PushDataFieldNames(std::vector<ScDPName>& rDataF
         }
 
         rDataFieldNames.emplace_back(rLabelData.maName, sLayoutName, rLabelData.mnDupCount);
-    }
+    } while (mxControl->iter_next(*xLoopEntry));
 }
 
-void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget)
+void ScPivotLayoutTreeListData::InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget)
 {
-    ScItemValue* pItemValue = static_cast<ScItemValue*>(pSource->GetUserData());
+    ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(rSource.get_selected_id().toInt64());
 
     if (mpParent->IsDataElement(pItemValue->maFunctionData.mnCol))
         return;
 
-    if (HasEntry(pSource))
+    if (&rSource == mxControl.get())
     {
-        OUString rText = GetEntryText(pSource);
-        GetModel()->Remove(pSource);
-        sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
-        InsertEntry(rText, nullptr, false, nPosition, pItemValue);
+        OUString sText = mxControl->get_selected_text();
+        OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pItemValue)));
+        mxControl->remove_id(sId);
+        mxControl->insert(nullptr, nTarget, &sText, &sId, nullptr, nullptr, nullptr, false, nullptr);
     }
     else
     {
-        sal_uLong nPosition = (pTarget == nullptr) ? TREELIST_APPEND : GetModel()->GetAbsPos(pTarget) + 1;
-        InsertEntryForItem(pItemValue->mpOriginalItemValue, nPosition);
+        InsertEntryForItem(pItemValue->mpOriginalItemValue, nTarget);
     }
 }
 
-void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition)
+void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, int nPosition)
 {
     ScItemValue* pDataItemValue = new ScItemValue(pItemValue);
     pDataItemValue->mpOriginalItemValue = pItemValue;
@@ -211,7 +214,8 @@ void ScPivotLayoutTreeListData::InsertEntryForItem(ScItemValue* pItemValue, sal_
                             pDataItemValue->maName,
                             rFunctionData.mnDupCount);
 
-    InsertEntry(sDataName, nullptr, false, nPosition, pDataItemValue);
+    OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pDataItemValue)));
+    mxControl->insert(nullptr, nPosition, &sDataName, &sId, nullptr, nullptr, nullptr, false, nullptr);
 }
 
 void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValue)
@@ -223,10 +227,12 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
     rInputFunctionData.mnDupCount = 0;
     sal_uInt8 nMaxDuplicateCount = 0;
 
-    SvTreeListEntry* pEachEntry;
-    for (pEachEntry = First(); pEachEntry != nullptr; pEachEntry = Next(pEachEntry))
+    std::unique_ptr<weld::TreeIter> xEachEntry(mxControl->make_iterator());
+    if (!mxControl->get_iter_first(*xEachEntry))
+        return;
+    do
     {
-        ScItemValue* pItemValue = static_cast<ScItemValue*>(pEachEntry->GetUserData());
+        ScItemValue* pItemValue = reinterpret_cast<ScItemValue*>(mxControl->get_id(*xEachEntry).toInt64());
         if (pItemValue == pInputItemValue)
             continue;
 
@@ -239,7 +245,7 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
             if(rFunctionData.mnDupCount > nMaxDuplicateCount)
                 nMaxDuplicateCount = rFunctionData.mnDupCount;
         }
-    }
+    } while (mxControl->iter_next(*xEachEntry));
 
     if(bFoundDuplicate)
     {
@@ -247,20 +253,20 @@ void ScPivotLayoutTreeListData::AdjustDuplicateCount(ScItemValue* pInputItemValu
     }
 }
 
-void ScPivotLayoutTreeListData::KeyInput(const KeyEvent& rKeyEvent)
+IMPL_LINK(ScPivotLayoutTreeListData, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
 {
     vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
     sal_uInt16 nCode = aCode.GetCode();
 
     if (nCode == KEY_DELETE)
     {
-        const SvTreeListEntry* pEntry = GetCurEntry();
-        if (pEntry)
-            GetModel()->Remove(pEntry);
-        return;
+        int nEntry = mxControl->get_cursor_index();
+        if (nEntry != -1)
+            mxControl->remove(nEntry);
+        return true;
     }
 
-    SvTreeListBox::KeyInput(rKeyEvent);
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
index 82cfc0ec9bd7..d09afc5c759f 100644
--- a/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
+++ b/sc/source/ui/dbgui/PivotLayoutTreeListLabel.cxx
@@ -18,14 +18,11 @@
 #include <vcl/treelistentry.hxx>
 #include <pivot.hxx>
 
-VCL_BUILDER_FACTORY_ARGS(ScPivotLayoutTreeListLabel,
-                         WB_BORDER | WB_TABSTOP | WB_CLIPCHILDREN);
-
-ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(vcl::Window* pParent, WinBits nBits)
-    : ScPivotLayoutTreeListBase(pParent, nBits, LABEL_LIST)
+ScPivotLayoutTreeListLabel::ScPivotLayoutTreeListLabel(std::unique_ptr<weld::TreeView> xControl)
+    : ScPivotLayoutTreeListBase(std::move(xControl), LABEL_LIST)
     , maDataItem(0)
 {
-    SetForceMakeVisible(true);
+    mxControl->connect_key_press(LINK(this, ScPivotLayoutTreeListLabel, KeyInputHdl));
 }
 
 ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
@@ -33,7 +30,7 @@ ScPivotLayoutTreeListLabel::~ScPivotLayoutTreeListLabel()
 
 void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVector)
 {
-    Clear();
+    mxControl->clear();
     maItemValues.clear();
 
     for (std::unique_ptr<ScDPLabelData> const & pLabelData : rLabelVector)
@@ -47,17 +44,16 @@ void ScPivotLayoutTreeListLabel::FillLabelFields(ScDPLabelDataVector& rLabelVect
 
         if (pLabelData->mnOriginalDim < 0 && !pLabelData->mbDataLayout)
         {
-            SvTreeListEntry* pEntry = InsertEntry(pLabelData->maName);
-            pEntry->SetUserData(pValue);
+            mxControl->append(OUString::number(reinterpret_cast<sal_Int64>(pValue)), pLabelData->maName);
         }
     }
 }
 
-void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* /*pTarget*/)
+void ScPivotLayoutTreeListLabel::InsertEntryForSourceTarget(weld::TreeView& rSource, int /*nTarget*/)
 {
-    ScPivotLayoutTreeListBase *pSourceTree = mpParent->FindListBoxFor(pSource);
-    if (pSourceTree)
-        pSourceTree->RemoveSelection();
+    if (&rSource == mxControl.get())
+        return;
+    rSource.remove(rSource.get_selected_index());
 }
 
 bool ScPivotLayoutTreeListLabel::IsDataElement(SCCOL nColumn)
@@ -72,20 +68,20 @@ ScItemValue* ScPivotLayoutTreeListLabel::GetItem(SCCOL nColumn)
     return maItemValues[nColumn].get();
 }
 
-void ScPivotLayoutTreeListLabel::KeyInput(const KeyEvent& rKeyEvent)
+IMPL_LINK(ScPivotLayoutTreeListLabel, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
 {
     vcl::KeyCode aCode = rKeyEvent.GetKeyCode();
     sal_uInt16 nCode = aCode.GetCode();
 
     if (nCode == KEY_DELETE)
     {
-        const SvTreeListEntry* pEntry = GetCurEntry();
-        if (pEntry)
-            GetModel()->Remove(pEntry);
-        return;
+        int nEntry = mxControl->get_cursor_index();
+        if (nEntry != -1)
+            mxControl->remove(nEntry);
+        return true;
     }
 
-    SvTreeListBox::KeyInput(rKeyEvent);
+    return false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 7d93d84c5e5e..a082dbfdd544 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -234,7 +234,7 @@ namespace
 }
 
 ScDPFunctionDlg::ScDPFunctionDlg(
-        weld::Window* pParent, const ScDPLabelDataVector& rLabelVec,
+        weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
         const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData)
     : GenericDialogController(pParent, "modules/scalc/ui/datafielddialog.ui", "DataFieldDialog")
     , mxLbFunc(new ScDPFunctionListBox(m_xBuilder->weld_tree_view("functions")))
@@ -443,7 +443,7 @@ IMPL_LINK_NOARG(ScDPFunctionDlg, DblClickHdl, weld::TreeView&, void)
     m_xDialog->response(RET_OK);
 }
 
-ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Window* pParent, ScDPObject& rDPObj,
+ScDPSubtotalDlg::ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
         const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
         const ScDPNameVec& rDataFields, bool bEnableLayout)
     : GenericDialogController(pParent, "modules/scalc/ui/pivotfielddialog.ui", "PivotFieldDialog")
diff --git a/sc/source/ui/inc/PivotLayoutDialog.hxx b/sc/source/ui/inc/PivotLayoutDialog.hxx
index 7d24443b4f69..55a476b86faf 100644
--- a/sc/source/ui/inc/PivotLayoutDialog.hxx
+++ b/sc/source/ui/inc/PivotLayoutDialog.hxx
@@ -33,12 +33,12 @@ public:
     ~ScItemValue();
 };
 
-class ScPivotLayoutDialog : public ScAnyRefDlg
+class ScPivotLayoutDialog : public ScAnyRefDlgController
 {
 public:
     ScDPObject maPivotTableObject;
 
-    VclPtr<ScPivotLayoutTreeListBase> mpPreviouslyFocusedListBox;
+    ScPivotLayoutTreeListBase* mpPreviouslyFocusedListBox;
 
 private:
     ScViewData* mpViewData;
@@ -46,52 +46,62 @@ private:
 
     bool const mbNewPivotTable;
 
-    VclPtr<ScPivotLayoutTreeListLabel> mpListBoxField;
-    VclPtr<ScPivotLayoutTreeList>      mpListBoxPage;
-    VclPtr<ScPivotLayoutTreeList>      mpListBoxColumn;
-    VclPtr<ScPivotLayoutTreeList>      mpListBoxRow;
-    VclPtr<ScPivotLayoutTreeListData>  mpListBoxData;
-
-    VclPtr<CheckBox> mpCheckIgnoreEmptyRows;
-    VclPtr<CheckBox> mpCheckTotalColumns;
-    VclPtr<CheckBox> mpCheckAddFilter;
-    VclPtr<CheckBox> mpCheckIdentifyCategories;
-    VclPtr<CheckBox> mpCheckTotalRows;
-    VclPtr<CheckBox> mpCheckDrillToDetail;
-
-    VclPtr<RadioButton> mpSourceRadioNamedRange;
-    VclPtr<RadioButton> mpSourceRadioSelection;
-
-    VclPtr<ListBox>            mpSourceListBox;
-    VclPtr<formula::RefEdit>   mpSourceEdit;
-    VclPtr<formula::RefButton> mpSourceButton;
-
-    VclPtr<RadioButton>        mpDestinationRadioNewSheet;
-    VclPtr<RadioButton>        mpDestinationRadioNamedRange;
-    VclPtr<RadioButton>        mpDestinationRadioSelection;
-
-    VclPtr<ListBox>            mpDestinationListBox;
-    VclPtr<formula::RefEdit>   mpDestinationEdit;
-    VclPtr<formula::RefButton> mpDestinationButton;
-
-    VclPtr<PushButton>       mpBtnOK;
-    VclPtr<CancelButton>     mpBtnCancel;
-
-    VclPtr<formula::RefEdit>   mpActiveEdit;
     ScAddress::Details const  maAddressDetails;
     bool                mbDialogLostFocus;
 
-    DECL_LINK(CancelClicked,       Button*, void);
-    DECL_LINK(OKClicked,           Button*, void);
-    DECL_LINK(GetFocusHandler,     Control&, void);
-    DECL_LINK(LoseFocusHandler,    Control&, void);
-    DECL_LINK(ToggleSource,        RadioButton&, void);
-    DECL_LINK(ToggleDestination,   RadioButton&, void);
-    DECL_LINK(SourceListSelected,  ListBox&, void);
-    DECL_LINK(SourceEditModified,  Edit&, void);
+    formula::WeldRefEdit* mpActiveEdit;
+    std::unique_ptr<ScPivotLayoutTreeListLabel> mxListBoxField;
+    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxPage;
+    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxColumn;
+    std::unique_ptr<ScPivotLayoutTreeList> mxListBoxRow;
+    std::unique_ptr<ScPivotLayoutTreeListData>  mxListBoxData;
+
+    std::unique_ptr<weld::CheckButton> mxCheckIgnoreEmptyRows;
+    std::unique_ptr<weld::CheckButton> mxCheckTotalColumns;
+    std::unique_ptr<weld::CheckButton> mxCheckAddFilter;
+    std::unique_ptr<weld::CheckButton> mxCheckIdentifyCategories;
+    std::unique_ptr<weld::CheckButton> mxCheckTotalRows;
+    std::unique_ptr<weld::CheckButton> mxCheckDrillToDetail;
+
+    std::unique_ptr<weld::RadioButton> mxSourceRadioNamedRange;
+    std::unique_ptr<weld::RadioButton> mxSourceRadioSelection;
+
+    std::unique_ptr<weld::ComboBox> mxSourceListBox;
+    std::unique_ptr<formula::WeldRefEdit> mxSourceEdit;
+    std::unique_ptr<formula::WeldRefButton> mxSourceButton;
+
+    std::unique_ptr<weld::RadioButton> mxDestinationRadioNewSheet;
+    std::unique_ptr<weld::RadioButton> mxDestinationRadioNamedRange;
+    std::unique_ptr<weld::RadioButton> mxDestinationRadioSelection;
+
+    std::unique_ptr<weld::ComboBox> mxDestinationListBox;
+    std::unique_ptr<formula::WeldRefEdit> mxDestinationEdit;
+    std::unique_ptr<formula::WeldRefButton> mxDestinationButton;
+
+    std::unique_ptr<weld::Button> mxBtnOK;
+    std::unique_ptr<weld::Button> mxBtnCancel;
+
+    std::unique_ptr<weld::Frame> mxSourceFrame;
+    std::unique_ptr<weld::Label> mxSourceLabel;
+    std::unique_ptr<weld::Frame> mxDestFrame;
+    std::unique_ptr<weld::Label> mxDestLabel;
+
+    std::unique_ptr<weld::Expander> mxOptions;
+    std::unique_ptr<weld::Expander> mxMore;
+
+    DECL_LINK(CancelClicked, weld::Button&, void);
+    DECL_LINK(OKClicked, weld::Button&, void);
+    DECL_LINK(GetEditFocusHandler, formula::WeldRefEdit&, void);
+    DECL_LINK(GetButtonFocusHandler, formula::WeldRefButton&, void);
+    DECL_LINK(LoseEditFocusHandler, formula::WeldRefEdit&, void);
+    DECL_LINK(LoseButtonFocusHandler, formula::WeldRefButton&, void);
+    DECL_LINK(ToggleSource, weld::ToggleButton&, void);
+    DECL_LINK(ToggleDestination, weld::ToggleButton&, void);
+    DECL_LINK(SourceListSelected, weld::ComboBox&, void);
+    DECL_LINK(SourceEditModified, formula::WeldRefEdit&, void);
     void ToggleSource();
     void ToggleDestination();
-    virtual bool Close() override;
+    virtual void Close() override;
 
     ScPivotParam maPivotParameters;
 
@@ -104,10 +114,9 @@ private:
     bool GetDestination(ScRange& aDestinationRange, bool& bToNewSheet);
 
 public:
-    ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent,
+    ScPivotLayoutDialog(SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, weld::Window* pParent,
                              ScViewData* pViewData, const ScDPObject* pPivotTableObject, bool bCreateNewPivotTable);
     virtual ~ScPivotLayoutDialog() override;
-    virtual void dispose() override;
 
     virtual void SetReference(const ScRange& rReferenceRange, ScDocument* pDocument) override;
     virtual void SetActive() override;
@@ -127,8 +136,6 @@ public:
     ScDPLabelData& GetLabelData(SCCOL nColumn);
     ScDPLabelDataVector& GetLabelDataVector() { return maPivotParameters.maLabelArray;}
     void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
-
-    ScPivotLayoutTreeListBase* FindListBoxFor(const SvTreeListEntry *pEntry);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeList.hxx b/sc/source/ui/inc/PivotLayoutTreeList.hxx
index 8af3cd1d193d..02120e7b4812 100644
--- a/sc/source/ui/inc/PivotLayoutTreeList.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeList.hxx
@@ -12,6 +12,7 @@
 #define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELIST_HXX
 
 #include <memory>
+#include <tools/solar.h>
 #include "PivotLayoutTreeListBase.hxx"
 
 class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
@@ -19,19 +20,19 @@ class ScPivotLayoutTreeList : public ScPivotLayoutTreeListBase
 private:
     std::vector<std::unique_ptr<ScItemValue> > maItemValues;
 
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+    DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
+
 public:
-    ScPivotLayoutTreeList(vcl::Window* pParent, WinBits nBits);
+    ScPivotLayoutTreeList(std::unique_ptr<weld::TreeView> xControl);
     virtual ~ScPivotLayoutTreeList() override;
-    virtual bool DoubleClickHdl() override;
 
     void Setup(ScPivotLayoutDialog* pParent, SvPivotTreeListType eType);
     void FillFields(ScPivotFieldVector& rFieldVector);
 
+    virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
 protected:
-    virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
-    void InsertEntryForItem(const ScItemValue* pItemValue, sal_uLong nPosition);
-
-    virtual void KeyInput(const KeyEvent& rKeyEvent) override;
+    void InsertEntryForItem(const ScItemValue* pItemValue, int nPosition);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
index fb5d9a0061b9..4796fdc673ac 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListBase.hxx
@@ -11,14 +11,27 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTBASE_HXX
 
-#include <vcl/treelistbox.hxx>
-
+#include <vcl/transfer.hxx>
+#include <vcl/weld.hxx>
 #include <pivot.hxx>
 
 class ScPivotLayoutDialog;
+class ScPivotLayoutTreeListBase;
 class ScItemValue;
 
-class ScPivotLayoutTreeListBase : public SvTreeListBox
+class ScPivotLayoutTreeDropTarget : public DropTargetHelper
+{
+private:
+    ScPivotLayoutTreeListBase& m_rTreeView;
+
+    virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
+    virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
+
+public:
+    ScPivotLayoutTreeDropTarget(ScPivotLayoutTreeListBase& rTreeView);
+};
+
+class ScPivotLayoutTreeListBase
 {
 public:
     enum SvPivotTreeListType
@@ -32,36 +45,29 @@ public:
     };
 
 protected:
+    std::unique_ptr<weld::TreeView> mxControl;
+    ScPivotLayoutTreeDropTarget maDropTargetHelper;
     SvPivotTreeListType meType;
-    VclPtr<ScPivotLayoutDialog> mpParent;
+    ScPivotLayoutDialog* mpParent;
+
+    DECL_LINK(GetFocusHdl, weld::Widget&, void);
+    DECL_LINK(MnemonicActivateHdl, weld::Widget&, bool);
+    DECL_LINK(LoseFocusHdl, weld::Widget&, void);
 
 public:
     void Setup(ScPivotLayoutDialog* pParent);
 
-    ScPivotLayoutTreeListBase(vcl::Window* pParent, WinBits nBits, SvPivotTreeListType eType = UNDEFINED);
-    virtual ~ScPivotLayoutTreeListBase() override;
-    virtual void dispose() override;
-
-    virtual bool NotifyAcceptDrop(SvTreeListEntry* pEntry) override;
-    virtual TriState NotifyMoving(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
-                                  SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) override;
-    virtual TriState NotifyCopying(SvTreeListEntry* pTarget, SvTreeListEntry* pSource,
-                                   SvTreeListEntry*& rpNewParent, sal_uLong& rNewChildPos) override;
-    virtual DragDropMode NotifyStartDrag(TransferDataContainer& aTransferDataContainer,
-                                         SvTreeListEntry* pEntry) override;
-    virtual void DragFinished(sal_Int8 nDropAction) override;
-
-    virtual void GetFocus() override;
-    virtual void LoseFocus() override;
+    ScPivotLayoutTreeListBase(std::unique_ptr<weld::TreeView> xControl, SvPivotTreeListType eType = UNDEFINED);
+    weld::TreeView& get_widget() { return *mxControl; }
+    virtual ~ScPivotLayoutTreeListBase();
 
     void PushEntriesToPivotFieldVector(ScPivotFieldVector& rVector);
 
     void RemoveEntryForItem(const ScItemValue* pItemValue);
 
-    bool HasEntry(const SvTreeListEntry* pEntry);
+    bool HasEntry(const weld::TreeIter& rEntry);
 
-protected:
-    virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget);
+    virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/PivotLayoutTreeListData.hxx b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
index 0f2847c2c4dc..c9f9dce4366c 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListData.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListData.hxx
@@ -12,27 +12,29 @@
 #define INCLUDED_SC_SOURCE_UI_INC_PIVOTLAYOUTTREELISTDATA_HXX
 
 #include "PivotLayoutTreeListBase.hxx"
+#include <tools/solar.h>
 #include <vector>
 #include <memory>
 
 class ScPivotLayoutTreeListData final : public ScPivotLayoutTreeListBase
 {
+private:
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+    DECL_LINK(DoubleClickHdl, weld::TreeView&, void);
+
 public:
-    ScPivotLayoutTreeListData(vcl::Window* pParent, WinBits nBits);
+    ScPivotLayoutTreeListData(std::unique_ptr<weld::TreeView> xControl);
     virtual ~ScPivotLayoutTreeListData() override;
-    virtual bool DoubleClickHdl() override;
 
     void FillDataField(ScPivotFieldVector& rDataFields);
     void PushDataFieldNames(std::vector<ScDPName>& rDataFieldNames);
+    virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
 
 private:
-    virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
-    void InsertEntryForItem(ScItemValue* pItemValue, sal_uLong nPosition);
+    void InsertEntryForItem(ScItemValue* pItemValue, int nPosition);
 
     void AdjustDuplicateCount(ScItemValue* pInputItemValue);
 
-    virtual void KeyInput(const KeyEvent& rKeyEvent) override;
-
     std::vector<std::unique_ptr<ScItemValue> > maDataItemValues;
 };
 
diff --git a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
index 9934dac5d523..ac2ccc0b1a8f 100644
--- a/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
+++ b/sc/source/ui/inc/PivotLayoutTreeListLabel.hxx
@@ -21,16 +21,14 @@ private:
     std::vector<std::unique_ptr<ScItemValue> > maItemValues;
     SCCOL maDataItem;
 
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
 public:
-    ScPivotLayoutTreeListLabel(vcl::Window* pParent, WinBits nBits);
+    ScPivotLayoutTreeListLabel(std::unique_ptr<weld::TreeView> xControl);
     virtual ~ScPivotLayoutTreeListLabel() override;
     void FillLabelFields(ScDPLabelDataVector& rLabelVector);
     ScItemValue* GetItem(SCCOL nColumn);
     bool IsDataElement(SCCOL nColumn);
-
-protected:
-    virtual void InsertEntryForSourceTarget(SvTreeListEntry* pSource, SvTreeListEntry* pTarget) override;
-    virtual void KeyInput(const KeyEvent& rKeyEvent) override;
+    virtual void InsertEntryForSourceTarget(weld::TreeView& rSource, int nTarget) override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index 2193043e0cd1..19b1d49cb164 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -54,7 +54,7 @@ class ScDPFunctionDlg : public weld::GenericDialogController
 {
     typedef std::unordered_map< OUString, OUString > NameMapType;
 public:
-    explicit ScDPFunctionDlg(weld::Window* pParent, const ScDPLabelDataVector& rLabelVec,
+    explicit ScDPFunctionDlg(weld::Widget* pParent, const ScDPLabelDataVector& rLabelVec,
                              const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData );
     virtual ~ScDPFunctionDlg() override;
     PivotFunc               GetFuncMask() const;
@@ -92,7 +92,7 @@ private:
 class ScDPSubtotalDlg : public weld::GenericDialogController
 {
 public:
-    explicit            ScDPSubtotalDlg(weld::Window* pParent, ScDPObject& rDPObj,
+    explicit            ScDPSubtotalDlg(weld::Widget* pParent, ScDPObject& rDPObj,
                             const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData,
                             const ScDPNameVec& rDataFields, bool bEnableLayout);
     virtual             ~ScDPSubtotalDlg() override;
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index fd4e47966f6b..8a389b529ade 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -33,11 +33,11 @@
 #include <validate.hxx>
 
 SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER)
 SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
-SFX_IMPL_MODELESSDIALOG_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE)
 SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
 SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFilterDlgWrapper, SID_FILTER )
 SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
@@ -131,7 +131,7 @@ IMPL_CONTROLLER_CHILD_CTOR( ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
 
 IMPL_CONTROLLER_CHILD_CTOR( ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
 
-IMPL_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
+IMPL_CONTROLLER_CHILD_CTOR( ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE )
 
 IMPL_CONTROLLER_CHILD_CTOR( ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
 
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 9c7691a1464a..a5a04d91b63b 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -140,25 +140,8 @@ VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
     if(pCW)
         pCW->SetHideNotDelete(true);
 
-    ScDocument* pDoc = GetViewData().GetDocument();
-
     switch( nSlotId )
     {
-        case SID_OPENDLG_PIVOTTABLE:
-        {
-            // all settings must be in pDialogDPObject
-
-            if( pDialogDPObject )
-            {
-                // Check for an existing datapilot output.
-                ScViewData& rViewData = GetViewData();
-                rViewData.SetRefTabNo( rViewData.GetTabNo() );
-                ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
-                pResult = VclPtr<ScPivotLayoutDialog>::Create(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr);
-            }
-        }
-        break;
-
         case SID_OPENDLG_FUNCTION:
         {
             // dialog checks, what is in the cell
@@ -477,6 +460,21 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
             xResult.reset(new ScXMLSourceDlg(pB, pCW, pParent, pDoc));
             break;
         }
+        case SID_OPENDLG_PIVOTTABLE:
+        {
+            // all settings must be in pDialogDPObject
+
+            if( pDialogDPObject )
+            {
+                // Check for an existing datapilot output.
+                ScViewData& rViewData = GetViewData();
+                rViewData.SetRefTabNo( rViewData.GetTabNo() );
+                ScDPObject* pObj = pDoc->GetDPAtCursor(rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo());
+                xResult.reset(new ScPivotLayoutDialog(pB, pCW, pParent, &rViewData, pDialogDPObject.get(), pObj == nullptr));
+            }
+
+            break;
+        }
     }
 
     if (xResult)
diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
index cf96beaf5069..1380840620bc 100644
--- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
+++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
@@ -1,13 +1,57 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sc">
   <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="GtkTreeStore" id="liststore4">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkTreeStore" id="liststore5">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
   <object class="GtkDialog" id="PivotTableLayout">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="pivottablelayoutdialog|PivotTableLayout">Pivot Table Layout</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -22,6 +66,7 @@
                 <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
                 <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
@@ -81,6 +126,7 @@
               <object class="GtkBox" id="box2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
                 <property name="vexpand">True</property>
                 <property name="border_width">6</property>
                 <property name="spacing">6</property>
@@ -104,12 +150,12 @@
                           <object class="GtkLabel" id="label3">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="xpad">4</property>
                             <property name="label" translatable="yes" context="pivottablelayoutdialog|label3">Column Fields:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">listbox-column</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
@@ -121,15 +167,40 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="sclo-ScPivotLayoutTreeList" id="listbox-column">
+                          <object class="GtkScrolledWindow">
                             <property name="width_request">200</property>
                             <property name="height_request">100</property>
                             <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="Pivot Table List-selection"/>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="listbox-column">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="reorderable">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="Pivot Table List-selection"/>
+                                </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>
@@ -156,12 +227,12 @@
                           <object class="GtkLabel" id="label5">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="xpad">4</property>
                             <property name="label" translatable="yes" context="pivottablelayoutdialog|label5">Data Fields:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">listbox-data</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
@@ -173,15 +244,40 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="sclo-ScPivotLayoutTreeListData" id="listbox-data">
+                          <object class="GtkScrolledWindow">
+                            <property name="visible">True</property>
                             <property name="width_request">240</property>
                             <property name="height_request">120</property>
-                            <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="Pivot Table Data List-selection"/>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="listbox-data">
+                                <property name="visible">True</property>
+                                <property name="reorderable">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="Pivot Table Data List-selection"/>
+                                </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>
@@ -208,12 +304,12 @@
                           <object class="GtkLabel" id="label4">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="xpad">4</property>
                             <property name="label" translatable="yes" context="pivottablelayoutdialog|label4">Row Fields:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">listbox-row</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
@@ -225,14 +321,38 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="sclo-ScPivotLayoutTreeList" id="listbox-row">
+                          <object class="GtkScrolledWindow">
+                            <property name="visible">True</property>
                             <property name="width_request">180</property>
                             <property name="height_request">100</property>
-                            <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="vexpand">True</property>
-                            <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="Pivot Table List-selection4"/>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="listbox-row">
+                                <property name="visible">True</property>
+                                <property name="reorderable">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="vexpand">True</property>
+                                <property name="model">liststore5</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="Pivot Table List-selection4"/>
+                                </child>
+                                <child>
+                                  <object class="GtkTreeViewColumn" id="treeviewcolumn5">
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderertext5"/>
+                                      <attributes>
+                                        <attribute name="text">0</attribute>
+                                      </attributes>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
                             </child>
                           </object>
                           <packing>
@@ -259,12 +379,12 @@
                           <object class="GtkLabel" id="label2">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
                             <property name="xpad">4</property>
                             <property name="label" translatable="yes" context="pivottablelayoutdialog|label2">Page Fields:</property>
                             <property name="use_underline">True</property>
                             <property name="mnemonic_widget">listbox-page</property>
+                            <property name="xalign">0</property>
+                            <property name="yalign">0</property>
                             <attributes>
                               <attribute name="weight" value="bold"/>
                             </attributes>
@@ -276,15 +396,40 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="sclo-ScPivotLayoutTreeList" id="listbox-page">
+                          <object class="GtkScrolledWindow">
+                            <property name="visible">True</property>
                             <property name="width_request">200</property>
                             <property name="height_request">100</property>
-                            <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="Pivot Table List-selection5"/>
+                            <property name="shadow_type">in</property>
+                            <child>
+                              <object class="GtkTreeView" id="listbox-page">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="reorderable">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>

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list