LCOV - code coverage report
Current view: top level - forms/source/xforms/xpathlib - extension.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 37 0.0 %
Date: 2014-04-14 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : 
      21             : #include <stdio.h>
      22             : #include <com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp>
      23             : #include <com/sun/star/beans/NamedValue.hpp>
      24             : #include "extension.hxx"
      25             : #include "xpathlib.hxx"
      26             : #include "frm_module.hxx"
      27             : 
      28             : using namespace com::sun::star::uno;
      29             : using namespace com::sun::star::lang;
      30             : using namespace com::sun::star::xforms;
      31             : using namespace com::sun::star::xml::xpath;
      32             : using namespace com::sun::star::beans;
      33             : using com::sun::star::xml::dom::XNode;
      34             : 
      35           0 : Reference< XInterface > SAL_CALL CLibxml2XFormsExtension::Create(
      36             :     const Reference< XMultiServiceFactory >& /*aFactory*/)
      37             : {
      38           0 :     Reference< XInterface > aInstance(static_cast< XXPathExtension* >(new CLibxml2XFormsExtension(/*aFactory*/)));
      39           0 :     return aInstance;
      40             : }
      41             : 
      42           0 : OUString SAL_CALL CLibxml2XFormsExtension::getImplementationName_Static()
      43             : {
      44           0 :     return OUString("com.sun.star.comp.xml.xpath.XFormsExtension");
      45             : }
      46             : 
      47           0 : Sequence< OUString > SAL_CALL CLibxml2XFormsExtension::getSupportedServiceNames_Static()
      48             : {
      49           0 :     Sequence< OUString > aSequence(1);
      50           0 :     aSequence[0] = "com.sun.star.xml.xpath.XPathExtension";
      51           0 :     return aSequence;
      52             : }
      53             : 
      54           0 : Libxml2ExtensionHandle SAL_CALL CLibxml2XFormsExtension::getLibxml2ExtensionHandle() throw (RuntimeException, std::exception)
      55             : {
      56           0 :     Libxml2ExtensionHandle aHandle;
      57           0 :     aHandle.functionLookupFunction = reinterpret_cast< sal_Int64 >( &xforms_lookupFunc );
      58           0 :     aHandle.functionData = reinterpret_cast< sal_Int64 >( this );
      59           0 :     aHandle.variableLookupFunction = (sal_Int64)0;
      60           0 :     aHandle.variableData = (sal_Int64)0;
      61           0 :     return aHandle;
      62             : }
      63             : 
      64           0 : void SAL_CALL CLibxml2XFormsExtension::initialize(const Sequence< Any >& aSequence) throw (RuntimeException, std::exception)
      65             : {
      66           0 :     if (aSequence.getLength() == 2
      67           0 :         && (aSequence[0] >>= m_aModel)
      68           0 :         && (aSequence[1] >>= m_aContextNode))
      69             :     {
      70           0 :         return;
      71             :     }
      72             : 
      73           0 :     NamedValue aValue;
      74           0 :     for (sal_Int32 i = 0; i < aSequence.getLength(); i++)
      75             :     {
      76           0 :         if (! (aSequence[i] >>= aValue))
      77           0 :             throw RuntimeException();
      78           0 :         if ( aValue.Name == "Model" )
      79           0 :             aValue.Value >>= m_aModel;
      80           0 :         else if ( aValue.Name == "ContextNode" )
      81           0 :             aValue.Value >>= m_aContextNode;
      82           0 :     }
      83             : }
      84             : 
      85           0 : Reference< XModel > CLibxml2XFormsExtension::getModel()
      86             : {
      87           0 :     return m_aModel;
      88             : }
      89             : 
      90           0 : Reference< XNode > CLibxml2XFormsExtension::getContextNode()
      91             : {
      92           0 :     return m_aContextNode;
      93             : }
      94             : 
      95           0 : extern "C" void SAL_CALL createRegistryInfo_CLibxml2XFormsExtension()
      96             : {
      97           0 :     static frm::OMultiInstanceAutoRegistration< CLibxml2XFormsExtension >   aRegistration;
      98           0 : }
      99             : 
     100             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10