diff options
author | Jim Raykowski <raykowj@gmail.com> | 2021-10-19 02:10:41 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2021-10-22 04:19:10 +0200 |
commit | 58a3e2a6fad68d8d5e6091e063c0b26e3608f998 (patch) | |
tree | 4a911eaea8dea82b947da8143f4a7bab6d70de3c /sw | |
parent | cb56ec6aa8f03fbc70c808bd4f519ce9d3c21f7d (diff) |
tdf#144999 SwNavigator: Add way to collapse all categories
This patch adds a context menu item that can be used to collapse the
content tree to the root categories all at once.
Change-Id: I15274e6db838e9e8503a79384bed4ffcf983041c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123811
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 29 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/navigatorcontextmenu.ui | 168 |
2 files changed, 123 insertions, 74 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index a7aea176df5d..56ce7d9b5e87 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1529,6 +1529,8 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) if (rCEvt.GetCommand() != CommandEventId::ContextMenu) return false; + grab_focus(); + if (std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator()); rCEvt.IsMouseEvent() && m_xTreeView->get_dest_row_at_pos( rCEvt.GetMousePosPixel(), xEntry.get(), false)) @@ -1849,6 +1851,22 @@ IMPL_LINK(SwContentTree, CommandHdl, const CommandEvent&, rCEvt, bool) if (bRemoveSectionTracking) xPop->remove("sectiontracking"); + bool bSetSensitiveCollapseAllCategories = false; + if (!m_bIsRoot) + { + bool bEntry = m_xTreeView->get_iter_first(*xEntry); + while (bEntry) + { + if (m_xTreeView->get_row_expanded(*xEntry)) + { + bSetSensitiveCollapseAllCategories = true; + break; + } + bEntry = m_xTreeView->iter_next_sibling(*xEntry); + } + } + xPop->set_sensitive("collapseallcategories", bSetSensitiveCollapseAllCategories); + OString sCommand = xPop->popup_at_rect(m_xTreeView.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))); if (!sCommand.isEmpty()) ExecuteContextMenuAction(sCommand); @@ -4216,6 +4234,17 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const weld::TreeIter&, rEntry, OUStrin void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry) { + if (rSelectedPopupEntry == "collapseallcategories") + { + std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator(); + bool bEntry = m_xTreeView->get_iter_first(*xEntry); + while (bEntry) + { + m_xTreeView->collapse_row(*xEntry); + bEntry = m_xTreeView->iter_next_sibling(*xEntry); + } + return; + } if (rSelectedPopupEntry == "tabletracking") { m_bTableTracking = !m_bTableTracking; diff --git a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui index db918b084bb0..49b6b03d3c48 100644 --- a/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui +++ b/sw/uiconfig/swriter/ui/navigatorcontextmenu.ui @@ -1,197 +1,197 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.2 --> +<!-- Generated with glade 3.38.2 --> <interface domain="sw"> <requires lib="gtk+" version="3.20"/> <object class="GtkMenu" id="navmenu"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <child> <object class="GtkMenuItem" id="800"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="use_underline">True</property> + <property name="can-focus">False</property> + <property name="use-underline">True</property> <accelerator key="asterisk" signal="activate" modifiers="GDK_CONTROL_MASK"/> </object> </child> <child> <object class="GtkSeparatorMenuItem" id="separator3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> <child> <object class="GtkMenuItem" id="700"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY">Send Outline to Clipboard</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="900"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_GOTO">Go to</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Return" signal="activate"/> </object> </child> <child> <object class="GtkSeparatorMenuItem" id="separator2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> <child> <object class="GtkMenuItem" id="805"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_SELECT">Select</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="806"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DELETE">Delete</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Delete" signal="activate"/> </object> </child> <child> <object class="GtkMenuItem" id="801"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_PROMOTE_CHAPTER">Promote Chapter</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Up" signal="activate" modifiers="GDK_CONTROL_MASK"/> </object> </child> <child> <object class="GtkMenuItem" id="802"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DEMOTE_CHAPTER">Demote Chapter</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Down" signal="activate" modifiers="GDK_CONTROL_MASK"/> </object> </child> <child> <object class="GtkMenuItem" id="803"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_PROMOTE_LEVEL">Promote Level</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Left" signal="activate" modifiers="GDK_CONTROL_MASK"/> </object> </child> <child> <object class="GtkMenuItem" id="804"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DEMOTE_LEVEL">Demote Level</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Right" signal="activate" modifiers="GDK_CONTROL_MASK"/> </object> </child> <child> <object class="GtkMenuItem" id="401"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_REMOVE_INDEX">_Remove Index</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="402"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_UPDATE">_Update</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="403"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_EDIT_ENTRY">Edit...</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="404"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_REMOVE_TBL_PROTECTION">_Unprotect</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkCheckMenuItem" id="405"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_READONLY_IDX">Read-_only</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="501"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DELETE_ENTRY">_Delete</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <accelerator key="Delete" signal="activate"/> </object> </child> <child> <object class="GtkMenuItem" id="502"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_RENAME">_Rename...</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="600"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_SHOW">Show All</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="601"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_HIDE">Hide All</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkMenuItem" id="602"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_POSTIT_DELETE">Delete All</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkSeparatorMenuItem" id="separator1"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> <child> <object class="GtkMenuItem" id="5"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_OUTLINE_CONTENT">Outline Folding</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <child type="submenu"> <object class="GtkMenu" id="outlinecontent"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> </object> @@ -199,33 +199,19 @@ <child> <object class="GtkSeparatorMenuItem" id="separator1511"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> <child> <object class="GtkMenuItem" id="4"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_OUTLINE_TRACKING">Outline Tracking</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <child type="submenu"> <object class="GtkMenu" id="outlinetracking"> <property name="visible">True</property> - <property name="can_focus">False</property> - </object> - </child> - </object> - </child> - <child> - <object class="GtkMenuItem" id="1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes" context="navigatorcontextmenu|STR_OUTLINE_LEVEL">Outline Level</property> - <property name="use_underline">True</property> - <child type="submenu"> - <object class="GtkMenu" id="outlinelevel"> - <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> </object> @@ -233,29 +219,49 @@ <child> <object class="GtkCheckMenuItem" id="tabletracking"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_TABLE_TRACKING">Table Tracking</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> </object> </child> <child> <object class="GtkCheckMenuItem" id="sectiontracking"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_SECTION_TRACKING">Section Tracking</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> + </object> + </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="1"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="navigatorcontextmenu|STR_OUTLINE_LEVEL">Outline Level</property> + <property name="use-underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="outlinelevel"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + </child> </object> </child> <child> <object class="GtkMenuItem" id="2"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DRAGMODE">Drag Mode</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <child type="submenu"> <object class="GtkMenu" id="dragmodemenu"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> </object> @@ -263,16 +269,30 @@ <child> <object class="GtkMenuItem" id="3"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> <property name="label" translatable="yes" context="navigatorcontextmenu|STR_DISPLAY">Display</property> - <property name="use_underline">True</property> + <property name="use-underline">True</property> <child type="submenu"> <object class="GtkMenu" id="displaymenu"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can-focus">False</property> </object> </child> </object> </child> + <child> + <object class="GtkSeparatorMenuItem"> + <property name="visible">True</property> + <property name="can-focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="collapseallcategories"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="label" translatable="yes" context="navigatorcontextmenu|STR_COLLAPSE_ALL_CATEGORIES">Collapse All Categories</property> + <property name="use-underline">True</property> + </object> + </child> </object> </interface> |