summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-06 14:00:14 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-12 10:24:55 +0200
commit372f9801687cad620924b7ac6e4fe488ff998334 (patch)
tree2f439042ac40dd775c52427da5acdd7f0fcde595
parenta5036f396aadb44e44844ad2c784ee521eeda55a (diff)
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
-rw-r--r--offapi/UnoApi_offapi.mk5
-rw-r--r--offapi/com/sun/star/xml/dom/SAXDocumentBuilder.idl13
-rw-r--r--offapi/com/sun/star/xml/dom/XSAXDocumentBuilder2.idl41
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx7
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx8
-rw-r--r--starmath/source/mathmlimport.cxx5
-rw-r--r--sw/source/filter/xml/xmlimp.cxx16
-rw-r--r--sw/source/filter/xml/xmlmeta.cxx5
-rw-r--r--unoxml/source/dom/saxbuilder.hxx7
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx6
-rw-r--r--xmloff/source/draw/sdxmlimp.cxx8
-rw-r--r--xmloff/source/meta/MetaImportComponent.cxx5
12 files changed, 85 insertions, 41 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 20eafe067baa..17b3711cf29c 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 7e25bce146b3..b8c4146e6175 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 000000000000..9463176f498f
--- /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 00e76c32c952..8b941251523e 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 0de87a254df3..3df0818c5de4 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 0d38ec51db5e..d5343770d83e 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 bf1c1c32eefb..15e0f9846e6a 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 0b80ece87fed..58b472fbc61d 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 f9a41f4b4e64..9945548cf998 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 f7ef9a7fe5fb..b3cd44db2240 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 a0fbcd18bac7..d581d8a121f7 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 5c5afb91ac81..1acb47ea63c2 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);