[Libreoffice-commits] core.git: Branch 'feature/eszka' - 13 commits - desktop/source include/vcl sc/source vcl/inc vcl/jsdialog vcl/source

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Fri Nov 6 11:19:44 UTC 2020


Rebased ref, commits from common ancestor:
commit 5f134230d211448c2c73bd4772955acbcf456978
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Nov 4 11:37:15 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:56 2020 +0100

    jsdialog: notify about autofilter dropdown close
    
    Change-Id: If6eb585f04f2d7441a7950bbdca378cc92ba641b

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 7f41cfa4389a..493400ea3efb 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -32,6 +32,8 @@
 #include <rtl/math.hxx>
 #include <tools/wintypes.hxx>
 #include <unotools/charclass.hxx>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include <document.hxx>
 
@@ -1342,11 +1344,40 @@ void ScCheckListMenuControl::launch(const tools::Rectangle& rRect)
     StartPopupMode(aRect, FloatWinPopupFlags::Down);
 }
 
+void ScCheckListMenuControl::NotifyCloseLOK()
+{
+    VclPtr<vcl::Window> aNotifierWindow = mxFrame->GetParentWithLOKNotifier();
+    if (aNotifierWindow) {
+        try
+        {
+            const vcl::ILibreOfficeKitNotifier* pNotifier = aNotifierWindow->GetLOKNotifier();
+            if (pNotifier)
+            {
+                std::stringstream aStream;
+                boost::property_tree::ptree aTree;
+                aTree.put("jsontype", "dockingwindow");
+                aTree.put("action", "close");
+
+                boost::property_tree::write_json(aStream, aTree);
+                const std::string message = aStream.str();
+                pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
+            }
+        }
+        catch (boost::property_tree::json_parser::json_parser_error& rError)
+        {
+            SAL_WARN("vcl", rError.message());
+        }
+    }
+}
+
 void ScCheckListMenuControl::close(bool bOK)
 {
     if (bOK && mxOKAction)
         mxOKAction->execute();
     EndPopupMode();
+
+    if (comphelper::LibreOfficeKit::isActive())
+        NotifyCloseLOK();
 }
 
 void ScCheckListMenuControl::setExtendedData(std::unique_ptr<ExtendedData> p)
@@ -1374,6 +1405,9 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, PopupModeEndHdl, FloatingWindow*, void)
     clearSelectedMenuItem();
     if (mxPopupEndAction)
         mxPopupEndAction->execute();
+
+    if (comphelper::LibreOfficeKit::isActive())
+        NotifyCloseLOK();
 }
 
 int ScCheckListMenuControl::GetTextWidth(const OUString& rsName) const
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index eb5c418a3cad..49d4822ecd3b 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -209,6 +209,8 @@ private:
 
     void CreateDropDown();
 
+    void NotifyCloseLOK();
+
     DECL_LINK(ButtonHdl, weld::Button&, void);
     DECL_LINK(TriStateHdl, weld::ToggleButton&, void);
 
commit 50e7b889725b66a85995fb83dcc5cf773e689f5b
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 3 13:27:47 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:56 2020 +0100

    jsdialog: cleanup when destroying builder
    
    Change-Id: I38bf65eb96b560970fb03eafaea89446e89a2896

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index b0f4e42976d0..2412fe2197fb 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -65,6 +65,7 @@ class JSInstanceBuilder : public SalInstanceBuilder
     /// used in case of tab pages where dialog is not a direct top level
     VclPtr<vcl::Window> m_aParentDialog;
     VclPtr<vcl::Window> m_aContentWindow;
+    std::list<std::string> m_aRememberedWidgets;
     std::string m_sTypeOfJSON;
     bool m_bHasTopLevelDialog;
     bool m_bIsNotebookbar;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index f86b9b53236e..877ebaf6e8db 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -187,7 +187,18 @@ JSInstanceBuilder* JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window*
 JSInstanceBuilder::~JSInstanceBuilder()
 {
     if (m_nWindowId && (m_bHasTopLevelDialog || m_bIsNotebookbar))
+    {
         GetLOKWeldWidgetsMap().erase(m_nWindowId);
+    }
+    else
+    {
+        auto it = GetLOKWeldWidgetsMap().find(m_nWindowId);
+        if (it != GetLOKWeldWidgetsMap().end())
+        {
+            std::for_each(m_aRememberedWidgets.begin(), m_aRememberedWidgets.end(),
+                          [it](std::string& sId) { it->second.erase(sId.c_str()); });
+        }
+    }
 }
 
 std::map<sal_uInt64, WidgetMap>& JSInstanceBuilder::GetLOKWeldWidgetsMap()
@@ -227,6 +238,7 @@ void JSInstanceBuilder::RememberWidget(const OString& id, weld::Widget* pWidget)
     {
         it->second.erase(id);
         it->second.insert(WidgetMap::value_type(id, pWidget));
+        m_aRememberedWidgets.push_back(id.getStr());
     }
 }
 
commit 62cefafd861ba61fd97c1d75200083941ce876b1
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Tue Nov 3 11:32:21 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:56 2020 +0100

    jsdialog: prevent from crash
    
    Change-Id: If17738b7f58037929e29def75736434c33649b42

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index a2efd53ceb58..91a2750f4686 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -48,7 +48,7 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                 if (sAction == "selected")
                 {
                     int separatorPos = rData["data"].indexOf(';');
-                    if (separatorPos)
+                    if (separatorPos > 0)
                     {
                         OUString entryPos = rData["data"].copy(0, separatorPos);
                         OString posString = OUStringToOString(entryPos, RTL_TEXTENCODING_ASCII_US);
commit 1276b05b66184208f26b12fad9088fca5ac0d0b0
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 7 20:00:08 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    Resolves: tdf#133744 stop processing if DoubleClickHdl consumed event
    
    Change-Id: I69bb7d670b04b082df294d5ea56dfd6e8d6d4fe7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95703
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 087496706d7c..5ca02e42ee74 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2427,8 +2427,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
             break;
 
         case KEY_RETURN:
-            m_pView->DoubleClickHdl();
-            bKeyUsed = false;
+            bKeyUsed = !m_pView->DoubleClickHdl();
             break;
 
         case KEY_F2:
commit bc9b345fbb8b79419f52c303ed047e0a73de1342
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 26 16:17:59 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    emit activate-row in vcl treeview on return
    
    to align it with the gtk one which does this
    
    Change-Id: Id439fe684f263f59285ba9291fc803f88309c066
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94875
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 305248abbcca..087496706d7c 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -2427,8 +2427,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
             break;
 
         case KEY_RETURN:
-            if (m_pView->mbActivateOnSingleClick)
-                m_pView->DoubleClickHdl();
+            m_pView->DoubleClickHdl();
             bKeyUsed = false;
             break;
 
commit 34ebfc8ee25d2d22e61d3721398e762b5b7e886b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 24 20:26:54 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    support activate-on-single-click
    
    Change-Id: Iac0231b3bd84d664b1ab59023ef8242f3bd08940
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94773
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/treelist/svimpbox.cxx b/vcl/source/treelist/svimpbox.cxx
index 7ccbb5856f01..305248abbcca 100644
--- a/vcl/source/treelist/svimpbox.cxx
+++ b/vcl/source/treelist/svimpbox.cxx
@@ -598,8 +598,6 @@ void SvImpLBox::RecalcFocusRect()
 
 
 //  Sets cursor. When using SingleSelection, the selection is adjusted.
-
-
 void SvImpLBox::SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect )
 {
     SvViewDataEntry* pViewDataNewCur = nullptr;
@@ -2023,7 +2021,7 @@ void SvImpLBox::MouseButtonDown( const MouseEvent& rMEvt )
     }
 
 
-    if( (rMEvt.GetClicks() % 2) == 0 )
+    if( (rMEvt.GetClicks() % 2) == 0)
     {
         m_nFlags &= ~LBoxFlags::StartEditTimer;
         m_pView->pHdlEntry = pEntry;
@@ -2087,6 +2085,9 @@ void SvImpLBox::MouseButtonUp( const MouseEvent& rMEvt)
         m_aEditClickPos = rMEvt.GetPosPixel();
         m_aEditIdle.Start();
     }
+
+    if (m_pView->mbActivateOnSingleClick)
+        m_pView->DoubleClickHdl();
 }
 
 void SvImpLBox::MouseMove( const MouseEvent& rMEvt)
@@ -2426,15 +2427,9 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt)
             break;
 
         case KEY_RETURN:
-            if( m_bSubLstOpRet && IsExpandable() )
-            {
-                if( m_pView->IsExpanded( m_pCursor ) )
-                    m_pView->Collapse( m_pCursor );
-                else
-                    m_pView->Expand( m_pCursor );
-            }
-            else
-                bKeyUsed = false;
+            if (m_pView->mbActivateOnSingleClick)
+                m_pView->DoubleClickHdl();
+            bKeyUsed = false;
             break;
 
         case KEY_F2:
diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx
index 6e3c612093d8..6c91289f019d 100644
--- a/vcl/source/treelist/treelistbox.cxx
+++ b/vcl/source/treelist/treelistbox.cxx
@@ -456,7 +456,6 @@ bool SvTreeListBox::DoubleClickHdl()
     return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this);
 }
 
