[Libreoffice-commits] core.git: cui/source dbaccess/source desktop/source include/vcl sc/source sw/source vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri May 29 09:51:57 UTC 2020


 cui/source/customize/SvxNotebookbarConfigPage.cxx     |    5 +-
 cui/source/customize/SvxToolbarConfigPage.cxx         |    4 -
 cui/source/dialogs/multipat.cxx                       |    4 -
 cui/source/inc/SvxNotebookbarConfigPage.hxx           |    3 -
 cui/source/inc/SvxToolbarConfigPage.hxx               |    3 -
 cui/source/inc/multipat.hxx                           |    3 -
 cui/source/inc/optlingu.hxx                           |    8 +--
 cui/source/options/certpath.cxx                       |    4 -
 cui/source/options/certpath.hxx                       |    3 -
 cui/source/options/optjava.cxx                        |    4 -
 cui/source/options/optjava.hxx                        |    3 -
 cui/source/options/optlingu.cxx                       |   20 +++-----
 dbaccess/source/ui/control/tabletree.cxx              |    4 -
 dbaccess/source/ui/dlg/tablespage.cxx                 |    7 --
 dbaccess/source/ui/dlg/tablespage.hxx                 |    3 -
 dbaccess/source/ui/inc/tabletree.hxx                  |    4 -
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx |    6 --
 desktop/source/deployment/gui/dp_gui_updatedialog.hxx |    3 -
 include/vcl/weld.hxx                                  |   43 +++++++-----------
 sc/source/ui/dbgui/dpgroupdlg.cxx                     |   10 +++-
 sc/source/ui/dbgui/tpsubt.cxx                         |    2 
 sc/source/ui/inc/dpgroupdlg.hxx                       |    5 --
 sc/source/ui/inc/tpsubt.hxx                           |    3 -
 sw/source/ui/config/optload.cxx                       |    4 -
 sw/source/ui/index/cnttab.cxx                         |    5 --
 sw/source/uibase/inc/optload.hxx                      |    4 -
 vcl/source/app/salvtables.cxx                         |   10 +---
 vcl/unx/gtk3/gtk3gtkinst.cxx                          |   11 +---
 28 files changed, 80 insertions(+), 108 deletions(-)

New commits:
commit 652e2136984a5b023b5551914cb9786a0d8f1540
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu May 28 16:05:15 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri May 29 11:51:17 2020 +0200

    change TreeView toggle signal to provide an iter instead of a row index
    
    Change-Id: Ib611780816d170daa40f394b9798640ff6284d68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95056
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/customize/SvxNotebookbarConfigPage.cxx b/cui/source/customize/SvxNotebookbarConfigPage.cxx
index 584767d6af5a..3903a3366eb6 100644
--- a/cui/source/customize/SvxNotebookbarConfigPage.cxx
+++ b/cui/source/customize/SvxNotebookbarConfigPage.cxx
@@ -546,9 +546,10 @@ void SvxNotebookbarEntriesListBox::ChangedVisibility(int nRow)
     sfx2::SfxNotebookBar::ReloadNotebookBar(sUIPath);
 }
 
-IMPL_LINK(SvxNotebookbarEntriesListBox, CheckButtonHdl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxNotebookbarEntriesListBox, CheckButtonHdl, const weld::TreeView::iter_col&, rRowCol,
+          void)
 {
-    ChangedVisibility(rRowCol.first);
+    ChangedVisibility(m_xControl->get_iter_index_in_parent(rRowCol.first));
 }
 
 IMPL_LINK(SvxNotebookbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 7bc2115b36fa..5efa3283498b 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -865,9 +865,9 @@ void SvxToolbarEntriesListBox::ChangedVisibility(int nRow)
     }
 }
 
-IMPL_LINK(SvxToolbarEntriesListBox, CheckButtonHdl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxToolbarEntriesListBox, CheckButtonHdl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    ChangedVisibility(rRowCol.first);
+    ChangedVisibility(m_xControl->get_iter_index_in_parent(rRowCol.first));
 }
 
 IMPL_LINK(SvxToolbarEntriesListBox, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index 48dc545f93ea..5b38d584d76f 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -70,9 +70,9 @@ void SvxMultiPathDialog::HandleEntryChecked(int nRow)
     }
 }
 
