summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Jung <phil.jung@free.fr>2015-06-18 15:19:14 +0200
committerPhilippe Jung <phil.jung@free.fr>2015-06-18 13:32:56 +0000
commit3090550b5297c86b63ba09ed1aa13bce4c0e5b70 (patch)
tree62238e980907e0c04001baeb70250edb3f8d4a0a
parent79be3a5e3856593bb759b6e521f06dc99c69c0ae (diff)
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/16361 Reviewed-by: Philippe Jung <phil.jung@free.fr> Tested-by: Philippe Jung <phil.jung@free.fr>
-rw-r--r--framework/source/uielement/toolbarmanager.cxx18
-rw-r--r--vcl/source/window/toolbox2.cxx2
2 files changed, 20 insertions, 0 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index ac34a544ace6..fbb13018278f 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -1713,6 +1713,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 )
{
@@ -1724,6 +1729,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
@@ -1731,6 +1737,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
{
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 3e04d1b2ac44..585cdb7a2dce 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -1827,6 +1827,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 );
}
@@ -1843,6 +1844,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 );
}