diff options
48 files changed, 361 insertions, 443 deletions
diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 391c462ed7e5..ca5bb8c5b0c6 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -102,7 +102,7 @@ namespace dbaxml //--------------------------------------------------------------------- Reference< XInterface > SAL_CALL ODBExportHelper::Create(const Reference< XMultiServiceFactory >& _rxORB) { - return static_cast< XServiceInfo* >(new ODBExport(_rxORB,EXPORT_SETTINGS | EXPORT_PRETTY )); + return static_cast< XServiceInfo* >(new ODBExport(comphelper::getComponentContext(_rxORB),EXPORT_SETTINGS | EXPORT_PRETTY )); } //--------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODBExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -121,7 +121,7 @@ namespace dbaxml //--------------------------------------------------------------------- Reference< XInterface > SAL_CALL ODBFullExportHelper::Create(const Reference< XMultiServiceFactory >& _rxORB) { - return static_cast< XServiceInfo* >(new ODBExport(_rxORB,EXPORT_ALL)); + return static_cast< XServiceInfo* >(new ODBExport(comphelper::getComponentContext(_rxORB),EXPORT_ALL)); } //--------------------------------------------------------------------- ::rtl::OUString SAL_CALL ODBFullExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -193,10 +193,10 @@ namespace dbaxml } }; // ----------------------------------------------------------------------------- -ODBExport::ODBExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nExportFlag) -: SvXMLExport( util::MeasureUnit::MM_10TH, _rxMSF, XML_DATABASE, +ODBExport::ODBExport(const Reference< XComponentContext >& _rxContext,sal_uInt16 nExportFlag) +: SvXMLExport( util::MeasureUnit::MM_10TH, _rxContext, XML_DATABASE, EXPORT_OASIS | nExportFlag) -,m_aTypeCollection(comphelper::getComponentContext(_rxMSF)) +,m_aTypeCollection(_rxContext) ,m_bAllreadyFilled(sal_False) { GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_10TH); @@ -259,7 +259,16 @@ ODBExport::ODBExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 rtl::OUString(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX )); } // ----------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO1_STATIC( ODBExport, "com.sun.star.comp.sdb.DBExportFilter", "com.sun.star.document.ExportFilter") +IMPLEMENT_SERVICE_INFO_IMPLNAME_STATIC(ODBExport, "com.sun.star.comp.sdb.DBExportFilter") +IMPLEMENT_SERVICE_INFO_SUPPORTS(ODBExport) +IMPLEMENT_SERVICE_INFO_GETSUPPORTED1_STATIC(ODBExport, "com.sun.star.document.ExportFilter") + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + SAL_CALL ODBExport::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) +{ + return static_cast< XServiceInfo* >(new ODBExport( comphelper::getComponentContext(_rxORB))); +} + // ----------------------------------------------------------------------------- void ODBExport::exportDataSource() { @@ -281,7 +290,7 @@ void ODBExport::exportDataSource() xSettingsState->getPropertyDefault( INFO_DECIMALDELIMITER ) >>= aDelimiter.sDecimal; xSettingsState->getPropertyDefault( INFO_THOUSANDSDELIMITER ) >>= aDelimiter.sThousand; - ::connectivity::DriversConfig aDriverConfig(comphelper::getComponentContext(getServiceFactory())); + ::connectivity::DriversConfig aDriverConfig(getComponentContext()); const ::rtl::OUString sURL = ::comphelper::getString(xProp->getPropertyValue(PROPERTY_URL)); ::comphelper::NamedValueCollection aDriverSupportedProperties( aDriverConfig.getProperties( sURL ) ); diff --git a/dbaccess/source/filter/xml/xmlExport.hxx b/dbaccess/source/filter/xml/xmlExport.hxx index 664ed30f48a4..68ce90019e5a 100644 --- a/dbaccess/source/filter/xml/xmlExport.hxx +++ b/dbaccess/source/filter/xml/xmlExport.hxx @@ -176,7 +176,7 @@ protected: virtual ~ODBExport(){}; public: - ODBExport(const Reference< XMultiServiceFactory >& _rxMSF, sal_uInt16 nExportFlag = EXPORT_CONTENT | EXPORT_AUTOSTYLES | EXPORT_PRETTY | EXPORT_FONTDECLS | EXPORT_SCRIPTS ); + ODBExport(const Reference< XComponentContext >& _rxContext, sal_uInt16 nExportFlag = EXPORT_CONTENT | EXPORT_AUTOSTYLES | EXPORT_PRETTY | EXPORT_FONTDECLS | EXPORT_SCRIPTS ); // XServiceInfo DECLARE_SERVICE_INFO_STATIC( ); diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.cxx b/editeng/source/misc/SvXMLAutoCorrectExport.cxx index b70474a15c8f..2b08c0ff7085 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.cxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.cxx @@ -28,11 +28,11 @@ using namespace ::xmloff::token; using namespace ::rtl; SvXMLAutoCorrectExport::SvXMLAutoCorrectExport( - 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 SvxAutocorrWordList * pNewAutocorr_List, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), pAutocorr_List( pNewAutocorr_List ) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST), @@ -72,11 +72,11 @@ sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/) } SvXMLExceptionListExport::SvXMLExceptionListExport( - 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 SvStringsISortDtor &rNewList, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), rList( rNewList ) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ), diff --git a/editeng/source/misc/SvXMLAutoCorrectExport.hxx b/editeng/source/misc/SvXMLAutoCorrectExport.hxx index 294122dc7eeb..430aca271c4e 100644 --- a/editeng/source/misc/SvXMLAutoCorrectExport.hxx +++ b/editeng/source/misc/SvXMLAutoCorrectExport.hxx @@ -31,7 +31,7 @@ private: const SvxAutocorrWordList *pAutocorr_List; public: SvXMLAutoCorrectExport( - 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 SvxAutocorrWordList * pNewAutocorr_List, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); @@ -51,7 +51,7 @@ private: const SvStringsISortDtor & rList; public: SvXMLExceptionListExport( - 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 SvStringsISortDtor &rNewList, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 50c5b02ca360..a6a483ca53c9 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2046,8 +2046,6 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( xStrm->SetProperty( rtl::OUString("MediaType"), aAny ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -2056,7 +2054,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( xWriter->setOutputStream(xOut); uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); - SvXMLExceptionListExport aExp( xServiceFactory, rLst, sStrmName, xHandler ); + SvXMLExceptionListExport aExp( xContext, rLst, sStrmName, xHandler ); aExp.exportDoc( XML_BLOCK_LIST ); @@ -2409,8 +2407,6 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) aAny <<= aMime; refList->SetProperty( aPropName, aAny ); - uno::Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -2419,7 +2415,7 @@ sal_Bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SvStorage& rStg ) xWriter->setOutputStream(xOut); uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - SvXMLAutoCorrectExport aExp( xServiceFactory, pAutocorr_List, sStrmName, xHandler ); + SvXMLAutoCorrectExport aExp( xContext, pAutocorr_List, sStrmName, xHandler ); aExp.exportDoc( XML_BLOCK_LIST ); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index beec85ed2a29..0b568f211f66 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -348,7 +348,7 @@ class SvxXMLTextExportComponent : public SvXMLExport { public: SvxXMLTextExportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, EditEngine* pEditEngine, const ESelection& rSel, const ::rtl::OUString& rFileName, @@ -369,12 +369,12 @@ private: /////////////////////////////////////////////////////////////////////// SvxXMLTextExportComponent::SvxXMLTextExportComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, EditEngine* pEditEngine, const ESelection& rSel, const ::rtl::OUString& rFileName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler) -: SvXMLExport( xServiceFactory, rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), MAP_CM ), +: SvXMLExport( xContext, rFileName, xHandler, ((frame::XModel*)new SvxSimpleUnoModel()), MAP_CM ), maSelection( rSel ) { SvxEditEngineSource aEditSource( pEditEngine ); @@ -410,16 +410,8 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& do { // create service factory - - uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "got no service manager" ); - break; - } - // create document handler uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext ); @@ -441,7 +433,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler ); uno::Reference< xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW); - SvxXMLTextExportComponent aExporter( xServiceFactory, &rEditEngine, rSel, aName, xHandler ); + SvxXMLTextExportComponent aExporter( xContext, &rEditEngine, rSel, aName, xHandler ); aExporter.exportDoc(); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 36d66b47f712..5017d99a116a 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -310,11 +310,11 @@ sal_Bool operator==( const TextField & aLhsTextField, const TextField & aRhsText // ------------- SVGExport::SVGExport( - 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 Reference< XDocumentHandler >& rxHandler, const Sequence< PropertyValue >& rFilterData ) : SvXMLExport( util::MeasureUnit::MM_100TH, - xServiceFactory, + xContext, xmloff::token::XML_TOKEN_INVALID, EXPORT_META|EXPORT_PRETTY ) , mrFilterData( rFilterData ) @@ -547,7 +547,7 @@ bool EqualityBitmap::operator()( const ObjectRepresentation& rObjRep1, sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException) { - Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ; + Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ) ; Reference< XOutputStream > xOStm; SvStream* pOStm = NULL; sal_Int32 nLength = rDescriptor.getLength(); @@ -618,7 +618,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) maFilterData[ 5 ].Value <<= (sal_Bool) sal_False; } - if( xOStm.is() && xServiceFactory.is() ) + if( xOStm.is() ) { if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() ) { @@ -631,7 +631,7 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) // #110680# // mpSVGExport = new SVGExport( xDocHandler ); - mpSVGExport = new SVGExport( xServiceFactory, xDocHandler, maFilterData ); + mpSVGExport = new SVGExport( xContext, xDocHandler, maFilterData ); if( mpSVGExport != NULL ) { diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 86694f217a23..df54c7e52250 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -121,7 +121,7 @@ class SVGExport : public SvXMLExport public: - SVGExport( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SVGExport( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext, const Reference< XDocumentHandler >& rxHandler, const Sequence< PropertyValue >& rFilterData ); diff --git a/linguistic/source/convdicxml.hxx b/linguistic/source/convdicxml.hxx index 50d17df6afc6..6d958e8dc8ee 100644 --- a/linguistic/source/convdicxml.hxx +++ b/linguistic/source/convdicxml.hxx @@ -47,7 +47,7 @@ public: ConvDicXMLExport( ConvDic &rConvDic, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler) : - SvXMLExport ( comphelper::getProcessServiceFactory(), rFileName, + SvXMLExport ( comphelper::getProcessComponentContext(), rFileName, ::com::sun::star::util::MeasureUnit::CM, rHandler ), rDic ( rConvDic ), bSuccess ( sal_False ) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 6788d86f49bd..a38f4c6697ec 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -101,6 +101,8 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/document,\ NamedPropertyValues \ OleEmbeddedServerRegistration \ OOXMLDocumentPropertiesImporter \ + XMLBasicExporter \ + XMLOasisBasicExporter \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/drawing,\ ShapeCollection \ @@ -654,9 +656,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/documen PDFDialog \ Settings \ TypeDetection \ - XMLBasicExporter \ XMLBasicImporter \ - XMLOasisBasicExporter \ XMLOasisBasicImporter \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/drawing,\ @@ -2171,6 +2171,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/document,\ XUndoManagerListener \ XUndoManagerSupplier \ XViewDataSupplier \ + XXMLBasicExporter \ )) $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/drawing,\ Alignment \ diff --git a/offapi/com/sun/star/document/XMLBasicExporter.idl b/offapi/com/sun/star/document/XMLBasicExporter.idl index 47efa6dfe0b1..a8d618c817da 100644 --- a/offapi/com/sun/star/document/XMLBasicExporter.idl +++ b/offapi/com/sun/star/document/XMLBasicExporter.idl @@ -19,9 +19,8 @@ #ifndef __com_sun_star_document_XMLBasicExporter_idl__ #define __com_sun_star_document_XMLBasicExporter_idl__ -#include <com/sun/star/document/XExporter.idl> -#include <com/sun/star/document/XFilter.idl> -#include <com/sun/star/lang/XInitialization.idl> +#include <com/sun/star/xml/sax/XDocumentHandler.idl> +#include <com/sun/star/document/XXMLBasicExporter.idl> @@ -37,23 +36,9 @@ module com { module sun { module star { module document { @since OOo 2.0 */ -published service XMLBasicExporter +published service XMLBasicExporter : XXMLBasicExporter { - - /** sets the source document for this filter. - */ - interface com::sun::star::document::XExporter; - - - /** filters the document. - */ - interface com::sun::star::document::XFilter; - - - /** initializes the component. - */ - [optional] interface com::sun::star::lang::XInitialization; - + createWithHandler([in] com::sun::star::xml::sax::XDocumentHandler DocumentHandler); }; diff --git a/offapi/com/sun/star/document/XMLOasisBasicExporter.idl b/offapi/com/sun/star/document/XMLOasisBasicExporter.idl index 23dd454c0c5b..d983f07d7333 100644 --- a/offapi/com/sun/star/document/XMLOasisBasicExporter.idl +++ b/offapi/com/sun/star/document/XMLOasisBasicExporter.idl @@ -19,9 +19,8 @@ #ifndef __com_sun_star_document_XMLOasisBasicExporter_idl__ #define __com_sun_star_document_XMLOasisBasicExporter_idl__ -#include <com/sun/star/document/XExporter.idl> -#include <com/sun/star/document/XFilter.idl> -#include <com/sun/star/lang/XInitialization.idl> +#include <com/sun/star/xml/sax/XDocumentHandler.idl> +#include <com/sun/star/document/XXMLBasicExporter.idl> @@ -37,23 +36,9 @@ module com { module sun { module star { module document { @since OOo 2.0 */ -published service XMLOasisBasicExporter +published service XMLOasisBasicExporter : XXMLBasicExporter { - - /** sets the source document for this filter. - */ - interface com::sun::star::document::XExporter; - - - /** filters the document. - */ - interface com::sun::star::document::XFilter; - - - /** initializes the component. - */ - [optional] interface com::sun::star::lang::XInitialization; - + createWithHandler([in] com::sun::star::xml::sax::XDocumentHandler DocumentHandler); }; diff --git a/offapi/com/sun/star/document/XXMLBasicExporter.idl b/offapi/com/sun/star/document/XXMLBasicExporter.idl new file mode 100644 index 000000000000..35ee98cbd8dc --- /dev/null +++ b/offapi/com/sun/star/document/XXMLBasicExporter.idl @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_document_XXMLBasicExporter_idl__ +#define __com_sun_star_document_XXMLBasicExporter_idl__ + +#include <com/sun/star/document/XExporter.idl> +#include <com/sun/star/document/XFilter.idl> + + + +module com { module sun { module star { module document { + + +/** Provides unified interface for XMLOasisBasicExporter and XMLBasicExporter services. + @since LibreOffice 4.1 + */ +published interface XXMLBasicExporter +{ + + /** sets the source document for this filter. + */ + interface com::sun::star::document::XExporter; + + + /** filters the document. + */ + interface com::sun::star::document::XFilter; + +}; + + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb Binary files differindex a80baa46eadb..e890208f2fe5 100644 --- a/offapi/type_reference/types.rdb +++ b/offapi/type_reference/types.rdb diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 9df73c0fef50..f6379026a3bb 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -75,7 +75,7 @@ namespace rptxml //--------------------------------------------------------------------- Reference< XInterface > ORptExportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),EXPORT_SETTINGS )); + return static_cast< XServiceInfo* >(new ORptExport(xContext,EXPORT_SETTINGS )); } //--------------------------------------------------------------------- ::rtl::OUString ORptExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -92,7 +92,7 @@ namespace rptxml //--------------------------------------------------------------------- Reference< XInterface > ORptContentExportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),EXPORT_CONTENT )); + return static_cast< XServiceInfo* >(new ORptExport(xContext,EXPORT_CONTENT )); } //--------------------------------------------------------------------- ::rtl::OUString ORptContentExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -110,7 +110,7 @@ namespace rptxml //--------------------------------------------------------------------- Reference< XInterface > ORptStylesExportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | + return static_cast< XServiceInfo* >(new ORptExport(xContext,EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS|EXPORT_OASIS )); } //--------------------------------------------------------------------- @@ -129,7 +129,7 @@ namespace rptxml //--------------------------------------------------------------------- Reference< XInterface > ORptMetaExportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),EXPORT_META )); + return static_cast< XServiceInfo* >(new ORptExport(xContext, EXPORT_META )); } //--------------------------------------------------------------------- ::rtl::OUString ORptMetaExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -147,7 +147,7 @@ namespace rptxml //--------------------------------------------------------------------- Reference< XInterface > ODBFullExportHelper::create(Reference< XComponentContext > const & xContext) { - return static_cast< XServiceInfo* >(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY),EXPORT_ALL)); + return static_cast< XServiceInfo* >(new ORptExport(xContext,EXPORT_ALL)); } //--------------------------------------------------------------------- ::rtl::OUString ODBFullExportHelper::getImplementationName_Static( ) throw (RuntimeException) @@ -215,8 +215,8 @@ void lcl_adjustColumnSpanOverRows(ORptExport::TSectionsGrid& _rGrid) } } // ----------------------------------------------------------------------------- -ORptExport::ORptExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt16 nExportFlag) -: SvXMLExport( util::MeasureUnit::MM_100TH, _rxMSF, XML_REPORT, EXPORT_OASIS) +ORptExport::ORptExport(const Reference< XComponentContext >& _rxContext,sal_uInt16 nExportFlag) +: SvXMLExport( util::MeasureUnit::MM_100TH, _rxContext, XML_REPORT, EXPORT_OASIS) ,m_bAllreadyFilled(sal_False) { setExportFlags( EXPORT_OASIS | nExportFlag); @@ -307,7 +307,7 @@ ORptExport::ORptExport(const Reference< XMultiServiceFactory >& _rxMSF,sal_uInt1 // ----------------------------------------------------------------------------- Reference< XInterface > ORptExport::create(Reference< XComponentContext > const & xContext) { - return *(new ORptExport(Reference< XMultiServiceFactory >(xContext->getServiceManager(),UNO_QUERY))); + return *(new ORptExport(xContext)); } // ----------------------------------------------------------------------------- diff --git a/reportdesign/source/filter/xml/xmlExport.hxx b/reportdesign/source/filter/xml/xmlExport.hxx index b3d8bf2e5065..8e048cc5d94b 100644 --- a/reportdesign/source/filter/xml/xmlExport.hxx +++ b/reportdesign/source/filter/xml/xmlExport.hxx @@ -185,7 +185,7 @@ protected: virtual ~ORptExport(){}; public: - ORptExport(const Reference< XMultiServiceFactory >& _rxMSF, sal_uInt16 nExportFlag = (EXPORT_CONTENT | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS)); + ORptExport(const Reference< XComponentContext >& _rxContext, sal_uInt16 nExportFlag = (EXPORT_CONTENT | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS)); // XServiceInfo virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 2a595b03a296..4be03fce76f0 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -225,7 +225,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_getSupportedServiceNames( uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport( rSMgr, EXPORT_ALL ); + return (cppu::OWeakObject*)new ScXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL ); } OUString SAL_CALL ScXMLOOoExport_Meta_getImplementationName() throw() @@ -242,7 +242,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Meta_getSupportedServiceN uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Meta_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport( rSMgr, EXPORT_META ); + return (cppu::OWeakObject*)new ScXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META ); } OUString SAL_CALL ScXMLOOoExport_Styles_getImplementationName() throw() @@ -259,7 +259,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Styles_getSupportedServic uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Styles_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport( rSMgr, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS); + return (cppu::OWeakObject*)new ScXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS); } OUString SAL_CALL ScXMLOOoExport_Content_getImplementationName() throw() @@ -276,7 +276,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Content_getSupportedServi uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Content_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport( rSMgr, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS); + return (cppu::OWeakObject*)new ScXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS); } OUString SAL_CALL ScXMLOOoExport_Settings_getImplementationName() throw() @@ -293,7 +293,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOOoExport_Settings_getSupportedServ uno::Reference< uno::XInterface > SAL_CALL ScXMLOOoExport_Settings_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport( rSMgr, EXPORT_SETTINGS ); + return (cppu::OWeakObject*)new ScXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS ); } // Oasis Filter @@ -313,7 +313,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_getSupportedServiceName uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport(rSMgr, EXPORT_ALL|EXPORT_OASIS); + return (cppu::OWeakObject*)new ScXMLExport(comphelper::getComponentContext(rSMgr), EXPORT_ALL|EXPORT_OASIS); } OUString SAL_CALL ScXMLOasisExport_Meta_getImplementationName() throw() @@ -331,7 +331,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Meta_getSupportedServic uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Meta_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport(rSMgr, EXPORT_META|EXPORT_OASIS); + return (cppu::OWeakObject*)new ScXMLExport(comphelper::getComponentContext(rSMgr), EXPORT_META|EXPORT_OASIS); } OUString SAL_CALL ScXMLOasisExport_Styles_getImplementationName() throw() @@ -349,7 +349,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Styles_getSupportedServ uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Styles_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport(rSMgr, EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS|EXPORT_OASIS); + return (cppu::OWeakObject*)new ScXMLExport(comphelper::getComponentContext(rSMgr), EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS|EXPORT_OASIS); } OUString SAL_CALL ScXMLOasisExport_Content_getImplementationName() throw() @@ -367,7 +367,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Content_getSupportedSer uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Content_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport(rSMgr, EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS|EXPORT_OASIS); + return (cppu::OWeakObject*)new ScXMLExport(comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_FONTDECLS|EXPORT_OASIS); } OUString SAL_CALL ScXMLOasisExport_Settings_getImplementationName() throw() @@ -385,7 +385,7 @@ uno::Sequence< rtl::OUString > SAL_CALL ScXMLOasisExport_Settings_getSupportedSe uno::Reference< uno::XInterface > SAL_CALL ScXMLOasisExport_Settings_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) { - return (cppu::OWeakObject*)new ScXMLExport(rSMgr, EXPORT_SETTINGS|EXPORT_OASIS); + return (cppu::OWeakObject*)new ScXMLExport(comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS|EXPORT_OASIS); } //---------------------------------------------------------------------------- @@ -434,10 +434,10 @@ sal_Int16 ScXMLExport::GetFieldUnit() // #110680# ScXMLExport::ScXMLExport( - 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 nExportFlag) : SvXMLExport( SvXMLUnitConverter::GetMeasureUnit(GetFieldUnit()), - xServiceFactory, XML_SPREADSHEET, nExportFlag ), + xContext, XML_SPREADSHEET, nExportFlag ), pDoc(NULL), nSourceStreamPos(0), pNumberFormatAttributesExportHelper(NULL), diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx index 6baa28e5e764..8e66d15cefac 100644 --- a/sc/source/filter/xml/xmlexprt.hxx +++ b/sc/source/filter/xml/xmlexprt.hxx @@ -223,9 +223,8 @@ protected: virtual XMLShapeExport* CreateShapeExport(); virtual XMLFontAutoStylePool* CreateFontAutoStylePool(); public: - // #110680# ScXMLExport( - 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 nExportFlag); virtual ~ScXMLExport(); diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx index d87fc6076b17..f18ebbc2ec5f 100644 --- a/starmath/source/mathmlexport.cxx +++ b/starmath/source/mathmlexport.cxx @@ -362,9 +362,9 @@ sal_Bool SmXMLExportWrapper::WriteThroughComponent( //////////////////////////////////////////////////////////// SmXMLExport::SmXMLExport( - 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 nExportFlags) -: SvXMLExport(util::MeasureUnit::INCH, xServiceFactory, XML_MATH, +: SvXMLExport(util::MeasureUnit::INCH, xContext, XML_MATH, nExportFlags) , pTree(0) , bSuccess(sal_False) @@ -413,7 +413,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExport_createInstance( // EXPORT_OASIS is required here allthough there is no differrence between // OOo and OASIS, because without the flag, a transformation to OOo would // be chained in. - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_ALL ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_OASIS|EXPORT_ALL ); } //////////////////////////////////////////////////////////// @@ -435,7 +435,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMetaOOO_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_META ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META ); } //////////////////////////////////////////////////////////// @@ -457,7 +457,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExportMeta_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_META ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_OASIS|EXPORT_META ); } //////////////////////////////////////////////////////////// @@ -479,7 +479,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettingsOOO_createInstance const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_SETTINGS ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS ); } //////////////////////////////////////////////////////////// @@ -501,7 +501,7 @@ uno::Reference< uno::XInterface > SAL_CALL SmXMLExportSettings_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_SETTINGS ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_OASIS|EXPORT_SETTINGS ); } //////////////////////////////////////////////////////////// @@ -525,7 +525,7 @@ throw( uno::Exception ) { // The EXPORT_OASIS flag is only required to avoid that a transformer is // chanied in - return (cppu::OWeakObject*)new SmXMLExport( rSMgr, EXPORT_OASIS|EXPORT_CONTENT ); + return (cppu::OWeakObject*)new SmXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_OASIS|EXPORT_CONTENT ); } //////////////////////////////////////////////////////////// diff --git a/starmath/source/mathmlexport.hxx b/starmath/source/mathmlexport.hxx index 82eaf7a4fa14..98da8d7e8ee0 100644 --- a/starmath/source/mathmlexport.hxx +++ b/starmath/source/mathmlexport.hxx @@ -103,7 +103,7 @@ protected: public: SmXMLExport( - 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 nExportFlags=EXPORT_ALL); virtual ~SmXMLExport() {}; diff --git a/svx/source/inc/xmlxtexp.hxx b/svx/source/inc/xmlxtexp.hxx index 4ec56a7ccb9c..04a17e2ecd90 100644 --- a/svx/source/inc/xmlxtexp.hxx +++ b/svx/source/inc/xmlxtexp.hxx @@ -37,7 +37,7 @@ class SvxXMLXTableExportComponent : public SvXMLExport public: // #110680# SvxXMLXTableExportComponent( - 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 rtl::OUString& rFileName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > & xHandler, const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > & xTable, diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index 3786c4d5c9a4..36de147adf29 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -146,12 +146,12 @@ private: // #110680# SvxXMLXTableExportComponent::SvxXMLXTableExportComponent( - 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 OUString& rFileName, const uno::Reference<xml::sax::XDocumentHandler> & rHandler, const uno::Reference<container::XNameContainer >& xTable, uno::Reference<document::XGraphicObjectResolver >& xGrfResolver ) -: SvXMLExport( xServiceFactory, rFileName, rHandler, NULL, MAP_100TH_MM), +: SvXMLExport( xContext, rFileName, rHandler, NULL, MAP_100TH_MM), mxTable( xTable ) { @@ -227,13 +227,7 @@ bool SvxXMLXTableExportComponent::save( try { - uno::Reference< lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() ); uno::Reference< uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - if( !xServiceFactory.is() ) - { - OSL_FAIL( "got no service manager" ); - return false; - } uno::Reference< xml::sax::XWriter > xWriter = xml::sax::Writer::create( xContext ); @@ -306,7 +300,7 @@ bool SvxXMLXTableExportComponent::save( // Finally do the export const OUString aName; - SvxXMLXTableExportComponent aExporter( xServiceFactory, aName, xHandler, xTable, xGrfResolver ); + SvxXMLXTableExportComponent aExporter( xContext, aName, xHandler, xTable, xGrfResolver ); bRet = aExporter.exportTable(); if( pGraphicHelper ) diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx index bd50c7b0a5e9..10597655f56e 100644 --- a/sw/source/core/inc/SwXMLBlockExport.hxx +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -32,7 +32,7 @@ private: public: SwXMLBlockListExport( - 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, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); @@ -51,7 +51,7 @@ private: public: SwXMLTextBlockExport( - 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, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); diff --git a/sw/source/core/swg/SwXMLBlockExport.cxx b/sw/source/core/swg/SwXMLBlockExport.cxx index a4c82e4d6675..9239474f68bc 100644 --- a/sw/source/core/swg/SwXMLBlockExport.cxx +++ b/sw/source/core/swg/SwXMLBlockExport.cxx @@ -29,11 +29,11 @@ using ::rtl::OUString; // #110680# SwXMLBlockListExport::SwXMLBlockListExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, uno::Reference< xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), rBlockList(rBlocks) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ), @@ -80,11 +80,11 @@ sal_uInt32 SwXMLBlockListExport::exportDoc(enum XMLTokenEnum ) // #110680# SwXMLTextBlockExport::SwXMLTextBlockExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, SwXMLTextBlocks & rBlocks, const rtl::OUString &rFileName, uno::Reference< xml::sax::XDocumentHandler> &rHandler) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), rBlockList(rBlocks) { _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ), diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index ddff63fd9a79..152014d82180 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -370,16 +370,8 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , String aFolderName( rPackageName ); String aStreamName = aFolderName + rtl::OUString(".xml"); - 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 ? - } uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); sal_uLong nRes = 0; @@ -402,9 +394,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const String& rShort, const String& , uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - // #110680# - // SwXMLTextBlockExport aExp(*this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); - SwXMLTextBlockExport aExp( xServiceFactory, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); + SwXMLTextBlockExport aExp( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler); aExp.exportDoc( rText ); @@ -453,12 +443,6 @@ void SwXMLTextBlocks::ReadInfo( void ) 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 = sDocName; @@ -467,8 +451,6 @@ void SwXMLTextBlocks::ReadInfo( void ) aParserInput.aInputStream = xDocStream->getInputStream(); // get filter - // #110680# - // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( *this ); uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLBlockListImport( xServiceFactory, *this ); // connect parser and filter @@ -502,16 +484,8 @@ void SwXMLTextBlocks::WriteInfo( void ) { if ( xBlkRoot.is() || 0 == OpenFile ( sal_False ) ) { - 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 ? - } uno::Reference < xml::sax::XWriter > xWriter = xml::sax::Writer::create(xContext); OUString sDocName( RTL_CONSTASCII_USTRINGPARAM( XMLN_BLOCKLIST ) ); @@ -540,7 +514,7 @@ void SwXMLTextBlocks::WriteInfo( void ) uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); - SwXMLBlockListExport aExp( xServiceFactory, *this, OUString(RTL_CONSTASCII_USTRINGPARAM(XMLN_BLOCKLIST)), xHandler); + SwXMLBlockListExport aExp( xContext, *this, OUString(RTL_CONSTASCII_USTRINGPARAM(XMLN_BLOCKLIST)), xHandler); aExp.exportDoc( XML_BLOCK_LIST ); diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 2d2d90388eb0..1d508071057c 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -80,9 +80,9 @@ using namespace ::com::sun::star::xforms; using namespace ::xmloff::token; SwXMLExport::SwXMLExport( - const uno::Reference< lang::XMultiServiceFactory > xServiceFactory, + const uno::Reference< uno::XComponentContext > xContext, sal_uInt16 nExportFlags) -: SvXMLExport( util::MeasureUnit::INCH, xServiceFactory, XML_TEXT, +: SvXMLExport( util::MeasureUnit::INCH, xContext, XML_TEXT, nExportFlags ), pTableItemMapper( 0 ), pTableLines( 0 ), @@ -537,7 +537,7 @@ Reference< XInterface > SAL_CALL SwXMLExportOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL); } OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw() @@ -558,7 +558,7 @@ Reference< XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS ); } @@ -581,7 +581,7 @@ Reference< XInterface > SAL_CALL SwXMLExportContentOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS | EXPORT_FONTDECLS ); } @@ -604,7 +604,7 @@ Reference< XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_META); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META); } OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw() @@ -625,7 +625,7 @@ Reference< XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_SETTINGS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS); } // OASIS @@ -647,7 +647,7 @@ Reference< XInterface > SAL_CALL SwXMLExport_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, EXPORT_ALL|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL|EXPORT_OASIS); } OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw() @@ -668,7 +668,7 @@ Reference< XInterface > SAL_CALL SwXMLExportStyles_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport( rSMgr, + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_MASTERSTYLES | EXPORT_AUTOSTYLES | EXPORT_FONTDECLS|EXPORT_OASIS ); } @@ -692,7 +692,7 @@ Reference< XInterface > SAL_CALL SwXMLExportContent_createInstance( throw( Exception ) { return (cppu::OWeakObject*)new SwXMLExport( - rSMgr, + comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_SCRIPTS | EXPORT_FONTDECLS|EXPORT_OASIS ); } @@ -715,7 +715,7 @@ Reference< XInterface > SAL_CALL SwXMLExportMeta_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_META|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META|EXPORT_OASIS); } OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw() @@ -736,7 +736,7 @@ Reference< XInterface > SAL_CALL SwXMLExportSettings_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new SwXMLExport(rSMgr, EXPORT_SETTINGS|EXPORT_OASIS); + return (cppu::OWeakObject*)new SwXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_SETTINGS|EXPORT_OASIS); } namespace diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx index 9015bc6e152d..9af8a5cee5c8 100644 --- a/sw/source/filter/xml/xmlexp.hxx +++ b/sw/source/filter/xml/xmlexp.hxx @@ -118,7 +118,7 @@ protected: public: SwXMLExport( - 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 nExportFlags = EXPORT_ALL); virtual ~SwXMLExport(); diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index d17c101d30ce..d0235e96acec 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -41,6 +41,7 @@ #include "swrect.hxx" #include "xmlexp.hxx" #include <editeng/memberids.hrc> +#include <comphelper/processfactory.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -222,7 +223,7 @@ inline void SwXMLTableItemMapper_Impl::SetAbsWidth( sal_uInt32 nAbs ) void SwXMLExport::_InitItemExport() { - pTwipUnitConv = new SvXMLUnitConverter(getServiceFactory(), + pTwipUnitConv = new SvXMLUnitConverter(getComponentContext(), util::MeasureUnit::TWIP, GetMM100UnitConverter().GetXMLMeasureUnit()); xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index 0c505beb868a..8359cafa58d6 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -38,6 +38,7 @@ #include <editeng/memberids.hrc> #include <svx/unomid.hxx> +#include <comphelper/processfactory.hxx> #include <hintids.hxx> #include <paratr.hxx> @@ -335,7 +336,7 @@ SvXMLImportContext *SwXMLItemSetContext_Impl::CreateChildContext( void SwXMLImport::_InitItemImport() { - pTwipUnitConv = new SvXMLUnitConverter( getServiceFactory(), + pTwipUnitConv = new SvXMLUnitConverter( comphelper::getComponentContext(getServiceFactory()), util::MeasureUnit::TWIP, util::MeasureUnit::TWIP ); xTableItemMap = new SvXMLItemMapEntries( aXMLTableItemMap ); diff --git a/xmloff/inc/MetaExportComponent.hxx b/xmloff/inc/MetaExportComponent.hxx index c91f1b1fbcc4..2d4881a0f01e 100644 --- a/xmloff/inc/MetaExportComponent.hxx +++ b/xmloff/inc/MetaExportComponent.hxx @@ -30,10 +30,8 @@ class XMLMetaExportComponent : public SvXMLExport ::com::sun::star::document::XDocumentProperties > mxDocProps; public: - // #110680# - // XMLMetaExportComponent(); XMLMetaExportComponent( - 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 nFlags ); diff --git a/xmloff/inc/SchXMLExport.hxx b/xmloff/inc/SchXMLExport.hxx index 204abba6288c..46f63c9aa5af 100644 --- a/xmloff/inc/SchXMLExport.hxx +++ b/xmloff/inc/SchXMLExport.hxx @@ -55,7 +55,7 @@ protected: public: // #110680# SchXMLExport( - 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 nExportFlags = EXPORT_ALL ); virtual ~SchXMLExport(); diff --git a/xmloff/inc/xmloff/xmlexp.hxx b/xmloff/inc/xmloff/xmlexp.hxx index 7482971c1614..7ec93bd70206 100644 --- a/xmloff/inc/xmloff/xmlexp.hxx +++ b/xmloff/inc/xmloff/xmlexp.hxx @@ -50,6 +50,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/container/XNamed.hpp> #include <unotools/saveopt.hxx> @@ -75,7 +76,6 @@ class XMLErrors; namespace rtl { class OUString; } namespace com { namespace sun { namespace star { - namespace uno { class XComponentContext; } namespace frame { class XModel; } namespace container { class XIndexContainer; } } } } @@ -106,8 +106,7 @@ class XMLOFF_DLLPUBLIC SvXMLExport : public ::cppu::WeakImplHelper6< { SvXMLExport_Impl *mpImpl; // dummy - // #110680# - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxServiceFactory; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel; ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler; // the handlers @@ -264,36 +263,20 @@ protected: public: - // #110680# - //SvXMLExport( MapUnit eDfltUnit, - // const enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID, - // sal_uInt16 nExportFlag = EXPORT_ALL ); SvXMLExport( sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, - 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 enum ::xmloff::token::XMLTokenEnum eClass = xmloff::token::XML_TOKEN_INVALID, sal_uInt16 nExportFlag = EXPORT_ALL ); - // #110680# - //SvXMLExport( const ::rtl::OUString& rFileName, - // const ::com::sun::star::uno::Reference< - // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, - // MapUnit eDfltUnit = MAP_INCH ); SvXMLExport( - 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 ::rtl::OUString& rFileName, sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler); - // #110680# - //SvXMLExport( const ::rtl::OUString& rFileName, - // const ::com::sun::star::uno::Reference< - // ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, - // const ::com::sun::star::uno::Reference< - // ::com::sun::star::frame::XModel > &, - // sal_Int16 eDfltUnit ); SvXMLExport( - 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 ::rtl::OUString& rFileName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > &, @@ -523,8 +506,7 @@ 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(); // Shapes in Writer cannot be named via context menu (#i51726#) SvtModuleOptions::EFactory GetModelType() const diff --git a/xmloff/inc/xmloff/xmluconv.hxx b/xmloff/inc/xmloff/xmluconv.hxx index 0fb3fa2485ac..7e6e33a82256 100644 --- a/xmloff/inc/xmloff/xmluconv.hxx +++ b/xmloff/inc/xmloff/xmluconv.hxx @@ -36,8 +36,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/drawing/Position3D.hpp> -// #110680# -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -95,7 +94,7 @@ public: the default unit for textual measures */ SvXMLUnitConverter( const ::com::sun::star::uno::Reference< - ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + ::com::sun::star::uno::XComponentContext >& xContext, sal_Int16 eCoreMeasureUnit, sal_Int16 eXMLMeasureUnit); diff --git a/xmloff/inc/xmlversion.hxx b/xmloff/inc/xmlversion.hxx index dacb331e934f..6c116edd4a8a 100644 --- a/xmloff/inc/xmlversion.hxx +++ b/xmloff/inc/xmlversion.hxx @@ -39,7 +39,7 @@ private: const com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag >& maVersions; public: XMLVersionListExport( - 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::Sequence < com::sun::star::util::RevisionTag >& rVersions, const rtl::OUString &rFileName, com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler ); diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index e15819bf91ec..833a3b0f4196 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -1086,7 +1086,7 @@ SchXMLExportHelper_Impl::SchXMLExportHelper_Impl( // #110680# // changed initialisation for msCLSID. Compare the ServiceInfo name with // the known name of the LegacyServiceManager. - Reference<lang::XServiceInfo> xServiceInfo( mrExport.getServiceFactory(), uno::UNO_QUERY ); + Reference<lang::XServiceInfo> xServiceInfo( mrExport.getComponentContext()->getServiceManager(), uno::UNO_QUERY ); DBG_ASSERT( xServiceInfo.is(), "XMultiServiceFactory without xServiceInfo (!)" ); OUString rdbURL = xServiceInfo->getImplementationName(); OUString implLegacyServiceManagerName( "com.sun.star.comp.office.LegacyServiceManager" ); @@ -3626,11 +3626,10 @@ void SchXMLExportHelper_Impl::exportText( const OUString& rText, bool bConvertTa // class SchXMLExport // ======================================== -// #110680# SchXMLExport::SchXMLExport( - const Reference< lang::XMultiServiceFactory >& xServiceFactory, + const Reference< uno::XComponentContext >& xContext, sal_uInt16 nExportFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, +: SvXMLExport( util::MeasureUnit::CM, xContext, ::xmloff::token::XML_CHART, nExportFlags ), maAutoStylePool( *this ), maExportHelper( *this, maAutoStylePool ) @@ -3836,7 +3835,7 @@ Reference< uno::XInterface > SAL_CALL SchXMLExport_createInstance(const Referenc { // #110680# // #103997# removed some flags from EXPORT_ALL - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )); } // Oasis format @@ -3855,7 +3854,7 @@ OUString SAL_CALL SchXMLExport_Oasis_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #103997# removed some flags from EXPORT_ALL - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), (EXPORT_ALL ^ ( EXPORT_SETTINGS | EXPORT_MASTERSTYLES | EXPORT_SCRIPTS )) | EXPORT_OASIS ); } @@ -3878,7 +3877,7 @@ OUString SAL_CALL SchXMLExport_Styles_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Styles_createInstance(const Reference< lang::XMultiServiceFactory >& rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES ); } // Oasis format @@ -3896,7 +3895,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Styles_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Styles_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_STYLES | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_STYLES | EXPORT_OASIS ); } // ------------------------------------------------------------ @@ -3916,7 +3915,7 @@ OUString SAL_CALL SchXMLExport_Content_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { // #110680# - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS ); } // Oasis format @@ -3934,7 +3933,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Content_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Content_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_AUTOSTYLES | EXPORT_CONTENT | EXPORT_FONTDECLS | EXPORT_OASIS ); } // ------------------------------------------------------------ @@ -3954,7 +3953,7 @@ OUString SAL_CALL SchXMLExport_Oasis_Meta_getImplementationName() throw() Reference< uno::XInterface > SAL_CALL SchXMLExport_Oasis_Meta_createInstance(const Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new SchXMLExport( rSMgr, EXPORT_META | EXPORT_OASIS ); + return (cppu::OWeakObject*)new SchXMLExport( comphelper::getComponentContext(rSMgr), EXPORT_META | EXPORT_OASIS ); } diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 94e145412a34..3d0f92342b14 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -81,6 +81,7 @@ #include <unotools/configmgr.hxx> #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XMLOasisBasicExporter.hpp> #include <com/sun/star/embed/XEncryptionProtectedSource2.hpp> #include <com/sun/star/rdf/XMetadatable.hpp> #include "RDFaExportHelper.hxx" @@ -204,7 +205,7 @@ void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters ) Reference< XComponentContext > SettingsExportFacade::GetComponentContext() const { - return comphelper::getComponentContext( m_rExport.getServiceFactory() ); + return m_rExport.getComponentContext(); } //============================================================================== @@ -441,13 +442,13 @@ void SvXMLExport::_DetermineModelType() SvXMLExport::SvXMLExport( sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, - const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory, + const uno::Reference< uno::XComponentContext >& xContext, const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags ) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mpAttrList( new SvXMLAttributeList ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -461,23 +462,23 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); + DBG_ASSERT( xContext.is(), "got no service manager" ); _InitCtor(); } SvXMLExport::SvXMLExport( - 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 OUString &rFileName, sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/, const uno::Reference< xml::sax::XDocumentHandler > & rHandler) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mxHandler( rHandler ), mxExtHandler( rHandler, uno::UNO_QUERY ), mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ), mpNumExport(0L), mpProgressBarHelper( NULL ), @@ -491,8 +492,8 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { + DBG_ASSERT( xContext.is(), "got no service manager" ); mpImpl->SetSchemeOf( msOrigFileName ); - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); _InitCtor(); if (mxNumberFormatsSupplier.is()) @@ -500,13 +501,13 @@ SvXMLExport::SvXMLExport( } SvXMLExport::SvXMLExport( - 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 OUString &rFileName, const uno::Reference< xml::sax::XDocumentHandler > & rHandler, const Reference< XModel >& rModel, sal_Int16 const eDefaultFieldUnit) : mpImpl( new SvXMLExport_Impl ), - mxServiceFactory(xServiceFactory), + m_xContext(xContext), mxModel( rModel ), mxHandler( rHandler ), mxExtHandler( rHandler, uno::UNO_QUERY ), @@ -514,7 +515,7 @@ SvXMLExport::SvXMLExport( mpAttrList( new SvXMLAttributeList ), msOrigFileName( rFileName ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter(getServiceFactory(), + mpUnitConv( new SvXMLUnitConverter( xContext, util::MeasureUnit::MM_100TH, SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit)) ), mpNumExport(0L), @@ -529,8 +530,8 @@ SvXMLExport::SvXMLExport( msWS( GetXMLToken(XML_WS) ), mbSaveLinkedSections(sal_True) { + DBG_ASSERT( xContext.is(), "got no service manager" ); mpImpl->SetSchemeOf( msOrigFileName ); - DBG_ASSERT( mxServiceFactory.is(), "got no service manager" ); _InitCtor(); if (mxNumberFormatsSupplier.is()) @@ -1262,55 +1263,50 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) } if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + try { - try + ::comphelper::PropertyMapEntry aInfoMap[] = { - ::comphelper::PropertyMapEntry aInfoMap[] = - { - { "Class", sizeof("Class")-1, 0, - &::getCppuType((::rtl::OUString*)0), - PropertyAttribute::MAYBEVOID, 0}, - { NULL, 0, 0, NULL, 0, 0 } - }; - Reference< XPropertySet > xConvPropSet( - ::comphelper::GenericPropertySet_CreateInstance( - new ::comphelper::PropertySetInfo( aInfoMap ) ) ); - - Any aAny; - aAny <<= GetXMLToken( eClass ); - xConvPropSet->setPropertyValue( - OUString("Class"), aAny ); - - Reference< XPropertySet > xPropSet = - mxExportInfo.is() - ? PropertySetMerger_CreateInstance( mxExportInfo, - xConvPropSet ) - : xConvPropSet; - - Sequence<Any> aArgs( 3 ); - aArgs[0] <<= mxHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= mxModel; - - // get filter component - Reference< xml::sax::XDocumentHandler > xTmpDocHandler( - xFactory->createInstanceWithArguments( - OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), UNO_QUERY); - OSL_ENSURE( xTmpDocHandler.is(), - "can't instantiate OASIS transformer component" ); - if( xTmpDocHandler.is() ) - { - mxHandler = xTmpDocHandler; - mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY ); - } - } - catch(const com::sun::star::uno::Exception&) + { "Class", sizeof("Class")-1, 0, + &::getCppuType((::rtl::OUString*)0), + PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + Reference< XPropertySet > xConvPropSet( + ::comphelper::GenericPropertySet_CreateInstance( + new ::comphelper::PropertySetInfo( aInfoMap ) ) ); + + Any aAny; + aAny <<= GetXMLToken( eClass ); + xConvPropSet->setPropertyValue( + OUString("Class"), aAny ); + + Reference< XPropertySet > xPropSet = + mxExportInfo.is() + ? PropertySetMerger_CreateInstance( mxExportInfo, + xConvPropSet ) + : xConvPropSet; + + Sequence<Any> aArgs( 3 ); + aArgs[0] <<= mxHandler; + aArgs[1] <<= xPropSet; + aArgs[2] <<= mxModel; + + // get filter component + Reference< xml::sax::XDocumentHandler > xTmpDocHandler( + m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.Oasis2OOoTransformer", aArgs, m_xContext), + UNO_QUERY); + OSL_ENSURE( xTmpDocHandler.is(), + "can't instantiate OASIS transformer component" ); + if( xTmpDocHandler.is() ) { + mxHandler = xTmpDocHandler; + mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY ); } } + catch(const com::sun::star::uno::Exception&) + { + } } mxHandler->startDocument(); @@ -1501,32 +1497,13 @@ void SvXMLExport::_ExportScripts() xPSet->getPropertyValue( ::rtl::OUString( "BasicLibraries" ) ); } - Reference< document::XExporter > xExporter; - Reference< lang::XMultiServiceFactory > xMSF( getServiceFactory() ); - if ( xMSF.is() ) - { - Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) ); - Sequence < Any > aArgs( 1 ); - aArgs[0] <<= xHdl; - xExporter.set( xMSF->createInstanceWithArguments( - OUString( "com.sun.star.document.XMLOasisBasicExporter" ), aArgs ), - UNO_QUERY ); - } + Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) ); + Reference< document::XXMLBasicExporter > xExporter = document::XMLOasisBasicExporter::createWithHandler( m_xContext, xHdl ); - OSL_ENSURE( xExporter.is(), - "SvXMLExport::_ExportScripts: can't instantiate export filter component for Basic macros" ); - - if ( xExporter.is() ) - { - Reference< XComponent > xComp( mxModel, UNO_QUERY ); - xExporter->setSourceDocument( xComp ); - Reference< XFilter > xFilter( xExporter, UNO_QUERY ); - if ( xFilter.is() ) - { - Sequence < PropertyValue > aMediaDesc( 0 ); - xFilter->filter( aMediaDesc ); - } - } + Reference< XComponent > xComp( mxModel, UNO_QUERY ); + xExporter->setSourceDocument( xComp ); + Sequence< PropertyValue > aMediaDesc( 0 ); + xExporter->filter( aMediaDesc ); } // export document events @@ -2144,13 +2121,9 @@ sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp ) } aArgs[0] <<= xHdl; - // #110680# - // Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory(); - Reference< lang::XMultiServiceFactory > xServiceFactory = getServiceFactory(); - Reference< document::XExporter > xExporter( - xServiceFactory->createInstanceWithArguments( sFilterService, aArgs), - UNO_QUERY); + m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(sFilterService, aArgs, m_xContext), + UNO_QUERY); OSL_ENSURE( xExporter.is(), "can't instantiate export filter component for own object" ); if( !xExporter.is() ) @@ -2365,9 +2338,9 @@ void SvXMLExport::DisposingModel() mxEventListener.clear(); } -::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory() +::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SvXMLExport::getComponentContext() { - return mxServiceFactory; + return m_xContext; } ::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper() diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 1db8a015f5f7..bfa39220bee9 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -400,7 +400,7 @@ SvXMLImport::SvXMLImport( : mpImpl( new SvXMLImport_Impl() ), mpNamespaceMap( new SvXMLNamespaceMap ), - mpUnitConv( new SvXMLUnitConverter( xServiceFactory, + mpUnitConv( new SvXMLUnitConverter( comphelper::getComponentContext(xServiceFactory), util::MeasureUnit::MM_100TH, util::MeasureUnit::MM_100TH) ), mpContexts( new SvXMLImportContexts_Impl ), diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index cb8f1036b8b2..604c0cd6d90b 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/text/DefaultNumberingProvider.hpp> #include <com/sun/star/text/XDefaultNumberingProvider.hpp> #include <com/sun/star/text/XNumberingTypeInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/i18n/CharacterClassification.hpp> #include <com/sun/star/i18n/UnicodeType.hpp> #include <basegfx/vector/b3dvector.hxx> @@ -66,19 +65,19 @@ struct SvXMLUnitConverter::Impl sal_Int16 m_eCoreMeasureUnit; sal_Int16 m_eXMLMeasureUnit; util::Date m_aNullDate; - uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo; - uno::Reference< i18n::XCharacterClassification > m_xCharClass; - uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory; + mutable uno::Reference< text::XNumberingTypeInfo > m_xNumTypeInfo; + mutable uno::Reference< i18n::XCharacterClassification > m_xCharClass; + uno::Reference< uno::XComponentContext > m_xContext; - Impl(uno::Reference<lang::XMultiServiceFactory> const& xServiceFactory, + Impl(uno::Reference<uno::XComponentContext> const& xContext, sal_Int16 const eCoreMeasureUnit, sal_Int16 const eXMLMeasureUnit) : m_eCoreMeasureUnit(eCoreMeasureUnit) , m_eXMLMeasureUnit(eXMLMeasureUnit) , m_aNullDate(30, 12, 1899) - , m_xServiceFactory(xServiceFactory) + , m_xContext(xContext) { - OSL_ENSURE( m_xServiceFactory.is(), "got no service manager" ); + OSL_ENSURE( m_xContext.is(), "got no service manager" ); } void createNumTypeInfo() const; @@ -87,13 +86,8 @@ struct SvXMLUnitConverter::Impl void SvXMLUnitConverter::Impl::createNumTypeInfo() const { - if (m_xServiceFactory.is()) - { - Reference<XComponentContext> xContext( comphelper::getComponentContext(m_xServiceFactory) ); - Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create(xContext); - const_cast<Impl*>(this)->m_xNumTypeInfo = - Reference<XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY); - } + Reference<XDefaultNumberingProvider> xDefNum = DefaultNumberingProvider::create(m_xContext); + m_xNumTypeInfo = Reference<XNumberingTypeInfo>(xDefNum, uno::UNO_QUERY); } const uno::Reference< text::XNumberingTypeInfo >& @@ -127,10 +121,10 @@ sal_Int16 SvXMLUnitConverter::GetXMLMeasureUnit() const */ SvXMLUnitConverter::SvXMLUnitConverter( - const uno::Reference<lang::XMultiServiceFactory>& xServiceFactory, + const uno::Reference<uno::XComponentContext>& xContext, sal_Int16 const eCoreMeasureUnit, sal_Int16 const eXMLMeasureUnit) -: m_pImpl(new Impl(xServiceFactory, eCoreMeasureUnit, eXMLMeasureUnit)) +: m_pImpl(new Impl(xContext, eCoreMeasureUnit, eXMLMeasureUnit)) { } @@ -799,34 +793,26 @@ OUString SvXMLUnitConverter::encodeStyleName( { if (!m_pImpl->m_xCharClass.is()) { - if (m_pImpl->m_xServiceFactory.is()) - { - const_cast < SvXMLUnitConverter * >(this) - ->m_pImpl->m_xCharClass = CharacterClassification::create( - comphelper::getComponentContext(m_pImpl->m_xServiceFactory) ); - } + this->m_pImpl->m_xCharClass = CharacterClassification::create( m_pImpl->m_xContext ); } - if (m_pImpl->m_xCharClass.is()) + sal_Int16 nType = m_pImpl->m_xCharClass->getType(rName, i); + + switch( nType ) { - sal_Int16 nType = m_pImpl->m_xCharClass->getType(rName, i); - - switch( nType ) - { - case UnicodeType::UPPERCASE_LETTER: // Lu - case UnicodeType::LOWERCASE_LETTER: // Ll - case UnicodeType::TITLECASE_LETTER: // Lt - case UnicodeType::OTHER_LETTER: // Lo - case UnicodeType::LETTER_NUMBER: // Nl - bValidChar = sal_True; - break; - case UnicodeType::NON_SPACING_MARK: // Ms - case UnicodeType::ENCLOSING_MARK: // Me - case UnicodeType::COMBINING_SPACING_MARK: //Mc - case UnicodeType::MODIFIER_LETTER: // Lm - case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd - bValidChar = i > 0; - break; - } + case UnicodeType::UPPERCASE_LETTER: // Lu + case UnicodeType::LOWERCASE_LETTER: // Ll + case UnicodeType::TITLECASE_LETTER: // Lt + case UnicodeType::OTHER_LETTER: // Lo + case UnicodeType::LETTER_NUMBER: // Nl + bValidChar = sal_True; + break; + case UnicodeType::NON_SPACING_MARK: // Ms + case UnicodeType::ENCLOSING_MARK: // Me + case UnicodeType::COMBINING_SPACING_MARK: //Mc + case UnicodeType::MODIFIER_LETTER: // Lm + case UnicodeType::DECIMAL_DIGIT_NUMBER: // Nd + bValidChar = i > 0; + break; } } } diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 237f670c45f0..d33db725215f 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -64,6 +64,7 @@ #include <cppuhelper/implbase1.hxx> #include <comphelper/extract.hxx> +#include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include "PropertySetMerger.hxx" #include "layerexp.hxx" @@ -396,9 +397,9 @@ ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterI // #110680# SdXMLExport::SdXMLExport( - 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 nExportFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, +: SvXMLExport( util::MeasureUnit::CM, xContext, (bIsDraw) ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), mnDocMasterPageCount(0L), mnDocDrawPageCount(0L), @@ -2802,7 +2803,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 SdXMLExport( rSMgr, draw, flags );\ + return (cppu::OWeakObject*)new SdXMLExport( comphelper::getComponentContext(rSMgr), draw, flags );\ } SERVICE( XMLImpressExportOasis, "com.sun.star.comp.Impress.XMLOasisExporter", "XMLImpressExportOasis", sal_False, EXPORT_OASIS|EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS|EXPORT_FONTDECLS|EXPORT_EMBEDDED ); diff --git a/xmloff/source/draw/sdxmlexp_impl.hxx b/xmloff/source/draw/sdxmlexp_impl.hxx index 3e3f1e445833..166f57328e17 100644 --- a/xmloff/source/draw/sdxmlexp_impl.hxx +++ b/xmloff/source/draw/sdxmlexp_impl.hxx @@ -176,9 +176,8 @@ protected: virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps); public: - // #110680# SdXMLExport( - 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 nExportFlags = EXPORT_ALL ); virtual ~SdXMLExport(); diff --git a/xmloff/source/draw/shapeexport4.cxx b/xmloff/source/draw/shapeexport4.cxx index ce504fe2b793..58b895e24f4e 100644 --- a/xmloff/source/draw/shapeexport4.cxx +++ b/xmloff/source/draw/shapeexport4.cxx @@ -1234,7 +1234,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( "ReplacementGraphic" ) ), uno::UNO_QUERY ); if( xGraphic.is() ) try { - Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW ); + Reference< uno::XComponentContext > xContext = GetExport().getComponentContext(); uno::Reference< embed::XStorage > xPictureStorage; uno::Reference< embed::XStorage > xStorage; @@ -1243,7 +1243,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape OUString sPictureName; if( bExportEmbedded ) { - xPictureStream.set( xSM->createInstance( OUString( "com.sun.star.comp.MemoryStream" ) ), UNO_QUERY_THROW ); + xPictureStream.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.comp.MemoryStream", xContext), UNO_QUERY_THROW ); } else { @@ -1265,7 +1265,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(comphelper::getComponentContext(xSM)) ); + Reference< graphic::XGraphicProvider > xProvider( graphic::GraphicProvider::create(xContext) ); Sequence< beans::PropertyValue > aArgs( 2 ); aArgs[ 0 ].Name = OUString( "MimeType" ); aArgs[ 0 ].Value <<= OUString( "image/x-vclgraphic" ); diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx index bb3838102f8d..af886136ec0d 100644 --- a/xmloff/source/forms/layerexport.cxx +++ b/xmloff/source/forms/layerexport.cxx @@ -766,7 +766,7 @@ namespace xmloff ::rtl::OUString("US"), ::rtl::OUString() ); - xFormatsSupplier = NumberFormatsSupplier::createWithLocale( comphelper::getComponentContext(m_rContext.getServiceFactory()), aLocale ); + xFormatsSupplier = NumberFormatsSupplier::createWithLocale( m_rContext.getComponentContext(), aLocale ); m_xControlNumberFormats = xFormatsSupplier->getNumberFormats(); } catch(const Exception&) diff --git a/xmloff/source/meta/MetaExportComponent.cxx b/xmloff/source/meta/MetaExportComponent.cxx index 4c1299b04113..515879dbaf8c 100644 --- a/xmloff/source/meta/MetaExportComponent.cxx +++ b/xmloff/source/meta/MetaExportComponent.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/genericpropertyset.hxx> +#include <comphelper/processfactory.hxx> #include <rtl/ustrbuf.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/nmspmap.hxx> @@ -41,9 +42,9 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; XMLMetaExportComponent::XMLMetaExportComponent( - 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 nFlags ) -: SvXMLExport( util::MeasureUnit::CM, xServiceFactory, XML_TEXT, nFlags ) +: SvXMLExport( util::MeasureUnit::CM, xContext, XML_TEXT, nFlags ) { } @@ -74,51 +75,47 @@ sal_uInt32 XMLMetaExportComponent::exportDoc( enum XMLTokenEnum ) if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - uno::Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + uno::Reference< uno::XComponentContext > xContext = getComponentContext(); + try { - try + ::comphelper::PropertyMapEntry aInfoMap[] = { - ::comphelper::PropertyMapEntry aInfoMap[] = - { - { "Class", sizeof("Class")-1, 0, - &::getCppuType((::rtl::OUString*)0), - beans::PropertyAttribute::MAYBEVOID, 0}, - { NULL, 0, 0, NULL, 0, 0 } - }; - uno::Reference< beans::XPropertySet > xConvPropSet( - ::comphelper::GenericPropertySet_CreateInstance( - new ::comphelper::PropertySetInfo( aInfoMap ) ) ); - - uno::Any aAny; - aAny <<= GetXMLToken( XML_TEXT ); - xConvPropSet->setPropertyValue( - ::rtl::OUString("Class"), aAny ); - - uno::Reference< beans::XPropertySet > xPropSet = - getExportInfo().is() - ? PropertySetMerger_CreateInstance( getExportInfo(), - xConvPropSet ) - : getExportInfo(); - - uno::Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= xDocHandler; - aArgs[1] <<= xPropSet; - aArgs[2] <<= GetModel(); - - // get filter component - xDocHandler = uno::Reference< xml::sax::XDocumentHandler >( - xFactory->createInstanceWithArguments( - ::rtl::OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), - uno::UNO_QUERY_THROW ); - - SetDocHandler( xDocHandler ); - } - catch( com::sun::star::uno::Exception& ) - { - OSL_FAIL( "Cannot instantiate com.sun.star.comp.Oasis2OOoTransformer!\n"); - } + { "Class", sizeof("Class")-1, 0, + &::getCppuType((::rtl::OUString*)0), + beans::PropertyAttribute::MAYBEVOID, 0}, + { NULL, 0, 0, NULL, 0, 0 } + }; + uno::Reference< beans::XPropertySet > xConvPropSet( + ::comphelper::GenericPropertySet_CreateInstance( + new ::comphelper::PropertySetInfo( aInfoMap ) ) ); + + uno::Any aAny; + aAny <<= GetXMLToken( XML_TEXT ); + xConvPropSet->setPropertyValue( + ::rtl::OUString("Class"), aAny ); + + uno::Reference< beans::XPropertySet > xPropSet = + getExportInfo().is() + ? PropertySetMerger_CreateInstance( getExportInfo(), + xConvPropSet ) + : getExportInfo(); + + uno::Sequence< uno::Any > aArgs( 3 ); + aArgs[0] <<= xDocHandler; + aArgs[1] <<= xPropSet; + aArgs[2] <<= GetModel(); + + // get filter component + xDocHandler = uno::Reference< xml::sax::XDocumentHandler >( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.Oasis2OOoTransformer", aArgs, xContext), + uno::UNO_QUERY_THROW ); + + SetDocHandler( xDocHandler ); + } + catch( com::sun::star::uno::Exception& ) + { + OSL_FAIL( "Cannot instantiate com.sun.star.comp.Oasis2OOoTransformer!\n"); } } @@ -202,7 +199,7 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportComponent_createInstance const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META|EXPORT_OASIS); + return (cppu::OWeakObject*)new XMLMetaExportComponent( comphelper::getComponentContext(rSMgr), EXPORT_META|EXPORT_OASIS); } uno::Sequence< rtl::OUString > SAL_CALL XMLMetaExportOOO_getSupportedServiceNames() @@ -223,7 +220,7 @@ uno::Reference< uno::XInterface > SAL_CALL XMLMetaExportOOO_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rSMgr) throw( uno::Exception ) { - return (cppu::OWeakObject*)new XMLMetaExportComponent(rSMgr, EXPORT_META); + return (cppu::OWeakObject*)new XMLMetaExportComponent( comphelper::getComponentContext(rSMgr), EXPORT_META); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/meta/xmlversion.cxx b/xmloff/source/meta/xmlversion.cxx index 1a2d0bc87f99..39c74cb17df2 100644 --- a/xmloff/source/meta/xmlversion.cxx +++ b/xmloff/source/meta/xmlversion.cxx @@ -46,11 +46,11 @@ const char XMLN_VERSIONSLIST[] = "VersionList.xml"; // ------------------------------------------------------------------------ // #110897# XMLVersionListExport::XMLVersionListExport( - 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::Sequence < com::sun::star::util::RevisionTag >& rVersions, const OUString &rFileName, Reference< XDocumentHandler > &rHandler ) -: SvXMLExport( xServiceFactory, rFileName, util::MeasureUnit::CM, rHandler ), +: SvXMLExport( xContext, rFileName, util::MeasureUnit::CM, rHandler ), maVersions( rVersions ) { _GetNamespaceMap().AddAtIndex( XML_NAMESPACE_DC_IDX, xmloff::token::GetXMLToken(xmloff::token::XML_NP_DC), @@ -345,9 +345,6 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt if ( xRoot.is() ) { // get the services needed for writing the xml data - Reference< lang::XMultiServiceFactory > xServiceFactory = - comphelper::getProcessServiceFactory(); - DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" ); Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext(); @@ -374,7 +371,7 @@ void SAL_CALL XMLVersionListPersistence::store( const uno::Reference< embed::XSt Reference< XDocumentHandler > xHandler( xWriter, uno::UNO_QUERY ); - XMLVersionListExport aExp( xServiceFactory, rVersions, sVerName, xHandler ); + XMLVersionListExport aExp( xContext, rVersions, sVerName, xHandler ); aExp.exportDoc( ::xmloff::token::XML_VERSION ); diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 0a124371de2d..66e0c121f380 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -246,8 +246,8 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; @@ -281,8 +281,8 @@ SvXMLNumFmtExport::SvXMLNumFmtExport( { LanguageTag aLanguageTag( MsLangId::getSystemLanguage() ); - pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); - pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLanguageTag ); + pCharClass = new CharClass( rExport.getComponentContext(), aLanguageTag ); + pLocaleData = new LocaleDataWrapper( rExport.getComponentContext(), aLanguageTag ); } pUsedList = new SvXMLNumUsedList_Impl; diff --git a/xmloff/source/text/XMLAutoTextEventExport.cxx b/xmloff/source/text/XMLAutoTextEventExport.cxx index d2f865da938c..48175de93543 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.cxx +++ b/xmloff/source/text/XMLAutoTextEventExport.cxx @@ -35,6 +35,7 @@ #include <xmloff/XMLEventExport.hxx> #include <tools/debug.hxx> #include <tools/fldunit.hxx> +#include <comphelper/processfactory.hxx> using namespace ::com::sun::star; @@ -63,10 +64,10 @@ const sal_Char sAPI_AutoText[] = "com.sun.star.text.AutoTextContainer"; XMLAutoTextEventExport::XMLAutoTextEventExport( - 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 nFlags ) -: SvXMLExport(util::MeasureUnit::INCH, xServiceFactory, XML_AUTO_TEXT, nFlags) +: SvXMLExport(util::MeasureUnit::INCH, xContext, XML_AUTO_TEXT, nFlags) , sEventType("EventType"), sNone("None") @@ -115,31 +116,30 @@ sal_uInt32 XMLAutoTextEventExport::exportDoc( enum XMLTokenEnum ) { if( (getExportFlags() & EXPORT_OASIS) == 0 ) { - Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory(); - if( xFactory.is() ) + Reference< uno::XComponentContext> xContext = getComponentContext(); + try { - try - { - Sequence<Any> aArgs( 1 ); - aArgs[0] <<= GetDocHandler(); - - // get filter component - Reference< xml::sax::XDocumentHandler > xTmpDocHandler( - xFactory->createInstanceWithArguments( - OUString("com.sun.star.comp.Oasis2OOoTransformer"), - aArgs), UNO_QUERY); - OSL_ENSURE( xTmpDocHandler.is(), - "can't instantiate OASIS transformer component" ); - if( xTmpDocHandler.is() ) - { - SetDocHandler( xTmpDocHandler ); - } - } - catch( com::sun::star::uno::Exception& ) + Sequence<Any> aArgs( 1 ); + aArgs[0] <<= GetDocHandler(); + + // get filter component + Reference< xml::sax::XDocumentHandler > xTmpDocHandler( + xContext->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.Oasis2OOoTransformer", + aArgs, + xContext), + UNO_QUERY); + OSL_ENSURE( xTmpDocHandler.is(), + "can't instantiate OASIS transformer component" ); + if( xTmpDocHandler.is() ) { + SetDocHandler( xTmpDocHandler ); } } + catch( com::sun::star::uno::Exception& ) + { + } } if (hasEvents()) { @@ -235,7 +235,7 @@ Reference< XInterface > SAL_CALL XMLAutoTextEventExport_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr, EXPORT_ALL|EXPORT_OASIS); + return (cppu::OWeakObject*)new XMLAutoTextEventExport( comphelper::getComponentContext(rSMgr), EXPORT_ALL|EXPORT_OASIS); } // methods to support the component registration @@ -257,7 +257,7 @@ Reference< XInterface > SAL_CALL XMLAutoTextEventExportOOO_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw( Exception ) { - return (cppu::OWeakObject*)new XMLAutoTextEventExport(rSMgr,EXPORT_ALL); + return (cppu::OWeakObject*)new XMLAutoTextEventExport( comphelper::getComponentContext(rSMgr),EXPORT_ALL); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmloff/source/text/XMLAutoTextEventExport.hxx b/xmloff/source/text/XMLAutoTextEventExport.hxx index 45ce88eb2ff3..ed0e50fd6467 100644 --- a/xmloff/source/text/XMLAutoTextEventExport.hxx +++ b/xmloff/source/text/XMLAutoTextEventExport.hxx @@ -57,7 +57,7 @@ class XMLAutoTextEventExport : public SvXMLExport public: XMLAutoTextEventExport( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, sal_uInt16 nFlags + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext, sal_uInt16 nFlags ); ~XMLAutoTextEventExport(); diff --git a/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx b/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx index c23e43b34d6d..c20b53e23609 100644 --- a/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx +++ b/xmlscript/source/xmlflat_imexp/xmlbas_export.hxx @@ -21,13 +21,12 @@ #define XMLSCRIPT_XMLBAS_EXPORT_HXX #include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XXMLBasicExporter.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/uno/XComponentContext.hpp> -#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase3.hxx> #include <osl/mutex.hxx> @@ -40,11 +39,10 @@ namespace xmlscript // class XMLBasicExporterBase // ============================================================================= - typedef ::cppu::WeakImplHelper4< + typedef ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XInitialization, - ::com::sun::star::document::XExporter, - ::com::sun::star::document::XFilter > XMLBasicExporterBase_BASE; + ::com::sun::star::document::XXMLBasicExporter > XMLBasicExporterBase_BASE; class XMLBasicExporterBase : public XMLBasicExporterBase_BASE { |