Kaydet (Commit) d40c2239 authored tarafından Carsten Driesner's avatar Carsten Driesner

fwk153: #i110127# Provide one instance of module accelerator manager in module…

fwk153: #i110127# Provide one instance of module accelerator manager in module ui configuration manager implementation.
üst b3a5ee2e
...@@ -219,6 +219,7 @@ namespace framework ...@@ -219,6 +219,7 @@ namespace framework
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager;
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager;
}; };
} }
......
...@@ -1246,12 +1246,13 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util: ...@@ -1246,12 +1246,13 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
if (! xHAccess.is ()) if (! xHAccess.is ())
return; return;
const sal_Int32 c = aEvent.Changes.getLength(); css::util::ChangesEvent aReceivedEvents( aEvent );
const sal_Int32 c = aReceivedEvents.Changes.getLength();
sal_Int32 i = 0; sal_Int32 i = 0;
for (i=0; i<c; ++i) for (i=0; i<c; ++i)
{ {
const css::util::ElementChange& aChange = aEvent.Changes[i]; const css::util::ElementChange& aChange = aReceivedEvents.Changes[i];
// Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will // Only path of form "PrimaryKeys/Modules/Module['<module_name>']/Key['<command_url>']/Command[<locale>]" will
// be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-) // be interesting for use. Sometimes short path values are given also by the broadcaster ... but they must be ignored :-)
......
...@@ -776,26 +776,29 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u ...@@ -776,26 +776,29 @@ void SAL_CALL ModuleUIConfigurationManager::dispose() throw (::com::sun::star::u
css::lang::EventObject aEvent( xThis ); css::lang::EventObject aEvent( xThis );
m_aListenerContainer.disposeAndClear( aEvent ); m_aListenerContainer.disposeAndClear( aEvent );
{ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
ResetableGuard aGuard( m_aLock ); ResetableGuard aGuard( m_aLock );
try Reference< XComponent > xModuleImageManager( m_xModuleImageManager );
{ m_xModuleImageManager.clear();
if ( m_xModuleImageManager.is() ) m_xModuleAcceleratorManager.clear();
m_xModuleImageManager->dispose(); m_aUIElements[LAYER_USERDEFINED].clear();
} m_aUIElements[LAYER_DEFAULT].clear();
catch ( Exception& ) m_xDefaultConfigStorage.clear();
{ m_xUserConfigStorage.clear();
} m_xUserRootCommit.clear();
m_bConfigRead = false;
m_bModified = false;
m_bDisposed = true;
aGuard.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
m_xModuleImageManager.clear(); try
m_aUIElements[LAYER_USERDEFINED].clear(); {
m_aUIElements[LAYER_DEFAULT].clear(); if ( xModuleImageManager.is() )
m_xDefaultConfigStorage.clear(); xModuleImageManager->dispose();
m_xUserConfigStorage.clear(); }
m_xUserRootCommit.clear(); catch ( Exception& )
m_bConfigRead = false; {
m_bModified = false;
m_bDisposed = true;
} }
} }
...@@ -1370,30 +1373,35 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() ...@@ -1370,30 +1373,35 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager()
} }
return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY ); return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY );
// return Reference< XInterface >();
} }
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException)
{ {
ResetableGuard aGuard( m_aLock ); ResetableGuard aGuard( m_aLock );
if ( m_bDisposed )
throw DisposedException();
Reference< XMultiServiceFactory > xSMGR = m_xServiceManager; Reference< XMultiServiceFactory > xSMGR = m_xServiceManager;
::rtl::OUString aModule = /*m_aModuleShortName*/m_aModuleIdentifier; ::rtl::OUString aModule = m_aModuleIdentifier;
aGuard.unlock();
Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); if ( !m_xModuleAcceleratorManager.is() )
Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); {
Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION);
Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW);
PropertyValue aProp; PropertyValue aProp;
aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier"); aProp.Name = ::rtl::OUString::createFromAscii("ModuleIdentifier");
aProp.Value <<= aModule; aProp.Value <<= aModule;
Sequence< Any > lArgs(1); Sequence< Any > lArgs(1);
lArgs[0] <<= aProp; lArgs[0] <<= aProp;
xInit->initialize(lArgs); xInit->initialize(lArgs);
m_xModuleAcceleratorManager = Reference< XInterface >( xManager, UNO_QUERY );
}
return xManager; return m_xModuleAcceleratorManager;
} }
Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException) Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment