From 7cc85bfd54645d3786828816972a2f039cb134e9 Mon Sep 17 00:00:00 2001 From: SalimHabchi Date: Wed, 11 Jul 2018 11:53:03 +0200 Subject: tdf#118453 Reactivate navitagor submenu drag mode and display I add a function to get the data from the submenu Change-Id: If8aedc72abfc7ca967377f0e588167f9f62fe137 Reviewed-on: https://gerrit.libreoffice.org/57269 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- vcl/source/window/menu.cxx | 6 ++++++ vcl/source/window/menuitemlist.cxx | 11 +++++++++++ vcl/source/window/menuitemlist.hxx | 1 + 3 files changed, 18 insertions(+) (limited to 'vcl') diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index cf509a91374a..a1e3180ace35 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 7778a8004b53..1d63118af096 100644 --- a/vcl/source/window/menuitemlist.cxx +++ b/vcl/source/window/menuitemlist.cxx @@ -140,6 +140,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 c25eae263dac..bb7ef90dc026 100644 --- a/vcl/source/window/menuitemlist.hxx +++ b/vcl/source/window/menuitemlist.hxx @@ -116,6 +116,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; -- cgit