Kaydet (Commit) a7ecab87 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, convert xml::xpath::XPathExtension service to new-style

Change-Id: Ibdfaa221d33ae405c08bc13aa9ed280b30448772
üst f53517a5
......@@ -29,7 +29,7 @@
#include <com/sun/star/xml/dom/XNode.hpp>
#include <com/sun/star/xml/xpath/XPathAPI.hpp>
#include <com/sun/star/xml/xpath/XXPathObject.hpp>
#include <com/sun/star/xml/xpath/XXPathExtension.hpp>
#include <com/sun/star/xml/xpath/XPathExtension.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
......@@ -47,6 +47,7 @@ using com::sun::star::xml::dom::XNode;
using com::sun::star::container::XNameContainer;
using com::sun::star::xml::xpath::XPathAPI;
using com::sun::star::xml::xpath::XXPathAPI;
using com::sun::star::xml::xpath::XPathExtension;
using com::sun::star::xml::xpath::XXPathExtension;
using com::sun::star::xml::xpath::XXPathObject;
using com::sun::star::xml::xpath::XPathObjectType_XPATH_UNDEFINED;
......@@ -193,18 +194,8 @@ Reference<XXPathAPI> ComputedExpression::_getXPathAPI(const xforms::EvaluationCo
Reference<XXPathAPI> xXPath( XPathAPI::create( comphelper::getProcessComponentContext() ) );
// register xforms extension#
Sequence< Any > aSequence(2);
NamedValue aValue;
aValue.Name = "Model";
aValue.Value <<= aContext.mxModel;
aSequence[0] <<= aValue;
aValue.Name = "ContextNode";
aValue.Value <<= aContext.mxContextNode;
aSequence[1] <<= aValue;
Reference< XComponentContext > aComponentContext = comphelper::getProcessComponentContext();
Reference< XXPathExtension > aExtension(
aComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.comp.xml.xpath.XFormsExtension", aSequence, aComponentContext),
UNO_QUERY_THROW);
Reference< XXPathExtension > aExtension = XPathExtension::createWithModel(aComponentContext, aContext.mxModel, aContext.mxContextNode);
xXPath->registerExtensionInstance(aExtension);
// register namespaces
......
......@@ -63,6 +63,13 @@ Libxml2ExtensionHandle SAL_CALL CLibxml2XFormsExtension::getLibxml2ExtensionHand
void SAL_CALL CLibxml2XFormsExtension::initialize(const Sequence< Any >& aSequence) throw (RuntimeException)
{
if (aSequence.getLength() == 2
&& (aSequence[0] >>= m_aModel)
&& (aSequence[1] >>= m_aContextNode))
{
return;
}
NamedValue aValue;
for (sal_Int32 i = 0; i < aSequence.getLength(); i++)
{
......
......@@ -370,6 +370,7 @@ $(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/xpath,\
XPathAPI \
XPathExtension \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/xslt,\
XSLTTransformer \
......@@ -1541,9 +1542,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/wra
XMLDocumentWrapper \
XMLElementWrapper \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/xpath,\
XPathExtension \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xsd,\
Boolean \
Date \
......
......@@ -20,14 +20,16 @@
#ifndef __com_sun_star_xml_xpath_XPathExtension_idl__
#define __com_sun_star_xml_xpath_XPathExtension_idl__
#include <com/sun/star/xforms/XModel.idl>
#include <com/sun/star/xml/xpath/XXPathExtension.idl>
#include <com/sun/star/xml/dom/XNode.idl>
module com { module sun { module star { module xml { module xpath {
service XPathExtension
{
interface XXPathExtension;
};
service XPathExtension : XXPathExtension
{
createWithModel([in] com::sun::star::xforms::XModel Model, [in] com::sun::star::xml::dom::XNode ContextNode);
};
};};};};};
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment