LibreOffice Module sw (master)  1
iodetect.hxx
Go to the documentation of this file.
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 INCLUDED_SW_INC_IODETECT_HXX
21 #define INCLUDED_SW_INC_IODETECT_HXX
22 
23 #include <memory>
24 #include <rtl/ustring.hxx>
25 #include <tools/lineend.hxx>
26 #include <tools/solar.h>
27 #include "swdllapi.h"
28 
29 #define FILTER_RTF "RTF"
30 #define sRtfWH "WH_RTF"
31 #define FILTER_TEXT "TEXT"
32 #define FILTER_BAS "BAS"
33 #define FILTER_WW8 "CWW8"
34 #define FILTER_TEXT_DLG "TEXT_DLG"
35 #define FILTER_XML "CXML"
36 #define FILTER_XMLV "CXMLV"
37 #define FILTER_XMLVW "CXMLVWEB"
38 #define FILTER_DOCX "OXML"
39 #define sHTML "HTML"
40 #define sWW5 "WW6"
41 #define sWW6 "CWW6"
42 
43 #define sSWRITER "swriter"
44 #define sSWRITERWEB "swriter/web"
45 
46 class SfxFilter;
47 class SfxFilterContainer;
48 class SotStorage;
49 class SvStream;
50 namespace com { namespace sun { namespace star { namespace embed { class XStorage; } } } }
51 namespace com { namespace sun { namespace star { namespace uno { template <typename> class Reference; } } } }
52 
53 struct SwIoDetect
54 {
55  const OUString sName;
56 
57  SwIoDetect(const OUString &rN)
58  : sName(rN)
59  {
60  }
61 
62  bool IsFilter( const OUString& rNm ) const
63  {
64  return rNm.startsWith(sName);
65  }
66 };
67 
81 };
82 
83 extern SwIoDetect aFilterDetect[];
84 
91 {
92 public:
94  SW_DLLPUBLIC static std::shared_ptr<const SfxFilter>
95  GetFilterOfFormat( const OUString& rFormat,
96  const SfxFilterContainer* pCnt = nullptr );
97 
101  static std::shared_ptr<const SfxFilter> GetFileFilter(const OUString& rFileName);
102 
103  static bool IsValidStgFilter( SotStorage& , const SfxFilter& );
104  static bool IsValidStgFilter( const css::uno::Reference < css::embed::XStorage >& rStg, const SfxFilter& rFilter);
105 
106  static bool IsDetectableText( const sal_Char* pBuf, sal_uLong &rLen,
107  rtl_TextEncoding *pCharSet, bool *pSwap, LineEnd *pLineEnd );
108 
109  static OUString GetSubStorageName( const SfxFilter& rFltr );
110 };
111 
112 extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportFODT(SvStream &rStream);
113 
114 #endif
115 
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uIntPtr sal_uLong
SwIoDetect(const OUString &rN)
Definition: iodetect.hxx:57
ReaderWriterEnum
Definition: iodetect.hxx:68
Reference
const OUString sName
Definition: iodetect.hxx:55
static bool IsValidStgFilter(SotStorage &, const SfxFilter &)
Definition: iodetect.cxx:112
static bool IsDetectableText(const sal_Char *pBuf, sal_uLong &rLen, rtl_TextEncoding *pCharSet, bool *pSwap, LineEnd *pLineEnd)
Definition: iodetect.cxx:241
char sal_Char
SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportFODT(SvStream &rStream)
Definition: xmlimp.cxx:1804
static SW_DLLPUBLIC std::shared_ptr< const SfxFilter > GetFilterOfFormat(const OUString &rFormat, const SfxFilterContainer *pCnt=nullptr)
find for an internal format name the corresponding filter entry
Definition: iodetect.cxx:68
The following class is a wrapper for basic i/o functions of Writer 3.0.
Definition: iodetect.hxx:90
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
LineEnd
static std::shared_ptr< const SfxFilter > GetFileFilter(const OUString &rFileName)
Detect for the given file which filter should be used.
Definition: iodetect.cxx:149
static OUString GetSubStorageName(const SfxFilter &rFltr)
Definition: iodetect.cxx:55
bool IsFilter(const OUString &rNm) const
Definition: iodetect.hxx:62
SwIoDetect aFilterDetect[]
Definition: iodetect.cxx:40