[Libreoffice-commits] .: 2 commits - offapi/com offapi/UnoApi_offapi.mk reportdesign/source sc/source starmath/source sw/source unoxml/source xmloff/inc xmloff/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 01:25:33 PDT 2012


 offapi/UnoApi_offapi.mk                              |    5 --
 offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl   |   13 ++---
 offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl |   43 +++++++++++++++++++
 reportdesign/source/filter/xml/xmlfilter.cxx         |    6 --
 sc/source/filter/xml/xmlimprt.cxx                    |   20 ++------
 starmath/source/mathmlimport.cxx                     |   16 ++-----
 sw/source/filter/xml/xmlimp.cxx                      |   25 ++++-------
 sw/source/filter/xml/xmlmeta.cxx                     |    6 --
 unoxml/source/dom/saxbuilder.hxx                     |    7 +--
 xmloff/inc/xmloff/xmlmetai.hxx                       |    8 +--
 xmloff/source/chart/SchXMLImport.cxx                 |    9 ---
 xmloff/source/chart/contexts.cxx                     |    5 --
 xmloff/source/chart/contexts.hxx                     |    3 -
 xmloff/source/draw/sdxmlimp.cxx                      |   20 ++------
 xmloff/source/meta/MetaImportComponent.cxx           |    7 ---
 xmloff/source/meta/xmlmetai.cxx                      |   32 ++++++--------
 16 files changed, 104 insertions(+), 121 deletions(-)

New commits:
commit fe1fd7c40caaa83fe2b86c9884dc1693d58741e7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Sep 12 10:24:08 2012 +0200

    Improvement on previous commit
    
    Change-Id: I51226f78ca60c32ebb908bcf4f74d38d0750eb00

diff --git a/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl b/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl
index 9463176..3f1f673 100644
--- a/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl
+++ b/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl
@@ -27,6 +27,8 @@ module com {  module sun {  module star {  module xml { module dom {
 
 /**
   Provides a unified interface for the SAXDocumentBuilder service to implement.
+
+  @since LibreOffice 3.7
 */
 interface XSAXDocumentBuilder2
 {
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 8b94125..bb91956 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -43,12 +43,10 @@
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/XMLFontStylesContext.hxx>
 #include <rtl/logfile.hxx>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <xmloff/ProgressBarHelper.hxx>
@@ -1085,11 +1083,8 @@ SvXMLImportContext* ORptFilter::CreateMetaContext(const ::rtl::OUString& rLocalN
 
     if ( (getImportFlags() & IMPORT_META) )
     {
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(getServiceFactory()).getUNOContext()),
-            uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(GetModel(), uno::UNO_QUERY_THROW);
-        pContext = new SvXMLMetaDocumentContext(*this,XML_NAMESPACE_OFFICE, rLocalName,xDPS->getDocumentProperties(), xDocBuilder);
+        pContext = new SvXMLMetaDocumentContext(*this,XML_NAMESPACE_OFFICE, rLocalName,xDPS->getDocumentProperties());
     }
     return pContext;
 }
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 3df0818..872c967 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -71,7 +71,6 @@
 #include "rangeutl.hxx"
 #include "postit.hxx"
 #include "formulaparserpool.hxx"
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -91,7 +90,6 @@
 #include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
 #include <memory>
 
@@ -296,8 +294,7 @@ public:
     ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const OUString & i_rLName,
         const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps);
 
     virtual ~ScXMLFlatDocContext_Impl();
 
@@ -309,12 +306,11 @@ public:
 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
                                                    sal_uInt16 i_nPrefix, const OUString & i_rLName,
                                                    const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
-                                                   const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-                                                   const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+                                                   const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
 SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
 ScXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
 SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
-                         i_xDocProps, i_xDocBuilder)
+                         i_xDocProps)
 {
 }
 
@@ -1832,14 +1828,11 @@ SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix,
             pContext = CreateMetaContext(rLocalName);
     } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
         ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
-            uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                uno::UNO_QUERY_THROW);
             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
                 GetModel(), uno::UNO_QUERY_THROW);
             // flat OpenDocument file format
             pContext = new ScXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
-                xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
+                xAttrList, xDPS->getDocumentProperties());
     }
     else
         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
@@ -2127,14 +2120,11 @@ SvXMLImportContext *ScXMLImport::CreateMetaContext(
 
     if( !IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
     {
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-            uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
         pContext = new SvXMLMetaDocumentContext(*this,
             XML_NAMESPACE_OFFICE, rLocalName,
-            xDPS->getDocumentProperties(), xDocBuilder);
+            xDPS->getDocumentProperties());
     }
 
     if( !pContext )
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index d534377..a57b83b 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -37,9 +37,7 @@ one go*/
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/uno/Any.h>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
@@ -1856,8 +1854,7 @@ class SmXMLFlatDocContext_Impl
 public:
     SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const OUString & i_rLName,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps);
 
     virtual ~SmXMLFlatDocContext_Impl();
 
@@ -1866,12 +1863,11 @@ public:
 
 SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const OUString & i_rLName,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
     SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
     SmXMLOfficeContext_Impl(i_rImport, i_nPrefix, i_rLName),
     SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
-        i_xDocProps, i_xDocBuilder)
+        i_xDocProps)
 {
 }
 
@@ -2658,18 +2654,15 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
         if ( (IsXMLToken(rLocalName, XML_DOCUMENT) ||
               IsXMLToken(rLocalName, XML_DOCUMENT_META)))
         {
-            uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                    uno::UNO_QUERY_THROW);
             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
                 GetModel(), uno::UNO_QUERY_THROW);
             return IsXMLToken(rLocalName, XML_DOCUMENT_META)
                 ? new SvXMLMetaDocumentContext(*this,
                         XML_NAMESPACE_OFFICE, rLocalName,
-                        xDPS->getDocumentProperties(), xDocBuilder)
+                        xDPS->getDocumentProperties())
                 // flat OpenDocument file format -- this has not been tested...
                 : new SmXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
-                            xDPS->getDocumentProperties(), xDocBuilder);
+                            xDPS->getDocumentProperties());
         }
         else
         {
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 15e0f98..db8b993 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -34,7 +34,6 @@
 #include <com/sun/star/i18n/XForbiddenCharacters.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmltkmap.hxx>
@@ -73,7 +72,6 @@
 
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xformsimport.hxx>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/servicehelper.hxx>
 
 using ::rtl::OUString;
@@ -281,8 +279,7 @@ public:
                 sal_uInt16 nPrfx,
                 const OUString& rLName,
                 const Reference< xml::sax::XAttributeList > & xAttrList,
-                const Reference< document::XDocumentProperties >& xDocProps,
-                const Reference< xml::sax::XDocumentHandler >& xDocBuilder);
+                const Reference< document::XDocumentProperties >& xDocProps);
     virtual ~SwXMLOfficeDocContext_Impl();
 
     TYPEINFO();
@@ -298,11 +295,10 @@ SwXMLOfficeDocContext_Impl::SwXMLOfficeDocContext_Impl(
                 sal_uInt16 nPrfx,
                 const OUString& rLName,
                 const Reference< xml::sax::XAttributeList > & xAttrList,
-                const Reference< document::XDocumentProperties >& xDocProps,
-                const Reference< xml::sax::XDocumentHandler >& xDocBuilder) :
+                const Reference< document::XDocumentProperties >& xDocProps) :
     SvXMLImportContext( rImport, nPrfx, rLName ),
     SwXMLDocContext_Impl( rImport, nPrfx, rLName, xAttrList ),
-    SvXMLMetaDocumentContext( rImport, nPrfx, rLName, xDocProps, xDocBuilder)
+    SvXMLMetaDocumentContext( rImport, nPrfx, rLName, xDocProps)
 {
 }
 
