summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/source/uielement/menubarmanager.cxx2
-rw-r--r--include/vcl/menu.hxx6
-rw-r--r--vcl/source/window/menuwindow.cxx19
3 files changed, 21 insertions, 6 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index edbd88d2250c..b445324d70d5 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1342,6 +1342,8 @@ void MenuBarManager::FillMenu(
{
VclPtr<PopupMenu> pNewPopupMenu = VclPtr<PopupMenu>::Create();
pMenu->SetPopupMenu( nId, pNewPopupMenu );
+ // Use the command URL as the Help ID for the sub menu
+ pNewPopupMenu->SetHelpId(aCommandURL);
if ( xDispatchProvider.is() )
{
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index c6bd47efba01..aeedc2cbe218 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -156,6 +156,9 @@ private:
mutable std::unique_ptr<vcl::MenuLayoutData> mpLayoutData;
std::unique_ptr<SalMenu> mpSalMenu;
+ // Stores the help ID of the menu
+ OUString m_sMenuHelpId;
+
protected:
SAL_DLLPRIVATE Menu* ImplGetStartMenu();
SAL_DLLPRIVATE Menu* ImplFindSelectMenu();
@@ -314,6 +317,9 @@ public:
void SetHelpId( sal_uInt16 nItemId, const OUString& rHelpId );
OUString GetHelpId( sal_uInt16 nItemId ) const;
+ void SetHelpId( const OUString& rHelpId ) { m_sMenuHelpId = rHelpId; }
+ OUString GetHelpId() const { return m_sMenuHelpId; }
+
void SetActivateHdl( const Link<Menu *, bool>& rLink )
{
aActivateHdl = rLink;
diff --git a/vcl/source/window/menuwindow.cxx b/vcl/source/window/menuwindow.cxx
index 36ed07f0730d..802c62e285f8 100644
--- a/vcl/source/window/menuwindow.cxx
+++ b/vcl/source/window/menuwindow.cxx
@@ -91,17 +91,24 @@ bool MenuWindow::ImplHandleHelpEvent(vcl::Window* pMenuWindow, Menu const * pMen
Help* pHelp = Application::GetHelp();
if ( pHelp )
{
- // is an id available, then call help with the id, otherwise
- // use help-index
+ // Check if there is a Help ID available, or else use
+ // the command URL
OUString aCommand = pMenu->GetItemCommand( nId );
- OUString aHelpId( pMenu->GetHelpId( nId ) );
+ OUString aHelpId;
+
+ // If no entry is selected, use the general menu Help ID
+ if (nId <= 0)
+ aHelpId = pMenu->GetHelpId();
+ else
+ aHelpId = pMenu->GetHelpId(nId);
+
if( aHelpId.isEmpty() )
aHelpId = OOO_HELP_INDEX;
- if ( !aCommand.isEmpty() )
- pHelp->Start(aCommand);
- else
+ if ( !aHelpId.isEmpty() )
pHelp->Start(aHelpId);
+ else
+ pHelp->Start(aCommand);
}
bDone = true;
}