sw/source/uibase/utlui/content.cxx | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
New commits: commit 479fa3a53bf21302e414e892574ea129f8f2373d Author: Jim Raykowski <rayk...@gmail..com> AuthorDate: Tue Feb 25 16:32:21 2020 -0900 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Mar 2 07:56:52 2020 +0100 Add functionality for promote/demote chapter/level shortcut keys The following arrow key shortcuts for these actions can be used when focus is on outline content in Writer Navigator: Ctrl+Up promote chapter Ctrl+Down demote chapter Ctrl+Left promote level Ctrl+Right demote level Holding the Shift key, in combination with the above, will exclude children from the action. Change-Id: I73a320d571791e2e9e1c0e4efb579c9977220494 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89491 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index f8b8fb7bf425..47bb9e560a7a 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3185,14 +3185,39 @@ void SwContentTree::KeyInput(const KeyEvent& rEvent) } } - else if (m_bIsRoot && m_nRootType == ContentTypeId::OUTLINE && aCode.GetCode() == KEY_LEFT) + else { - SelectAll(false); - SvTreeListBox::KeyInput(rEvent); + SvTreeListEntry* pEntry = GetCurEntry(); + if (pEntry) + { + SwContent* pCnt = dynamic_cast<SwContent*>(static_cast<SwTypeNumber*>(pEntry->GetUserData())); + if (pCnt && pCnt->GetParent()->GetType() == ContentTypeId::OUTLINE) + { + if (m_bIsRoot && aCode.GetCode() == KEY_LEFT && aCode.GetModifier() == 0) + { + SelectAll(false); + SvTreeListBox::KeyInput(rEvent); + } + else if (aCode.IsMod1()) + { + if (aCode.GetCode() == KEY_LEFT) + ExecCommand("promote", !aCode.IsShift()); + else if (aCode.GetCode() == KEY_RIGHT) + ExecCommand("demote", !aCode.IsShift()); + else if (aCode.GetCode() == KEY_UP) + ExecCommand("up", !aCode.IsShift()); + else if (aCode.GetCode() == KEY_DOWN) + ExecCommand("down", !aCode.IsShift()); + else + SvTreeListBox::KeyInput(rEvent); + } + else + SvTreeListBox::KeyInput(rEvent); + } + else + SvTreeListBox::KeyInput(rEvent); + } } - else - SvTreeListBox::KeyInput(rEvent); - } void SwContentTree::RequestHelp( const HelpEvent& rHEvt ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits