summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorSalimHabchi <salim.habchi@epitech.eu>2018-07-11 11:53:03 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2018-07-23 10:16:38 +0200
commit7cc85bfd54645d3786828816972a2f039cb134e9 (patch)
treedf64ec4b88ff26ebe26e19e7089b27ea31cc3df6 /vcl
parent110a25fdc2b0dc16c9b376fa6a9fdeb5fe7a58fb (diff)
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 <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/menu.cxx6
-rw-r--r--vcl/source/window/menuitemlist.cxx11
-rw-r--r--vcl/source/window/menuitemlist.hxx1
3 files changed, 18 insertions, 0 deletions
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;