diff options
author | Noel Grandin <noel@peralex.com> | 2012-12-11 08:16:08 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2012-12-13 05:20:58 +0200 |
commit | c1e42d60c572d23c61a703cd66495eab1cea4e05 (patch) | |
tree | 431e056f9e19802e87df477996a298771bafa237 /framework/source/uielement | |
parent | 9779ae8bdeffe1c296803dffefa0d69b0fb8f975 (diff) |
fdo#46808, use service constructor for ui::WindowStateConfiguration
Change-Id: I0b7f773a7db47049d7df4138d07e7fc38c657a65
Diffstat (limited to 'framework/source/uielement')
-rw-r--r-- | framework/source/uielement/toolbarsmenucontroller.cxx | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index 34520aa830ec..75b8351ff620 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -41,6 +41,7 @@ #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/ui/WindowStateConfiguration.hpp> #include <vcl/menu.hxx> #include <vcl/svapp.hxx> @@ -824,38 +825,33 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume if ( m_bInitialized ) { Reference< XModuleManager2 > xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ); - Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance( - SERVICENAME_WINDOWSTATECONFIGURATION ), - UNO_QUERY ); + Reference< XNameAccess > xPersistentWindowStateSupplier = ::com::sun::star::ui::WindowStateConfiguration::create( comphelper::getComponentContext(m_xServiceManager) ); // Retrieve persistent window state reference for our module - if ( xPersistentWindowStateSupplier.is() && xModuleManager.is() ) + rtl::OUString aModuleIdentifier; + try { - rtl::OUString aModuleIdentifier; - try - { - aModuleIdentifier = xModuleManager->identify( m_xFrame ); - xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState; - - Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = - ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) ); - m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ); - - Reference< XController > xController = m_xFrame->getController(); - Reference< XModel > xModel; - if ( xController.is() ) - xModel = xController->getModel(); - if ( xModel.is() ) - { - Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY ); - if ( xUIConfigurationManagerSupplier.is() ) - m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager(); - } - m_aModuleIdentifier = aModuleIdentifier; - } - catch ( const Exception& ) + aModuleIdentifier = xModuleManager->identify( m_xFrame ); + xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= m_xPersistentWindowState; + + Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = + ModuleUIConfigurationManagerSupplier::create( comphelper::getComponentContext(m_xServiceManager) ); + m_xModuleCfgMgr = xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ); + + Reference< XController > xController = m_xFrame->getController(); + Reference< XModel > xModel; + if ( xController.is() ) + xModel = xController->getModel(); + if ( xModel.is() ) { + Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY ); + if ( xUIConfigurationManagerSupplier.is() ) + m_xDocCfgMgr = xUIConfigurationManagerSupplier->getUIConfigurationManager(); } + m_aModuleIdentifier = aModuleIdentifier; + } + catch ( const Exception& ) + { } } } |