LCOV - code coverage report
Current view: top level - sc/inc - filter.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 4 75.0 %
Date: 2012-08-25 Functions: 3 5 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_FILTER_HXX
      30                 :            : #define SC_FILTER_HXX
      31                 :            : 
      32                 :            : #include <tools/string.hxx>
      33                 :            : #include <rtl/textenc.h>
      34                 :            : 
      35                 :            : class SfxMedium;
      36                 :            : class SvStream;
      37                 :            : 
      38                 :            : class ScAddress;
      39                 :            : class ScDocument;
      40                 :            : class ScRange;
      41                 :            : class SvNumberFormatter;
      42                 :            : 
      43                 :            : // return values im-/export filter  (sal_uLong)
      44                 :            : 
      45                 :            : typedef sal_uLong FltError;
      46                 :            : 
      47                 :            : #define eERR_OK         ERRCODE_NONE                // no error
      48                 :            : #define eERR_OPEN       SCERR_IMPORT_OPEN           // ...
      49                 :            : #define eERR_UNBEK      SCERR_IMPORT_UNKNOWN        // unknown error, historical meaning
      50                 :            : #define eERR_NOMEM      SCERR_IMPORT_OUTOFMEM       // out of memory
      51                 :            : #define eERR_UNKN_WK    SCERR_IMPORT_UNKNOWN_WK     // unknown WK? format (Lotus 1-2-3)
      52                 :            : #define eERR_FORMAT     SCERR_IMPORT_FORMAT         // format error during reading (no formula error!)
      53                 :            : #define eERR_NI         SCERR_IMPORT_NI             // filter not implemented
      54                 :            : #define eERR_UNKN_BIFF  SCERR_IMPORT_UNKNOWN_BIFF   // unknown BIFF format (Excel)
      55                 :            : #define eERR_NI_BIFF    SCERR_IMPORT_NI_BIFF        // not implemented BIFF format
      56                 :            : #define eERR_FILEPASSWD SCERR_IMPORT_FILEPASSWD     // file password protected
      57                 :            : #define eERR_INTERN     SCERR_IMPORT_INTERNAL       // internal error
      58                 :            : #define eERR_RNGOVRFLW  SCWARN_IMPORT_RANGE_OVERFLOW// overflow of cell coordinates
      59                 :            :                                                     // table restricted to valid area (?)
      60                 :            : // more error codes: s. scerrors.hxx
      61                 :            : 
      62                 :            : // for import
      63                 :            : enum EXCIMPFORMAT { EIF_AUTO, EIF_BIFF5, EIF_BIFF8, EIF_BIFF_LE4 };
      64                 :            : 
      65                 :            : // for export
      66                 :            : enum ExportFormatLotus { ExpWK1, ExpWK3, ExpWK4 };
      67                 :            : enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpBiff8, Exp2007Xml };
      68                 :            : 
      69                 :            : 
      70                 :            : // options for DIF im-/export (combine with '|')
      71                 :            : #define SC_DIFOPT_PLAIN     0x00000000
      72                 :            : #define SC_DIFOPT_DATE      0x00000001
      73                 :            : #define SC_DIFOPT_TIME      0x00000002
      74                 :            : #define SC_DIFOPT_CURRENCY  0x00000004
      75                 :            : 
      76                 :            : #define SC_DIFOPT_EXCEL     (SC_DIFOPT_DATE|SC_DIFOPT_TIME|SC_DIFOPT_CURRENCY)
      77                 :            : 
      78                 :            : // These are implemented inside the scfilt library and lazy loaded
      79                 :            : 
      80                 :          3 : class ScEEAbsImport {
      81                 :            :   public:
      82         [ -  + ]:          3 :     virtual ~ScEEAbsImport() {}
      83                 :            :     virtual sal_uLong   Read( SvStream& rStream, const String& rBaseURL ) = 0;
      84                 :            :     virtual ScRange GetRange() = 0;
      85                 :            :     virtual void    WriteToDocument(
      86                 :            :         bool bSizeColsRows = false, double nOutputFactor = 1.0,
      87                 :            :         SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
      88                 :            : };
      89                 :            : 
      90                 :          8 : class ScFormatFilterPlugin {
      91                 :            :   public:
      92                 :            :     // various import filters
      93                 :            :     virtual FltError ScImportLotus123( SfxMedium&, ScDocument*, CharSet eSrc = RTL_TEXTENCODING_DONTKNOW ) = 0;
      94                 :            :     virtual FltError ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc ) = 0;
      95                 :            :     virtual FltError ScImportExcel( SfxMedium&, ScDocument*, const EXCIMPFORMAT ) = 0;
      96                 :            :         // eFormat == EIF_AUTO  -> matching filter is used automatically
      97                 :            :         // eFormat == EIF_BIFF5 -> only Biff5 stream is read sucessfully (in an Excel97 doc, too)
      98                 :            :         // eFormat == EIF_BIFF8 -> only Biff8 stream is read sucessfully (only in Excel97 docs)
      99                 :            :         // eFormat == EIF_BIFF_LE4 -> only non storage files _might_ be read sucessfully
     100                 :            :     virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) = 0;
     101                 :            :     virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
     102                 :            :                  const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
     103                 :            :     virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
     104                 :            :     virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0,
     105                 :            :                                    bool bCalcWidthHeight = true, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0;
     106                 :            : 
     107                 :            :     // various import helpers
     108                 :            :     virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0;
     109                 :            :     virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScRange& rRange, bool bCalcWidthHeight ) = 0;
     110                 :            :     virtual String         GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrigName ) = 0;
     111                 :            : 
     112                 :            :     // various export filters
     113                 :            :     virtual FltError ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, CharSet eDest ) = 0;
     114                 :            :     virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress& rOutPos, const CharSet eDest,
     115                 :            :                                  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
     116                 :            :     virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest,
     117                 :            :                  sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
     118                 :            :     virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, bool bAll,
     119                 :            :                   const String& rStreamPath, String& rNonConvertibleChars ) = 0;
     120                 :            :     virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest ) = 0;
     121                 :            : 
     122                 :            : protected:
     123                 :          0 :     ~ScFormatFilterPlugin() {}
     124                 :            : };
     125                 :            : 
     126                 :            : // scfilt plugin symbol
     127                 :            : extern "C" {
     128                 :            :   SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * SAL_CALL ScFilterCreate(void);
     129                 :            : }
     130                 :            : 
     131                 :            : class ScFormatFilter {
     132                 :            :     public:
     133                 :            :     static ScFormatFilterPlugin &Get();
     134                 :            : };
     135                 :            : 
     136                 :            : #endif
     137                 :            : 
     138                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10