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_SVL_INETTYPE_HXX
21 #define INCLUDED_SVL_INETTYPE_HXX
23 #include <svl/svldllapi.h>
24 #include <tools/inetmime.hxx>
26 /** Definitions for frequently used media type names.
28 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_OCTSTREAM
= u
"application/octet-stream";
29 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_PDF
= u
"application/pdf";
30 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_RTF
= u
"application/rtf";
31 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_CALC
32 = u
"application/vnd.stardivision.calc";
33 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_CHART
34 = u
"application/vnd.stardivision.chart";
35 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_DRAW
36 = u
"application/vnd.stardivision.draw";
37 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMAGE
38 = u
"application/vnd.stardivision.image";
39 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED
40 = u
"application/vnd.stardivision.impress-packed";
41 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_IMPRESS
42 = u
"application/vnd.stardivision.impress";
43 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_MAIL
44 = u
"application/vnd.stardivision.mail";
45 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_MATH
46 = u
"application/vnd.stardivision.math";
47 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_NEWS
48 = u
"application/vnd.stardivision.news";
49 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_OUTTRAY
50 = u
"application/vnd.stardivision.outtray";
51 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_TEMPLATE
52 = u
"application/vnd.stardivision.template";
53 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL
54 = u
"application/vnd.stardivision.writer-global";
55 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER_WEB
56 = u
"application/vnd.stardivision.writer-web";
57 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_WRITER
58 = u
"application/vnd.stardivision.writer";
59 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_FRAMESET
= u
"application/x-frameset";
60 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_GALLERY_THEME
61 = u
"application/x-gallery-theme";
62 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_GALLERY
= u
"application/x-gallery";
63 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_JAR
= u
"application/x-jar";
64 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MACRO
= u
"application/x-macro";
65 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL
66 = u
"application/x-msexcel-template";
67 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSEXCEL
= u
"application/x-msexcel";
68 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL
69 = u
"application/x-mspowerpoint-template";
70 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSPPOINT
= u
"application/x-mspowerpoint";
71 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSWORD_TEMPL
72 = u
"application/x-msword-template";
73 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_MSWORD
= u
"application/x-msword";
74 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARCALC
= u
"application/x-starcalc";
75 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARCHART
= u
"application/x-starchart;";
76 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARDRAW
= u
"application/x-stardraw";
77 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARHELP
= u
"application/x-starhelp";
78 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARIMAGE
= u
"application/x-starimage";
79 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARIMPRESS
= u
"application/x-starimpress";
80 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMAIL_SDM
= u
"application/x-starmail-sdm";
81 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMAIL_SMD
= u
"application/x-starmail-smd";
82 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARMATH
= u
"application/x-starmath";
83 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARWRITER_GLOB
84 = u
"application/x-starwriter-global";
85 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_STARWRITER
= u
"application/x-starwriter";
86 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP
87 = u
"application/x-sun-ae-file";
88 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_ZIP
= u
"application/x-zip-compressed";
89 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_AIFF
= u
"audio/aiff";
90 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_BASIC
= u
"audio/basic";
91 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_MIDI
= u
"audio/midi";
92 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_VORBIS
= u
"audio/vorbis";
93 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_WAV
= u
"audio/wav";
94 inline constexpr OUStringLiteral CONTENT_TYPE_STR_AUDIO_WEBM
= u
"audio/webm";
95 inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSBOX
= u
".chaos/fsys-box";
96 inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSFOLDER
= u
".chaos/fsys-folder";
97 inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER
98 = u
".chaos/fsys-special-folder";
99 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_GENERIC
= u
"image/generic";
100 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_GIF
= u
"image/gif";
101 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_JPEG
= u
"image/jpeg";
102 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_PCX
= u
"image/pcx";
103 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_PNG
= u
"image/png";
104 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_TIFF
= u
"image/tiff";
105 inline constexpr OUStringLiteral CONTENT_TYPE_STR_IMAGE_BMP
= u
"image/x-MS-bmp";
106 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MSG_RFC822
= u
"message/rfc822";
107 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE
= u
"multipart/alternative";
108 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_DIGEST
= u
"multipart/digest";
109 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_MIXED
= u
"multipart/mixed";
110 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_PARALLEL
= u
"multipart/parallel";
111 inline constexpr OUStringLiteral CONTENT_TYPE_STR_INET_MULTI_RELATED
= u
"multipart/related";
112 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_ICALENDAR
= u
"text/calendar";
113 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_HTML
= u
"text/html";
114 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_PLAIN
= u
"text/plain";
115 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_XMLICALENDAR
= u
"text/x-icalxml";
116 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_URL
= u
"text/x-url";
117 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_VCALENDAR
= u
"text/x-vCalendar";
118 inline constexpr OUStringLiteral CONTENT_TYPE_STR_TEXT_VCARD
= u
"text/x-vCard";
119 inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_MSVIDEO
= u
"video/x-msvideo";
120 inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_THEORA
= u
"video/theora";
121 inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_VDO
= u
"video/vdo";
122 inline constexpr OUStringLiteral CONTENT_TYPE_STR_VIDEO_WEBM
= u
"audio/webm";
123 inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_STARMAIL
= u
"x-starmail";
124 inline constexpr OUStringLiteral CONTENT_TYPE_STR_X_VRML
= u
"x-world/x-vrml";
125 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER
126 = u
"application/vnd.sun.xml.writer";
127 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC
128 = u
"application/vnd.sun.xml.calc";
129 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS
130 = u
"application/vnd.sun.xml.impress";
131 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW
132 = u
"application/vnd.sun.xml.draw";
133 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART
134 = u
"application/vnd.sun.xml.chart";
135 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH
136 = u
"application/vnd.sun.xml.math";
137 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL
138 = u
"application/vnd.sun.xml.writer-global";
139 inline constexpr OUStringLiteral CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED
140 = u
"application/vnd.sun.xml.impress-packed";
142 /** Definitions for matching parts of URIs.
144 #define INETTYPE_URL_PROT_DATA "data"
145 #define INETTYPE_URL_PROT_FILE "file"
146 #define INETTYPE_URL_PROT_HTTP "http"
147 #define INETTYPE_URL_PROT_HTTPS "https"
148 #define INETTYPE_URL_PROT_MACRO "macro"
149 #define INETTYPE_URL_PROT_MAILTO "mailto"
150 #define INETTYPE_URL_PROT_PRIVATE "private"
154 CONTENT_TYPE_UNKNOWN
,
155 CONTENT_TYPE_APP_OCTSTREAM
,
156 CONTENT_TYPE_APP_PDF
,
157 CONTENT_TYPE_APP_RTF
,
158 CONTENT_TYPE_APP_MSWORD
,
159 CONTENT_TYPE_APP_MSWORD_TEMPL
,
160 CONTENT_TYPE_APP_STARCALC
,
161 CONTENT_TYPE_APP_STARCHART
,
162 CONTENT_TYPE_APP_STARDRAW
,
163 CONTENT_TYPE_APP_STARHELP
,
164 CONTENT_TYPE_APP_STARIMAGE
,
165 CONTENT_TYPE_APP_STARIMPRESS
,
166 CONTENT_TYPE_APP_STARMATH
,
167 CONTENT_TYPE_APP_STARWRITER
,
168 CONTENT_TYPE_APP_ZIP
,
169 CONTENT_TYPE_AUDIO_AIFF
,
170 CONTENT_TYPE_AUDIO_BASIC
,
171 CONTENT_TYPE_AUDIO_MIDI
,
172 CONTENT_TYPE_AUDIO_VORBIS
,
173 CONTENT_TYPE_AUDIO_WAV
,
174 CONTENT_TYPE_AUDIO_WEBM
,
175 CONTENT_TYPE_IMAGE_GIF
,
176 CONTENT_TYPE_IMAGE_JPEG
,
177 CONTENT_TYPE_IMAGE_PCX
,
178 CONTENT_TYPE_IMAGE_PNG
,
179 CONTENT_TYPE_IMAGE_TIFF
,
180 CONTENT_TYPE_IMAGE_BMP
,
181 CONTENT_TYPE_IMAGE_WEBP
,
182 CONTENT_TYPE_TEXT_HTML
,
183 CONTENT_TYPE_TEXT_PLAIN
,
184 CONTENT_TYPE_TEXT_URL
,
185 CONTENT_TYPE_TEXT_VCARD
,
186 CONTENT_TYPE_VIDEO_MSVIDEO
,
187 CONTENT_TYPE_VIDEO_THEORA
,
188 CONTENT_TYPE_VIDEO_VDO
,
189 CONTENT_TYPE_VIDEO_WEBM
,
190 CONTENT_TYPE_X_CNT_FSYSBOX
,
191 CONTENT_TYPE_X_CNT_FSYSFOLDER
,
192 CONTENT_TYPE_X_STARMAIL
,
194 CONTENT_TYPE_APP_GALLERY
,
195 CONTENT_TYPE_APP_GALLERY_THEME
,
196 CONTENT_TYPE_APP_STARWRITER_GLOB
,
197 CONTENT_TYPE_APP_STARMAIL_SDM
,
198 CONTENT_TYPE_APP_STARMAIL_SMD
,
199 CONTENT_TYPE_APP_VND_CALC
,
200 CONTENT_TYPE_APP_VND_CHART
,
201 CONTENT_TYPE_APP_VND_DRAW
,
202 CONTENT_TYPE_APP_VND_IMAGE
,
203 CONTENT_TYPE_APP_VND_IMPRESS
,
204 CONTENT_TYPE_APP_VND_MAIL
,
205 CONTENT_TYPE_APP_VND_MATH
,
206 CONTENT_TYPE_APP_VND_WRITER
,
207 CONTENT_TYPE_APP_VND_WRITER_GLOBAL
,
208 CONTENT_TYPE_APP_VND_WRITER_WEB
,
209 CONTENT_TYPE_APP_FRAMESET
,
210 CONTENT_TYPE_APP_MACRO
,
211 CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER
,
212 CONTENT_TYPE_APP_VND_TEMPLATE
,
213 CONTENT_TYPE_IMAGE_GENERIC
,
214 CONTENT_TYPE_APP_VND_NEWS
,
215 CONTENT_TYPE_APP_VND_OUTTRAY
,
216 CONTENT_TYPE_APP_MSEXCEL
,
217 CONTENT_TYPE_APP_MSEXCEL_TEMPL
,
218 CONTENT_TYPE_APP_MSPPOINT
,
219 CONTENT_TYPE_APP_MSPPOINT_TEMPL
,
220 CONTENT_TYPE_TEXT_VCALENDAR
,
221 CONTENT_TYPE_TEXT_ICALENDAR
,
222 CONTENT_TYPE_TEXT_XMLICALENDAR
,
223 CONTENT_TYPE_APP_CDE_CALENDAR_APP
,
224 CONTENT_TYPE_INET_MESSAGE_RFC822
,
225 CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE
,
226 CONTENT_TYPE_INET_MULTIPART_DIGEST
,
227 CONTENT_TYPE_INET_MULTIPART_PARALLEL
,
228 CONTENT_TYPE_INET_MULTIPART_RELATED
,
229 CONTENT_TYPE_INET_MULTIPART_MIXED
,
230 CONTENT_TYPE_APP_VND_IMPRESSPACKED
,
231 CONTENT_TYPE_APP_JAR
,
232 CONTENT_TYPE_APP_VND_SUN_XML_WRITER
,
233 CONTENT_TYPE_APP_VND_SUN_XML_CALC
,
234 CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
,
235 CONTENT_TYPE_APP_VND_SUN_XML_DRAW
,
236 CONTENT_TYPE_APP_VND_SUN_XML_CHART
,
237 CONTENT_TYPE_APP_VND_SUN_XML_MATH
,
238 CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL
,
239 CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
,
240 CONTENT_TYPE_LAST
= CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
243 class SVL_DLLPUBLIC INetContentTypes
246 static INetContentType
GetContentType(OUString
const& rTypeName
);
248 static OUString
GetContentType(INetContentType eTypeID
);
250 static INetContentType
GetContentType4Extension(OUString
const& rExtension
);
252 static INetContentType
GetContentTypeFromURL(std::u16string_view aURL
);
254 static bool GetExtensionFromURL(std::u16string_view rURL
, OUString
& rExtension
);
256 static bool parse(OUString
const& rMediaType
, OUString
& rType
, OUString
& rSubType
,
257 INetContentTypeParameterList
* pParameters
= nullptr);
260 #endif // INCLUDED_SVL_INETTYPE_HXX
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */