[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - include/vcl sc/source vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 8 10:20:19 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 4eb27c796350d041675cfc963ed88bc08cd34b82
Author: SalimHabchi <salim.habchi at epitech.eu>
AuthorDate: Wed Jul 11 11:53:03 2018 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Aug 8 12:19:56 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>
(cherry picked from commit 7cc85bfd54645d3786828816972a2f039cb134e9)
Reviewed-on: https://gerrit.libreoffice.org/58685
Tested-by: Xisco FaulĂ <xiscofauli at libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
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;
More information about the Libreoffice-commits
mailing list