diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-04 13:20:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:43 +0200 |
commit | a6a8a8707b6ae111f94bac094d3c2909f523ca6f (patch) | |
tree | 402b668480b3106df0d3055cff037c8a768a419c | |
parent | f1204419af34b1d2f0ecaa69ceeb1f8c8a7d87df (diff) |
fdo#46808, convert xmloff module code to use XComponentContext
with lots of repurcussions in other modules
Change-Id: I6982671eecc701b06cf85d93533e1fe618044fea
48 files changed, 163 insertions, 214 deletions
diff --git a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx index 5afe4c9a86f7..67f2dd8db641 100644 --- a/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx +++ b/dbaccess/source/filter/xml/xmlFileBasedDatabase.cxx @@ -100,7 +100,7 @@ OXMLFileBasedDatabase::OXMLFileBasedDatabase( ODBFilter& rImport, } if ( !(sLocation.isEmpty() || sMediaType.isEmpty()) ) { - ::dbaccess::ODsnTypeCollection aTypeCollection(comphelper::getComponentContext(rImport.getServiceFactory())); + ::dbaccess::ODsnTypeCollection aTypeCollection(rImport.GetComponentContext()); ::rtl::OUString sURL(aTypeCollection.getDatasourcePrefixFromMediaType(sMediaType,sFileTypeExtension)); sURL += sLocation; try diff --git a/dbaccess/source/filter/xml/xmlTable.cxx b/dbaccess/source/filter/xml/xmlTable.cxx index ca8ffd19ead7..994d1cfaddb8 100644 --- a/dbaccess/source/filter/xml/xmlTable.cxx +++ b/dbaccess/source/filter/xml/xmlTable.cxx @@ -99,7 +99,9 @@ OXMLTable::OXMLTable( ODBFilter& _rImport aValue.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Parent")); aValue.Value <<= m_xParentContainer; aArguments[1] <<= aValue; - m_xTable.set(GetOwnImport().getServiceFactory()->createInstanceWithArguments(m_sServiceName,aArguments),UNO_QUERY); + m_xTable.set( + GetOwnImport().GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext(m_sServiceName,aArguments, GetOwnImport().GetComponentContext()), + UNO_QUERY); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 0187a0b2158d..183d58b6abc9 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -357,8 +357,8 @@ sal_Int32 ReadThroughComponent( // ------------- DBG_NAME(ODBFilter) -ODBFilter::ODBFilter( const uno::Reference< XMultiServiceFactory >& _rxMSF ) - :SvXMLImport(_rxMSF) +ODBFilter::ODBFilter( const uno::Reference< XComponentContext >& _rxContext ) + :SvXMLImport(_rxContext) ,m_bNewFormat(false) { DBG_CTOR(ODBFilter,NULL); @@ -382,7 +382,16 @@ ODBFilter::~ODBFilter() throw() DBG_DTOR(ODBFilter,NULL); } // ----------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO1_STATIC( ODBFilter, "com.sun.star.comp.sdb.DBFilter", "com.sun.star.document.ImportFilter") +IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(ODBFilter, "com.sun.star.comp.sdb.DBFilter") +IMPLEMENT_SERVICE_INFO_SUPPORTS(ODBFilter) +IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(ODBFilter, "com.sun.star.document.ImportFilter") + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + SAL_CALL ODBFilter::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) +{ + return static_cast< XServiceInfo* >(new ODBFilter( comphelper::getComponentContext(_rxORB))); +} + // ----------------------------------------------------------------------------- sal_Bool SAL_CALL ODBFilter::filter( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException) @@ -446,7 +455,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) uno::Reference<sdb::XOfficeDatabaseDocument> xOfficeDoc(GetModel(),UNO_QUERY_THROW); m_xDataSource.set(xOfficeDoc->getDataSource(),UNO_QUERY_THROW); - uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener( comphelper::getComponentContext(getServiceFactory())); + uno::Reference<beans::XPropertyChangeListener> xListener = new DatasourceURLListener( GetComponentContext()); m_xDataSource->addPropertyChangeListener(PROPERTY_URL,xListener); uno::Reference< XNumberFormatsSupplier > xNum(m_xDataSource->getPropertyValue(PROPERTY_NUMBERFORMATSSUPPLIER),UNO_QUERY); SetNumberFormatsSupplier(xNum); @@ -456,7 +465,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"settings.xml" ,"Settings.xml" - ,comphelper::getComponentContext(getServiceFactory()) + ,GetComponentContext() ,this ); @@ -465,7 +474,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"content.xml" ,"Content.xml" - ,comphelper::getComponentContext(getServiceFactory()) + ,GetComponentContext() ,this ); @@ -871,7 +880,7 @@ void ODBFilter::setPropertyInfo() if ( !xDataSource.is() ) return; - ::connectivity::DriversConfig aDriverConfig(comphelper::getComponentContext(getServiceFactory())); + ::connectivity::DriversConfig aDriverConfig(GetComponentContext()); const ::rtl::OUString sURL = ::comphelper::getString(xDataSource->getPropertyValue(PROPERTY_URL)); ::comphelper::NamedValueCollection aDataSourceSettings = aDriverConfig.getProperties( sURL ); diff --git a/dbaccess/source/filter/xml/xmlfilter.hxx b/dbaccess/source/filter/xml/xmlfilter.hxx index 4b8303667aa4..1b9e65595ab2 100644 --- a/dbaccess/source/filter/xml/xmlfilter.hxx +++ b/dbaccess/source/filter/xml/xmlfilter.hxx @@ -112,7 +112,7 @@ protected: virtual ~ODBFilter() throw(); public: - ODBFilter( const Reference< XMultiServiceFactory >& _rxMSF ); + ODBFilter( const Reference< XComponentContext >& _rxContext ); // XFilter virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException); diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.cxx b/editeng/source/misc/SvXMLAutoCorrectImport.cxx index 2cedfc2c20f3..5d8fc09fea3d 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.cxx @@ -28,11 +28,11 @@ using namespace ::rtl; const char aBlockList[] = "_block-list"; SvXMLAutoCorrectImport::SvXMLAutoCorrectImport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SvxAutocorrWordList *pNewAutocorr_List, SvxAutoCorrect &rNewAutoCorrect, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rNewStorage) -: SvXMLImport( xServiceFactory ), +: SvXMLImport( xContext ), pAutocorr_List (pNewAutocorr_List), rAutoCorrect ( rNewAutoCorrect ), xStorage ( rNewStorage ) @@ -143,9 +143,9 @@ SvXMLWordContext::~SvXMLWordContext ( void ) } SvXMLExceptionListImport::SvXMLExceptionListImport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SvStringsISortDtor & rNewList ) -: SvXMLImport( xServiceFactory ), +: SvXMLImport( xContext ), rList (rNewList) { GetNamespaceMap().Add( diff --git a/editeng/source/misc/SvXMLAutoCorrectImport.hxx b/editeng/source/misc/SvXMLAutoCorrectImport.hxx index 2c423fd7d548..106ea4023c29 100644 --- a/editeng/source/misc/SvXMLAutoCorrectImport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectImport.hxx @@ -42,7 +42,7 @@ public: com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xStorage; SvXMLAutoCorrectImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SvxAutocorrWordList *pNewAutocorr_List, SvxAutoCorrect &rNewAutoCorrect, const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rNewStorage); @@ -95,7 +95,7 @@ public: SvStringsISortDtor &rList; SvXMLExceptionListImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SvStringsISortDtor & rNewList ); ~SvXMLExceptionListImport ( void ) throw (); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index ccc0f4eed2b5..f311fa6523af 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -1961,14 +1961,8 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( } else { - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - OSL_ENSURE( xServiceFactory.is(), - "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } + uno::Reference< uno::XComponentContext > xContext = + comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; aParserInput.sSystemId = sStrmName; @@ -1978,10 +1972,10 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( aParserInput.aInputStream = new utl::OInputStreamWrapper( *xStrm ); // get filter - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( xServiceFactory, *rpLst ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( xContext, *rpLst ); // connect parser and filter - uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(xServiceFactory) ); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); xParser->setDocumentHandler( xFilter ); // parse @@ -2083,7 +2077,6 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() uno::Reference < embed::XStorage > xStg = comphelper::OStorageHelper::GetStorageFromURL( sShareAutoCorrFile, embed::ElementModes::READ ); String aXMLWordListName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 ); uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; @@ -2093,7 +2086,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList() // get parser uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "AutoCorrect Import" ); - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xContext, pAutocorr_List, rAutoCorrect, xStg ); // connect parser and filter xParser->setDocumentHandler( xFilter ); diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index c70d389370a4..128e9b4316ef 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -109,7 +109,7 @@ class SvxXMLXTextImportComponent : public SvXMLImport { public: SvxXMLXTextImportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const uno::Reference< XText > & xText ); virtual ~SvxXMLXTextImportComponent() throw (); @@ -125,9 +125,9 @@ private: // -------------------------------------------------------------------- SvxXMLXTextImportComponent::SvxXMLXTextImportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const uno::Reference< XText > & xText ) -: SvXMLImport(xServiceFactory), +: SvXMLImport(xContext), mxText( xText ) { GetTextImport()->SetCursor( mxText->createTextCursor() ); @@ -160,13 +160,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r { do { - uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" ); - break; - } uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); @@ -206,7 +200,7 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r */ // uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xText ) ); - uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xServiceFactory, xText ) ); + uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTextImportComponent( xContext, xText ) ); xParser->setDocumentHandler( xHandler ); diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx index 6d958e8dc8ee..b21c6cfb820e 100644 --- a/linguistic/source/convdicxml.hxx +++ b/linguistic/source/convdicxml.hxx @@ -87,7 +87,7 @@ public: //!! see comment for pDic member ConvDicXMLImport( ConvDic *pConvDic, const rtl::OUString /*&rFileName*/ ) : - SvXMLImport ( comphelper::getProcessServiceFactory(), IMPORT_ALL ), + SvXMLImport ( comphelper::getProcessComponentContext(), IMPORT_ALL ), pDic ( pConvDic ) { nLanguage = LANGUAGE_NONE; diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx b/reportdesign/source/filter/xml/xmlFixedContent.cxx index 06273c372d50..1bcc317c51f5 100644 --- a/reportdesign/source/filter/xml/xmlFixedContent.cxx +++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx @@ -141,7 +141,7 @@ SvXMLImportContext* OXMLFixedContent::_CreateChildContext( static const ::rtl::OUString s_sStringConcat(RTL_CONSTASCII_USTRINGPARAM(" & ")); const SvXMLTokenMap& rTokenMap = m_rImport.GetCellElemTokenMap(); - Reference<XMultiServiceFactory> xFactor = m_rImport.getServiceFactory(); + Reference<XComponentContext> xContext = m_rImport.GetComponentContext(); m_rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); const sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName ); diff --git a/reportdesign/source/filter/xml/xmlSection.cxx b/reportdesign/source/filter/xml/xmlSection.cxx index ca5419dc8299..23870a685d9f 100644 --- a/reportdesign/source/filter/xml/xmlSection.cxx +++ b/reportdesign/source/filter/xml/xmlSection.cxx @@ -116,12 +116,11 @@ SvXMLImportContext* OXMLSection::CreateChildContext( SvXMLImportContext *pContext = 0; ORptFilter& rImport = GetOwnImport(); const SvXMLTokenMap& rTokenMap = rImport.GetSectionElemTokenMap(); - uno::Reference<lang::XMultiServiceFactory> xFactor = rImport.getServiceFactory(); switch( rTokenMap.Get( _nPrefix, _rLocalName ) ) { case XML_TOK_TABLE: - pContext = new OXMLTable( rImport, _nPrefix, _rLocalName,xAttrList,m_xSection); + pContext = new OXMLTable( rImport, _nPrefix, _rLocalName, xAttrList, m_xSection); break; default: break; diff --git a/reportdesign/source/filter/xml/xmlTable.cxx b/reportdesign/source/filter/xml/xmlTable.cxx index f79deceac6cc..c908e9278229 100644 --- a/reportdesign/source/filter/xml/xmlTable.cxx +++ b/reportdesign/source/filter/xml/xmlTable.cxx @@ -130,7 +130,6 @@ SvXMLImportContext* OXMLTable::CreateChildContext( SvXMLImportContext *pContext = 0; ORptFilter& rImport = GetOwnImport(); const SvXMLTokenMap& rTokenMap = rImport.GetColumnTokenMap(); - Reference<XMultiServiceFactory> xFactor = rImport.getServiceFactory(); switch( rTokenMap.Get( _nPrefix, _rLocalName ) ) { diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index 1279e7386f93..2854a66ee6f4 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -211,7 +211,7 @@ sal_Int32 ReadThroughComponent( const uno::Reference<XComponent>& xModelComponent, const sal_Char* pStreamName, const sal_Char* pCompatibilityStreamName, - const uno::Reference<XMultiServiceFactory> & rFactory, + const uno::Reference<XComponentContext> & rxContext, const Reference< document::XGraphicObjectResolver > & _xGraphicObjectResolver, const Reference<document::XEmbeddedObjectResolver>& _xEmbeddedObjectResolver, const ::rtl::OUString& _sFilterName @@ -278,14 +278,14 @@ sal_Int32 ReadThroughComponent( aFilterCompArgs[ nArgs++ ] <<= _xProp; Reference< xml::sax::XDocumentHandler > xDocHandler( - rFactory->createInstanceWithArguments( _sFilterName, aFilterCompArgs ), + rxContext->getServiceManager()->createInstanceWithArgumentsAndContext(_sFilterName, aFilterCompArgs, rxContext), uno::UNO_QUERY_THROW ); uno::Reference< XInputStream > xInputStream = xDocStream->getInputStream(); // read from the stream return ReadThroughComponent( xInputStream ,xModelComponent ,pStreamName - ,comphelper::getComponentContext(rFactory) + ,rxContext ,xDocHandler ,bEncrypted ); } @@ -297,7 +297,7 @@ sal_Int32 ReadThroughComponent( //--------------------------------------------------------------------- uno::Reference< uno::XInterface > ORptImportHelper::create(uno::Reference< uno::XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),IMPORT_SETTINGS )); + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_SETTINGS )); } //--------------------------------------------------------------------- ::rtl::OUString ORptImportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -314,7 +314,7 @@ Sequence< ::rtl::OUString > ORptImportHelper::getSupportedServiceNames_Static( //--------------------------------------------------------------------- Reference< XInterface > ORptContentImportHelper::create(const Reference< XComponentContext > & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS | + return static_cast< XServiceInfo* >(new ORptFilter(xContext,IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS | IMPORT_FONTDECLS )); } //--------------------------------------------------------------------- @@ -333,7 +333,7 @@ Sequence< ::rtl::OUString > ORptContentImportHelper::getSupportedServiceNames_St //--------------------------------------------------------------------- Reference< XInterface > ORptStylesImportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY), + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_STYLES | IMPORT_MASTERSTYLES | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS )); } @@ -353,7 +353,7 @@ Sequence< ::rtl::OUString > ORptStylesImportHelper::getSupportedServiceNames_Sta //--------------------------------------------------------------------- Reference< XInterface > ORptMetaImportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptFilter(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY), + return static_cast< XServiceInfo* >(new ORptFilter(xContext, IMPORT_META)); } //--------------------------------------------------------------------- @@ -373,8 +373,8 @@ Sequence< ::rtl::OUString > ORptMetaImportHelper::getSupportedServiceNames_Stati // - ORptFilter - // ------------- DBG_NAME(rpt_ORptFilter) -ORptFilter::ORptFilter( const uno::Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nImportFlags ) - :SvXMLImport(_rxMSF,nImportFlags) +ORptFilter::ORptFilter( const uno::Reference< XComponentContext >& _rxContext,sal_uInt16 nImportFlags ) + :SvXMLImport(_rxContext,nImportFlags) { DBG_CTOR(rpt_ORptFilter,NULL); GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_100TH); @@ -403,7 +403,7 @@ ORptFilter::~ORptFilter() throw() //------------------------------------------------------------------------------ uno::Reference< XInterface > ORptFilter::create(uno::Reference< XComponentContext > const & xContext) { - return *(new ORptFilter(uno::Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))); + return *(new ORptFilter(xContext)); } // ----------------------------------------------------------------------------- @@ -527,19 +527,17 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) Reference< document::XGraphicObjectResolver > xGraphicObjectResolver; uno::Reference<document::XEmbeddedObjectResolver> xEmbeddedObjectResolver; - uno::Reference< lang::XMultiServiceFactory > xServiceFactory( getServiceFactory(), uno::UNO_QUERY); - if( xServiceFactory.is()) - { - uno::Sequence< uno::Any > aArgs(1); - aArgs[0] <<= xStorage; - xGraphicObjectResolver.set( - xServiceFactory->createInstanceWithArguments( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Svx.GraphicImportHelper")), aArgs ), uno::UNO_QUERY ); - - uno::Reference< lang::XMultiServiceFactory > xReportServiceFactory( m_xReportDefinition, uno::UNO_QUERY); - aArgs[0] <<= beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(xStorage)); - xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),aArgs) , uno::UNO_QUERY); - } + uno::Reference< uno::XComponentContext > xContext = GetComponentContext(); + + uno::Sequence< uno::Any > aArgs(1); + aArgs[0] <<= xStorage; + xGraphicObjectResolver.set( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Svx.GraphicImportHelper", aArgs, xContext), + uno::UNO_QUERY ); + + uno::Reference< lang::XMultiServiceFactory > xReportServiceFactory( m_xReportDefinition, uno::UNO_QUERY); + aArgs[0] <<= beans::NamedValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage")),uno::makeAny(xStorage)); + xEmbeddedObjectResolver.set( xReportServiceFactory->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.document.ImportEmbeddedObjectResolver")),aArgs) , uno::UNO_QUERY); static const ::rtl::OUString s_sOld(RTL_CONSTASCII_USTRINGPARAM("OldFormat")); static comphelper::PropertyMapEntry pMap[] = @@ -566,7 +564,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"meta.xml" ,"Meta.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_METAIMPORTER @@ -590,7 +588,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"settings.xml" ,"Settings.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_SETTINGSIMPORTER @@ -604,7 +602,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"styles.xml" ,"Styles.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_STYLESIMPORTER @@ -618,7 +616,7 @@ sal_Bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) ,xModel ,"content.xml" ,"Content.xml" - ,getServiceFactory() + ,GetComponentContext() ,xGraphicObjectResolver ,xEmbeddedObjectResolver ,SERVICE_CONTENTIMPORTER diff --git a/reportdesign/source/filter/xml/xmlfilter.hxx b/reportdesign/source/filter/xml/xmlfilter.hxx index bb597deaeef1..c2327d2c8883 100644 --- a/reportdesign/source/filter/xml/xmlfilter.hxx +++ b/reportdesign/source/filter/xml/xmlfilter.hxx @@ -120,7 +120,7 @@ protected: virtual ~ORptFilter() throw(); public: - ORptFilter( const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nImportFlags = IMPORT_ALL ); + ORptFilter( const Reference< XComponentContext >& _rxContext, sal_uInt16 nImportFlags = IMPORT_ALL ); // XFilter virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& rDescriptor ) throw(RuntimeException); @@ -135,7 +135,7 @@ public: static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); - inline Reference< XMultiServiceFactory > getORB() { return SvXMLImport::getServiceFactory(); } + inline Reference< XComponentContext > getORB() { return SvXMLImport::GetComponentContext(); } inline Reference<XReportDefinition> getReportDefinition() const { return m_xReportDefinition; } /** return the SdrModel of the real model * diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index bd5fd4de8010..d587bf13f5b2 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -121,7 +121,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance( { // #110680# // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL); - return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_ALL ); + return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_ALL ); } OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw() @@ -140,7 +140,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance( { // #110680# // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META); - return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_META ); + return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META ); } OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw() @@ -159,7 +159,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance( { // #110680# // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS); - return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS); + return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS); } OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw() @@ -178,7 +178,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance( { // #110680# // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS); - return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS); + return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS); } OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw() @@ -197,7 +197,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance( { // #110680# // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_SETTINGS); - return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_SETTINGS ); + return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_SETTINGS ); } const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap() @@ -1922,11 +1922,10 @@ SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix, return pContext; } -// #110680# ScXMLImport::ScXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const sal_uInt16 nImportFlag) -: SvXMLImport( xServiceFactory, nImportFlag ), +: SvXMLImport( xContext, nImportFlag ), pDoc( NULL ), pChangeTrackingImportHelper(NULL), pStylesImportHelper(NULL), diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index 09a3639a6cf0..2d8201d097e2 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -927,7 +927,7 @@ protected: public: // #110680# ScXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const sal_uInt16 nImportFlag); ~ScXMLImport() throw(); diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 8a4f3a0a7aff..3d730eb63d80 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -413,9 +413,9 @@ sal_uLong SmXMLImportWrapper::ReadThroughComponent( //////////////////////////////////////////////////////////// SmXMLImport::SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, sal_uInt16 nImportFlags) -: SvXMLImport( xServiceFactory, nImportFlags ), +: SvXMLImport( xContext, nImportFlags ), pPresLayoutElemTokenMap(0), pPresLayoutAttrTokenMap(0), pFencedAttrTokenMap(0), @@ -456,7 +456,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLImport_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLImport(rSMgr, IMPORT_ALL); + return (cppu::OWeakObject*)new SmXMLImport(comphelper::getComponentContext(rSMgr), IMPORT_ALL); } //////////////////////////////////////////////////////////// @@ -478,7 +478,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLImportMeta_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_META ); + return (cppu::OWeakObject*)new SmXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META ); } //////////////////////////////////////////////////////////// @@ -500,7 +500,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLImportSettings_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLImport( rSMgr, IMPORT_SETTINGS ); + return (cppu::OWeakObject*)new SmXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_SETTINGS ); } //////////////////////////////////////////////////////////// diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx index 00405e1622a5..3e3c45092865 100644 --- a/starmath/source/mathmlimport.hxx +++ b/starmath/source/mathmlimport.hxx @@ -87,7 +87,7 @@ class SmXMLImport : public SvXMLImport public: SmXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, sal_uInt16 nImportFlags=IMPORT_ALL); virtual ~SmXMLImport() throw (); diff --git a/svx/source/inc/xmlxtimp.hxx b/svx/source/inc/xmlxtimp.hxx index f6a739a95c24..ab055910ae2a 100644 --- a/svx/source/inc/xmlxtimp.hxx +++ b/svx/source/inc/xmlxtimp.hxx @@ -36,7 +36,7 @@ class SvxXMLXTableImport : public SvXMLImport public: // #110680# SvxXMLXTableImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > & rTable, com::sun::star::uno::Reference< com::sun::star::document::XGraphicObjectResolver >& xGrfResolver); diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index ae81d1541ae5..c7f638352685 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -328,10 +328,10 @@ void SvxXMLTableImportContext::importBitmap( sal_uInt16 nPrfx, const OUString& r // #110680# SvxXMLXTableImport::SvxXMLXTableImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const uno::Reference< XNameContainer > & rTable, uno::Reference< XGraphicObjectResolver >& xGrfResolver ) -: SvXMLImport(xServiceFactory, 0), +: SvXMLImport(xContext, 0), mrTable( rTable ) { SetGraphicResolver( xGrfResolver ); @@ -383,13 +383,7 @@ bool SvxXMLXTableImport::load( const rtl::OUString &rPath, try { - uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" ); - return false; - } uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); @@ -448,7 +442,7 @@ bool SvxXMLXTableImport::load( const rtl::OUString &rPath, { } - uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xServiceFactory, xTable, xGrfResolver ) ); + uno::Reference< XDocumentHandler > xHandler( new SvxXMLXTableImport( xContext, xTable, xGrfResolver ) ); xParser->setDocumentHandler( xHandler ); xParser->parseStream( aParserInput ); diff --git a/sw/inc/SwXMLSectionList.hxx b/sw/inc/SwXMLSectionList.hxx index 04ff2bd78de3..75e20d35f6e2 100644 --- a/sw/inc/SwXMLSectionList.hxx +++ b/sw/inc/SwXMLSectionList.hxx @@ -35,7 +35,7 @@ public: std::vector<String*> &rSectionList; SwXMLSectionList( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, std::vector<String*> &rNewSectionList ); virtual ~SwXMLSectionList ( ) diff --git a/sw/source/core/inc/SwXMLBlockImport.hxx b/sw/source/core/inc/SwXMLBlockImport.hxx index be3602ed94e2..27b470143fb1 100644 --- a/sw/source/core/inc/SwXMLBlockImport.hxx +++ b/sw/source/core/inc/SwXMLBlockImport.hxx @@ -39,7 +39,7 @@ protected: public: SwXMLBlockListImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SwXMLTextBlocks &rBlocks ); SwXMLTextBlocks& getBlockList ( void ) @@ -67,7 +67,7 @@ public: sal_Bool bTextOnly; String &m_rText; SwXMLTextBlockImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, SwXMLTextBlocks &rBlocks, String &rNewText, sal_Bool bNewTextOnly ); SwXMLTextBlocks& getBlockList ( void ) diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx index e65fb2dd91c2..fc0e49376fef 100644 --- a/sw/source/core/swg/SwXMLBlockImport.cxx +++ b/sw/source/core/swg/SwXMLBlockImport.cxx @@ -31,11 +31,10 @@ sal_Char const sXML_np__block_list[] = "_block-list"; sal_Char const sXML_np__office[] = "_ooffice"; sal_Char const sXML_np__text[] = "_otext"; -// #110680# SwXMLBlockListImport::SwXMLBlockListImport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks &rBlocks ) -: SvXMLImport( xServiceFactory, 0 ), +: SvXMLImport( xContext, 0 ), rBlockList (rBlocks) { GetNamespaceMap().Add( OUString ( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__block_list ) ), @@ -63,13 +62,12 @@ SvXMLImportContext *SwXMLBlockListImport::CreateContext( return pContext; } -// #110680# SwXMLTextBlockImport::SwXMLTextBlockImport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks &rBlocks, String & rNewText, sal_Bool bNewTextOnly ) -: SvXMLImport(xServiceFactory, IMPORT_ALL ), +: SvXMLImport(xContext, IMPORT_ALL ), rBlockList ( rBlocks ), bTextOnly ( bNewTextOnly ), m_rText ( rNewText ) diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx index 5511c2e1b4ca..a93b4862f87a 100644 --- a/sw/source/core/swg/SwXMLSectionList.cxx +++ b/sw/source/core/swg/SwXMLSectionList.cxx @@ -32,9 +32,9 @@ sal_Char const sXML_np__text[] = "_otext"; // #110680# SwXMLSectionList::SwXMLSectionList( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, std::vector<String*> &rNewSectionList) -: SvXMLImport( xServiceFactory ), +: SvXMLImport( xContext ), rSectionList ( rNewSectionList ) { GetNamespaceMap().Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__office ) ), diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 152014d82180..5d88455e39cf 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -98,13 +98,8 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) xRoot = xBlkRoot->openStorageElement( aFolderName, embed::ElementModes::READ ); uno::Reference < io::XStream > xStream = xRoot->openStreamElement( aStreamName, embed::ElementModes::READ ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } + uno::Reference< uno::XComponentContext > xContext = + comphelper::getProcessComponentContext(); xml::sax::InputSource aParserInput; aParserInput.sSystemId = aNames[nIdx]->aPackageName; @@ -112,12 +107,11 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx ) aParserInput.aInputStream = xStream->getInputStream(); // get filter - // #110680# // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, aCur, sal_True ); - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xServiceFactory, *this, aCur, sal_True ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, aCur, sal_True ); // connect parser and filter - uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(xServiceFactory)); + uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); xParser->setDocumentHandler( xFilter ); // parse @@ -305,15 +299,8 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) } uno::Reference < io::XStream > xContents = xRoot->openStreamElement( aStreamName, embed::ElementModes::READ ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); - OSL_ENSURE( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); - if( !xServiceFactory.is() ) - { - // Throw an exception ? - } xml::sax::InputSource aParserInput; aParserInput.sSystemId = aName; @@ -322,7 +309,7 @@ sal_uLong SwXMLTextBlocks::GetBlockText( const String& rShort, String& rText ) // get filter // #110680# // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, rText, bTextOnly ); - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xServiceFactory, *this, rText, bTextOnly ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xContext, *this, rText, bTextOnly ); // connect parser and filter uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); @@ -439,8 +426,6 @@ void SwXMLTextBlocks::ReadInfo( void ) uno::Reference < container::XNameAccess > xAccess( xBlkRoot, uno::UNO_QUERY ); if ( xAccess.is() && xAccess->hasByName( sDocName ) && xBlkRoot->isStreamElement( sDocName ) ) { - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -451,7 +436,7 @@ void SwXMLTextBlocks::ReadInfo( void ) aParserInput.aInputStream = xDocStream->getInputStream(); // get filter - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xServiceFactory, *this ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xContext, *this ); // connect parser and filter uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext ); diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index 175372d85df5..2d2f108c591e 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -1051,8 +1051,6 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con size_t XMLReader::GetSectionList( SfxMedium& rMedium, std::vector<String*>& rStrings ) const { - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); uno::Reference < embed::XStorage > xStg2; @@ -1069,7 +1067,7 @@ size_t XMLReader::GetSectionList( SfxMedium& rMedium, aParserInput.aInputStream = xStm->getInputStream(); // get filter - uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xServiceFactory, rStrings ); + uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLSectionList( xContext, rStrings ); // connect parser and filter uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 67fa1efdcb6f..e45dc1cc82d2 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -65,6 +65,7 @@ #include <xmloff/xmlmetai.hxx> #include <xmloff/xformsimport.hxx> #include <comphelper/servicehelper.hxx> +#include <comphelper/processfactory.hxx> using ::rtl::OUString; @@ -408,9 +409,9 @@ SvXMLImportContext *SwXMLImport::CreateContext( } SwXMLImport::SwXMLImport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, sal_uInt16 nImportFlags) -: SvXMLImport( xServiceFactory, nImportFlags ), +: SvXMLImport( xContext, nImportFlags ), pSttNdIdx( 0 ), pTableItemMapper( 0 ), pDocElemTokenMap( 0 ), @@ -1560,7 +1561,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImport_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_ALL ); + return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_ALL ); } OUString SAL_CALL SwXMLImportStyles_getImplementationName() throw() @@ -1582,7 +1583,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportStyles_createInstance( throw( uno::Exception ) { return (cppu::OWeakObject*)new SwXMLImport( - rSMgr, + comphelper::getComponentContext(rSMgr), IMPORT_STYLES | IMPORT_MASTERSTYLES | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS ); } @@ -1606,7 +1607,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportContent_createInstance( throw( uno::Exception ) { return (cppu::OWeakObject*)new SwXMLImport( - rSMgr, + comphelper::getComponentContext(rSMgr), IMPORT_AUTOSTYLES | IMPORT_CONTENT | IMPORT_SCRIPTS | IMPORT_FONTDECLS ); } @@ -1629,7 +1630,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportMeta_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_META ); + return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META ); } OUString SAL_CALL SwXMLImportSettings_getImplementationName() throw() @@ -1650,7 +1651,7 @@ uno::Reference< uno::XInterface > SAL_CALL SwXMLImportSettings_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SwXMLImport( rSMgr, IMPORT_SETTINGS ); + return (cppu::OWeakObject*)new SwXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_SETTINGS ); } diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx index 992236015971..5e2e4959c918 100644 --- a/sw/source/filter/xml/xmlimp.hxx +++ b/sw/source/filter/xml/xmlimp.hxx @@ -109,7 +109,7 @@ protected: public: SwXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, sal_uInt16 nImportFlags = IMPORT_ALL); ~SwXMLImport() throw(); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 8359cafa58d6..3fc237af18e0 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -336,7 +336,7 @@ SvXMLImportContext *SwXMLItemSetContext_Impl::CreateChildContext( void SwXMLImport::_InitItemImport() { - pTwipUnitConv = new SvXMLUnitConverter( comphelper::getComponentContext(getServiceFactory()), + pTwipUnitConv = new SvXMLUnitConverter( GetComponentContext(), util::MeasureUnit::TWIP, util::MeasureUnit::TWIP ); xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); diff --git a/xmloff/inc/MetaImportComponent.hxx b/xmloff/inc/MetaImportComponent.hxx index 95934af06c3a..27568e9cf19f 100644 --- a/xmloff/inc/MetaImportComponent.hxx +++ b/xmloff/inc/MetaImportComponent.hxx @@ -36,7 +36,7 @@ public: // #110680# // XMLMetaImportComponent() throw(); XMLMetaImportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) throw(); virtual ~XMLMetaImportComponent() throw(); diff --git a/xmloff/inc/SchXMLImport.hxx b/xmloff/inc/SchXMLImport.hxx index f7ec314d2337..ad9efe967d27 100644 --- a/xmloff/inc/SchXMLImport.hxx +++ b/xmloff/inc/SchXMLImport.hxx @@ -165,7 +165,7 @@ protected: public: // #110680# SchXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nImportFlags = IMPORT_ALL ); virtual ~SchXMLImport() throw (); diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx index 7e6381a867ad..24f1f9799c11 100644 --- a/xmloff/inc/xmloff/xmlimp.hxx +++ b/xmloff/inc/xmloff/xmlimp.hxx @@ -39,6 +39,7 @@ #include <com/sun/star/document/XGraphicObjectResolver.hpp> #include <com/sun/star/document/XEmbeddedObjectResolver.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/weak.hxx> #include <xmloff/txtimp.hxx> #include <xmloff/shapeimport.hxx> @@ -50,7 +51,6 @@ #include <com/sun/star/beans/NamedValue.hpp> namespace com { namespace sun { namespace star { - namespace uno { class XComponentContext; } namespace frame { class XModel; } namespace io { class XOutputStream; } namespace rdf { class XMetadatable; } @@ -140,8 +140,6 @@ class XMLOFF_DLLPUBLIC SvXMLImport : public ::cppu::WeakImplHelper6< sal_uInt16 mnErrorFlags; protected: - // #110680# - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory; ::com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > mxStatusIndicator; sal_Bool mbIsFormsSupported; @@ -184,7 +182,7 @@ public: // #110680# // SvXMLImport( sal_uInt16 nImportFlags = IMPORT_ALL ) throw(); SvXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nImportFlags = IMPORT_ALL ) throw(); virtual ~SvXMLImport() throw(); @@ -372,9 +370,6 @@ public: ::comphelper::UnoInterfaceToUniqueIdentifierMapper& getInterfaceToIdentifierMapper(); - // #110680# - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getServiceFactory(); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > GetComponentContext() const; diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx index 6c116edd4a8a..1d7595e89e62 100644 --- a/xmloff/inc/xmlversion.hxx +++ b/xmloff/inc/xmlversion.hxx @@ -68,9 +68,8 @@ protected: public: - // #110897# XMLVersionListImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions ); ~XMLVersionListImport() throw(); diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx index f7002fdb26c8..234d43bb4a7c 100644 --- a/xmloff/source/chart/SchXMLImport.cxx +++ b/xmloff/source/chart/SchXMLImport.cxx @@ -537,9 +537,9 @@ Reference< chart2::XDataSeries > SchXMLImportHelper::GetNewDataSeries( // #110680# SchXMLImport::SchXMLImport( - const Reference< lang::XMultiServiceFactory >& xServiceFactory, + const Reference< uno::XComponentContext >& xContext, sal_uInt16 nImportFlags ) : - SvXMLImport( xServiceFactory, nImportFlags ) + SvXMLImport( xContext, nImportFlags ) { GetNamespaceMap().Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK ); GetNamespaceMap().Add( GetXMLToken(XML_NP_CHART_EXT), GetXMLToken(XML_N_CHART_EXT), XML_NAMESPACE_CHART_EXT); @@ -709,7 +709,7 @@ OUString SAL_CALL SchXMLImport_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLImport_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLImport(rSMgr); + return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr)); } // ============================================================ @@ -731,7 +731,7 @@ OUString SAL_CALL SchXMLImport_Styles_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLImport_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_STYLES ); + return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_STYLES ); } // ------------------------------------------------------------ @@ -751,7 +751,7 @@ OUString SAL_CALL SchXMLImport_Content_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLImport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS ); + return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_CONTENT | IMPORT_AUTOSTYLES | IMPORT_FONTDECLS ); } // ------------------------------------------------------------ @@ -771,7 +771,7 @@ OUString SAL_CALL SchXMLImport_Meta_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLImport_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLImport( rSMgr, IMPORT_META ); + return (cppu::OWeakObject*)new SchXMLImport( comphelper::getComponentContext(rSMgr), IMPORT_META ); } // XServiceInfo diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index c0dc4ce7e135..6379a13c4284 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -461,8 +461,7 @@ XMLConfigBaseContext::XMLConfigBaseContext(SvXMLImport& rImport, sal_uInt16 nPrf const rtl::OUString& rLName, com::sun::star::uno::Any& rTempAny, XMLConfigBaseContext* pTempBaseContext) : SvXMLImportContext( rImport, nPrfx, rLName ), - // #110680# - maProps( comphelper::getComponentContext(rImport.getServiceFactory())), + maProps( rImport.GetComponentContext() ), maProp(), mrAny(rTempAny), mpBaseContext(pTempBaseContext) @@ -679,9 +678,9 @@ void XMLConfigItemContext::ManipulateConfigItem() else if( (mrItemName == "ColorTableURL") || (mrItemName == "LineEndTableURL") || (mrItemName == "HatchTableURL") || (mrItemName == "DashTableURL") || (mrItemName == "GradientTableURL") || (mrItemName == "BitmapTableURL") ) { - if( GetImport().getServiceFactory().is() ) try + try { - uno::Reference< uno::XComponentContext > xContext( comphelper::getComponentContext(GetImport().getServiceFactory()) ); + uno::Reference< uno::XComponentContext > xContext( GetImport().GetComponentContext() ); uno::Reference< util::XStringSubstitution > xStringSubsitution( util::PathSubstitution::create(xContext) ); rtl::OUString aURL; diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index 402c8a884538..fa5a264ebf78 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -150,11 +150,11 @@ sal_Bool XMLEmbeddedObjectImportContext::SetComponent( Sequence<Any> aArgs( 0 ); - Reference< XMultiServiceFactory > xServiceFactory = GetImport().getServiceFactory(); + Reference< XComponentContext > xContext( GetImport().GetComponentContext() ); xHandler = Reference < XDocumentHandler >( - xServiceFactory->createInstanceWithArguments( sFilterService, aArgs), - UNO_QUERY); + xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, xContext), + UNO_QUERY); if( !xHandler.is() ) return sal_False; diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index bfa39220bee9..6cc7330bedcc 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -289,7 +289,7 @@ public: std::auto_ptr< DocumentInfo > mpDocumentInfo; - SvXMLImport_Impl() + SvXMLImport_Impl( const uno::Reference< uno::XComponentContext >& rxContext) : hBatsFontConv( 0 ) , hMathFontConv( 0 ) , mbOwnGraphicResolver( false ) @@ -298,7 +298,7 @@ public: // Convert drawing object positions from OOo file format to OASIS (#i28749#) , mbShapePositionInHoriL2R( sal_False ) , mbTextDocInOOoFileFormat( sal_False ) - , mxComponentContext( ::comphelper::getProcessComponentContext() ) + , mxComponentContext( rxContext ) , mpRDFaHelper() // lazy , mpDocumentInfo() // lazy { @@ -381,7 +381,7 @@ void SvXMLImport::_InitCtor() msPackageProtocol = "vnd.sun.star.Package:"; if (mxNumberFormatsSupplier.is()) - mpNumImport = new SvXMLNumFmtHelper(mxNumberFormatsSupplier, comphelper::getComponentContext(getServiceFactory())); + mpNumImport = new SvXMLNumFmtHelper(mxNumberFormatsSupplier, GetComponentContext()); if (mxModel.is() && !mxEventListener.is()) { @@ -393,14 +393,13 @@ void SvXMLImport::_InitCtor() } -// #110680# SvXMLImport::SvXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nImportFlags ) throw () -: mpImpl( new SvXMLImport_Impl() ), +: mpImpl( new SvXMLImport_Impl(xContext) ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( comphelper::getComponentContext(xServiceFactory), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), @@ -411,13 +410,11 @@ SvXMLImport::SvXMLImport( mpStyleMap(0), mnImportFlags( nImportFlags ), mnErrorFlags(0), - // #110680# - mxServiceFactory(xServiceFactory), mbIsFormsSupported( sal_True ), mbIsTableShapeSupported( false ), mbIsGraphicLoadOnDemandSupported( true ) { - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); + DBG_ASSERT( xContext.is(), "got no service manager" ); _InitCtor(); } @@ -1649,7 +1646,7 @@ void SvXMLImport::_CreateDataStylesImport() uno::Reference<util::XNumberFormatsSupplier> xNum = GetNumberFormatsSupplier(); if ( xNum.is() ) - mpNumImport = new SvXMLNumFmtHelper(xNum, comphelper::getComponentContext(getServiceFactory())); + mpNumImport = new SvXMLNumFmtHelper(xNum, GetComponentContext() ); } @@ -1772,12 +1769,6 @@ void SvXMLImport::DisposingModel() return mpImpl->maInterfaceToIdentifierMapper; } -::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLImport::getServiceFactory() -{ - // #110680# - return mxServiceFactory; -} - uno::Reference< uno::XComponentContext > SvXMLImport::GetComponentContext() const { diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 32eeae9baa1c..24a8565779a2 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -1282,7 +1282,7 @@ private: }; AnimationsImport::AnimationsImport( const Reference< XComponentContext > & rxContext ) -: SvXMLImport( Reference<XMultiServiceFactory>(rxContext->getServiceManager(), UNO_QUERY_THROW) , true ) +: SvXMLImport( rxContext , true ) { // add namespaces GetNamespaceMap().Add( diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 38cc4c0ac9df..6797c739f4ea 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -19,6 +19,7 @@ #include <osl/thread.h> +#include <comphelper/processfactory.hxx> #include <xmloff/xmlscripti.hxx> #include "sdxmlimp_impl.hxx" @@ -295,7 +296,7 @@ OUString SAL_CALL classname##_getImplementationName() throw()\ }\ uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception )\ {\ - return (cppu::OWeakObject*)new SdXMLImport( rSMgr, draw, flags );\ + return (cppu::OWeakObject*)new SdXMLImport( comphelper::getComponentContext(rSMgr), draw, flags );\ } SERVICE( XMLImpressImportOasis, "com.sun.star.comp.Impress.XMLOasisImporter", "XMLImpressImportOasis", sal_False, IMPORT_ALL ) @@ -317,9 +318,9 @@ SERVICE( XMLDrawSettingsImportOasis, "com.sun.star.comp.Draw.XMLOasisSettingsImp // #110680# SdXMLImport::SdXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Bool bIsDraw, sal_uInt16 nImportFlags ) -: SvXMLImport( xServiceFactory, nImportFlags ), +: SvXMLImport( xContext, nImportFlags ), mpMasterStylesContext(0L), mpDocElemTokenMap(0L), mpBodyElemTokenMap(0L), diff --git a/xmloff/source/draw/sdxmlimp_impl.hxx b/xmloff/source/draw/sdxmlimp_impl.hxx index 1bdb3acdccf5..dbede52ec884 100644 --- a/xmloff/source/draw/sdxmlimp_impl.hxx +++ b/xmloff/source/draw/sdxmlimp_impl.hxx @@ -227,9 +227,8 @@ protected: com::sun::star::xml::sax::XAttributeList>& xAttrList); public: - // #110680# SdXMLImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_Bool bIsDraw, sal_uInt16 nImportFlags = IMPORT_ALL ); ~SdXMLImport() throw (); diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 94ca2f7615d3..73a1d637a4e9 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -1001,9 +1001,9 @@ SdXMLStylesContext::SdXMLStylesContext( : SvXMLStylesContext(rImport, nPrfx, rLName, xAttrList), mbIsAutoStyle(bIsAutoStyle) { - Reference< lang::XMultiServiceFactory > xMSF = rImport.getServiceFactory(); - mpNumFormatter = new SvNumberFormatter( comphelper::getComponentContext(xMSF), LANGUAGE_SYSTEM ); - mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, comphelper::getComponentContext(xMSF) ); + Reference< uno::XComponentContext > xContext = rImport.GetComponentContext(); + mpNumFormatter = new SvNumberFormatter( xContext, LANGUAGE_SYSTEM ); + mpNumFmtHelper = new SvXMLNumFmtHelper( mpNumFormatter, xContext ); } ////////////////////////////////////////////////////////////////////////////// diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 907390f5fe6a..a52fbb21f013 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -642,7 +642,8 @@ namespace xmloff Reference< XPropertySet > xReturn; if (!m_sServiceName.isEmpty()) { - Reference< XInterface > xPure = m_rFormImport.getGlobalContext().getServiceFactory()->createInstance(m_sServiceName); + Reference< XComponentContext > xContext = m_rFormImport.getGlobalContext().GetComponentContext(); + Reference< XInterface > xPure = xContext->getServiceManager()->createInstanceWithContext(m_sServiceName, xContext); OSL_ENSURE(xPure.is(), ::rtl::OStringBuffer("OElementImport::createElement: service factory gave me no object (service name: ").append(rtl::OUStringToOString(m_sServiceName, RTL_TEXTENCODING_ASCII_US)).append(")!").getStr()); xReturn = Reference< XPropertySet >(xPure, UNO_QUERY); diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx index f7de080a5b00..d1e7a8fa3648 100644 --- a/xmloff/source/meta/MetaImportComponent.cxx +++ b/xmloff/source/meta/MetaImportComponent.cxx @@ -24,6 +24,7 @@ #include <xmloff/xmltoken.hxx> #include <xmloff/xmlmetai.hxx> #include <xmloff/nmspmap.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; using namespace ::xmloff::token; @@ -33,8 +34,8 @@ using namespace ::xmloff::token; // #110680# XMLMetaImportComponent::XMLMetaImportComponent( - const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory) throw() - : SvXMLImport(xServiceFactory), mxDocProps() + const uno::Reference< uno::XComponentContext >& xContext) throw() + : SvXMLImport(xContext), mxDocProps() { } @@ -96,7 +97,7 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaImportComponent_createInstance throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new XMLMetaImportComponent(rSMgr); + return (cppu::OWeakObject*)new XMLMetaImportComponent( comphelper::getComponentContext(rSMgr)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index bf9956298dde..f7be45771743 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -152,7 +152,7 @@ lcl_initGenerator(SvXMLImport & rImport, uno::UNO_SET_THROW); try { uno::Reference< xml::xpath::XXPathAPI > const xPath = xml::xpath::XPathAPI::create( - comphelper::getComponentContext(rImport.getServiceFactory()) ); + rImport.GetComponentContext() ); xPath->registerNS(GetXMLToken(XML_NP_OFFICE),GetXMLToken(XML_N_OFFICE)); xPath->registerNS(GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META)); diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 39c74cb17df2..3b13701cbb21 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -106,11 +106,10 @@ sal_uInt32 XMLVersionListExport::exportDoc( enum ::xmloff::token::XMLTokenEnum ) } // ------------------------------------------------------------------------ -// #110897# XMLVersionListImport::XMLVersionListImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& rVersions ) -: SvXMLImport(xServiceFactory), +: SvXMLImport(xContext), maVersions( rVersions ) { GetNamespaceMap().AddAtIndex( XML_NAMESPACE_FRAMEWORK_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_VERSIONS_LIST), @@ -396,9 +395,7 @@ uno::Sequence< util::RevisionTag > SAL_CALL XMLVersionListPersistence::load( con try { if ( xRootNames.is() && xRootNames->hasByName( sDocName ) && xRoot->isStreamElement( sDocName ) ) { - Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); + Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); InputSource aParserInput; @@ -426,10 +423,10 @@ uno::Sequence< util::RevisionTag > SAL_CALL XMLVersionListPersistence::load( con throw uno::RuntimeException(); // get filter - Reference< XDocumentHandler > xFilter = new XMLVersionListImport( xServiceFactory, aVersions ); + Reference< XDocumentHandler > xFilter = new XMLVersionListImport( xContext, aVersions ); // connect parser and filter - Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(xServiceFactory)); + Reference< XParser > xParser = xml::sax::Parser::create(xContext); xParser->setDocumentHandler( xFilter ); // parse diff --git a/xmloff/source/script/xmlbasici.cxx b/xmloff/source/script/xmlbasici.cxx index 188608a19c85..b67b56fe8955 100644 --- a/xmloff/source/script/xmlbasici.cxx +++ b/xmloff/source/script/xmlbasici.cxx @@ -37,8 +37,8 @@ XMLBasicImportContext::XMLBasicImportContext( SvXMLImport& rImport, sal_uInt16 n :SvXMLImportContext( rImport, nPrfx, rLName ) ,m_xModel( rxModel ) { - Reference< lang::XMultiServiceFactory > xMSF = GetImport().getServiceFactory(); - m_xHandler = document::XMLOasisBasicImporter::create( comphelper::getComponentContext(xMSF) ); + Reference< uno::XComponentContext > xContext = GetImport().GetComponentContext(); + m_xHandler = document::XMLOasisBasicImporter::create( xContext ); Reference< lang::XComponent > xComp( m_xModel, UNO_QUERY ); m_xHandler->setTargetDocument( xComp ); diff --git a/xmloff/source/text/XMLAutoTextEventImport.cxx b/xmloff/source/text/XMLAutoTextEventImport.cxx index c313accca867..875b29a6eb25 100644 --- a/xmloff/source/text/XMLAutoTextEventImport.cxx +++ b/xmloff/source/text/XMLAutoTextEventImport.cxx @@ -27,6 +27,7 @@ #include "xmloff/xmlnmspe.hxx" #include <xmloff/xmltoken.hxx> #include <tools/debug.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -50,8 +51,8 @@ const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer"; // #110680# XMLAutoTextEventImport::XMLAutoTextEventImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory) throw() -: SvXMLImport(xServiceFactory) + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext) throw() +: SvXMLImport(xContext) { } @@ -126,9 +127,7 @@ Reference< XInterface > SAL_CALL XMLAutoTextEventImport_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - // #110680# - // return (cppu::OWeakObject*)new XMLAutoTextEventImport; - return (cppu::OWeakObject*)new XMLAutoTextEventImport(rSMgr); + return (cppu::OWeakObject*)new XMLAutoTextEventImport( comphelper::getComponentContext(rSMgr) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLAutoTextEventImport.hxx b/xmloff/source/text/XMLAutoTextEventImport.hxx index a18501ccf6a1..ec4de83c9d2b 100644 --- a/xmloff/source/text/XMLAutoTextEventImport.hxx +++ b/xmloff/source/text/XMLAutoTextEventImport.hxx @@ -45,10 +45,8 @@ class XMLAutoTextEventImport : public SvXMLImport ::com::sun::star::container::XNameReplace> xEvents; public: - // #110680# - // XMLAutoTextEventImport() throw(); XMLAutoTextEventImport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ) throw(); ~XMLAutoTextEventImport() throw(); |