summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/menu.hxx2
-rw-r--r--sc/source/ui/navipi/content.cxx2
-rw-r--r--vcl/source/window/menu.cxx6
-rw-r--r--vcl/source/window/menuitemlist.cxx11
-rw-r--r--vcl/source/window/menuitemlist.hxx1
5 files changed, 20 insertions, 2 deletions
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 6c73d802802f..f7875f936014 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -263,7 +263,7 @@ public:
MenuItemType GetItemType( sal_uInt16 nPos ) const;
sal_uInt16 GetCurItemId() const { return nSelectedId;}
OString GetCurItemIdent() const;
-
+ OString GetItemIdentFromSubMenu(sal_uInt16 nItemId) const;
void SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits );
MenuItemBits GetItemBits( sal_uInt16 nItemId ) const;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 4cd69244142f..6f71bd92434e 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -668,7 +668,7 @@ void ScContentTree::Command( const CommandEvent& rCEvt )
aPop->SetPopupMenu( 2, aDocMenu.get() );
sal_uInt16 nSelected = aPop->Execute(this, rCEvt.GetMousePosPixel());
- OString sIdent = aPop->GetItemIdent(nSelected);
+ OString sIdent = aPop->GetItemIdentFromSubMenu(nSelected);
if (sIdent.startsWith("document"))
{
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index a0cdd3b7f3de..62739890e3aa 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -702,6 +702,12 @@ OString Menu::GetItemIdent(sal_uInt16 nId) const
return pData ? pData->sIdent : OString();
}
+OString Menu::GetItemIdentFromSubMenu(sal_uInt16 nId) const
+{
+ const MenuItemData* pData = pItemList->GetDataFromSubMenu(nId);
+ return pData ? pData->sIdent : OString();
+}
+
void Menu::SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits )
{
MenuItemData* pData = pItemList->GetData( nItemId );
diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx
index f9306c864249..bfe8a381df1b 100644
--- a/vcl/source/window/menuitemlist.cxx
+++ b/vcl/source/window/menuitemlist.cxx
@@ -141,6 +141,17 @@ MenuItemData* MenuItemList::GetData( sal_uInt16 nSVId, size_t& rPos ) const
return nullptr;
}
+MenuItemData* MenuItemList::GetDataFromSubMenu(sal_uInt16 nSVId) const
+{
+ for ( size_t i = 0, n = maItemList.size(); i < n; ++i )
+ {
+ if ( maItemList[i]->pSubMenu
+ && maItemList[i]->pSubMenu->GetCurItemId() != 0 ) // if something is selected
+ return maItemList[i].get()->pSubMenu->GetItemList()->GetDataFromPos(nSVId - 1);
+ }
+ return nullptr;
+}
+
MenuItemData* MenuItemList::SearchItem(
sal_Unicode cSelectChar,
KeyCode aKeyCode,
diff --git a/vcl/source/window/menuitemlist.hxx b/vcl/source/window/menuitemlist.hxx
index 300908eee447..73c36980172c 100644
--- a/vcl/source/window/menuitemlist.hxx
+++ b/vcl/source/window/menuitemlist.hxx
@@ -118,6 +118,7 @@ public:
void Clear();
MenuItemData* GetData( sal_uInt16 nSVId, size_t& rPos ) const;
+ MenuItemData* GetDataFromSubMenu( sal_uInt16 nSVId ) const;
MenuItemData* GetData( sal_uInt16 nSVId ) const
{
size_t nTemp;