-
 bool SvTreeListBox::CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 nAction )
 {
     if ( pSource == this )
commit 7781245d63cd97fab16bfd4d76b2b4c9dc9cc02e
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Nov 2 16:33:22 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    Set height for autofilter dropdown
    
    Change-Id: I2111773e9c8f871707f95a0ce24b472217afa8e6

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index b905d5a7bba1..7f41cfa4389a 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -462,6 +462,7 @@ ScCheckListMenuControl::ScCheckListMenuControl(ScCheckListMenuWindow* pParent, v
     bool bIsSubMenu = pParent->GetParentMenu();
 
     int nChecksHeight = mxTreeChecks->get_height_rows(9);
+    int nDiffHeight = nChecksHeight - mxTreeChecks->get_preferred_size().Height();
     if (!bIsSubMenu && nWidth != -1)
     {
         mnCheckWidthReq = nWidth - mxFrame->get_border_width() * 2 - 4;
@@ -518,6 +519,9 @@ ScCheckListMenuControl::ScCheckListMenuControl(ScCheckListMenuWindow* pParent, v
         mxTreeChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
         mxListChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
     }
+
+    mxContainer->set_size_request(mxContainer->get_preferred_size().Width(),
+                                  mxContainer->get_preferred_size().Height() + nDiffHeight);
 }
 
 IMPL_LINK_NOARG(ScCheckListMenuControl, FocusHdl, weld::Widget&, void)
commit 757448a7ae3431c0582a3e3cc1c76c949745dea2
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Nov 2 12:24:49 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    jsdialog: execute checkbox action
    
    Change-Id: Ib19997f600404cc9555acbfaf87acac32f8aa5fc

diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 90f007d08433..1282c3dcc48c 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -39,6 +39,8 @@ public:
 
     static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
 
+    static void trigger_toggled(weld::ToggleButton& rButton) { rButton.signal_toggled(); }
+
     static void trigger_row_activated(weld::TreeView& rTreeView)
     {
         rTreeView.signal_row_activated();
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index ab9a70ea97b5..351d39b5224b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1125,6 +1125,8 @@ public:
 
 class VCL_DLLPUBLIC ToggleButton : virtual public Button
 {
+    friend class ::LOKTrigger;
+
 protected:
     Link<ToggleButton&, void> m_aToggleHdl;
     TriState m_eSavedValue = TRISTATE_FALSE;
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index ae6751e1dfff..a2efd53ceb58 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -78,6 +78,20 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                 }
             }
         }
+        else if (sControlType == "checkbox")
+        {
+            auto pCheckButton = dynamic_cast<weld::CheckButton*>(pWidget);
+            if (pCheckButton)
+            {
+                if (sAction == "change")
+                {
+                    bool bChecked = rData["data"] == "true";
+                    pCheckButton->set_state(bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
+                    LOKTrigger::trigger_toggled(*static_cast<weld::ToggleButton*>(pCheckButton));
+                    return true;
+                }
+            }
+        }
         else if (sControlType == "drawingarea")
         {
             auto pArea = dynamic_cast<weld::DrawingArea*>(pWidget);
commit 8262e42587e66973c6530c5718c6e4504be4eb7b
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon Nov 2 12:14:50 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    jsdialog: export placeholder text for edit fields
    
    Change-Id: I6031025a72cc72e8bc3834c256479ec1a07971b7

diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index 5958f124ae51..a1aed62c24a3 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -259,6 +259,8 @@ public:
     void SetForceControlBackground(bool b) { mbForceControlBackground = b; }
 
     bool IsPassword() const { return mbPassword; }
+
+    virtual boost::property_tree::ptree DumpAsPropertyTree() override;
 };
 
 #endif // INCLUDED_VCL_EDIT_HXX
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 75f224d64acb..b579ab3948b7 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2938,4 +2938,15 @@ FactoryFunction Edit::GetUITestFactory() const
     return EditUIObject::create;
 }
 
+
+boost::property_tree::ptree Edit::DumpAsPropertyTree()
+{
+    boost::property_tree::ptree aTree(Control::DumpAsPropertyTree());
+
+    if (!maPlaceholderText.isEmpty())
+        aTree.put("placeholder", maPlaceholderText);
+
+    return aTree;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit e0b7609460f6419c0cc335d2438058cb8e57fac8
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Oct 30 10:51:08 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:55 2020 +0100

    jsdialog: implement TreeView
    
    Change-Id: I7c1cc683e8c5d5bdc00c1e3d3d0a2c85846bbda0

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index abde59b9b5c6..992a14b5c248 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -449,24 +449,6 @@ std::vector<beans::PropertyValue> desktop::jsonToPropertyValuesVector(const char
 }
 
 
-static StringMap jsonToStringMap(const char* pJSON)
-{
-    StringMap aArgs;
-    if (pJSON && pJSON[0] != '\0')
-    {
-        std::stringstream aStream(pJSON);
-        boost::property_tree::ptree aTree;
-        boost::property_tree::read_json(aStream, aTree);
-
-        for (const auto& rPair : aTree)
-        {
-            aArgs[OUString::fromUtf8(rPair.first.c_str())] = OUString::fromUtf8(rPair.second.get_value<std::string>(".").c_str());
-        }
-    }
-    return aArgs;
-}
-
-
 static boost::property_tree::ptree unoAnyToPropertyTree(const uno::Any& anyItem)
 {
     boost::property_tree::ptree aTree;
diff --git a/include/vcl/jsdialog/executor.hxx b/include/vcl/jsdialog/executor.hxx
index 1cfa24c28a8a..90f007d08433 100644
--- a/include/vcl/jsdialog/executor.hxx
+++ b/include/vcl/jsdialog/executor.hxx
@@ -13,6 +13,23 @@
 #include <vcl/uitest/uiobject.hxx>
 #include <vcl/weld.hxx>
 
+static StringMap jsonToStringMap(const char* pJSON)
+{
+    StringMap aArgs;
+    if (pJSON && pJSON[0] != '\0')
+    {
+        std::stringstream aStream(pJSON);
+        boost::property_tree::ptree aTree;
+        boost::property_tree::read_json(aStream, aTree);
+
+        for (const auto& rPair : aTree)
+        {
+            aArgs[OUString::fromUtf8(rPair.first.c_str())]
+                = OUString::fromUtf8(rPair.second.get_value<std::string>(".").c_str());
+        }
+    }
+    return aArgs;
+}
 class LOKTrigger
 {
 public:
@@ -22,6 +39,11 @@ public:
 
     static void trigger_changed(weld::ComboBox& rComboBox) { rComboBox.signal_changed(); }
 
+    static void trigger_row_activated(weld::TreeView& rTreeView)
+    {
+        rTreeView.signal_row_activated();
+    }
+
     static void trigger_clicked(weld::Toolbar& rToolbar, const OString& rIdent)
     {
         rToolbar.signal_clicked(rIdent);
diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx
index 0b060ddf56a3..a1a8eabfe0fd 100644
--- a/include/vcl/salvtables.hxx
+++ b/include/vcl/salvtables.hxx
@@ -1103,7 +1103,7 @@ public:
 
 class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
 {
-private:
+protected:
     // owner for UserData
     std::vector<std::unique_ptr<OUString>> m_aUserData;
     VclPtr<SvTabListBox> m_xTreeView;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0d5b19aee983..ab9a70ea97b5 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -685,6 +685,8 @@ public:
 */
 class VCL_DLLPUBLIC TreeView : virtual public Container
 {
+    friend class ::LOKTrigger;
+
 public:
     typedef std::pair<const TreeIter&, int> iter_col;
     typedef std::pair<const TreeIter&, OUString> iter_string;
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 0682cc0d1bc5..b0f4e42976d0 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -19,6 +19,7 @@
 #include <vcl/combobox.hxx>
 #include <vcl/button.hxx>
 #include <vcl/fmtfield.hxx>
+#include <vcl/svtabbx.hxx>
 
 class ToolBox;
 class SfxViewShell;
@@ -121,6 +122,8 @@ public:
                                                 bool bTakeOwnership = true) override;
     std::unique_ptr<weld::TextView> weld_text_view(const OString& id,
                                                    bool bTakeOwnership = false) override;
+    std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id,
+                                                   bool bTakeOwnership = false) override;
 
     static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
                                                     VclMessageType eMessageType,
@@ -302,4 +305,17 @@ public:
     virtual void set_text(const OUString& rText) override;
 };
 
+class JSTreeView : public JSWidget<SalInstanceTreeView, ::SvTabListBox>
+{
+public:
+    JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
+               ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
+               std::string sTypeOfJSON);
+
+    /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry
+    virtual void set_toggle(int pos, TriState eState, int col = -1) override;
+    /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry
+    virtual void select(int pos) override;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index 53fded14e1c1..ae6751e1dfff 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -11,6 +11,7 @@
 #include <vcl/weld.hxx>
 #include <vcl/jsdialog/executor.hxx>
 #include <sal/log.hxx>
+#include <rtl/uri.hxx>
 
 namespace jsdialog
 {
@@ -143,6 +144,38 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget, StringMap& rDat
                 }
             }
         }
+        else if (sControlType == "treeview")
+        {
+            auto pTreeView = dynamic_cast<weld::TreeView*>(pWidget);
+            if (pTreeView)
+            {
+                if (sAction == "change")
+                {
+                    OUString sDataJSON = rtl::Uri::decode(
+                        rData["data"], rtl_UriDecodeMechanism::rtl_UriDecodeWithCharset,
+                        RTL_TEXTENCODING_UTF8);
+                    StringMap aMap(jsonToStringMap(
+                        OUStringToOString(sDataJSON, RTL_TEXTENCODING_ASCII_US).getStr()));
+
+                    OString nRowString = OUStringToOString(aMap["row"], RTL_TEXTENCODING_ASCII_US);
+                    int nRow = std::atoi(nRowString.getStr());
+                    bool bValue = aMap["value"] == "true";
+
+                    pTreeView->set_toggle(nRow, bValue ? TRISTATE_TRUE : TRISTATE_FALSE);
+
+                    return true;
+                }
+                else if (sAction == "select")
+                {
+                    OString nRowString
+                        = OUStringToOString(rData["data"], RTL_TEXTENCODING_ASCII_US);
+                    int nRow = std::atoi(nRowString.getStr());
+
+                    pTreeView->select(nRow);
+                    LOKTrigger::trigger_row_activated(*pTreeView);
+                }
+            }
+        }
     }
 
     return false;
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 92f0dc9769ea..f86b9b53236e 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -15,6 +15,7 @@
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <vcl/toolbox.hxx>
 #include <vcl/vclmedit.hxx>
+#include <vcl/treelistentry.hxx>
 
 using namespace weld;
 
@@ -46,6 +47,25 @@ void JSDialogNotifyIdle::Invoke()
             boost::property_tree::ptree aTree = m_aContentWindow->DumpAsPropertyTree();
             aTree.put("id", m_aNotifierWindow->GetLOKWindowId());
             aTree.put("jsontype", m_sTypeOfJSON);
+
+            if (m_sTypeOfJSON == "autofilter")
+            {
+                vcl::Window* pWindow = m_aContentWindow.get();
+                DockingWindow* pDockingWIndow = dynamic_cast<DockingWindow*>(pWindow);
+                while (pWindow && !pDockingWIndow)
+                {
+                    pWindow = pWindow->GetParent();
+                    pDockingWIndow = dynamic_cast<DockingWindow*>(pWindow);
+                }
+
+                if (pDockingWIndow)
+                {
+                    Point aPos = pDockingWIndow->GetFloatingPos();
+                    aTree.put("posx", aPos.getX());
+                    aTree.put("posy", aPos.getY());
+                }
+            }
+
             boost::property_tree::write_json(aStream, aTree);
             const std::string message = aStream.str();
             if (m_bForce || message != m_LastNotificationMessage)
@@ -416,6 +436,21 @@ std::unique_ptr<weld::TextView> JSInstanceBuilder::weld_text_view(const OString&
     return pWeldWidget;
 }
 
+std::unique_ptr<weld::TreeView> JSInstanceBuilder::weld_tree_view(const OString& id,
+                                                                  bool bTakeOwnership)
+{
+    SvTabListBox* pTreeView = m_xBuilder->get<SvTabListBox>(id);
+    auto pWeldWidget
+        = pTreeView ? std::make_unique<JSTreeView>(GetNotifierWindow(), GetContentWindow(),
+                                                   pTreeView, this, bTakeOwnership, m_sTypeOfJSON)
+                    : nullptr;
+
+    if (pWeldWidget)
+        RememberWidget(id, pWeldWidget.get());
+
+    return pWeldWidget;
+}
+
 weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
                                                             VclMessageType eMessageType,
                                                             VclButtonsType eButtonType,
@@ -698,4 +733,45 @@ void JSTextView::set_text(const OUString& rText)
     notifyDialogState();
 }
 
+JSTreeView::JSTreeView(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
+                       ::SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership,
+                       std::string sTypeOfJSON)
+    : JSWidget<SalInstanceTreeView, ::SvTabListBox>(aNotifierWindow, aContentWindow, pTreeView,
+                                                    pBuilder, bTakeOwnership, sTypeOfJSON)
+{
+}
+
+void JSTreeView::set_toggle(int pos, TriState eState, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0);
+
+    while (pEntry && pos--)
+        pEntry = m_xTreeView->Next(pEntry);
+
+    if (pEntry)
+        SalInstanceTreeView::set_toggle(pEntry, eState, col);
+}
+
+void JSTreeView::select(int pos)
+{
+    assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
+    disable_notify_events();
+    if (pos == -1 || (pos == 0 && n_children() == 0))
+        m_xTreeView->SelectAll(false);
+    else
+    {
+        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, 0);
+
+        while (pEntry && pos--)
+            pEntry = m_xTreeView->Next(pEntry);
+
+        if (pEntry)
+        {
+            m_xTreeView->Select(pEntry, true);
+            m_xTreeView->MakeVisible(pEntry);
+        }
+    }
+    enable_notify_events();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
commit 2c42ebdee50de425f23a7a6c2cb72ed418831019
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Oct 29 12:12:41 2020 +0100
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Fri Nov 6 11:54:54 2020 +0100

    Move SalInstanceTreeView decl to header file
    
    Change-Id: Ie49f4113332de5c4fa825f93dde46bb408187fe4

diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx
index 1898278eb5b0..0b060ddf56a3 100644
--- a/include/vcl/salvtables.hxx
+++ b/include/vcl/salvtables.hxx
@@ -14,6 +14,8 @@
 #include <vcl/tabctrl.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/messagedialog.hxx>
+#include <vcl/svtabbx.hxx>
+#include <vcl/svlbitm.hxx>
 
 class SalInstanceBuilder : public weld::Builder
 {
@@ -1099,4 +1101,312 @@ public:
     virtual ~SalInstanceTextView() override;
 };
 
+class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
+{
+private:
+    // owner for UserData
+    std::vector<std::unique_ptr<OUString>> m_aUserData;
+    VclPtr<SvTabListBox> m_xTreeView;
+    SvLBoxButtonData m_aCheckButtonData;
+    SvLBoxButtonData m_aRadioButtonData;
+    bool m_bDisableCheckBoxAutoWidth;
+    bool m_bTogglesAsRadio;
+    int m_nSortColumn;
+
+    DECL_LINK(SelectHdl, SvTreeListBox*, void);
+    DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
+    DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
+    DECL_LINK(ExpandingHdl, SvTreeListBox*, bool);
+    DECL_LINK(EndDragHdl, HeaderBar*, void);
+    DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
+    DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
+    DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
+    DECL_LINK(StartDragHdl, SvTreeListBox*, void);
+    DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
+    DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool);
+    typedef std::pair<SvTreeListEntry*, OUString> IterString;
+    DECL_LINK(EditedEntryHdl, IterString, bool);
+    DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
+    DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
+    DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
+
+    // Each row has a cell for the expander image, (and an optional cell for a
+    // checkbutton if enable_toggle_buttons has been called) which preceed
+    // index 0
+    int to_internal_model(int col) const;
+
+    int to_external_model(int col) const;
+
+    bool IsDummyEntry(SvTreeListEntry* pEntry) const;
+
+    SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const;
+
+    static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor);
+
+    static void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol);
+
+    void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
+                   const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface,
+                   bool bChildrenOnDemand, weld::TreeIter* pRet, bool bIsSeparator);
+
+    void update_checkbutton_column_width(SvTreeListEntry* pEntry);
+
+    void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
+
+    static TriState do_get_toggle(SvTreeListEntry* pEntry, int col);
+
+    TriState get_toggle(SvTreeListEntry* pEntry, int col) const;
+
+    void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col);
+
+    bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const;
+
+public:
+    SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
+
+    virtual void columns_autosize() override;
+
+    virtual void freeze() override;
+
+    virtual void thaw() override;
+
+    virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override;
+
+    virtual void set_centered_column(int nCol) override;
+
+    virtual int get_column_width(int nColumn) const override;
+
+    virtual OUString get_column_title(int nColumn) const override;
+
+    virtual void set_column_title(int nColumn, const OUString& rTitle) override;
+
+    virtual void show() override;
+
+    virtual void hide() override;
+
+    virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
+                        const OUString* pId, const OUString* pIconName,
+                        VirtualDevice* pImageSurface, const OUString* pExpanderName,
+                        bool bChildrenOnDemand, weld::TreeIter* pRet) override;
+
+    virtual void
+    bulk_insert_for_each(int nSourceCount,
+                         const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
+                         const std::vector<int>* pFixedWidths = nullptr) override;
+
+    virtual void set_font_color(int pos, const Color& rColor) const override;
+
+    virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) const override;
+
+    virtual void remove(int pos) override;
+
+    virtual int find_text(const OUString& rText) const override;
+
+    virtual int find_id(const OUString& rId) const override;
+
+    virtual void swap(int pos1, int pos2) override;
+
+    virtual void clear() override;
+
+    virtual int n_children() const override;
+
+    virtual void select(int pos) override;
+
+    virtual int get_cursor_index() const override;
+
+    virtual void set_cursor(int pos) override;
+
+    virtual void scroll_to_row(int pos) override;
+
+    virtual bool is_selected(int pos) const override;
+
+    virtual void unselect(int pos) override;
+
+    virtual std::vector<int> get_selected_rows() const override;
+
+    OUString get_text(SvTreeListEntry* pEntry, int col) const;
+
+    virtual OUString get_text(int pos, int col = -1) const override;
+
+    void set_text(SvTreeListEntry* pEntry, const OUString& rText, int col);
+
+    virtual void set_text(int pos, const OUString& rText, int col = -1) override;
+
+    void set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col = -1);
+
+    using SalInstanceWidget::set_sensitive;
+
+    virtual void set_sensitive(int pos, bool bSensitive, int col = -1) override;
+
+    virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col = -1) override;
+
+    virtual TriState get_toggle(int pos, int col = -1) const override;
+
+    virtual TriState get_toggle(const weld::TreeIter& rIter, int col = -1) const override;
+
+    virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override;
+
+    virtual void set_toggle(int pos, TriState eState, int col = -1) override;
+
+    virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col = -1) override;
+
+    void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col);
+
+    virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override;
+
+    virtual void set_text_emphasis(int pos, bool bOn, int col) override;
+
+    virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override;
+
+    virtual bool get_text_emphasis(int pos, int col) const override;
+
+    void set_text_align(SvTreeListEntry* pEntry, double fAlign, int col);
+
+    virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override;
+
+    virtual void set_text_align(int pos, double fAlign, int col) override;
+
+    virtual void connect_editing(const Link<const weld::TreeIter&, bool>& rStartLink,
+                                 const Link<const iter_string&, bool>& rEndLink) override;
+
+    virtual void start_editing(const weld::TreeIter& rIter) override;
+
+    virtual void end_editing() override;
+
+    void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col);
+
+    virtual void set_image(int pos, const OUString& rImage, int col = -1) override;
+
+    virtual void set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage,
+                           int col = -1) override;
+
+    virtual void set_image(int pos, VirtualDevice& rImage, int col = -1) override;
+
+    virtual void set_image(const weld::TreeIter& rIter, const OUString& rImage,
+                           int col = -1) override;
+
+    virtual void set_image(const weld::TreeIter& rIter,
+                           const css::uno::Reference<css::graphic::XGraphic>& rImage,
+                           int col = -1) override;
+
+    virtual void set_image(const weld::TreeIter& rIter, VirtualDevice& rImage,
+                           int col = -1) override;
+
+    const OUString* getEntryData(int index) const;
+
+    virtual OUString get_id(int pos) const override;
+
+    void set_id(SvTreeListEntry* pEntry, const OUString& rId);
+
+    virtual void set_id(int pos, const OUString& rId) override;
+
+    virtual int get_selected_index() const override;
+
+    virtual OUString get_selected_text() const override;
+
+    virtual OUString get_selected_id() const override;
+
+    virtual std::unique_ptr<weld::TreeIter> make_iterator(const weld::TreeIter* pOrig
+                                                          = nullptr) const override;
+
+    virtual void copy_iterator(const weld::TreeIter& rSource, weld::TreeIter& rDest) const override;
+
+    virtual bool get_selected(weld::TreeIter* pIter) const override;
+
+    virtual bool get_cursor(weld::TreeIter* pIter) const override;
+
+    virtual void set_cursor(const weld::TreeIter& rIter) override;
+
+    virtual bool get_iter_first(weld::TreeIter& rIter) const override;
+
+    virtual bool iter_next_sibling(weld::TreeIter& rIter) const override;
+
+    virtual bool iter_next(weld::TreeIter& rIter) const override;
+
+    virtual bool iter_children(weld::TreeIter& rIter) const override;
+
+    virtual bool iter_parent(weld::TreeIter& rIter) const override;
+
+    virtual void remove(const weld::TreeIter& rIter) override;
+
+    virtual void select(const weld::TreeIter& rIter) override;
+
+    virtual void scroll_to_row(const weld::TreeIter& rIter) override;
+
+    virtual void unselect(const weld::TreeIter& rIter) override;
+
+    virtual int get_iter_depth(const weld::TreeIter& rIter) const override;
+
+    virtual bool iter_has_child(const weld::TreeIter& rIter) const override;
+
+    virtual bool get_row_expanded(const weld::TreeIter& rIter) const override;
+
+    virtual void expand_row(const weld::TreeIter& rIter) override;
+
+    virtual void collapse_row(const weld::TreeIter& rIter) override;
+
+    virtual OUString get_text(const weld::TreeIter& rIter, int col = -1) const override;
+
+    virtual void set_text(const weld::TreeIter& rIter, const OUString& rText,
+                          int col = -1) override;
+
+    virtual OUString get_id(const weld::TreeIter& rIter) const override;
+
+    virtual void set_id(const weld::TreeIter& rIter, const OUString& rId) override;
+
+    virtual void set_selection_mode(SelectionMode eMode) override;
+
+    virtual void all_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
+
+    virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
+
+    virtual void visible_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
+
+    virtual void connect_visible_range_changed(const Link<weld::TreeView&, void>& rLink) override;
+
+    virtual void remove_selection() override;
+
+    virtual bool is_selected(const weld::TreeIter& rIter) const override;
+
+    virtual int get_iter_index_in_parent(const weld::TreeIter& rIter) const override;
+
+    virtual int iter_compare(const weld::TreeIter& a, const weld::TreeIter& b) const override;
+
+    virtual void move_subtree(weld::TreeIter& rNode, const weld::TreeIter* pNewParent,
+                              int nIndexInNewParent) override;
+
+    virtual int count_selected_rows() const override;
+
+    virtual int get_height_rows(int nRows) const override;
+
+    virtual void make_sorted() override;
+
+    virtual void set_sort_func(
+        const std::function<int(const weld::TreeIter&, const weld::TreeIter&)>& func) override;
+
+    virtual void make_unsorted() override;
+
+    virtual void set_sort_order(bool bAscending) override;
+
+    virtual bool get_sort_order() const override;
+
+    virtual void set_sort_indicator(TriState eState, int col = -1) override;
+
+    virtual TriState get_sort_indicator(int col = -1) const override;
+
+    virtual int get_sort_column() const override;
+
+    virtual void set_sort_column(int nColumn) override;
+
+    SvTabListBox& getTreeView();
+
+    virtual bool get_dest_row_at_pos(const Point& rPos, weld::TreeIter* pResult) override;
+
+    virtual TreeView* get_drag_source() const override;
+
+    void set_show_expanders(bool bShow) override;
+
+    virtual ~SalInstanceTreeView() override;
+};
+
 #endif
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 35b98f07e5fa..822871242a42 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -57,8 +57,6 @@
 #include <vcl/ptrstyle.hxx>
 #include <vcl/slider.hxx>
 #include <vcl/sysdata.hxx>
