[Libreoffice-commits] core.git: include/vcl sc/source vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jul 23 08:16:59 UTC 2018
include/vcl/menu.hxx | 2 +-
sc/source/ui/navipi/content.cxx | 2 +-
vcl/source/window/menu.cxx | 6 ++++++
vcl/source/window/menuitemlist.cxx | 11 +++++++++++
vcl/source/window/menuitemlist.hxx | 1 +
5 files changed, 20 insertions(+), 2 deletions(-)
New commits:
commit 7cc85bfd54645d3786828816972a2f039cb134e9
Author: SalimHabchi <salim.habchi at epitech.eu>
AuthorDate: Wed Jul 11 11:53:03 2018 +0200
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Mon Jul 23 10:16:38 2018 +0200
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 at cib.de>
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index 705486ab7356..f865166c0b57 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 a0c709966c27..b800833e1b43 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 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;
More information about the Libreoffice-commits
mailing list