summaryrefslogtreecommitdiff
path: root/forms
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 /forms
parentf53517a5b08f9dddd61f5f0aa697222529d15e28 (diff)
fdo#46808, convert xml::xpath::XPathExtension service to new-style
Change-Id: Ibdfaa221d33ae405c08bc13aa9ed280b30448772
Diffstat (limited to 'forms')
-rw-r--r--forms/source/xforms/computedexpression.cxx15
-rw-r--r--forms/source/xforms/xpathlib/extension.cxx7
2 files changed, 10 insertions, 12 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++)
{