-#include <vcl/svlbitm.hxx>
-#include <vcl/svtabbx.hxx>
 #include <vcl/tabctrl.hxx>
 #include <vcl/tabpage.hxx>
 #include <vcl/treelistentry.hxx>
@@ -3218,1386 +3216,1351 @@ struct SalInstanceTreeIter : public weld::TreeIter
     SvTreeListEntry* iter;
 };
 
-class SalInstanceTreeView;
-
 static SalInstanceTreeView* g_DragSource;
 
-class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
+// Each row has a cell for the expander image, (and an optional cell for a
+// checkbutton if enable_toggle_buttons has been called) which preceed
+// index 0
+int SalInstanceTreeView::to_internal_model(int col) const
 {
-private:
-    // owner for UserData
-    std::vector<std::unique_ptr<OUString>> m_aUserData;
-    VclPtr<SvTabListBox> m_xTreeView;
-    SvLBoxButtonData m_aCheckButtonData;
-    SvLBoxButtonData m_aRadioButtonData;
-    bool m_bDisableCheckBoxAutoWidth;
-    bool m_bTogglesAsRadio;
-    int m_nSortColumn;
+    if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
+        ++col; // skip checkbutton column
+    ++col; //skip expander column
+    return col;
+}
 
-    DECL_LINK(SelectHdl, SvTreeListBox*, void);
-    DECL_LINK(DeSelectHdl, SvTreeListBox*, void);
-    DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
-    DECL_LINK(ExpandingHdl, SvTreeListBox*, bool);
-    DECL_LINK(EndDragHdl, HeaderBar*, void);
-    DECL_LINK(HeaderBarClickedHdl, HeaderBar*, void);
-    DECL_LINK(ToggleHdl, SvLBoxButtonData*, void);
-    DECL_LINK(ModelChangedHdl, SvTreeListBox*, void);
-    DECL_LINK(StartDragHdl, SvTreeListBox*, void);
-    DECL_STATIC_LINK(SalInstanceTreeView, FinishDragHdl, SvTreeListBox*, void);
-    DECL_LINK(EditingEntryHdl, SvTreeListEntry*, bool);
-    typedef std::pair<SvTreeListEntry*, OUString> IterString;
-    DECL_LINK(EditedEntryHdl, IterString, bool);
-    DECL_LINK(VisibleRangeChangedHdl, SvTreeListBox*, void);
-    DECL_LINK(CompareHdl, const SvSortData&, sal_Int32);
-    DECL_LINK(PopupMenuHdl, const CommandEvent&, bool);
-
-    // Each row has a cell for the expander image, (and an optional cell for a
-    // checkbutton if enable_toggle_buttons has been called) which preceed
-    // index 0
-    int to_internal_model(int col) const
+int SalInstanceTreeView::to_external_model(int col) const
+{
+    if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
+        --col; // skip checkbutton column
+    --col; //skip expander column
+    return col;
+}
+
+bool SalInstanceTreeView::IsDummyEntry(SvTreeListEntry* pEntry) const
+{
+    return m_xTreeView->GetEntryText(pEntry).trim() == "<dummy>";
+}
+
+SvTreeListEntry* SalInstanceTreeView::GetPlaceHolderChild(SvTreeListEntry* pEntry) const
+{
+    if (pEntry->HasChildren())
     {
-        if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
-            ++col; // skip checkbutton column
-        ++col; //skip expander column
-        return col;
+        auto pChild = m_xTreeView->FirstChild(pEntry);
+        assert(pChild);
+        if (IsDummyEntry(pChild))
+            return pChild;
     }
+    return nullptr;
+}
+
+void SalInstanceTreeView::set_font_color(SvTreeListEntry* pEntry, const Color& rColor)
+{
+    if (rColor == COL_AUTO)
+        pEntry->SetTextColor(boost::optional<Color>());
+    else
+        pEntry->SetTextColor(rColor);
+}
+
+void SalInstanceTreeView::AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int /*nCol*/)
+{
+    auto xCell = std::make_unique<SvLBoxString>(rStr);
+    pEntry->AddItem(std::move(xCell));
+}
 
-    int to_external_model(int col) const
+void SalInstanceTreeView::do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
+                const OUString* pId, const OUString* pIconName,
+                VirtualDevice* pImageSurface, bool bChildrenOnDemand,
+                weld::TreeIter* pRet, bool bIsSeparator)
+{
+    disable_notify_events();
+    const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
+    SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
+    auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
+    void* pUserData;
+    if (pId)
     {
-        if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
-            --col; // skip checkbutton column
-        --col; //skip expander column
-        return col;
+        m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
+        pUserData = m_aUserData.back().get();
     }
+    else
+        pUserData = nullptr;
 
-    bool IsDummyEntry(SvTreeListEntry* pEntry) const
+    SvTreeListEntry* pEntry = new SvTreeListEntry;
+    if (bIsSeparator)
+        pEntry->SetFlags(pEntry->GetFlags() | SvTLEntryFlags::IS_SEPARATOR);
+
+    if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
+        AddStringItem(pEntry, "", -1);
+
+    if (pIconName || pImageSurface)
     {
-        return m_xTreeView->GetEntryText(pEntry).trim() == "<dummy>";
+        Image aImage(pIconName ? createImage(*pIconName) : createImage(*pImageSurface));
+        pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
     }
-
-    SvTreeListEntry* GetPlaceHolderChild(SvTreeListEntry* pEntry) const
+    else
     {
-        if (pEntry->HasChildren())
-        {
-            auto pChild = m_xTreeView->FirstChild(pEntry);
-            assert(pChild);
-            if (IsDummyEntry(pChild))
-                return pChild;
-        }
-        return nullptr;
+        Image aDummy;
+        pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
     }
+    if (pStr)
+        AddStringItem(pEntry, *pStr, 0);
+    pEntry->SetUserData(pUserData);
+    m_xTreeView->Insert(pEntry, iter, nInsertPos);
 
-    static void set_font_color(SvTreeListEntry* pEntry, const Color& rColor)
+    if (pRet)
     {
-        if (rColor == COL_AUTO)
-            pEntry->SetTextColor(boost::optional<Color>());
-        else
-            pEntry->SetTextColor(rColor);
+        SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
+        pVclRetIter->iter = pEntry;
     }
 
-    void AddStringItem(SvTreeListEntry* pEntry, const OUString& rStr, int nCol)
+    if (bChildrenOnDemand)
     {
-        auto xCell = std::make_unique<SvLBoxString>(rStr);
-        pEntry->AddItem(std::move(xCell));
+        SvTreeListEntry* pPlaceHolder = m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+        SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pPlaceHolder);
+        pViewData->SetSelectable(false);
     }
 
-    void do_insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
-                   const OUString* pId, const OUString* pIconName,
-                   VirtualDevice* pImageSurface, bool bChildrenOnDemand,
-                   weld::TreeIter* pRet, bool bIsSeparator)
+    if (bIsSeparator)
     {
-        disable_notify_events();
-        const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
-        SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
-        auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
-        void* pUserData;
-        if (pId)
-        {
-            m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
-            pUserData = m_aUserData.back().get();
-        }
-        else
-            pUserData = nullptr;
-
-        SvTreeListEntry* pEntry = new SvTreeListEntry;
-        if (bIsSeparator)
-            pEntry->SetFlags(pEntry->GetFlags() | SvTLEntryFlags::IS_SEPARATOR);
-
-        if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
-            AddStringItem(pEntry, "", -1);
-
-        if (pIconName || pImageSurface)
-        {
-            Image aImage(pIconName ? createImage(*pIconName) : createImage(*pImageSurface));
-            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
-        }
-        else
-        {
-            Image aDummy;
-            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
-        }
-        if (pStr)
-            AddStringItem(pEntry, *pStr, 0);
-        pEntry->SetUserData(pUserData);
-        m_xTreeView->Insert(pEntry, iter, nInsertPos);
+        SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
+        pViewData->SetSelectable(false);
+    }
 
-        if (pRet)
-        {
-            SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
-            pVclRetIter->iter = pEntry;
-        }
+    enable_notify_events();
+}
 
-        if (bChildrenOnDemand)
-        {
-            SvTreeListEntry* pPlaceHolder = m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
-            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pPlaceHolder);
-            pViewData->SetSelectable(false);
-        }
+void SalInstanceTreeView::update_checkbutton_column_width(SvTreeListEntry* pEntry)
+{
+    SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
+    m_xTreeView->InitViewData(pViewData, pEntry);
+    if (!m_bDisableCheckBoxAutoWidth)
+        m_xTreeView->CheckBoxInserted(pEntry);
+}
 
-        if (bIsSeparator)
-        {
-            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
-            pViewData->SetSelectable(false);
-        }
+void SalInstanceTreeView::do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col)
+{
+    assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
+    // if its the placeholder to allow a blank column, replace it now
+    if (pEntry->GetItem(col).GetType() != SvLBoxItemType::Button)
+    {
+        SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
+        pEntry->ReplaceItem(std::make_unique<SvLBoxButton>(pData), 0);
+        update_checkbutton_column_width(pEntry);
 
-        enable_notify_events();
     }
-
-    void update_checkbutton_column_width(SvTreeListEntry* pEntry)
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxButton*>(&rItem));
+    switch (eState)
     {
-        SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
-        m_xTreeView->InitViewData(pViewData, pEntry);
-        if (!m_bDisableCheckBoxAutoWidth)
-            m_xTreeView->CheckBoxInserted(pEntry);
+        case TRISTATE_TRUE:
+            static_cast<SvLBoxButton&>(rItem).SetStateChecked();
+            break;
+        case TRISTATE_FALSE:
+            static_cast<SvLBoxButton&>(rItem).SetStateUnchecked();
+            break;
+        case TRISTATE_INDET:
+            static_cast<SvLBoxButton&>(rItem).SetStateTristate();
+            break;
     }
 
