related tdf#128814: Add 'Go to' to Navigator popup menu
Change-Id: I63b656bd93c5e584a9d6236c6345cbd3ee939c13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89293
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc
index f1f16d7..c2bb4ef 100644
--- a/sw/inc/strings.hrc
+++ b/sw/inc/strings.hrc
@@ -643,6 +643,7 @@
#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_GOTO NC_("STR_GOTO", "Go to")
#define STR_SELECT NC_("STR_SELECT", "Select")
#define STR_DEMOTE_CHAPTER NC_("STR_DEMOTE_CHAPTER", "Demote Chapter")
#define STR_PROMOTE_CHAPTER NC_("STR_PROMOTE_CHAPTER", "Promote Chapter")
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index a41c3f9..19a7b81 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1274,6 +1274,11 @@ VclPtr<PopupMenu> SwContentTree::CreateContextMenu()
pSubPop3->CheckItem( nId );
SvTreeListEntry* pEntry = nullptr;
if (lcl_IsContent(FirstSelected()))
{
pPop->InsertItem(900, SwResId(STR_GOTO));
pPop->SetAccelKey(900, vcl::KeyCode(KEY_RETURN, false, false, false, false));
}
// Edit only if the shown content is coming from the current view.
if ((State::ACTIVE == m_eState || m_pActiveShell == pActiveView->GetWrtShellPtr())
&& nullptr != (pEntry = FirstSelected()) && lcl_IsContent(pEntry))
@@ -3387,6 +3392,12 @@ void SwContentTree::ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry )
// Delete outline selections
EditEntry(pFirst, EditEntryMode::DELETE);
break;
case 900:
{
SwContent* pCnt = static_cast<SwContent*>(pFirst->GetUserData());
GotoContent(pCnt);
}
break;
//Display
default:
if(nSelectedPopupEntry > 300 && nSelectedPopupEntry < 400)