diff options
author | Jim Raykowski <raykowj@gmail..com> | 2020-02-25 16:32:21 -0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-03-02 07:56:52 +0100 |
commit | 479fa3a53bf21302e414e892574ea129f8f2373d (patch) | |
tree | f5df2b2b04c8f784f081845cd5c9589bb837493a /sw/source/uibase | |
parent | 4ba1088d68fc7c0c76e13f29faff5a3f54342534 (diff) |
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.tietze@documentfoundation.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
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 ) |