-    void do_set_toggle(SvTreeListEntry* pEntry, TriState eState, int col)
-    {
-        assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
-        // if its the placeholder to allow a blank column, replace it now
-        if (pEntry->GetItem(col).GetType() != SvLBoxItemType::Button)
-        {
-            SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
-            pEntry->ReplaceItem(std::make_unique<SvLBoxButton>(pData), 0);
-            update_checkbutton_column_width(pEntry);
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-        }
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        assert(dynamic_cast<SvLBoxButton*>(&rItem));
-        switch (eState)
-        {
-            case TRISTATE_TRUE:
-                static_cast<SvLBoxButton&>(rItem).SetStateChecked();
-                break;
-            case TRISTATE_FALSE:
-                static_cast<SvLBoxButton&>(rItem).SetStateUnchecked();
-                break;
-            case TRISTATE_INDET:
-                static_cast<SvLBoxButton&>(rItem).SetStateTristate();
-                break;
-        }
+TriState SalInstanceTreeView::do_get_toggle(SvTreeListEntry* pEntry, int col)
+{
+    if (static_cast<size_t>(col) == pEntry->ItemCount())
+        return TRISTATE_FALSE;
 
-        m_xTreeView->ModelHasEntryInvalidated(pEntry);
-    }
+    assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxButton*>(&rItem));
+    SvLBoxButton& rToggle = static_cast<SvLBoxButton&>(rItem);
+    if (rToggle.IsStateTristate())
+        return TRISTATE_INDET;
+    else if (rToggle.IsStateChecked())
+        return TRISTATE_TRUE;
+    return TRISTATE_FALSE;
+}
 
-    static TriState do_get_toggle(SvTreeListEntry* pEntry, int col)
+TriState SalInstanceTreeView::get_toggle(SvTreeListEntry* pEntry, int col) const
+{
+    if (col == -1)
     {
-        if (static_cast<size_t>(col) == pEntry->ItemCount())
-            return TRISTATE_FALSE;
-
-        assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        assert(dynamic_cast<SvLBoxButton*>(&rItem));
-        SvLBoxButton& rToggle = static_cast<SvLBoxButton&>(rItem);
-        if (rToggle.IsStateTristate())
-            return TRISTATE_INDET;
-        else if (rToggle.IsStateChecked())
-            return TRISTATE_TRUE;
-        return TRISTATE_FALSE;
+        assert(m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN);
+        return do_get_toggle(pEntry, 0);
     }
+    col = to_internal_model(col);
+    return do_get_toggle(pEntry, col);
+}
 
-    TriState get_toggle(SvTreeListEntry* pEntry, int col) const
+void SalInstanceTreeView::set_toggle(SvTreeListEntry* pEntry, TriState eState, int col)
+{
+    if (col == -1)
     {
-        if (col == -1)
-        {
-            assert(m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN);
-            return do_get_toggle(pEntry, 0);
-        }
-        col = to_internal_model(col);
-        return do_get_toggle(pEntry, col);
+        assert(m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN);
+        do_set_toggle(pEntry, eState, 0);
+        return;
     }
 
-    void set_toggle(SvTreeListEntry* pEntry, TriState eState, int col)
-    {
-        if (col == -1)
-        {
-            assert(m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN);
-            do_set_toggle(pEntry, eState, 0);
-            return;
-        }
-
-        col = to_internal_model(col);
+    col = to_internal_model(col);
 
-        // blank out missing entries
-        for (int i = pEntry->ItemCount(); i < col; ++i)
-            AddStringItem(pEntry, "", i - 1);
-
-        if (static_cast<size_t>(col) == pEntry->ItemCount())
-        {
-            SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
-            pEntry->AddItem(std::make_unique<SvLBoxButton>(pData));
-            update_checkbutton_column_width(pEntry);
-        }
+    // blank out missing entries
+    for (int i = pEntry->ItemCount(); i < col; ++i)
+        AddStringItem(pEntry, "", i - 1);
 
-        do_set_toggle(pEntry, eState, col);
+    if (static_cast<size_t>(col) == pEntry->ItemCount())
+    {
+        SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
+        pEntry->AddItem(std::make_unique<SvLBoxButton>(pData));
+        update_checkbutton_column_width(pEntry);
     }
 
-    bool get_text_emphasis(SvTreeListEntry* pEntry, int col) const
-    {
-        col = to_internal_model(col);
+    do_set_toggle(pEntry, eState, col);
+}
 
-        assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        assert(dynamic_cast<SvLBoxString*>(&rItem));
-        return static_cast<SvLBoxString&>(rItem).IsEmphasized();
-    }
+bool SalInstanceTreeView::get_text_emphasis(SvTreeListEntry* pEntry, int col) const
+{
+    col = to_internal_model(col);
 
-public:
-    SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
-        : SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
-        , m_xTreeView(pTreeView)
-        , m_aCheckButtonData(pTreeView, false)
-        , m_aRadioButtonData(pTreeView, true)
-        , m_bDisableCheckBoxAutoWidth(false)
-        , m_bTogglesAsRadio(false)
-        , m_nSortColumn(-1)
-    {
-        m_xTreeView->SetNodeDefaultImages();
-        m_xTreeView->SetSelectHdl(LINK(this, SalInstanceTreeView, SelectHdl));
-        m_xTreeView->SetDeselectHdl(LINK(this, SalInstanceTreeView, DeSelectHdl));
-        m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl));
-        m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
-        m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, PopupMenuHdl));
-        const long aTabPositions[] = { 0 };
-        m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-
-        if (pHeaderBox)
-        {
-            if (HeaderBar* pHeaderBar = pHeaderBox->GetHeaderBar())
-            {
-                //make the last entry fill available space
-                pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
-                pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
-                pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
-            }
-            pHeaderBox->SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
-            pHeaderBox->SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
-        }
-        else
-        {
-            static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl));
-            static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl));
-            static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(LINK(this, SalInstanceTreeView, FinishDragHdl));
-            static_cast<LclTabListBox&>(*m_xTreeView).SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
-            static_cast<LclTabListBox&>(*m_xTreeView).SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
-        }
-        m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
-        m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
-    }
+    assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxString*>(&rItem));
+    return static_cast<SvLBoxString&>(rItem).IsEmphasized();
+}
+
+SalInstanceTreeView::SalInstanceTreeView(SvTabListBox* pTreeView, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
+    : SalInstanceContainer(pTreeView, pBuilder, bTakeOwnership)
+    , m_xTreeView(pTreeView)
+    , m_aCheckButtonData(pTreeView, false)
+    , m_aRadioButtonData(pTreeView, true)
+    , m_bDisableCheckBoxAutoWidth(false)
+    , m_bTogglesAsRadio(false)
+    , m_nSortColumn(-1)
+{
+    m_xTreeView->SetNodeDefaultImages();
+    m_xTreeView->SetSelectHdl(LINK(this, SalInstanceTreeView, SelectHdl));
+    m_xTreeView->SetDeselectHdl(LINK(this, SalInstanceTreeView, DeSelectHdl));
+    m_xTreeView->SetDoubleClickHdl(LINK(this, SalInstanceTreeView, DoubleClickHdl));
+    m_xTreeView->SetExpandingHdl(LINK(this, SalInstanceTreeView, ExpandingHdl));
+    m_xTreeView->SetPopupMenuHdl(LINK(this, SalInstanceTreeView, PopupMenuHdl));
+    const long aTabPositions[] = { 0 };
+    m_xTreeView->SetTabs(SAL_N_ELEMENTS(aTabPositions), aTabPositions);
+    LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
 
-    virtual void columns_autosize() override
+    if (pHeaderBox)
     {
-        std::vector<long> aWidths;
-        m_xTreeView->getPreferredDimensions(aWidths);
-        if (aWidths.size() > 2)
+        if (HeaderBar* pHeaderBar = pHeaderBox->GetHeaderBar())
         {
-            std::vector<int> aColWidths;
-            for (size_t i = 1; i < aWidths.size() - 1; ++i)
-                aColWidths.push_back(aWidths[i] - aWidths[i - 1]);
-            set_column_fixed_widths(aColWidths);
+            //make the last entry fill available space
+            pHeaderBar->SetItemSize(pHeaderBar->GetItemId(pHeaderBar->GetItemCount() - 1 ), HEADERBAR_FULLSIZE);
+            pHeaderBar->SetEndDragHdl(LINK(this, SalInstanceTreeView, EndDragHdl));
+            pHeaderBar->SetSelectHdl(LINK(this, SalInstanceTreeView, HeaderBarClickedHdl));
         }
+        pHeaderBox->SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
+        pHeaderBox->SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
     }
-
-    virtual void freeze() override
+    else
     {
-        SalInstanceWidget::freeze();
-        m_xTreeView->SetUpdateMode(false);
+        static_cast<LclTabListBox&>(*m_xTreeView).SetModelChangedHdl(LINK(this, SalInstanceTreeView, ModelChangedHdl));
+        static_cast<LclTabListBox&>(*m_xTreeView).SetStartDragHdl(LINK(this, SalInstanceTreeView, StartDragHdl));
+        static_cast<LclTabListBox&>(*m_xTreeView).SetEndDragHdl(LINK(this, SalInstanceTreeView, FinishDragHdl));
+        static_cast<LclTabListBox&>(*m_xTreeView).SetEditingEntryHdl(LINK(this, SalInstanceTreeView, EditingEntryHdl));
+        static_cast<LclTabListBox&>(*m_xTreeView).SetEditedEntryHdl(LINK(this, SalInstanceTreeView, EditedEntryHdl));
     }
+    m_aCheckButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
+    m_aRadioButtonData.SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
+}
 
-    virtual void thaw() override
+void SalInstanceTreeView::columns_autosize()
+{
+    std::vector<long> aWidths;
+    m_xTreeView->getPreferredDimensions(aWidths);
+    if (aWidths.size() > 2)
     {
-        m_xTreeView->SetUpdateMode(true);
-        SalInstanceWidget::thaw();
+        std::vector<int> aColWidths;
+        for (size_t i = 1; i < aWidths.size() - 1; ++i)
+            aColWidths.push_back(aWidths[i] - aWidths[i - 1]);
+        set_column_fixed_widths(aColWidths);
     }
+}
+
+void SalInstanceTreeView::freeze()
+{
+    SalInstanceWidget::freeze();
+    m_xTreeView->SetUpdateMode(false);
+}
+
+void SalInstanceTreeView::thaw()
+{
+    m_xTreeView->SetUpdateMode(true);
+    SalInstanceWidget::thaw();
+}
 
-    virtual void set_column_fixed_widths(const std::vector<int>& rWidths) override
+void SalInstanceTreeView::set_column_fixed_widths(const std::vector<int>& rWidths)
+{
+    m_bDisableCheckBoxAutoWidth = true;
+    std::vector<long> aTabPositions;
+    aTabPositions.push_back(0);
+    for (size_t i = 0; i < rWidths.size(); ++i)
+        aTabPositions.push_back(aTabPositions[i] + rWidths[i]);
+    m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), MapUnit::MapPixel);
+    LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+    if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
     {
-        m_bDisableCheckBoxAutoWidth = true;
-        std::vector<long> aTabPositions;
-        aTabPositions.push_back(0);
         for (size_t i = 0; i < rWidths.size(); ++i)
-            aTabPositions.push_back(aTabPositions[i] + rWidths[i]);
-        m_xTreeView->SetTabs(aTabPositions.size(), aTabPositions.data(), MapUnit::MapPixel);
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
-        {
-            for (size_t i = 0; i < rWidths.size(); ++i)
-                pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
-        }
-        // call Resize to recalculate based on the new tabs
-        m_xTreeView->Resize();
+            pHeaderBar->SetItemSize(pHeaderBar->GetItemId(i), rWidths[i]);
     }
+    // call Resize to recalculate based on the new tabs
+    m_xTreeView->Resize();
+}
+
+void SalInstanceTreeView::set_centered_column(int nCol)
+{
+    m_xTreeView->SetTabJustify(nCol, SvTabJustify::AdjustCenter);
+}
+
+int SalInstanceTreeView::get_column_width(int nColumn) const
+{
+    LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+    if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
+        return pHeaderBar->GetItemSize(pHeaderBar->GetItemId(nColumn));
+    // GetTab(0) gives the position of the bitmap which is automatically inserted by the TabListBox.
+    // So the first text column's width is Tab(2)-Tab(1).
+    auto nWidthPixel = m_xTreeView->GetLogicTab(nColumn + 2) - m_xTreeView->GetLogicTab(nColumn + 1);
+    nWidthPixel -= SV_TAB_BORDER;
+    return nWidthPixel;
+}
 
-    virtual void set_centered_column(int nCol) override
+OUString SalInstanceTreeView::get_column_title(int nColumn) const
+{
+    LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+    if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
     {
-        m_xTreeView->SetTabJustify(nCol, SvTabJustify::AdjustCenter);
+        return pHeaderBar->GetItemText(pHeaderBar->GetItemId(nColumn));
     }
+    return OUString();
+}
 
-    virtual int get_column_width(int nColumn) const override
+void SalInstanceTreeView::set_column_title(int nColumn, const OUString& rTitle)
+{
+    LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
+    if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
     {
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
-            return pHeaderBar->GetItemSize(pHeaderBar->GetItemId(nColumn));
-        // GetTab(0) gives the position of the bitmap which is automatically inserted by the TabListBox.
-        // So the first text column's width is Tab(2)-Tab(1).
-        auto nWidthPixel = m_xTreeView->GetLogicTab(nColumn + 2) - m_xTreeView->GetLogicTab(nColumn + 1);
-        nWidthPixel -= SV_TAB_BORDER;
-        return nWidthPixel;
+        return pHeaderBar->SetItemText(pHeaderBar->GetItemId(nColumn), rTitle);
     }
+}
+
+void SalInstanceTreeView::show()
+{
+    if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
+        pHeaderBox->GetParent()->Show();
+    SalInstanceContainer::show();
+}
 
-    virtual OUString get_column_title(int nColumn) const override
+void SalInstanceTreeView::hide()
+{
+    if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
+        pHeaderBox->GetParent()->Hide();
+    SalInstanceContainer::hide();
+}
+
+void SalInstanceTreeView::insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
+                    const OUString* pIconName, VirtualDevice* pImageSurface,
+                    const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet)
+{
+    disable_notify_events();
+    const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
+    SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
+    auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
+    void* pUserData;
+    if (pId)
     {
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
-        {
-            return pHeaderBar->GetItemText(pHeaderBar->GetItemId(nColumn));
-        }
-        return OUString();
+        m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
+        pUserData = m_aUserData.back().get();
     }
+    else
+        pUserData = nullptr;
+
+    SvTreeListEntry* pEntry = new SvTreeListEntry;
 
-    virtual void set_column_title(int nColumn, const OUString& rTitle) override
+    if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
+        AddStringItem(pEntry, "", -1);
+
+    if (pIconName || pImageSurface)
     {
-        LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get());
-        if (HeaderBar* pHeaderBar = pHeaderBox ? pHeaderBox->GetHeaderBar() : nullptr)
-        {
-            return pHeaderBar->SetItemText(pHeaderBar->GetItemId(nColumn), rTitle);
-        }
+        Image aImage(pIconName ? createImage(*pIconName) : createImage(*pImageSurface));
+        pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
+    }
+    else
+    {
+        Image aDummy;
+        pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
     }
+    if (pStr)
+        pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
+    pEntry->SetUserData(pUserData);
+    m_xTreeView->Insert(pEntry, iter, nInsertPos);
 
-    virtual void show() override
+    if (pExpanderName)
     {
-        if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
-            pHeaderBox->GetParent()->Show();
-        SalInstanceContainer::show();
+        Image aImage(createImage(*pExpanderName));
+        m_xTreeView->SetExpandedEntryBmp(pEntry, aImage);
+        m_xTreeView->SetCollapsedEntryBmp(pEntry, aImage);
     }
 
-    virtual void hide() override
+    if (pRet)
     {
-        if (LclHeaderTabListBox* pHeaderBox = dynamic_cast<LclHeaderTabListBox*>(m_xTreeView.get()))
-            pHeaderBox->GetParent()->Hide();
-        SalInstanceContainer::hide();
+        SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
+        pVclRetIter->iter = pEntry;
     }
 
-    virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, const OUString* pId,
-                        const OUString* pIconName, VirtualDevice* pImageSurface,
-                        const OUString* pExpanderName, bool bChildrenOnDemand, weld::TreeIter* pRet) override
+    if (bChildrenOnDemand)
     {
-        disable_notify_events();
-        const SalInstanceTreeIter* pVclIter = static_cast<const SalInstanceTreeIter*>(pParent);
-        SvTreeListEntry* iter = pVclIter ? pVclIter->iter : nullptr;
-        auto nInsertPos = pos == -1 ? TREELIST_APPEND : pos;
-        void* pUserData;
-        if (pId)
-        {
-            m_aUserData.emplace_back(std::make_unique<OUString>(*pId));
-            pUserData = m_aUserData.back().get();
-        }
-        else
-            pUserData = nullptr;
+        m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+    }
+    enable_notify_events();
+}
 
-        SvTreeListEntry* pEntry = new SvTreeListEntry;
+void SalInstanceTreeView::bulk_insert_for_each(int nSourceCount,
+                                    const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
+                                    const std::vector<int>* pFixedWidths)
+{
+    freeze();
+    clear();
+    SalInstanceTreeIter aVclIter(static_cast<SvTreeListEntry*>(nullptr));
 
-        if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
-            AddStringItem(pEntry, "", -1);
+    m_xTreeView->nTreeFlags |= SvTreeFlags::MANINS;
 
-        if (pIconName || pImageSurface)
-        {
-            Image aImage(pIconName ? createImage(*pIconName) : createImage(*pImageSurface));
-            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
-        }
-        else
-        {
-            Image aDummy;
-            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
-        }
-        if (pStr)
-            pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
-        pEntry->SetUserData(pUserData);
-        m_xTreeView->Insert(pEntry, iter, nInsertPos);
+    if (pFixedWidths)
+        set_column_fixed_widths(*pFixedWidths);
 
-        if (pExpanderName)
-        {
-            Image aImage(createImage(*pExpanderName));
-            m_xTreeView->SetExpandedEntryBmp(pEntry, aImage);
-            m_xTreeView->SetCollapsedEntryBmp(pEntry, aImage);
-        }
+    Image aDummy;
+    for (int i = 0; i < nSourceCount; ++i)
+    {
+        aVclIter.iter = new SvTreeListEntry;
+        if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
+            AddStringItem(aVclIter.iter, "", -1);
+        aVclIter.iter->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
+        m_xTreeView->Insert(aVclIter.iter, nullptr, TREELIST_APPEND);
+        func(aVclIter, i);
 
-        if (pRet)
-        {
-            SalInstanceTreeIter* pVclRetIter = static_cast<SalInstanceTreeIter*>(pRet);
-            pVclRetIter->iter = pEntry;
-        }
+        if (!pFixedWidths)
+            continue;
 
-        if (bChildrenOnDemand)
+        size_t nFixedWidths = std::min(pFixedWidths->size(), aVclIter.iter->ItemCount());
+        for (size_t j = 0; j < nFixedWidths; ++j)
         {
-            m_xTreeView->InsertEntry("<dummy>", pEntry, false, 0, nullptr);
+            SvLBoxItem& rItem = aVclIter.iter->GetItem(j);
+            SvViewDataItem* pViewDataItem = m_xTreeView->GetViewDataItem(aVclIter.iter, &rItem);
+            pViewDataItem->mnWidth = (*pFixedWidths)[j];
         }
-        enable_notify_events();
     }
 
-    virtual void bulk_insert_for_each(int nSourceCount,
-                                      const std::function<void(weld::TreeIter&, int nSourceIndex)>& func,
-                                      const std::vector<int>* pFixedWidths) override
-    {
-        freeze();
-        clear();
-        SalInstanceTreeIter aVclIter(static_cast<SvTreeListEntry*>(nullptr));
-
-        m_xTreeView->nTreeFlags |= SvTreeFlags::MANINS;
+    m_xTreeView->nTreeFlags &= ~SvTreeFlags::MANINS;
 
-        if (pFixedWidths)
-            set_column_fixed_widths(*pFixedWidths);
-
-        Image aDummy;
-        for (int i = 0; i < nSourceCount; ++i)
-        {
-            aVclIter.iter = new SvTreeListEntry;
-            if (m_xTreeView->nTreeFlags & SvTreeFlags::CHKBTN)
-                AddStringItem(aVclIter.iter, "", -1);
-            aVclIter.iter->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy, false));
-            m_xTreeView->Insert(aVclIter.iter, nullptr, TREELIST_APPEND);
-            func(aVclIter, i);
-
-            if (!pFixedWidths)
-                continue;
+    thaw();
+}
 
-            size_t nFixedWidths = std::min(pFixedWidths->size(), aVclIter.iter->ItemCount());
-            for (size_t j = 0; j < nFixedWidths; ++j)
-            {
-                SvLBoxItem& rItem = aVclIter.iter->GetItem(j);
-                SvViewDataItem* pViewDataItem = m_xTreeView->GetViewDataItem(aVclIter.iter, &rItem);
-                pViewDataItem->mnWidth = (*pFixedWidths)[j];
-            }
-        }
+void SalInstanceTreeView::set_font_color(int pos, const Color& rColor) const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    pEntry->SetTextColor(rColor);
+}
 
