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

Generated by: LCOV version 1.10