1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: inettype.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
33 #include <tools/table.hxx>
34 #include <tools/wldcrd.hxx>
35 #include <svtools/inettype.hxx>
36 #include <svtools/svtdata.hxx>
38 #include <svtools/svtools.hrc>
41 #ifndef _SVSTDARR_STRINGSSORT_DECL
42 #define _SVSTDARR_STRINGSSORT
43 #include <svtools/svstdarr.hxx>
44 #undef _SVSTDARR_STRINGSSORT
47 namespace unnamed_svtools_inettype
{}
48 using namespace unnamed_svtools_inettype
;
49 // unnamed namespaces don't work well yet
51 //============================================================================
52 namespace unnamed_svtools_inettype
{
54 //============================================================================
57 sal_Char
const * m_pTypeName
;
58 INetContentType m_eTypeID
;
59 sal_Char
const * m_pExtension
;
62 //============================================================================
65 UniString m_aTypeName
;
66 UniString m_aPresentation
;
67 UniString m_aSystemFileType
;
70 //============================================================================
71 struct TypeNameMapEntry
: public UniString
73 UniString m_aExtension
;
74 INetContentType m_eTypeID
;
76 TypeNameMapEntry(const UniString
& rType
):
77 UniString(rType
), m_eTypeID(CONTENT_TYPE_UNKNOWN
) {}
80 //============================================================================
81 struct ExtensionMapEntry
: public UniString
83 INetContentType m_eTypeID
;
85 ExtensionMapEntry(const UniString
& rExt
):
86 UniString(rExt
), m_eTypeID(CONTENT_TYPE_UNKNOWN
) {}
89 //============================================================================
92 static Registration
* m_pRegistration
;
94 Table m_aTypeIDMap
; // map TypeID to TypeName, Presentation
95 SvStringsSort m_aTypeNameMap
; // map TypeName to TypeID, Extension
96 SvStringsSort m_aExtensionMap
; // map Extension to TypeID
97 sal_uInt32 m_nNextDynamicID
;
100 Registration(): m_nNextDynamicID(CONTENT_TYPE_LAST
+ 1) {}
104 static inline void deinitialize();
106 static inline TypeIDMapEntry
* getEntry(INetContentType eTypeID
);
108 static TypeNameMapEntry
* getExtensionEntry(UniString
const & rTypeName
);
110 static INetContentType
RegisterContentType(UniString
const & rTypeName
,
113 UniString
const * pExtension
,
117 static INetContentType
GetContentType(UniString
const & rTypeName
);
119 static UniString
GetContentType(INetContentType eTypeID
);
121 static UniString
GetPresentation(INetContentType eTypeID
);
123 static UniString
GetExtension(const UniString
& rTypeName
);
125 static INetContentType
GetContentType4Extension(UniString
const &
131 inline void Registration::deinitialize()
133 delete m_pRegistration
;
138 inline TypeIDMapEntry
* Registration::getEntry(INetContentType eTypeID
)
142 static_cast< TypeIDMapEntry
* >(m_pRegistration
->
143 m_aTypeIDMap
.Get(eTypeID
)) :
147 //============================================================================
148 MediaTypeEntry
const * seekEntry(UniString
const & rTypeName
,
149 MediaTypeEntry
const * pMap
, sal_Size nSize
);
151 //============================================================================
152 /** A mapping from type names to type ids and extensions. Sorted by type
155 MediaTypeEntry
const aStaticTypeNameMap
[CONTENT_TYPE_LAST
+ 1]
156 = { { " ", CONTENT_TYPE_UNKNOWN
, "" },
157 { CONTENT_TYPE_STR_X_CNT_DOCUMENT
, CONTENT_TYPE_X_CNT_DOCUMENT
,
159 { CONTENT_TYPE_STR_X_CNT_FSYSBOX
, CONTENT_TYPE_X_CNT_FSYSBOX
, "tmp" },
160 { CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME
,
161 CONTENT_TYPE_X_CNT_CDROM_VOLUME
, "tmp" },
162 { CONTENT_TYPE_STR_X_CNT_DISK_35
, CONTENT_TYPE_X_CNT_DISK_35
, "tmp" },
163 { CONTENT_TYPE_STR_X_CNT_DISK_525
, CONTENT_TYPE_X_CNT_DISK_525
,
165 { CONTENT_TYPE_STR_X_CNT_FSYSFILE
, CONTENT_TYPE_X_CNT_FSYSFILE
,
167 { CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME
,
168 CONTENT_TYPE_X_CNT_FIXED_VOLUME
, "tmp" },
169 { CONTENT_TYPE_STR_X_CNT_FSYSFOLDER
, CONTENT_TYPE_X_CNT_FSYSFOLDER
,
171 { CONTENT_TYPE_STR_X_CNT_RAM_VOLUME
, CONTENT_TYPE_X_CNT_RAM_VOLUME
,
173 { CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME
,
174 CONTENT_TYPE_X_CNT_REMOTE_VOLUME
, "tmp" },
175 { CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME
,
176 CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME
, "tmp" },
177 { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE
,
178 CONTENT_TYPE_X_CNT_FSYSSPECIALFILE
, "tmp" },
179 { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER
,
180 CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER
, "tmp" },
181 { CONTENT_TYPE_STR_X_CNT_TAPEDRIVE
, CONTENT_TYPE_X_CNT_TAPEDRIVE
,
183 { CONTENT_TYPE_STR_X_CNT_FSYSURLFILE
, CONTENT_TYPE_X_CNT_FSYSURLFILE
,
185 { CONTENT_TYPE_STR_X_CNT_FTPBOX
, CONTENT_TYPE_X_CNT_FTPBOX
, "tmp" },
186 { CONTENT_TYPE_STR_X_CNT_FTPFILE
, CONTENT_TYPE_X_CNT_FTPFILE
, "tmp" },
187 { CONTENT_TYPE_STR_X_CNT_FTPFOLDER
, CONTENT_TYPE_X_CNT_FTPFOLDER
,
189 { CONTENT_TYPE_STR_X_CNT_FTPLINK
, CONTENT_TYPE_X_CNT_FTPLINK
, "tmp" },
190 { CONTENT_TYPE_STR_X_CNT_HTTPBOX
, CONTENT_TYPE_X_CNT_HTTPBOX
, "tmp" },
191 { CONTENT_TYPE_STR_X_CNT_HTTPFILE
, CONTENT_TYPE_X_CNT_HTTPFILE
,
193 { CONTENT_TYPE_STR_X_CNT_IMAPBOX
, CONTENT_TYPE_X_CNT_IMAPBOX
, "tmp" },
194 { CONTENT_TYPE_STR_X_CNT_IMAPFOLDER
, CONTENT_TYPE_X_CNT_IMAPFOLDER
,
196 { CONTENT_TYPE_STR_X_CNT_MESSAGE
, CONTENT_TYPE_X_CNT_MESSAGE
, "tmp" },
197 { CONTENT_TYPE_STR_X_CNT_NEWSBOX
, CONTENT_TYPE_X_CNT_NEWSBOX
, "tmp" },
198 { CONTENT_TYPE_STR_X_CNT_NEWSGROUP
, CONTENT_TYPE_X_CNT_NEWSGROUP
,
200 { CONTENT_TYPE_STR_X_CNT_OUTBOX
, CONTENT_TYPE_X_CNT_OUTBOX
, "tmp" },
201 { CONTENT_TYPE_STR_X_CNT_POP3BOX
, CONTENT_TYPE_X_CNT_POP3BOX
, "tmp" },
202 { CONTENT_TYPE_STR_X_CNT_PUBLISHBOX
, CONTENT_TYPE_X_CNT_PUBLISHBOX
,
204 { CONTENT_TYPE_STR_X_CNT_SEARCHBOX
, CONTENT_TYPE_X_CNT_SEARCHBOX
,
206 { CONTENT_TYPE_STR_X_CNT_SEPARATOR
, CONTENT_TYPE_X_CNT_SEPARATOR
,
208 { CONTENT_TYPE_STR_X_CNT_BOOKMARK
, CONTENT_TYPE_X_CNT_BOOKMARK
,
210 { CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX
,
211 CONTENT_TYPE_X_CNT_SUBSCRIBEBOX
, "tmp" },
212 { CONTENT_TYPE_STR_X_CNT_CDF
, CONTENT_TYPE_X_CNT_CDF
, "tmp" },
213 { CONTENT_TYPE_STR_X_CNT_CDFITEM
, CONTENT_TYPE_X_CNT_CDFITEM
, "tmp" },
214 { CONTENT_TYPE_STR_X_CNT_CDFSUB
, CONTENT_TYPE_X_CNT_CDFSUB
, "tmp" },
215 { CONTENT_TYPE_STR_X_CNT_STARCHANNEL
, CONTENT_TYPE_X_CNT_STARCHANNEL
,
217 { CONTENT_TYPE_STR_X_CNT_TRASHBOX
, CONTENT_TYPE_X_CNT_TRASHBOX
,
219 { CONTENT_TYPE_STR_X_CNT_TRASH
, CONTENT_TYPE_X_CNT_TRASH
, "tmp" },
220 { CONTENT_TYPE_STR_X_CNT_VIMBBOARD
, CONTENT_TYPE_X_CNT_VIMBBOARD
,
222 { CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX
,
223 CONTENT_TYPE_X_CNT_VIMBBOARDBOX
, "tmp" },
224 { CONTENT_TYPE_STR_X_CNT_VIMBOX
, CONTENT_TYPE_X_CNT_VIMBOX
, "tmp" },
225 { CONTENT_TYPE_STR_X_CNT_VIMINBOX
, CONTENT_TYPE_X_CNT_VIMINBOX
,
227 { CONTENT_TYPE_STR_APP_OCTSTREAM
, CONTENT_TYPE_APP_OCTSTREAM
, "tmp" },
228 { CONTENT_TYPE_STR_APP_PDF
, CONTENT_TYPE_APP_PDF
, "pdf" },
229 { CONTENT_TYPE_STR_APP_RTF
, CONTENT_TYPE_APP_RTF
, "rtf" },
230 { CONTENT_TYPE_STR_APP_VND_CALC
, CONTENT_TYPE_APP_VND_CALC
, "sdc" },
231 { CONTENT_TYPE_STR_APP_VND_CHART
, CONTENT_TYPE_APP_VND_CHART
, "sds" },
232 { CONTENT_TYPE_STR_APP_VND_DRAW
, CONTENT_TYPE_APP_VND_DRAW
, "sda" },
233 { CONTENT_TYPE_STR_APP_VND_IMAGE
, CONTENT_TYPE_APP_VND_IMAGE
, "sim" },
234 { CONTENT_TYPE_STR_APP_VND_IMPRESS
, CONTENT_TYPE_APP_VND_IMPRESS
,
236 { CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED
,
237 CONTENT_TYPE_APP_VND_IMPRESSPACKED
, "sdp" },
238 { CONTENT_TYPE_STR_APP_VND_MAIL
, CONTENT_TYPE_APP_VND_MAIL
, "sdm" },
239 { CONTENT_TYPE_STR_APP_VND_MATH
, CONTENT_TYPE_APP_VND_MATH
, "smf" },
240 { CONTENT_TYPE_STR_APP_VND_NEWS
, CONTENT_TYPE_APP_VND_NEWS
, "sdm" },
241 { CONTENT_TYPE_STR_APP_VND_OUTTRAY
, CONTENT_TYPE_APP_VND_OUTTRAY
,
243 { CONTENT_TYPE_STR_APP_VND_TEMPLATE
, CONTENT_TYPE_APP_VND_TEMPLATE
,
245 { CONTENT_TYPE_STR_APP_VND_WRITER
, CONTENT_TYPE_APP_VND_WRITER
,
247 { CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL
,
248 CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "sgl" },
249 { CONTENT_TYPE_STR_APP_VND_WRITER_WEB
,
250 CONTENT_TYPE_APP_VND_WRITER_WEB
, "htm" },
251 { CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC
, CONTENT_TYPE_APP_VND_SUN_XML_CALC
, "sxc" },
252 { CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART
, CONTENT_TYPE_APP_VND_SUN_XML_CHART
, "sxs" },
253 { CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW
, CONTENT_TYPE_APP_VND_SUN_XML_DRAW
, "sxd" },
254 { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS
, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
, "sxi" },
255 { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED
, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
, "sxp" },
256 { CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH
, CONTENT_TYPE_APP_VND_SUN_XML_MATH
, "sxm" },
257 { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER
, CONTENT_TYPE_APP_VND_SUN_XML_WRITER
, "sxw" },
258 { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL
, CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL
, "sxg" },
259 { CONTENT_TYPE_STR_APP_FRAMESET
, CONTENT_TYPE_APP_FRAMESET
, "sfs" },
260 { CONTENT_TYPE_STR_APP_GALLERY
, CONTENT_TYPE_APP_GALLERY
, "gal" },
261 { CONTENT_TYPE_STR_APP_GALLERY_THEME
, CONTENT_TYPE_APP_GALLERY_THEME
,
263 { CONTENT_TYPE_STR_APP_JAR
, CONTENT_TYPE_APP_JAR
, "jar" },
264 { CONTENT_TYPE_STR_APP_MACRO
, CONTENT_TYPE_APP_MACRO
, "tmp" },
265 { CONTENT_TYPE_STR_APP_MSEXCEL
, CONTENT_TYPE_APP_MSEXCEL
, "xls" },
266 { CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL
, CONTENT_TYPE_APP_MSEXCEL_TEMPL
,
268 { CONTENT_TYPE_STR_APP_MSPPOINT
, CONTENT_TYPE_APP_MSPPOINT
, "ppt" },
269 { CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL
,
270 CONTENT_TYPE_APP_MSPPOINT_TEMPL
, "pot" },
271 { CONTENT_TYPE_STR_APP_MSWORD
, CONTENT_TYPE_APP_MSWORD
, "doc" },
272 { CONTENT_TYPE_STR_APP_MSWORD_TEMPL
, CONTENT_TYPE_APP_MSWORD_TEMPL
,
274 { CONTENT_TYPE_STR_APP_SCHEDULE_CMB
, CONTENT_TYPE_APP_SCHEDULE
,
276 { CONTENT_TYPE_STR_APP_SCHEDULE_EVT
, CONTENT_TYPE_APP_SCHEDULE_EVT
,
278 { CONTENT_TYPE_STR_APP_SCHEDULE_FEVT
,
279 CONTENT_TYPE_APP_SCHEDULE_FORM_EVT
, "tmp" },
280 { CONTENT_TYPE_STR_APP_SCHEDULE_FTASK
,
281 CONTENT_TYPE_APP_SCHEDULE_FORM_TASK
, "tmp" },
282 { CONTENT_TYPE_STR_APP_SCHEDULE_TASK
, CONTENT_TYPE_APP_SCHEDULE_TASK
,
284 { CONTENT_TYPE_STR_APP_STARCALC
, CONTENT_TYPE_APP_STARCALC
, "sdc" },
285 { CONTENT_TYPE_STR_APP_STARCHART
, CONTENT_TYPE_APP_STARCHART
, "sds" },
286 { CONTENT_TYPE_STR_APP_STARDRAW
, CONTENT_TYPE_APP_STARDRAW
, "sda" },
287 { CONTENT_TYPE_STR_APP_STARHELP
, CONTENT_TYPE_APP_STARHELP
, "svh" },
288 { CONTENT_TYPE_STR_APP_STARIMAGE
, CONTENT_TYPE_APP_STARIMAGE
, "sim" },
289 { CONTENT_TYPE_STR_APP_STARIMPRESS
, CONTENT_TYPE_APP_STARIMPRESS
,
291 { CONTENT_TYPE_STR_APP_STARMAIL_SDM
, CONTENT_TYPE_APP_STARMAIL_SDM
,
293 { CONTENT_TYPE_STR_APP_STARMAIL_SMD
, CONTENT_TYPE_APP_STARMAIL_SMD
,
295 { CONTENT_TYPE_STR_APP_STARMATH
, CONTENT_TYPE_APP_STARMATH
, "smf" },
296 { CONTENT_TYPE_STR_APP_STARWRITER
, CONTENT_TYPE_APP_STARWRITER
,
298 { CONTENT_TYPE_STR_APP_STARWRITER_GLOB
,
299 CONTENT_TYPE_APP_STARWRITER_GLOB
, "sgl" },
300 { CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP
,
301 CONTENT_TYPE_APP_CDE_CALENDAR_APP
, "appt" },
302 { CONTENT_TYPE_STR_APP_ZIP
, CONTENT_TYPE_APP_ZIP
, "zip" },
303 { CONTENT_TYPE_STR_AUDIO_AIFF
, CONTENT_TYPE_AUDIO_AIFF
, "aif" },
304 { CONTENT_TYPE_STR_AUDIO_BASIC
, CONTENT_TYPE_AUDIO_BASIC
, "au" },
305 { CONTENT_TYPE_STR_AUDIO_MIDI
, CONTENT_TYPE_AUDIO_MIDI
, "mid" },
306 { CONTENT_TYPE_STR_AUDIO_VORBIS
, CONTENT_TYPE_AUDIO_VORBIS
, "ogg" },
307 { CONTENT_TYPE_STR_AUDIO_WAV
, CONTENT_TYPE_AUDIO_WAV
, "wav" },
308 { CONTENT_TYPE_STR_IMAGE_GENERIC
, CONTENT_TYPE_IMAGE_GENERIC
, "tmp" },
309 { CONTENT_TYPE_STR_IMAGE_GIF
, CONTENT_TYPE_IMAGE_GIF
, "gif" },
310 { CONTENT_TYPE_STR_IMAGE_JPEG
, CONTENT_TYPE_IMAGE_JPEG
, "jpg" },
311 { CONTENT_TYPE_STR_IMAGE_PCX
, CONTENT_TYPE_IMAGE_PCX
, "pcx" },
312 { CONTENT_TYPE_STR_IMAGE_PNG
, CONTENT_TYPE_IMAGE_PNG
, "png" },
313 { CONTENT_TYPE_STR_IMAGE_TIFF
, CONTENT_TYPE_IMAGE_TIFF
, "tif" },
314 { CONTENT_TYPE_STR_IMAGE_BMP
, CONTENT_TYPE_IMAGE_BMP
, "bmp" },
315 { CONTENT_TYPE_STR_INET_MSG_RFC822
, CONTENT_TYPE_INET_MESSAGE_RFC822
,
317 { CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE
,
318 CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE
, "tmp" },
319 { CONTENT_TYPE_STR_INET_MULTI_DIGEST
,
320 CONTENT_TYPE_INET_MULTIPART_DIGEST
, "tmp" },
321 { CONTENT_TYPE_STR_INET_MULTI_MIXED
,
322 CONTENT_TYPE_INET_MULTIPART_MIXED
, "tmp" },
323 { CONTENT_TYPE_STR_INET_MULTI_PARALLEL
,
324 CONTENT_TYPE_INET_MULTIPART_PARALLEL
, "tmp" },
325 { CONTENT_TYPE_STR_INET_MULTI_RELATED
,
326 CONTENT_TYPE_INET_MULTIPART_RELATED
, "tmp" },
327 { CONTENT_TYPE_STR_TEXT_ICALENDAR
, CONTENT_TYPE_TEXT_ICALENDAR
,
329 { CONTENT_TYPE_STR_TEXT_HTML
, CONTENT_TYPE_TEXT_HTML
, "htm" },
330 { CONTENT_TYPE_STR_TEXT_PLAIN
, CONTENT_TYPE_TEXT_PLAIN
, "txt" },
331 { CONTENT_TYPE_STR_TEXT_XMLICALENDAR
, CONTENT_TYPE_TEXT_XMLICALENDAR
,
333 { CONTENT_TYPE_STR_TEXT_URL
, CONTENT_TYPE_TEXT_URL
, "url" },
334 { CONTENT_TYPE_STR_TEXT_VCALENDAR
, CONTENT_TYPE_TEXT_VCALENDAR
,
336 { CONTENT_TYPE_STR_TEXT_VCARD
, CONTENT_TYPE_TEXT_VCARD
, "vcf" },
337 { CONTENT_TYPE_STR_VIDEO_THEORA
, CONTENT_TYPE_VIDEO_THEORA
, "ogg" },
338 { CONTENT_TYPE_STR_VIDEO_VDO
, CONTENT_TYPE_VIDEO_VDO
, "vdo" },
339 { CONTENT_TYPE_STR_VIDEO_MSVIDEO
, CONTENT_TYPE_VIDEO_MSVIDEO
, "avi" },
340 { CONTENT_TYPE_STR_X_STARMAIL
, CONTENT_TYPE_X_STARMAIL
, "smd" },
341 { CONTENT_TYPE_STR_X_VRML
, CONTENT_TYPE_X_VRML
, "wrl" }
344 //============================================================================
345 /** A mapping from type IDs to presentation resource IDs. Sorted by type ID.
347 USHORT
const aStaticResourceIDMap
[CONTENT_TYPE_LAST
+ 1]
348 = { STR_SVT_MIMETYPE_APP_OCTSTREAM
, // CONTENT_TYPE_UNKNOWN
349 STR_SVT_MIMETYPE_APP_OCTSTREAM
, // CONTENT_TYPE_APP_OCTSTREAM
350 STR_SVT_MIMETYPE_APP_PDF
, // CONTENT_TYPE_APP_PDF
351 STR_SVT_MIMETYPE_APP_RTF
, // CONTENT_TYPE_APP_RTF
352 STR_SVT_MIMETYPE_APP_MSWORD
, // CONTENT_TYPE_APP_MSWORD
353 STR_SVT_MIMETYPE_APP_MSWORD
, // CONTENT_TYPE_APP_MSWORD_TEMPL //@todo new presentation string?
354 STR_SVT_MIMETYPE_APP_STARCALC
, // CONTENT_TYPE_APP_STARCALC
355 STR_SVT_MIMETYPE_APP_STARCHART
, // CONTENT_TYPE_APP_STARCHART
356 STR_SVT_MIMETYPE_APP_STARDRAW
, // CONTENT_TYPE_APP_STARDRAW
357 STR_SVT_MIMETYPE_APP_STARHELP
, // CONTENT_TYPE_APP_STARHELP
358 STR_SVT_MIMETYPE_APP_STARIMAGE
, // CONTENT_TYPE_APP_STARIMAGE
359 STR_SVT_MIMETYPE_APP_STARIMPRESS
, // CONTENT_TYPE_APP_STARIMPRESS
360 STR_SVT_MIMETYPE_APP_STARMATH
, // CONTENT_TYPE_APP_STARMATH
361 STR_SVT_MIMETYPE_APP_STARWRITER
, // CONTENT_TYPE_APP_STARWRITER
362 STR_SVT_MIMETYPE_APP_ZIP
, // CONTENT_TYPE_APP_ZIP
363 STR_SVT_MIMETYPE_AUDIO_AIFF
, // CONTENT_TYPE_AUDIO_AIFF
364 STR_SVT_MIMETYPE_AUDIO_BASIC
, // CONTENT_TYPE_AUDIO_BASIC
365 STR_SVT_MIMETYPE_AUDIO_MIDI
, // CONTENT_TYPE_AUDIO_MIDI
366 STR_SVT_MIMETYPE_AUDIO_VORBIS
, // CONTENT_TYPE_AUDIO_VORBIS
367 STR_SVT_MIMETYPE_AUDIO_WAV
, // CONTENT_TYPE_AUDIO_WAV
368 STR_SVT_MIMETYPE_IMAGE_GIF
, // CONTENT_TYPE_IMAGE_GIF
369 STR_SVT_MIMETYPE_IMAGE_JPEG
, // CONTENT_TYPE_IMAGE_JPEG
370 STR_SVT_MIMETYPE_IMAGE_PCX
, // CONTENT_TYPE_IMAGE_PCX
371 STR_SVT_MIMETYPE_IMAGE_PNG
, // CONTENT_TYPE_IMAGE_PNG
372 STR_SVT_MIMETYPE_IMAGE_TIFF
, // CONTENT_TYPE_IMAGE_TIFF
373 STR_SVT_MIMETYPE_IMAGE_BMP
, // CONTENT_TYPE_IMAGE_BMP
374 STR_SVT_MIMETYPE_TEXT_HTML
, // CONTENT_TYPE_TEXT_HTML
375 STR_SVT_MIMETYPE_TEXT_PLAIN
, // CONTENT_TYPE_TEXT_PLAIN
376 STR_SVT_MIMETYPE_TEXT_URL
, // CONTENT_TYPE_TEXT_URL
377 STR_SVT_MIMETYPE_TEXT_VCARD
, // CONTENT_TYPE_TEXT_VCARD
378 STR_SVT_MIMETYPE_VIDEO_THEORA
, // CONTENT_TYPE_VIDEO_THEORA
379 STR_SVT_MIMETYPE_VIDEO_VDO
, // CONTENT_TYPE_VIDEO_VDO
380 STR_SVT_MIMETYPE_VIDEO_MSVIDEO
, // CONTENT_TYPE_VIDEO_MSVIDEO
381 STR_SVT_MIMETYPE_CNT_MSG
, // CONTENT_TYPE_X_CNT_MESSAGE
382 STR_SVT_MIMETYPE_CNT_DOCUMENT
, // CONTENT_TYPE_X_CNT_DOCUMENT
383 STR_SVT_MIMETYPE_CNT_POP3BOX
, // CONTENT_TYPE_X_CNT_POP3BOX
384 STR_SVT_MIMETYPE_CNT_IMAPBOX
, // CONTENT_TYPE_X_CNT_IMAPBOX
385 STR_SVT_MIMETYPE_CNT_IMAPFLD
, // CONTENT_TYPE_X_CNT_IMAPFOLDER
386 STR_SVT_MIMETYPE_CNT_VIMBOX
, // CONTENT_TYPE_X_CNT_VIMBOX
387 STR_SVT_MIMETYPE_CNT_VIMINBOX
, // CONTENT_TYPE_X_CNT_VIMINBOX
388 STR_SVT_MIMETYPE_CNT_BBBOX
, // CONTENT_TYPE_X_CNT_VIMBBOARDBOX
389 STR_SVT_MIMETYPE_CNT_VIM_BB
, // CONTENT_TYPE_X_CNT_VIMBBOARD
390 STR_SVT_MIMETYPE_CNT_NEWSBOX
, // CONTENT_TYPE_X_CNT_NEWSBOX
391 STR_SVT_MIMETYPE_CNT_NEWSGRP
, // CONTENT_TYPE_X_CNT_NEWSGROUP
392 STR_SVT_MIMETYPE_CNT_OUTBOX
, // CONTENT_TYPE_X_CNT_OUTBOX
393 STR_SVT_MIMETYPE_CNT_FTPBOX
, // CONTENT_TYPE_X_CNT_FTPBOX
394 STR_SVT_MIMETYPE_CNT_FTPFLD
, // CONTENT_TYPE_X_CNT_FTPFOLDER
395 STR_SVT_MIMETYPE_CNT_FTPFILE
, // CONTENT_TYPE_X_CNT_FTPFILE
396 STR_SVT_MIMETYPE_CNT_FTPLINK
, // CONTENT_TYPE_X_CNT_FTPLINK
397 STR_SVT_MIMETYPE_CNT_HTTPBOX
, // CONTENT_TYPE_X_CNT_HTTPBOX
398 STR_SVT_MIMETYPE_CNT_FSYSBOX
, // CONTENT_TYPE_X_CNT_FSYSBOX
399 STR_SVT_MIMETYPE_CNT_FSYSFLD
, // CONTENT_TYPE_X_CNT_FSYSFOLDER
400 STR_SVT_MIMETYPE_CNT_FSYSFILE
, // CONTENT_TYPE_X_CNT_FSYSFILE
401 STR_SVT_MIMETYPE_CNT_FSYSURLFILE
, // CONTENT_TYPE_X_CNT_FSYSURLFILE
402 STR_SVT_MIMETYPE_CNT_PUBLBOX
, // CONTENT_TYPE_X_CNT_PUBLISHBOX
403 STR_SVT_MIMETYPE_CNT_SRCHBOX
, // CONTENT_TYPE_X_CNT_SEARCHBOX
404 STR_SVT_MIMETYPE_CNT_SUBSCRBOX
, // CONTENT_TYPE_X_CNT_SUBSCRIBEBOX
405 STR_SVT_MIMETYPE_CNT_BOOKMARK
, // CONTENT_TYPE_X_CNT_BOOKMARK
406 STR_SVT_MIMETYPE_CNT_CDF
, // CONTENT_TYPE_X_CNT_CDF
407 STR_SVT_MIMETYPE_CNT_CDFSUB
, // CONTENT_TYPE_X_CNT_CDFSUB
408 STR_SVT_MIMETYPE_CNT_CDFITEM
, // CONTENT_TYPE_X_CNT_CDFITEM
409 STR_SVT_MIMETYPE_CNT_TRASHBOX
, // CONTENT_TYPE_X_CNT_TRASHBOX
410 STR_SVT_MIMETYPE_CNT_TRASH
, // CONTENT_TYPE_X_CNT_TRASH
411 STR_SVT_MIMETYPE_X_STARMAIL
, // CONTENT_TYPE_X_STARMAIL
412 STR_SVT_MIMETYPE_X_VRML
, // CONTENT_TYPE_X_VRML
413 STR_SVT_MIMETYPE_CNT_REMOV_VOL
,
414 // CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME
415 STR_SVT_MIMETYPE_CNT_FIX_VOL
, // CONTENT_TYPE_X_CNT_FIXED_VOLUME
416 STR_SVT_MIMETYPE_CNT_REM_VOL
, // CONTENT_TYPE_X_CNT_REMOTE_VOLUME
417 STR_SVT_MIMETYPE_CNT_RAM_VOL
, // CONTENT_TYPE_X_CNT_RAM_VOLUME
418 STR_SVT_MIMETYPE_CNT_CDROM
, // CONTENT_TYPE_X_CNT_CDROM_VOLUME
419 STR_SVT_MIMETYPE_CNT_DISK_35
, // CONTENT_TYPE_X_CNT_DISK_35
420 STR_SVT_MIMETYPE_CNT_DISK_525
, // CONTENT_TYPE_X_CNT_DISK_525
421 STR_SVT_MIMETYPE_CNT_TAPEDRIVE
, // CONTENT_TYPE_X_CNT_TAPEDRIVE
422 STR_SVT_MIMETYPE_APP_GAL
, // CONTENT_TYPE_APP_GALLERY
423 STR_SVT_MIMETYPE_APP_GAL_THEME
, // CONTENT_TYPE_APP_GALLERY_THEME
424 STR_SVT_MIMETYPE_CNT_STARCHANNEL
, // CONTENT_TYPE_X_CNT_STARCHANNEL
425 STR_SVT_MIMETYPE_CNT_SEPARATOR
, // CONTENT_TYPE_X_CNT_SEPARATOR
426 STR_SVT_MIMETYPE_APP_STARW_GLOB
, // CONTENT_TYPE_APP_STARWRITER_GLOB
427 STR_SVT_MIMETYPE_APP_SDM
, // CONTENT_TYPE_APP_STARMAIL_SDM
428 STR_SVT_MIMETYPE_APP_SMD
, // CONTENT_TYPE_APP_STARMAIL_SMD
429 STR_SVT_MIMETYPE_APP_STARCALC
, // CONTENT_TYPE_APP_VND_CALC
430 STR_SVT_MIMETYPE_APP_STARCHART
, // CONTENT_TYPE_APP_VND_CHART
431 STR_SVT_MIMETYPE_APP_STARDRAW
, // CONTENT_TYPE_APP_VND_DRAW
432 STR_SVT_MIMETYPE_APP_STARIMAGE
, // CONTENT_TYPE_APP_VND_IMAGE
433 STR_SVT_MIMETYPE_APP_STARIMPRESS
, // CONTENT_TYPE_APP_VND_IMPRESS
434 STR_SVT_MIMETYPE_X_STARMAIL
, // CONTENT_TYPE_APP_VND_MAIL
435 STR_SVT_MIMETYPE_APP_STARMATH
, // CONTENT_TYPE_APP_VND_MATH
436 STR_SVT_MIMETYPE_APP_STARWRITER
, // CONTENT_TYPE_APP_VND_WRITER
437 STR_SVT_MIMETYPE_APP_STARW_GLOB
, // CONTENT_TYPE_APP_VND_WRITER_GLOBAL
438 STR_SVT_MIMETYPE_APP_STARW_WEB
, // CONTENT_TYPE_APP_VND_WRITER_WEB
439 STR_SVT_MIMETYPE_SCHEDULE
, // CONTENT_TYPE_APP_SCHEDULE
440 STR_SVT_MIMETYPE_SCHEDULE_EVT
, // CONTENT_TYPE_APP_SCHEDULE_EVT
441 STR_SVT_MIMETYPE_SCHEDULE_TASK
, // CONTENT_TYPE_APP_SCHEDULE_TASK
442 STR_SVT_MIMETYPE_SCHEDULE_FEVT
, // CONTENT_TYPE_APP_SCHEDULE_FORM_EVT
443 STR_SVT_MIMETYPE_SCHEDULE_FTASK
,
444 // CONTENT_TYPE_APP_SCHEDULE_FORM_TASK
445 STR_SVT_MIMETYPE_FRAMESET
, // CONTENT_TYPE_APP_FRAMESET
446 STR_SVT_MIMETYPE_MACRO
, // CONTENT_TYPE_APP_MACRO
447 STR_SVT_MIMETYPE_CNT_SFSYSFOLDER
,
448 // CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER
449 STR_SVT_MIMETYPE_CNT_SFSYSFILE
, // CONTENT_TYPE_X_CNT_FSYSSPECIALFILE
450 STR_SVT_MIMETYPE_APP_TEMPLATE
, // CONTENT_TYPE_APP_VND_TEMPLATE
451 STR_SVT_MIMETYPE_IMAGE_GENERIC
, // CONTENT_TYPE_IMAGE_GENERIC
452 STR_SVT_MIMETYPE_X_STARMAIL
, // CONTENT_TYPE_APP_VND_NEWS
453 STR_SVT_MIMETYPE_X_STARMAIL
, // CONTENT_TYPE_APP_VND_OUTTRAY
454 STR_SVT_MIMETYPE_TEXT_HTML
, // CONTENT_TYPE_X_CNT_HTTPFILE
455 STR_SVT_MIMETYPE_APP_MSEXCEL
, // CONTENT_TYPE_APP_MSEXCEL
456 STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL
, // CONTENT_TYPE_APP_MSEXCEL_TEMPL
457 STR_SVT_MIMETYPE_APP_MSPPOINT
, // CONTENT_TYPE_APP_MSPPOINT
458 STR_SVT_MIMETYPE_APP_MSPPOINT
, // CONTENT_TYPE_APP_MSPPOINT_TEMPL //@todo new presentation string?
459 STR_SVT_MIMETYPE_TEXT_VCALENDAR
, // CONTENT_TYPE_TEXT_VCALENDAR
460 STR_SVT_MIMETYPE_TEXT_ICALENDAR
, // CONTENT_TYPE_TEXT_ICALENDAR
461 STR_SVT_MIMETYPE_TEXT_XMLICALENDAR
, // CONTENT_TYPE_TEXT_XMLICALENDAR
462 STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP
,
463 // CONTENT_TYPE_APP_CDE_CALENDAR_APP
464 STR_SVT_MIMETYPE_INET_MSG_RFC822
, // CONTENT_TYPE_INET_MESSAGE_RFC822
465 STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE
,
466 // CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE
467 STR_SVT_MIMETYPE_INET_MULTI_DIGEST
,
468 // CONTENT_TYPE_INET_MULTIPART_DIGEST
469 STR_SVT_MIMETYPE_INET_MULTI_PARALLEL
,
470 // CONTENT_TYPE_INET_MULTIPART_PARALLEL
471 STR_SVT_MIMETYPE_INET_MULTI_RELATED
,
472 // CONTENT_TYPE_INET_MULTIPART_RELATED
473 STR_SVT_MIMETYPE_INET_MULTI_MIXED
,
474 // CONTENT_TYPE_INET_MULTIPART_MIXED
475 STR_SVT_MIMETYPE_APP_IMPRESSPACKED
,
476 // CONTENT_TYPE_APP_VND_IMPRESSPACKED
477 STR_SVT_MIMETYPE_APP_JAR
, // CONTENT_TYPE_APP_JAR
478 STR_SVT_MIMETYPE_APP_SXWRITER
, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER
479 STR_SVT_MIMETYPE_APP_SXCALC
, // CONTENT_TYPE_APP_VND_SUN_XML_CALC
480 STR_SVT_MIMETYPE_APP_SXIMPRESS
, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
481 STR_SVT_MIMETYPE_APP_SXDRAW
, // CONTENT_TYPE_APP_VND_SUN_XML_DRAW
482 STR_SVT_MIMETYPE_APP_SXCHART
, // CONTENT_TYPE_APP_VND_SUN_XML_CHART
483 STR_SVT_MIMETYPE_APP_SXMATH
, // CONTENT_TYPE_APP_VND_SUN_XML_MATH
484 STR_SVT_MIMETYPE_APP_SXGLOBAL
, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL
485 STR_SVT_MIMETYPE_APP_SXIPACKED
, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
488 //============================================================================
489 /** A mapping from extensions to type IDs. Sorted by extension.
491 MediaTypeEntry
const aStaticExtensionMap
[]
492 = { { "aif", CONTENT_TYPE_AUDIO_AIFF
, "" },
493 { "aiff", CONTENT_TYPE_AUDIO_AIFF
, "" },
494 { "appt", CONTENT_TYPE_APP_CDE_CALENDAR_APP
, "" },
495 { "au", CONTENT_TYPE_AUDIO_BASIC
, "" },
496 { "avi", CONTENT_TYPE_VIDEO_MSVIDEO
, "" },
497 { "bmp", CONTENT_TYPE_IMAGE_BMP
, "" },
498 { "cgm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
499 { "doc", CONTENT_TYPE_APP_MSWORD
, "" },
500 { "dot", CONTENT_TYPE_APP_MSWORD_TEMPL
, "" },
501 { "dxf", CONTENT_TYPE_IMAGE_GENERIC
, "" },
502 { "eps", CONTENT_TYPE_IMAGE_GENERIC
, "" },
503 { "gal", CONTENT_TYPE_APP_GALLERY
, "" },
504 { "gif", CONTENT_TYPE_IMAGE_GIF
, "" },
505 { "htm", CONTENT_TYPE_TEXT_HTML
, "" },
506 { "html", CONTENT_TYPE_TEXT_HTML
, "" },
507 { "ics", CONTENT_TYPE_TEXT_ICALENDAR
, "" },
508 { "jar", CONTENT_TYPE_APP_JAR
, "" },
509 { "jpeg", CONTENT_TYPE_IMAGE_JPEG
, "" },
510 { "jpg", CONTENT_TYPE_IMAGE_JPEG
, "" },
511 { "met", CONTENT_TYPE_IMAGE_GENERIC
, "" },
512 { "mid", CONTENT_TYPE_AUDIO_MIDI
, "" },
513 { "midi", CONTENT_TYPE_AUDIO_MIDI
, "" },
514 { "ogg", CONTENT_TYPE_AUDIO_VORBIS
, "" },
515 { "pbm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
516 { "pcd", CONTENT_TYPE_IMAGE_GENERIC
, "" },
517 { "pct", CONTENT_TYPE_IMAGE_GENERIC
, "" },
518 { "pcx", CONTENT_TYPE_IMAGE_PCX
, "" },
519 { "pdf", CONTENT_TYPE_APP_PDF
, "" },
520 { "pgm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
521 { "png", CONTENT_TYPE_IMAGE_PNG
, "" },
522 { "pot", CONTENT_TYPE_APP_MSPPOINT_TEMPL
, "" },
523 { "ppm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
524 { "ppt", CONTENT_TYPE_APP_MSPPOINT
, "" },
525 { "psd", CONTENT_TYPE_IMAGE_GENERIC
, "" },
526 { "ras", CONTENT_TYPE_IMAGE_GENERIC
, "" },
527 { "rtf", CONTENT_TYPE_APP_RTF
, "" },
528 { "sda", CONTENT_TYPE_APP_VND_DRAW
, "" },
529 { "sdc", CONTENT_TYPE_APP_VND_CALC
, "" },
530 { "sdd", CONTENT_TYPE_APP_VND_IMPRESS
, "" },
531 { "sdm", CONTENT_TYPE_APP_VND_MAIL
, "" },
532 { "sdp", CONTENT_TYPE_APP_VND_IMPRESSPACKED
, "" },
533 { "sds", CONTENT_TYPE_APP_VND_CHART
, "" },
534 { "sdw", CONTENT_TYPE_APP_VND_WRITER
, "" },
535 { "sd~", CONTENT_TYPE_X_STARMAIL
, "" },
536 { "sfs", CONTENT_TYPE_APP_FRAMESET
, "" },
537 { "sgl", CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "" },
538 { "sim", CONTENT_TYPE_APP_VND_IMAGE
, "" },
539 { "smd", CONTENT_TYPE_APP_STARMAIL_SMD
, "" }, //CONTENT_TYPE_X_STARMAIL
540 { "smf", CONTENT_TYPE_APP_VND_MATH
, "" },
541 { "svh", CONTENT_TYPE_APP_STARHELP
, "" },
542 { "svm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
543 { "sxc", CONTENT_TYPE_APP_VND_SUN_XML_CALC
, "" },
544 { "sxd", CONTENT_TYPE_APP_VND_SUN_XML_DRAW
, "" },
545 { "sxg", CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL
, "" },
546 { "sxi", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
, "" },
547 { "sxm", CONTENT_TYPE_APP_VND_SUN_XML_MATH
, "" },
548 { "sxp", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
, "" },
549 { "sxs", CONTENT_TYPE_APP_VND_SUN_XML_CHART
, "" },
550 { "sxw", CONTENT_TYPE_APP_VND_SUN_XML_WRITER
, "" },
551 { "tga", CONTENT_TYPE_IMAGE_GENERIC
, "" },
552 { "thm", CONTENT_TYPE_APP_GALLERY_THEME
, "" },
553 { "tif", CONTENT_TYPE_IMAGE_TIFF
, "" },
554 { "tiff", CONTENT_TYPE_IMAGE_TIFF
, "" },
555 { "txt", CONTENT_TYPE_TEXT_PLAIN
, "" },
556 { "url", CONTENT_TYPE_TEXT_URL
, "" },
557 { "vcf", CONTENT_TYPE_TEXT_VCARD
, "" },
558 { "vcs", CONTENT_TYPE_TEXT_VCALENDAR
, "" },
559 { "vdo", CONTENT_TYPE_VIDEO_VDO
, "" },
560 { "vor", CONTENT_TYPE_APP_VND_TEMPLATE
, "" },
561 { "wav", CONTENT_TYPE_AUDIO_WAV
, "" },
562 { "wmf", CONTENT_TYPE_IMAGE_GENERIC
, "" },
563 { "wrl", CONTENT_TYPE_X_VRML
, "" },
564 { "xbm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
565 { "xcs", CONTENT_TYPE_TEXT_XMLICALENDAR
, "" },
566 { "xls", CONTENT_TYPE_APP_MSEXCEL
, "" },
567 { "xlt", CONTENT_TYPE_APP_MSEXCEL_TEMPL
, "" },
568 { "xlw", CONTENT_TYPE_APP_MSEXCEL
, "" },
569 { "xpm", CONTENT_TYPE_IMAGE_GENERIC
, "" },
570 { "zip", CONTENT_TYPE_APP_ZIP
, "" } };
572 //============================================================================
573 /** A mapping from presentations to type IDs. Sorted by presentations.
575 MediaTypeEntry
const aStaticPresentationMap
[]
576 = { { "Binary Data", CONTENT_TYPE_APP_OCTSTREAM
, "" },
577 { "Bitmap", CONTENT_TYPE_IMAGE_BMP
, "" },
578 { "DOS Command File", CONTENT_TYPE_APP_OCTSTREAM
, "" },
579 { "Digital Video", CONTENT_TYPE_VIDEO_MSVIDEO
, "" },
580 { "Executable", CONTENT_TYPE_APP_OCTSTREAM
, "" },
581 { "Grafik", CONTENT_TYPE_IMAGE_GENERIC
, "" },
582 { "HTM", CONTENT_TYPE_TEXT_HTML
, "" },
583 { "HTML", CONTENT_TYPE_TEXT_HTML
, "" },
584 { "Hypertext", CONTENT_TYPE_TEXT_HTML
, "" },
585 { "Icon", CONTENT_TYPE_IMAGE_GENERIC
, "" },
586 { "Image File", CONTENT_TYPE_IMAGE_GENERIC
, "" },
587 { "MIDI", CONTENT_TYPE_AUDIO_MIDI
, "" },
588 { "Master Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "" },
589 { "Plain Text", CONTENT_TYPE_TEXT_PLAIN
, "" },
590 { "StarCalc", CONTENT_TYPE_APP_VND_CALC
, "" },
591 { "StarCalc 3.0", CONTENT_TYPE_APP_VND_CALC
, "" },
592 { "StarCalc 4.0", CONTENT_TYPE_APP_VND_CALC
, "" },
593 { "StarCalc 5.0", CONTENT_TYPE_APP_VND_CALC
, "" },
594 { "StarCalc Datei", CONTENT_TYPE_APP_VND_CALC
, "" },
595 { "StarCalc Document", CONTENT_TYPE_APP_VND_CALC
, "" },
596 { "StarCalc File", CONTENT_TYPE_APP_VND_CALC
, "" },
597 { "StarChart 3.0", CONTENT_TYPE_APP_VND_CHART
, "" },
598 { "StarChart 4.0", CONTENT_TYPE_APP_VND_CHART
, "" },
599 { "StarChart 5.0", CONTENT_TYPE_APP_VND_CHART
, "" },
600 { "StarChart Document", CONTENT_TYPE_APP_VND_CHART
, "" },
601 { "StarDraw 3.0", CONTENT_TYPE_APP_VND_DRAW
, "" },
602 { "StarDraw 5.0", CONTENT_TYPE_APP_VND_DRAW
, "" },
603 { "StarDraw", CONTENT_TYPE_APP_VND_DRAW
, "" },
604 { "StarDraw Document", CONTENT_TYPE_APP_VND_DRAW
, "" },
605 { "StarImpress 4.0", CONTENT_TYPE_APP_VND_IMPRESS
, "" },
606 { "StarImpress 5.0 (packed)", CONTENT_TYPE_APP_VND_IMPRESSPACKED
, "" },
607 { "StarImpress 5.0", CONTENT_TYPE_APP_VND_IMPRESS
, "" },
608 { "StarImpress Document", CONTENT_TYPE_APP_VND_IMPRESS
, "" },
609 { "StarMath 3.0", CONTENT_TYPE_APP_VND_MATH
, "" },
610 { "StarMath 4.0", CONTENT_TYPE_APP_VND_MATH
, "" },
611 { "StarMath 5.0", CONTENT_TYPE_APP_VND_MATH
, "" },
612 { "StarMath Document", CONTENT_TYPE_APP_VND_MATH
, "" },
613 { "StarMessage5", CONTENT_TYPE_APP_VND_MAIL
, "" },
614 { "StarOffice XML (Calc)", CONTENT_TYPE_APP_VND_SUN_XML_CALC
, "" },
615 { "StarOffice XML (Impress)", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
, "" },
616 { "StarOffice XML (Draw)", CONTENT_TYPE_APP_VND_SUN_XML_DRAW
, "" },
617 { "StarOffice XML (Chart)", CONTENT_TYPE_APP_VND_SUN_XML_CHART
, "" },
618 { "StarOffice XML (Writer)", CONTENT_TYPE_APP_VND_SUN_XML_WRITER
, "" },
619 { "StarWriter", CONTENT_TYPE_APP_VND_WRITER
, "" },
620 { "StarWriter 3.0", CONTENT_TYPE_APP_VND_WRITER
, "" },
621 { "StarWriter 4.0", CONTENT_TYPE_APP_VND_WRITER
, "" },
622 { "StarWriter 5.0", CONTENT_TYPE_APP_VND_WRITER
, "" },
623 { "StarWriter Document", CONTENT_TYPE_APP_VND_WRITER
, "" },
624 { "StarWriter/Global 5.0", CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "" },
625 { "StarWriter/Global Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "" },
626 { "StarWriter/Web 5.0", CONTENT_TYPE_APP_VND_WRITER_WEB
, "" },
627 { "StarWriterGlobal Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL
, "" },
628 { "StarWriterHtml Document", CONTENT_TYPE_APP_VND_WRITER_WEB
, "" },
629 { "UniformResourceLocator", CONTENT_TYPE_TEXT_URL
, "" },
630 { "text/html", CONTENT_TYPE_TEXT_HTML
, "" } };
634 //============================================================================
638 //============================================================================
641 Registration
* Registration::m_pRegistration
= 0;
643 //============================================================================
644 Registration::~Registration()
646 {for (ULONG i
= 0; i
< m_aTypeIDMap
.Count(); ++i
)
647 delete static_cast< TypeIDMapEntry
* >(m_aTypeIDMap
.GetObject(i
));
649 m_aTypeIDMap
.Clear();
650 {for (USHORT i
= 0; i
< m_aTypeNameMap
.Count(); ++i
)
651 delete static_cast< TypeNameMapEntry
* >(m_aTypeNameMap
.GetObject(i
));
653 m_aTypeNameMap
.Remove(USHORT(0), m_aTypeNameMap
.Count());
654 {for (USHORT i
= 0; i
< m_aExtensionMap
.Count(); ++i
)
656 static_cast< ExtensionMapEntry
* >(m_aExtensionMap
.GetObject(i
));
658 m_aExtensionMap
.Remove(USHORT(0), m_aExtensionMap
.Count());
661 //============================================================================
663 TypeNameMapEntry
* Registration::getExtensionEntry(UniString
const &
668 UniString aTheTypeName
= rTypeName
;
669 aTheTypeName
.ToLowerAscii();
671 if (m_pRegistration
->m_aTypeNameMap
.Seek_Entry(&aTheTypeName
, &nPos
))
672 return static_cast< TypeNameMapEntry
* >(m_pRegistration
->
679 //============================================================================
681 INetContentType
Registration::RegisterContentType(UniString
const & rTypeName
,
689 if (!m_pRegistration
)
690 m_pRegistration
= new Registration
;
692 DBG_ASSERT(GetContentType(rTypeName
) == CONTENT_TYPE_UNKNOWN
,
693 "Registration::RegisterContentType(): Already registered");
695 INetContentType eTypeID
696 = INetContentType(m_pRegistration
->m_nNextDynamicID
++);
697 UniString aTheTypeName
= rTypeName
;
698 aTheTypeName
.ToLowerAscii();
700 TypeIDMapEntry
* pTypeIDMapEntry
= new TypeIDMapEntry
;
701 pTypeIDMapEntry
->m_aTypeName
= aTheTypeName
;
702 pTypeIDMapEntry
->m_aPresentation
= rPresentation
;
704 pTypeIDMapEntry
->m_aSystemFileType
= *pSystemFileType
;
705 m_pRegistration
->m_aTypeIDMap
.Insert(eTypeID
, pTypeIDMapEntry
);
707 TypeNameMapEntry
* pTypeNameMapEntry
= new TypeNameMapEntry(aTheTypeName
);
709 pTypeNameMapEntry
->m_aExtension
= *pExtension
;
710 pTypeNameMapEntry
->m_eTypeID
= eTypeID
;
711 m_pRegistration
->m_aTypeNameMap
.Insert(pTypeNameMapEntry
);
715 ExtensionMapEntry
* pExtensionMapEntry
716 = new ExtensionMapEntry(*pExtension
);
717 pExtensionMapEntry
->m_eTypeID
= eTypeID
;
718 m_pRegistration
->m_aExtensionMap
.Insert(pExtensionMapEntry
);
724 //============================================================================
726 INetContentType
Registration::GetContentType(UniString
const & rTypeName
)
728 if (!m_pRegistration
)
729 m_pRegistration
= new Registration
;
731 UniString aTheTypeName
= rTypeName
;
732 aTheTypeName
.ToLowerAscii();
734 return m_pRegistration
->m_aTypeNameMap
.Seek_Entry(&aTheTypeName
, &nPos
) ?
735 static_cast< TypeNameMapEntry
* >(m_pRegistration
->
739 CONTENT_TYPE_UNKNOWN
;
742 //============================================================================
744 UniString
Registration::GetContentType(INetContentType eTypeID
)
746 if (!m_pRegistration
)
747 m_pRegistration
= new Registration
;
749 TypeIDMapEntry
* pEntry
750 = static_cast< TypeIDMapEntry
* >(m_pRegistration
->
751 m_aTypeIDMap
.Get(eTypeID
));
752 return pEntry
? pEntry
->m_aTypeName
: UniString();
755 //============================================================================
757 UniString
Registration::GetPresentation(INetContentType eTypeID
)
759 if (!m_pRegistration
)
760 m_pRegistration
= new Registration
;
762 TypeIDMapEntry
* pEntry
763 = static_cast< TypeIDMapEntry
* >(m_pRegistration
->
764 m_aTypeIDMap
.Get(eTypeID
));
765 return pEntry
? pEntry
->m_aPresentation
: UniString();
768 //============================================================================
770 UniString
Registration::GetExtension(UniString
const & rTypeName
)
772 if (!m_pRegistration
)
773 m_pRegistration
= new Registration
;
775 UniString aTheTypeName
= rTypeName
;
776 aTheTypeName
.ToLowerAscii();
778 return m_pRegistration
->m_aTypeNameMap
.Seek_Entry(&aTheTypeName
, &nPos
) ?
779 static_cast< TypeNameMapEntry
* >(m_pRegistration
->
786 //============================================================================
788 INetContentType
Registration::GetContentType4Extension(UniString
const &
791 if (!m_pRegistration
)
792 m_pRegistration
= new Registration
;
795 return m_pRegistration
->
797 Seek_Entry(const_cast< UniString
* >(&rExtension
),
799 static_cast< ExtensionMapEntry
* >(m_pRegistration
->
803 CONTENT_TYPE_UNKNOWN
;
806 //============================================================================
810 //============================================================================
812 namespace unnamed_svtools_inettype
{
814 MediaTypeEntry
const * seekEntry(UniString
const & rTypeName
,
815 MediaTypeEntry
const * pMap
, sal_Size nSize
)
817 #if defined DBG_UTIL || defined INETTYPE_DEBUG
818 static bool bChecked
= false;
821 for (sal_Size i
= 0; i
< nSize
- 1; ++i
)
822 DBG_ASSERT(pMap
[i
].m_pTypeName
< pMap
[i
+ 1].m_pTypeName
,
823 "seekEntry(): Bad map");
826 #endif // DBG_UTIL, INETTYPE_DEBUG
829 sal_Size nHigh
= nSize
;
830 while (nLow
!= nHigh
)
832 sal_Size nMiddle
= (nLow
+ nHigh
) / 2;
833 MediaTypeEntry
const * pEntry
= pMap
+ nMiddle
;
834 switch (rTypeName
.CompareIgnoreCaseToAscii(pEntry
->m_pTypeName
))
843 case COMPARE_GREATER
:
853 //============================================================================
857 //============================================================================
860 void INetContentTypes::Uninitialize()
862 Registration::deinitialize();
865 //============================================================================
867 INetContentType
INetContentTypes::RegisterContentType(UniString
const &
876 INetContentType eTypeID
= GetContentType(rTypeName
);
877 if (eTypeID
== CONTENT_TYPE_UNKNOWN
)
878 eTypeID
= Registration::RegisterContentType(rTypeName
, rPresentation
,
881 else if (eTypeID
> CONTENT_TYPE_LAST
)
883 TypeIDMapEntry
* pTypeEntry
= Registration::getEntry(eTypeID
);
886 if (rPresentation
.Len() != 0)
887 pTypeEntry
->m_aPresentation
= rPresentation
;
889 pTypeEntry
->m_aSystemFileType
= *pSystemFileType
;
893 TypeNameMapEntry
* pEntry
894 = Registration::getExtensionEntry(rTypeName
);
896 pEntry
->m_aExtension
= *pExtension
;
902 //============================================================================
904 INetContentType
INetContentTypes::GetContentType(UniString
const & rTypeName
)
908 if (parse(rTypeName
, aType
, aSubType
))
912 MediaTypeEntry
const * pEntry
= seekEntry(aType
, aStaticTypeNameMap
,
913 CONTENT_TYPE_LAST
+ 1);
914 return pEntry
? pEntry
->m_eTypeID
:
915 Registration::GetContentType(aType
);
919 rTypeName
.EqualsIgnoreCaseAscii(CONTENT_TYPE_STR_X_STARMAIL
) ?
920 CONTENT_TYPE_X_STARMAIL
: CONTENT_TYPE_UNKNOWN
;
921 // the content type "x-starmail" has no sub type
924 //============================================================================
926 UniString
INetContentTypes::GetContentType(INetContentType eTypeID
)
928 static sal_Char
const * aMap
[CONTENT_TYPE_LAST
+ 1];
929 static bool bInitialized
= false;
932 for (sal_Size i
= 0; i
<= CONTENT_TYPE_LAST
; ++i
)
933 aMap
[aStaticTypeNameMap
[i
].m_eTypeID
]
934 = aStaticTypeNameMap
[i
].m_pTypeName
;
935 aMap
[CONTENT_TYPE_UNKNOWN
] = CONTENT_TYPE_STR_APP_OCTSTREAM
;
936 aMap
[CONTENT_TYPE_TEXT_PLAIN
] = CONTENT_TYPE_STR_TEXT_PLAIN
937 "; charset=iso-8859-1";
941 UniString aTypeName
= eTypeID
<= CONTENT_TYPE_LAST
?
942 UniString::CreateFromAscii(aMap
[eTypeID
]) :
943 Registration::GetContentType(eTypeID
);
944 if (aTypeName
.Len() == 0)
946 DBG_ERROR("INetContentTypes::GetContentType(): Bad ID");
948 UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
949 CONTENT_TYPE_STR_APP_OCTSTREAM
));
954 //============================================================================
956 UniString
INetContentTypes::GetPresentation(INetContentType eTypeID
,
957 const ::com::sun::star::lang::Locale
& aLocale
)
959 USHORT nResID
= USHORT();
960 if (eTypeID
<= CONTENT_TYPE_LAST
)
961 nResID
= aStaticResourceIDMap
[eTypeID
];
964 UniString aPresentation
= Registration::GetPresentation(eTypeID
);
965 if (aPresentation
.Len() == 0)
966 nResID
= STR_SVT_MIMETYPE_APP_OCTSTREAM
;
968 return aPresentation
;
970 return SvtSimpleResId(nResID
, aLocale
);
973 //============================================================================
975 UniString
INetContentTypes::GetExtension(UniString
const & rTypeName
)
977 MediaTypeEntry
const * pEntry
= seekEntry(rTypeName
, aStaticTypeNameMap
,
978 CONTENT_TYPE_LAST
+ 1);
980 return UniString::CreateFromAscii(pEntry
->m_pExtension
);
982 UniString aExtension
= Registration::GetExtension(rTypeName
);
983 if (aExtension
.Len() != 0)
985 // special handling of text types, which come in uncounted variations:
986 return rTypeName
.EqualsIgnoreCaseAscii("text", 0,
987 RTL_CONSTASCII_LENGTH("text")) ?
988 UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("txt")) :
989 UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("tmp"));
992 //============================================================================
994 INetContentType
INetContentTypes::GetContentType4Extension(UniString
const &
997 MediaTypeEntry
const * pEntry
= seekEntry(rExtension
, aStaticExtensionMap
,
998 sizeof aStaticExtensionMap
999 / sizeof (MediaTypeEntry
));
1001 return pEntry
->m_eTypeID
;
1002 INetContentType eTypeID
1003 = Registration::GetContentType4Extension(rExtension
);
1004 return eTypeID
== CONTENT_TYPE_UNKNOWN
? CONTENT_TYPE_APP_OCTSTREAM
:
1008 //============================================================================
1010 INetContentType
INetContentTypes::GetContentTypeFromURL(UniString
const &
1013 INetContentType eTypeID
= CONTENT_TYPE_UNKNOWN
;
1014 UniString aToken
= rURL
.GetToken(0, ':');
1015 if (aToken
.Len() != 0)
1017 if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE
))
1018 if (rURL
.GetChar(rURL
.Len() - 1) == '/') // folder
1019 if (rURL
.Len() > RTL_CONSTASCII_LENGTH("file:///"))
1020 if (WildCard(UniString(RTL_CONSTASCII_USTRINGPARAM(
1022 Matches(rURL
)) // special folder
1023 eTypeID
= CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER
;
1025 // drive? -> "file:///?|/"
1026 if (rURL
.Len() == 11
1027 && rURL
.GetChar(rURL
.Len() - 2) == '|')
1029 // Drives need further processing, because of
1030 // dynamic type according to underlying volume,
1031 // which cannot be determined here.
1033 else // normal folder
1034 eTypeID
= CONTENT_TYPE_X_CNT_FSYSFOLDER
;
1035 else // file system root
1036 eTypeID
= CONTENT_TYPE_X_CNT_FSYSBOX
;
1041 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTP
)
1042 || aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTPS
))
1043 eTypeID
= CONTENT_TYPE_TEXT_HTML
;
1044 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_PRIVATE
))
1046 UniString aSecondPart
= rURL
.GetToken(1, ':');
1047 aToken
= aSecondPart
.GetToken(0, '/');
1048 if (aToken
.EqualsAscii(INETTYPE_URL_SUB_FACTORY
))
1050 aToken
= aSecondPart
.GetToken(1, '/');
1051 if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SWRITER
))
1053 aToken
= aSecondPart
.GetToken(2, '/');
1054 eTypeID
= aToken
.EqualsAscii(INETTYPE_URL_SSSUB_WEB
) ?
1055 CONTENT_TYPE_APP_VND_WRITER_WEB
:
1056 aToken
.EqualsAscii(INETTYPE_URL_SSSUB_GLOB
) ?
1057 CONTENT_TYPE_APP_VND_WRITER_GLOBAL
:
1058 CONTENT_TYPE_APP_VND_WRITER
;
1060 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SCALC
))
1061 eTypeID
= CONTENT_TYPE_APP_VND_CALC
;
1062 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SDRAW
))
1063 eTypeID
= CONTENT_TYPE_APP_VND_DRAW
;
1064 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SIMPRESS
))
1065 eTypeID
= CONTENT_TYPE_APP_VND_IMPRESS
;
1066 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SCHART
))
1067 eTypeID
= CONTENT_TYPE_APP_VND_CHART
;
1068 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SIMAGE
))
1069 eTypeID
= CONTENT_TYPE_APP_VND_IMAGE
;
1070 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SMATH
))
1071 eTypeID
= CONTENT_TYPE_APP_VND_MATH
;
1072 else if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_FRAMESET
))
1073 eTypeID
= CONTENT_TYPE_APP_FRAMESET
;
1075 else if (aToken
.EqualsAscii(INETTYPE_URL_SUB_HELPID
))
1076 eTypeID
= CONTENT_TYPE_APP_STARHELP
;
1078 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_COMPONENT
))
1080 aToken
= rURL
.GetToken(1, ':'); // aToken now equals ss / *
1081 aToken
= aToken
.GetToken(0, '/');
1082 if (aToken
.EqualsAscii(INETTYPE_URL_SSUB_SS
))
1083 eTypeID
= rURL
.SearchAscii(INETTYPE_URL_SCHED_CMB
)
1085 && rURL
.SearchAscii(INETTYPE_URL_SCHED_FORM
)
1086 == STRING_NOTFOUND
?
1087 CONTENT_TYPE_APP_SCHEDULE
:
1088 rURL
.SearchAscii(INETTYPE_URL_SCHED_TASK
)
1089 == STRING_NOTFOUND
?
1090 CONTENT_TYPE_APP_SCHEDULE_EVT
:
1091 CONTENT_TYPE_APP_SCHEDULE_TASK
;
1093 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MAILTO
))
1094 eTypeID
= CONTENT_TYPE_APP_VND_OUTTRAY
;
1095 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MACRO
))
1096 eTypeID
= CONTENT_TYPE_APP_MACRO
;
1097 else if (aToken
.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_DATA
))
1099 UniString aSecondPart
= rURL
.GetToken(1, ':');
1100 aToken
= aSecondPart
.GetToken(0, ',');
1101 eTypeID
= GetContentType(aToken
);
1104 if (eTypeID
== CONTENT_TYPE_UNKNOWN
)
1106 UniString aExtension
;
1107 if (GetExtensionFromURL(rURL
, aExtension
))
1108 eTypeID
= GetContentType4Extension(aExtension
);
1113 //============================================================================
1115 bool INetContentTypes::GetExtensionFromURL(UniString
const & rURL
,
1116 UniString
& rExtension
)
1118 xub_StrLen nSlashPos
= 0;
1120 while (i
!= STRING_NOTFOUND
)
1123 i
= rURL
.Search('/', i
+ 1);
1127 xub_StrLen nLastDotPos
= i
= rURL
.Search('.', nSlashPos
);
1128 while (i
!= STRING_NOTFOUND
)
1131 i
= rURL
.Search('.', i
+ 1);
1133 if (nLastDotPos
!= STRING_NOTFOUND
)
1134 rExtension
= rURL
.Copy(nLastDotPos
+ 1);
1140 //============================================================================
1142 INetContentType
INetContentTypes::MapStringToContentType(UniString
const &
1145 MediaTypeEntry
const * pEntry
= seekEntry(rPresentation
,
1146 aStaticPresentationMap
,
1147 sizeof aStaticPresentationMap
1148 / sizeof (MediaTypeEntry
));
1149 return pEntry
? pEntry
->m_eTypeID
: CONTENT_TYPE_UNKNOWN
;
1152 //============================================================================
1154 bool INetContentTypes::parse(ByteString
const & rMediaType
,
1155 ByteString
& rType
, ByteString
& rSubType
,
1156 INetContentTypeParameterList
* pParameters
)
1158 sal_Char
const * p
= rMediaType
.GetBuffer();
1159 sal_Char
const * pEnd
= p
+ rMediaType
.Len();
1161 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1162 sal_Char
const * pToken
= p
;
1163 bool bDowncase
= false;
1164 while (p
!= pEnd
&& INetMIME::isTokenChar(*p
))
1166 bDowncase
= bDowncase
|| INetMIME::isUpperCase(*p
);
1171 rType
= ByteString(pToken
, sal::static_int_cast
< xub_StrLen
>(p
- pToken
));
1173 rType
.ToLowerAscii();
1175 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1176 if (p
== pEnd
|| *p
++ != '/')
1179 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1182 while (p
!= pEnd
&& INetMIME::isTokenChar(*p
))
1184 bDowncase
= bDowncase
|| INetMIME::isUpperCase(*p
);
1189 rSubType
= ByteString(
1190 pToken
, sal::static_int_cast
< xub_StrLen
>(p
- pToken
));
1192 rSubType
.ToLowerAscii();
1194 return INetMIME::scanParameters(p
, pEnd
, pParameters
) == pEnd
;
1197 //============================================================================
1199 bool INetContentTypes::parse(UniString
const & rMediaType
,
1200 UniString
& rType
, UniString
& rSubType
,
1201 INetContentTypeParameterList
* pParameters
)
1203 sal_Unicode
const * p
= rMediaType
.GetBuffer();
1204 sal_Unicode
const * pEnd
= p
+ rMediaType
.Len();
1206 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1207 sal_Unicode
const * pToken
= p
;
1208 bool bDowncase
= false;
1209 while (p
!= pEnd
&& INetMIME::isTokenChar(*p
))
1211 bDowncase
= bDowncase
|| INetMIME::isUpperCase(*p
);
1216 rType
= UniString(pToken
, sal::static_int_cast
< xub_StrLen
>(p
- pToken
));
1218 rType
.ToLowerAscii();
1220 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1221 if (p
== pEnd
|| *p
++ != '/')
1224 p
= INetMIME::skipLinearWhiteSpaceComment(p
, pEnd
);
1227 while (p
!= pEnd
&& INetMIME::isTokenChar(*p
))
1229 bDowncase
= bDowncase
|| INetMIME::isUpperCase(*p
);
1234 rSubType
= UniString(
1235 pToken
, sal::static_int_cast
< xub_StrLen
>(p
- pToken
));
1237 rSubType
.ToLowerAscii();
1239 return INetMIME::scanParameters(p
, pEnd
, pParameters
) == pEnd
;
1242 //============================================================================
1244 ByteString
INetContentTypes::appendUSASCIIParameter(ByteString
const &
1248 ByteString
const & rValue
)
1250 ByteString aResult
= rMediaType
;
1251 aResult
.Append(RTL_CONSTASCII_STRINGPARAM("; "));
1252 aResult
+= rAttribute
;
1254 bool bQuote
= false;
1255 for (xub_StrLen i
= 0; i
< rValue
.Len(); ++i
)
1257 // When the value contains any ' characters, use a quoted string
1258 // instead of a token, in order to avoid confusion with RFC 2231
1260 sal_uInt32 nChar
= sal_uChar(rValue
.GetChar(i
));
1261 DBG_ASSERT(INetMIME::isUSASCII(nChar
),
1262 "INetContentTypes::appendUSASCIIParameter(): Bad value");
1263 if (!INetMIME::isTokenChar(nChar
) || nChar
== '\'')
1272 for (xub_StrLen i
= 0; i
< rValue
.Len(); ++i
)
1274 // Escape LF as well as CR to avoid confusion with line folding:
1275 sal_uInt32 nChar
= sal_uChar(rValue
.GetChar(i
));
1276 DBG_ASSERT(INetMIME::isUSASCII(nChar
),
1277 "INetContentTypes::appendUSASCIIParameter():"
1287 aResult
+= static_cast< char >(nChar
);
1298 //============================================================================
1300 UniString
INetContentTypes::appendUSASCIIParameter(UniString
const &
1304 UniString
const & rValue
)
1306 UniString aResult
= rMediaType
;
1307 aResult
.AppendAscii(RTL_CONSTASCII_STRINGPARAM("; "));
1308 aResult
+= rAttribute
;
1310 bool bQuote
= false;
1311 for (xub_StrLen i
= 0; i
< rValue
.Len(); ++i
)
1313 // When the value contains any ' characters, use a quoted string
1314 // instead of a token, in order to avoid confusion with RFC 2231
1316 sal_uInt32 nChar
= rValue
.GetChar(i
);
1317 DBG_ASSERT(INetMIME::isUSASCII(nChar
),
1318 "INetContentTypes::appendUSASCIIParameter(): Bad value");
1319 if (!INetMIME::isTokenChar(nChar
) || nChar
== '\'')
1328 for (xub_StrLen i
= 0; i
< rValue
.Len(); ++i
)
1330 // Escape LF as well as CR to avoid confusion with line folding:
1331 sal_uInt32 nChar
= rValue
.GetChar(i
);
1332 DBG_ASSERT(INetMIME::isUSASCII(nChar
),
1333 "INetContentTypes::appendUSASCIIParameter():"
1343 aResult
+= sal_Unicode(nChar
);