-        m_xTreeView->nTreeFlags &= ~SvTreeFlags::MANINS;
+void SalInstanceTreeView::set_font_color(const weld::TreeIter& rIter, const Color& rColor) const
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    rVclIter.iter->SetTextColor(rColor);
+}
 
-        thaw();
-    }
+void SalInstanceTreeView::remove(int pos)
+{
+    disable_notify_events();
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    m_xTreeView->RemoveEntry(pEntry);
+    enable_notify_events();
+}
 
-    virtual void set_font_color(int pos, const Color& rColor) const override
+int SalInstanceTreeView::find_text(const OUString& rText) const
+{
+    for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
     {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        pEntry->SetTextColor(rColor);
+        if (SvTabListBox::GetEntryText(pEntry, 0) == rText)
+            return SvTreeList::GetRelPos(pEntry);
     }
+    return -1;
+}
 
-    virtual void set_font_color(const weld::TreeIter& rIter, const Color& rColor) const override
+int SalInstanceTreeView::find_id(const OUString& rId) const
+{
+    for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
     {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        rVclIter.iter->SetTextColor(rColor);
+        const OUString* pId = static_cast<const OUString*>(pEntry->GetUserData());
+        if (!pId)
+            continue;
+        if (rId == *pId)
+            return SvTreeList::GetRelPos(pEntry);
     }
+    return -1;
+}
 
-    virtual void remove(int pos) override
-    {
-        disable_notify_events();
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        m_xTreeView->RemoveEntry(pEntry);
-        enable_notify_events();
-    }
+void SalInstanceTreeView::swap(int pos1, int pos2)
+{
+    int min = std::min(pos1, pos2);
+    int max = std::max(pos1, pos2);
+    SvTreeList* pModel = m_xTreeView->GetModel();
+    SvTreeListEntry* pEntry1 = pModel->GetEntry(nullptr, min);
+    SvTreeListEntry* pEntry2 = pModel->GetEntry(nullptr, max);
+    pModel->Move(pEntry1, pEntry2);
+}
+
+void SalInstanceTreeView::clear()
+{
+    disable_notify_events();
+    m_xTreeView->Clear();
+    m_aUserData.clear();
+    enable_notify_events();
+}
+
+int SalInstanceTreeView::n_children() const
+{
+    return m_xTreeView->GetModel()->GetChildList(nullptr).size();
+}
 
-    virtual int find_text(const OUString& rText) const override
+void SalInstanceTreeView::select(int pos)
+{
+    assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
+    disable_notify_events();
+    if (pos == -1 || (pos == 0 && n_children() == 0))
+        m_xTreeView->SelectAll(false);
+    else
     {
-        for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
-        {
-            if (SvTabListBox::GetEntryText(pEntry, 0) == rText)
-                return SvTreeList::GetRelPos(pEntry);
-        }
-        return -1;
+        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+        m_xTreeView->Select(pEntry, true);
+        m_xTreeView->MakeVisible(pEntry);
     }
+    enable_notify_events();
+}
 
-    virtual int find_id(const OUString& rId) const override
-    {
-        for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
-        {
-            const OUString* pId = static_cast<const OUString*>(pEntry->GetUserData());
-            if (!pId)
-                continue;
-            if (rId == *pId)
-                return SvTreeList::GetRelPos(pEntry);
-        }
+int SalInstanceTreeView::get_cursor_index() const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetCurEntry();
+    if (!pEntry)
         return -1;
-    }
+    return SvTreeList::GetRelPos(pEntry);
+}
 
-    virtual void swap(int pos1, int pos2) override
+void SalInstanceTreeView::set_cursor(int pos)
+{
+    if (pos == -1)
+        m_xTreeView->SetCurEntry(nullptr);
+    else
     {
-        int min = std::min(pos1, pos2);
-        int max = std::max(pos1, pos2);
-        SvTreeList* pModel = m_xTreeView->GetModel();
-        SvTreeListEntry* pEntry1 = pModel->GetEntry(nullptr, min);
-        SvTreeListEntry* pEntry2 = pModel->GetEntry(nullptr, max);
-        pModel->Move(pEntry1, pEntry2);
+        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+        m_xTreeView->SetCurEntry(pEntry);
     }
+}
 
-    virtual void clear() override
-    {
-        disable_notify_events();
-        m_xTreeView->Clear();
-        m_aUserData.clear();
-        enable_notify_events();
-    }
+void SalInstanceTreeView::scroll_to_row(int pos)
+{
+    assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
+    disable_notify_events();
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    m_xTreeView->MakeVisible(pEntry);
+    enable_notify_events();
+}
 
-    virtual int n_children() const override
-    {
-        return m_xTreeView->GetModel()->GetChildList(nullptr).size();
-    }
+bool SalInstanceTreeView::is_selected(int pos) const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    return m_xTreeView->IsSelected(pEntry);
+}
 
-    virtual void select(int pos) override
+void SalInstanceTreeView::unselect(int pos)
+{
+    assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
+    disable_notify_events();
+    if (pos == -1)
+        m_xTreeView->SelectAll(true);
+    else
     {
-        assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
-        disable_notify_events();
-        if (pos == -1 || (pos == 0 && n_children() == 0))
-            m_xTreeView->SelectAll(false);
-        else
-        {
-            SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-            m_xTreeView->Select(pEntry, true);
-            m_xTreeView->MakeVisible(pEntry);
-        }
-        enable_notify_events();
+        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+        m_xTreeView->Select(pEntry, false);
     }
+    enable_notify_events();
+}
 
-    virtual int get_cursor_index() const override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetCurEntry();
-        if (!pEntry)
-            return -1;
-        return SvTreeList::GetRelPos(pEntry);
-    }
+std::vector<int> SalInstanceTreeView::get_selected_rows() const
+{
+    std::vector<int> aRows;
 
-    virtual void set_cursor(int pos) override
-    {
-        if (pos == -1)
-            m_xTreeView->SetCurEntry(nullptr);
-        else
-        {
-            SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-            m_xTreeView->SetCurEntry(pEntry);
-        }
-    }
+    aRows.reserve(m_xTreeView->GetSelectionCount());
+    for (SvTreeListEntry* pEntry = m_xTreeView->FirstSelected(); pEntry; pEntry = m_xTreeView->NextSelected(pEntry))
+        aRows.push_back(SvTreeList::GetRelPos(pEntry));
 
-    virtual void scroll_to_row(int pos) override
-    {
-        assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
-        disable_notify_events();
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        m_xTreeView->MakeVisible(pEntry);
-        enable_notify_events();
-    }
+    return aRows;
+}
 
-    virtual bool is_selected(int pos) const override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        return m_xTreeView->IsSelected(pEntry);
-    }
+OUString SalInstanceTreeView::get_text(SvTreeListEntry* pEntry, int col) const
+{
+    if (col == -1)
+        return SvTabListBox::GetEntryText(pEntry, 0);
 
-    virtual void unselect(int pos) override
-    {
-        assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
-        disable_notify_events();
-        if (pos == -1)
-            m_xTreeView->SelectAll(true);
-        else
-        {
-            SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-            m_xTreeView->Select(pEntry, false);
-        }
-        enable_notify_events();
-    }
+    col = to_internal_model(col);
 
-    virtual std::vector<int> get_selected_rows() const override
-    {
-        std::vector<int> aRows;
+    if (static_cast<size_t>(col) == pEntry->ItemCount())
+        return OUString();
 
-        aRows.reserve(m_xTreeView->GetSelectionCount());
-        for (SvTreeListEntry* pEntry = m_xTreeView->FirstSelected(); pEntry; pEntry = m_xTreeView->NextSelected(pEntry))
-            aRows.push_back(SvTreeList::GetRelPos(pEntry));
+    assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxString*>(&rItem));
+    return static_cast<SvLBoxString&>(rItem).GetText();
+}
 
-        return aRows;
-    }
+OUString SalInstanceTreeView::get_text(int pos, int col) const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    return get_text(pEntry, col);
+}
 
-    OUString get_text(SvTreeListEntry* pEntry, int col) const
+void SalInstanceTreeView::set_text(SvTreeListEntry* pEntry, const OUString& rText, int col)
+{
+    if (col == -1)
     {
-        if (col == -1)
-            return SvTabListBox::GetEntryText(pEntry, 0);
+        m_xTreeView->SetEntryText(pEntry, rText);
+        return;
+    }
 
-        col = to_internal_model(col);
+    col = to_internal_model(col);
 
-        if (static_cast<size_t>(col) == pEntry->ItemCount())
-            return OUString();
+    // blank out missing entries
+    for (int i = pEntry->ItemCount(); i < col ; ++i)
+        pEntry->AddItem(std::make_unique<SvLBoxString>(""));
 
+    if (static_cast<size_t>(col) == pEntry->ItemCount())
+    {
+        pEntry->AddItem(std::make_unique<SvLBoxString>(rText));
+        SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
+        m_xTreeView->InitViewData(pViewData, pEntry);
+    }
+    else
+    {
         assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
         SvLBoxItem& rItem = pEntry->GetItem(col);
         assert(dynamic_cast<SvLBoxString*>(&rItem));
-        return static_cast<SvLBoxString&>(rItem).GetText();
+        static_cast<SvLBoxString&>(rItem).SetText(rText);
     }
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-    virtual OUString get_text(int pos, int col) const override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        return get_text(pEntry, col);
-    }
+void SalInstanceTreeView::set_text(int pos, const OUString& rText, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    set_text(pEntry, rText, col);
+}
 
-    void set_text(SvTreeListEntry* pEntry, const OUString& rText, int col)
+void SalInstanceTreeView::set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col)
+{
+    if (col == -1)
     {
-        if (col == -1)
+        const sal_uInt16 nCount = pEntry->ItemCount();
+        for (sal_uInt16 nCur = 0; nCur < nCount; ++nCur)
         {
-            m_xTreeView->SetEntryText(pEntry, rText);
-            return;
+            SvLBoxItem& rItem = pEntry->GetItem(nCur);
+            if (rItem.GetType() == SvLBoxItemType::String)
+            {
+                rItem.Enable(bSensitive);
+                m_xTreeView->ModelHasEntryInvalidated(pEntry);
+                break;
+            }
         }
+        return;
+    }
 
-        col = to_internal_model(col);
-
-        // blank out missing entries
-        for (int i = pEntry->ItemCount(); i < col ; ++i)
-            pEntry->AddItem(std::make_unique<SvLBoxString>(""));
+    col = to_internal_model(col);
 
-        if (static_cast<size_t>(col) == pEntry->ItemCount())
-        {
-            pEntry->AddItem(std::make_unique<SvLBoxString>(rText));
-            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
-            m_xTreeView->InitViewData(pViewData, pEntry);
-        }
-        else
-        {
-            assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
-            SvLBoxItem& rItem = pEntry->GetItem(col);
-            assert(dynamic_cast<SvLBoxString*>(&rItem));
-            static_cast<SvLBoxString&>(rItem).SetText(rText);
-        }
-        m_xTreeView->ModelHasEntryInvalidated(pEntry);
-    }
+    assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    rItem.Enable(bSensitive);
 
-    virtual void set_text(int pos, const OUString& rText, int col) override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        set_text(pEntry, rText, col);
-    }
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-    void set_sensitive(SvTreeListEntry* pEntry, bool bSensitive, int col)
-    {
-        if (col == -1)
-        {
-            const sal_uInt16 nCount = pEntry->ItemCount();
-            for (sal_uInt16 nCur = 0; nCur < nCount; ++nCur)
-            {
-                SvLBoxItem& rItem = pEntry->GetItem(nCur);
-                if (rItem.GetType() == SvLBoxItemType::String)
-                {
-                    rItem.Enable(bSensitive);
-                    m_xTreeView->ModelHasEntryInvalidated(pEntry);
-                    break;
-                }
-            }
-            return;
-        }
+void SalInstanceTreeView::set_sensitive(int pos, bool bSensitive, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    set_sensitive(pEntry, bSensitive, col);
+}
 
-        col = to_internal_model(col);
+void SalInstanceTreeView::set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col)
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    set_sensitive(rVclIter.iter, bSensitive, col);
+}
 
-        assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        rItem.Enable(bSensitive);
+TriState SalInstanceTreeView::get_toggle(int pos, int col) const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    return get_toggle(pEntry, col);
+}
 
-        m_xTreeView->ModelHasEntryInvalidated(pEntry);
-    }
+TriState SalInstanceTreeView::get_toggle(const weld::TreeIter& rIter, int col) const
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    return get_toggle(rVclIter.iter, col);
+}
 
-    using SalInstanceWidget::set_sensitive;
+void SalInstanceTreeView::enable_toggle_buttons(weld::ColumnToggleType eType)
+{
+    assert(n_children() == 0 && "tree must be empty");
+    m_bTogglesAsRadio = eType == weld::ColumnToggleType::Radio;
 
-    virtual void set_sensitive(int pos, bool bSensitive, int col) override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        set_sensitive(pEntry, bSensitive, col);
-    }
+    SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
+    m_xTreeView->EnableCheckButton(pData);
+    // EnableCheckButton clobbered this, restore it
+    pData->SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
+}
 
-    virtual void set_sensitive(const weld::TreeIter& rIter, bool bSensitive, int col) override
-    {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        set_sensitive(rVclIter.iter, bSensitive, col);
-    }
+void SalInstanceTreeView::set_toggle(int pos, TriState eState, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    set_toggle(pEntry, eState, col);
+}
 
-    virtual TriState get_toggle(int pos, int col) const override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        return get_toggle(pEntry, col);
-    }
+void SalInstanceTreeView::set_toggle(const weld::TreeIter& rIter, TriState eState, int col)
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    set_toggle(rVclIter.iter, eState, col);
+}
 
-    virtual TriState get_toggle(const weld::TreeIter& rIter, int col) const override
-    {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        return get_toggle(rVclIter.iter, col);
-    }
+void SalInstanceTreeView::set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col)
+{
+    col = to_internal_model(col);
 
-    virtual void enable_toggle_buttons(weld::ColumnToggleType eType) override
-    {
-        assert(n_children() == 0 && "tree must be empty");
-        m_bTogglesAsRadio = eType == weld::ColumnToggleType::Radio;
+    assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxString*>(&rItem));
+    static_cast<SvLBoxString&>(rItem).Emphasize(bOn);
 
-        SvLBoxButtonData* pData = m_bTogglesAsRadio ? &m_aRadioButtonData : &m_aCheckButtonData;
-        m_xTreeView->EnableCheckButton(pData);
-        // EnableCheckButton clobbered this, restore it
-        pData->SetLink(LINK(this, SalInstanceTreeView, ToggleHdl));
-    }
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-    virtual void set_toggle(int pos, TriState eState, int col) override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        set_toggle(pEntry, eState, col);
-    }
+void SalInstanceTreeView::set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col)
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    set_text_emphasis(rVclIter.iter, bOn, col);
+}
 
-    virtual void set_toggle(const weld::TreeIter& rIter, TriState eState, int col) override
-    {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        set_toggle(rVclIter.iter, eState, col);
-    }
+void SalInstanceTreeView::set_text_emphasis(int pos, bool bOn, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    set_text_emphasis(pEntry, bOn, col);
+}
 
-    void set_text_emphasis(SvTreeListEntry* pEntry, bool bOn, int col)
-    {
-        col = to_internal_model(col);
+bool SalInstanceTreeView::get_text_emphasis(const weld::TreeIter& rIter, int col) const
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    return get_text_emphasis(rVclIter.iter, col);
+}
 
-        assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        assert(dynamic_cast<SvLBoxString*>(&rItem));
-        static_cast<SvLBoxString&>(rItem).Emphasize(bOn);
+bool SalInstanceTreeView::get_text_emphasis(int pos, int col) const
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    return get_text_emphasis(pEntry, col);
+}
 
-        m_xTreeView->ModelHasEntryInvalidated(pEntry);
-    }
+void SalInstanceTreeView::set_text_align(SvTreeListEntry* pEntry, double fAlign, int col)
+{
+    col = to_internal_model(col);
 
-    virtual void set_text_emphasis(const weld::TreeIter& rIter, bool bOn, int col) override
-    {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        set_text_emphasis(rVclIter.iter, bOn, col);
-    }
+    assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
+    SvLBoxItem& rItem = pEntry->GetItem(col);
+    assert(dynamic_cast<SvLBoxString*>(&rItem));
+    static_cast<SvLBoxString&>(rItem).Align(fAlign);
 
-    virtual void set_text_emphasis(int pos, bool bOn, int col) override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        set_text_emphasis(pEntry, bOn, col);
-    }
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-    virtual bool get_text_emphasis(const weld::TreeIter& rIter, int col) const override
-    {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        return get_text_emphasis(rVclIter.iter, col);
-    }
+void SalInstanceTreeView::set_text_align(const weld::TreeIter& rIter, double fAlign, int col)
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    set_text_align(rVclIter.iter, fAlign, col);
+}
 
-    virtual bool get_text_emphasis(int pos, int col) const override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        return get_text_emphasis(pEntry, col);
-    }
+void SalInstanceTreeView::set_text_align(int pos, double fAlign, int col)
+{
+    SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+    set_text_align(pEntry, fAlign, col);
+}
 
-    void set_text_align(SvTreeListEntry* pEntry, double fAlign, int col)
-    {
-        col = to_internal_model(col);
+void SalInstanceTreeView::connect_editing(
+    const Link<const weld::TreeIter&, bool>& rStartLink,
+    const Link<const iter_string&, bool>& rEndLink)
+{
+    m_xTreeView->EnableInplaceEditing(rStartLink.IsSet() || rEndLink.IsSet());
+    weld::TreeView::connect_editing(rStartLink, rEndLink);
+}
 
-        assert(col >= 0 && static_cast<unsigned>(col) < pEntry->ItemCount());
-        SvLBoxItem& rItem = pEntry->GetItem(col);
-        assert(dynamic_cast<SvLBoxString*>(&rItem));
-        static_cast<SvLBoxString&>(rItem).Align(fAlign);
+void SalInstanceTreeView::start_editing(const weld::TreeIter& rIter)
+{
+    const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
+    m_xTreeView->EditEntry(rVclIter.iter);
+}
 
-        m_xTreeView->ModelHasEntryInvalidated(pEntry);
-    }
+void SalInstanceTreeView::end_editing()
+{
+    m_xTreeView->EndEditing();
+}
 
-    virtual void set_text_align(const weld::TreeIter& rIter, double fAlign, int col) override
+void SalInstanceTreeView::set_image(SvTreeListEntry* pEntry, const Image& rImage, int col)
+{
+    if (col == -1)
     {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        set_text_align(rVclIter.iter, fAlign, col);
+        m_xTreeView->SetExpandedEntryBmp(pEntry, rImage);
+        m_xTreeView->SetCollapsedEntryBmp(pEntry, rImage);
+        return;
     }
 
-    virtual void set_text_align(int pos, double fAlign, int col) override
-    {
-        SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
-        set_text_align(pEntry, fAlign, col);
-    }
+    col = to_internal_model(col);
 
-    virtual void connect_editing(
-        const Link<const weld::TreeIter&, bool>& rStartLink,
-        const Link<const iter_string&, bool>& rEndLink) override
-    {
-        m_xTreeView->EnableInplaceEditing(rStartLink.IsSet() || rEndLink.IsSet());
-        weld::TreeView::connect_editing(rStartLink, rEndLink);
-    }
+    // blank out missing entries
+    for (int i = pEntry->ItemCount(); i < col ; ++i)
+        pEntry->AddItem(std::make_unique<SvLBoxString>(""));
 
-    virtual void start_editing(const weld::TreeIter& rIter) override
+    if (static_cast<size_t>(col) == pEntry->ItemCount())
     {
-        const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
-        m_xTreeView->EditEntry(rVclIter.iter);
+        pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(rImage, rImage, false));
+        SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
+        m_xTreeView->InitViewData(pViewData, pEntry);
     }
-
-    virtual void end_editing() override
+    else
     {
-        m_xTreeView->EndEditing();
+        assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
+        SvLBoxItem& rItem = pEntry->GetItem(col);
+        assert(dynamic_cast<SvLBoxContextBmp*>(&rItem));
+        static_cast<SvLBoxContextBmp&>(rItem).SetBitmap1(rImage);
+        static_cast<SvLBoxContextBmp&>(rItem).SetBitmap2(rImage);
     }
 
-    void set_image(SvTreeListEntry* pEntry, const Image& rImage, int col)
-    {
-        if (col == -1)
-        {
-            m_xTreeView->SetExpandedEntryBmp(pEntry, rImage);
-            m_xTreeView->SetCollapsedEntryBmp(pEntry, rImage);
-            return;
-        }
+    m_xTreeView->SetEntryHeight(pEntry);
+    m_xTreeView->ModelHasEntryInvalidated(pEntry);
+}
 
-        col = to_internal_model(col);
+void SalInstanceTreeView::set_image(int pos, const OUString& rImage, int col)
+{
+    set_image(m_xTreeView->GetEntry(nullptr, pos), createImage(rImage), col);
+}
 
-        // blank out missing entries
-        for (int i = pEntry->ItemCount(); i < col ; ++i)
-            pEntry->AddItem(std::make_unique<SvLBoxString>(""));
+void SalInstanceTreeView::set_image(int pos, const css::uno::Reference<css::graphic::XGraphic>& rImage, int col)
+{
+    set_image(m_xTreeView->GetEntry(nullptr, pos), Image(rImage), col);
+}
 
-        if (static_cast<size_t>(col) == pEntry->ItemCount())
-        {
-            pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(rImage, rImage, false));
-            SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
-            m_xTreeView->InitViewData(pViewData, pEntry);
-        }
-        else
-        {

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list