LCOV - code coverage report
Current view: top level - sc/inc - filter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 3 4 75.0 %
Date: 2015-06-13 12:38:46 Functions: 3 5 60.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             : #ifndef INCLUDED_SC_INC_FILTER_HXX
      21             : #define INCLUDED_SC_INC_FILTER_HXX
      22             : 
      23             : #include <rtl/textenc.h>
      24             : #include <rtl/ustring.hxx>
      25             : #include <tools/solar.h>
      26             : 
      27             : #include "scdllapi.h"
      28             : 
      29             : class SfxMedium;
      30             : class SvStream;
      31             : 
      32             : class ScAddress;
      33             : class ScDocument;
      34             : class ScRange;
      35             : class SvNumberFormatter;
      36             : class ScOrcusFilters;
      37             : 
      38             : // return values im-/export filter  (sal_uLong)
      39             : 
      40             : typedef sal_uLong FltError;
      41             : 
      42             : #define eERR_OK         ERRCODE_NONE                // no error
      43             : #define eERR_OPEN       SCERR_IMPORT_OPEN
      44             : #define eERR_NOMEM      SCERR_IMPORT_OUTOFMEM       // out of memory
      45             : #define eERR_UNKN_WK    SCERR_IMPORT_UNKNOWN_WK     // unknown WK? format (Lotus 1-2-3)
      46             : #define eERR_FORMAT     SCERR_IMPORT_FORMAT         // format error during reading (no formula error!)
      47             : #define eERR_NI         SCERR_IMPORT_NI             // filter not implemented
      48             : #define eERR_UNKN_BIFF  SCERR_IMPORT_UNKNOWN_BIFF   // unknown BIFF format (Excel)
      49             : #define eERR_FILEPASSWD SCERR_IMPORT_FILEPASSWD     // file password protected
      50             : #define eERR_INTERN     SCERR_IMPORT_INTERNAL       // internal error
      51             : #define eERR_RNGOVRFLW  SCWARN_IMPORT_RANGE_OVERFLOW// overflow of cell coordinates
      52             :                                                     // table restricted to valid area (?)
      53             : // more error codes: s. scerrors.hxx
      54             : 
      55             : // for import
      56             : enum EXCIMPFORMAT { EIF_AUTO, EIF_BIFF5, EIF_BIFF8, EIF_BIFF_LE4 };
      57             : 
      58             : // for export
      59             : enum ExportFormatLotus { ExpWK1, ExpWK3, ExpWK4 };
      60             : enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpBiff8, Exp2007Xml };
      61             : 
      62             : // options for DIF im-/export (combine with '|')
      63             : #define SC_DIFOPT_PLAIN     0x00000000
      64             : #define SC_DIFOPT_DATE      0x00000001
      65             : #define SC_DIFOPT_TIME      0x00000002
      66             : #define SC_DIFOPT_CURRENCY  0x00000004
      67             : 
      68             : #define SC_DIFOPT_EXCEL     (SC_DIFOPT_DATE|SC_DIFOPT_TIME|SC_DIFOPT_CURRENCY)
      69             : 
      70             : // These are implemented inside the scfilt library and lazy loaded
      71             : 
      72           1 : class ScEEAbsImport {
      73             :   public:
      74           1 :     virtual ~ScEEAbsImport() {}
      75             :     virtual sal_uLong   Read( SvStream& rStream, const OUString& rBaseURL ) = 0;
      76             :     virtual ScRange GetRange() = 0;
      77             :     virtual void    WriteToDocument(
      78             :         bool bSizeColsRows = false, double nOutputFactor = 1.0,
      79             :         SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
      80             : };
      81             : 
      82           9 : class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin {
      83             :   public:
      84             :     // various import filters
      85             :     virtual FltError ScImportLotus123( SfxMedium&, ScDocument*, rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW ) = 0;
      86             :     virtual FltError ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc ) = 0;
      87             :     virtual FltError ScImportExcel( SfxMedium&, ScDocument*, const EXCIMPFORMAT ) = 0;
      88             :         // eFormat == EIF_AUTO  -> matching filter is used automatically
      89             :         // eFormat == EIF_BIFF5 -> only Biff5 stream is read successfully (in an Excel97 doc, too)
      90             :         // eFormat == EIF_BIFF8 -> only Biff8 stream is read successfully (only in Excel97 docs)
      91             :         // eFormat == EIF_BIFF_LE4 -> only non storage files _might_ be read successfully
      92             :     virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) = 0;
      93             :     virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
      94             :                  const rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
      95             :     virtual FltError ScImportRTF( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
      96             :     virtual FltError ScImportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0,
      97             :                                    bool bCalcWidthHeight = true, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
      98             : 
      99             :     // various import helpers
     100             :     virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0;
     101             :     virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const ScRange& rRange, bool bCalcWidthHeight ) = 0;
     102             :     virtual OUString       GetHTMLRangeNameList( ScDocument* pDoc, const OUString& rOrigName ) = 0;
     103             : 
     104             :     // various export filters
     105             :     virtual FltError ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, rtl_TextEncoding eDest ) = 0;
     106             :     virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress& rOutPos, const rtl_TextEncoding eDest,
     107             :                                  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
     108             :     virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest,
     109             :                  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
     110             :     virtual FltError ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
     111             :                   const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) = 0;
     112             :     virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) = 0;
     113             : 
     114             :     virtual ScOrcusFilters* GetOrcusFilters() = 0;
     115             : 
     116             : protected:
     117           0 :     ~ScFormatFilterPlugin() {}
     118             : };
     119             : 
     120             : // scfilt plugin symbol
     121             : extern "C" {
     122             :   SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * SAL_CALL ScFilterCreate();
     123             : }
     124             : 
     125             : class ScFormatFilter {
     126             :     public:
     127             :     SC_DLLPUBLIC static ScFormatFilterPlugin &Get();
     128             : };
     129             : 
     130             : struct LotusContext;
     131             : 
     132             : FltError ScImportLotus123old(LotusContext& rContext, SvStream&, ScDocument*, rtl_TextEncoding eSrc);
     133             : 
     134             : #endif
     135             : 
     136             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11