From b3c76dee6d44d07eae404b8d7341e6c88e6c4429 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 26 May 2012 13:53:19 +0200 Subject: fdo#46808, Adapt UNO services to new style, Part 7, updating ::create Update calls to factories to use new ::create methods Change-Id: I01d4417820f52718836c92faf3c2fae0dc96b30d Signed-off-by: Stephan Bergmann , added some tweaks. --- desktop/source/deployment/registry/package/dp_package.cxx | 10 +++------- desktop/source/migration/migration.cxx | 12 +++++++----- 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'desktop') diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 4e7f8e8403a6..3a520ebf738c 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -47,6 +47,7 @@ #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/beans/UnknownPropertyException.hpp" #include "com/sun/star/graphic/XGraphic.hpp" +#include "com/sun/star/graphic/GraphicProvider.hpp" #include "com/sun/star/graphic/XGraphicProvider.hpp" #include "com/sun/star/io/XOutputStream.hpp" #include "com/sun/star/io/XInputStream.hpp" @@ -835,18 +836,13 @@ uno::Reference< graphic::XGraphic > BackendImpl::PackageImpl::getIcon( sal_Bool OUString aFullIconURL = m_url_expanded + OUSTR("/") + aIconURL; uno::Reference< XComponentContext > xContext( getMyBackend()->getComponentContext() ); - uno::Reference< graphic::XGraphicProvider > xGraphProvider( - xContext->getServiceManager()->createInstanceWithContext( OUSTR( "com.sun.star.graphic.GraphicProvider" ), xContext ), - uno::UNO_QUERY ); + uno::Reference< graphic::XGraphicProvider > xGraphProvider( graphic::GraphicProvider::create(xContext) ); - if ( xGraphProvider.is() ) - { uno::Sequence< beans::PropertyValue > aMediaProps( 1 ); aMediaProps[0].Name = OUSTR( "URL" ); aMediaProps[0].Value <<= aFullIconURL; - xGraphic = xGraphProvider->queryGraphic( aMediaProps ); - } + xGraphic = xGraphProvider->queryGraphic( aMediaProps ); } return xGraphic; diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index 583edec17049..88bf8c54f393 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -35,6 +35,7 @@ #include "migration_impl.hxx" #include +#include #include #include #include @@ -57,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -272,10 +274,9 @@ sal_Bool MigrationImpl::doMigration() lArgs[0] <<= aOldCfgDataPath + vModulesInfo[i].sModuleShortName; lArgs[1] <<= embed::ElementModes::READ; - uno::Reference< lang::XSingleServiceFactory > xStorageFactory(m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.FileSystemStorageFactory"))), uno::UNO_QUERY); - uno::Reference< embed::XStorage > xModules; - - xModules = uno::Reference< embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); + uno::Reference< lang::XSingleServiceFactory > xStorageFactory( + embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext())); + uno::Reference< embed::XStorage > xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); uno::Reference< ui::XUIConfigurationManager > xOldCfgManager( m_xFactory->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager"))), uno::UNO_QUERY ); uno::Reference< ui::XUIConfigurationStorage > xOldCfgStorage( xOldCfgManager, uno::UNO_QUERY ); uno::Reference< ui::XUIConfigurationPersistence > xOldCfgPersistence( xOldCfgManager, uno::UNO_QUERY ); @@ -996,7 +997,8 @@ void MigrationImpl::runServices() lArgs[0] <<= m_aInfo.userdata + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/user/config/soffice.cfg/modules")); lArgs[1] <<= embed::ElementModes::READ; - uno::Reference< lang::XSingleServiceFactory > xStorageFactory(m_xFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.FileSystemStorageFactory"))), uno::UNO_QUERY); + uno::Reference< lang::XSingleServiceFactory > xStorageFactory( + embed::FileSystemStorageFactory::create(comphelper::ComponentContext(m_xFactory).getUNOContext())); uno::Reference< embed::XStorage > xModules; xModules = uno::Reference< embed::XStorage >(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); -- cgit