summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-12-17 01:54:45 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2017-12-17 07:35:15 +0100
commitc8977c4465b5ea2b598bdd71621d1b7c57ec5eb6 (patch)
tree696799785c1fefe9d9a6b21b6df14e3a13608675
parentccb6a1c6d59859467f9d9a6d954501e9329ee202 (diff)
tdf#98058 Respect menu:style="text" setting
It was implemented on the xml handling side, but ignored by the menubar code. In addition, make the menu:style attribute survive customization (similar to tdf#114261). Change-Id: I92a3517ee7ba2fe7a0782985d89fb5d0fdbac246 Reviewed-on: https://gerrit.libreoffice.org/46627 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
-rw-r--r--cui/source/customize/SvxConfigPageHelper.cxx10
-rw-r--r--cui/source/customize/cfg.cxx4
-rw-r--r--cui/source/inc/SvxConfigPageHelper.hxx1
-rw-r--r--framework/source/uielement/menubarmanager.cxx17
4 files changed, 18 insertions, 14 deletions
diff --git a/cui/source/customize/SvxConfigPageHelper.cxx b/cui/source/customize/SvxConfigPageHelper.cxx
index 18da75eb2c6e..9738b20c595f 100644
--- a/cui/source/customize/SvxConfigPageHelper.cxx
+++ b/cui/source/customize/SvxConfigPageHelper.cxx
@@ -297,6 +297,7 @@ bool SvxConfigPageHelper::GetMenuItemData(
OUString& rCommandURL,
OUString& rLabel,
sal_uInt16& rType,
+ sal_Int32& rStyle,
css::uno::Reference< css::container::XIndexAccess >& rSubMenu )
{
try
@@ -314,6 +315,10 @@ bool SvxConfigPageHelper::GetMenuItemData(
{
aProp[i].Value >>= rSubMenu;
}
+ else if ( aProp[i].Name == ITEM_DESCRIPTOR_STYLE )
+ {
+ aProp[i].Value >>= rStyle;
+ }
else if ( aProp[i].Name == ITEM_DESCRIPTOR_LABEL )
{
aProp[i].Value >>= rLabel;
@@ -385,7 +390,7 @@ bool SvxConfigPageHelper::GetToolbarItemData(
css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertSvxConfigEntry(
const SvxConfigEntry* pEntry )
{
- css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 3 );
+ css::uno::Sequence< css::beans::PropertyValue > aPropSeq( 4 );
aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL;
aPropSeq[0].Value <<= pEntry->GetCommand();
@@ -406,6 +411,9 @@ css::uno::Sequence< css::beans::PropertyValue > SvxConfigPageHelper::ConvertSvxC
aPropSeq[2].Value <<= pEntry->GetName();
}
+ aPropSeq[3].Name = ITEM_DESCRIPTOR_STYLE;
+ aPropSeq[3].Value <<= static_cast<sal_Int16>(pEntry->GetStyle());
+
return aPropSeq;
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 8420ada0049a..bb3769bd540b 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -471,9 +471,10 @@ bool SaveInData::LoadSubMenus( const uno::Reference< container::XIndexAccess >&
OUString aLabel;
sal_uInt16 nType( css::ui::ItemType::DEFAULT );
+ sal_Int32 nStyle(0);
bool bItem = SvxConfigPageHelper::GetMenuItemData( xMenuSettings, nIndex,
- aCommandURL, aLabel, nType, xSubMenu );
+ aCommandURL, aLabel, nType, nStyle, xSubMenu );
if ( bItem )
{
@@ -530,6 +531,7 @@ bool SaveInData::LoadSubMenus( const uno::Reference< container::XIndexAccess >&
SvxConfigEntry* pEntry = new SvxConfigEntry(
aLabel, aCommandURL, xSubMenu.is(), /*bParentData*/false );
+ pEntry->SetStyle( nStyle );
pEntry->SetUserDefined( bIsUserDefined );
if ( !bUseDefaultLabel )
pEntry->SetName( aLabel );
diff --git a/cui/source/inc/SvxConfigPageHelper.hxx b/cui/source/inc/SvxConfigPageHelper.hxx
index 75f8373201f6..4d0596846bd6 100644
--- a/cui/source/inc/SvxConfigPageHelper.hxx
+++ b/cui/source/inc/SvxConfigPageHelper.hxx
@@ -65,6 +65,7 @@ public:
OUString& rCommandURL,
OUString& rLabel,
sal_uInt16& rType,
+ sal_Int32& rStyle,
css::uno::Reference< css::container::XIndexAccess >& rSubMenu );
static bool GetToolbarItemData(
const css::uno::Reference< css::container::XIndexAccess >& rItemContainer,
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index fa5215f80213..f32d54bba2b4 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -1073,13 +1073,10 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF
Reference< XDispatch > xDispatch;
Reference< XStatusListener > xStatusListener;
VclPtr<PopupMenu> pPopup = pMenu->GetPopupMenu( nItemId );
- bool bItemShowMenuImages = m_bShowMenuImages;
// overwrite the show icons on menu option?
- if (!bItemShowMenuImages)
- {
- MenuItemBits nBits = pMenu->GetItemBits( nItemId );
- bItemShowMenuImages = ( ( nBits & MenuItemBits::ICON ) == MenuItemBits::ICON );
- }
+ MenuItemBits nBits = pMenu->GetItemBits( nItemId ) & ( MenuItemBits::ICON | MenuItemBits::TEXT );
+ bool bItemShowMenuImages = ( m_bShowMenuImages && nBits != MenuItemBits::TEXT ) || nBits & MenuItemBits::ICON;
+
if ( pPopup )
{
// Retrieve module identifier from Help Command entry
@@ -1891,13 +1888,9 @@ void MenuBarManager::FillMenuImages(Reference< XFrame > const & _xFrame, Menu* _
sal_uInt16 nId = _pMenu->GetItemId( nPos );
if ( _pMenu->GetItemType( nPos ) != MenuItemType::SEPARATOR )
{
- bool bTmpShowMenuImages( bShowMenuImages );
// overwrite the show icons on menu option?
- if (!bTmpShowMenuImages)
- {
- MenuItemBits nBits = _pMenu->GetItemBits( nId );
- bTmpShowMenuImages = ( ( nBits & MenuItemBits::ICON ) == MenuItemBits::ICON );
- }
+ MenuItemBits nBits = _pMenu->GetItemBits( nId ) & ( MenuItemBits::ICON | MenuItemBits::TEXT );
+ bool bTmpShowMenuImages = ( bShowMenuImages && nBits != MenuItemBits::TEXT ) || nBits & MenuItemBits::ICON;
if ( bTmpShowMenuImages )
{