diff options
author | Jim Raykowski <raykowj@gmail..com> | 2019-10-17 19:09:18 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2019-10-23 04:38:36 +0200 |
commit | 3ed56f407235feb97ee2565a613e5f1d2bb2d925 (patch) | |
tree | 8664a6dcd52bad58efbd7e8289cca550af5cbc89 /sw | |
parent | 7fe58f64cd8b58918cae92aed536d266f63b4c71 (diff) |
tdf#128058 Add Expand Collapse All to Navigator context menu
Change-Id: I8c68865c8bc95a9ef6d1bea565e635e288f728e6
Reviewed-on: https://gerrit.libreoffice.org/81003
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/strings.hrc | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index e6355c4cbb3d..b77225641089 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -631,6 +631,8 @@ #define STR_OUTLINE_LEVEL NC_("STR_OUTLINE_LEVEL", "Outline Level") #define STR_DRAGMODE NC_("STR_DRAGMODE", "Drag Mode") #define STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY NC_("STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY", "Send Outline to Clipboard") +#define STR_EXPANDALL NC_("STR_EXPANDALL", "Expand All") +#define STR_COLLAPSEALL NC_("STR_COLLAPSEALL", "Collapse All") #define STR_HYPERLINK NC_("STR_HYPERLINK", "Insert as Hyperlink") #define STR_LINK_REGION NC_("STR_LINK_REGION", "Insert as Link") #define STR_COPY_REGION NC_("STR_COPY_REGION", "Insert as Copy") diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 7ee2789a4f9f..0381b2101281 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -1207,6 +1207,16 @@ sal_Int8 SwContentTree::ExecuteDrop( const ExecuteDropEvent& rEvt ) // Handler for Dragging and ContextMenu +static void lcl_InsertExpandCollapseAllItem(SwContentTree* pContentTree, SvTreeListEntry* pEntry, PopupMenu* pPop) +{ + if(pEntry->HasChildren() || pEntry->HasChildrenOnDemand()) + { + pPop->InsertSeparator(); + pPop->InsertItem(800, pContentTree->IsAllExpanded(pEntry) ? SwResId(STR_COLLAPSEALL) : SwResId(STR_EXPANDALL)); + pPop->SetAccelKey(800, vcl::KeyCode(KEY_MULTIPLY, false, true, false, false)); + } +} + VclPtr<PopupMenu> SwContentTree::CreateContextMenu() { auto pPop = VclPtr<PopupMenu>::Create(); @@ -1348,6 +1358,8 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu() pPop->SetPopupMenu(4, pSubPop4); } } + else if(ContentTypeId::OUTLINE == nContentType) + lcl_InsertExpandCollapseAllItem(this, pEntry, pPop); } else if( pEntry ) { @@ -1355,6 +1367,7 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu() SwContentType* pType = static_cast<SwContentType*>(pEntry->GetUserData()); if(ContentTypeId::OUTLINE == pType->GetType()) { + lcl_InsertExpandCollapseAllItem(this, pEntry, pPop); pPop->InsertSeparator(); pPop->InsertItem(700, m_aContextStrings[IDX_STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY]); } @@ -3291,6 +3304,9 @@ void SwContentTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry ) m_pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_OUTLINE_TO_CLIPBOARD); break; } + case 800: + KeyInput(KeyEvent(0, KEY_MOD1|KEY_MULTIPLY)); + break; //Display default: if(nSelectedPopupEntry > 300 && nSelectedPopupEntry < 400) |