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 | |
parent | 51a2b574bf6e163d34d2301c2b526a09cd7ff1aa (diff) |
fdo#46808, cleanup some usage of getProcessServiceFactory()
Change-Id: I2ab4c7c0a19bd436c84e62bfc6aeda1fea079a44
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/sdrpagewindow.cxx | 29 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 6 | ||||
-rw-r--r-- | svx/source/svdraw/svdouno.cxx | 8 | ||||
-rw-r--r-- | svx/source/xml/xmlexport.cxx | 42 |
4 files changed, 34 insertions, 51 deletions
diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 2c55ea66cfe2..f89fdfad2fae 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -78,22 +78,19 @@ using namespace ::com::sun::star; { // Printer and VirtualDevice, or rather: no OutDev uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if( xFactory.is() ) - { - const_cast< SdrPageWindow* >( this )->mxControlContainer = uno::Reference< awt::XControlContainer >(xFactory->createInstance(rtl::OUString("com.sun.star.awt.UnoControlContainer")), uno::UNO_QUERY); - uno::Reference< awt::XControlModel > xModel(xFactory->createInstance(rtl::OUString("com.sun.star.awt.UnoControlContainerModel")), uno::UNO_QUERY); - uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY); - if (xControl.is()) - xControl->setModel(xModel); - - OutputDevice& rOutDev = rPaintWindow.GetOutputDevice(); - Point aPosPix = rOutDev.GetMapMode().GetOrigin(); - Size aSizePix = rOutDev.GetOutputSizePixel(); - - uno::Reference< awt::XWindow > xContComp(mxControlContainer, uno::UNO_QUERY); - if( xContComp.is() ) - xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE); - } + const_cast< SdrPageWindow* >( this )->mxControlContainer = uno::Reference< awt::XControlContainer >(xFactory->createInstance(rtl::OUString("com.sun.star.awt.UnoControlContainer")), uno::UNO_QUERY); + uno::Reference< awt::XControlModel > xModel(xFactory->createInstance(rtl::OUString("com.sun.star.awt.UnoControlContainerModel")), uno::UNO_QUERY); + uno::Reference< awt::XControl > xControl(mxControlContainer, uno::UNO_QUERY); + if (xControl.is()) + xControl->setModel(xModel); + + OutputDevice& rOutDev = rPaintWindow.GetOutputDevice(); + Point aPosPix = rOutDev.GetMapMode().GetOrigin(); + Size aSizePix = rOutDev.GetOutputSizePixel(); + + uno::Reference< awt::XWindow > xContComp(mxControlContainer, uno::UNO_QUERY); + if( xContComp.is() ) + xContComp->setPosSize(aPosPix.X(), aPosPix.Y(), aSizePix.Width(), aSizePix.Height(), awt::PosSize::POSSIZE); } FmFormView* pViewAsFormView = dynamic_cast< FmFormView* >( &rView ); diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 1bba0f7e9a57..170c4e27289f 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -415,19 +415,19 @@ Reference< XCustomShapeEngine > SdrObjCustomShape::GetCustomShapeEngine() const if ( !aEngine.Len() ) aEngine = String( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) ); - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); Reference< XShape > aXShape = GetXShapeForSdrObject(const_cast<SdrObjCustomShape*>(this)); if ( aXShape.is() ) { - if ( aEngine.Len() && xFactory.is() ) + if ( aEngine.Len() ) { Sequence< Any > aArgument( 1 ); Sequence< PropertyValue > aPropValues( 1 ); aPropValues[ 0 ].Name = rtl::OUString("CustomShape"); aPropValues[ 0 ].Value <<= aXShape; aArgument[ 0 ] <<= aPropValues; - Reference< XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) ); + Reference< XInterface > xInterface( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( aEngine, aArgument, xContext ) ); if ( xInterface.is() ) mxCustomShapeEngine = Reference< XCustomShapeEngine >( xInterface, UNO_QUERY ); } diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx index daa6c07aab37..f9f2ca7b689b 100644 --- a/svx/source/svdraw/svdouno.cxx +++ b/svx/source/svdraw/svdouno.cxx @@ -485,11 +485,11 @@ void SdrUnoObj::CreateUnoControlModel(const String& rModelName) aUnoControlModelTypeName = rModelName; uno::Reference< awt::XControlModel > xModel; - uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - if (aUnoControlModelTypeName.Len() && xFactory.is() ) + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + if (aUnoControlModelTypeName.Len() ) { - xModel = uno::Reference< awt::XControlModel >(xFactory->createInstance( - aUnoControlModelTypeName), uno::UNO_QUERY); + xModel = uno::Reference< awt::XControlModel >(xContext->getServiceManager()->createInstanceWithContext( + aUnoControlModelTypeName, xContext), uno::UNO_QUERY); if (xModel.is()) SetChanged(); 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; |