[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 24 11:31:02 UTC 2020
sw/source/uibase/utlui/content.cxx | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
New commits:
commit 4f70e274ee6d35cf1887a255757fe58334159306
Author: Jim Raykowski <raykowj at gmail..com>
AuthorDate: Tue Mar 24 02:03:31 2020 -0800
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Mar 24 12:30:29 2020 +0100
weld writer navigator expand and collapse all support
Makes expand and collapse all work from the outline context menu and
ctrl+* short cut for all vcl plugins
Change-Id: I6cec6f1b4dedfc62216028b24d09d7f402a387cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90973
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 51aeea0d77a5..cfa216925470 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1115,6 +1115,18 @@ namespace
while (rContentTree.iter_next_sibling(*xChild));
return true;
}
+
+ void ExpandOrCollapseAll(weld::TreeView& rContentTree, weld::TreeIter& rEntry)
+ {
+ bool bExpand = !IsAllExpanded(rContentTree, rEntry);
+ bExpand ? rContentTree.expand_row(rEntry) : rContentTree.collapse_row(rEntry);
+ int nRefDepth = rContentTree.get_iter_depth(rEntry);
+ while (rContentTree.iter_next(rEntry) && rContentTree.get_iter_depth(rEntry) > nRefDepth)
+ {
+ if (rContentTree.iter_has_child(rEntry))
+ bExpand ? rContentTree.expand_row(rEntry) : rContentTree.collapse_row(rEntry);
+ }
+ }
}
// Handler for Dragging and ContextMenu
@@ -3072,7 +3084,13 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
bool bConsumed = true;
const vcl::KeyCode aCode = rEvent.GetKeyCode();
- if (aCode.GetCode() == KEY_RETURN)
+ if (aCode.GetCode() == KEY_MULTIPLY && aCode.IsMod1())
+ {
+ std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
+ if (m_xTreeView->get_selected(xEntry.get()))
+ ExpandOrCollapseAll(*m_xTreeView, *xEntry);
+ }
+ else if (aCode.GetCode() == KEY_RETURN)
{
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
if (m_xTreeView->get_selected(xEntry.get()))
@@ -3380,7 +3398,7 @@ void SwContentTree::ExecuteContextMenuAction(const OString& rSelectedPopupEntry)
break;
}
case 800:
- KeyInputHdl(KeyEvent(0, KEY_MOD1|KEY_MULTIPLY));
+ ExpandOrCollapseAll(*m_xTreeView, *xFirst);
break;
case 801:
ExecCommand("chapterup", true);
More information about the Libreoffice-commits
mailing list