LCOV - code coverage report
Current view: top level - writerperfect/source/calc - NumbersImportFilter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 25 27 92.6 %
Date: 2015-06-13 12:38:46 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* NumbersImportFilter: Sets up the filter, and calls DocumentCollector
       3             :  * to do the actual filtering
       4             :  *
       5             :  * This file is part of the LibreOffice project.
       6             :  *
       7             :  * This Source Code Form is subject to the terms of the Mozilla Public
       8             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       9             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
      10             :  */
      11             : 
      12             : #include <libetonyek/libetonyek.h>
      13             : 
      14             : #include <com/sun/star/uno/Reference.h>
      15             : 
      16             : #include <cppuhelper/supportsservice.hxx>
      17             : 
      18             : #include "NumbersImportFilter.hxx"
      19             : 
      20             : using com::sun::star::uno::Sequence;
      21             : using com::sun::star::uno::Reference;
      22             : using com::sun::star::uno::Any;
      23             : using com::sun::star::uno::XInterface;
      24             : using com::sun::star::uno::Exception;
      25             : using com::sun::star::uno::RuntimeException;
      26             : using com::sun::star::uno::XComponentContext;
      27             : 
      28             : using libetonyek::EtonyekDocument;
      29             : 
      30           1 : bool NumbersImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &)
      31             : {
      32           1 :     return EtonyekDocument::parse(&rInput, &rGenerator);
      33             : }
      34             : 
      35          88 : bool NumbersImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
      36             : {
      37          88 :     EtonyekDocument::Type type = EtonyekDocument::TYPE_UNKNOWN;
      38          88 :     const EtonyekDocument::Confidence confidence = EtonyekDocument::isSupported(&rInput, &type);
      39          88 :     if ((confidence == EtonyekDocument::CONFIDENCE_EXCELLENT) && (type == EtonyekDocument::TYPE_NUMBERS))
      40             :     {
      41           1 :         rTypeName = "calc_AppleNumbers";
      42           1 :         return true;
      43             :     }
      44             : 
      45          87 :     return false;
      46             : }
      47             : 
      48           1 : void NumbersImportFilter::doRegisterHandlers(OdsGenerator &)
      49             : {
      50           1 : }
      51             : 
      52          19 : OUString NumbersImportFilter_getImplementationName()
      53             : throw (RuntimeException)
      54             : {
      55          19 :     return OUString("org.libreoffice.comp.Calc.NumbersImportFilter");
      56             : }
      57             : 
      58           7 : Sequence< OUString > SAL_CALL NumbersImportFilter_getSupportedServiceNames()
      59             : throw (RuntimeException)
      60             : {
      61           7 :     Sequence < OUString > aRet(2);
      62           7 :     OUString *pArray = aRet.getArray();
      63           7 :     pArray[0] =  "com.sun.star.document.ImportFilter";
      64           7 :     pArray[1] =  "com.sun.star.document.ExtendedTypeDetection";
      65           7 :     return aRet;
      66             : }
      67             : 
      68          89 : Reference< XInterface > SAL_CALL NumbersImportFilter_createInstance(const Reference< XComponentContext > &rContext)
      69             : throw(Exception)
      70             : {
      71          89 :     return static_cast<cppu::OWeakObject *>(new NumbersImportFilter(rContext));
      72             : }
      73             : 
      74             : // XServiceInfo
      75           1 : OUString SAL_CALL NumbersImportFilter::getImplementationName()
      76             : throw (RuntimeException, std::exception)
      77             : {
      78           1 :     return NumbersImportFilter_getImplementationName();
      79             : }
      80           0 : sal_Bool SAL_CALL NumbersImportFilter::supportsService(const OUString &rServiceName)
      81             : throw (RuntimeException, std::exception)
      82             : {
      83           0 :     return cppu::supportsService(this, rServiceName);
      84             : }
      85           1 : Sequence< OUString > SAL_CALL NumbersImportFilter::getSupportedServiceNames()
      86             : throw (RuntimeException, std::exception)
      87             : {
      88           1 :     return NumbersImportFilter_getSupportedServiceNames();
      89             : }
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11