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
@@ -47,7 +47,7 @@
|
|||||||
#include "com/sun/star/xml/dom/DOMException.hpp"
|
#include "com/sun/star/xml/dom/DOMException.hpp"
|
||||||
#include "com/sun/star/xml/dom/XNode.hpp"
|
#include "com/sun/star/xml/dom/XNode.hpp"
|
||||||
#include "com/sun/star/xml/dom/XNodeList.hpp"
|
#include "com/sun/star/xml/dom/XNodeList.hpp"
|
||||||
#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
|
#include "com/sun/star/xml/dom/DocumentBuilder.hpp"
|
||||||
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
||||||
#include "com/sun/star/ucb/InteractiveIOException.hpp"
|
#include "com/sun/star/ucb/InteractiveIOException.hpp"
|
||||||
#include "cppuhelper/implbase1.hxx"
|
#include "cppuhelper/implbase1.hxx"
|
||||||
@@ -224,11 +224,7 @@ ExtensionDescription::ExtensionDescription(
|
|||||||
|
|
||||||
//get root node of description.xml
|
//get root node of description.xml
|
||||||
Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
|
Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
|
||||||
xContext->getServiceManager()->createInstanceWithContext(
|
css::xml::dom::DocumentBuilder::create(xContext) );
|
||||||
OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
|
|
||||||
xContext ), css::uno::UNO_QUERY);
|
|
||||||
if (!xDocBuilder.is())
|
|
||||||
throw css::uno::Exception(OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
|
|
||||||
|
|
||||||
if (xDocBuilder->isNamespaceAware() == sal_False)
|
if (xDocBuilder->isNamespaceAware() == sal_False)
|
||||||
{
|
{
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include "cppuhelper/exc_hlp.hxx"
|
#include "cppuhelper/exc_hlp.hxx"
|
||||||
#include "osl/file.hxx"
|
#include "osl/file.hxx"
|
||||||
#include "com/sun/star/uno/XComponentContext.hpp"
|
#include "com/sun/star/uno/XComponentContext.hpp"
|
||||||
#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
|
#include "com/sun/star/xml/dom/DocumentBuilder.hpp"
|
||||||
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
||||||
#include "com/sun/star/io/XActiveDataSource.hpp"
|
#include "com/sun/star/io/XActiveDataSource.hpp"
|
||||||
#include "com/sun/star/io/XActiveDataControl.hpp"
|
#include "com/sun/star/io/XActiveDataControl.hpp"
|
||||||
@@ -79,12 +79,7 @@ css::uno::Reference<css::xml::dom::XDocument> BackendDb::getDocument()
|
|||||||
if (!m_doc.is())
|
if (!m_doc.is())
|
||||||
{
|
{
|
||||||
const Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
|
const Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
|
||||||
m_xContext->getServiceManager()->createInstanceWithContext(
|
css::xml::dom::DocumentBuilder::create(m_xContext) );
|
||||||
OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
|
|
||||||
m_xContext ), css::uno::UNO_QUERY);
|
|
||||||
if (!xDocBuilder.is())
|
|
||||||
throw css::uno::RuntimeException(
|
|
||||||
OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
|
|
||||||
|
|
||||||
::osl::DirectoryItem item;
|
::osl::DirectoryItem item;
|
||||||
::osl::File::RC err = ::osl::DirectoryItem::get(m_urlDb, item);
|
::osl::File::RC err = ::osl::DirectoryItem::get(m_urlDb, item);
|
||||||
|
@@ -46,6 +46,7 @@
|
|||||||
#include <com/sun/star/ucb/NameClash.hpp>
|
#include <com/sun/star/ucb/NameClash.hpp>
|
||||||
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
|
||||||
#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
|
#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
|
||||||
|
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
|
||||||
#include <com/sun/star/beans/NamedValue.hpp>
|
#include <com/sun/star/beans/NamedValue.hpp>
|
||||||
#include <com/sun/star/deployment/ExtensionManager.hpp>
|
#include <com/sun/star/deployment/ExtensionManager.hpp>
|
||||||
|
|
||||||
@@ -211,10 +212,7 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript
|
|||||||
{
|
{
|
||||||
if ( !m_xDocBuilder.is() )
|
if ( !m_xDocBuilder.is() )
|
||||||
{
|
{
|
||||||
m_xDocBuilder = uno::Reference< xml::dom::XDocumentBuilder >(
|
m_xDocBuilder = uno::Reference< xml::dom::XDocumentBuilder >( xml::dom::DocumentBuilder::create(m_ctx) );
|
||||||
m_ctx->getServiceManager()->createInstanceWithContext(
|
|
||||||
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder")),
|
|
||||||
m_ctx ), uno::UNO_QUERY );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_xSimpleFileAccess.is() )
|
if ( !m_xSimpleFileAccess.is() )
|
||||||
@@ -223,94 +221,91 @@ bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescript
|
|||||||
}
|
}
|
||||||
|
|
||||||
::rtl::OUString aExtIdentifier;
|
::rtl::OUString aExtIdentifier;
|
||||||
if ( m_xDocBuilder.is() && m_xSimpleFileAccess.is() )
|
try
|
||||||
{
|
{
|
||||||
try
|
uno::Reference< io::XInputStream > xIn =
|
||||||
|
m_xSimpleFileAccess->openFileRead( sDescriptionXmlURL );
|
||||||
|
|
||||||
|
if ( xIn.is() )
|
||||||
{
|
{
|
||||||
uno::Reference< io::XInputStream > xIn =
|
uno::Reference< xml::dom::XDocument > xDoc = m_xDocBuilder->parse( xIn );
|
||||||
m_xSimpleFileAccess->openFileRead( sDescriptionXmlURL );
|
if ( xDoc.is() )
|
||||||
|
|
||||||
if ( xIn.is() )
|
|
||||||
{
|
{
|
||||||
uno::Reference< xml::dom::XDocument > xDoc = m_xDocBuilder->parse( xIn );
|
uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement();
|
||||||
if ( xDoc.is() )
|
if ( xRoot.is() && xRoot->getTagName() == "description" )
|
||||||
{
|
{
|
||||||
uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement();
|
uno::Reference< xml::xpath::XXPathAPI > xPath(
|
||||||
if ( xRoot.is() && xRoot->getTagName() == "description" )
|
m_ctx->getServiceManager()->createInstanceWithContext(
|
||||||
|
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.xpath.XPathAPI")),
|
||||||
|
m_ctx),
|
||||||
|
uno::UNO_QUERY);
|
||||||
|
|
||||||
|
xPath->registerNS(
|
||||||
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")),
|
||||||
|
xRoot->getNamespaceURI());
|
||||||
|
xPath->registerNS(
|
||||||
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")),
|
||||||
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.w3.org/1999/xlink")));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY );
|
||||||
|
uno::Reference< xml::dom::XNode > xNode(
|
||||||
|
xPath->selectSingleNode(
|
||||||
|
xRootNode,
|
||||||
|
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc:identifier/@value")) ));
|
||||||
|
if ( xNode.is() )
|
||||||
|
aExtIdentifier = xNode->getNodeValue();
|
||||||
|
}
|
||||||
|
catch ( const xml::xpath::XPathException& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch ( const xml::dom::DOMException& )
|
||||||
{
|
{
|
||||||
uno::Reference< xml::xpath::XXPathAPI > xPath(
|
|
||||||
m_ctx->getServiceManager()->createInstanceWithContext(
|
|
||||||
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.xpath.XPathAPI")),
|
|
||||||
m_ctx),
|
|
||||||
uno::UNO_QUERY);
|
|
||||||
|
|
||||||
xPath->registerNS(
|
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")),
|
|
||||||
xRoot->getNamespaceURI());
|
|
||||||
xPath->registerNS(
|
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")),
|
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.w3.org/1999/xlink")));
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY );
|
|
||||||
uno::Reference< xml::dom::XNode > xNode(
|
|
||||||
xPath->selectSingleNode(
|
|
||||||
xRootNode,
|
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc:identifier/@value")) ));
|
|
||||||
if ( xNode.is() )
|
|
||||||
aExtIdentifier = xNode->getNodeValue();
|
|
||||||
}
|
|
||||||
catch ( const xml::xpath::XPathException& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch ( const xml::dom::DOMException& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !aExtIdentifier.isEmpty() )
|
|
||||||
{
|
|
||||||
// scan extension identifier and try to match with our black list entries
|
|
||||||
for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ )
|
|
||||||
{
|
|
||||||
utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP);
|
|
||||||
utl::TextSearch ts(param, LANGUAGE_DONTKNOW);
|
|
||||||
|
|
||||||
xub_StrLen start = 0;
|
|
||||||
xub_StrLen end = static_cast<sal_uInt16>(aExtIdentifier.getLength());
|
|
||||||
if (ts.SearchFrwrd(aExtIdentifier, &start, &end))
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch ( const ucb::CommandAbortedException& )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
catch ( const uno::RuntimeException& )
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aExtIdentifier.isEmpty() )
|
if ( !aExtIdentifier.isEmpty() )
|
||||||
{
|
{
|
||||||
// Fallback:
|
// scan extension identifier and try to match with our black list entries
|
||||||
// Try to use the folder name to match our black list
|
|
||||||
// as some extensions don't provide an identifier in the
|
|
||||||
// description.xml!
|
|
||||||
for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ )
|
for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ )
|
||||||
{
|
{
|
||||||
utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP);
|
utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP);
|
||||||
utl::TextSearch ts(param, LANGUAGE_DONTKNOW);
|
utl::TextSearch ts(param, LANGUAGE_DONTKNOW);
|
||||||
|
|
||||||
xub_StrLen start = 0;
|
xub_StrLen start = 0;
|
||||||
xub_StrLen end = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength());
|
xub_StrLen end = static_cast<sal_uInt16>(aExtIdentifier.getLength());
|
||||||
if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end))
|
if (ts.SearchFrwrd(aExtIdentifier, &start, &end))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch ( const ucb::CommandAbortedException& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch ( const uno::RuntimeException& )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( aExtIdentifier.isEmpty() )
|
||||||
|
{
|
||||||
|
// Fallback:
|
||||||
|
// Try to use the folder name to match our black list
|
||||||
|
// as some extensions don't provide an identifier in the
|
||||||
|
// description.xml!
|
||||||
|
for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ )
|
||||||
|
{
|
||||||
|
utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP);
|
||||||
|
utl::TextSearch ts(param, LANGUAGE_DONTKNOW);
|
||||||
|
|
||||||
|
xub_StrLen start = 0;
|
||||||
|
xub_StrLen end = static_cast<sal_uInt16>(sDescriptionXmlURL.getLength());
|
||||||
|
if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@
|
|||||||
#include <com/sun/star/ucb/OpenMode.hpp>
|
#include <com/sun/star/ucb/OpenMode.hpp>
|
||||||
#include <com/sun/star/sdbc/XRow.hpp>
|
#include <com/sun/star/sdbc/XRow.hpp>
|
||||||
#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp>
|
#include <com/sun/star/task/PasswordContainerInteractionHandler.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
|
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
|
||||||
#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
|
#include <com/sun/star/xml/xpath/XXPathAPI.hpp>
|
||||||
|
|
||||||
#include <rtl/ref.hxx>
|
#include <rtl/ref.hxx>
|
||||||
@@ -416,8 +416,7 @@ UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentCo
|
|||||||
uno::Reference< ucb::XContentProvider > xContentProvider(xContentIdFactory, uno::UNO_QUERY_THROW);
|
uno::Reference< ucb::XContentProvider > xContentProvider(xContentIdFactory, uno::UNO_QUERY_THROW);
|
||||||
|
|
||||||
uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
|
uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
|
||||||
xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.dom.DocumentBuilder" ), xContext ),
|
xml::dom::DocumentBuilder::create(xContext));
|
||||||
uno::UNO_QUERY_THROW);
|
|
||||||
|
|
||||||
uno::Reference< xml::xpath::XXPathAPI > xXPath(
|
uno::Reference< xml::xpath::XXPathAPI > xXPath(
|
||||||
xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), xContext ),
|
xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.xml.xpath.XPathAPI" ), xContext ),
|
||||||
|
@@ -46,9 +46,10 @@
|
|||||||
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
#include <basegfx/polygon/b2dpolypolygontools.hxx>
|
||||||
#include <com/sun/star/io/XSeekable.hpp>
|
#include <com/sun/star/io/XSeekable.hpp>
|
||||||
#include <com/sun/star/xml/sax/XParser.hpp>
|
#include <com/sun/star/xml/sax/XParser.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
|
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
|
||||||
#include <com/sun/star/xml/dom/NodeType.hpp>
|
#include <com/sun/star/xml/dom/NodeType.hpp>
|
||||||
|
|
||||||
|
#include <comphelper/componentcontext.hxx>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
|
#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
|
||||||
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
|
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
|
||||||
@@ -1903,8 +1904,7 @@ SVGReader::SVGReader(const uno::Reference<lang::XMultiServiceFactory>& xServ
|
|||||||
|
|
||||||
sal_Bool SVGReader::parseAndConvert()
|
sal_Bool SVGReader::parseAndConvert()
|
||||||
{
|
{
|
||||||
uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(
|
uno::Reference<xml::dom::XDocumentBuilder> xDomBuilder(xml::dom::DocumentBuilder::create(comphelper::ComponentContext(m_xServiceFactory).getUNOContext()));
|
||||||
m_xServiceFactory->createInstance( "com.sun.star.xml.dom.DocumentBuilder" ), uno::UNO_QUERY_THROW );
|
|
||||||
|
|
||||||
uno::Reference<xml::dom::XDocument> xDom(
|
uno::Reference<xml::dom::XDocument> xDom(
|
||||||
xDomBuilder->parse(m_xInputStream),
|
xDomBuilder->parse(m_xInputStream),
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
#include <com/sun/star/xml/xpath/XPathObjectType.hpp>
|
#include <com/sun/star/xml/xpath/XPathObjectType.hpp>
|
||||||
#include <com/sun/star/xml/dom/XNodeList.hpp>
|
#include <com/sun/star/xml/dom/XNodeList.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocument.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/XDocumentFragment.hpp>
|
||||||
#include <com/sun/star/xml/dom/NodeType.hpp>
|
#include <com/sun/star/xml/dom/NodeType.hpp>
|
||||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
#include <com/sun/star/xforms/InvalidDataOnSubmitException.hpp>
|
#include <com/sun/star/xforms/InvalidDataOnSubmitException.hpp>
|
||||||
#include <com/sun/star/frame/XFrame.hpp>
|
#include <com/sun/star/frame/XFrame.hpp>
|
||||||
#include <cppuhelper/typeprovider.hxx>
|
#include <cppuhelper/typeprovider.hxx>
|
||||||
|
#include <comphelper/componentcontext.hxx>
|
||||||
#include <comphelper/propertysetinfo.hxx>
|
#include <comphelper/propertysetinfo.hxx>
|
||||||
#include <comphelper/interaction.hxx>
|
#include <comphelper/interaction.hxx>
|
||||||
#include <comphelper/processfactory.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)
|
Reference< XDocumentFragment > Submission::createSubmissionDocument(const Reference< XXPathObject >& aObj, sal_Bool bRemoveWSNodes)
|
||||||
{
|
{
|
||||||
using namespace com::sun::star::xml::xpath;
|
using namespace com::sun::star::xml::xpath;
|
||||||
Reference< XDocumentBuilder > aDocBuilder(m_aFactory->createInstance(
|
Reference< XDocumentBuilder > aDocBuilder(DocumentBuilder::create(comphelper::ComponentContext(m_aFactory).getUNOContext()));
|
||||||
OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder"))), UNO_QUERY);
|
|
||||||
Reference< XDocument > aDocument = aDocBuilder->newDocument();
|
Reference< XDocument > aDocument = aDocBuilder->newDocument();
|
||||||
Reference< XDocumentFragment > aFragment = aDocument->createDocumentFragment();
|
Reference< XDocumentFragment > aFragment = aDocument->createDocumentFragment();
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#include <com/sun/star/uno/Reference.hxx>
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocument.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/XComponentLoader.hpp>
|
||||||
#include <com/sun/star/frame/FrameSearchFlag.hpp>
|
#include <com/sun/star/frame/FrameSearchFlag.hpp>
|
||||||
#include <com/sun/star/beans/PropertyValue.hpp>
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
||||||
@@ -58,6 +58,7 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
|
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
|
||||||
|
Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
|
||||||
if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("all"))
|
if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("all"))
|
||||||
|| aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("document"))) {
|
|| aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("document"))) {
|
||||||
Reference< XComponentLoader > xLoader;
|
Reference< XComponentLoader > xLoader;
|
||||||
@@ -85,8 +86,7 @@ CSubmission::SubmissionResult CSubmission::replace(const ::rtl::OUString& aRepla
|
|||||||
} else if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("instance"))) {
|
} else if (aReplace.equalsIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM("instance"))) {
|
||||||
if (aDocument.is()) {
|
if (aDocument.is()) {
|
||||||
// parse the result stream into a new document
|
// parse the result stream into a new document
|
||||||
Reference< XDocumentBuilder > xBuilder(xFactory->createInstance(
|
Reference< XDocumentBuilder > xBuilder(DocumentBuilder::create(xContext));
|
||||||
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder") ) ), UNO_QUERY_THROW);
|
|
||||||
Reference< XDocument > aNewDocument = xBuilder->parse(m_aResultStream);
|
Reference< XDocument > aNewDocument = xBuilder->parse(m_aResultStream);
|
||||||
|
|
||||||
if (aNewDocument.is()) {
|
if (aNewDocument.is()) {
|
||||||
|
@@ -23,12 +23,14 @@
|
|||||||
#include "unohelper.hxx"
|
#include "unohelper.hxx"
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <com/sun/star/uno/Reference.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 rtl::OUString;
|
||||||
using com::sun::star::uno::Reference;
|
using com::sun::star::uno::Reference;
|
||||||
using com::sun::star::uno::UNO_QUERY_THROW;
|
using com::sun::star::uno::UNO_QUERY_THROW;
|
||||||
using com::sun::star::container::XNameContainer;
|
using com::sun::star::container::XNameContainer;
|
||||||
|
using com::sun::star::xml::dom::DocumentBuilder;
|
||||||
using com::sun::star::xml::dom::XDocumentBuilder;
|
using com::sun::star::xml::dom::XDocumentBuilder;
|
||||||
|
|
||||||
|
|
||||||
@@ -128,11 +130,7 @@ bool isValidPrefixName( const OUString& sName,
|
|||||||
|
|
||||||
Reference<XDocumentBuilder> getDocumentBuilder()
|
Reference<XDocumentBuilder> getDocumentBuilder()
|
||||||
{
|
{
|
||||||
Reference<XDocumentBuilder> xBuilder(
|
Reference<XDocumentBuilder> xBuilder(DocumentBuilder::create(::comphelper::getProcessComponentContext()));
|
||||||
xforms::createInstance(
|
|
||||||
OUSTRING("com.sun.star.xml.dom.DocumentBuilder") ),
|
|
||||||
UNO_QUERY_THROW );
|
|
||||||
OSL_ENSURE( xBuilder.is(), "no document builder?" );
|
|
||||||
return xBuilder;
|
return xBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -290,6 +290,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
|
|||||||
UriAbbreviation \
|
UriAbbreviation \
|
||||||
URLTransformer \
|
URLTransformer \
|
||||||
))
|
))
|
||||||
|
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/dom,\
|
||||||
|
DocumentBuilder \
|
||||||
|
))
|
||||||
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\
|
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/sax,\
|
||||||
FastShapeContextHandler \
|
FastShapeContextHandler \
|
||||||
FastTokenHandler \
|
FastTokenHandler \
|
||||||
@@ -1528,7 +1531,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/cry
|
|||||||
))
|
))
|
||||||
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/dom,\
|
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/dom,\
|
||||||
SAXDocumentBuilder \
|
SAXDocumentBuilder \
|
||||||
DocumentBuilder \
|
|
||||||
))
|
))
|
||||||
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/input,\
|
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/input,\
|
||||||
SaxDocumentHandler \
|
SaxDocumentHandler \
|
||||||
|
@@ -1,14 +1,16 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
|
||||||
#ifndef __com_sun_star_xml_dom_documentbuilder_idl
|
#ifndef __com_sun_star_xml_dom_documentbuilder_idl
|
||||||
#define __com_sun_star_xml_dom_documentbuilder_idl
|
#define __com_sun_star_xml_dom_documentbuilder_idl
|
||||||
|
|
||||||
#include <com/sun/star/xml/dom/XDocumentBuilder.idl>
|
#include <com/sun/star/xml/dom/XDocumentBuilder.idl>
|
||||||
|
|
||||||
module com { module sun { module star { module xml { module dom {
|
module com { module sun { module star { module xml { module dom {
|
||||||
|
|
||||||
service DocumentBuilder
|
service DocumentBuilder : XDocumentBuilder;
|
||||||
{
|
|
||||||
interface XDocumentBuilder;
|
|
||||||
};
|
|
||||||
};};};};};
|
};};};};};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -43,7 +43,7 @@
|
|||||||
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
|
||||||
#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
|
#include <com/sun/star/document/XOOXMLDocumentPropertiesImporter.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocument.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/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <comphelper/processfactory.hxx>
|
#include <comphelper/processfactory.hxx>
|
||||||
#include <comphelper/mediadescriptor.hxx>
|
#include <comphelper/mediadescriptor.hxx>
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
using ::com::sun::star::uno::XComponentContext;
|
using ::com::sun::star::uno::XComponentContext;
|
||||||
using ::com::sun::star::document::XOOXMLDocumentPropertiesImporter;
|
using ::com::sun::star::document::XOOXMLDocumentPropertiesImporter;
|
||||||
using ::com::sun::star::document::XDocumentPropertiesSupplier;
|
using ::com::sun::star::document::XDocumentPropertiesSupplier;
|
||||||
|
using ::com::sun::star::xml::dom::DocumentBuilder;
|
||||||
using ::com::sun::star::xml::dom::XDocument;
|
using ::com::sun::star::xml::dom::XDocument;
|
||||||
using ::com::sun::star::xml::dom::XDocumentBuilder;
|
using ::com::sun::star::xml::dom::XDocumentBuilder;
|
||||||
using ::com::sun::star::xml::sax::XFastSAXSerializable;
|
using ::com::sun::star::xml::sax::XFastSAXSerializable;
|
||||||
@@ -357,11 +358,7 @@ Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFrag
|
|||||||
// create the dom parser
|
// create the dom parser
|
||||||
Reference< XComponentContext > xContext =
|
Reference< XComponentContext > xContext =
|
||||||
lcl_getComponentContext(getServiceFactory());
|
lcl_getComponentContext(getServiceFactory());
|
||||||
Reference<XDocumentBuilder> xDomBuilder(
|
Reference<XDocumentBuilder> xDomBuilder( DocumentBuilder::create(xContext) );
|
||||||
xContext->getServiceManager()->createInstanceWithContext(
|
|
||||||
::rtl::OUString("com.sun.star.xml.dom.DocumentBuilder" ),
|
|
||||||
xContext),
|
|
||||||
UNO_QUERY_THROW );
|
|
||||||
|
|
||||||
// create DOM from fragment
|
// create DOM from fragment
|
||||||
xRet = xDomBuilder->parse(xInStrm);
|
xRet = xDomBuilder->parse(xInStrm);
|
||||||
|
@@ -47,7 +47,7 @@
|
|||||||
#include "com/sun/star/xml/sax/XParser.hpp"
|
#include "com/sun/star/xml/sax/XParser.hpp"
|
||||||
#include "com/sun/star/xml/dom/XDocument.hpp"
|
#include "com/sun/star/xml/dom/XDocument.hpp"
|
||||||
#include "com/sun/star/xml/dom/XElement.hpp"
|
#include "com/sun/star/xml/dom/XElement.hpp"
|
||||||
#include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
|
#include "com/sun/star/xml/dom/DocumentBuilder.hpp"
|
||||||
#include "com/sun/star/xml/dom/XSAXDocumentBuilder.hpp"
|
#include "com/sun/star/xml/dom/XSAXDocumentBuilder.hpp"
|
||||||
#include "com/sun/star/xml/dom/NodeType.hpp"
|
#include "com/sun/star/xml/dom/NodeType.hpp"
|
||||||
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
#include "com/sun/star/xml/xpath/XXPathAPI.hpp"
|
||||||
@@ -1116,18 +1116,9 @@ void SAL_CALL SfxDocumentMetaData::updateUserDefinedAndAttributes()
|
|||||||
css::uno::Reference<css::xml::dom::XDocument> SAL_CALL
|
css::uno::Reference<css::xml::dom::XDocument> SAL_CALL
|
||||||
SfxDocumentMetaData::createDOM() const // throw (css::uno::RuntimeException)
|
SfxDocumentMetaData::createDOM() const // throw (css::uno::RuntimeException)
|
||||||
{
|
{
|
||||||
css::uno::Reference<css::lang::XMultiComponentFactory> xMsf (
|
css::uno::Reference<css::lang::XMultiComponentFactory> xMsf ( m_xContext->getServiceManager());
|
||||||
m_xContext->getServiceManager());
|
css::uno::Reference<css::xml::dom::XDocumentBuilder> xBuilder( css::xml::dom::DocumentBuilder::create(m_xContext) );
|
||||||
css::uno::Reference<css::xml::dom::XDocumentBuilder> xBuilder(
|
css::uno::Reference<css::xml::dom::XDocument> xDoc = xBuilder->newDocument();
|
||||||
xMsf->createInstanceWithContext(::rtl::OUString(
|
|
||||||
"com.sun.star.xml.dom.DocumentBuilder"), m_xContext),
|
|
||||||
css::uno::UNO_QUERY_THROW );
|
|
||||||
if (!xBuilder.is()) throw css::uno::RuntimeException(
|
|
||||||
::rtl::OUString("SfxDocumentMetaData::createDOM: "
|
|
||||||
"cannot create DocumentBuilder service"),
|
|
||||||
*const_cast<SfxDocumentMetaData*>(this));
|
|
||||||
css::uno::Reference<css::xml::dom::XDocument> xDoc =
|
|
||||||
xBuilder->newDocument();
|
|
||||||
if (!xDoc.is()) throw css::uno::RuntimeException(
|
if (!xDoc.is()) throw css::uno::RuntimeException(
|
||||||
::rtl::OUString("SfxDocumentMetaData::createDOM: "
|
::rtl::OUString("SfxDocumentMetaData::createDOM: "
|
||||||
"cannot create new document"),
|
"cannot create new document"),
|
||||||
|
@@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
#include "saxbuilder.hxx"
|
#include "saxbuilder.hxx"
|
||||||
|
|
||||||
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
|
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
|
||||||
|
#include <comphelper/componentcontext.hxx>
|
||||||
|
|
||||||
|
|
||||||
namespace DOM
|
namespace DOM
|
||||||
@@ -166,8 +167,7 @@ namespace DOM
|
|||||||
if (!m_aState == SAXDocumentBuilderState_READY)
|
if (!m_aState == SAXDocumentBuilderState_READY)
|
||||||
throw SAXException();
|
throw SAXException();
|
||||||
|
|
||||||
Reference< XDocumentBuilder > aBuilder(m_aServiceManager->createInstance(
|
Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(comphelper::ComponentContext(m_aServiceManager).getUNOContext()));
|
||||||
"com.sun.star.xml.dom.DocumentBuilder"), UNO_QUERY_THROW);
|
|
||||||
Reference< XDocument > aDocument = aBuilder->newDocument();
|
Reference< XDocument > aDocument = aBuilder->newDocument();
|
||||||
m_aNodeStack.push(Reference< XNode >(aDocument, UNO_QUERY));
|
m_aNodeStack.push(Reference< XNode >(aDocument, UNO_QUERY));
|
||||||
m_aDocument = aDocument;
|
m_aDocument = aDocument;
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
#include <com/sun/star/uno/Reference.hxx>
|
#include <com/sun/star/uno/Reference.hxx>
|
||||||
#include <com/sun/star/uno/Sequence.hxx>
|
#include <com/sun/star/uno/Sequence.hxx>
|
||||||
#include <com/sun/star/xml/dom/XAttr.hpp>
|
#include <com/sun/star/xml/dom/XAttr.hpp>
|
||||||
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
|
#include <com/sun/star/xml/dom/DocumentBuilder.hpp>
|
||||||
#include <com/sun/star/xml/dom/XNode.hpp>
|
#include <com/sun/star/xml/dom/XNode.hpp>
|
||||||
#include <com/sun/star/xml/dom/XElement.hpp>
|
#include <com/sun/star/xml/dom/XElement.hpp>
|
||||||
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
||||||
@@ -50,10 +50,12 @@
|
|||||||
|
|
||||||
|
|
||||||
using com::sun::star::lang::XMultiServiceFactory;
|
using com::sun::star::lang::XMultiServiceFactory;
|
||||||
|
using com::sun::star::uno::XComponentContext;
|
||||||
using com::sun::star::uno::Reference;
|
using com::sun::star::uno::Reference;
|
||||||
using com::sun::star::uno::Sequence;
|
using com::sun::star::uno::Sequence;
|
||||||
using com::sun::star::uno::UNO_QUERY;
|
using com::sun::star::uno::UNO_QUERY;
|
||||||
using com::sun::star::uno::UNO_QUERY_THROW;
|
using com::sun::star::uno::UNO_QUERY_THROW;
|
||||||
|
using com::sun::star::xml::dom::DocumentBuilder;
|
||||||
using com::sun::star::xml::dom::XAttr;
|
using com::sun::star::xml::dom::XAttr;
|
||||||
using com::sun::star::xml::dom::XDocument;
|
using com::sun::star::xml::dom::XDocument;
|
||||||
using com::sun::star::xml::dom::XDocumentBuilder;
|
using com::sun::star::xml::dom::XDocumentBuilder;
|
||||||
@@ -191,17 +193,12 @@ void DomBuilderContext::Characters( const OUString& rCharacters )
|
|||||||
// helper function implementations
|
// helper function implementations
|
||||||
//
|
//
|
||||||
|
|
||||||
const sal_Char sDocumentBuilder[] = "com.sun.star.xml.dom.DocumentBuilder";
|
|
||||||
|
|
||||||
Reference<XNode> lcl_createDomInstance()
|
Reference<XNode> lcl_createDomInstance()
|
||||||
{
|
{
|
||||||
Reference<XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
|
Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
|
||||||
DBG_ASSERT( xFactory.is(), "can't get service factory" );
|
DBG_ASSERT( xContext.is(), "can't get service factory" );
|
||||||
|
|
||||||
Reference<XDocumentBuilder> xBuilder(
|
Reference<XDocumentBuilder> xBuilder( DocumentBuilder::create(xContext) );
|
||||||
xFactory->createInstance(
|
|
||||||
OUString( RTL_CONSTASCII_USTRINGPARAM( sDocumentBuilder ) ) ),
|
|
||||||
UNO_QUERY_THROW );
|
|
||||||
|
|
||||||
return Reference<XNode>( xBuilder->newDocument(), UNO_QUERY_THROW );
|
return Reference<XNode>( xBuilder->newDocument(), UNO_QUERY_THROW );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user