1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp>
22 #include <com/sun/star/beans/NamedValue.hpp>
23 #include "extension.hxx"
24 #include "xpathlib.hxx"
25 #include "services.hxx"
27 using namespace com::sun::star::uno
;
28 using namespace com::sun::star::lang
;
29 using namespace com::sun::star::xforms
;
30 using namespace com::sun::star::xml::xpath
;
31 using namespace com::sun::star::beans
;
32 using com::sun::star::xml::dom::XNode
;
34 Libxml2ExtensionHandle SAL_CALL
CLibxml2XFormsExtension::getLibxml2ExtensionHandle() throw (RuntimeException
, std::exception
)
36 Libxml2ExtensionHandle aHandle
;
37 aHandle
.functionLookupFunction
= reinterpret_cast< sal_Int64
>( &xforms_lookupFunc
);
38 aHandle
.functionData
= reinterpret_cast< sal_Int64
>( this );
39 aHandle
.variableLookupFunction
= (sal_Int64
)0;
40 aHandle
.variableData
= (sal_Int64
)0;
44 void SAL_CALL
CLibxml2XFormsExtension::initialize(const Sequence
< Any
>& aSequence
) throw (RuntimeException
, std::exception
)
46 if (aSequence
.getLength() == 2
47 && (aSequence
[0] >>= m_aModel
)
48 && (aSequence
[1] >>= m_aContextNode
))
54 for (sal_Int32 i
= 0; i
< aSequence
.getLength(); i
++)
56 if (! (aSequence
[i
] >>= aValue
))
57 throw RuntimeException();
58 if ( aValue
.Name
== "Model" )
59 aValue
.Value
>>= m_aModel
;
60 else if ( aValue
.Name
== "ContextNode" )
61 aValue
.Value
>>= m_aContextNode
;
66 extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface
* SAL_CALL
67 com_sun_star_comp_xml_xpath_XFormsExtension_get_implementation(::com::sun::star::uno::XComponentContext
*,
68 ::com::sun::star::uno::Sequence
<css::uno::Any
> const &)
70 return cppu::acquire(new CLibxml2XFormsExtension());
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */