diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-22 21:21:40 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-28 01:28:29 +0300 |
commit | 180a5fe0a2c72408e2322f8155415b4639131096 (patch) | |
tree | dc3abfdd661577a8e8e4f0f7995624c354fbf5ca /framework | |
parent | f58f10fc89e19d182b5a415bb69af5ecc7de080a (diff) |
Simplify
Every button has a controller, so it should be enough to
just iterate the controllers map.
Change-Id: I9e3d269a00ddd9362164a45000a90d9dc6220cab
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index a6c0efd9a8c6..11192ed4740f 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -327,33 +327,24 @@ void ToolBarManager::RefreshImages() bool bBigImages( SvtMiscOptions().AreCurrentSymbolsLarge() ); m_pToolBar->SetToolboxButtonSize( bBigImages ? TOOLBOX_BUTTONSIZE_LARGE : TOOLBOX_BUTTONSIZE_SMALL ); - for ( sal_uInt16 nPos = 0; nPos < m_pToolBar->GetItemCount(); nPos++ ) + for ( auto const& it : m_aControllerMap ) { - sal_uInt16 nId( m_pToolBar->GetItemId( nPos ) ); - - if ( nId > 0 ) + Reference< XSubToolbarController > xController( it.second, UNO_QUERY ); + if ( xController.is() && xController->opensSubToolbar() ) { - 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 ); - } - } + // 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( it.first ); + 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( it.first, aImage ); } } |