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

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/16781Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMaxim Monastirsky <momonasmon@gmail.com>
üst ae20b814
......@@ -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 );
}
}
}
}
......
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