diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-31 09:54:28 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-03 10:00:01 +0200 |
commit | e6c13f2846c684410e060701cbf1deb9bcaec890 (patch) | |
tree | 7c18df0ad2de8297cff389c091714b3eedd92621 /sfx2/source/sidebar | |
parent | 1f79707438d84ba639a2c601ae9d25c4647d37f6 (diff) |
fdo#46808, Convert XMultiServiceFactory to XComponentContext
Change-Id: Ice5ec3a056f7f2f5184523bda1c709ccac876736
Diffstat (limited to 'sfx2/source/sidebar')
-rw-r--r-- | sfx2/source/sidebar/ContextChangeBroadcaster.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/sidebar/ControllerFactory.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/sidebar/SidebarController.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/Tools.cxx | 40 |
5 files changed, 32 insertions, 50 deletions
diff --git a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx index 7d5dd3a86e3b..d004ce94400c 100644 --- a/sfx2/source/sidebar/ContextChangeBroadcaster.cxx +++ b/sfx2/source/sidebar/ContextChangeBroadcaster.cxx @@ -19,7 +19,7 @@ #include "sfx2/sidebar/EnumContext.hxx" #include <com/sun/star/ui/ContextChangeEventObject.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> @@ -115,10 +115,8 @@ OUString ContextChangeBroadcaster::GetModuleName (const cssu::Reference<css::fra return OUString(); try { - const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); - const Reference<frame::XModuleManager> xModuleManager ( - aContext.createComponent("com.sun.star.frame.ModuleManager" ), - UNO_QUERY_THROW ); + const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext() ); + const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xContext ); return xModuleManager->identify(rxFrame); } catch (const Exception&) diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index 4702c898fb9e..0c9d7217b735 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/frame/XToolbarController.hpp> #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XUIControllerFactory.hpp> +#include <com/sun/star/frame/ToolbarControllerFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <framework/sfxhelperfunctions.hxx> @@ -145,9 +145,8 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController( { try { - Reference<frame::XUIControllerFactory> xFactory ( - comphelper::getProcessServiceFactory()->createInstance(A2S("com.sun.star.frame.ToolbarControllerFactory")), - UNO_QUERY); + Reference<XComponentContext> xContext = comphelper::getProcessComponentContext(); + Reference<frame::XUIControllerFactory> xFactory = frame::ToolbarControllerFactory::create( xContext ); OUString sModuleName (Tools::GetModuleName(rxFrame)); if (xFactory.is() && xFactory->hasController(rsCommandName, sModuleName)) @@ -178,17 +177,12 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBarController( aPropertyVector.push_back( makeAny( aPropValue )); } - Reference<beans::XPropertySet> xFactoryProperties (comphelper::getProcessServiceFactory(), UNO_QUERY); - Reference<XComponentContext > xComponentContext; - if (xFactoryProperties.is()) - xFactoryProperties->getPropertyValue(A2S("DefaultContext")) >>= xComponentContext; - Sequence<Any> aArgs (comphelper::containerToSequence(aPropertyVector)); return Reference<frame::XToolbarController>( xFactory->createInstanceWithArgumentsAndContext( rsCommandName, aArgs, - xComponentContext), + xContext), UNO_QUERY); } } diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 96395ebd77b1..97095a30cf44 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -29,7 +29,7 @@ #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <map> @@ -598,10 +598,9 @@ void ResourceManager::StorePanelExpansionState ( { try { - const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); - const Reference<container::XNameAccess> xModuleAccess ( - aContext.createComponent("com.sun.star.frame.ModuleManager"), - UNO_QUERY_THROW); + const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext() ); + const Reference<frame::XModuleManager2> xModuleAccess = + frame::ModuleManager::create( xContext ); const ::comphelper::NamedValueCollection aModuleProperties (xModuleAccess->getByName(rsModuleName)); const ::rtl::OUString sWindowStateRef (aModuleProperties.getOrDefault( "ooSetupFactoryWindowStateConfigRef", @@ -612,7 +611,7 @@ void ResourceManager::StorePanelExpansionState ( aPathComposer.append(sWindowStateRef); aPathComposer.appendAscii("/UIElements/States"); - return ::utl::OConfigurationTreeRoot(::comphelper::getProcessComponentContext(), + return ::utl::OConfigurationTreeRoot(xContext, aPathComposer.makeStringAndClear(), false); } catch( const Exception& ) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 970e96ad5c20..da9746e204d1 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -47,7 +47,7 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/ui/ContextChangeEventMultiplexer.hpp> #include <com/sun/star/ui/ContextChangeEventObject.hpp> -#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/ui/UIElementFactoryManager.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/rendering/XSpriteCanvas.hpp> @@ -689,10 +689,9 @@ Reference<ui::XUIElement> SidebarController::CreateUIElement ( { try { - const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); - const Reference<ui::XUIElementFactory> xUIElementFactory ( - aComponentContext.createComponent("com.sun.star.ui.UIElementFactoryManager"), - UNO_QUERY_THROW); + const Reference<XComponentContext> xComponentContext (::comphelper::getProcessComponentContext() ); + const Reference<ui::XUIElementFactory> xUIElementFactory = + ui::UIElementFactoryManager::create( xComponentContext ); // Create the XUIElement. ::comphelper::NamedValueCollection aCreationArguments; diff --git a/sfx2/source/sidebar/Tools.cxx b/sfx2/source/sidebar/Tools.cxx index 62c244cd6045..6b0609ecd9f2 100644 --- a/sfx2/source/sidebar/Tools.cxx +++ b/sfx2/source/sidebar/Tools.cxx @@ -27,9 +27,9 @@ #include <vcl/gradient.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/graphic/XGraphicProvider.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> #include <cstring> @@ -80,20 +80,16 @@ Image Tools::GetImage ( } else { - const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); - const Reference<graphic::XGraphicProvider> xGraphicProvider ( - aContext.createComponent("com.sun.star.graphic.GraphicProvider"), + const Reference<XComponentContext> xContext (::comphelper::getProcessComponentContext()); + const Reference<graphic::XGraphicProvider> xGraphicProvider = + graphic::GraphicProvider::create( xContext ); + ::comphelper::NamedValueCollection aMediaProperties; + aMediaProperties.put("URL", rsURL); + const Reference<graphic::XGraphic> xGraphic ( + xGraphicProvider->queryGraphic(aMediaProperties.getPropertyValues()), UNO_QUERY); - if ( xGraphicProvider.is()) - { - ::comphelper::NamedValueCollection aMediaProperties; - aMediaProperties.put("URL", rsURL); - const Reference<graphic::XGraphic> xGraphic ( - xGraphicProvider->queryGraphic(aMediaProperties.getPropertyValues()), - UNO_QUERY); - if (xGraphic.is()) - return Image(xGraphic); - } + if (xGraphic.is()) + return Image(xGraphic); } } return Image(); @@ -158,10 +154,8 @@ util::URL Tools::GetURL (const ::rtl::OUString& rsCommand) util::URL aURL; aURL.Complete = rsCommand; - const ::comphelper::ComponentContext aComponentContext (::comphelper::getProcessServiceFactory()); - const Reference<util::XURLTransformer> xParser ( - aComponentContext.createComponent("com.sun.star.util.URLTransformer"), - UNO_QUERY_THROW); + const Reference<XComponentContext> xComponentContext (::comphelper::getProcessComponentContext()); + const Reference<util::XURLTransformer> xParser = util::URLTransformer::create( xComponentContext ); xParser->parseStrict(aURL); return aURL; @@ -190,10 +184,8 @@ Reference<frame::XDispatch> Tools::GetDispatch ( try { - const ::comphelper::ComponentContext aContext (::comphelper::getProcessServiceFactory()); - const Reference<frame::XModuleManager> xModuleManager ( - aContext.createComponent("com.sun.star.frame.ModuleManager"), - UNO_QUERY_THROW); + const Reference<XComponentContext> xComponentContext (::comphelper::getProcessComponentContext()); + const Reference<frame::XModuleManager> xModuleManager = frame::ModuleManager::create( xComponentContext ); return xModuleManager->identify(rxFrame); } catch (const Exception&) |