[Libreoffice-commits] core.git: framework/source
Maxim Monastirsky
momonasmon at gmail.com
Mon Jul 6 07:55:27 PDT 2015
framework/source/uielement/toolbarmanager.cxx | 28 +++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
New commits:
commit dd69bde36a4ee4636933a80c0291486593a37670
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Mon Jul 6 02:50:08 2015 +0300
ToolBarManager: Let XSubToolbarController update itself
The doc for XSubToolbarController::updateImage says:
"gets called to notify a controller that it should set an image
which represents the current selected function.
Only the controller instance is able to set the correct image
for the current function. A toolbar implementation will ask
sub-toolbar controllers to update their image whenever it has
to update the images of all its buttons." However, it didn't
work that way until now.
Steps to reproduce:
1. Open one of the custom shapes dropdowns, and choose a shape
other than the default. Note that the button is now updated
with the last selection.
2. Change the icon theme. Note that the button shows now the
default shape, despite the fact that a future activation
of that button, will still draw the last used shape.
Change-Id: I9345c9faa17dc82a5f590b242b60751ce5d8e648
Reviewed-on: https://gerrit.libreoffice.org/16781
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index fbb1301..ac02170 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -331,13 +331,27 @@ void ToolBarManager::RefreshImages()
if ( nId > 0 )
{
- OUString aCommandURL = m_pToolBar->GetItemCommand( nId );
- Image aImage = GetImageFromURL( m_xFrame, aCommandURL, bBigImages );
- // Try also to query for add-on images before giving up and use an
- // empty image.
- if ( !aImage )
- aImage = QueryAddonsImage( aCommandURL, bBigImages );
- m_pToolBar->SetItemImage( nId, aImage );
+ ToolBarControllerMap::const_iterator pIter = m_aControllerMap.find( nId );
+ if ( pIter != m_aControllerMap.end() )
+ {
+ Reference< XSubToolbarController > xController( pIter->second, UNO_QUERY );
+ if ( xController.is() && xController->opensSubToolbar() )
+ {
+ // The button should show the last function that was selected from the
+ // dropdown. The controller should know better than us what it was.
+ xController->updateImage();
+ }
+ else
+ {
+ OUString aCommandURL = m_pToolBar->GetItemCommand( nId );
+ Image aImage = GetImageFromURL( m_xFrame, aCommandURL, bBigImages );
+ // Try also to query for add-on images before giving up and use an
+ // empty image.
+ if ( !aImage )
+ aImage = QueryAddonsImage( aCommandURL, bBigImages );
+ m_pToolBar->SetItemImage( nId, aImage );
+ }
+ }
}
}
More information about the Libreoffice-commits
mailing list