diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:54:35 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-01-13 17:54:35 +0000 |
commit | f7d37320014779056f1af6c49c4218806b69ed80 (patch) | |
tree | ea98a7ba8e6ba8195b87e50a381d034ec855dba5 /framework/source/uielement/menubarmanager.cxx | |
parent | 2c4cd0628684bb14639ecf76ca400d70b3f9aabc (diff) |
INTEGRATION: CWS cd02 (1.12.54); FILE MERGED
2005/01/05 12:14:05 cd 1.12.54.2: RESYNC: (1.12-1.16); FILE MERGED
2004/11/08 17:41:00 cd 1.12.54.1: #i36816# Menubar popups and toolbars can now handle non-unqiue commands correctly
Diffstat (limited to 'framework/source/uielement/menubarmanager.cxx')
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 121 |
1 files changed, 53 insertions, 68 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index a6ad0f1731..6246ba1c65 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: menubarmanager.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: kz $ $Date: 2004-12-03 14:19:49 $ + * last change: $Author: kz $ $Date: 2005-01-13 18:54:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -807,94 +807,79 @@ void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event ) throw ( RuntimeException ) { ::rtl::OUString aFeatureURL = Event.FeatureURL.Complete; - MenuItemHandler* pStatusChangedMenu = NULL; - + + OGuard aGuard( Application::GetSolarMutex() ); { ResetableGuard aGuard( m_aLock ); if ( m_bDisposed ) return; - + + // We have to check all menu entries as there can be identical entries in a popup menu. std::vector< MenuItemHandler* >::iterator p; for ( p = m_aMenuItemHandlerVector.begin(); p != m_aMenuItemHandlerVector.end(); p++ ) { MenuItemHandler* pMenuItemHandler = *p; if ( pMenuItemHandler->aMenuItemURL == aFeatureURL ) { - pStatusChangedMenu = pMenuItemHandler; - break; - } - } - } + sal_Bool bCheckmark( sal_False ); + sal_Bool bMenuItemEnabled( m_pVCLMenu->IsItemEnabled( pMenuItemHandler->nItemId )); + rtl::OUString aItemText; + status::Visibility aVisibilityStatus; - if ( pStatusChangedMenu ) - { - OGuard aGuard( Application::GetSolarMutex() ); - { - ResetableGuard aGuard( m_aLock ); - - sal_Bool bCheckmark( sal_False ); - sal_Bool bMenuItemEnabled( m_pVCLMenu->IsItemEnabled( pStatusChangedMenu->nItemId )); - rtl::OUString aItemText; - status::Visibility aVisibilityStatus; + // Enable/disable item + if ( Event.IsEnabled != bMenuItemEnabled ) + m_pVCLMenu->EnableItem( pMenuItemHandler->nItemId, Event.IsEnabled ); - if ( aFeatureURL.equalsAscii( ".uno:ChangeCaseToHalfWidth" )) - { - int a = 1; - } - - // Enable/disable item - if ( Event.IsEnabled != bMenuItemEnabled ) - m_pVCLMenu->EnableItem( pStatusChangedMenu->nItemId, Event.IsEnabled ); - - if ( Event.State >>= bCheckmark ) - { - // Checkmark - m_pVCLMenu->ShowItem( pStatusChangedMenu->nItemId, TRUE ); - m_pVCLMenu->CheckItem( pStatusChangedMenu->nItemId, bCheckmark ); - } - else if ( Event.State >>= aItemText ) - { - // Replacement for place holders - if ( aItemText.matchAsciiL( "($1)", 4 )) + if ( Event.State >>= bCheckmark ) { - String aResStr = String( FwkResId( STR_UPDATEDOC )); - rtl::OUString aTmp( aResStr ); - aTmp += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); - aTmp += aItemText.copy( 4 ); - aItemText = aTmp; + // Checkmark + m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE ); + m_pVCLMenu->CheckItem( pMenuItemHandler->nItemId, bCheckmark ); } - else if ( aItemText.matchAsciiL( "($2)", 4 )) + else if ( Event.State >>= aItemText ) { - String aResStr = String( FwkResId( STR_CLOSEDOC_ANDRETURN )); - rtl::OUString aTmp( aResStr ); - aTmp += aItemText.copy( 4 ); - aItemText = aTmp; + // Replacement for place holders + if ( aItemText.matchAsciiL( "($1)", 4 )) + { + String aResStr = String( FwkResId( STR_UPDATEDOC )); + rtl::OUString aTmp( aResStr ); + aTmp += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); + aTmp += aItemText.copy( 4 ); + aItemText = aTmp; + } + else if ( aItemText.matchAsciiL( "($2)", 4 )) + { + String aResStr = String( FwkResId( STR_CLOSEDOC_ANDRETURN )); + rtl::OUString aTmp( aResStr ); + aTmp += aItemText.copy( 4 ); + aItemText = aTmp; + } + else if ( aItemText.matchAsciiL( "($3)", 4 )) + { + String aResStr = String( FwkResId( STR_SAVECOPYDOC )); + rtl::OUString aTmp( aResStr ); + aTmp += aItemText.copy( 4 ); + aItemText = aTmp; + } + + m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE ); + m_pVCLMenu->SetItemText( pMenuItemHandler->nItemId, aItemText ); } - else if ( aItemText.matchAsciiL( "($3)", 4 )) + else if ( Event.State >>= aVisibilityStatus ) { - String aResStr = String( FwkResId( STR_SAVECOPYDOC )); - rtl::OUString aTmp( aResStr ); - aTmp += aItemText.copy( 4 ); - aItemText = aTmp; + // Visibility + m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, aVisibilityStatus.bVisible ); } - - m_pVCLMenu->ShowItem( pStatusChangedMenu->nItemId, TRUE ); - m_pVCLMenu->SetItemText( pStatusChangedMenu->nItemId, aItemText ); + else + m_pVCLMenu->ShowItem( pMenuItemHandler->nItemId, TRUE ); } - else if ( Event.State >>= aVisibilityStatus ) + + if ( Event.Requery ) { - // Visibility - m_pVCLMenu->ShowItem( pStatusChangedMenu->nItemId, aVisibilityStatus.bVisible ); + // Release dispatch object - will be requeried on the next activate! + pMenuItemHandler->xMenuItemDispatch.clear(); } - else - m_pVCLMenu->ShowItem( pStatusChangedMenu->nItemId, TRUE ); - } - - if ( Event.Requery ) - { - // Release dispatch object - will be requeried on the next activate! - pStatusChangedMenu->xMenuItemDispatch.clear(); } } } |