LCOV - code coverage report
Current view: top level - writerperfect/source/calc - MSWorksCalcImportFilter.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 20 27 74.1 %
Date: 2014-11-03 Functions: 6 9 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* MSWorksCalcImportFilter: 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 <com/sun/star/uno/Reference.h>
      13             : #include <cppuhelper/supportsservice.hxx>
      14             : 
      15             : #include <libwps/libwps.h>
      16             : 
      17             : #include "MSWorksCalcImportFilter.hxx"
      18             : 
      19             : using com::sun::star::uno::Sequence;
      20             : using com::sun::star::uno::Reference;
      21             : using com::sun::star::uno::Any;
      22             : using com::sun::star::uno::XInterface;
      23             : using com::sun::star::uno::Exception;
      24             : using com::sun::star::uno::RuntimeException;
      25             : using com::sun::star::uno::XComponentContext;
      26             : 
      27           8 : bool MSWorksCalcImportFilter::doImportDocument(librevenge::RVNGInputStream &rInput, OdsGenerator &rGenerator, utl::MediaDescriptor &)
      28             : {
      29           8 :     return libwps::WPS_OK == libwps::WPSDocument::parse(&rInput, &rGenerator);
      30             : }
      31             : 
      32           8 : bool MSWorksCalcImportFilter::doDetectFormat(librevenge::RVNGInputStream &rInput, OUString &rTypeName)
      33             : {
      34           8 :     libwps::WPSKind kind = libwps::WPS_TEXT;
      35           8 :     const libwps::WPSConfidence confidence = libwps::WPSDocument::isFileFormatSupported(&rInput, kind);
      36             : 
      37           8 :     if ((kind == libwps::WPS_SPREADSHEET || kind == libwps::WPS_DATABASE) && (confidence == libwps::WPS_CONFIDENCE_EXCELLENT))
      38             :     {
      39           8 :         rTypeName = "calc_MS_Works_Document";
      40           8 :         return true;
      41             :     }
      42             : 
      43           0 :     return false;
      44             : }
      45             : 
      46           8 : void MSWorksCalcImportFilter::doRegisterHandlers(OdsGenerator &)
      47             : {
      48           8 : }
      49             : 
      50           4 : OUString MSWorksCalcImportFilter_getImplementationName()
      51             : throw (RuntimeException)
      52             : {
      53           4 :     return OUString("com.sun.star.comp.Calc.MSWorksCalcImportFilter");
      54             : }
      55             : 
      56           2 : Sequence< OUString > SAL_CALL MSWorksCalcImportFilter_getSupportedServiceNames()
      57             : throw (RuntimeException)
      58             : {
      59           2 :     Sequence < OUString > aRet(2);
      60           2 :     OUString *pArray = aRet.getArray();
      61           2 :     pArray[0] =  "com.sun.star.document.ImportFilter";
      62           2 :     pArray[1] =  "com.sun.star.document.ExtendedTypeDetection";
      63           2 :     return aRet;
      64             : }
      65             : #undef SERVICE_NAME2
      66             : #undef SERVICE_NAME1
      67             : 
      68           2 : Reference< XInterface > SAL_CALL MSWorksCalcImportFilter_createInstance(const Reference< XComponentContext > &rContext)
      69             : throw(Exception)
      70             : {
      71           2 :     return (cppu::OWeakObject *) new MSWorksCalcImportFilter(rContext);
      72             : }
      73             : 
      74             : // XServiceInfo
      75           0 : OUString SAL_CALL MSWorksCalcImportFilter::getImplementationName()
      76             : throw (RuntimeException, std::exception)
      77             : {
      78           0 :     return MSWorksCalcImportFilter_getImplementationName();
      79             : }
      80           0 : sal_Bool SAL_CALL MSWorksCalcImportFilter::supportsService(const OUString &rServiceName)
      81             : throw (RuntimeException, std::exception)
      82             : {
      83           0 :     return cppu::supportsService(this, rServiceName);
      84             : }
      85           0 : Sequence< OUString > SAL_CALL MSWorksCalcImportFilter::getSupportedServiceNames()
      86             : throw (RuntimeException, std::exception)
      87             : {
      88           0 :     return MSWorksCalcImportFilter_getSupportedServiceNames();
      89             : }
      90             : 
      91             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10