-IMPL_LINK(SvxMultiPathDialog, CheckHdl_Impl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxMultiPathDialog, CheckHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    HandleEntryChecked(rRowCol.first);
+    HandleEntryChecked(m_xRadioLB->get_iter_index_in_parent(rRowCol.first));
 }
 
 void SvxMultiPathDialog::AppendEntry(const OUString& rText, const OUString& rId)
diff --git a/cui/source/inc/SvxNotebookbarConfigPage.hxx b/cui/source/inc/SvxNotebookbarConfigPage.hxx
index 47870949d9aa..7e417463ab30 100644
--- a/cui/source/inc/SvxNotebookbarConfigPage.hxx
+++ b/cui/source/inc/SvxNotebookbarConfigPage.hxx
@@ -75,8 +75,7 @@ public:
 class SvxNotebookbarEntriesListBox final : public SvxMenuEntriesListBox
 {
     void ChangedVisibility(int nRow);
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckButtonHdl, const row_col&, void);
+    DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void);
     DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
 
 public:
diff --git a/cui/source/inc/SvxToolbarConfigPage.hxx b/cui/source/inc/SvxToolbarConfigPage.hxx
index 5902cdf4b268..00672453df1b 100644
--- a/cui/source/inc/SvxToolbarConfigPage.hxx
+++ b/cui/source/inc/SvxToolbarConfigPage.hxx
@@ -77,8 +77,7 @@ class SvxToolbarEntriesListBox final : public SvxMenuEntriesListBox
 {
     void ChangedVisibility(int nRow);
 
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckButtonHdl, const row_col&, void);
+    DECL_LINK(CheckButtonHdl, const weld::TreeView::iter_col&, void);
     DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
 
 public:
diff --git a/cui/source/inc/multipat.hxx b/cui/source/inc/multipat.hxx
index 67832c1e8cae..fcc60bb08693 100644
--- a/cui/source/inc/multipat.hxx
+++ b/cui/source/inc/multipat.hxx
@@ -44,8 +44,7 @@ private:
     DECL_LINK(AddHdl_Impl, weld::Button&, void);
     DECL_LINK(DelHdl_Impl, weld::Button&, void);
     DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckHdl_Impl, const row_col&, void);
+    DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col&, void);
 
 public:
     SvxMultiPathDialog(weld::Window* pParent);
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index bc12d3991daa..35d34eb101db 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -67,8 +67,7 @@ class SvxEditModulesDlg : public weld::GenericDialogController
     DECL_LINK( ClickHdl_Impl, weld::Button&, void );
     DECL_LINK( BackHdl_Impl, weld::Button&, void );
     DECL_LINK( LangSelectListBoxHdl_Impl, weld::ComboBox&, void );
-    typedef std::pair<int, int> row_col;
-    DECL_LINK( BoxCheckButtonHdl_Impl, const row_col&, void );
+    DECL_LINK( BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
     void LangSelectHdl_Impl(const SvxLanguageBox* pBox);
 
 public:
@@ -125,9 +124,8 @@ private:
     DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
     DECL_LINK( ClickHdl_Impl, weld::Button&, void );
     DECL_LINK( BoxDoubleClickHdl_Impl, weld::TreeView&, bool );
-    typedef std::pair<int, int> row_col;
-    DECL_LINK( ModulesBoxCheckButtonHdl_Impl, const row_col&, void );
-    DECL_LINK( DicsBoxCheckButtonHdl_Impl, const row_col&, void );
+    DECL_LINK( ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
+    DECL_LINK( DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
     DECL_LINK( PostDblClickHdl_Impl, void *, void);
 
     void                UpdateModulesBox_Impl();
diff --git a/cui/source/options/certpath.cxx b/cui/source/options/certpath.cxx
index b98811dc4827..3f2359a5ac50 100644
--- a/cui/source/options/certpath.cxx
+++ b/cui/source/options/certpath.cxx
@@ -155,9 +155,9 @@ CertPathDialog::~CertPathDialog()
 {
 }
 
-IMPL_LINK(CertPathDialog, CheckHdl_Impl, const row_col&, rRowCol, void)
+IMPL_LINK(CertPathDialog, CheckHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    HandleEntryChecked(rRowCol.first);
+    HandleEntryChecked(m_xCertPathList->get_iter_index_in_parent(rRowCol.first));
 }
 
 void CertPathDialog::HandleEntryChecked(int nRow)
diff --git a/cui/source/options/certpath.hxx b/cui/source/options/certpath.hxx
index 7ab30955dff6..75d53ae10100 100644
--- a/cui/source/options/certpath.hxx
+++ b/cui/source/options/certpath.hxx
@@ -20,8 +20,7 @@ class CertPathDialog : public weld::GenericDialogController
     OUString m_sManualLabel;
     OUString m_sManualPath;
 
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckHdl_Impl, const row_col&, void);
+    DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col&, void);
     DECL_LINK(ManualHdl_Impl, weld::Button&, void);
     DECL_LINK(OKHdl_Impl, weld::Button&, void);
 
diff --git a/cui/source/options/optjava.cxx b/cui/source/options/optjava.cxx
index 0eeaec393c6d..2d4df6cb3069 100644
--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -141,9 +141,9 @@ IMPL_LINK_NOARG(SvxJavaOptionsPage, EnableHdl_Impl, weld::Button&, void)
     m_xJavaList->set_sensitive(bEnable);
 }
 
