Kaydet (Commit) c8977c44 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky

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/46627Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst ccb6a1c6
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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,
......
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment