diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2013-05-25 22:10:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-26 20:39:02 +0100 |
commit | 1e85fc5b2d8aeafb12f414c6bf0692fb2ca221eb (patch) | |
tree | b34c142953c868ad4042c500cea1ec9dd1db9bbb /framework | |
parent | f45cad5126137a868b9194c66b0eaa940eb6304b (diff) |
svt::ToolboxController clean-up
Some small clean-up to use the PopupMenu ToolbarController
(cherry picked from commit e1687ce159e787d98f79d29a3d2131cca4b6ec71)
Conflicts:
svtools/inc/svtools/toolboxcontroller.hxx
svtools/source/uno/toolboxcontroller.cxx
Change-Id: Ie5e0397c32352d52cf2664bdbab920923e74bd03
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/generictoolbarcontroller.cxx | 6 | ||||
-rw-r--r-- | framework/source/uielement/toolbarmanager.cxx | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 6ed76510a5b3..fc6ad416e93f 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -362,8 +362,14 @@ MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::Runtime } } + if ( !pMenu || !m_pToolbar ) + return NULL; + + OSL_ENSURE ( pMenu->GetItemCount(), "Empty PopupMenu!" ); + ::Rectangle aRect( m_pToolbar->GetItemRect( m_nID ) ); pMenu->Execute( m_pToolbar, aRect, POPUPMENU_EXECUTE_DOWN ); + return NULL; } } // namespace diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 2ddcda576c88..675e83954a3d 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -928,6 +928,9 @@ void ToolBarManager::CreateControllers() aPropValue.Name = OUString( "ParentWindow" ); aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); + aPropValue.Value = uno::makeAny( nId ); + aPropertyVector.push_back( uno::makeAny( aPropValue ) ); if ( nWidth > 0 ) { @@ -1041,6 +1044,9 @@ void ToolBarManager::CreateControllers() aPropValue.Name = OUString( "ModuleIdentifier" ); aPropValue.Value <<= m_aModuleIdentifier; aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); + aPropValue.Value = uno::makeAny( nId ); + aPropertyVector.push_back( uno::makeAny( aPropValue ) ); if ( nWidth > 0 ) { @@ -1248,9 +1254,12 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine try { Reference< XIndexAccess > xMenuContainer; - if ( m_xDocUICfgMgr.is() ) + if ( m_xDocUICfgMgr.is() && + m_xDocUICfgMgr->hasSettings( aCommandURL ) ) xMenuContainer = m_xDocUICfgMgr->getSettings( aCommandURL, sal_False ); - if ( !xMenuContainer.is() && m_xUICfgMgr.is() ) + if ( !xMenuContainer.is() && + m_xUICfgMgr.is() && + m_xUICfgMgr->hasSettings( aCommandURL ) ) xMenuContainer = m_xUICfgMgr->getSettings( aCommandURL, sal_False ); if ( xMenuContainer.is() && xMenuContainer->getCount() ) { @@ -1297,7 +1306,10 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine sal_uInt16 nItemBits = ConvertStyleToToolboxItemBits( nStyle ); if ( aMenuDesc.is() ) + { m_aMenuMap[ nId ] = aMenuDesc; + nItemBits |= TIB_DROPDOWNONLY; + } m_pToolBar->InsertItem( nId, aString, nItemBits ); m_pToolBar->SetItemCommand( nId, aCommandURL ); if ( !aTooltip.isEmpty() ) |