-IMPL_LINK(SvxJavaOptionsPage, CheckHdl_Impl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxJavaOptionsPage, CheckHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    HandleCheckEntry(rRowCol.first);
+    HandleCheckEntry(m_xJavaList->get_iter_index_in_parent(rRowCol.first));
 }
 
 IMPL_LINK_NOARG(SvxJavaOptionsPage, SelectHdl_Impl, weld::TreeView&, void)
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index f117746ebeec..0bfae107948f 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -82,8 +82,7 @@ private:
     std::unique_ptr<weld::Widget> m_xJavaFrame;
 
     DECL_LINK(EnableHdl_Impl, weld::Button&, void);
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckHdl_Impl, const row_col&, void);
+    DECL_LINK(CheckHdl_Impl, const weld::TreeView::iter_col&, void);
     DECL_LINK(SelectHdl_Impl, weld::TreeView&, void);
     DECL_LINK(AddHdl_Impl, weld::Button&, void);
     DECL_LINK(ParameterHdl_Impl, weld::Button&, void);
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 3a45faab808e..525a2607824f 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1302,21 +1302,19 @@ IMPL_LINK_NOARG(SvxLinguTabPage, PostDblClickHdl_Impl, void*, void)
     ClickHdl_Impl(*m_xLinguModulesEditPB);
 }
 
-IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxLinguTabPage, ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
 {
     if (!pLinguData)
         return;
-    auto nPos = rRowCol.first;
-    pLinguData->Reconfigure(m_xLinguModulesCLB->get_text(nPos, 1),
-                            m_xLinguModulesCLB->get_toggle(nPos, 0) == TRISTATE_TRUE);
+    pLinguData->Reconfigure(m_xLinguModulesCLB->get_text(rRowCol.first, 1),
+                            m_xLinguModulesCLB->get_toggle(rRowCol.first, 0) == TRISTATE_TRUE);
 }
 
-IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const row_col&, rRowCol, void)
+IMPL_LINK(SvxLinguTabPage, DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    auto nPos = rRowCol.first;
-    const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[ nPos ];
+    const uno::Reference<XDictionary> &rDic = aDics.getConstArray()[m_xLinguDicsCLB->get_iter_index_in_parent(rRowCol.first)];
     if (LinguMgr::GetIgnoreAllList() == rDic)
-        m_xLinguDicsCLB->set_toggle(nPos, TRISTATE_TRUE, 0);
+        m_xLinguDicsCLB->set_toggle(rRowCol.first, TRISTATE_TRUE, 0);
 }
 
 IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
@@ -1621,15 +1619,15 @@ IMPL_LINK( SvxEditModulesDlg, SelectHdl_Impl, weld::TreeView&, rBox, void )
     m_xPrioDownPB->set_sensitive(!bDisableDown);
 }
 
-IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const row_col&, rRowCol, void )
+IMPL_LINK( SvxEditModulesDlg, BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, rRowCol, void )
 {
-    auto nPos = rRowCol.first;
-    ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(nPos).toInt64());
+    ModuleUserData_Impl* pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(rRowCol.first).toInt64());
     if (pData->IsParent() || pData->GetType() != TYPE_HYPH)
         return;
 
     // make hyphenator checkboxes function as radio-buttons
     // (at most one box may be checked)
+    auto nPos = m_xModulesCLB->get_iter_index_in_parent(rRowCol.first);
     for (int i = 0, nEntryCount = m_xModulesCLB->n_children(); i < nEntryCount; ++i)
     {
         pData = reinterpret_cast<ModuleUserData_Impl*>(m_xModulesCLB->get_id(i).toInt64());
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index b3170487ed32..a1e3d872e840 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -485,7 +485,7 @@ void OTableTreeListBox::checkedButton_noBroadcast(SvTreeListEntry* _pEntry)
     implEmphasize(_pEntry, SvButtonState::Checked == eState);
 }
 
-void TableTreeListBox::checkedButton_noBroadcast(weld::TreeIter& rEntry)
+void TableTreeListBox::checkedButton_noBroadcast(const weld::TreeIter& rEntry)
 {
     if (!m_bShowToggles)
         return;
@@ -564,7 +564,7 @@ void OTableTreeListBox::implEmphasize(SvTreeListEntry* _pEntry, bool _bChecked,
     }
 }
 
-void TableTreeListBox::implEmphasize(weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors)
+void TableTreeListBox::implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants, bool _bUpdateAncestors)
 {
     // special emphasizing handling for the "all objects" entry
     bool bAllObjectsEntryAffected = haveVirtualRoot() && (getAllObjectsEntry()->equal(rEntry));
diff --git a/dbaccess/source/ui/dlg/tablespage.cxx b/dbaccess/source/ui/dlg/tablespage.cxx
index 586cf77bf8a4..eb39f0b27bf7 100644
--- a/dbaccess/source/ui/dlg/tablespage.cxx
+++ b/dbaccess/source/ui/dlg/tablespage.cxx
@@ -330,12 +330,9 @@ namespace dbaui
         return nResult;
     }
 
-    IMPL_LINK_NOARG(OTableSubscriptionPage, OnTreeEntryChecked, const row_col&, void)
+    IMPL_LINK(OTableSubscriptionPage, OnTreeEntryChecked, const weld::TreeView::iter_col&, rRowCol, void)
     {
-        weld::TreeView& rTreeView = m_xTablesList->GetWidget();
-        std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
-        if (rTreeView.get_cursor(xEntry.get()))
-            m_xTablesList->checkedButton_noBroadcast(*xEntry);
+        m_xTablesList->checkedButton_noBroadcast(rRowCol.first);
         callModifiedHdl();
     }
 
