diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-17 11:08:46 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-17 11:10:05 +0100 |
commit | 0c48c809f09e74e79c9f8dc4c22958147f591921 (patch) | |
tree | bfba7f403290b958d0058ba239e244f42613d2a0 /framework | |
parent | 16f85dc485970f34c2abd06fb5379b426d3a83bc (diff) |
tdf#95845 Use CommandInfoProvider to receive command properties
Change-Id: I41f9a661b7a5b355e50910d7f58f0d9d55dc62a6
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 76fa3319ba35..e4f29796d75e 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -773,62 +773,8 @@ void ToolBarManager::RemoveControllers() m_aControllerMap.clear(); } -uno::Sequence< beans::PropertyValue > ToolBarManager::GetPropsForCommand( const OUString& rCmdURL ) -{ - Sequence< PropertyValue > aPropSeq; - - // Retrieve properties for command - try - { - if ( !m_bModuleIdentified ) - { - Reference< XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); - Reference< XInterface > xIfac( m_xFrame, UNO_QUERY ); - - m_bModuleIdentified = true; - m_aModuleIdentifier = xModuleManager->identify( xIfac ); - - if ( !m_aModuleIdentifier.isEmpty() ) - { - Reference< XNameAccess > xNameAccess = frame::theUICommandDescription::get( m_xContext ); - xNameAccess->getByName( m_aModuleIdentifier ) >>= m_xUICommandLabels; - } - } - - if ( m_xUICommandLabels.is() ) - { - if ( !rCmdURL.isEmpty() ) - m_xUICommandLabels->getByName( rCmdURL ) >>= aPropSeq; - } - } - catch (const Exception&) - { - } - - return aPropSeq; -} - -sal_Int32 ToolBarManager::RetrievePropertiesFromCommand( const OUString& aCmdURL ) -{ - sal_Int32 nProperties(0); - Sequence< PropertyValue > aPropSeq; - - // Retrieve popup menu labels - aPropSeq = GetPropsForCommand( aCmdURL ); - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name == "Properties" ) - { - aPropSeq[i].Value >>= nProperties; - break; - } - } - return nProperties; -} - void ToolBarManager::CreateControllers() { - Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); css::util::URL aURL; @@ -932,7 +878,7 @@ void ToolBarManager::CreateControllers() new GenericToolbarController( m_xContext, m_xFrame, m_pToolBar, nId, aCommandURL )); // Accessibility support: Set toggle button role for specific commands - sal_Int32 nProps = RetrievePropertiesFromCommand( aCommandURL ); + sal_Int32 nProps = vcl::CommandInfoProvider::Instance().GetPropertiesForCommand(aCommandURL, m_xFrame); if ( nProps & UICOMMANDDESCRIPTION_PROPERTIES_TOGGLEBUTTON ) m_pToolBar->SetItemBits( nId, m_pToolBar->GetItemBits( nId ) | ToolBoxItemBits::CHECKABLE ); } |