From a7ecab870eb5567bceb3ef61d87d8db805bc6796 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 30 Jan 2013 13:17:47 +0200 Subject: fdo#46808, convert xml::xpath::XPathExtension service to new-style Change-Id: Ibdfaa221d33ae405c08bc13aa9ed280b30448772 --- forms/source/xforms/computedexpression.cxx | 15 +++------------ forms/source/xforms/xpathlib/extension.cxx | 7 +++++++ 2 files changed, 10 insertions(+), 12 deletions(-) (limited to 'forms') 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 #include #include -#include +#include #include #include #include @@ -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 ComputedExpression::_getXPathAPI(const xforms::EvaluationCo Reference 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++) { -- cgit