diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-02-12 12:01:00 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-02-13 11:26:29 +0100 |
commit | eb1799714c7f57cbb8006d33736cd5e088ed6558 (patch) | |
tree | dab601d7a23645d9f5b7c6d96cfafbb3dceae9e3 /framework | |
parent | 5691ef0b4f3d1be45f3f208db668d295013cdc9b (diff) |
cleaning the code a bit
Change-Id: I4cc9c16fb79f669ae70d10a50ace3943075edd46
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/uifactory/menubarfactory.hxx | 6 | ||||
-rw-r--r-- | framework/source/uifactory/menubarfactory.cxx | 22 | ||||
-rw-r--r-- | framework/source/uifactory/statusbarfactory.cxx | 12 | ||||
-rw-r--r-- | framework/source/uifactory/toolbarfactory.cxx | 11 |
4 files changed, 20 insertions, 31 deletions
diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index ce9ea19f8b14..ba8988d21e2b 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -23,7 +23,6 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <toolkit/awt/vclxmenu.hxx> @@ -67,11 +66,10 @@ typedef ::cppu::WeakImplHelper2< virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ); static void CreateUIElement(const OUString& ResourceURL - , const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args + ,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ,const char* _pExtraMode - ,const char* _pAsciiName + ,const OUString& ResourceType ,const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); protected: diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 3395854bae57..c5ffdfebc032 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -58,21 +58,17 @@ Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement( const Sequence< PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ) { - // SAFE - SolarMutexClearableGuard g; - MenuBarWrapper* pMenuBarWrapper = new MenuBarWrapper( m_xContext ); - Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pMenuBarWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); - g.clear(); - CreateUIElement(ResourceURL, Args, "MenuOnly", "private:resource/menubar/", xMenuBar, xModuleManager, m_xContext); + Reference< ::com::sun::star::ui::XUIElement > xMenuBar( + static_cast<OWeakObject *>(new MenuBarWrapper(m_xContext)), UNO_QUERY); + CreateUIElement(ResourceURL, Args, "MenuOnly", "private:resource/menubar/", xMenuBar, m_xContext); return xMenuBar; } + void MenuBarFactory::CreateUIElement(const OUString& ResourceURL - , const Sequence< PropertyValue >& Args + ,const Sequence< PropertyValue >& Args ,const char* _pExtraMode - ,const char* _pAsciiName + ,const OUString& ResourceType ,const Reference< ::com::sun::star::ui::XUIElement >& _xMenuBar - ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 >& _xModuleManager ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext) { Reference< XUIConfigurationManager > xCfgMgr; @@ -95,7 +91,7 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL else if ( _pExtraMode && Args[n].Name.equalsAscii( _pExtraMode )) Args[n].Value >>= bExtraMode; } - if ( aResourceURL.indexOf( OUString::createFromAscii(_pAsciiName)) != 0 ) + if (!aResourceURL.startsWith(ResourceType)) throw IllegalArgumentException(); // Identify frame and determine document based ui configuration manager/module ui configuration manager @@ -120,7 +116,9 @@ void MenuBarFactory::CreateUIElement(const OUString& ResourceURL if ( !bHasSettings ) { - OUString aModuleIdentifier = _xModuleManager->identify( xFrame ); + Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = + ModuleManager::create( _rxContext ); + OUString aModuleIdentifier = xModuleManager->identify( xFrame ); if ( !aModuleIdentifier.isEmpty() ) { Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index ac30f93cd81c..adf1673da789 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -77,14 +77,10 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement( const Sequence< PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ) { - // SAFE - SolarMutexClearableGuard g; - StatusBarWrapper* pWrapper = new StatusBarWrapper( m_xContext ); - Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create( m_xContext ); - g.clear(); - MenuBarFactory::CreateUIElement(ResourceURL, Args, NULL, "private:resource/statusbar/", xMenuBar, xModuleManager, m_xContext ); - return xMenuBar; + Reference< ::com::sun::star::ui::XUIElement > xStatusBar( + static_cast<OWeakObject *>(new StatusBarWrapper(m_xContext)), UNO_QUERY); + MenuBarFactory::CreateUIElement(ResourceURL, Args, NULL, "private:resource/statusbar/", xStatusBar, m_xContext); + return xStatusBar; } } diff --git a/framework/source/uifactory/toolbarfactory.cxx b/framework/source/uifactory/toolbarfactory.cxx index 74f856faea69..2e104b528d56 100644 --- a/framework/source/uifactory/toolbarfactory.cxx +++ b/framework/source/uifactory/toolbarfactory.cxx @@ -77,13 +77,10 @@ Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement( const Sequence< PropertyValue >& Args ) throw ( ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException ) { - SolarMutexClearableGuard g; - ToolBarWrapper* pWrapper = new ToolBarWrapper( m_xContext ); - Reference< ::com::sun::star::ui::XUIElement > xMenuBar( (OWeakObject *)pWrapper, UNO_QUERY ); - Reference< ::com::sun::star::frame::XModuleManager2 > xModuleManager = ModuleManager::create(m_xContext); - g.clear(); - CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xMenuBar, xModuleManager, m_xContext); - return xMenuBar; + Reference< ::com::sun::star::ui::XUIElement > xToolBar( + static_cast<OWeakObject *>(new ToolBarWrapper(m_xContext)), UNO_QUERY); + CreateUIElement(ResourceURL, Args, "PopupMode", "private:resource/toolbar/", xToolBar, m_xContext); + return xToolBar; } } |