diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-26 13:53:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-04 16:57:55 +0200 |
commit | b3c76dee6d44d07eae404b8d7341e6c88e6c4429 (patch) | |
tree | c747dd5bddf94c3b4312c7b1861a5087e76e71d6 /sd | |
parent | eb68bf18f2d859486c4a737abb2536a6afe45411 (diff) |
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 <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'sd')
-rw-r--r-- | sd/CppunitTest_sd_filters_test.mk | 1 | ||||
-rw-r--r-- | sd/source/filter/grf/sdgrffilter.cxx | 8 | ||||
-rw-r--r-- | sd/source/filter/html/buttonset.cxx | 16 | ||||
-rw-r--r-- | sd/source/ui/dlg/TemplateScanner.cxx | 21 |
4 files changed, 14 insertions, 32 deletions
diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk index 82512dc9f545..6afe52d4d79d 100644 --- a/sd/CppunitTest_sd_filters_test.mk +++ b/sd/CppunitTest_sd_filters_test.mk @@ -99,6 +99,7 @@ $(eval $(call gb_CppunitTest_use_components,sd_filters_test,\ sd/util/sdfilt \ sfx2/util/sfx \ sot/util/sot \ + svtools/util/svt \ toolkit/util/tk \ ucb/source/core/ucb1 \ ucb/source/ucp/file/ucpfile1 \ diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index 1db89b3cbaac..2ad8a7abafdb 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -30,8 +30,10 @@ #ifdef _MSC_VER #pragma warning (disable:4190) #endif +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/graphic/GraphicType.hpp> +#include <com/sun/star/ucb/SimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess2.hpp> #include <unotools/localfilehelper.hxx> @@ -381,9 +383,9 @@ void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< ::com::su { try { - Reference< XMultiServiceFactory > xSM( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - Reference< XGraphicProvider > xProvider( xSM->createInstance( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW ); + Reference< XGraphicProvider > xProvider( GraphicProvider::create(xContext) ); Reference< XPropertySet > xShapeSet( xShape, UNO_QUERY_THROW ); // detect mime type of graphic @@ -523,7 +525,7 @@ void SdGRFFilter::SaveGraphic( const ::com::sun::star::uno::Reference< ::com::su if( xGraphStream.is() ) { - Reference< XSimpleFileAccess2 > xFileAccess( xSM->createInstance("com.sun.star.ucb.SimpleFileAccess" ), UNO_QUERY_THROW ); + Reference< XSimpleFileAccess2 > xFileAccess( SimpleFileAccess::create(xContext) ); xFileAccess->writeFile( sPath, xGraphStream ); } else diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx index b819e302d0b2..a22748ca6e01 100644 --- a/sd/source/filter/html/buttonset.cxx +++ b/sd/source/filter/html/buttonset.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <osl/file.hxx> @@ -261,19 +262,8 @@ Reference< XGraphicProvider > ButtonSetImpl::getGraphicProvider() { if( !mxGraphicProvider.is() ) { - Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory() ); - if( xServiceManager.is() ) try - { - Reference< XGraphicProvider > xGraphProvider( - xServiceManager->createInstance( - ::rtl::OUString( "com.sun.star.graphic.GraphicProvider" ) ), UNO_QUERY_THROW ); - - mxGraphicProvider = xGraphProvider; - } - catch( Exception& ) - { - OSL_FAIL("sd::ButtonSetImpl::getGraphicProvider(), could not get graphic provider!"); - } + Reference< XComponentContext > xComponentContext = ::comphelper::getProcessComponentContext(); + mxGraphicProvider = GraphicProvider::create(xComponentContext); } return mxGraphicProvider; } diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index a98fa13b3e4d..c9e93c17f995 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -30,6 +30,7 @@ #include "TemplateScanner.hxx" #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/documentconstants.hxx> #include <comphelper/string.hxx> @@ -38,6 +39,7 @@ #include <vcl/svapp.hxx> #include <sfx2/doctempl.hxx> #include <sfx2/templatelocnames.hrc> +#include <com/sun/star/frame/DocumentTemplates.hpp> #include <com/sun/star/frame/XDocumentTemplates.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp> @@ -219,22 +221,9 @@ TemplateScanner::State TemplateScanner::GetTemplateRoot (void) { State eNextState (INITIALIZE_FOLDER_SCANNING); - Reference<lang::XMultiServiceFactory> xFactory = ::comphelper::getProcessServiceFactory (); - DBG_ASSERT (xFactory.is(), "TemplateScanner::GetTemplateRoot: xFactory is NULL"); - - if (xFactory.is()) - { - Reference<frame::XDocumentTemplates> xTemplates ( - xFactory->createInstance (rtl::OUString(DOCTEMPLATES)), UNO_QUERY); - DBG_ASSERT (xTemplates.is(), "TemplateScanner::GetTemplateRoot: xTemplates is NULL"); - - if (xTemplates.is()) - mxTemplateRoot = xTemplates->getContent(); - else - eNextState = ERROR; - } - else - eNextState = ERROR; + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + Reference<frame::XDocumentTemplates> xTemplates = frame::DocumentTemplates::create(xContext); + mxTemplateRoot = xTemplates->getContent(); return eNextState; } |