@@ -416,14 +412,11 @@ SvXMLImportContext *SwXMLImport::CreateContext(
     else if ( XML_NAMESPACE_OFFICE==nPrefix &&
               IsXMLToken( rLocalName, XML_DOCUMENT ) )
     {
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentProperties> const xDocProps(
             GetDocumentProperties());
         // flat OpenDocument file format
         pContext = new SwXMLOfficeDocContext_Impl( *this, nPrefix, rLocalName,
-                        xAttrList, xDocProps, xDocBuilder);
+                        xAttrList, xDocProps);
     }
     else
         pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index 58b472f..1791c3c 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -30,8 +30,6 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
-#include <comphelper/componentcontext.hxx>
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xmlmetae.hxx>
@@ -76,13 +74,10 @@ SvXMLImportContext *SwXMLImport::CreateMetaContext(
 
     if (getImportFlags() & IMPORT_META)
     {
-        uno::Reference<xml::sax::XDocumentHandler> const xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-            uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentProperties> const xDocProps(
                 GetDocumentProperties());
         pContext = new SvXMLMetaDocumentContext(*this,
-                    XML_NAMESPACE_OFFICE, rLocalName, xDocProps, xDocBuilder);
+                    XML_NAMESPACE_OFFICE, rLocalName, xDocProps);
     }
 
     if( !pContext )
diff --git a/xmloff/inc/xmloff/xmlmetai.hxx b/xmloff/inc/xmloff/xmlmetai.hxx
index 64afb05..5b67902 100644
--- a/xmloff/inc/xmloff/xmlmetai.hxx
+++ b/xmloff/inc/xmloff/xmlmetai.hxx
@@ -26,7 +26,7 @@
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
 
 
 /// handles the top-level office:document-meta element of meta.xml documents
@@ -39,15 +39,13 @@ private:
     ::com::sun::star::uno::Reference<
         ::com::sun::star::document::XDocumentProperties> mxDocProps;
     ::com::sun::star::uno::Reference<
-        ::com::sun::star::xml::sax::XDocumentHandler> mxDocBuilder;
+        ::com::sun::star::xml::dom::XSAXDocumentBuilder2> mxDocBuilder;
 
 public:
     SvXMLMetaDocumentContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
         const rtl::OUString& rLName,
         const ::com::sun::star::uno::Reference<
-            ::com::sun::star::document::XDocumentProperties>& xDocProps,
-        const ::com::sun::star::uno::Reference<
-            ::com::sun::star::xml::sax::XDocumentHandler>& xDocBuilder);
+            ::com::sun::star::document::XDocumentProperties>& xDocProps);
 
     virtual ~SvXMLMetaDocumentContext();
 
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index b3cd44d..ab0ae4d 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -35,7 +35,6 @@
 
 #include <tools/debug.hxx>
 #include <rtl/ustrbuf.hxx>
-#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include "xmloff/xmlnmspe.hxx"
 #include <xmloff/xmltoken.hxx>
@@ -57,7 +56,6 @@
 
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
 #include <typeinfo>
 
@@ -608,17 +606,14 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr
             GetModel(), uno::UNO_QUERY);
         // mst@: right now, this seems to be not supported, so it is untested
         if (xDPS.is()) {
-            uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                    uno::UNO_QUERY_THROW);
             pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
                 ? new SvXMLMetaDocumentContext(*this,
                             XML_NAMESPACE_OFFICE, rLocalName,
-                            xDPS->getDocumentProperties(), xDocBuilder)
+                            xDPS->getDocumentProperties())
                 // flat OpenDocument file format
                 : new SchXMLFlatDocContext_Impl(
                             maImportHelper, *this, nPrefix, rLocalName,
-                            xDPS->getDocumentProperties(), xDocBuilder);
+                            xDPS->getDocumentProperties());
         } else {
             pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
                 ? SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList )
diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx
index 7b41a07..37eb7e2 100644
--- a/xmloff/source/chart/contexts.cxx
+++ b/xmloff/source/chart/contexts.cxx
@@ -141,12 +141,11 @@ SchXMLFlatDocContext_Impl::SchXMLFlatDocContext_Impl(
         SchXMLImportHelper& i_rImpHelper,
         SchXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
     SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
     SchXMLDocContext(i_rImpHelper, i_rImport, i_nPrefix, i_rLName),
     SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
-        i_xDocProps, i_xDocBuilder)
+        i_xDocProps)
 {
 }
 
diff --git a/xmloff/source/chart/contexts.hxx b/xmloff/source/chart/contexts.hxx
index 15fa75f..186c98f 100644
--- a/xmloff/source/chart/contexts.hxx
+++ b/xmloff/source/chart/contexts.hxx
@@ -70,8 +70,7 @@ public:
         SchXMLImportHelper& i_rImpHelper,
         SchXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const ::rtl::OUString & i_rLName,
-        const com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>& i_xDocProps,
-        const com::sun::star::uno::Reference<com::sun::star::xml::sax::XDocumentHandler>& i_xDocBuilder);
+        const com::sun::star::uno::Reference<com::sun::star::document::XDocumentProperties>& i_xDocProps);
 
     virtual ~SchXMLFlatDocContext_Impl();
 
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index d581d8a..01e4744 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -55,8 +55,6 @@
 
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
-#include <comphelper/componentcontext.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -254,8 +252,7 @@ public:
     SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const OUString & i_rLName,
         const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps);
 
     virtual ~SdXMLFlatDocContext_Impl();
 
@@ -267,12 +264,11 @@ public:
 SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport,
         sal_uInt16 i_nPrefix, const OUString & i_rLName,
         const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
-        const uno::Reference<document::XDocumentProperties>& i_xDocProps,
-        const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
+        const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
     SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
     SdXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
     SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
-        i_xDocProps, i_xDocBuilder)
+        i_xDocProps)
 {
 }
 
@@ -733,14 +729,11 @@ SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
         pContext = CreateMetaContext(rLocalName, xAttrList);
     } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
                 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
         // flat OpenDocument file format
         pContext = new SdXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
-                        xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
+                        xAttrList, xDPS->getDocumentProperties());
     } else {
         pContext = SvXMLImport::CreateContext(nPrefix, rLocalName, xAttrList);
     }
@@ -757,16 +750,13 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
 
     if (getImportFlags() & IMPORT_META)
     {
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentProperties> const xDocProps(
             (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
         pContext = new SvXMLMetaDocumentContext(*this,
                         XML_NAMESPACE_OFFICE, rLocalName,
-                        xDocProps, xDocBuilder);
+                        xDocProps);
     }
 
     if(!pContext)
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
index 1acb47e..f2d66c7 100644
--- a/xmloff/source/meta/MetaImportComponent.cxx
+++ b/xmloff/source/meta/MetaImportComponent.cxx
@@ -34,9 +34,6 @@
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/nmspmap.hxx>
 
-#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
-#include <comphelper/componentcontext.hxx>
-
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
 
@@ -68,11 +65,8 @@ SvXMLImportContext* XMLMetaImportComponent::CreateContext(
                 "XMLMetaImportComponent::CreateContext: setTargetDocument "
                 "has not been called")), *this);
         }
