[Libreoffice-commits] .: basic/source chart2/source comphelper/inc comphelper/source dbaccess/source desktop/source editeng/source filter/Library_odfflatxml.mk filter/source framework/inc framework/source i18npool/Executable_saxparser.mk i18npool/source linguistic/source offapi/com offapi/UnoApi_offapi.mk package/source reportdesign/source sc/inc sc/source sd/source sfx2/source starmath/source svx/source svx/workben sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_subsequent_rtfimport.mk sw/source unotools/source writerfilter/source xmloff/source xmlscript/source xmlsecurity/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Oct 4 07:31:31 PDT 2012


 basic/source/uno/dlgcont.cxx                                      |   20 -
 basic/source/uno/namecont.cxx                                     |   18 -
 basic/source/uno/scriptcont.cxx                                   |   12 
 chart2/source/model/filter/XMLFilter.cxx                          |    6 
 comphelper/inc/comphelper/ofopxmlhelper.hxx                       |    6 
 comphelper/source/xml/ofopxmlhelper.cxx                           |   16 -
 dbaccess/source/core/recovery/storagexmlstream.cxx                |    5 
 dbaccess/source/filter/xml/xmlfilter.cxx                          |   23 -
 desktop/source/deployment/dp_xml.cxx                              |    6 
 desktop/source/deployment/registry/sfwk/dp_sfwk.cxx               |    6 
 editeng/source/misc/svxacorr.cxx                                  |   35 --
 editeng/source/xml/xmltxtimp.cxx                                  |   10 
 filter/Library_odfflatxml.mk                                      |    1 
 filter/source/odfflatxml/OdfFlatXml.cxx                           |   12 
 filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx               |    6 
 filter/source/xsltdialog/typedetectionimport.cxx                  |   25 -
 filter/source/xsltfilter/XSLTFilter.cxx                           |   12 
 framework/inc/framework/configimporter.hxx                        |    4 
 framework/inc/framework/statusbarconfiguration.hxx                |    3 
 framework/inc/framework/toolboxconfiguration.hxx                  |    3 
 framework/inc/services.h                                          |    1 
 framework/inc/xml/imagesconfiguration.hxx                         |    3 
 framework/source/accelerators/acceleratorconfiguration.cxx        |    5 
 framework/source/fwe/helper/configimporter.cxx                    |    5 
 framework/source/fwe/xml/menuconfiguration.cxx                    |    5 
 framework/source/fwe/xml/statusbarconfiguration.cxx               |   10 
 framework/source/fwe/xml/toolboxconfiguration.cxx                 |   10 
 framework/source/uiconfiguration/imagemanagerimpl.cxx             |    3 
 framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx |    5 
 framework/source/uiconfiguration/uiconfigurationmanager.cxx       |    5 
 framework/source/xml/imagesconfiguration.cxx                      |   10 
 i18npool/Executable_saxparser.mk                                  |    1 
 i18npool/source/localedata/saxparser.cxx                          |   55 +--
 linguistic/source/convdic.cxx                                     |   15 
 offapi/UnoApi_offapi.mk                                           |    1 
 offapi/com/sun/star/xml/sax/Parser.idl                            |   37 ++
 package/source/manifest/ManifestReader.cxx                        |   54 +--
 package/source/xstor/owriteablestream.cxx                         |    4 
 package/source/xstor/xstorage.cxx                                 |    4 
 package/source/zippackage/ZipPackage.cxx                          |    2 
 reportdesign/source/filter/xml/xmlfilter.cxx                      |   16 -
 sc/inc/xmlwrap.hxx                                                |    4 
 sc/source/filter/xml/xmlwrap.cxx                                  |   13 
 sd/source/core/CustomAnimationPreset.cxx                          |    8 
 sd/source/filter/xml/sdxmlwrp.cxx                                 |   10 
 sfx2/source/doc/SfxDocumentMetaData.cxx                           |   10 
 sfx2/source/doc/doctemplates.cxx                                  |    2 
 sfx2/source/doc/doctemplateslocal.cxx                             |   12 
 sfx2/source/doc/doctemplateslocal.hxx                             |    4 
 sfx2/source/doc/sfxbasemodel.cxx                                  |    4 
 starmath/source/mathmlimport.cxx                                  |   11 
 svx/source/xml/xmlexport.cxx                                      |    6 
 svx/source/xml/xmlxtimp.cxx                                       |    5 
 svx/workben/msview/xmlconfig.cxx                                  |    7 
 sw/CppunitTest_sw_filters_test.mk                                 |    1 
 sw/CppunitTest_sw_subsequent_rtfimport.mk                         |    1 
 sw/source/core/swg/SwXMLTextBlocks1.cxx                           |  154 +++-------
 sw/source/filter/xml/swxml.cxx                                    |   34 --
 unotools/source/config/accelcfg.cxx                               |    6 
 writerfilter/source/ooxml/OOXMLStreamImpl.cxx                     |   12 
 xmloff/source/meta/xmlversion.cxx                                 |   11 
 xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx                  |   11 
 xmlsecurity/source/helper/xmlsignaturehelper.cxx                  |    9 
 63 files changed, 335 insertions(+), 480 deletions(-)

New commits:
commit a20f9a410fdd3f776f870434bc39219d5fc64b40
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Oct 3 13:30:43 2012 +0200

    fdo#46808, Adapt xml::sax::XParser UNO service to new style
    
    The xml.sax.Parser service already existed, it just did not have
    a new-style service to create it.
    
    Change-Id: I6f145a7504ff9e149c802f723991954a2801cbc9

diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 2cfe035..b9ad7f1 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -32,6 +32,7 @@
 #include "com/sun/star/document/XGraphicObjectResolver.hpp"
 #include "dlgcont.hxx"
 #include "sbmodule.hxx"
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <unotools/streamwrap.hxx>
 #include <osl/mutex.hxx>
