summaryrefslogtreecommitdiff
path: root/framework/source/uielement
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2017-05-17 22:58:30 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2017-05-18 00:30:50 +0300
commit7e6b62825032ff6610ab83c3e4f3b7085d2def0c (patch)
tree7ce14c57bcf0e5d54bf9d5c14c80ade2799286f2 /framework/source/uielement
parent29dd77c749f6bdae19ba1e81b0470f9009c42537 (diff)
Use WeakComponentImplHelper for MenuBarManager
Change-Id: Ia0c47186f5f266d512c02e92d7983872e207f878
Diffstat (limited to 'framework/source/uielement')
-rw-r--r--framework/source/uielement/menubarmanager.cxx101
1 files changed, 36 insertions, 65 deletions
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 8a187f204152..3a1b2bd4d157 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -71,10 +71,7 @@
#include <vcl/menu.hxx>
#include <vcl/settings.hxx>
#include <vcl/commandinfoprovider.hxx>
-#include <osl/mutex.hxx>
#include <osl/file.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <cppuhelper/queryinterface.hxx>
#include <svtools/acceleratorexecute.hxx>
#include <svtools/miscopt.hxx>
#include <uielement/menubarmerger.hxx>
@@ -127,12 +124,11 @@ MenuBarManager::MenuBarManager(
const Reference< XDispatchProvider >& rDispatchProvider,
const OUString& rModuleIdentifier,
Menu* pMenu, bool bDelete, bool bHasMenuBar ):
- m_bDisposed( false )
+ WeakComponentImplHelper( m_aMutex )
, m_bRetrieveImages( false )
, m_bAcceleratorCfg( false )
, m_bModuleIdentified( false )
, m_bHasMenuBar( bHasMenuBar )
- , m_aListenerContainer( m_mutex )
, m_xContext(rxContext)
, m_xURLTransformer(_xURLTransformer)
, m_sIconTheme( SvtMiscOptions().GetIconTheme() )
@@ -148,12 +144,11 @@ MenuBarManager::MenuBarManager(
const Reference< XURLTransformer >& _xURLTransformer,
Menu* pAddonMenu,
bool popup):
- m_bDisposed( false )
+ WeakComponentImplHelper( m_aMutex )
, m_bRetrieveImages( true )
, m_bAcceleratorCfg( false )
, m_bModuleIdentified( false )
, m_bHasMenuBar( true )
- , m_aListenerContainer( m_mutex )
, m_xContext(rxContext)
, m_xURLTransformer(_xURLTransformer)
, m_sIconTheme( SvtMiscOptions().GetIconTheme() )
@@ -166,7 +161,7 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< sal_Int8 >& /*Proces
{
SolarMutexGuard aSolarGuard;
- if ( m_bDisposed )
+ if ( rBHelper.bDisposed || rBHelper.bInDispose )
throw css::lang::DisposedException();
Any a;
@@ -203,7 +198,7 @@ void MenuBarManager::Destroy()
{
SolarMutexGuard aGuard;
- if ( !m_bDisposed )
+ if ( !rBHelper.bDisposed )
{
// stop asynchronous settings timer and
// release defered item container reference
@@ -230,69 +225,45 @@ void MenuBarManager::Destroy()
}
// XComponent
-void SAL_CALL MenuBarManager::dispose()
+void SAL_CALL MenuBarManager::disposing()
{
Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
- EventObject aEvent( xThis );
- m_aListenerContainer.disposeAndClear( aEvent );
+ SolarMutexGuard g;
+ Destroy();
+ if ( m_xDocImageManager.is() )
{
- SolarMutexGuard g;
- Destroy();
- m_bDisposed = true;
-
- if ( m_xDocImageManager.is() )
+ try
{
- try
- {
- m_xDocImageManager->removeConfigurationListener(
- Reference< XUIConfigurationListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
- }
- catch ( const Exception& )
- {
- }
+ m_xDocImageManager->removeConfigurationListener(
+ Reference< XUIConfigurationListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
}
- if ( m_xModuleImageManager.is() )
+ catch ( const Exception& )
{
- try
- {
- m_xModuleImageManager->removeConfigurationListener(
- Reference< XUIConfigurationListener >(
- static_cast< OWeakObject* >( this ), UNO_QUERY ));
- }
- catch ( const Exception& )
- {
- }
}
- m_xDocImageManager.clear();
- m_xModuleImageManager.clear();
- m_xGlobalAcceleratorManager.clear();
- m_xModuleAcceleratorManager.clear();
- m_xDocAcceleratorManager.clear();
- m_xUICommandLabels.clear();
- m_xPopupMenuControllerFactory.clear();
- m_xContext.clear();
}
-}
-
-void SAL_CALL MenuBarManager::addEventListener( const Reference< XEventListener >& xListener )
-{
- SolarMutexGuard g;
-
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
- throw DisposedException();
-
- m_aListenerContainer.addInterface( cppu::UnoType<XEventListener>::get(), xListener );
-}
-
-void SAL_CALL MenuBarManager::removeEventListener( const Reference< XEventListener >& xListener )
-{
- SolarMutexGuard g;
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
- m_aListenerContainer.removeInterface( cppu::UnoType<XEventListener>::get(), xListener );
+ if ( m_xModuleImageManager.is() )
+ {
+ try
+ {
+ m_xModuleImageManager->removeConfigurationListener(
+ Reference< XUIConfigurationListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+ }
+ catch ( const Exception& )
+ {
+ }
+ }
+ m_xDocImageManager.clear();
+ m_xModuleImageManager.clear();
+ m_xGlobalAcceleratorManager.clear();
+ m_xModuleAcceleratorManager.clear();
+ m_xDocAcceleratorManager.clear();
+ m_xUICommandLabels.clear();
+ m_xPopupMenuControllerFactory.clear();
+ m_xContext.clear();
}
void SAL_CALL MenuBarManager::elementInserted( const css::ui::ConfigurationEvent& Event )
@@ -300,7 +271,7 @@ void SAL_CALL MenuBarManager::elementInserted( const css::ui::ConfigurationEvent
SolarMutexGuard g;
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- if ( m_bDisposed )
+ if ( rBHelper.bDisposed || rBHelper.bInDispose )
return;
sal_Int16 nImageType = sal_Int16();
@@ -325,7 +296,7 @@ void SAL_CALL MenuBarManager::frameAction( const FrameActionEvent& Action )
{
SolarMutexGuard g;
- if ( m_bDisposed )
+ if ( rBHelper.bDisposed || rBHelper.bInDispose )
throw css::lang::DisposedException();
if ( Action.Action == FrameAction_CONTEXT_CHANGED )
@@ -356,7 +327,7 @@ void SAL_CALL MenuBarManager::statusChanged( const FeatureStateEvent& Event )
SolarMutexGuard aSolarGuard;
{
- if ( m_bDisposed )
+ if ( rBHelper.bDisposed || rBHelper.bInDispose )
return;
// We have to check all menu entries as there can be identical entries in a popup menu.