Kaydet (Commit) f3742e41 authored tarafından Philippe Jung's avatar Philippe Jung Kaydeden (comit) Andras Timar

tdf#91953 Mixture of icon sizes

Now, whatever the size of toolbar icons, the toolbar
context menu always shows small icons.

Change-Id: Id17df15278d74ae75a3e82d54ecf7af310e0ceb4
Reviewed-on: https://gerrit.libreoffice.org/16361Reviewed-by: 's avatarPhilippe Jung <phil.jung@free.fr>
Tested-by: 's avatarPhilippe Jung <phil.jung@free.fr>
(cherry picked from commit 3090550b)
Reviewed-on: https://gerrit.libreoffice.org/16365Reviewed-by: 's avatarYousuf Philips <philipz85@hotmail.com>
Tested-by: 's avatarYousuf Philips <philipz85@hotmail.com>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst f9b83b18
......@@ -1715,6 +1715,11 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
if( !(pToolBar->GetFloatStyle() & WB_CLOSEABLE) )
aQuickCustomizationMenu.EnableItem(MENUITEM_TOOLBAR_CLOSE, false);
// Temporary stores a Command --> Url map to update contextual menu with the
// correct icons. The popup icons are by default the same as those in the
// toolbar. They are not correct for contextual popup menu.
std::map< OUString, Image > commandToImage;
// Go through all toolbar items and add them to the context menu
for ( nPos = 0; nPos < m_pToolBar->GetItemCount(); ++nPos )
{
......@@ -1726,6 +1731,7 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
pVisibleItemsPopupMenu->CheckItem( STARTID_CUSTOMIZE_POPUPMENU+nPos, m_pToolBar->IsItemVisible( nId ) );
pVisibleItemsPopupMenu->SetItemCommand( STARTID_CUSTOMIZE_POPUPMENU+nPos, aCommandURL );
Image aImage( GetImageFromURL( m_xFrame, aCommandURL, false ) );
commandToImage[aCommandURL] = aImage;
pVisibleItemsPopupMenu->SetItemImage( STARTID_CUSTOMIZE_POPUPMENU+nPos, aImage );
}
else
......@@ -1733,6 +1739,18 @@ bool ToolBarManager::MenuItemAllowed( sal_uInt16 ) const
pVisibleItemsPopupMenu->InsertSeparator();
}
}
// Now we go through all the contextual menu to update the icons
std::map< OUString, Image >::iterator it;
for ( nPos = 0; nPos < pMenu->GetItemCount(); ++nPos )
{
sal_uInt16 nId = pMenu->GetItemId( nPos );
OUString cmdUrl = pMenu->GetItemCommand( nId );
it = commandToImage.find( cmdUrl );
if (it != commandToImage.end()) {
pMenu->SetItemImage( nId, it->second );
}
}
}
else
{
......
......@@ -1828,6 +1828,7 @@ void ToolBox::UpdateCustomMenu()
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString());
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem ( id, it->meState == TRISTATE_TRUE );
}
......@@ -1844,6 +1845,7 @@ void ToolBox::UpdateCustomMenu()
{
sal_uInt16 id = it->mnId + TOOLBOX_MENUITEM_START;
pMenu->InsertItem( id, it->maText, it->maImageOriginal, MenuItemBits::NONE, OString() );
pMenu->SetItemCommand( id, it->maCommandStr );
pMenu->EnableItem( id, it->mbEnabled );
pMenu->CheckItem( id, it->meState == TRISTATE_TRUE );
}
......
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