@@ -122,12 +123,7 @@ bool writeOasis2OOoLibraryElement(
     Reference< lang::XMultiComponentFactory > xSMgr(
         xContext->getServiceManager() );
 
-    Reference< xml::sax::XParser > xParser(
-        xSMgr->createInstanceWithContext(
-            OUString( RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.xml.sax.Parser" ) ),
-            xContext ),
-        UNO_QUERY );
+    Reference< xml::sax::XParser > xParser =  xml::sax::Parser::create(xContext);
 
     Reference< xml::sax::XExtendedDocumentHandler > xWriter(
         xSMgr->createInstanceWithContext(
@@ -139,7 +135,7 @@ bool writeOasis2OOoLibraryElement(
     Reference< io::XActiveDataSource > xSource( xWriter, UNO_QUERY );
     xSource->setOutputStream( xOutput );
 
-    if ( !xParser.is() || !xWriter.is() )
+    if ( !xWriter.is() )
     {
         return sal_False;
     }
@@ -297,13 +293,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
     //  return aRetAny;
     //}
 
-    Reference< XParser > xParser( mxMSF->createInstance(
-        OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
-    if( !xParser.is() )
-    {
-        OSL_FAIL( "### couldn't create sax parser component\n" );
-        return aRetAny;
-    }
+    Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) );
 
     Reference< XNameContainer > xDialogModel( mxMSF->createInstance
         ( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 77ced57..dfce89a 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -41,7 +41,7 @@
 #include <svtools/ehdl.hxx>
 #include <basic/basmgr.hxx>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -650,13 +650,7 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
         maLibraryPath = SvtPathOptions().GetBasicPath();
     }
 
-    Reference< XParser > xParser( mxMSF->createInstance(
-        OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
-    if( !xParser.is() )
-    {
-        SAL_WARN("basic", "couldn't create sax parser component");
-        return;
-    }
+    Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF));
 
     uno::Reference< io::XInputStream > xInput;
 
@@ -1603,13 +1597,7 @@ void SfxLibraryContainer::implStoreLibraryIndexFile( SfxLibrary* pLib,
 bool SfxLibraryContainer::implLoadLibraryIndexFile(  SfxLibrary* pLib,
     ::xmlscript::LibDescriptor& rLib, const uno::Reference< embed::XStorage >& xStorage, const OUString& aIndexFileName )
 {
-    Reference< XParser > xParser( mxMSF->createInstance(
-        OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
-    if( !xParser.is() )
-    {
-        SAL_WARN("basic", "couldn't create sax parser component");
-        return false;
-    }
+    Reference< XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(mxMSF));
 
     sal_Bool bLink = sal_False;
     bool bStorage = false;
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 393dc77..bbc8509 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -20,7 +20,7 @@
 #include "scriptcont.hxx"
 #include "sbmodule.hxx"
 #include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -32,6 +32,7 @@
 #include <com/sun/star/embed/XTransactedObject.hpp>
 #include <com/sun/star/task/ErrorCodeIOException.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <unotools/streamwrap.hxx>
@@ -238,14 +239,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
 {
     Any aRetAny;
 
-    Reference< XParser > xParser( mxMSF->createInstance(
-        OUString( "com.sun.star.xml.sax.Parser" ) ), UNO_QUERY );
-    if( !xParser.is() )
-    {
-        OSL_FAIL( "### couldn't create sax parser component\n" );
-        return aRetAny;
-    }
-
+    Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(mxMSF) );
 
     // Read from storage?
     sal_Bool bStorage = xInStream.is();
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 56f3407..5f72dde 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -45,7 +45,7 @@
 #include <com/sun/star/embed/XTransactedObject.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <com/sun/star/packages/zip/ZipIOException.hpp>
 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
@@ -332,9 +332,7 @@ sal_Int32 XMLFilter::impl_Import(
             return ERRCODE_SFX_GENERAL;
 
         // create a sax parser
-        Reference< xml::sax::XParser > xSaxParser(
-            xFactory->createInstanceWithContext( C2U( "com.sun.star.xml.sax.Parser" ), m_xContext ),
-            uno::UNO_QUERY_THROW );
+        Reference< xml::sax::XParser > xSaxParser = xml::sax::Parser::create(m_xContext);
 
         bool bOasis = true;
         isOasisFormat( rMediaDescriptor, bOasis );
diff --git a/comphelper/inc/comphelper/ofopxmlhelper.hxx b/comphelper/inc/comphelper/ofopxmlhelper.hxx
index 789abcc..e18d08f 100644
--- a/comphelper/inc/comphelper/ofopxmlhelper.hxx
+++ b/comphelper/inc/comphelper/ofopxmlhelper.hxx
@@ -58,7 +58,7 @@ class COMPHELPER_DLLPUBLIC OFOPXMLHelper : public cppu::WeakImplHelper1 < com::s
     OFOPXMLHelper( sal_uInt16 nFormat ); // must not be created directly
     ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetParsingResult();
 
-    static COMPHELPER_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL ReadSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, sal_uInt16 nFormat, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
+    static COMPHELPER_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL ReadSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, sal_uInt16 nFormat, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
     throw( ::com::sun::star::uno::Exception );
 
 public:
@@ -73,7 +73,7 @@ public:
     ReadRelationsInfoSequence(
         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
         const ::rtl::OUString aStreamName,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
+        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
             throw( ::com::sun::star::uno::Exception );
 
     // returns sequence containing two entries of type sequence<StringPair>
@@ -86,7 +86,7 @@ public:
     SAL_CALL
     ReadContentTypeSequence(
         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
+        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
             throw( ::com::sun::star::uno::Exception );
 
     // writes sequence of elements, where each element is described by sequence of tags,
diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx
index 8eb783d..739b27d 100644
--- a/comphelper/source/xml/ofopxmlhelper.cxx
+++ b/comphelper/source/xml/ofopxmlhelper.cxx
@@ -21,7 +21,7 @@
 #include <com/sun/star/beans/StringPair.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
@@ -37,20 +37,20 @@ using namespace ::com::sun::star;
 namespace comphelper {
 
 // -----------------------------------
-uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadRelationsInfoSequence( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString aStreamName, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadRelationsInfoSequence( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString aStreamName, const uno::Reference< uno::XComponentContext > xContext )
     throw( uno::Exception )
 {
     ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/" ) );
     aStringID += aStreamName;
-    return ReadSequence_Impl( xInStream, aStringID, RELATIONINFO_FORMAT, xFactory );
+    return ReadSequence_Impl( xInStream, aStringID, RELATIONINFO_FORMAT, xContext );
 }
 
 // -----------------------------------
-uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadContentTypeSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadContentTypeSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext > xContext )
     throw( uno::Exception )
 {
     ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[Content_Types].xml" ) );
-    return ReadSequence_Impl( xInStream, aStringID, CONTENTTYPE_FORMAT, xFactory );
+    return ReadSequence_Impl( xInStream, aStringID, CONTENTTYPE_FORMAT, xContext );
 }
 
 // -----------------------------------
@@ -186,15 +186,15 @@ void SAL_CALL OFOPXMLHelper::WriteContentSequence( const uno::Reference< io::XOu
 // ==================================================================================
 
 // -----------------------------------
-uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, sal_uInt16 nFormat, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+uno::Sequence< uno::Sequence< beans::StringPair > > SAL_CALL OFOPXMLHelper::ReadSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, sal_uInt16 nFormat, const uno::Reference< uno::XComponentContext > xContext )
     throw( uno::Exception )
 {
-    if ( !xFactory.is() || !xInStream.is() || nFormat > FORMAT_MAX_ID )
+    if ( !xContext.is() || !xInStream.is() || nFormat > FORMAT_MAX_ID )
         throw uno::RuntimeException();
 
     uno::Sequence< uno::Sequence< beans::StringPair > > aResult;
 
-    uno::Reference< xml::sax::XParser > xParser( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW );
+    uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
     OFOPXMLHelper* pHelper = new OFOPXMLHelper( nFormat );
     uno::Reference< xml::sax::XDocumentHandler > xHelper( static_cast< xml::sax::XDocumentHandler* >( pHelper ) );
diff --git a/dbaccess/source/core/recovery/storagexmlstream.cxx b/dbaccess/source/core/recovery/storagexmlstream.cxx
index ad5dec9..14b76e7 100644
--- a/dbaccess/source/core/recovery/storagexmlstream.cxx
+++ b/dbaccess/source/core/recovery/storagexmlstream.cxx
@@ -22,7 +22,7 @@
 
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 
 #include <comphelper/componentcontext.hxx>
 #include <cppuhelper/implbase1.hxx>
@@ -55,6 +55,7 @@ namespace dbaccess
     using ::com::sun::star::io::XStream;
     using ::com::sun::star::io::XOutputStream;
     using ::com::sun::star::io::XActiveDataSource;
+    using ::com::sun::star::xml::sax::Parser;
     using ::com::sun::star::xml::sax::XParser;
     using ::com::sun::star::xml::sax::InputSource;
     /** === end UNO using === **/
@@ -163,7 +164,7 @@ namespace dbaccess
         :StorageInputStream( i_rContext, i_rParentStorage, i_rStreamName )
         ,m_pData( new StorageXMLInputStream_Data )
     {
-        m_pData->xParser.set( i_rContext.createComponent( "com.sun.star.xml.sax.Parser" ), UNO_QUERY_THROW );
+        m_pData->xParser.set( Parser::create(i_rContext.getUNOContext()) );
     }
 
     //------------------------------------------------------------------------------------------------------------------
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index f25f781..990e5ae 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -33,7 +33,7 @@
 #include <xmloff/nmspmap.hxx>
 #include <rtl/logfile.hxx>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <xmloff/ProgressBarHelper.hxx>
 #include <sfx2/docfile.hxx>
 #include <com/sun/star/io/XInputStream.hpp>
@@ -55,6 +55,7 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <tools/diagnose_ex.h>
 #include <osl/diagnose.h>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/namedvaluecollection.hxx>
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/documentconstants.hxx>
@@ -213,12 +214,12 @@ namespace dbaxml
 sal_Int32 ReadThroughComponent(
     const uno::Reference<XInputStream>& xInputStream,
     const uno::Reference<XComponent>& xModelComponent,
-    const uno::Reference<XMultiServiceFactory> & rFactory,
+    const uno::Reference<XComponentContext> & rxContext,
     const uno::Reference< XDocumentHandler >& _xFilter )
 {
     OSL_ENSURE(xInputStream.is(), "input stream missing");
     OSL_ENSURE(xModelComponent.is(), "document missing");
-    OSL_ENSURE(rFactory.is(), "factory missing");
+    OSL_ENSURE(rxContext.is(), "factory missing");
 
     RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "dbaxml", "oj", "ReadThroughComponent" );
 
@@ -227,13 +228,7 @@ sal_Int32 ReadThroughComponent(
     aParserInput.aInputStream = xInputStream;
 
     // get parser
-    uno::Reference< XParser > xParser(
-        rFactory->createInstance(
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
-        UNO_QUERY );
-    OSL_ENSURE( xParser.is(), "Can't create parser" );
-    if( !xParser.is() )
-        return 1;
+    uno::Reference< XParser > xParser = Parser::create(rxContext);
     RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
 
     // get filter
@@ -294,7 +289,7 @@ sal_Int32 ReadThroughComponent(
     const uno::Reference<XComponent>& xModelComponent,
     const sal_Char* pStreamName,
     const sal_Char* pCompatibilityStreamName,
-    const uno::Reference<XMultiServiceFactory> & rFactory,
+    const uno::Reference<XComponentContext> & rxContext,
     const uno::Reference< XDocumentHandler >& _xFilter)
 {
     OSL_ENSURE( xStorage.is(), "Need storage!");
@@ -350,7 +345,7 @@ sal_Int32 ReadThroughComponent(
         // read from the stream
         return ReadThroughComponent( xInputStream
                                     ,xModelComponent
-                                    ,rFactory
+                                    ,rxContext
                                     ,_xFilter );
     }
 
@@ -462,7 +457,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
                                     ,xModel
                                     ,"settings.xml"
                                     ,"Settings.xml"
-                                    ,getServiceFactory()
+                                    ,comphelper::getComponentContext(getServiceFactory())
                                     ,this
                                     );
 
@@ -471,7 +466,7 @@ sal_Bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
                                     ,xModel
                                     ,"content.xml"
                                     ,"Content.xml"
-                                    ,getServiceFactory()
+                                    ,comphelper::getComponentContext(getServiceFactory())
                                     ,this
                                     );
 
diff --git a/desktop/source/deployment/dp_xml.cxx b/desktop/source/deployment/dp_xml.cxx
index d276818..b45c4c0 100644
--- a/desktop/source/deployment/dp_xml.cxx
+++ b/desktop/source/deployment/dp_xml.cxx
@@ -31,7 +31,7 @@
 #include "dp_xml.h"
 #include "rtl/ustrbuf.hxx"
 #include "ucbhelper/content.hxx"
-#include "com/sun/star/xml/sax/XParser.hpp"
+#include "com/sun/star/xml/sax/Parser.hpp"
 
 
 using namespace ::com::sun::star;
@@ -48,9 +48,7 @@ void xml_parse(
     Reference<XComponentContext> const & xContext )
 {
     // raise sax parser:
-    Reference<xml::sax::XParser> xParser(
-        xContext->getServiceManager()->createInstanceWithContext(
-            OUSTR("com.sun.star.xml.sax.Parser"), xContext ), UNO_QUERY_THROW );
+    Reference<xml::sax::XParser> xParser = xml::sax::Parser::create(xContext);
 
     // error handler, entity resolver omitted
     xParser->setDocumentHandler( xDocHandler );
diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
index 5741ccc..f751f8b 100644
--- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
+++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx
@@ -37,6 +37,7 @@
 #include "svl/inettype.hxx"
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/script/provider/XScriptProviderFactory.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <memory>
 
 
@@ -252,10 +253,7 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_(
                     Reference<XComponentContext>
                         xContext( getComponentContext() );
 
-                    Reference< xml::sax::XParser > xParser(
-                      xContext->getServiceManager()->createInstanceWithContext(
-                            OUSTR("com.sun.star.xml.sax.Parser"), xContext ),
-                                UNO_QUERY_THROW );
+                    Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
 
                     xParser->setDocumentHandler( xDocHandler );
                     xml::sax::InputSource source;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 9c58090..a970e8a 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -45,6 +45,7 @@
 #include <unotools/transliterationwrapper.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/storagehelper.hxx>
 #include <comphelper/string.hxx>
@@ -58,7 +59,7 @@
 #include "vcl/window.hxx"
 #include <helpid.hrc>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <unotools/streamwrap.hxx>
 #include <SvXMLAutoCorrectImport.hxx>
 #include <SvXMLAutoCorrectExport.hxx>
@@ -2003,21 +2004,11 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
                 xStrm->SetBufferSize( 8 * 1024 );
                 aParserInput.aInputStream = new utl::OInputStreamWrapper( *xStrm );
 
-                // get parser
-                uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance(
-                    OUString("com.sun.star.xml.sax.Parser") );
-                OSL_ENSURE( xXMLParser.is(),
-                    "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
-                if( !xXMLParser.is() )
-                {
-                    // Maybe throw an exception?
-                }
-
                 // get filter
                 uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLExceptionListImport ( xServiceFactory, *rpLst );
 
                 // connect parser and filter
-                uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
+                uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(xServiceFactory) );
                 xParser->setDocumentHandler( xFilter );
 
                 // parse
@@ -2130,26 +2121,22 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
         String aXMLWordListName( pXMLImplAutocorr_ListStr, RTL_TEXTENCODING_MS_1252 );
         uno::Reference < io::XStream > xStrm = xStg->openStreamElement( aXMLWordListName, embed::ElementModes::READ );
         uno::Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+        uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
 
         xml::sax::InputSource aParserInput;
         aParserInput.sSystemId = aXMLWordListName;
         aParserInput.aInputStream = xStrm->getInputStream();
 
         // get parser
-        uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance( OUString("com.sun.star.xml.sax.Parser") );
-        OSL_ENSURE( xXMLParser.is(), "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
-        if( xXMLParser.is() )
-        {
-            RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "AutoCorrect Import" );
-            uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg );
+        uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(xContext);
+        RTL_LOGFILE_PRODUCT_CONTEXT( aLog, "AutoCorrect Import" );
+        uno::Reference< xml::sax::XDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xServiceFactory, pAutocorr_List, rAutoCorrect, xStg );
 
-            // connect parser and filter
-            uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
-            xParser->setDocumentHandler( xFilter );
+        // connect parser and filter
+        xParser->setDocumentHandler( xFilter );
 
-            // parse
-            xParser->parseStream( aParserInput );
-        }
+        // parse
+        xParser->parseStream( aParserInput );
     }
     catch ( const uno::Exception& )
     {
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index cc5d111..27e6b36 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -29,7 +29,7 @@
 #include <com/sun/star/io/Pipe.hpp>
 #include <com/sun/star/io/XActiveDataControl.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/text/XText.hpp>
@@ -170,18 +170,14 @@ void SvxReadXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection& r
         do
         {
             uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+            uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
             if( !xServiceFactory.is() )
             {
                 OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" );
                 break;
             }
 
-            uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY );
-            if( !xParser.is() )
-            {
-                OSL_FAIL( "com.sun.star.xml.sax.Parser service missing" );
-                break;
-            }
+            uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
             uno::Reference<io::XInputStream> xInputStream = new utl::OInputStreamWrapper( rStream );
 
diff --git a/filter/Library_odfflatxml.mk b/filter/Library_odfflatxml.mk
index b7d66b6..666e728 100644
--- a/filter/Library_odfflatxml.mk
+++ b/filter/Library_odfflatxml.mk
@@ -40,6 +40,7 @@ $(eval $(call gb_Library_use_libraries,odfflatxml,\
 	xo \
 	tl \
 	ucbhelper \
+	comphelper \
 	cppuhelper \
 	cppu \
 	sal \
diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx
index 1845190..cad9039 100644
--- a/filter/source/odfflatxml/OdfFlatXml.cxx
+++ b/filter/source/odfflatxml/OdfFlatXml.cxx
@@ -28,6 +28,7 @@
  */
 
 
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/servicefactory.hxx>
 #include <cppuhelper/implbase3.hxx>
@@ -44,7 +45,7 @@
 
 #include <com/sun/star/xml/XImportFilter.hpp>
 #include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
@@ -141,14 +142,7 @@ OdfFlatXml::importer(
     if (!inputStream.is())
         return sal_False;
 
-    OUString SAX_PARSER_SERVICE(
-                                RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"));
-    Reference<XParser> saxParser(m_rServiceFactory->createInstance(
-                                                                   SAX_PARSER_SERVICE), UNO_QUERY);
-
-    OSL_ASSERT(saxParser.is());
-    if (!saxParser.is())
-        return sal_False;
+    Reference<XParser> saxParser = Parser::create(comphelper::getComponentContext(m_rServiceFactory));
 
     InputSource inputSource;
     inputSource.sSystemId = url;
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index bf089c9..ed2901b 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -32,7 +32,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/frame/XConfigManager.hpp>
 #include <com/sun/star/xml/XImportFilter.hpp>
 #include <com/sun/star/xml/XExportFilter.hpp>
@@ -43,6 +43,7 @@
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/style/XStyleLoader.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -85,8 +86,7 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star
     }
 
     OUString sXMLImportService (  udImport  );
-    const OUString sSaxParser ( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser") );
-    Reference < XParser > xSaxParser( mxMSF->createInstance( sSaxParser ), UNO_QUERY );
+    Reference < XParser > xSaxParser = Parser::create( comphelper::getComponentContext(mxMSF) );
 
     Sequence< Any > aAnys(1);
     OUString aBaseURI;
diff --git a/filter/source/xsltdialog/typedetectionimport.cxx b/filter/source/xsltdialog/typedetectionimport.cxx
index ab0046c..daf6f32 100644
--- a/filter/source/xsltdialog/typedetectionimport.cxx
+++ b/filter/source/xsltdialog/typedetectionimport.cxx
@@ -18,10 +18,11 @@
  */
 
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 
+#include <comphelper/processfactory.hxx>
 #include "typedetectionimport.hxx"
 #include "xmlfiltersettingsdialog.hxx"
 
@@ -61,21 +62,19 @@ void TypeDetectionImporter::doImport( Reference< XMultiServiceFactory >& xMSF, R
 {
     try
     {
-        Reference< XParser > xParser( xMSF->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" )) ), UNO_QUERY );
-        if( xParser.is() )
-        {
-            TypeDetectionImporter* pImporter = new TypeDetectionImporter( xMSF );
-            Reference < XDocumentHandler > xDocHandler( pImporter );
-            xParser->setDocumentHandler( xDocHandler );
+        Reference< XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(xMSF) );
 
-            InputSource source;
-            source.aInputStream = xIS;
+        TypeDetectionImporter* pImporter = new TypeDetectionImporter( xMSF );
+        Reference < XDocumentHandler > xDocHandler( pImporter );
+        xParser->setDocumentHandler( xDocHandler );
 
-            // start parsing
-            xParser->parseStream( source );
+        InputSource source;
+        source.aInputStream = xIS;
 
-            pImporter->fillFilterVector( rFilters );
-        }
+        // start parsing
+        xParser->parseStream( source );
+
+        pImporter->fillFilterVector( rFilters );
     }
     catch( const Exception& /* e */ )
     {
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 7d0a18a..4bb92b0 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -42,7 +42,7 @@
 
 #include <com/sun/star/beans/PropertyValue.hpp>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
@@ -283,15 +283,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
 
         // create SAX parser that will read the document file
         // and provide events to xHandler passed to this call
-        css::uno::Reference<XParser>
-                xSaxParser(
-                        m_rServiceFactory->createInstance(
-                                OUString(
-                                         "com.sun.star.xml.sax.Parser" )),
-                        UNO_QUERY);
-        OSL_ASSERT(xSaxParser.is());
-        if (!xSaxParser.is())
-            return sal_False;
+        css::uno::Reference<XParser> xSaxParser = Parser::create(comphelper::getComponentContext(m_rServiceFactory));
 
         // create transformer
         Sequence<Any> args(3);
diff --git a/framework/inc/framework/configimporter.hxx b/framework/inc/framework/configimporter.hxx
index 1fdca6b..ab151ee 100644
--- a/framework/inc/framework/configimporter.hxx
+++ b/framework/inc/framework/configimporter.hxx
@@ -23,7 +23,7 @@
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <rtl/ustring.hxx>
 #include <framework/fwedllapi.h>
@@ -36,7 +36,7 @@ namespace framework
             static sal_Bool ImportCustomToolbars(
                         const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& rContainerFactory,
                         ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer,
-                        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
+                        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
                         const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage );
     };
 
diff --git a/framework/inc/framework/statusbarconfiguration.hxx b/framework/inc/framework/statusbarconfiguration.hxx
index 2ef90ad..2c405c7 100644
--- a/framework/inc/framework/statusbarconfiguration.hxx
+++ b/framework/inc/framework/statusbarconfiguration.hxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 namespace framework
 {
@@ -44,7 +45,7 @@ class FWE_DLLPUBLIC StatusBarConfiguration
 {
     public:
         static sal_Bool LoadStatusBar(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream,
             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration );
 
diff --git a/framework/inc/framework/toolboxconfiguration.hxx b/framework/inc/framework/toolboxconfiguration.hxx
index e2c1270..1e31bbb 100644
--- a/framework/inc/framework/toolboxconfiguration.hxx
+++ b/framework/inc/framework/toolboxconfiguration.hxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 namespace framework
 {
@@ -36,7 +37,7 @@ class FWE_DLLPUBLIC ToolBoxConfiguration
 {
     public:
         static sal_Bool LoadToolBox(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration );
 
diff --git a/framework/inc/services.h b/framework/inc/services.h
index dbdd101..70956ec 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -80,7 +80,6 @@ namespace framework{
 #define SERVICENAME_GLOBALACCELERATORCONFIGURATION              DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration")
 #define SERVICENAME_MODULEACCELERATORCONFIGURATION              DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration")
 #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION            DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration")
-#define SERVICENAME_SAXPARSER                                   DECLARE_ASCII("com.sun.star.xml.sax.Parser"                         )
 #define SERVICENAME_SAXWRITER                                   DECLARE_ASCII("com.sun.star.xml.sax.Writer"                         )
 #define SERVICENAME_STORAGEFACTORY                              DECLARE_ASCII("com.sun.star.embed.StorageFactory"                   )
 #define SERVICENAME_FILESYSTEMSTORAGEFACTORY                    DECLARE_ASCII("com.sun.star.embed.FileSystemStorageFactory"         )
diff --git a/framework/inc/xml/imagesconfiguration.hxx b/framework/inc/xml/imagesconfiguration.hxx
index 2a5c7ae..eda31f4 100644
--- a/framework/inc/xml/imagesconfiguration.hxx
+++ b/framework/inc/xml/imagesconfiguration.hxx
@@ -37,6 +37,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
 
 #include <vector>
 #include <boost/ptr_container/ptr_vector.hpp>
@@ -100,7 +101,7 @@ class ImagesConfiguration
 {
     public:
         static sal_Bool LoadImages(
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+            const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
             const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
             ImageListsDescriptor& rItems );
 
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index d8c0732..fa010e7 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -41,7 +41,7 @@
 #include <acceleratorconst.h>
 #include <services.h>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
@@ -56,6 +56,7 @@
 #include <com/sun/star/awt/KeyModifier.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/util/XChangesNotifier.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/configurationhelper.hxx>
 #include <unotools/configpaths.hxx>
 #include <rtl/logfile.hxx>
@@ -522,7 +523,7 @@ void XMLBasedAcceleratorConfiguration::impl_ts_load(const css::uno::Reference< c
     css::uno::Reference< css::xml::sax::XDocumentHandler > xFilter (static_cast< ::cppu::OWeakObject* >(pFilter), css::uno::UNO_QUERY_THROW);
 
     // connect parser, filter and stream
-    css::uno::Reference< css::xml::sax::XParser > xParser(xSMGR->createInstance(SERVICENAME_SAXPARSER), css::uno::UNO_QUERY_THROW);
+    css::uno::Reference< css::xml::sax::XParser > xParser = css::xml::sax::Parser::create(comphelper::getComponentContext(xSMGR));
     xParser->setDocumentHandler(xFilter);
 
     css::xml::sax::InputSource aSource;
diff --git a/framework/source/fwe/helper/configimporter.cxx b/framework/source/fwe/helper/configimporter.cxx
index 0aacbda..ca6c1a1 100644
--- a/framework/source/fwe/helper/configimporter.cxx
+++ b/framework/source/fwe/helper/configimporter.cxx
@@ -41,11 +41,10 @@ namespace framework
 sal_Bool UIConfigurationImporterOOo1x::ImportCustomToolbars(
     const uno::Reference< ui::XUIConfigurationManager >& rContainerFactory,
     uno::Sequence< uno::Reference< container::XIndexContainer > >& rSeqContainer,
-    const uno::Reference< lang::XMultiServiceFactory >& rServiceManager,
+    const uno::Reference< uno::XComponentContext >& rxContext,
     const uno::Reference< embed::XStorage >& rToolbarStorage )
 {
     const char USERDEFTOOLBOX[] = "userdeftoolbox0.xml";
-    uno::Reference< lang::XMultiServiceFactory > rSrvMgr( rServiceManager );
 
     sal_Bool bResult ( sal_False );
     if ( rToolbarStorage.is() && rContainerFactory.is() )
@@ -66,7 +65,7 @@ sal_Bool UIConfigurationImporterOOo1x::ImportCustomToolbars(
                     if ( xInputStream.is() )
                     {
                         uno::Reference< container::XIndexContainer > xContainer = rContainerFactory->createSettings();
-                        if ( ToolBoxConfiguration::LoadToolBox( rSrvMgr, xInputStream, xContainer ))
+                        if ( ToolBoxConfiguration::LoadToolBox( rxContext, xInputStream, xContainer ))
                         {
                             sal_uInt32 nIndex = rSeqContainer.getLength();
                             rSeqContainer.realloc( nIndex+1 );
diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx
index fe522fe..c47e52d 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -36,9 +36,10 @@
 
 #include <uielement/rootitemcontainer.hxx>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
+#include <comphelper/processfactory.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -66,7 +67,7 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML(
     Reference< XInputStream >& rInputStream )
 throw ( WrappedTargetException )
 {
-    Reference< XParser > xParser( m_rxServiceManager->createInstance(SERVICENAME_SAXPARSER),UNO_QUERY);
+    Reference< XParser > xParser = Parser::create( comphelper::getComponentContext(m_rxServiceManager) );
 
     // connect stream to input stream to the parser
     InputSource aInputSource;
diff --git a/framework/source/fwe/xml/statusbarconfiguration.cxx b/framework/source/fwe/xml/statusbarconfiguration.cxx
index 17e41e3..2b24554 100644
--- a/framework/source/fwe/xml/statusbarconfiguration.cxx
+++ b/framework/source/fwe/xml/statusbarconfiguration.cxx
@@ -32,7 +32,7 @@
 #include <xml/saxnamespacefilter.hxx>
 #include <services.h>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -51,10 +51,10 @@ namespace framework
 {
 
 static Reference< XParser > GetSaxParser(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext
     )
 {
-    return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
+    return Parser::create( xContext );
 }
 
 static Reference< XDocumentHandler > GetSaxWriter(
@@ -65,11 +65,11 @@ static Reference< XDocumentHandler > GetSaxWriter(
 }
 
 sal_Bool StatusBarConfiguration::LoadStatusBar(
-    const Reference< XMultiServiceFactory >& xServiceFactory,
+    const Reference< XComponentContext >& rxContext,
     const Reference< XInputStream >& xInputStream,
     const Reference< XIndexContainer >& rStatusbarConfiguration )
 {
-    Reference< XParser > xParser( GetSaxParser( xServiceFactory ) );
+    Reference< XParser > xParser( GetSaxParser( rxContext ) );
 
     // connect stream to input stream to the parser
     InputSource aInputSource;
diff --git a/framework/source/fwe/xml/toolboxconfiguration.cxx b/framework/source/fwe/xml/toolboxconfiguration.cxx
index 13afba4..dcc7d48 100644
--- a/framework/source/fwe/xml/toolboxconfiguration.cxx
+++ b/framework/source/fwe/xml/toolboxconfiguration.cxx
@@ -32,7 +32,7 @@
 #include <xml/saxnamespacefilter.hxx>
 #include <services.h>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -51,10 +51,10 @@ namespace framework
 {
 
 static Reference< XParser > GetSaxParser(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
     )
 {
-    return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
+    return Parser::create(rxContext);
 }
 
 static Reference< XDocumentHandler > GetSaxWriter(
@@ -65,11 +65,11 @@ static Reference< XDocumentHandler > GetSaxWriter(
 }
 
 sal_Bool ToolBoxConfiguration::LoadToolBox(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
     const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration )
 {
-    Reference< XParser > xParser( GetSaxParser( xServiceFactory ) );
+    Reference< XParser > xParser( GetSaxParser( rxContext ) );
 
     // connect stream to input stream to the parser
     InputSource aInputSource;
diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx
index 54fdc51..3e3b503 100644
--- a/framework/source/uiconfiguration/imagemanagerimpl.cxx
+++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx
@@ -47,6 +47,7 @@
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <osl/mutex.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/sequence.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/ucbstreamhelper.hxx>
@@ -492,7 +493,7 @@ sal_Bool ImageManagerImpl::implts_loadUserImages(
             uno::Reference< XInputStream > xInputStream = xStream->getInputStream();
 
             ImageListsDescriptor aUserImageListInfo;
-            ImagesConfiguration::LoadImages( m_xServiceManager,
+            ImagesConfiguration::LoadImages( comphelper::getComponentContext(m_xServiceManager),
                                              xInputStream,
                                              aUserImageListInfo );
             if (( aUserImageListInfo.pImageList != 0 ) &&
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 0b9cfce..2a6b451 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -47,6 +47,7 @@
 
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 
 //_________________________________________________________________________________________________________________
@@ -338,7 +339,7 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
                         try
                         {
                             Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
-                            ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
+                            ToolBoxConfiguration::LoadToolBox( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
                             RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
                             aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
                             return;
@@ -355,7 +356,7 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement
                         try
                         {
                             Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
-                            StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
+                            StatusBarConfiguration::LoadStatusBar( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
                             RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
                             aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
                             return;
diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
index 0ce2e54..f19853f 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/io/XStream.hpp>
 #include <com/sun/star/embed/XTransactedObject.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <vcl/svapp.hxx>
 #include <rtl/ustrbuf.hxx>
 
@@ -276,7 +277,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType,
                         try
                         {
                             Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
-                            ToolBoxConfiguration::LoadToolBox( m_xServiceManager, xInputStream, xIndexContainer );
+                            ToolBoxConfiguration::LoadToolBox( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
                             RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
                             aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
                             return;
@@ -293,7 +294,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType,
                         try
                         {
                             Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY );
-                            StatusBarConfiguration::LoadStatusBar( m_xServiceManager, xInputStream, xIndexContainer );
+                            StatusBarConfiguration::LoadStatusBar( comphelper::getComponentContext(m_xServiceManager), xInputStream, xIndexContainer );
                             RootItemContainer* pRootItemContainer = RootItemContainer::GetImplementation( xIndexContainer );
                             aUIElementData.xSettings = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, sal_True ) ), UNO_QUERY );
                             return;
diff --git a/framework/source/xml/imagesconfiguration.cxx b/framework/source/xml/imagesconfiguration.cxx
index b583605..622b45f 100644
--- a/framework/source/xml/imagesconfiguration.cxx
+++ b/framework/source/xml/imagesconfiguration.cxx
@@ -33,7 +33,7 @@
 #include <xml/imagesdocumenthandler.hxx>
 #include <xml/saxnamespacefilter.hxx>
 
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -51,10 +51,10 @@ namespace framework
 {
 
 static Reference< XParser > GetSaxParser(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
     )
 {
-    return Reference< XParser >( xServiceFactory->createInstance( SERVICENAME_SAXPARSER), UNO_QUERY);
+    return Parser::create(rxContext);
 }
 
 static Reference< XDocumentHandler > GetSaxWriter(
@@ -65,11 +65,11 @@ static Reference< XDocumentHandler > GetSaxWriter(
 }
 
 sal_Bool ImagesConfiguration::LoadImages(
-    const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
+    const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
     const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
     ImageListsDescriptor& rItems )
 {
-    Reference< XParser > xParser( GetSaxParser( xServiceFactory ) );
+    Reference< XParser > xParser( GetSaxParser( rxContext ) );
 
     // connect stream to input stream to the parser
     InputSource aInputSource;
diff --git a/i18npool/Executable_saxparser.mk b/i18npool/Executable_saxparser.mk
index ba0be63..ce47a70 100644
--- a/i18npool/Executable_saxparser.mk
+++ b/i18npool/Executable_saxparser.mk
@@ -35,6 +35,7 @@ $(eval $(call gb_Executable_set_include,saxparser,\
 $(eval $(call gb_Executable_use_sdk_api,saxparser))
 
 $(eval $(call gb_Executable_use_libraries,saxparser,\
+	comphelper \
 	cppu \
 	cppuhelper \
 	sal \
diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index c23d4ad..6908c6f 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -27,12 +27,13 @@
 #include <com/sun/star/lang/XComponent.hpp>
 
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
 
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/servicefactory.hxx>
 #include <cppuhelper/implbase1.hxx>
 #include <cppuhelper/implbase3.hxx>
@@ -322,46 +323,36 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
     // parser demo
     // read xml from a file and count elements
     //--------------------------------
-    Reference< XInterface > x = xSMgr->createInstance(
-        OUString("com.sun.star.xml.sax.Parser") );
-    int nError = 0;
-    if( x.is() )
-    {
-        Reference< XParser > rParser( x , UNO_QUERY );
-
-        // create and connect the document handler to the parser
-        TestDocumentHandler *pDocHandler = new TestDocumentHandler( argv[1], argv[3]);
+    Reference< XParser > rParser = Parser::create(comphelper::getComponentContext(xSMgr));
 
-        Reference < XDocumentHandler >  rDocHandler( (XDocumentHandler *) pDocHandler );
-        Reference< XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler );
+    int nError = 0;
+    // create and connect the document handler to the parser
+    TestDocumentHandler *pDocHandler = new TestDocumentHandler( argv[1], argv[3]);
 
-        rParser->setDocumentHandler( rDocHandler );
-        rParser->setEntityResolver( rEntityResolver );
+    Reference < XDocumentHandler >  rDocHandler( (XDocumentHandler *) pDocHandler );
+    Reference< XEntityResolver > rEntityResolver( (XEntityResolver *) pDocHandler );
 
-        // create the input stream
-        InputSource source;
-        source.aInputStream = createStreamFromFile( argv[2] );
-        source.sSystemId    = OUString::createFromAscii( argv[2] );
+    rParser->setDocumentHandler( rDocHandler );
+    rParser->setEntityResolver( rEntityResolver );
 
-        try
-        {
-            // start parsing
-            rParser->parseStream( source );
-        }
+    // create the input stream
+    InputSource source;
+    source.aInputStream = createStreamFromFile( argv[2] );
+    source.sSystemId    = OUString::createFromAscii( argv[2] );
 
-        catch( const Exception & e )
-        {
-            OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
-            printf( "Exception during parsing : %s\n" ,  o1.getStr() );
-            exit(1);
-        }
-        nError = pDocHandler->nError;
+    try
+    {
+        // start parsing
+        rParser->parseStream( source );
     }
-    else
+
+    catch( const Exception & e )
     {
-        printf( "couldn't create sax-parser component\n" );
+        OString o1 = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8 );
+        printf( "Exception during parsing : %s\n" ,  o1.getStr() );
         exit(1);
     }
+    nError = pDocHandler->nError;
 
     return nError;
 }
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index 212506c..347707e 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -61,7 +61,7 @@
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 
 
 #include "convdic.hxx"
@@ -88,7 +88,6 @@ void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport )
         return;
     DBG_ASSERT(!INetURLObject( rMainURL ).HasError(), "invalid URL");
 
-    uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
     uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
 
     // get xInputStream stream
@@ -112,17 +111,7 @@ void ReadThroughDic( const String &rMainURL, ConvDicXMLImport &rImport )
     aParserInput.aInputStream = xIn;
 
     // get parser
-    uno::Reference< xml::sax::XParser > xParser;
-    try
-    {
-        xParser = uno::Reference< xml::sax::XParser >( xServiceFactory->createInstance( "com.sun.star.xml.sax.Parser" ), UNO_QUERY );
-    }
-    catch (uno::Exception &)
-    {
-    }
-    DBG_ASSERT( xParser.is(), "Can't create parser" );
-    if (!xParser.is())
-        return;
+    uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
     //!! keep a reference until everything is done to
     //!! ensure the proper lifetime of the object
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index e31beef..1a42899 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -317,6 +317,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/dom,\
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\
 	FastShapeContextHandler \
 	FastTokenHandler \
+	Parser \
 ))
 
 
diff --git a/offapi/com/sun/star/xml/sax/Parser.idl b/offapi/com/sun/star/xml/sax/Parser.idl
new file mode 100644
index 0000000..8ddee4e
--- /dev/null
+++ b/offapi/com/sun/star/xml/sax/Parser.idl
@@ -0,0 +1,37 @@
+/* -*- 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_xml_sax_Parser_idl__
+#define __com_sun_star_xml_sax_Parser_idl__
+
+#include <com/sun/star/xml/sax/XParser.idl>
+
+module com {  module sun {  module star {  module xml {  module sax {
+
+
+/**
+   Service that provides a SAX parser.
+ */
+published service Parser : XParser;
+
+
+}; }; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/source/manifest/ManifestReader.cxx b/package/source/manifest/ManifestReader.cxx
index f57f43b..9ff7144 100644
--- a/package/source/manifest/ManifestReader.cxx
+++ b/package/source/manifest/ManifestReader.cxx
@@ -19,10 +19,11 @@
 
 #include <ManifestReader.hxx>
 #include <ManifestImport.hxx>
+#include <comphelper/processfactory.hxx>
 #include <cppuhelper/factory.hxx>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <vector>
@@ -49,34 +50,31 @@ Sequence< Sequence< PropertyValue > > SAL_CALL ManifestReader::readManifestSeque
     throw (::com::sun::star::uno::RuntimeException)
 {
     Sequence < Sequence < PropertyValue > > aManifestSequence;
-    Reference < XParser > xParser (xFactory->createInstance ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.xml.sax.Parser" ) ) ), UNO_QUERY );
-    if (xParser.is())
+    Reference < XParser > xParser  = Parser::create(comphelper::getComponentContext(xFactory));
+    try
+    {
+        vector < Sequence < PropertyValue > > aManVector;
+        Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector );
+        InputSource aParserInput;
+        aParserInput.aInputStream = rStream;
+        aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
+        xParser->setDocumentHandler ( xFilter );
+        xParser->parseStream( aParserInput );
+        aManifestSequence.realloc ( aManVector.size() );
+        Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
+        ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin();
+        ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end();
+        while( aIter != aEnd )
+            *pSequence++ = (*aIter++);
+    }
+    catch (SAXParseException& )
+    {
+    }
+    catch (SAXException& )
+    {
+    }
+    catch (IOException& )
     {
-        try
-        {
-            vector < Sequence < PropertyValue > > aManVector;
-            Reference < XDocumentHandler > xFilter = new ManifestImport( aManVector );
-            InputSource aParserInput;
-            aParserInput.aInputStream = rStream;
-            aParserInput.sSystemId = OUString ( RTL_CONSTASCII_USTRINGPARAM ( "META-INF/manifest.xml" ) );
-            xParser->setDocumentHandler ( xFilter );
-            xParser->parseStream( aParserInput );
-            aManifestSequence.realloc ( aManVector.size() );
-            Sequence < PropertyValue > * pSequence = aManifestSequence.getArray();
-            ::std::vector < Sequence < PropertyValue > >::const_iterator aIter = aManVector.begin();
-            ::std::vector < Sequence < PropertyValue > >::const_iterator aEnd = aManVector.end();
-            while( aIter != aEnd )
-                *pSequence++ = (*aIter++);
-        }
-        catch (SAXParseException& )
-        {
-        }
-        catch (SAXException& )
-        {
-        }
-        catch (IOException& )
-        {
-        }
     }
     xParser->setDocumentHandler ( Reference < XDocumentHandler > () );
     return aManifestSequence;
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx
index a8d1b92..05a3f15 100644
--- a/package/source/xstor/owriteablestream.cxx
+++ b/package/source/xstor/owriteablestream.cxx
@@ -1082,7 +1082,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
                 m_aOrigRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
                                         m_xOrigRelInfoStream,
                                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/*.rels" ) ),
-                                        m_xFactory );
+                                        comphelper::getComponentContext(m_xFactory) );
 
             // in case of success the stream must be thrown away, that means that the OrigRelInfo is initialized
             // the reason for this is that the original stream might not be seekable ( at the same time the new
@@ -1108,7 +1108,7 @@ void OWriteStream_Impl::ReadRelInfoIfNecessary()
                 m_aNewRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
                                         m_xNewRelInfoStream,
                                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/*.rels" ) ),
-                                        m_xFactory );
+                                        comphelper::getComponentContext(m_xFactory) );
 
             m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
         }
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 3908e8a..33d4aaa 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -595,7 +595,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
             m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
                                     xRelInfoStream,
                                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/.rels" ) ),
-                                    m_xFactory );
+                                    comphelper::getComponentContext(m_xFactory) );
 
         m_nRelInfoStatus = RELINFO_READ;
     }
@@ -608,7 +608,7 @@ void OStorage_Impl::ReadRelInfoIfNecessary()
                 m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
                                         m_xNewRelInfoStream,
                                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_rels/.rels" ) ),
-                                        m_xFactory );
+                                        comphelper::getComponentContext(m_xFactory) );
 
             m_nRelInfoStatus = RELINFO_CHANGED_STREAM_READ;
         }
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index b3e1730..5ab16b3 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -464,7 +464,7 @@ void ZipPackage::parseContentType()
                     sal_Int32 nInd = 0;
                     // here aContentTypeInfo[0] - Defaults, and aContentTypeInfo[1] - Overrides
                     uno::Sequence< uno::Sequence< beans::StringPair > > aContentTypeInfo =
-                        ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, m_xFactory );
+                        ::comphelper::OFOPXMLHelper::ReadContentTypeSequence( xInStream, comphelper::getComponentContext(m_xFactory) );
 
                     if ( aContentTypeInfo.getLength() != 2 )
                         throw io::IOException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index b9d2daf..1279e73 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/beans/NamedValue.hpp>
 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
 #include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include "xmlfilter.hxx"
 #include "xmlGroup.hxx"
 #include "xmlReport.hxx"
@@ -38,6 +39,7 @@
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
+#include <comphelper/processfactory.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <xmloff/ProgressBarHelper.hxx>
@@ -124,13 +126,13 @@ sal_Int32 ReadThroughComponent(
     const uno::Reference<XInputStream>& xInputStream,
     const uno::Reference<XComponent>& xModelComponent,
     const sal_Char* /*pStreamName*/,
-    const uno::Reference<XMultiServiceFactory> & rFactory,
+    const uno::Reference<XComponentContext> & rContext,
     const uno::Reference< XDocumentHandler >& _xFilter,
     sal_Bool /*bEncrypted*/ )
 {
     OSL_ENSURE(xInputStream.is(), "input stream missing");
     OSL_ENSURE(xModelComponent.is(), "document missing");
-    OSL_ENSURE(rFactory.is(), "factory missing");
+    OSL_ENSURE(rContext.is(), "factory missing");
 
     RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "rptxml", "oj", "ReadThroughComponent" );
 
@@ -139,13 +141,7 @@ sal_Int32 ReadThroughComponent(
     aParserInput.aInputStream = xInputStream;
 
     // get parser
-    uno::Reference< XParser > xParser(
-        rFactory->createInstance(
-            ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"))),
-        UNO_QUERY );
-    OSL_ENSURE( xParser.is(), "Can't create parser" );
-    if( !xParser.is() )
-        return 1;
+    uno::Reference< XParser > xParser = xml::sax::Parser::create(rContext);
     RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
 
     // get filter
@@ -289,7 +285,7 @@ sal_Int32 ReadThroughComponent(
         return ReadThroughComponent( xInputStream
                                     ,xModelComponent
                                     ,pStreamName
-                                    ,rFactory
+                                    ,comphelper::getComponentContext(rFactory)
                                     ,xDocHandler
                                     ,bEncrypted );
     }
diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx
index e30df93..2e378a4 100644
--- a/sc/inc/xmlwrap.hxx
+++ b/sc/inc/xmlwrap.hxx
@@ -38,7 +38,7 @@ namespace com { namespace sun { namespace star {
     namespace uno { class XInterface; }
     namespace embed { class XStorage; }
     namespace xml {
-        namespace sax { struct InputSource; } }
+        namespace sax { struct InputSource; class XParser; } }
 } } }
 
 class ScXMLImportWrapper
@@ -51,7 +51,7 @@ class ScXMLImportWrapper
 
     sal_uInt32 ImportFromComponent(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory,
         com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xModel,
-        com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xXMLParser,
+        com::sun::star::uno::Reference<com::sun::star::xml::sax::XParser>& xParser,
         com::sun::star::xml::sax::InputSource& aParserInput,
         const rtl::OUString& sComponentName, const rtl::OUString& sDocName, const rtl::OUString& sOldDocName,
         com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArgs,
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index acbc1fa..83ee343 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -44,7 +44,7 @@
 #include <com/sun/star/xml/sax/XEntityResolver.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDTDHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XActiveDataControl.hpp>
 #include <com/sun/star/frame/XModel.hpp>
@@ -110,7 +110,7 @@ uno::Reference <task::XStatusIndicator> ScXMLImportWrapper::GetStatusIndicator()
 }
 
 sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference<lang::XMultiServiceFactory>& xServiceFactory,
-    uno::Reference<frame::XModel>& xModel, uno::Reference<uno::XInterface>& xXMLParser,
+    uno::Reference<frame::XModel>& xModel, uno::Reference<xml::sax::XParser>& xParser,
     xml::sax::InputSource& aParserInput,
     const rtl::OUString& sComponentName, const rtl::OUString& sDocName,
     const rtl::OUString& sOldDocName, uno::Sequence<uno::Any>& aArgs,
@@ -184,7 +184,6 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference<lang::XMultiSe
         xImporter->setTargetDocument( xComponent );
 
     // connect parser and filter
-    uno::Reference<xml::sax::XParser> xParser( xXMLParser, uno::UNO_QUERY );
     xParser->setDocumentHandler( xDocHandler );
 
     try
@@ -325,6 +324,7 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError)
 
     uno::Reference<lang::XMultiServiceFactory> xServiceFactory =
                                         comphelper::getProcessServiceFactory();
+    uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
     OSL_ENSURE( xServiceFactory.is(), "got no service manager" );
     if( !xServiceFactory.is() )
         return false;
@@ -337,12 +337,7 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError)
         xStorage = pMedium->GetStorage();
 
     // get parser
-    uno::Reference<uno::XInterface> xXMLParser(
-        xServiceFactory->createInstance(
-            OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" )) ));
-    OSL_ENSURE( xXMLParser.is(), "com.sun.star.xml.sax.Parser service missing" );
-    if( !xXMLParser.is() )
-        return false;
+    uno::Reference<xml::sax::XParser> xXMLParser = xml::sax::Parser::create(xContext);
 
     // get filter
     SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 8eb74ee..87e19f8 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -31,7 +31,7 @@
 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/presentation/EffectPresetClass.hpp>
@@ -266,11 +266,7 @@ Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFac
         aParserInput.aInputStream = xInputStream;
 
         // get parser
-        Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance("com.sun.star.xml.sax.Parser" ), UNO_QUERY );
-
-        DBG_ASSERT( xParser.is(), "Can't create parser" );
-        if( !xParser.is() )
-            return xRootNode;
+        Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( comphelper::getComponentContext(xServiceFactory) );
 
         // get filter
         Reference< xml::sax::XDocumentHandler > xFilter( xServiceFactory->createInstance("com.sun.star.comp.Xmloff.AnimationsImport" ), UNO_QUERY );
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 77caf60..f9cf8e3 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -58,9 +58,10 @@
 #include <com/sun/star/xml/sax/XEntityResolver.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDTDHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XActiveDataControl.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/propertysetinfo.hxx>
 #include <unotools/saveopt.hxx>
@@ -228,12 +229,7 @@ sal_Int32 ReadThroughComponent(
     aParserInput.aInputStream = xInputStream;
 
     // get parser
-    Reference< xml::sax::XParser > xParser(
-        rFactory->createInstance("com.sun.star.xml.sax.Parser" ),
-        UNO_QUERY );
-    DBG_ASSERT( xParser.is(), "Can't create parser" );
-    if( !xParser.is() )
-        return SD_XML_READERROR;
+    Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(rFactory));
     RTL_LOGFILE_CONTEXT_TRACE( aLog, "parser created" );
 
     // get filter
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 8c717ed..0b97c0b 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -44,7 +44,7 @@
 #include "com/sun/star/document/XImporter.hpp"
 #include "com/sun/star/document/XExporter.hpp"
 #include "com/sun/star/document/XFilter.hpp"
-#include "com/sun/star/xml/sax/XParser.hpp"
+#include "com/sun/star/xml/sax/Parser.hpp"
 #include "com/sun/star/xml/dom/XDocument.hpp"
 #include "com/sun/star/xml/dom/XElement.hpp"
 #include "com/sun/star/xml/dom/DocumentBuilder.hpp"
@@ -1918,13 +1918,7 @@ SfxDocumentMetaData::loadFromStorage(
     // create DOM parser service
     css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (
         m_xContext->getServiceManager());
-    css::uno::Reference<css::xml::sax::XParser> xParser (
-        xMsf->createInstanceWithContext(::rtl::OUString(
-                "com.sun.star.xml.sax.Parser"), m_xContext),
-        css::uno::UNO_QUERY_THROW);
-    if (!xParser.is()) throw css::uno::RuntimeException(
-        ::rtl::OUString("SfxDocumentMetaData::loadFromStorage:"
-                " cannot create Parser service"), *this);
+    css::uno::Reference<css::xml::sax::XParser> xParser = css::xml::sax::Parser::create(m_xContext);
     css::xml::sax::InputSource input;
     input.aInputStream = xInStream;
 
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 75e294c..76a4f5d 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -1307,7 +1307,7 @@ uno::Sequence< beans::StringPair > SfxDocTplService_Impl::ReadUINamesForTemplate
         {
             uno::Reference< io::XInputStream > xLocStream = aLocContent.openStream();
             if ( xLocStream.is() )
-                aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, mxFactory );
+                aUINames = DocTemplLocaleHelper::ReadGroupLocalizationSequence( xLocStream, comphelper::getComponentContext(mxFactory) );
         }
         catch( uno::Exception& )
         {}
diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx
index 71ee17e..82452dc 100644
--- a/sfx2/source/doc/doctemplateslocal.cxx
+++ b/sfx2/source/doc/doctemplateslocal.cxx
@@ -21,7 +21,7 @@
 #include <com/sun/star/beans/StringPair.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 
@@ -32,11 +32,11 @@
 using namespace ::com::sun::star;
 
 // -----------------------------------
-uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+uno::Sequence< beans::StringPair > DocTemplLocaleHelper::ReadGroupLocalizationSequence( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< uno::XComponentContext > xContext )
     throw( uno::Exception )
 {
     ::rtl::OUString aStringID = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "groupuinames.xml" ) );
-    return ReadLocalizationSequence_Impl( xInStream, aStringID, xFactory );
+    return ReadLocalizationSequence_Impl( xInStream, aStringID, xContext );
 }
 
 // -----------------------------------
@@ -92,15 +92,15 @@ void SAL_CALL DocTemplLocaleHelper::WriteGroupLocalizationSequence( const uno::R
 // ==================================================================================
 
 // -----------------------------------
-uno::Sequence< beans::StringPair > SAL_CALL DocTemplLocaleHelper::ReadLocalizationSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const uno::Reference< lang::XMultiServiceFactory > xFactory )
+uno::Sequence< beans::StringPair > SAL_CALL DocTemplLocaleHelper::ReadLocalizationSequence_Impl( const uno::Reference< io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const uno::Reference< uno::XComponentContext > xContext )
     throw( uno::Exception )
 {
-    if ( !xFactory.is() || !xInStream.is() )
+    if ( !xContext.is() || !xInStream.is() )
         throw uno::RuntimeException();
 
     uno::Sequence< beans::StringPair > aResult;
 
-    uno::Reference< xml::sax::XParser > xParser( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW );
+    uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
     DocTemplLocaleHelper* pHelper = new DocTemplLocaleHelper();
     uno::Reference< xml::sax::XDocumentHandler > xHelper( static_cast< xml::sax::XDocumentHandler* >( pHelper ) );
diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx
index 49327ea..ba0f58a 100644
--- a/sfx2/source/doc/doctemplateslocal.hxx
+++ b/sfx2/source/doc/doctemplateslocal.hxx
@@ -41,7 +41,7 @@ class DocTemplLocaleHelper : public cppu::WeakImplHelper1 < com::sun::star::xml:
     DocTemplLocaleHelper(); // must not be created directly
     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > GetParsingResult();
 
-    static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL ReadLocalizationSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
+    static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > SAL_CALL ReadLocalizationSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const ::rtl::OUString& aStringID, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
     throw( ::com::sun::star::uno::Exception );
 
 public:
@@ -52,7 +52,7 @@ public:
     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >
     ReadGroupLocalizationSequence(
         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
-        const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory )
+        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
             throw( ::com::sun::star::uno::Exception );
 
     // writes sequence of elements ( GroupName, GroupUIName )
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 2ef4d8b..f7c5f30 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3382,11 +3382,11 @@ uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfig
                 xOOo1ConfigStorage = getDocumentSubStorage( aOOo1UIConfigFolderName, embed::ElementModes::READ );
                 if ( xOOo1ConfigStorage.is() )
                 {
-                    uno::Reference< lang::XMultiServiceFactory > xServiceMgr( ::comphelper::getProcessServiceFactory() );
+                    uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
                     uno::Sequence< uno::Reference< container::XIndexContainer > > rToolbars;
 
                     sal_Bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars(
-                                            xNewUIConfMan, rToolbars, xServiceMgr, xOOo1ConfigStorage );
+                                            xNewUIConfMan, rToolbars, xContext, xOOo1ConfigStorage );
                     if ( bImported )
                     {
                         SfxObjectShell* pObjShell = SfxBaseModel::GetObjectShell();
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index a71fc36..2273c10 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -26,7 +26,7 @@ one go*/
 #include <com/sun/star/xml/sax/XEntityResolver.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XDTDHandler.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
 #include <com/sun/star/io/XActiveDataControl.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
@@ -38,6 +38,7 @@ one go*/
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/uno/Any.h>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
@@ -273,13 +274,7 @@ sal_uLong SmXMLImportWrapper::ReadThroughComponent(
     aParserInput.aInputStream = xInputStream;
 
     // get parser
-    Reference< xml::sax::XParser > xParser(
-        rFactory->createInstance(
-            "com.sun.star.xml.sax.Parser"),
-        UNO_QUERY );
-    OSL_ENSURE( xParser.is(), "Can't create parser" );
-    if ( !xParser.is() )
-        return nError;
+    Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(rFactory));
 
     Sequence<Any> aArgs( 1 );
     aArgs[0] <<= rPropSet;
diff --git a/svx/source/xml/xmlexport.cxx b/svx/source/xml/xmlexport.cxx
index 7273fc7..0109eff 100644
--- a/svx/source/xml/xmlexport.cxx
+++ b/svx/source/xml/xmlexport.cxx
@@ -29,7 +29,7 @@
 #include <tools/debug.hxx>
 #include <tools/diagnose_ex.h>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
@@ -190,6 +190,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInpu
     {
         // Get service factory
         Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
+        Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
         DBG_ASSERT( xServiceFactory.is(), "XMLReader::Read: got no service manager" );
 
         if( !xServiceFactory.is() )
@@ -226,8 +227,7 @@ sal_Bool SvxDrawingLayerImport( SdrModel* pModel, const uno::Reference<io::XInpu
             aParserInput.aInputStream = xInputStream;
 
             // get parser
-            Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString("com.sun.star.xml.sax.Parser") ), UNO_QUERY );
-            DBG_ASSERT( xParser.is(), "Can't create parser" );
+            Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
             // prepare filter arguments
             Sequence<Any> aFilterArgs( 2 );
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index e552dda..09cc967 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -31,7 +31,7 @@
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/io/XActiveDataControl.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
@@ -393,13 +393,14 @@ bool SvxXMLXTableImport::load( const rtl::OUString &rPath,
     try
     {
         uno::Reference<lang::XMultiServiceFactory> xServiceFactory( ::comphelper::getProcessServiceFactory() );
+        uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
         if( !xServiceFactory.is() )
         {
             OSL_FAIL( "SvxXMLXTableImport::load: got no service manager" );
             return false;
         }
 
-        uno::Reference< xml::sax::XParser > xParser( xServiceFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Parser" ) ) ), uno::UNO_QUERY_THROW );
+        uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
 
         xml::sax::InputSource aParserInput;
         comphelper::LifecycleProxy aNasty;
diff --git a/svx/workben/msview/xmlconfig.cxx b/svx/workben/msview/xmlconfig.cxx
index b97e5f0..6a85448 100644
--- a/svx/workben/msview/xmlconfig.cxx
+++ b/svx/workben/msview/xmlconfig.cxx
@@ -29,7 +29,7 @@
 
 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/xml/sax/SAXParseException.hpp>
 #include <com/sun/star/io/IOException.hpp>
 #include <cppuhelper/implbase1.hxx>
@@ -323,10 +323,7 @@ void load_config( const OUString& rPath )
         aParserInput.aInputStream = xInputStream;
 
         // get parser
-        Reference< XParser > xParser(
-            comphelper::getProcessServiceFactory()->createInstance(
-                OUString("com.sun.star.xml.sax.Parser") ),
-            UNO_QUERY_THROW );
+        Reference< XParser > xParser = Parser::create(comphelper::getProcessComponentContext());
 
         // get filter
         ConfigHandler* pConfigHandler = new ConfigHandler();
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index 7b0d48f..e49b467 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
     framework/util/fwk \
     i18npool/util/i18npool \
     package/util/package2 \
+    sax/source/expatwrap/expwrap \
     sfx2/util/sfx \
     svtools/util/svt \
     sw/util/msword \
diff --git a/sw/CppunitTest_sw_subsequent_rtfimport.mk b/sw/CppunitTest_sw_subsequent_rtfimport.mk
index 062ef8d..2cc2110 100644
--- a/sw/CppunitTest_sw_subsequent_rtfimport.mk
+++ b/sw/CppunitTest_sw_subsequent_rtfimport.mk
@@ -72,6 +72,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_subsequent_rtfimport,\
     framework/util/fwk \
     i18npool/util/i18npool \
     package/util/package2 \
+    sax/source/expatwrap/expwrap \
     sw/util/sw \
     sw/util/swd \
     sfx2/util/sfx \
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 646439b..714de20 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -32,10 +32,11 @@
 #include <svtools/unoevent.hxx>
 #include <sfx2/docfile.hxx>
 #include <unotools/streamwrap.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
+#include <com/sun/star/xml/sax/Parser.hpp>
 #include <com/sun/star/document/XStorageBasedDocument.hpp>
 #include <doc.hxx>
 #include <docsh.hxx>
@@ -118,23 +119,13 @@ sal_uLong SwXMLTextBlocks::GetDoc( sal_uInt16 nIdx )
 
             aParserInput.aInputStream = xStream->getInputStream();
 
-            // get parser
-            uno::Reference< XInterface > xXMLParser = xServiceFactory->createInstance(
-                    OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser")));
-            OSL_ENSURE( xXMLParser.is(),
-                    "XMLReader::Read: com.sun.star.xml.sax.Parser service missing" );
-            if( !xXMLParser.is() )
-            {
-                // Maybe throw an exception?
-            }
-
             // get filter
             // #110680#
             // uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( *this, aCur, sal_True );
             uno::Reference< xml::sax::XDocumentHandler > xFilter = new SwXMLTextBlockImport( xServiceFactory, *this, aCur, sal_True );
 
             // connect parser and filter
-            uno::Reference< xml::sax::XParser > xParser( xXMLParser, UNO_QUERY );
+            uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create(comphelper::getComponentContext(xServiceFactory));
             xParser->setDocumentHandler( xFilter );
 
             // parse
@@ -218,74 +209,67 @@ sal_uLong SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
                 // get service factory
                 uno::Reference< lang::XMultiServiceFactory > xServiceFactory =
                     comphelper::getProcessServiceFactory();
+                uno::Reference< uno::XComponentContext > xContext =
+                    comphelper::getProcessComponentContext();
                 if ( xServiceFactory.is() )
                 {
 
                     // get parser
-                    OUString sParserService( RTL_CONSTASCII_USTRINGPARAM(
-                        "com.sun.star.xml.sax.Parser" ) );
-                    uno::Reference< xml::sax::XParser > xParser(
-                        xServiceFactory->createInstance(sParserService),
+                    uno::Reference< xml::sax::XParser > xParser = xml::sax::Parser::create( xContext );
+
+                    // create descriptor and reference to it. Either
+                    // both or neither must be kept because of the
+                    // reference counting!
+                    SvMacroTableEventDescriptor* pDescriptor =
+                        new SvMacroTableEventDescriptor(aAutotextEvents);
+                    uno::Reference<XNameReplace> xReplace = pDescriptor;
+                    Sequence<Any> aFilterArguments( 1 );
+                    aFilterArguments[0] <<= xReplace;
+
+                    // get filter
+                    OUString sFilterComponent = bOasis
+                        ? OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter"))
+                        : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLAutotextEventsImporter"));
+                    uno::Reference< xml::sax::XDocumentHandler > xFilter(
+                        xServiceFactory->createInstanceWithArguments(
+                            sFilterComponent, aFilterArguments),
                         UNO_QUERY );
-                    OSL_ENSURE( xParser.is(), "Can't create parser" );
-                    if( xParser.is() )
+                    OSL_ENSURE( xFilter.is(),
+                                "can't instantiate atevents filter");
+                    if ( xFilter.is() )
                     {
-                        // create descriptor and reference to it. Either
-                        // both or neither must be kept because of the
-                        // reference counting!
-                        SvMacroTableEventDescriptor* pDescriptor =
-                            new SvMacroTableEventDescriptor(aAutotextEvents);
-                        uno::Reference<XNameReplace> xReplace = pDescriptor;
-                        Sequence<Any> aFilterArguments( 1 );
-                        aFilterArguments[0] <<= xReplace;
-
-                        // get filter
-                        OUString sFilterComponent = bOasis
-                            ? OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLOasisAutotextEventsImporter"))
-                            : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.XMLAutotextEventsImporter"));
-                        uno::Reference< xml::sax::XDocumentHandler > xFilter(
-                            xServiceFactory->createInstanceWithArguments(
-                                sFilterComponent, aFilterArguments),
-                            UNO_QUERY );
-                        OSL_ENSURE( xFilter.is(),
-                                    "can't instantiate atevents filter");
-                        if ( xFilter.is() )
+                        // connect parser and filter
+                        xParser->setDocumentHandler( xFilter );
+
+                        // connect model and filter
+                        uno::Reference<document::XImporter> xImporter( xFilter,
+                                                                UNO_QUERY );
+
+                        // we don't need a model
+                        // xImporter->setTargetDocument( xModelComponent );
+
+                        // parse the stream
+                        try
+                        {
+                            xParser->parseStream( aParserInput );
+                        }
+                        catch( xml::sax::SAXParseException& )
+                        {
+                            // workaround for #83452#: SetSize doesn't work
+                            // nRet = ERR_SWG_READ_ERROR;
+                        }
+                        catch( xml::sax::SAXException& )
                         {
-                            // connect parser and filter
-                            xParser->setDocumentHandler( xFilter );
-
-                            // connect model and filter
-                            uno::Reference<document::XImporter> xImporter( xFilter,
-                                                                    UNO_QUERY );
-
-                            // we don't need a model
-                            // xImporter->setTargetDocument( xModelComponent );
-
-                            // parse the stream
-                            try
-                            {
-                                xParser->parseStream( aParserInput );
-                            }
-                            catch( xml::sax::SAXParseException& )
-                            {
-                                // workaround for #83452#: SetSize doesn't work
-                                // nRet = ERR_SWG_READ_ERROR;
-                            }
-                            catch( xml::sax::SAXException& )
-                            {
-                                nRet = ERR_SWG_READ_ERROR;
-                            }
-                            catch( io::IOException& )
-                            {
-                                nRet = ERR_SWG_READ_ERROR;
-                            }
-
-                            // and finally, copy macro into table
-                            if (0 == nRet)
-                                pDescriptor->copyMacrosIntoTable(rMacroTbl);
+                            nRet = ERR_SWG_READ_ERROR;
                         }
-                        else
+                        catch( io::IOException& )
+                        {
                             nRet = ERR_SWG_READ_ERROR;
+                        }
+
+                        // and finally, copy macro into table

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list