1 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
2 
3 /* AbiWord
4  * Copyright (C) 1998 AbiSource, Inc.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA.
20  */
21 
22 #ifndef IE_TYPES_H
23 #define IE_TYPES_H
24 
25 /*
26   NOTE:  File filters can support one or MORE of the following
27   NOTE:  file types.  However, each of these file types can be
28   NOTE:  handled by only ONE filter.  So, the number of file types
29   NOTE:  supported by all the filters combined should be equal
30   NOTE:  to (or less than) the number below.
31 */
32 
33 #if defined(__MINGW32__)
34 #  undef snprintf
35 #  if __GNUC__ <= 3
36 #    define _GLIBCXX_USE_C99_DYNAMIC 1
37 #  endif
38 #endif
39 
40 #include <string>
41 #include <glib.h>
42 #include "ut_types.h"
43 
44 typedef UT_sint32 IEFileType;
45 #define IEFT_Bogus   static_cast<IEFileType>(-1)
46 #define IEFT_Unknown static_cast<IEFileType>(0)
47 
48 typedef UT_sint32 IEGraphicFileType;
49 #define IEGFT_Bogus static_cast<IEGraphicFileType>(-1)
50 #define IEGFT_Unknown static_cast<IEGraphicFileType>(0)
51 
52 // temporary hack so that we don't bust too many things - DOM
53 #define IEGFT_PNG IE_ImpGraphic::fileTypeForSuffix(".png")
54 #define IEGFT_SVG IE_ImpGraphic::fileTypeForSuffix(".svg")
55 #define IEGFT_BMP IE_ImpGraphic::fileTypeForSuffix(".bmp")
56 #define IEGFT_DIB IEGFT_BMP
57 #define IEGFT_JPEG IE_ImpGraphic::fileTypeForSuffix(".jpg")
58 #define IEGFT_WMF IE_ImpGraphic::fileTypeForSuffix(".wmf")
59 #define IEGFT_EMF IE_ImpGraphic::fileTypeForSuffix(".emf")
60 
61 /* plug-ins adding new importers/exporters should give them names
62  * such as "<plug-in name>::<format description>"
63  */
64 #define IE_IMPEXPNAME_AWML11		"AbiWord::AWML-1.1"
65 #define IE_IMPEXPNAME_AWML11AWT		"AbiWord::AWML-1.1/template"
66 #define IE_IMPEXPNAME_AWML11GZ		"AbiWord::AWML-1.1/compressed"
67 #define IE_IMPEXPNAME_AWML11GZB64	"AbiWord::AWML-1.1/compressed/base64"
68 #define IE_IMPEXPNAME_MSWORD97		"AbiWord::MS Word (97)"
69 #define IE_IMPEXPNAME_RTF			"AbiWord::RTF"
70 #define IE_IMPEXPNAME_RTFATTIC		"AbiWord::RTF (attic)"
71 #define IE_IMPEXPNAME_RTFMSDOC		"AbiWord::RTF (!MSWord)"
72 #define IE_IMPEXPNAME_TEXT			"AbiWord::Text"
73 #define IE_IMPEXPNAME_TEXTENC		"AbiWord::Text/encoded"
74 #define IE_IMPEXPNAME_HTML			"AbiWord::HTML"
75 #define IE_IMPEXPNAME_MATHML    	"AbiWord::MathML"
76 #define IE_IMPEXPNAME_GOCHART   	"AbiWord::GNOME Office Chart"
77 #define IE_IMPEXPNAME_GOCOMPONENT   "AbiWord::GNOME Office Component"
78 
79 /*!
80  * How to match mimetypes that plugins support.
81  */
82 enum IE_MimeMatch {
83 	IE_MIME_MATCH_BOGUS,	/*!< Terminator for mime match entry array */
84 	IE_MIME_MATCH_CLASS, 	/*!< Matches only the mime class, e.g. "text" from mimetype "text/plain" */
85 	IE_MIME_MATCH_FULL		/*!< Matches the whole mimetype */
86 };
87 
88 /*!
89  * Entry for mimetypes supported by a filter.
90  */
91 struct IE_MimeConfidence {
92 	IE_MimeMatch	 match;			/*!< Match class or full mimetype. */
93 	std::string 	 mimetype;		/*!< Mimetype string itself. */
94 	UT_Confidence_t	 confidence;	/*!< Confidence for supporting that mimetype. */
95 };
96 
97 /*!
98  * Entry for filename suffixes supported by a filter.
99  */
100 struct IE_SuffixConfidence {
101 	std::string		 suffix;		/*!< Filename suffix to match. */
102 	UT_Confidence_t	 confidence;	/*!< Confidence for supporting that mimetype. */
103 };
104 
105 #endif /* IE_TYPES_H */
106