LCOV - code coverage report
Current view: top level - formula/source/core/api - FormulaOpCodeMapperObj.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 25 33 75.8 %
Date: 2015-06-13 12:38:46 Functions: 11 13 84.6 %
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             : #include <sal/config.h>
      21             : 
      22             : #include <utility>
      23             : 
      24             : #include "formula/FormulaOpCodeMapperObj.hxx"
      25             : #include "formula/opcode.hxx"
      26             : #include <comphelper/sequence.hxx>
      27             : #include <cppuhelper/supportsservice.hxx>
      28             : 
      29             : namespace formula
      30             : {
      31             :     using namespace ::com::sun::star;
      32             : 
      33           0 : sal_Bool SAL_CALL FormulaOpCodeMapperObj::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException, std::exception)
      34             : {
      35           0 :     return cppu::supportsService(this, _rServiceName);
      36             : }
      37             : 
      38         471 : FormulaOpCodeMapperObj::FormulaOpCodeMapperObj(::std::unique_ptr<FormulaCompiler> && _pCompiler)
      39         471 : : m_pCompiler(std::move(_pCompiler))
      40             : {
      41         471 : }
      42             : 
      43         472 : FormulaOpCodeMapperObj::~FormulaOpCodeMapperObj()
      44             : {
      45         472 : }
      46             : 
      47         469 : ::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeExternal()
      48             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      49             : {
      50         469 :     return ocExternal;
      51             : }
      52             : 
      53             : 
      54         469 : ::sal_Int32 SAL_CALL FormulaOpCodeMapperObj::getOpCodeUnknown()
      55             :     throw (::com::sun::star::uno::RuntimeException, std::exception)
      56             : {
      57         469 :     return FormulaCompiler::OpCodeMap::getOpCodeUnknown();
      58             : }
      59             : 
      60             : 
      61             : ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
      62           0 : SAL_CALL FormulaOpCodeMapperObj::getMappings(
      63             :         const ::com::sun::star::uno::Sequence< OUString >& rNames,
      64             :         sal_Int32 nLanguage )
      65             :     throw ( ::com::sun::star::lang::IllegalArgumentException,
      66             :             ::com::sun::star::uno::RuntimeException, std::exception)
      67             : {
      68           0 :     FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
      69           0 :     if (!xMap)
      70           0 :         throw lang::IllegalArgumentException();
      71           0 :     return xMap->createSequenceOfFormulaTokens( *m_pCompiler,rNames);
      72             : }
      73             : 
      74             : 
      75             : ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry >
      76        2814 : SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
      77             :         sal_Int32 nLanguage, sal_Int32 nGroups )
      78             :     throw ( ::com::sun::star::lang::IllegalArgumentException,
      79             :             ::com::sun::star::uno::RuntimeException, std::exception)
      80             : {
      81        2814 :     FormulaCompiler::OpCodeMapPtr xMap = m_pCompiler->GetOpCodeMap( nLanguage);
      82        2814 :     if (!xMap)
      83           0 :         throw lang::IllegalArgumentException();
      84        2814 :     return xMap->createSequenceOfAvailableMappings( *m_pCompiler,nGroups);
      85             : }
      86             : 
      87           1 : OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName(  ) throw(uno::RuntimeException, std::exception)
      88             : {
      89           1 :     return getImplementationName_Static();
      90             : }
      91             : 
      92           2 : OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName_Static()
      93             : {
      94           2 :     return OUString( "simple.formula.FormulaOpCodeMapperObj" );
      95             : }
      96             : 
      97           1 : uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames(  ) throw(uno::RuntimeException, std::exception)
      98             : {
      99           1 :     return getSupportedServiceNames_Static();
     100             : }
     101           2 : uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
     102             : {
     103           2 :     uno::Sequence< OUString > aSeq( 1 );
     104           2 :     aSeq[0] = "com.sun.star.sheet.FormulaOpCodeMapper";
     105           2 :     return aSeq;
     106             : }
     107             : 
     108           1 : uno::Reference< uno::XInterface > SAL_CALL FormulaOpCodeMapperObj::create(
     109             :                 uno::Reference< uno::XComponentContext > const & /*_xContext*/)
     110             : {
     111           1 :     return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(::std::unique_ptr<FormulaCompiler>(new FormulaCompiler())));
     112             : }
     113             : 
     114             : } // formula
     115             : 
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11