summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-01-30 13:17:47 +0200
committerNoel Grandin <noel@peralex.com>2013-02-11 08:02:14 +0200
commita7ecab870eb5567bceb3ef61d87d8db805bc6796 (patch)
tree98debe6da4ea8ac156e59035df13193e8e665149
parentf53517a5b08f9dddd61f5f0aa697222529d15e28 (diff)
fdo#46808, convert xml::xpath::XPathExtension service to new-style
Change-Id: Ibdfaa221d33ae405c08bc13aa9ed280b30448772
-rw-r--r--forms/source/xforms/computedexpression.cxx15
-rw-r--r--forms/source/xforms/xpathlib/extension.cxx7
-rw-r--r--offapi/UnoApi_offapi.mk4
-rw-r--r--offapi/com/sun/star/xml/xpath/XPathExtension.idl10
4 files changed, 17 insertions, 19 deletions
diff --git a/forms/source/xforms/computedexpression.cxx b/forms/source/xforms/computedexpression.cxx
index 9580d7ce958a..004521e72b93 100644
--- a/forms/source/xforms/computedexpression.cxx
+++ b/forms/source/xforms/computedexpression.cxx
@@ -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
diff --git a/forms/source/xforms/xpathlib/extension.cxx b/forms/source/xforms/xpathlib/extension.cxx
index df31e517c153..5e567f78c1fd 100644
--- a/forms/source/xforms/xpathlib/extension.cxx
+++ b/forms/source/xforms/xpathlib/extension.cxx
@@ -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++)
{
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 68cd560af255..1ef0fec977ae 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -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 \
diff --git a/offapi/com/sun/star/xml/xpath/XPathExtension.idl b/offapi/com/sun/star/xml/xpath/XPathExtension.idl
index f96d07421222..23b95e48ce5e 100644
--- a/offapi/com/sun/star/xml/xpath/XPathExtension.idl
+++ b/offapi/com/sun/star/xml/xpath/XPathExtension.idl
@@ -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