1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filter.hxx,v $
10 * $Revision: 1.8.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/string.hxx>
35 #include <rtl/textenc.h>
37 #define ENABLE_LOTUS123_EXPORT 0
45 class SvNumberFormatter
;
47 // Return-Werte Im-/Exportfilter (ULONG)
49 typedef ULONG FltError
;
52 #define eERR_OK ERRCODE_NONE // kein Fehler, alles OK
53 #define eERR_OPEN SCERR_IMPORT_OPEN // ...
54 #define eERR_UNBEK SCERR_IMPORT_UNKNOWN // unbekannter Fehler, auch historische Bedeutung
55 #define eERR_NOMEM SCERR_IMPORT_OUTOFMEM // nicht mehr genuegend Speicher zur Verfuegung
56 #define eERR_UNKN_WK SCERR_IMPORT_UNKNOWN_WK // unbekanntes WK?-Format (Lotus 1-2-3)
57 #define eERR_FORMAT SCERR_IMPORT_FORMAT // Formatfehler beim Lesen (kein Formel-Fehler!)
58 #define eERR_NI SCERR_IMPORT_NI // Nicht implementierter Filter
59 #define eERR_UNKN_BIFF SCERR_IMPORT_UNKNOWN_BIFF // unbekanntes BIFF-Format (Excel)
60 #define eERR_NI_BIFF SCERR_IMPORT_NI_BIFF // nicht implementiertes BIFF-Format
61 #define eERR_FILEPASSWD SCERR_IMPORT_FILEPASSWD // File Passwordgeschuetzt
62 #define eERR_INTERN SCERR_IMPORT_INTERNAL // interner Fehler
63 #define eERR_RNGOVRFLW SCWARN_IMPORT_RANGE_OVERFLOW// ueberlauf der Zellkoordinaten:
64 // Tabelle abgschnitten auf erlaubtem Bereich
65 // mehr Fehlercodes siehe scerrors.hxx
71 enum EXCIMPFORMAT
{ EIF_AUTO
, EIF_BIFF5
, EIF_BIFF8
, EIF_BIFF_LE4
};
74 enum ExportFormatLotus
{ ExpWK1
, ExpWK3
, ExpWK4
};
75 enum ExportFormatExcel
{ ExpBiff2
, ExpBiff3
, ExpBiff4
, ExpBiff4W
, ExpBiff5
, ExpBiff8
, Exp2007Xml
};
78 // Optionen fuer DIF-Im-/Export (Kombination ueber '|')
79 #define SC_DIFOPT_PLAIN 0x00000000
80 #define SC_DIFOPT_DATE 0x00000001
81 #define SC_DIFOPT_TIME 0x00000002
82 #define SC_DIFOPT_CURRENCY 0x00000004
84 #define SC_DIFOPT_EXCEL (SC_DIFOPT_DATE|SC_DIFOPT_TIME|SC_DIFOPT_CURRENCY)
86 // These are implemented inside the scfilt library and lazy loaded
93 virtual ~ScEEAbsImport() {}
94 virtual ULONG
Read( SvStream
& rStream
, const String
& rBaseURL
) = 0;
95 virtual ScRange
GetRange() = 0;
96 virtual void WriteToDocument(
97 BOOL bSizeColsRows
= FALSE
, double nOutputFactor
= 1.0,
98 SvNumberFormatter
* pFormatter
= NULL
, bool bConvertDate
= true ) = 0;
101 class ScFormatFilterPlugin
{
103 // various import filters
104 virtual FltError
ScImportLotus123( SfxMedium
&, ScDocument
*, CharSet eSrc
= RTL_TEXTENCODING_DONTKNOW
) = 0;
105 virtual FltError
ScImportQuattroPro( SfxMedium
&rMedium
, ScDocument
*pDoc
) = 0;
106 virtual FltError
ScImportExcel( SfxMedium
&, ScDocument
*, const EXCIMPFORMAT
) = 0;
107 // eFormat == EIF_AUTO -> passender Filter wird automatisch verwendet
108 // eFormat == EIF_BIFF5 -> nur Biff5-Stream fuehrt zum Erfolg (auch wenn in einem Excel97-Doc)
109 // eFormat == EIF_BIFF8 -> nur Biff8-Stream fuehrt zum Erfolg (nur in Excel97-Docs)
110 // eFormat == EIF_BIFF_LE4 -> nur Nicht-Storage-Dateien _koennen_ zum Erfolg fuehren
111 virtual FltError
ScImportStarCalc10( SvStream
&, ScDocument
* ) = 0;
112 virtual FltError
ScImportDif( SvStream
&, ScDocument
*, const ScAddress
& rInsPos
,
113 const CharSet eSrc
= RTL_TEXTENCODING_DONTKNOW
, UINT32 nDifOption
= SC_DIFOPT_EXCEL
) = 0;
114 virtual FltError
ScImportRTF( SvStream
&, const String
& rBaseURL
, ScDocument
*, ScRange
& rRange
) = 0;
115 virtual FltError
ScImportHTML( SvStream
&, const String
& rBaseURL
, ScDocument
*, ScRange
& rRange
, double nOutputFactor
= 1.0,
116 BOOL bCalcWidthHeight
= TRUE
, SvNumberFormatter
* pFormatter
= NULL
, bool bConvertDate
= true ) = 0;
118 // various import helpers
119 virtual ScEEAbsImport
*CreateRTFImport( ScDocument
* pDoc
, const ScRange
& rRange
) = 0;
120 virtual ScEEAbsImport
*CreateHTMLImport( ScDocument
* pDocP
, const String
& rBaseURL
, const ScRange
& rRange
, BOOL bCalcWidthHeight
) = 0;
121 virtual String
GetHTMLRangeNameList( ScDocument
* pDoc
, const String
& rOrigName
) = 0;
123 // various export filters
124 #if ENABLE_LOTUS123_EXPORT
125 virtual FltError
ScExportLotus123( SvStream
&, ScDocument
*, ExportFormatLotus
, CharSet eDest
) = 0;
127 virtual FltError
ScExportExcel5( SfxMedium
&, ScDocument
*, ExportFormatExcel eFormat
, CharSet eDest
) = 0;
128 virtual FltError
ScExportDif( SvStream
&, ScDocument
*, const ScAddress
& rOutPos
, const CharSet eDest
,
129 UINT32 nDifOption
= SC_DIFOPT_EXCEL
) = 0;
130 virtual FltError
ScExportDif( SvStream
&, ScDocument
*, const ScRange
& rRange
, const CharSet eDest
,
131 UINT32 nDifOption
= SC_DIFOPT_EXCEL
) = 0;
132 virtual FltError
ScExportHTML( SvStream
&, const String
& rBaseURL
, ScDocument
*, const ScRange
& rRange
, const CharSet eDest
, BOOL bAll
,
133 const String
& rStreamPath
, String
& rNonConvertibleChars
) = 0;
134 virtual FltError
ScExportRTF( SvStream
&, ScDocument
*, const ScRange
& rRange
, const CharSet eDest
) = 0;
137 // scfilt plugin symbol
139 ScFormatFilterPlugin
* SAL_CALL
ScFilterCreate(void);
142 class ScFormatFilter
{
144 static ScFormatFilterPlugin
&Get();