diff options
author | Noel Grandin <noel@peralex.com> | 2013-03-08 14:06:05 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-03-20 07:32:52 +0200 |
commit | b4b0b400071a0fd12587334e3b9d615f35be671b (patch) | |
tree | bbaadae1d60fda7c1195f5dbf9c055db1b5ea029 /svx/source/xml/xmlexport.cxx | |
parent | 51a2b574bf6e163d34d2301c2b526a09cd7ff1aa (diff) |
fdo#46808, cleanup some usage of getProcessServiceFactory()
Change-Id: I2ab4c7c0a19bd436c84e62bfc6aeda1fea079a44
Diffstat (limited to 'svx/source/xml/xmlexport.cxx')
-rw-r--r-- | svx/source/xml/xmlexport.cxx | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx index aa1f57acbe82..1da4ad59aa42 100644 --- a/svx/source/xml/xmlexport.cxx +++ b/svx/source/xml/xmlexport.cxx @@ -68,13 +68,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutp pModel->setUnoModel( Reference< XInterface >::query( xSourceDoc ) ); } - uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "got no service manager" ); - bDocRet = sal_False; - } if( bDocRet ) { @@ -104,7 +98,7 @@ sal_Bool SvxDrawingLayerExport( SdrModel* pModel, const uno::Reference<io::XOutp if( xObjectResolver.is() ) aArgs[2] <<= xObjectResolver; - uno::Reference< document::XFilter > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pExportService ), aArgs ), uno::UNO_QUERY ); + uno::Reference< document::XFilter > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pExportService ), aArgs, xContext ), uno::UNO_QUERY ); if( !xFilter.is() ) { OSL_FAIL( "com.sun.star.comp.Draw.XMLExporter service missing" ); @@ -177,31 +171,23 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInpu try { // Get service factory - Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - nRet = 1; + if ( xTargetModel.is() ) + xTargetModel->lockControllers(); - if( 0 == nRet ) - { - if ( xTargetModel.is() ) - xTargetModel->lockControllers(); - - // ------------------------------------- + // ------------------------------------- - pGraphicHelper = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_READ ); - xGraphicResolver = pGraphicHelper; + pGraphicHelper = SvXMLGraphicHelper::Create( GRAPHICHELPER_MODE_READ ); + xGraphicResolver = pGraphicHelper; - ::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist(); - if( pPersist ) - { - pObjectHelper = SvXMLEmbeddedObjectHelper::Create( - *pPersist, - EMBEDDEDOBJECTHELPER_MODE_READ ); - xObjectResolver = pObjectHelper; - } + ::comphelper::IEmbeddedHelper *pPersist = pModel->GetPersist(); + if( pPersist ) + { + pObjectHelper = SvXMLEmbeddedObjectHelper::Create( + *pPersist, + EMBEDDEDOBJECTHELPER_MODE_READ ); + xObjectResolver = pObjectHelper; } // ------------------------------------- @@ -224,7 +210,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInpu *pArgs++ <<= xObjectResolver; // get filter - Reference< xml::sax::XDocumentHandler > xFilter( xServiceFactory->createInstanceWithArguments( OUString::createFromAscii( pImportService ), aFilterArgs), UNO_QUERY ); + Reference< xml::sax::XDocumentHandler > xFilter( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( OUString::createFromAscii( pImportService ), aFilterArgs, xContext), UNO_QUERY ); DBG_ASSERT( xFilter.is(), "Can't instantiate filter component." ); nRet = 1; |