-        uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
-                 uno::UNO_QUERY_THROW);
         return new SvXMLMetaDocumentContext(
-                        *this, nPrefix, rLocalName, mxDocProps, xDocBuilder);
+                        *this, nPrefix, rLocalName, mxDocProps);
     }
     else
     {
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 0a2a43a..25b2c2c 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -28,11 +28,12 @@
 
 
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
 #include <com/sun/star/xml/xpath/XXPathAPI.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/XPropertySetInfo.hpp>
-
+#include <comphelper/processfactory.hxx>
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xmlimp.hxx>
 #include <xmloff/nmspmap.hxx>
@@ -53,7 +54,7 @@ class XMLDocumentBuilderContext : public SvXMLImportContext
 {
 private:
     ::com::sun::star::uno::Reference<
-        ::com::sun::star::xml::sax::XDocumentHandler> mxDocBuilder;
+        ::com::sun::star::xml::dom::XSAXDocumentBuilder2> mxDocBuilder;
 
 public:
     XMLDocumentBuilderContext(SvXMLImport& rImport, sal_uInt16 nPrfx,
@@ -61,7 +62,7 @@ public:
         const ::com::sun::star::uno::Reference<
             ::com::sun::star::xml::sax::XAttributeList>& xAttrList,
         const ::com::sun::star::uno::Reference<
-            ::com::sun::star::xml::sax::XDocumentHandler>& rDocBuilder);
+            ::com::sun::star::xml::dom::XSAXDocumentBuilder2>& rDocBuilder);
 
     virtual ~XMLDocumentBuilderContext();
 
@@ -81,7 +82,7 @@ public:
 XMLDocumentBuilderContext::XMLDocumentBuilderContext(SvXMLImport& rImport,
         sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
         const uno::Reference<xml::sax::XAttributeList>&,
-        const uno::Reference<xml::sax::XDocumentHandler>& rDocBuilder) :
+        const uno::Reference<xml::dom::XSAXDocumentBuilder2>& rDocBuilder) :
     SvXMLImportContext( rImport, nPrfx, rLName ),
     mxDocBuilder(rDocBuilder)
 {
@@ -124,13 +125,11 @@ void XMLDocumentBuilderContext::EndElement()
 
 static void
 lcl_initDocumentProperties(SvXMLImport & rImport,
-        uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder,
+        uno::Reference<xml::dom::XSAXDocumentBuilder2> const& xDocBuilder,
         uno::Reference<document::XDocumentProperties> const& xDocProps)
 {
     uno::Sequence< uno::Any > aSeq(1);
-    uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder,
-        uno::UNO_QUERY_THROW);
-    aSeq[0] <<= xDB->getDocument();
+    aSeq[0] <<= xDocBuilder->getDocument();
     uno::Reference< lang::XInitialization > const xInit(xDocProps,
         uno::UNO_QUERY_THROW);
     try {
@@ -156,11 +155,9 @@ lcl_initDocumentProperties(SvXMLImport & rImport,
 
 static void
 lcl_initGenerator(SvXMLImport & rImport,
-        uno::Reference<xml::sax::XDocumentHandler> const& xDocBuilder)
+        uno::Reference<xml::dom::XSAXDocumentBuilder2> const& xDocBuilder)
 {
-    uno::Reference< xml::dom::XSAXDocumentBuilder > const xDB(xDocBuilder,
-        uno::UNO_QUERY_THROW);
-    uno::Reference< xml::dom::XDocument > const xDoc(xDB->getDocument(),
+    uno::Reference< xml::dom::XDocument > const xDoc(xDocBuilder->getDocument(),
         uno::UNO_SET_THROW);
     try {
         uno::Reference< xml::xpath::XXPathAPI > const xPath(
@@ -188,16 +185,15 @@ lcl_initGenerator(SvXMLImport & rImport,
 
 SvXMLMetaDocumentContext::SvXMLMetaDocumentContext(SvXMLImport& rImport,
             sal_uInt16 nPrfx, const rtl::OUString& rLName,
-            const uno::Reference<document::XDocumentProperties>& xDocProps,
-            const uno::Reference<xml::sax::XDocumentHandler>& xDocBuilder) :
+            const uno::Reference<document::XDocumentProperties>& xDocProps) :
     SvXMLImportContext( rImport, nPrfx, rLName ),
     mxDocProps(xDocProps),
-    mxDocBuilder(xDocBuilder)
+    mxDocBuilder(
+        xml::dom::SAXDocumentBuilder::create(
+            comphelper::getProcessComponentContext()))
 {
 // #i103539#: must always read meta.xml for generator, xDocProps unwanted then
 //    OSL_ENSURE(xDocProps.is(), "SvXMLMetaDocumentContext: no document props");
-    OSL_ENSURE(xDocBuilder.is(), "SvXMLMetaDocumentContext: no document hdlr");
-    // here are no attributes
 }
 
 SvXMLMetaDocumentContext::~SvXMLMetaDocumentContext()
commit 372f9801687cad620924b7ac6e4fe488ff998334
Author: Noel Grandin <noel at peralex.com>
Date:   Thu Sep 6 14:00:14 2012 +0200

    fdo#46808, Adapt xml::dom::SAXDocumentBuilderr UNO service to new style
    
    Create a merged XSAXDocumentBuilder2 interface for this service to implement.
    Which is backwards-compatible, but does not require creating a new service.
    
    Change-Id: Iaa96031a0b7c27e957d2edb0394e5eeaaa84cdca

diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 20eafe0..17b3711 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -307,6 +307,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/dom,\
 	DocumentBuilder \
+	SAXDocumentBuilder \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\
 	FastShapeContextHandler \
@@ -1529,9 +1530,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/cry
 	SignatureCreator \
 	SignatureVerifier \
 ))
-$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/dom,\
-	SAXDocumentBuilder \
-))
 $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/input,\
 	SaxDocumentHandler \
 ))
