diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-23 18:23:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-03 15:55:04 +0200 |
commit | 9b07288138228af56e58f50dc6ba50865b52fdfb (patch) | |
tree | 2bde7ca61824f7266c70a404be6049fba26d8c98 /forms/source | |
parent | eb0e7f62587d957c8d7a86d1c8170e5cd7a7e029 (diff) |
fdo#46808, Adapt xml::dom::DocumentBuilder UNO service to new style
Change-Id: I577fbc7f990be9ec1f7b7eea53218b7daaccb2a1
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/xforms/submission.cxx | 6 | ||||
-rw-r--r-- | forms/source/xforms/submission/replace.cxx | 6 | ||||
-rw-r--r-- | forms/source/xforms/xmlhelper.cxx | 10 |
3 files changed, 10 insertions, 12 deletions
diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx index f834171c8b8f..82a239869cea 100644 --- a/forms/source/xforms/submission.cxx +++ b/forms/source/xforms/submission.cxx @@ -49,7 +49,7 @@ #include <com/sun/star/xml/xpath/XPathObjectType.hpp> #include <com/sun/star/xml/dom/XNodeList.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> -#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +#include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/xml/dom/XDocumentFragment.hpp> #include <com/sun/star/xml/dom/NodeType.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> @@ -58,6 +58,7 @@ #include <com/sun/star/xforms/InvalidDataOnSubmitException.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <cppuhelper/typeprovider.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/propertysetinfo.hxx> #include <comphelper/interaction.hxx> #include <comphelper/processfactory.hxx> @@ -662,8 +663,7 @@ Reference< XDocument > Submission::getInstanceDocument(const Reference< XXPathOb Reference< XDocumentFragment > Submission::createSubmissionDocument(const Reference< XXPathObject >& aObj, sal_Bool bRemoveWSNodes) { using namespace com::sun::star::xml::xpath; - Reference< XDocumentBuilder > aDocBuilder(m_aFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder"))), UNO_QUERY); + Reference< XDocumentBuilder > aDocBuilder(DocumentBuilder::create(comphelper::ComponentContext(m_aFactory).getUNOContext())); Reference< XDocument > aDocument = aDocBuilder->newDocument(); Reference< XDocumentFragment > aFragment = aDocument->createDocumentFragment(); diff --git a/forms/source/xforms/submission/replace.cxx b/forms/source/xforms/submission/replace.cxx index 456bce53a939..9d487cc3c9e9 100644 --- a/forms/source/xforms/submission/replace.cxx +++ b/forms/source/xforms/submission/replace.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/xml/dom/XDocument.hpp> -#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +#include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -58,6 +58,7 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla try { Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("all")) || aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("document"))) { Reference< XComponentLoader > xLoader; @@ -85,8 +86,7 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla } else if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("instance"))) { if (aDocument.is()) { // parse the result stream into a new document - Reference< XDocumentBuilder > xBuilder(xFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder") ) ), UNO_QUERY_THROW); + Reference< XDocumentBuilder > xBuilder(DocumentBuilder::create(xContext)); Reference< XDocument > aNewDocument = xBuilder->parse(m_aResultStream); if (aNewDocument.is()) { diff --git a/forms/source/xforms/xmlhelper.cxx b/forms/source/xforms/xmlhelper.cxx index c3359a307882..025bebf59cc8 100644 --- a/forms/source/xforms/xmlhelper.cxx +++ b/forms/source/xforms/xmlhelper.cxx @@ -23,12 +23,14 @@ #include "unohelper.hxx" #include <rtl/ustring.hxx> #include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +#include <com/sun/star/xml/dom/DocumentBuilder.hpp> +#include <comphelper/processfactory.hxx> using rtl::OUString; using com::sun::star::uno::Reference; using com::sun::star::uno::UNO_QUERY_THROW; using com::sun::star::container::XNameContainer; +using com::sun::star::xml::dom::DocumentBuilder; using com::sun::star::xml::dom::XDocumentBuilder; @@ -128,11 +130,7 @@ bool isValidPrefixName( const OUString& sName, Reference<XDocumentBuilder> getDocumentBuilder() { - Reference<XDocumentBuilder> xBuilder( - xforms::createInstance( - OUSTRING("com.sun.star.xml.dom.DocumentBuilder") ), - UNO_QUERY_THROW ); - OSL_ENSURE( xBuilder.is(), "no document builder?" ); + Reference<XDocumentBuilder> xBuilder(DocumentBuilder::create(::comphelper::getProcessComponentContext())); return xBuilder; } |