fdo#46808, Adapt xml::dom::DocumentBuilder UNO service to new style
Change-Id: I577fbc7f990be9ec1f7b7eea53218b7daaccb2a1
This commit is contained in:
committed by
Stephan Bergmann
parent
eb0e7f6258
commit
9b07288138
@@ -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();
|
||||
|
||||
|
@@ -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()) {
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user