[Libreoffice-commits] core.git: include/sfx2 sfx2/source sfx2/uiconfig
GülÅah Köse (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 17 21:57:57 UTC 2021
include/sfx2/devtools/ObjectInspectorTreeHandler.hxx | 2 +
sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 32 +++++++++++++++++++
sfx2/uiconfig/ui/developmenttool.ui | 10 -----
3 files changed, 34 insertions(+), 10 deletions(-)
New commits:
commit b1c0734ffe0f395757b6e0cea7830d820231afeb
Author: Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Mon May 17 00:08:12 2021 +0300
Commit: Gülşah Köse <gulsah.kose at collabora.com>
CommitDate: Mon May 17 23:57:17 2021 +0200
tdf#141677 Make columns sortable
Change-Id: Ib4cb8aaba4c59a7afa347f8010deef41477b77f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115688
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose at collabora.com>
diff --git a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
index a9cf5be3dae6..03188276a4b4 100644
--- a/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
+++ b/include/sfx2/devtools/ObjectInspectorTreeHandler.hxx
@@ -83,6 +83,8 @@ public:
DECL_LINK(NotebookEnterPage, const OString&, void);
DECL_LINK(NotebookLeavePage, const OString&, bool);
+ DECL_LINK(HeaderBarClick, int, void);
+
void introspect(css::uno::Reference<css::uno::XInterface> const& xInterface);
void dispose();
diff --git a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
index 60a81be9ab60..d7d4895e5d6b 100644
--- a/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
+++ b/sfx2/source/devtools/ObjectInspectorTreeHandler.cxx
@@ -956,6 +956,15 @@ ObjectInspectorTreeHandler::ObjectInspectorTreeHandler(
mpObjectInspectorWidgets->mpPropertiesTreeView->make_sorted();
mpObjectInspectorWidgets->mpMethodsTreeView->make_sorted();
+ mpObjectInspectorWidgets->mpInterfacesTreeView->connect_column_clicked(
+ LINK(this, ObjectInspectorTreeHandler, HeaderBarClick));
+ mpObjectInspectorWidgets->mpServicesTreeView->connect_column_clicked(
+ LINK(this, ObjectInspectorTreeHandler, HeaderBarClick));
+ mpObjectInspectorWidgets->mpPropertiesTreeView->connect_column_clicked(
+ LINK(this, ObjectInspectorTreeHandler, HeaderBarClick));
+ mpObjectInspectorWidgets->mpMethodsTreeView->connect_column_clicked(
+ LINK(this, ObjectInspectorTreeHandler, HeaderBarClick));
+
mpObjectInspectorWidgets->mpToolbar->connect_clicked(
LINK(this, ObjectInspectorTreeHandler, ToolbarButtonClicked));
mpObjectInspectorWidgets->mpToolbar->set_item_sensitive("inspect", false);
@@ -1040,6 +1049,29 @@ IMPL_LINK(ObjectInspectorTreeHandler, SelectionChanged, weld::TreeView&, rTreeVi
mpObjectInspectorWidgets->mpToolbar->set_item_sensitive("inspect", bHaveNodeWithObject);
}
+static void updateOrder(std::unique_ptr<weld::TreeView>& pTreeView, sal_Int32 nColumn)
+{
+ pTreeView->set_sort_column(nColumn);
+
+ bool bSortAtoZ = pTreeView->get_sort_order();
+ pTreeView->set_sort_order(!bSortAtoZ);
+ pTreeView->set_sort_indicator(!bSortAtoZ ? TRISTATE_TRUE : TRISTATE_FALSE, nColumn);
+}
+
+IMPL_LINK(ObjectInspectorTreeHandler, HeaderBarClick, int, nColumn, void)
+{
+ auto rPageId = mpObjectInspectorWidgets->mpNotebook->get_current_page_ident();
+
+ if (rPageId == "object_inspector_interfaces_tab")
+ updateOrder(mpObjectInspectorWidgets->mpInterfacesTreeView, nColumn);
+ else if (rPageId == "object_inspector_services_tab")
+ updateOrder(mpObjectInspectorWidgets->mpServicesTreeView, nColumn);
+ else if (rPageId == "object_inspector_properties_tab")
+ updateOrder(mpObjectInspectorWidgets->mpPropertiesTreeView, nColumn);
+ else if (rPageId == "object_inspector_methods_tab")
+ updateOrder(mpObjectInspectorWidgets->mpMethodsTreeView, nColumn);
+}
+
IMPL_LINK(ObjectInspectorTreeHandler, PopupMenuHandler, const CommandEvent&, rCommandEvent, bool)
{
if (rCommandEvent.GetCommand() != CommandEventId::ContextMenu)
diff --git a/sfx2/uiconfig/ui/developmenttool.ui b/sfx2/uiconfig/ui/developmenttool.ui
index 58e03b3cf21a..27962e5863e7 100644
--- a/sfx2/uiconfig/ui/developmenttool.ui
+++ b/sfx2/uiconfig/ui/developmenttool.ui
@@ -320,7 +320,6 @@
<property name="title" translatable="yes" context="developmenttool|name">Name</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext4"/>
<attributes>
@@ -366,7 +365,6 @@
<property name="title" translatable="yes" context="developmenttool|name">Name</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext7"/>
<attributes>
@@ -421,7 +419,6 @@
<property name="title" translatable="yes" context="developmenttool|object">Object</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext1"/>
<attributes>
@@ -436,7 +433,6 @@
<property name="title" translatable="yes" context="developmenttool|value">Value</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">1</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext2"/>
<attributes>
@@ -451,7 +447,6 @@
<property name="title" translatable="yes" context="developmenttool|type">Type</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">2</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext3"/>
<attributes>
@@ -466,7 +461,6 @@
<property name="title" translatable="yes" context="developmenttool|info">Info</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">3</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext5"/>
<attributes>
@@ -545,7 +539,6 @@
<property name="title" translatable="yes" context="developmenttool|method">Method</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">0</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext10"/>
<attributes>
@@ -560,7 +553,6 @@
<property name="title" translatable="yes" context="developmenttool|returntype">Return Type</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">1</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext11"/>
<attributes>
@@ -575,7 +567,6 @@
<property name="title" translatable="yes" context="developmenttool|parameters">Parameters</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">2</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext12"/>
<attributes>
@@ -590,7 +581,6 @@
<property name="title" translatable="yes" context="developmenttool|implementation_class">Implementation Class</property>
<property name="clickable">True</property>
<property name="sort-indicator">True</property>
- <property name="sort-column-id">3</property>
<child>
<object class="GtkCellRendererText" id="obj_insp_cellrenderertext13"/>
<attributes>
More information about the Libreoffice-commits
mailing list