diff --git a/dbaccess/source/ui/dlg/tablespage.hxx b/dbaccess/source/ui/dlg/tablespage.hxx
index 0eb1273d1eb7..34618a0432be 100644
--- a/dbaccess/source/ui/dlg/tablespage.hxx
+++ b/dbaccess/source/ui/dlg/tablespage.hxx
@@ -54,8 +54,7 @@ namespace dbaui
         virtual void fillControls(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
         virtual void fillWindows(std::vector< std::unique_ptr<ISaveValueWrapper> >& _rControlList) override;
 
-        typedef std::pair<int, int> row_col;
-        DECL_LINK(OnTreeEntryChecked, const row_col&, void);
+        DECL_LINK(OnTreeEntryChecked, const weld::TreeView::iter_col&, void);
 
         /** check the tables in <member>m_aTablesList</member> according to <arg>_rTables</arg>
         */
diff --git a/dbaccess/source/ui/inc/tabletree.hxx b/dbaccess/source/ui/inc/tabletree.hxx
index 9be6310cd59f..58a6bba4322e 100644
--- a/dbaccess/source/ui/inc/tabletree.hxx
+++ b/dbaccess/source/ui/inc/tabletree.hxx
@@ -200,11 +200,11 @@ public:
 
     void            CheckButtons();     // make the button states consistent (bottom-up)
 
-    void            checkedButton_noBroadcast(weld::TreeIter& rEntry);
+    void            checkedButton_noBroadcast(const weld::TreeIter& rEntry);
 private:
     TriState implDetermineState(weld::TreeIter& rEntry);
 
-    void implEmphasize(weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
+    void implEmphasize(const weld::TreeIter& rEntry, bool _bChecked, bool _bUpdateDescendants = true, bool _bUpdateAncestors = true);
 
     /** adds the given entry to our list
         @precond
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 60a0337119d5..cb161d631809 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -487,14 +487,12 @@ short UpdateDialog::run() {
     return nRet;
 }
 
-IMPL_LINK(UpdateDialog, entryToggled, const row_col&, rRowCol, void)
+IMPL_LINK(UpdateDialog, entryToggled, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    int nRow = rRowCol.first;
-
     // error's can't be enabled
     const UpdateDialog::Index* p = reinterpret_cast<UpdateDialog::Index const *>(m_xUpdates->get_id(rRowCol.first).toInt64());
     if (p->m_eKind == SPECIFIC_ERROR)
-        m_xUpdates->set_toggle(nRow, TRISTATE_FALSE, 0);
+        m_xUpdates->set_toggle(rRowCol.first, TRISTATE_FALSE, 0);
 
     enableOk();
 }
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 291f028504c4..dd3ae621a5a5 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -127,8 +127,7 @@ private:
     DECL_LINK(allHandler, weld::ToggleButton&, void);
     DECL_LINK(okHandler, weld::Button&, void);
     DECL_LINK(closeHandler, weld::Button&, void);
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(entryToggled, const row_col&, void);
+    DECL_LINK(entryToggled, const weld::TreeView::iter_col&, void);
 
     css::uno::Reference< css::uno::XComponentContext >  m_context;
     OUString m_none;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index cad56785acb2..58309c9e49ef 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -618,9 +618,7 @@ protected:
     void signal_custom_render(vcl::RenderContext& rDevice, const tools::Rectangle& rRect,
                               bool bSelected, const OUString& rId)
     {
-        m_aRenderHdl.Call(
-            std::tuple<vcl::RenderContext&, const tools::Rectangle, bool, const OUString&>(
-                rDevice, rRect, bSelected, rId));
+        m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
     }
 
     Link<vcl::RenderContext&, Size> m_aGetSizeHdl;
@@ -761,6 +759,14 @@ public:
 
 class VCL_DLLPUBLIC TreeView : virtual public Container
 {
+public:
+    typedef std::pair<const TreeIter&, int> iter_col;
+    typedef std::pair<const TreeIter&, OUString> iter_string;
+    // OUString is the id of the row, it may be null to measure the height of a generic line
+    typedef std::pair<vcl::RenderContext&, const OUString&> get_size_args;
+    typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
+        render_args;
+
 private:
     OUString m_sSavedValue;
 
@@ -768,9 +774,9 @@ protected:
     Link<TreeView&, void> m_aChangeHdl;
     Link<TreeView&, bool> m_aRowActivatedHdl;
     Link<int, void> m_aColumnClickedHdl;
-    Link<const std::pair<int, int>&, void> m_aRadioToggleHdl;
+    Link<const iter_col&, void> m_aRadioToggleHdl;
     Link<const TreeIter&, bool> m_aEditingStartedHdl;
-    Link<const std::pair<const TreeIter&, OUString>&, bool> m_aEditingDoneHdl;
+    Link<const iter_string&, bool> m_aEditingDoneHdl;
     // if handler returns false, the expansion of the row is refused
     Link<const TreeIter&, bool> m_aExpandingHdl;
     // if handler returns false, the collapse of the row is refused
@@ -784,12 +790,6 @@ protected:
     Link<bool&, bool> m_aDragBeginHdl;
     std::function<int(const weld::TreeIter&, const weld::TreeIter&)> m_aCustomSort;
 
-public:
-    // OUString is the id of the row, it may be null to measure the height of a generic line
-    typedef std::pair<vcl::RenderContext&, const OUString&> get_size_args;
-    typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, bool, const OUString&>
-        render_args;
-
 protected:
     std::vector<int> m_aRadioIndexes;
 
@@ -807,12 +807,11 @@ protected:
     void signal_visible_range_changed() { m_aVisibleRangeChangedHdl.Call(*this); }
     void signal_model_changed() { m_aModelChangedHdl.Call(*this); }
 
-    // arg is pair<row,col>
-    void signal_toggled(const std::pair<int, int>& rRowCol) { m_aRadioToggleHdl.Call(rRowCol); }
+    void signal_toggled(const iter_col& rIterCol) { m_aRadioToggleHdl.Call(rIterCol); }
 
     bool signal_editing_started(const TreeIter& rIter) { return m_aEditingStartedHdl.Call(rIter); }
 
-    bool signal_editing_done(const std::pair<const TreeIter&, OUString>& rIterText)
+    bool signal_editing_done(const iter_string& rIterText)
     {
         return m_aEditingDoneHdl.Call(rIterText);
     }
@@ -824,15 +823,13 @@ protected:
     void signal_custom_render(vcl::RenderContext& rDevice, const tools::Rectangle& rRect,
                               bool bSelected, const OUString& rId)
     {
-        m_aRenderHdl.Call(
-            std::tuple<vcl::RenderContext&, const tools::Rectangle, bool, const OUString&>(
-                rDevice, rRect, bSelected, rId));
+        m_aRenderHdl.Call(render_args(rDevice, rRect, bSelected, rId));
     }
 
     Link<get_size_args, Size> m_aGetSizeHdl;
     Size signal_custom_get_size(vcl::RenderContext& rDevice, const OUString& rId)
     {
-        return m_aGetSizeHdl.Call(std::pair<vcl::RenderContext&, const OUString&>(rDevice, rId));
+        return m_aGetSizeHdl.Call(get_size_args(rDevice, rId));
     }
 
 public:
@@ -901,10 +898,7 @@ public:
 
     // Argument is a pair of row, col describing the node in non-tree mode.
     // If in tree mode, then retrieve the toggled node with get_cursor
-    void connect_toggled(const Link<const std::pair<int, int>&, void>& rLink)
-    {
-        m_aRadioToggleHdl = rLink;
-    }
+    void connect_toggled(const Link<const iter_col&, void>& rLink) { m_aRadioToggleHdl = rLink; }
 
     void connect_column_clicked(const Link<int, void>& rLink) { m_aColumnClickedHdl = rLink; }
     void connect_model_changed(const Link<TreeView&, void>& rLink) { m_aModelChangedHdl = rLink; }
@@ -1063,9 +1057,8 @@ public:
 
     // rStartLink returns true to allow editing, false to disallow
     // rEndLink returns true to accept the edit, false to reject
-    virtual void
-    connect_editing(const Link<const TreeIter&, bool>& rStartLink,
-                    const Link<const std::pair<const TreeIter&, OUString>&, bool>& rEndLink)
+    virtual void connect_editing(const Link<const TreeIter&, bool>& rStartLink,
+                                 const Link<const iter_string&, bool>& rEndLink)
     {
         assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off");
         m_aEditingStartedHdl = rStartLink;
diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx
index adbcee0f1874..5e92b4228dea 100644
--- a/sc/source/ui/dbgui/dpgroupdlg.cxx
+++ b/sc/source/ui/dbgui/dpgroupdlg.cxx
@@ -318,7 +318,7 @@ IMPL_LINK(ScDPDateGroupDlg, ClickHdl, weld::Button&, rButton, void)
         mxLbUnits->set_sensitive(true);
         mxLbUnits->grab_focus();
         // disable OK button if no date part selected
-        CheckHdl(row_col(0, 0));
+        Check();
     }
 }
 
@@ -335,10 +335,16 @@ namespace
     }
 }
 
-IMPL_LINK_NOARG(ScDPDateGroupDlg, CheckHdl, const row_col&, void)
+IMPL_LINK_NOARG(ScDPDateGroupDlg, CheckHdl, const weld::TreeView::iter_col&, void)
+{
+    Check();
+}
+
+void ScDPDateGroupDlg::Check()
 {
     // enable/disable OK button on modifying check list box
     mxBtnOk->set_sensitive(HasCheckedEntryCount(*mxLbUnits));
 }
 
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 684095e04163..78fb46dd75e6 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -364,7 +364,7 @@ void ScTpSubTotalGroup::SelectHdl(const weld::Widget *pLb)
     }
 }
 
-IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const row_col&, rRowCol, void )
+IMPL_LINK( ScTpSubTotalGroup, CheckHdl, const weld::TreeView::iter_col&, rRowCol, void )
 {
     mxLbColumns->select(rRowCol.first);
     SelectHdl(mxLbColumns.get());
diff --git a/sc/source/ui/inc/dpgroupdlg.hxx b/sc/source/ui/inc/dpgroupdlg.hxx
index d1b36587732f..7c7ca994f2cd 100644
--- a/sc/source/ui/inc/dpgroupdlg.hxx
+++ b/sc/source/ui/inc/dpgroupdlg.hxx
@@ -117,10 +117,9 @@ public:
 
 private:
     DECL_LINK(ClickHdl, weld::Button&, void);
+    DECL_LINK(CheckHdl, const weld::TreeView::iter_col&, void);
 
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckHdl, const row_col&, void);
-
+    void Check();
 private:
     std::unique_ptr<weld::RadioButton> mxRbAutoStart;
     std::unique_ptr<weld::RadioButton> mxRbManStart;
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index f4e52a5a6517..d5a2ca023eed 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -68,8 +68,7 @@ private:
     // Handler ------------------------
     DECL_LINK( SelectListBoxHdl, weld::ComboBox&, void );
     DECL_LINK( SelectTreeListBoxHdl, weld::TreeView&, void );
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(CheckHdl, const row_col&, void);
+    DECL_LINK(CheckHdl, const weld::TreeView::iter_col&, void);
     void SelectHdl(const weld::Widget*);
 };
 
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 97f24f093336..b5e1a1aa0bc3 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -768,9 +768,9 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, weld::TreeView&, void)
     m_nPrevSelectedEntry = m_xCheckLB->get_selected_index();
 }
 
-IMPL_LINK(SwCaptionOptPage, ToggleEntryHdl, const row_col&, rRowCol, void)
+IMPL_LINK(SwCaptionOptPage, ToggleEntryHdl, const weld::TreeView::iter_col&, rRowCol, void)
 {
-    UpdateEntry(rRowCol.first);
+    UpdateEntry(m_xCheckLB->get_iter_index_in_parent(rRowCol.first));
 }
 
 void SwCaptionOptPage::SaveEntry(int nEntry)
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index f428406b27b4..91e41c7a8b2e 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -478,8 +478,7 @@ class SwAddStylesDlg_Impl : public SfxDialogController
     DECL_LINK(LeftRightHdl, weld::Button&, void);
     DECL_LINK(KeyInput, const KeyEvent&, bool);
     DECL_LINK(TreeSizeAllocHdl, const Size&, void);
-    typedef std::pair<int, int> row_col;
-    DECL_LINK(RadioToggleOnHdl, const row_col&, void);
+    DECL_LINK(RadioToggleOnHdl, const weld::TreeView::iter_col&, void);
 
 public:
     SwAddStylesDlg_Impl(weld::Window* pParent, SwWrtShell const & rWrtSh, OUString rStringArr[]);
@@ -596,7 +595,7 @@ IMPL_LINK(SwAddStylesDlg_Impl, TreeSizeAllocHdl, const Size&, rSize, void)
     m_xHeaderTree->set_column_fixed_widths(aWidths);
 }
 
-IMPL_LINK(SwAddStylesDlg_Impl, RadioToggleOnHdl, const row_col&, rRowCol, void)
+IMPL_LINK(SwAddStylesDlg_Impl, RadioToggleOnHdl, const weld::TreeView::iter_col&, rRowCol, void)
 {
     for (sal_uInt16 i = 0; i <= MAXLEVEL; ++i)
     {
diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx
index 1db4fcbf59e5..22fef4bcd5ea 100644
--- a/sw/source/uibase/inc/optload.hxx
+++ b/sw/source/uibase/inc/optload.hxx
@@ -164,15 +164,13 @@ private:
     std::unique_ptr<weld::CheckButton> m_xApplyBorderCB;
     std::unique_ptr<weld::CustomWeld> m_xPreview;
 
-    typedef std::pair<int, int> row_col;
-
     DECL_LINK(SelectHdl, weld::ComboBox&, void);
     DECL_LINK(SelectListBoxHdl, weld::ComboBox&, void);
     DECL_LINK(ModifyEntryHdl, weld::Entry&, void);
     DECL_LINK(ModifyComboHdl, weld::ComboBox&, void);
     DECL_LINK(OrderHdl, weld::ComboBox&, void );
     DECL_LINK(ShowEntryHdl, weld::TreeView&, void);
-    DECL_LINK(ToggleEntryHdl, const row_col&, void);
+    DECL_LINK(ToggleEntryHdl, const weld::TreeView::iter_col&, void);
     DECL_LINK(TextFilterHdl, OUString&, bool);
 
     void ModifyHdl();
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6a8042ba2b1c..6057ffbe6dd6 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3917,7 +3917,7 @@ public:
 
     virtual void connect_editing(
         const Link<const weld::TreeIter&, bool>& rStartLink,
-        const Link<const std::pair<const weld::TreeIter&, OUString>&, bool>& rEndLink) override
+        const Link<const iter_string&, bool>& rEndLink) override
     {
         m_xTreeView->EnableInplaceEditing(rStartLink.IsSet() || rEndLink.IsSet());
         weld::TreeView::connect_editing(rStartLink, rEndLink);
@@ -4697,8 +4697,7 @@ IMPL_LINK(SalInstanceTreeView, ToggleHdl, SvLBoxButtonData*, pData, void)
         m_xTreeView->Select(pEntry, true);
     }
 
-    // toggled signal handlers can query get_cursor to get which
-    // node was clicked
+    // additionally set the cursor into the row the toggled element is in
     m_xTreeView->pImpl->m_pCursor = pEntry;
 
     for (int i = 1, nCount = pEntry->ItemCount(); i < nCount; ++i)
@@ -4706,9 +4705,8 @@ IMPL_LINK(SalInstanceTreeView, ToggleHdl, SvLBoxButtonData*, pData, void)
         SvLBoxItem& rItem = pEntry->GetItem(i);
         if (&rItem == pBox)
         {
-            int nRow = SvTreeList::GetRelPos(pEntry);
             int nCol = i - 1; // less dummy/expander column
-            signal_toggled(std::make_pair(nRow, nCol));
+            signal_toggled(iter_col(SalInstanceTreeIter(pEntry), nCol));
             break;
         }
     }
@@ -4806,7 +4804,7 @@ IMPL_LINK(SalInstanceTreeView, EditingEntryHdl, SvTreeListEntry*, pEntry, bool)
 
 IMPL_LINK(SalInstanceTreeView, EditedEntryHdl, IterString, rIterString, bool)
 {
-    return signal_editing_done(std::pair<const weld::TreeIter&, OUString>(
+    return signal_editing_done(iter_string(
         SalInstanceTreeIter(rIterString.first), rIterString.second));
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 3b25934e4002..57a2973743a3 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -9383,8 +9383,7 @@ private:
     {
         GtkTreePath *tree_path = gtk_tree_path_new_from_string(path);
 
-        // toggled signal handlers can query get_cursor to get which
-        // node was clicked
+        // additionally set the cursor into the row the toggled element is in
         gtk_tree_view_set_cursor(m_pTreeView, tree_path, nullptr, false);
 
         GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
@@ -9396,13 +9395,9 @@ private:
         bRet = !bRet;
         gtk_tree_store_set(m_pTreeStore, &iter, nCol, bRet, -1);
 
-        gint depth;
-        gint* indices = gtk_tree_path_get_indices_with_depth(tree_path, &depth);
-        int nRow = indices[depth-1];
-
         set(iter, m_aToggleTriStateMap[nCol], false);
 
-        signal_toggled(std::make_pair(nRow, nCol));
+        signal_toggled(iter_col(GtkInstanceTreeIter(iter), nCol));
 
         gtk_tree_path_free(tree_path);
     }
@@ -9453,7 +9448,7 @@ private:
         gtk_tree_path_free(tree_path);
 
         OUString sText(pNewText, pNewText ? strlen(pNewText) : 0, RTL_TEXTENCODING_UTF8);
-        if (signal_editing_done(std::pair<const weld::TreeIter&, OUString>(aGtkIter, sText)))
+        if (signal_editing_done(iter_string(aGtkIter, sText)))
         {
             void* pData = g_object_get_data(G_OBJECT(pCell), "g-lo-CellIndex");
             set(aGtkIter.iter, reinterpret_cast<sal_IntPtr>(pData), sText);


More information about the Libreoffice-commits mailing list