[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - basctl/source cui/source include/vcl vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Nov 25 14:36:11 UTC 2018


 basctl/source/basicide/bastype2.cxx |    5 ++++-
 cui/source/customize/cfgutil.cxx    |    5 ++++-
 include/vcl/weld.hxx                |    1 +
 vcl/source/app/salvtables.cxx       |    7 +++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx        |   10 ++++++++++
 5 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 8634bafd369a18868eebd71083e09b5c8fba6292
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Nov 23 17:14:25 2018 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Nov 25 15:35:47 2018 +0100

    allow collapsing rows
    
    Change-Id: I6b137e4fbb860a1d40acc961dae413bcdb27575a
    Reviewed-on: https://gerrit.libreoffice.org/63941
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
index b143924fe149..ee2caf7ad48a 100644
--- a/basctl/source/basicide/bastype2.cxx
+++ b/basctl/source/basicide/bastype2.cxx
@@ -1574,7 +1574,10 @@ IMPL_LINK_NOARG(SbTreeListBox, OpenCurrentHdl, weld::TreeView&, void)
             break;
 
         default:
-            m_xControl->expand_row(*m_xIter);
+            if (!m_xControl->get_row_expanded(*m_xIter))
+                m_xControl->expand_row(*m_xIter);
+            else
+                m_xControl->collapse_row(*m_xIter);
             break;
     }
 }
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index d0900c2ccbab..4204d2c0a0d6 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -1279,7 +1279,10 @@ IMPL_LINK_NOARG(CuiConfigGroupListBox, OpenCurrentHdl, weld::TreeView&, void)
     bool bValidIter = m_xTreeView->get_cursor(xIter.get());
     if (!bValidIter)
         return;
-    m_xTreeView->expand_row(*xIter);
+    if (!m_xTreeView->get_row_expanded(*xIter))
+        m_xTreeView->expand_row(*xIter);
+    else
+        m_xTreeView->collapse_row(*xIter);
 }
 
 CuiConfigGroupListBox::~CuiConfigGroupListBox()
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 1b9726ac556e..ae7ed7505b1c 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -488,6 +488,7 @@ public:
     virtual void unselect(const TreeIter& rIter) = 0;
     virtual bool get_row_expanded(const TreeIter& rIter) const = 0;
     virtual void expand_row(TreeIter& rIter) = 0;
+    virtual void collapse_row(TreeIter& rIter) = 0;
     virtual OUString get_text(const TreeIter& rIter) const = 0;
     virtual OUString get_id(const TreeIter& rIter) const = 0;
     virtual void scroll_to_row(const TreeIter& rIter) = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 5fa6327688f1..0904442b79ba 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2153,6 +2153,13 @@ public:
             m_xTreeView->Expand(rVclIter.iter);
     }
 
+    virtual void collapse_row(weld::TreeIter& rIter) override
+    {
+        SalInstanceTreeIter& rVclIter = static_cast<SalInstanceTreeIter&>(rIter);
+        if (m_xTreeView->IsExpanded(rVclIter.iter))
+            m_xTreeView->Collapse(rVclIter.iter);
+    }
+
     virtual OUString get_text(const weld::TreeIter& rIter) const override
     {
         const SalInstanceTreeIter& rVclIter = static_cast<const SalInstanceTreeIter&>(rIter);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1fefb9db0169..b2800cf970ee 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -4641,6 +4641,16 @@ public:
         gtk_tree_path_free(path);
     }
 
+    virtual void collapse_row(weld::TreeIter& rIter) override
+    {
+        GtkInstanceTreeIter& rGtkIter = static_cast<GtkInstanceTreeIter&>(rIter);
+        GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+        GtkTreePath* path = gtk_tree_model_get_path(pModel, &rGtkIter.iter);
+        if (gtk_tree_view_row_expanded(m_pTreeView, path))
+            gtk_tree_view_collapse_row(m_pTreeView, path);
+        gtk_tree_path_free(path);
+    }
+
     virtual OUString get_text(const weld::TreeIter& rIter) const override
     {
         const GtkInstanceTreeIter& rGtkIter = static_cast<const GtkInstanceTreeIter&>(rIter);


More information about the Libreoffice-commits mailing list