Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / inc / filter.hxx
blob7a71b89c503ed05ea622b23ba2569e5858c5efb3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <rtl/textenc.h>
23 #include <rtl/ustring.hxx>
24 #include <comphelper/errcode.hxx>
26 #include "scdllapi.h"
27 #include <memory>
29 class SfxMedium;
30 class SvStream;
32 class ScAddress;
33 class ScDocument;
34 class ScRange;
35 class SvNumberFormatter;
36 class ScOrcusFilters;
38 // for import
39 enum EXCIMPFORMAT { EIF_AUTO, EIF_BIFF5, EIF_BIFF8, EIF_BIFF_LE4 };
41 // for export
42 enum ExportFormatExcel { ExpBiff5, ExpBiff8 };
44 // These are implemented inside the scfilt library and lazy loaded
46 class ScEEAbsImport {
47 public:
48 virtual ~ScEEAbsImport() {}
49 virtual ErrCode Read( SvStream& rStream, const OUString& rBaseURL ) = 0;
50 virtual ScRange GetRange() = 0;
51 virtual void WriteToDocument(
52 bool bSizeColsRows = false, double nOutputFactor = 1.0,
53 SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true ) = 0;
56 class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin {
57 public:
58 // various import filters
59 virtual ErrCode ScImportLotus123( SfxMedium&, ScDocument&, rtl_TextEncoding eSrc ) = 0;
60 virtual ErrCode ScImportQuattroPro(SvStream* pStream, ScDocument& rDoc) = 0;
61 virtual ErrCode ScImportExcel( SfxMedium&, ScDocument*, const EXCIMPFORMAT ) = 0;
62 // eFormat == EIF_AUTO -> matching filter is used automatically
63 // eFormat == EIF_BIFF5 -> only Biff5 stream is read successfully (in an Excel97 doc, too)
64 // eFormat == EIF_BIFF8 -> only Biff8 stream is read successfully (only in Excel97 docs)
65 // eFormat == EIF_BIFF_LE4 -> only non storage files _might_ be read successfully
66 virtual ErrCode ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
67 const rtl_TextEncoding eSrc ) = 0;
68 virtual ErrCode ScImportRTF( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
69 virtual ErrCode ScImportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor,
70 bool bCalcWidthHeight, SvNumberFormatter* pFormatter, bool bConvertDate ) = 0;
72 // various import helpers
73 virtual std::unique_ptr<ScEEAbsImport> CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0;
74 virtual std::unique_ptr<ScEEAbsImport> CreateHTMLImport( ScDocument* pDocP, const OUString& rBaseURL, const ScRange& rRange ) = 0;
75 virtual OUString GetHTMLRangeNameList( ScDocument& rDoc, const OUString& rOrigName ) = 0;
77 // various export filters
78 virtual ErrCode ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, rtl_TextEncoding eDest ) = 0;
79 virtual void ScExportDif( SvStream&, ScDocument*, const ScAddress& rOutPos, const rtl_TextEncoding eDest ) = 0;
80 virtual void ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) = 0;
81 virtual void ScExportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest, bool bAll,
82 const OUString& rStreamPath, OUString& rNonConvertibleChars, const OUString& rFilterOptions ) = 0;
83 virtual void ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const rtl_TextEncoding eDest ) = 0;
85 virtual ScOrcusFilters* GetOrcusFilters() = 0;
87 protected:
88 ~ScFormatFilterPlugin() {}
91 // scfilt plugin symbol
92 extern "C" {
93 SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * ScFilterCreate();
96 class ScFormatFilter {
97 public:
98 SC_DLLPUBLIC static ScFormatFilterPlugin &Get();
101 struct LotusContext;
103 ErrCode ScImportLotus123old(LotusContext& rContext, SvStream&, rtl_TextEncoding eSrc);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */