LCOV - code coverage report
Current view: top level - writerperfect/source/writer - PagesImportFilter.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 25 92.0 %
Date: 2015-06-13 12:38:46 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* PagesImportFilter: 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 "PagesImportFilter.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 PagesImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdtGenerator &rGenerator, utl::MediaDescriptor &)
      31             : {
      32           1 :     return EtonyekDocument::parse(&rInput, &rGenerator);
      33             : }
      34             : 
      35          88 : bool PagesImportFilter::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_PAGES))
      40             :     {
      41           1 :         rTypeName = "writer_ApplePages";
      42           1 :         return true;
      43             :     }
      44             : 
      45          87 :     return false;
      46             : }
      47             : 
      48          33 : OUString PagesImportFilter_getImplementationName()
      49             : throw (RuntimeException)
      50             : {
      51          33 :     return OUString("org.libreoffice.comp.Writer.PagesImportFilter");
      52             : }
      53             : 
      54           7 : Sequence< OUString > SAL_CALL PagesImportFilter_getSupportedServiceNames()
      55             : throw (RuntimeException)
      56             : {
      57           7 :     Sequence < OUString > aRet(2);
      58           7 :     OUString *pArray = aRet.getArray();
      59           7 :     pArray[0] =  "com.sun.star.document.ImportFilter";
      60           7 :     pArray[1] =  "com.sun.star.document.ExtendedTypeDetection";
      61           7 :     return aRet;
      62             : }
      63             : 
      64          89 : Reference< XInterface > SAL_CALL PagesImportFilter_createInstance(const Reference< XComponentContext > &rContext)
      65             : throw(Exception)
      66             : {
      67          89 :     return static_cast<cppu::OWeakObject *>(new PagesImportFilter(rContext));
      68             : }
      69             : 
      70             : // XServiceInfo
      71           1 : OUString SAL_CALL PagesImportFilter::getImplementationName()
      72             : throw (RuntimeException, std::exception)
      73             : {
      74           1 :     return PagesImportFilter_getImplementationName();
      75             : }
      76           0 : sal_Bool SAL_CALL PagesImportFilter::supportsService(const OUString &rServiceName)
      77             : throw (RuntimeException, std::exception)
      78             : {
      79           0 :     return cppu::supportsService(this, rServiceName);
      80             : }
      81           1 : Sequence< OUString > SAL_CALL PagesImportFilter::getSupportedServiceNames()
      82             : throw (RuntimeException, std::exception)
      83             : {
      84           1 :     return PagesImportFilter_getSupportedServiceNames();
      85             : }
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11