Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <stdio.h>
31 : : #include <com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp>
32 : : #include <com/sun/star/beans/NamedValue.hpp>
33 : : #include "extension.hxx"
34 : : #include "xpathlib.hxx"
35 : : #include "frm_module.hxx"
36 : :
37 : : using namespace com::sun::star::uno;
38 : : using namespace com::sun::star::lang;
39 : : using namespace com::sun::star::xforms;
40 : : using namespace com::sun::star::xml::xpath;
41 : : using namespace com::sun::star::beans;
42 : : using com::sun::star::xml::dom::XNode;
43 : :
44 : 0 : Reference< XInterface > SAL_CALL CLibxml2XFormsExtension::Create(
45 : : const Reference< XMultiServiceFactory >& /*aFactory*/)
46 : : {
47 [ # # ][ # # ]: 0 : Reference< XInterface > aInstance(static_cast< XXPathExtension* >(new CLibxml2XFormsExtension(/*aFactory*/)));
[ # # ]
48 : 0 : return aInstance;
49 : : }
50 : :
51 : 60 : ::rtl::OUString SAL_CALL CLibxml2XFormsExtension::getImplementationName_Static()
52 : : {
53 : 60 : return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.xml.xpath.XFormsExtension") );
54 : : }
55 : :
56 : 30 : Sequence< ::rtl::OUString > SAL_CALL CLibxml2XFormsExtension::getSupportedServiceNames_Static()
57 : : {
58 : 30 : Sequence< ::rtl::OUString > aSequence(1);
59 [ + - ][ + - ]: 30 : aSequence[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.xpath.XPathExtension") );
60 : 30 : return aSequence;
61 : : }
62 : :
63 : 0 : Libxml2ExtensionHandle SAL_CALL CLibxml2XFormsExtension::getLibxml2ExtensionHandle() throw (RuntimeException)
64 : : {
65 : 0 : Libxml2ExtensionHandle aHandle;
66 : 0 : aHandle.functionLookupFunction = reinterpret_cast< sal_Int64 >( &xforms_lookupFunc );
67 : 0 : aHandle.functionData = reinterpret_cast< sal_Int64 >( this );
68 : 0 : aHandle.variableLookupFunction = (sal_Int64)0;
69 : 0 : aHandle.variableData = (sal_Int64)0;
70 : 0 : return aHandle;
71 : : }
72 : :
73 : 0 : void SAL_CALL CLibxml2XFormsExtension::initialize(const Sequence< Any >& aSequence) throw (RuntimeException)
74 : : {
75 : 0 : NamedValue aValue;
76 [ # # ]: 0 : for (sal_Int32 i = 0; i < aSequence.getLength(); i++)
77 : : {
78 [ # # ][ # # ]: 0 : if (! (aSequence[i] >>= aValue))
79 [ # # ]: 0 : throw RuntimeException();
80 [ # # ]: 0 : if ( aValue.Name == "Model" )
81 [ # # ]: 0 : aValue.Value >>= m_aModel;
82 [ # # ]: 0 : else if ( aValue.Name == "ContextNode" )
83 [ # # ]: 0 : aValue.Value >>= m_aContextNode;
84 : 0 : }
85 : 0 : }
86 : :
87 : 0 : Reference< XModel > CLibxml2XFormsExtension::getModel()
88 : : {
89 : 0 : return m_aModel;
90 : : }
91 : :
92 : 0 : Reference< XNode > CLibxml2XFormsExtension::getContextNode()
93 : : {
94 : 0 : return m_aContextNode;
95 : : }
96 : :
97 : 30 : extern "C" void SAL_CALL createRegistryInfo_CLibxml2XFormsExtension()
98 : : {
99 [ + - ][ + - ]: 30 : static frm::OMultiInstanceAutoRegistration< CLibxml2XFormsExtension > aRegistration;
[ + - ][ # # ]
100 : 30 : }
101 : :
102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|