@@ -4201,6 +4199,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml/dom,\
 	XNotation \
 	XProcessingInstruction \
 	XSAXDocumentBuilder \
+	XSAXDocumentBuilder2 \
 	XText \
 ))
 $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml/dom/events,\
diff --git a/offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl b/offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl
index 7e25bce..b8c4146 100644
--- a/offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl
+++ b/offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+
 #ifndef __com_sun_star_xml_dom_documentbuilder_idl
 #define __com_sun_star_xml_dom_documentbuilder_idl
-#include <com/sun/star/xml/sax/XDocumentHandler.idl>
-#include <com/sun/star/xml/dom/XSAXDocumentBuilder.idl>
+
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.idl>
 
 module com {  module sun {  module star {  module xml { module dom {
 
-    service SAXDocumentBuilder
-    {
-        interface XSAXDocumentBuilder;
-        interface com::sun::star::xml::sax::XDocumentHandler;
-    };
+service SAXDocumentBuilder : XSAXDocumentBuilder2;
+
 };};};};};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl b/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl
new file mode 100644
index 0000000..9463176
--- /dev/null
+++ b/offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl
@@ -0,0 +1,41 @@
+/* -*- 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_dom_XSAXDocumentBuilder2_idl
+#define __com_sun_star_xml_dom_XSAXDocumentBuilder2_idl
+
+#include <com/sun/star/xml/sax/XDocumentHandler.idl>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder.idl>
+
+module com {  module sun {  module star {  module xml { module dom {
+
+/**
+  Provides a unified interface for the SAXDocumentBuilder service to implement.
+*/
+interface XSAXDocumentBuilder2
+{
+    interface XSAXDocumentBuilder;
+    interface com::sun::star::xml::sax::XDocumentHandler;
+};
+
+};};};};};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 00e76c3..8b94125 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -43,10 +43,12 @@
 #include <xmloff/nmspmap.hxx>
 #include <xmloff/XMLFontStylesContext.hxx>
 #include <rtl/logfile.hxx>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 #include <com/sun/star/xml/sax/InputSource.hpp>
 #include <com/sun/star/xml/sax/XParser.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/mediadescriptor.hxx>
 #include <xmloff/ProgressBarHelper.hxx>
@@ -1084,9 +1086,8 @@ SvXMLImportContext* ORptFilter::CreateMetaContext(const ::rtl::OUString& rLocalN
     if ( (getImportFlags() & IMPORT_META) )
     {
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            getServiceFactory()->createInstance(::rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.SAXDocumentBuilder"))),
-                uno::UNO_QUERY_THROW);
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(getServiceFactory()).getUNOContext()),
+            uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(GetModel(), uno::UNO_QUERY_THROW);
         pContext = new SvXMLMetaDocumentContext(*this,XML_NAMESPACE_OFFICE, rLocalName,xDPS->getDocumentProperties(), xDocBuilder);
     }
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 0de87a2..3df0818 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -71,6 +71,7 @@
 #include "rangeutl.hxx"
 #include "postit.hxx"
 #include "formulaparserpool.hxx"
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/extract.hxx>
 
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -90,6 +91,7 @@
 #include <com/sun/star/sheet/XLabelRanges.hpp>
 #include <com/sun/star/io/XSeekable.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
 #include <memory>
 
@@ -1831,8 +1833,7 @@ SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix,
     } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
         ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
             uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                 uno::UNO_QUERY_THROW);
             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
                 GetModel(), uno::UNO_QUERY_THROW);
@@ -2127,8 +2128,7 @@ SvXMLImportContext *ScXMLImport::CreateMetaContext(
     if( !IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
     {
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-            "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
             uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 0d38ec5..d534377 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -37,7 +37,9 @@ one go*/
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/uno/Any.h>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/servicehelper.hxx>
@@ -2657,8 +2659,7 @@ SvXMLImportContext *SmXMLImport::CreateContext(sal_uInt16 nPrefix,
               IsXMLToken(rLocalName, XML_DOCUMENT_META)))
         {
             uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                mxServiceFactory->createInstance(
-                    "com.sun.star.xml.dom.SAXDocumentBuilder"),
+                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                     uno::UNO_QUERY_THROW);
             uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
                 GetModel(), uno::UNO_QUERY_THROW);
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index bf1c1c3..15e0f98 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -27,11 +27,15 @@
  ************************************************************************/
 
 
-#include <com/sun/star/text/XTextDocument.hpp>
-#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <com/sun/star/drawing/XDrawPage.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
-#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
+
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/xmlictxt.hxx>
@@ -40,8 +44,6 @@
 #include <xmloff/XMLTextShapeImportHelper.hxx>
 #include <xmloff/XMLFontStylesContext.hxx>
 #include <xmloff/ProgressBarHelper.hxx>
-#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
-#include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <doc.hxx>
 #include <TextCursorHelper.hxx>
 #include <unotext.hxx>
@@ -71,6 +73,7 @@
 
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xformsimport.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/servicehelper.hxx>
 
 using ::rtl::OUString;
@@ -414,8 +417,7 @@ SvXMLImportContext *SwXMLImport::CreateContext(
               IsXMLToken( rLocalName, XML_DOCUMENT ) )
     {
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                 uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentProperties> const xDocProps(
             GetDocumentProperties());
diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index 0b80ece..58b472f 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -30,6 +30,8 @@
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
+#include <comphelper/componentcontext.hxx>
 #include <xmloff/xmlnmspe.hxx>
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xmlmetae.hxx>
@@ -75,8 +77,7 @@ SvXMLImportContext *SwXMLImport::CreateMetaContext(
     if (getImportFlags() & IMPORT_META)
     {
         uno::Reference<xml::sax::XDocumentHandler> const xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-                "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
             uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentProperties> const xDocProps(
                 GetDocumentProperties());
diff --git a/unoxml/source/dom/saxbuilder.hxx b/unoxml/source/dom/saxbuilder.hxx
index f9a41f4..9945548 100644
--- a/unoxml/source/dom/saxbuilder.hxx
+++ b/unoxml/source/dom/saxbuilder.hxx
@@ -25,17 +25,16 @@
 
 #include <sal/types.h>
 #include <osl/mutex.hxx>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
 #include <com/sun/star/uno/Reference.h>
 #include <com/sun/star/uno/Sequence.h>
 
 #include <com/sun/star/uno/XInterface.hpp>
 #include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/xml/dom/XSAXDocumentBuilder.hpp>
+#include <com/sun/star/xml/dom/XSAXDocumentBuilder2.hpp>
 #include <com/sun/star/xml/dom/SAXDocumentBuilderState.hpp>
 #include <com/sun/star/xml/dom/XDocument.hpp>
 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
 #include <com/sun/star/xml/sax/XLocator.hpp>
 #include <com/sun/star/xml/sax/XAttributeList.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
@@ -60,7 +59,7 @@ namespace DOM
     typedef std::stack< NSMap > NSStack;
 
     class  CSAXDocumentBuilder
-        : public ::cppu::WeakImplHelper3< XDocumentHandler, XSAXDocumentBuilder, XServiceInfo >
+        : public ::cppu::WeakImplHelper2< XSAXDocumentBuilder2, XServiceInfo >
     {
 
     private:
diff --git a/xmloff/source/chart/SchXMLImport.cxx b/xmloff/source/chart/SchXMLImport.cxx
index f7ef9a7..b3cd44d 100644
--- a/xmloff/source/chart/SchXMLImport.cxx
+++ b/xmloff/source/chart/SchXMLImport.cxx
@@ -35,6 +35,7 @@
 
 #include <tools/debug.hxx>
 #include <rtl/ustrbuf.hxx>
+#include <comphelper/componentcontext.hxx>
 #include <comphelper/processfactory.hxx>
 #include "xmloff/xmlnmspe.hxx"
 #include <xmloff/xmltoken.hxx>
@@ -56,6 +57,7 @@
 
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
 
 #include <typeinfo>
 
@@ -607,9 +609,7 @@ SvXMLImportContext *SchXMLImport::CreateContext( sal_uInt16 nPrefix, const OUStr
         // mst@: right now, this seems to be not supported, so it is untested
         if (xDPS.is()) {
             uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-                mxServiceFactory->createInstance(
-                    ::rtl::OUString(
-                        "com.sun.star.xml.dom.SAXDocumentBuilder")),
+                xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                     uno::UNO_QUERY_THROW);
             pContext = (IsXMLToken(rLocalName, XML_DOCUMENT_META))
                 ? new SvXMLMetaDocumentContext(*this,
diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx
index a0fbcd1..d581d8a 100644
--- a/xmloff/source/draw/sdxmlimp.cxx
+++ b/xmloff/source/draw/sdxmlimp.cxx
@@ -55,6 +55,8 @@
 
 #include <com/sun/star/document/XDocumentProperties.hpp>
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
+#include <comphelper/componentcontext.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -732,8 +734,7 @@ SvXMLImportContext *SdXMLImport::CreateContext(sal_uInt16 nPrefix,
     } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
                 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(
-                "com.sun.star.xml.dom.SAXDocumentBuilder")),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                 uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
@@ -757,8 +758,7 @@ SvXMLImportContext *SdXMLImport::CreateMetaContext(const OUString& rLocalName,
     if (getImportFlags() & IMPORT_META)
     {
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(
-                "com.sun.star.xml.dom.SAXDocumentBuilder")),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                 uno::UNO_QUERY_THROW);
         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
             GetModel(), uno::UNO_QUERY_THROW);
diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx
index 5c5afb9..1acb47e 100644
--- a/xmloff/source/meta/MetaImportComponent.cxx
+++ b/xmloff/source/meta/MetaImportComponent.cxx
@@ -34,6 +34,8 @@
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/nmspmap.hxx>
 
+#include <com/sun/star/xml/dom/SAXDocumentBuilder.hpp>
+#include <comphelper/componentcontext.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::xmloff::token;
@@ -67,8 +69,7 @@ SvXMLImportContext* XMLMetaImportComponent::CreateContext(
                 "has not been called")), *this);
         }
         uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
-            mxServiceFactory->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
-                    "com.sun.star.xml.dom.SAXDocumentBuilder"))),
+            xml::dom::SAXDocumentBuilder::create(comphelper::ComponentContext(mxServiceFactory).getUNOContext()),
                  uno::UNO_QUERY_THROW);
         return new SvXMLMetaDocumentContext(
                         *this, nPrefix, rLocalName, mxDocProps, xDocBuilder);


More information about the Libreoffice-commits mailing list