diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2021-05-17 00:08:12 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2021-05-17 23:57:17 +0200 |
commit | b1c0734ffe0f395757b6e0cea7830d820231afeb (patch) | |
tree | 16dd46434ffb6bb0f6e09228cf602e65c9dec10a /sfx2/source/devtools | |
parent | 50d8a8c321b17cf5311029467a37e5e163f2bf9c (diff) |
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@collabora.com>
Diffstat (limited to 'sfx2/source/devtools')
-rw-r--r-- | sfx2/source/devtools/ObjectInspectorTreeHandler.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
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) |