From 30c466d395aaa4d0516adca739dd5907607be027 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 26 Mar 2013 13:35:50 +0200 Subject: fdo#46808, convert to XComponentContext Change-Id: I51e98ac96815d6d7348d53a191400e608768d6b7 --- .../accessibility/AccessibleControlShape.cxx | 7 ++-- svx/source/dialog/srchdlg.cxx | 3 +- svx/source/form/fmdmod.cxx | 11 ++++--- svx/source/form/fmpgeimp.cxx | 8 ++--- svx/source/form/fmshimp.cxx | 3 +- svx/source/form/navigatortree.cxx | 3 +- svx/source/gallery2/galmisc.cxx | 37 ++++++++++------------ .../sdr/contact/viewobjectcontactofunocontrol.cxx | 4 +-- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index fe548111eacd..0f56193ba0d1 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -39,7 +39,6 @@ #include "svx/svdstr.hrc" #include -using namespace ::comphelper; using namespace ::accessibility; using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star::uno; @@ -123,7 +122,7 @@ AccessibleControlShape::AccessibleControlShape ( , m_bDisposeNativeContext( false ) , m_bWaitingForControl( false ) { - m_pChildManager = new OWrappedAccessibleChildrenManager( getProcessComponentContext() ); + m_pChildManager = new comphelper::OWrappedAccessibleChildrenManager( comphelper::getProcessComponentContext() ); m_pChildManager->acquire(); osl_atomic_increment( &m_refCount ); @@ -260,7 +259,7 @@ void AccessibleControlShape::Init() // ................................................................. // finally, aggregate a proxy for the control context // first a factory for the proxy - Reference< XProxyFactory > xFactory = ProxyFactory::create( comphelper::getComponentContext(getProcessServiceFactory()) ); + Reference< XProxyFactory > xFactory = ProxyFactory::create( comphelper::getProcessComponentContext() ); // then the proxy itself if ( xNativeControlContext.is() ) { @@ -438,7 +437,7 @@ Sequence< Type > SAL_CALL AccessibleControlShape::getTypes() throw (RuntimeExcep if ( m_xControlContextTypeAccess.is() ) aAggregateTypes = m_xControlContextTypeAccess->getTypes(); - Sequence< Type > aAllTypes = concatSequences( aShapeTypes, aOwnTypes, aAggregateTypes ); + Sequence< Type > aAllTypes = comphelper::concatSequences( aShapeTypes, aOwnTypes, aAggregateTypes ); // remove duplicates Type* pBegin = aAllTypes.getArray(); diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index ee4f809432ec..26dd195c3ece 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -452,9 +452,8 @@ void SvxSearchDialog::Construct_Impl() { try { - uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory(); uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider = - configuration::theDefaultProvider::get( comphelper::getComponentContext(xMgr) ); + configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() ); uno::Sequence< uno::Any > aArgs(1); OUString sPath( "/org.openoffice.Office.Common/SearchOptions/"); aArgs[0] <<= sPath; diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index 4fa6fd8455e9..e5092ebe4fb3 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -28,20 +28,21 @@ using namespace ::svxform; //----------------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& ServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvxFmMSFactory::createInstance(const OUString& rServiceSpecifier) throw( ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException ) { ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xRet; - if ( ServiceSpecifier.indexOf( "com.sun.star.form.component." ) == 0 ) + if ( rServiceSpecifier.startsWith( "com.sun.star.form.component." ) ) { - xRet = ::comphelper::getProcessServiceFactory()->createInstance(ServiceSpecifier); + css::uno::Reference xContext = comphelper::getProcessComponentContext(); + xRet = xContext->getServiceManager()->createInstanceWithContext(rServiceSpecifier, xContext); } - else if ( ServiceSpecifier == "com.sun.star.drawing.ControlShape" ) + else if ( rServiceSpecifier == "com.sun.star.drawing.ControlShape" ) { SdrObject* pObj = new FmFormObj(); xRet = static_cast(static_cast(new SvxShapeControl(pObj))); } if (!xRet.is()) - xRet = SvxUnoDrawMSFactory::createInstance(ServiceSpecifier); + xRet = SvxUnoDrawMSFactory::createInstance(rServiceSpecifier); return xRet; } diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx index 8fd082ea217b..6d46e64d705d 100644 --- a/svx/source/form/fmpgeimp.cxx +++ b/svx/source/form/fmpgeimp.cxx @@ -329,11 +329,11 @@ const Reference< XNameContainer >& FmFormPageImpl::getForms( bool _bForceCreate m_bAttemptedFormCreation = true; const OUString sFormsCollectionServiceName("com.sun.star.form.Forms"); - m_xForms = Reference< XNameContainer > ( - ::comphelper::getProcessServiceFactory()->createInstance( sFormsCollectionServiceName ), - UNO_QUERY + Reference xContext = comphelper::getProcessComponentContext(); + m_xForms.set( + xContext->getServiceManager()->createInstanceWithContext( sFormsCollectionServiceName, xContext), + UNO_QUERY_THROW ); - DBG_ASSERT( m_xForms.is(), "FmFormPageImpl::getForms: could not create a forms collection!" ); if ( m_aFormsCreationHdl.IsSet() ) { diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index bed1a3190605..013861e097eb 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1166,7 +1166,8 @@ bool FmXFormShell::executeControlConversionSlot( const Reference< XFormComponent return false; OUString sNewName( getServiceNameByControlType( nObjectTypes[ lookupSlot ] ) ); - Reference< XControlModel> xNewModel( ::comphelper::getProcessServiceFactory()->createInstance( sNewName ), UNO_QUERY ); + Reference xContext = comphelper::getProcessComponentContext(); + Reference< XControlModel> xNewModel( xContext->getServiceManager()->createInstanceWithContext(sNewName, xContext), UNO_QUERY ); if (!xNewModel.is()) return false; diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx index 248428d5805b..828054700dc4 100644 --- a/svx/source/form/navigatortree.cxx +++ b/svx/source/form/navigatortree.cxx @@ -1429,7 +1429,8 @@ namespace svxform ////////////////////////////////////////////////////////////////////// // Neue Component erzeugen - Reference< XFormComponent > xNewComponent(::comphelper::getProcessServiceFactory()->createInstance(rServiceName), UNO_QUERY); + Reference xContext = comphelper::getProcessComponentContext(); + Reference xNewComponent( xContext->getServiceManager()->createInstanceWithContext(rServiceName, xContext), UNO_QUERY); if (!xNewComponent.is()) return NULL; diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 5def7f04a440..499ab340d238 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -395,33 +395,30 @@ GalleryProgress::GalleryProgress( GraphicFilter* pFilter ) : uno::Reference< lang::XMultiServiceFactory > xMgr( ::comphelper::getProcessServiceFactory() ); - if( xMgr.is() ) - { - uno::Reference< awt::XProgressMonitor > xMonitor( xMgr->createInstance( + uno::Reference< awt::XProgressMonitor > xMonitor( xMgr->createInstance( OUString("com.sun.star.awt.XProgressMonitor") ), uno::UNO_QUERY ); - if ( xMonitor.is() ) + if ( xMonitor.is() ) + { + mxProgressBar = uno::Reference< awt::XProgressBar >( xMonitor, uno::UNO_QUERY ); + + if( mxProgressBar.is() ) { - mxProgressBar = uno::Reference< awt::XProgressBar >( xMonitor, uno::UNO_QUERY ); + String aProgressText; - if( mxProgressBar.is() ) + if( mpFilter ) { - String aProgressText; - - if( mpFilter ) - { - aProgressText = GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER); -// mpFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all -// // so I am removing this. The gallery progress should -// // be changed to use the XStatusIndicator instead of XProgressMonitor - } - else - aProgressText = String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ); - - xMonitor->addText( String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ), aProgressText, sal_False ) ; - mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE ); + aProgressText = GAL_RESSTR(RID_SVXSTR_GALLERY_FILTER); +// mpFilter->SetUpdatePercentHdl( LINK( this, GalleryProgress, Update ) ); // sj: progress wasn't working up from SO7 at all +// // so I am removing this. The gallery progress should +// // be changed to use the XStatusIndicator instead of XProgressMonitor } + else + aProgressText = String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ); + + xMonitor->addText( String( RTL_CONSTASCII_USTRINGPARAM( "Gallery" ) ), aProgressText, sal_False ) ; + mxProgressBar->setRange( 0, GALLERY_PROGRESS_RANGE ); } } } diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index 6ee13eff2d74..a798d9542a97 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -1205,8 +1205,8 @@ namespace sdr { namespace contact { { const OUString sControlServiceName( _rUnoObject.GetUnoControlTypeName() ); - Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_SET_THROW ); - _out_rControl = Reference< XControl >( xFactory->createInstance( sControlServiceName ), UNO_QUERY_THROW ); + Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + _out_rControl = Reference( xContext->getServiceManager()->createInstanceWithContext(sControlServiceName, xContext), UNO_QUERY_THROW ); // knit the model and the control _out_rControl.setModel( xControlModel ); -- cgit v1.2.3