diff options
Diffstat (limited to 'framework/source/uielement/controlmenucontroller.cxx')
-rw-r--r-- | framework/source/uielement/controlmenucontroller.cxx | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 546d141e0f..983808b555 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -27,6 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" +#include <sal/macros.h> #include <uielement/controlmenucontroller.hxx> //_________________________________________________________________________________________________________________ @@ -67,7 +69,6 @@ // Function-Id's #define RID_FMSHELL_CONVERSIONMENU (RID_FORMS_START + 4) #define RID_SVXIMGLIST_FMEXPL (RID_FORMS_START + 0) -#define RID_SVXIMGLIST_FMEXPL_HC (RID_FORMS_START + 2) // Forms - Ids, used to address images from image list #define SID_FMSLOTS_START (SID_SVX_START + 592) @@ -192,7 +193,7 @@ const char* aCommands[] = //_________________________________________________________________________________________________________________ // Defines //_________________________________________________________________________________________________________________ -// +// using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -218,7 +219,6 @@ ControlMenuController::ControlMenuController( const ::com::sun::star::uno::Refer m_pResPopupMenu( 0 ) { const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - m_bWasHiContrast = rSettings.GetHighContrastMode(); m_bShowMenuImages = rSettings.GetUseImagesInMenus(); } @@ -231,15 +231,15 @@ ControlMenuController::~ControlMenuController() void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu ) { rtl::OUString aResName( RTL_CONSTASCII_USTRINGPARAM( "svx" )); - + ResMgr* pResMgr = ResMgr::CreateResMgr( rtl::OUStringToOString( aResName, RTL_TEXTENCODING_ASCII_US )); - ResId aResId( m_bWasHiContrast ? RID_SVXIMGLIST_FMEXPL_HC : RID_SVXIMGLIST_FMEXPL, *pResMgr ); + ResId aResId( RID_SVXIMGLIST_FMEXPL, *pResMgr ); aResId.SetRT( RSC_IMAGELIST ); - + if ( pResMgr->IsAvailable( aResId )) { ImageList aImageList( aResId ); - for ( sal_uInt32 i=0; i < sizeof(nConvertSlots)/sizeof(nConvertSlots[0]); ++i ) + for ( sal_uInt32 i=0; i < SAL_N_ELEMENTS(nConvertSlots); ++i ) { // das entsprechende Image dran if ( m_bShowMenuImages ) @@ -257,13 +257,13 @@ void ControlMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rP { VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( rPopupMenu ); PopupMenu* pVCLPopupMenu = 0; - - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - + + SolarMutexGuard aSolarMutexGuard; + resetPopupMenu( rPopupMenu ); if ( pPopupMenu ) pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - + if ( pVCLPopupMenu && m_pResPopupMenu ) *pVCLPopupMenu = *m_pResPopupMenu; } @@ -277,7 +277,7 @@ void SAL_CALL ControlMenuController::disposing( const EventObject& ) throw ( Run m_xFrame.clear(); m_xDispatch.clear(); m_xServiceManager.clear(); - + if ( m_xPopupMenu.is() ) m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(( OWeakObject *)this, UNO_QUERY )); m_xPopupMenu.clear(); @@ -302,9 +302,9 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve if ( nMenuId ) { VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXMenu::GetImplementation( m_xPopupMenu ); - - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - + + SolarMutexGuard aSolarMutexGuard; + PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); if ( !Event.IsEnabled && pVCLPopupMenu->GetItemPos( nMenuId ) != MENU_ITEM_NOTFOUND ) @@ -323,11 +323,11 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve if ( nPrevInConversion != MENU_ITEM_NOTFOUND ) break; } - + if ( MENU_ITEM_NOTFOUND == nPrevInConversion ) // none of the items which precede the nSID-slot in the source menu are present in our conversion menu nPrevInConversion = sal::static_int_cast< sal_uInt16 >(-1); // put the item at the first position - + pVCLPopupMenu->InsertItem( nMenuId, m_pResPopupMenu->GetItemText( nMenuId ), m_pResPopupMenu->GetItemBits( nMenuId ), ++nPrevInConversion ); pVCLPopupMenu->SetItemImage( nMenuId, m_pResPopupMenu->GetItemImage( nMenuId )); pVCLPopupMenu->SetHelpId( nMenuId, m_pResPopupMenu->GetHelpId( nMenuId )); @@ -344,7 +344,7 @@ void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispat Sequence<PropertyValue> aArgs; Reference< XDispatch > xDispatch = pIter->second; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# - UiEventLogHelper(::rtl::OUString::createFromAscii("ControlMenuController")).log(m_xServiceManager, m_xFrame, aURL, aArgs); + UiEventLogHelper(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ControlMenuController"))).log(m_xServiceManager, m_xFrame, aURL, aArgs); if ( xDispatch.is() ) xDispatch->dispatch( aURL, aArgs ); } @@ -356,18 +356,15 @@ void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) thro if ( m_xPopupMenu.is() ) { - vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - + SolarMutexGuard aSolarMutexGuard; + // Check if some modes have changed so we have to update our menu images const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - sal_Bool bIsHiContrast = rSettings.GetHighContrastMode(); sal_Bool bShowMenuImages = rSettings.GetUseImagesInMenus(); - sal_Bool bUpdateImages = (( m_bWasHiContrast != bIsHiContrast ) || ( bShowMenuImages != m_bShowMenuImages )); + sal_Bool bUpdateImages = (bShowMenuImages != m_bShowMenuImages); if ( bUpdateImages ) { - // The mode has changed or the complete menu so we have to retrieve all images again - m_bWasHiContrast = bIsHiContrast; m_bShowMenuImages = bShowMenuImages; VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( m_xPopupMenu ); @@ -402,7 +399,7 @@ void ControlMenuController::impl_setPopupMenu() } } // if ( m_pResPopupMenu == 0 ) } - + void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) { osl::ResettableMutexGuard aLock( m_aMutex ); @@ -415,12 +412,12 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (::com::sun::star:: Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); fillPopupMenu( m_xPopupMenu ); m_aURLToDispatchMap.free(); - - for (sal_uInt32 i=0; i<sizeof(aCommands)/sizeof(aCommands[0]); ++i) + + for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i) { aTargetURL.Complete = rtl::OUString::createFromAscii( aCommands[i] ); m_xURLTransformer->parseStrict( aTargetURL ); - + Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); if ( xDispatch.is() ) { @@ -441,3 +438,5 @@ void SAL_CALL ControlMenuController::initialize( const Sequence< Any >& aArgumen } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |