diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-18 13:28:46 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-18 14:07:27 +0100 |
commit | 27bdc70d83d4a4f1ebb89429f61b39084e739aaa (patch) | |
tree | be8f3142cfa115582e6a6ca17e6c0d1d1ec2ed3c | |
parent | 8327a5e162a4d1804286bfdfb4d621b8d2a1d504 (diff) |
Toolbar: Refactor insert toolitem code
Change-Id: Icb615164c4dc3e96048829805a3eb0faa7d88e4e
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index df119beab214..c1c23a6f4da6 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -1058,8 +1058,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if ( m_bDisposed ) return; - sal_uInt16 nId( 1 ); - Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); if ( !m_xDocImageManager.is() ) { @@ -1175,30 +1173,22 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine if (( nType == css::ui::ItemType::DEFAULT ) && !aCommandURL.isEmpty() ) { - OUString aString(vcl::CommandInfoProvider::Instance().GetLabelForCommand(aCommandURL, m_xFrame)); - ToolBoxItemBits nItemBits = ConvertStyleToToolboxItemBits( nStyle ); + + m_pToolBar->InsertItem(aCommandURL, m_xFrame, nItemBits); + sal_Int16 nId = m_pToolBar->GetItemId(aCommandURL); + if ( aMenuDesc.is() ) { m_aMenuMap[ nId ] = aMenuDesc; nItemBits |= ToolBoxItemBits::DROPDOWNONLY; } - m_pToolBar->InsertItem( nId, aString, nItemBits ); - m_pToolBar->SetItemCommand( nId, aCommandURL ); - OUString sTooltip = vcl::CommandInfoProvider::Instance().GetTooltipForCommand(aCommandURL, m_xFrame); - if (!sTooltip.isEmpty()) - m_pToolBar->SetQuickHelpText( nId, sTooltip ); + if ( !aLabel.isEmpty() ) - { m_pToolBar->SetItemText( nId, aLabel ); - } - else - { - m_pToolBar->SetItemText( nId, aString ); - } - m_pToolBar->EnableItem( nId ); - m_pToolBar->SetItemState( nId, TRISTATE_FALSE ); + if ( !bIsVisible ) + m_pToolBar->HideItem( nId ); // Fill command map. It stores all our commands and from what // image manager we got our image. So we can decide if we have to use an @@ -1214,11 +1204,6 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine { pIter->second.aIds.push_back( nId ); } - - if ( !bIsVisible ) - m_pToolBar->HideItem( nId ); - - ++nId; } else if ( nType == css::ui::ItemType::SEPARATOR_LINE ) { |