1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SW_INC_IODETECT_HXX
21 #define INCLUDED_SW_INC_IODETECT_HXX
24 #include <rtl/ustring.hxx>
25 #include <tools/lineend.hxx>
26 #include <tools/solar.h>
29 #define FILTER_RTF "RTF" ///< RTF filter
30 #define sRtfWH "WH_RTF"
31 #define FILTER_TEXT "TEXT" ///< text filter with default codeset
32 #define FILTER_BAS "BAS" ///< StarBasic (identical to ANSI)
33 #define FILTER_WW8 "CWW8" ///< WinWord 97 filter
34 #define FILTER_TEXT_DLG "TEXT_DLG" ///< text filter with encoding dialog
35 #define FILTER_XML "CXML" ///< XML filter
36 #define FILTER_XMLV "CXMLV" ///< XML filter
37 #define FILTER_XMLVW "CXMLVWEB" ///< XML filter
38 #define FILTER_DOCX "OXML"
43 #define sSWRITER "swriter"
44 #define sSWRITERWEB "swriter/web"
47 class SfxFilterContainer
;
50 namespace com::sun::star::embed
{ class XStorage
; }
51 namespace com::sun::star::uno
{ template <typename
> class Reference
; }
57 SwIoDetect(const OUString
&rN
)
62 bool IsFilter( const OUString
& rNm
) const
64 return rNm
.startsWith(sName
);
68 enum ReaderWriterEnum
{
77 READER_WRITER_TEXT_DLG
,
83 extern SwIoDetect aFilterDetect
[];
85 /** The following class is a wrapper for basic i/o functions of Writer 3.0.
86 Everything is static. All filter names mentioned are Writer-internal
87 names, i.e. the names in front of the equality sign in INSTALL.INI, like SWG
93 /// find for an internal format name the corresponding filter entry
94 SW_DLLPUBLIC
static std::shared_ptr
<const SfxFilter
>
95 GetFilterOfFormat( const OUString
& rFormat
,
96 const SfxFilterContainer
* pCnt
= nullptr );
98 /** Detect for the given file which filter should be used. The filter name
99 is returned. If no filter could be found, the name of the ASCII filter
101 static std::shared_ptr
<const SfxFilter
> GetFileFilter(const OUString
& rFileName
);
103 static bool IsValidStgFilter( SotStorage
& , const SfxFilter
& );
104 static bool IsValidStgFilter( const css::uno::Reference
< css::embed::XStorage
>& rStg
, const SfxFilter
& rFilter
);
106 static bool IsDetectableText( const char* pBuf
, sal_uLong
&rLen
,
107 rtl_TextEncoding
*pCharSet
, bool *pSwap
, LineEnd
*pLineEnd
);
109 static OUString
GetSubStorageName( const SfxFilter
& rFltr
);
112 extern "C" SAL_DLLPUBLIC_EXPORT
bool SAL_CALL
TestImportFODT(SvStream
&rStream
);
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */