xref: /trunk/main/sot/source/base/exchange.cxx (revision 61aee323)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sot.hxx"
26 #define _SOT_EXCHANGE_CXX
27 #define SOT_STRING_LIST
28 #define _SOT_FORMATS_INCLUDE_SYSTEMFORMATS
29 #include <tools/debug.hxx>
30 #include <tools/solar.h>
31 #include <tools/globname.hxx>
32 #include <tools/string.hxx>
33 #include <sot/sotdata.hxx>
34 #include <sot/exchange.hxx>
35 #include <sot/formats.hxx>
36 #include <sot/clsids.hxx>
37 #include <rtl/instance.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
39 #include <com/sun/star/datatransfer/DataFlavor.hpp>
40 #include <comphelper/documentconstants.hxx>
41 
42 using namespace::com::sun::star::uno;
43 using namespace::com::sun::star::datatransfer;
44 
45 /*
46 	In diesen Tabellen stehen alle im Office verwendeten MimeTypes,
47 	Format-Bezeichner und Types.
48 	Die Tabelle ist nach den Formatstring-Ids sortiert und jede Id
49 	ist um genau 1 groesser als ihre Vorgaenger-Id, damit die Id als
50 	Tabellenindex benutzt werden kann.
51 */
52 struct DataFlavorRepresentation
53 {
54 	const char*							pMimeType;
55 	const char*							pName;
56 	const ::com::sun::star::uno::Type*	pType;
57 };
58 
59 // -----------------------------------------------------------------------------
60 
61 namespace
62 {
63     struct ImplFormatArray_Impl
64     {
operator ()__anonb6f9ce010111::ImplFormatArray_Impl65         const DataFlavorRepresentation* operator()()
66         {
67             static const DataFlavorRepresentation aInstance[] =
68             {
69             /*  0 SOT_FORMAT_SYSTEM_START*/					{ "", "", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
70             /*  1 SOT_FORMAT_STRING*/						{ "text/plain;charset=utf-16", "Text", &::getCppuType( (const ::rtl::OUString*) 0 ) },
71             /*  2 SOT_FORMAT_BITMAP*/						{ "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
72             /*  3 SOT_FORMAT_GDIMETAFILE*/					{ "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
73             /*  4 SOT_FORMAT_PRIVATE*/						{ "application/x-openoffice-private;windows_formatname=\"Private\"", "Private", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
74             /*  5 SOT_FORMAT_FILE*/							{ "application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
75             /*  6 SOT_FORMAT_FILE_LIST*/					{ "application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
76             /*  7 EMPTY*/									{ "", "", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
77             /*  8 EMPTY*/									{ "", "", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
78             /*  9 EMPTY*/									{ "", "", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
79             /* 10 SOT_FORMAT_RTF*/							{ "text/richtext", "Rich Text Format", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
80             /* 11 SOT_FORMATSTR_ID_DRAWING*/				{ "application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
81             /* 12 SOT_FORMATSTR_ID_SVXB*/					{ "application/x-openoffice-svxb;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
82             /* 13 SOT_FORMATSTR_ID_SVIM*/					{ "application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
83             /* 14 SOT_FORMATSTR_ID_XFA*/					{ "application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
84             /* 15 SOT_FORMATSTR_ID_EDITENGINE*/				{ "application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
85             /* 16 SOT_FORMATSTR_ID_INTERNALLINK_STATE*/		{ "application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
86             /* 17 SOT_FORMATSTR_ID_SOLK*/					{ "application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
87             /* 18 SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK*/		{ "application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
88             /* 19 SOT_FORMATSTR_ID_TREELISTBOX*/			{ "application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
89             /* 20 SOT_FORMATSTR_ID_NATIVE*/					{ "application/x-openoffice-native;windows_formatname=\"Native\"", "Native", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
90             /* 21 SOT_FORMATSTR_ID_OWNERLINK*/				{ "application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
91             /* 22 SOT_FORMATSTR_ID_STARSERVER*/				{ "application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
92             /* 23 SOT_FORMATSTR_ID_STAROBJECT*/				{ "application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
93             /* 24 SOT_FORMATSTR_ID_APPLETOBJECT*/			{ "application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
94             /* 25 SOT_FORMATSTR_ID_PLUGIN_OBJECT*/			{ "application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
95             /* 26 SOT_FORMATSTR_ID_STARWRITER_30*/			{ "application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
96             /* 27 SOT_FORMATSTR_ID_STARWRITER_40*/			{ "application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
97             /* 28 SOT_FORMATSTR_ID_STARWRITER_50*/			{ "application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
98             /* 29 SOT_FORMATSTR_ID_STARWRITERWEB_40*/		{ "application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
99             /* 30 SOT_FORMATSTR_ID_STARWRITERWEB_50*/		{ "application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
100             /* 31 SOT_FORMATSTR_ID_STARWRITERGLOB_40*/		{ "application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
101             /* 32 SOT_FORMATSTR_ID_STARWRITERGLOB_50*/		{ "application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
102             /* 33 SOT_FORMATSTR_ID_STARDRAW*/				{ "application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
103             /* 34 SOT_FORMATSTR_ID_STARDRAW_40*/			{ "application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
104             /* 35 SOT_FORMATSTR_ID_STARIMPRESS_50*/			{ "application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
105             /* 36 SOT_FORMATSTR_ID_STARDRAW_50*/			{ "application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
106             /* 37 SOT_FORMATSTR_ID_STARCALC*/				{ "application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
107             /* 38 SOT_FORMATSTR_ID_STARCALC_40*/			{ "application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
108             /* 39 SOT_FORMATSTR_ID_STARCALC_50*/			{ "application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
109             /* 40 SOT_FORMATSTR_ID_STARCHART*/				{ "application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
110             /* 41 SOT_FORMATSTR_ID_STARCHART_40*/			{ "application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
111             /* 42 SOT_FORMATSTR_ID_STARCHART_50*/			{ "application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
112             /* 43 SOT_FORMATSTR_ID_STARIMAGE*/				{ "application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
113             /* 44 SOT_FORMATSTR_ID_STARIMAGE_40*/			{ "application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
114             /* 45 SOT_FORMATSTR_ID_STARIMAGE_50*/			{ "application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"", "StarImage 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
115             /* 46 SOT_FORMATSTR_ID_STARMATH*/				{ "application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
116             /* 47 SOT_FORMATSTR_ID_STARMATH_40*/			{ "application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
117             /* 48 SOT_FORMATSTR_ID_STARMATH_50*/			{ "application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
118             /* 49 SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC*/	{ "application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
119             /* 50 SOT_FORMATSTR_ID_FILLED_AREA*/			{ "application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
120             /* 51 SOT_FORMATSTR_ID_HTML*/					{ "text/html", "HTML (HyperText Markup Language)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
121             /* 52 SOT_FORMATSTR_ID_HTML_SIMPLE*/			{ "application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
122             /* 53 SOT_FORMATSTR_ID_CHAOS*/					{ "application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
123             /* 54 SOT_FORMATSTR_ID_CNT_MSGATTACHFILE*/		{ "application/x-openoffice-cnt-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
124             /* 55 SOT_FORMATSTR_ID_BIFF_5*/					{ "application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
125             /* 56 SOT_FORMATSTR_ID_BIFF__5*/				{ "application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
126             /* 57 SOT_FORMATSTR_ID_SYLK*/					{ "application/x-openoffice-sylk;windows_formatname=\"Sylk\"", "Sylk", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
127             /* 58 SOT_FORMATSTR_ID_SYLK_BIGCAPS*/			{ "application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
128             /* 59 SOT_FORMATSTR_ID_LINK*/					{ "application/x-openoffice-link;windows_formatname=\"Link\"", "Link", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
129             /* 60 SOT_FORMATSTR_ID_DIF*/					{ "application/x-openoffice-dif;windows_formatname=\"DIF\"", "DIF", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
130             /* 61 SOT_FORMATSTR_ID_STARDRAW_TABBAR*/		{ "application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
131             /* 62 SOT_FORMATSTR_ID_SONLK*/					{ "application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
132             /* 63 SOT_FORMATSTR_ID_MSWORD_DOC*/				{ "application/msword", "MSWordDoc", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
133             /* 64 SOT_FORMATSTR_ID_STAR_FRAMESET_DOC*/		{ "application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
134             /* 65 SOT_FORMATSTR_ID_OFFICE_DOC*/				{ "application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
135             /* 66 SOT_FORMATSTR_ID_NOTES_DOCINFO*/			{ "application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
136             /* 67 SOT_FORMATSTR_ID_NOTES_HNOTE*/			{ "application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
137             /* 68 SOT_FORMATSTR_ID_NOTES_NATIVE*/			{ "application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
138             /* 69 SOT_FORMATSTR_ID_SFX_DOC*/				{ "application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
139             /* 70 SOT_FORMATSTR_ID_EVDF*/					{ "application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\"", "EVDF (Explorer View Dummy Format)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
140             /* 71 SOT_FORMATSTR_ID_ESDF*/					{ "application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\"", "ESDF (Explorer Search Dummy Format)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
141             /* 72 SOT_FORMATSTR_ID_IDF*/					{ "application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
142             /* 73 SOT_FORMATSTR_ID_EFTP*/					{ "application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
143             /* 74 SOT_FORMATSTR_ID_EFD*/					{ "application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
144             /* 75 SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH*/		{ "application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
145             /* 76 SOT_FORMATSTR_ID_EXTENDED_TABBAR*/		{ "application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
146             /* 77 SOT_FORMATSTR_ID_SBA_DATAEXCHANGE*/		{ "application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
147             /* 78 SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE*/	{ "application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
148             /* 79 SOT_FORMATSTR_ID_SBA_PRIVATE_URL*/		{ "application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
149             /* 80 SOT_FORMATSTR_ID_SBA_TABED*/				{ "application/x-openofficesba-tabed;windows_formatname=\"Tabed\"", "Tabed", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
150             /* 81 SOT_FORMATSTR_ID_SBA_TABID*/				{ "application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
151             /* 82 SOT_FORMATSTR_ID_SBA_JOIN*/				{ "application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
152             /* 83 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR*/		{ "application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"", "Star Object Descriptor (XML)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
153             /* 84 SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR*/		{ "application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"", "Star Link Source Descriptor (XML)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
154             /* 85 SOT_FORMATSTR_ID_EMBED_SOURCE*/			{ "application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", "Star Embed Source (XML)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
155             /* 86 SOT_FORMATSTR_ID_LINK_SOURCE*/			{ "application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"", "Star Link Source (XML)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
156             /* 87 SOT_FORMATSTR_ID_EMBEDDED_OBJ*/			{ "application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"", "Star Embedded Object (XML)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
157             /* 88 SOT_FORMATSTR_ID_FILECONTENT*/			{ "application/x-openoffice-filecontent;windows_formatname=\"FileContents\"", "FileContents", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
158             /* 89 SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR*/		{ "application/x-openoffice-filegrpdescriptor;windows_formatname=\"FileGroupDescriptor\"", "FileGroupDescriptor", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
159             /* 90 SOT_FORMATSTR_ID_FILENAME*/				{ "application/x-openoffice-filename;windows_formatname=\"FileName\"", "FileName", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
160             /* 91 SOT_FORMATSTR_ID_SD_OLE*/					{ "application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
161             /* 92 SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE*/		{ "application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
162             /* 93 SOT_FORMATSTR_ID_EMBED_SOURCE_OLE*/		{ "application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
163             /* 94 SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE*/	{ "application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
164             /* 95 SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE*/	{ "application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
165             /* 96 SOT_FORMATSTR_ID_LINK_SOURCE_OLE*/		{ "application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
166             /* 97 SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE*/	{ "application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
167             /* 98 SOT_FORMATSTR_ID_OUTPLACE_OBJ*/			{ "application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
168             /* 99 SOT_FORMATSTR_ID_CNT_OWN_CLIP*/			{ "application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
169             /*100 SOT_FORMATSTR_ID_INET_IMAGE*/				{ "application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
170             /*101 SOT_FORMATSTR_ID_NETSCAPE_IMAGE*/			{ "application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
171             /*102 SOT_FORMATSTR_ID_SBA_FORMEXCHANGE*/		{ "application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"", "SBA_FORMEXCHANGE", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
172             /*103 SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE*/		{ "application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
173             /*104 SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR*/	{ "application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
174             /*105 SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50*/	{ "application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
175             /*106 SOT_FORMATSTR_ID_GRAPHOBJ*/				{ "application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
176             /*107 SOT_FORMATSTR_ID_STARWRITER_60*/          { MIMETYPE_VND_SUN_XML_WRITER_ASCII, "Writer 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
177             /*108 SOT_FORMATSTR_ID_STARWRITERWEB_60*/       { MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII, "Writer/Web 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
178             /*109 SOT_FORMATSTR_ID_STARWRITERGLOB_60*/      { MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII, "Writer/Global 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
179             /*110 SOT_FORMATSTR_ID_STARWDRAW_60*/           { MIMETYPE_VND_SUN_XML_DRAW_ASCII, "Draw 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
180             /*111 SOT_FORMATSTR_ID_STARIMPRESS_60*/         { MIMETYPE_VND_SUN_XML_IMPRESS_ASCII, "Impress 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
181             /*112 SOT_FORMATSTR_ID_STARCALC_60*/            { MIMETYPE_VND_SUN_XML_CALC_ASCII, "Calc 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
182             /*113 SOT_FORMATSTR_ID_STARCHART_60*/           { MIMETYPE_VND_SUN_XML_CHART_ASCII, "Chart 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
183             /*114 SOT_FORMATSTR_ID_STARMATH_60*/            { MIMETYPE_VND_SUN_XML_MATH_ASCII, "Math 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
184             /*115 SOT_FORMATSTR_ID_WMF*/					{ "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", "Windows MetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
185             /*116 SOT_FORMATSTR_ID_DBACCESS_QUERY*/         { "application/x-openoffice-dbaccess-query;windows_formatname=\"Data source Query Object\"", "Data source Query Object", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
186             /*117 SOT_FORMATSTR_ID_DBACCESS_TABLE*/         { "application/x-openoffice-dbaccess-table;windows_formatname=\"Data source Table\"", "Data source Table", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
187             /*118 SOT_FORMATSTR_ID_DBACCESS_COMMAND*/       { "application/x-openoffice-dbaccess-command;windows_formatname=\"SQL query\"", "SQL query", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
188             /*119 SOT_FORMATSTR_ID_DIALOG_60*/              { "application/vnd.sun.xml.dialog", "Dialog 6.0", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
189             /*120 SOT_FORMATSTR_ID_EMF*/					{ "application/x-openoffice-emf;windows_formatname=\"Image EMF\"", "Windows Enhanced MetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
190             /*121 SOT_FORMATSTR_ID_BIFF_8*/                 { "application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
191             /*122 SOT_FORMATSTR_ID_BMP*/                    { "image/bmp", "Windows Bitmap", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
192             /*123 SOT_FORMATSTR_ID_HTML_NO_COMMENT */       { "application/x-openoffice-html-no-comment;windows_formatname=\"HTML Format\"", "HTML (no comment)", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
193             /*124 SOT_FORMATSTR_ID_STARWRITER_8*/          { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII, "Writer 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
194             /*125 SOT_FORMATSTR_ID_STARWRITERWEB_8*/       { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII, "Writer/Web 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
195             /*126 SOT_FORMATSTR_ID_STARWRITERGLOB_8*/      { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII, "Writer/Global 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
196             /*127 SOT_FORMATSTR_ID_STARWDRAW_8*/           { MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII, "Draw 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
197             /*128 SOT_FORMATSTR_ID_STARIMPRESS_8*/         { MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII, "Impress 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
198             /*129 SOT_FORMATSTR_ID_STARCALC_8*/            { MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII, "Calc 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
199             /*130 SOT_FORMATSTR_ID_STARCHART_8*/           { MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII, "Chart 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
200             /*131 SOT_FORMATSTR_ID_STARMATH_8*/            { MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII, "Math 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
201             /*132 SOT_FORMATSTR_ID_XFORMS */               { "application/x-openoffice-xforms;windows_formatname=\"??? Format\"", "???", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
202             /*133 SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE*/          { MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII, "Writer 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
203             /*134 SOT_FORMATSTR_ID_STARWDRAW_8_TEMPLATE*/           { MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII, "Draw 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
204             /*135 SOT_FORMATSTR_ID_STARIMPRESS_8_TEMPLATE*/         { MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII, "Impress 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
205             /*136 SOT_FORMATSTR_ID_STARCALC_8_TEMPLATE*/            { MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII, "Calc 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
206             /*137 SOT_FORMATSTR_ID_STARCHART_8_TEMPLATE*/           { MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII, "Chart 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
207             /*138 SOT_FORMATSTR_ID_STARMATH_8_TEMPLATE*/            { MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII, "Math 8 Template", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
208             /*139 SOT_FORMATSTR_ID_STARBASE_8*/            { MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII, "StarBase 8", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
209             /*140 SOT_FORMAT_GDIMETAFILE*/					{ "application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\"", "High Contrast GDIMetaFile", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
210             /*141 SOT_FORMATSTR_ID_PNG*/                    { "image/png", "PNG Bitmap", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
211             /*142 SOT_FORMATSTR_ID_MATHML*/                 { "application/mathml+xml", "MathML", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
212             /*143 SOT_FORMATSTR_ID_SVG*/                    { "image/svg+xml;windows_formatname=\"image/svg+xml\"", "SVG", &::getCppuType( (const Sequence< sal_Int8 >*) 0 ) },
213             };
214 	    return &aInstance[0];
215         }
216     };
217 
218     struct FormatArray_Impl
219         : public rtl::StaticAggregate<
220             const DataFlavorRepresentation, ImplFormatArray_Impl > {};
221 }
222 
223 //-----------------------------------------------------------------------
224 
InitFormats_Impl()225 static List& InitFormats_Impl()
226 {
227 	SotData_Impl * pSotData = SOTDATA();
228 	if( !pSotData->pDataFlavorList )
229 		pSotData->pDataFlavorList = new List();
230 	return *pSotData->pDataFlavorList;
231 }
232 
233 /*************************************************************************
234 |*
235 |*    SotExchange::RegisterFormatName()
236 |*
237 |*    Beschreibung      CLIP.SDW
238 *************************************************************************/
RegisterFormatName(const String & rName)239 sal_uLong SotExchange::RegisterFormatName( const String& rName )
240 {
241     const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
242 	// teste zuerst die Standard - Name
243 	sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
244 	for( i = SOT_FORMAT_STRING; i <= nMax;  ++i )
245 		if( COMPARE_EQUAL == rName.CompareToAscii( pFormatArray_Impl[ i ].pName ) )
246 			return i;
247 
248 	// BM: the chart format 105 ("StarChartDocument 5.0") was written
249 	// only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0")
250 	// The registry only contains the entry for the 42 format id.
251 	nMax = SOT_FORMATSTR_ID_USER_END;
252 	for( i = SOT_FORMAT_RTF; i <= nMax;  ++i )
253 		if( rName.EqualsAscii( pFormatArray_Impl[ i ].pName ) )
254 			return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
255 					 ? SOT_FORMATSTR_ID_STARCHART_50
256 					 : i );
257 
258 	// dann in der dynamischen Liste
259 	List& rL = InitFormats_Impl();
260 	for( i = 0, nMax = rL.Count(); i < nMax; i++ )
261 	{
262 		DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i );
263 		if( pFlavor && rName == String( pFlavor->HumanPresentableName ) )
264 			return i + SOT_FORMATSTR_ID_USER_END + 1;
265 	}
266 
267 	// nMax ist der neue Platz
268 	DataFlavor* pNewFlavor = new DataFlavor;
269 
270 	pNewFlavor->MimeType = rName;
271 	pNewFlavor->HumanPresentableName = rName;
272 	pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 );
273 
274 	rL.Insert( pNewFlavor, LIST_APPEND );
275 
276 	return nMax + SOT_FORMATSTR_ID_USER_END + 1;
277 }
278 
RegisterFormatMimeType(const String & rMimeType)279 sal_uLong SotExchange::RegisterFormatMimeType( const String& rMimeType )
280 {
281     const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
282 	// teste zuerst die Standard - Name
283 	sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
284 	for( i = SOT_FORMAT_STRING; i <= nMax;  ++i )
285 		if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
286 			return i;
287 
288 	nMax = SOT_FORMATSTR_ID_USER_END;
289 	for( i = SOT_FORMAT_RTF; i <= nMax;  ++i )
290 		if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
291 			return i;
292 
293 	// dann in der dynamischen Liste
294 	List& rL = InitFormats_Impl();
295 	for( i = 0, nMax = rL.Count(); i < nMax; i++ )
296 	{
297 		DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i );
298 		if( pFlavor && rMimeType == String( pFlavor->MimeType ) )
299 			return i + SOT_FORMATSTR_ID_USER_END + 1;
300 	}
301 
302 	// nMax ist der neue Platz
303 	DataFlavor* pNewFlavor = new DataFlavor;
304 
305 	pNewFlavor->MimeType = rMimeType;
306 	pNewFlavor->HumanPresentableName = rMimeType;
307 	pNewFlavor->DataType = ::getCppuType( (const ::rtl::OUString*) 0 );
308 
309 	rL.Insert( pNewFlavor, LIST_APPEND );
310 
311 	return nMax + SOT_FORMATSTR_ID_USER_END + 1;
312 }
313 
314 /*************************************************************************
315 |*
316 |*    SotExchange::RegisterFormatName()
317 |*
318 |*    Beschreibung      CLIP.SDW
319 *************************************************************************/
RegisterFormat(const DataFlavor & rFlavor)320 sal_uLong SotExchange::RegisterFormat( const DataFlavor& rFlavor )
321 {
322 	sal_uLong nRet = GetFormat( rFlavor );
323 
324 	if( !nRet )
325 	{
326 		List& rL = InitFormats_Impl();
327 		nRet = rL.Count() + SOT_FORMATSTR_ID_USER_END + 1;
328 		rL.Insert( new DataFlavor( rFlavor ), LIST_APPEND );
329 	}
330 
331 	return nRet;
332 }
333 
334 /*************************************************************************
335 |*
336 |*    SotExchange::GetFormatDataFlavor()
337 |*
338 *************************************************************************/
339 
GetFormatDataFlavor(sal_uLong nFormat,DataFlavor & rFlavor)340 sal_Bool SotExchange::GetFormatDataFlavor( sal_uLong nFormat, DataFlavor& rFlavor )
341 {
342 	sal_Bool bRet;
343 
344 	if( SOT_FORMATSTR_ID_USER_END >= nFormat )
345 	{
346 		const DataFlavorRepresentation& rData = FormatArray_Impl::get()[nFormat];
347 		rFlavor.MimeType = ::rtl::OUString::createFromAscii( rData.pMimeType );
348 		rFlavor.HumanPresentableName = ::rtl::OUString::createFromAscii( rData.pName );
349 		rFlavor.DataType = *rData.pType;
350 
351 		bRet = sal_True;
352 	}
353 	else
354 	{
355 		List& rL = InitFormats_Impl();
356 
357 		nFormat -= SOT_FORMATSTR_ID_USER_END + 1;
358 
359 		if( rL.Count() > nFormat )
360 		{
361 			rFlavor = *(DataFlavor*) rL.GetObject( nFormat );
362 			bRet = sal_True;
363 		}
364 		else
365 		{
366 			rFlavor = DataFlavor();
367 			bRet = sal_False;
368 		}
369 	}
370 
371 	DBG_ASSERT( bRet, "SotExchange::GetFormatDataFlavor(): DataFlavor not initialized" );
372 
373 	return bRet;
374 }
375 
376 /*************************************************************************
377 |*
378 |*    SotExchange::GetFormatMimeType( sal_uLong nFormat )
379 |*
380 *************************************************************************/
381 
GetFormatMimeType(sal_uLong nFormat)382 String SotExchange::GetFormatMimeType( sal_uLong nFormat )
383 {
384 	String sMimeType;
385 	if( SOT_FORMATSTR_ID_USER_END >= nFormat )
386 		sMimeType.AssignAscii( FormatArray_Impl::get()[nFormat].pMimeType );
387 	else
388 	{
389 		List& rL = InitFormats_Impl();
390 
391 		nFormat -= SOT_FORMATSTR_ID_USER_END + 1;
392 
393 		if( rL.Count() > nFormat )
394 			sMimeType = ((DataFlavor*) rL.GetObject( nFormat ))->MimeType;
395 	}
396 
397 	DBG_ASSERT( sMimeType.Len(), "SotExchange::GetFormatMimeType(): DataFlavor not initialized" );
398 
399 	return sMimeType;
400 }
401 
402 /*************************************************************************
403 |*
404 |*    SotExchange::GetFormatIdFromMimeType( const String& rMimeType )
405 |*
406 *************************************************************************/
407 
GetFormatIdFromMimeType(const String & rMimeType)408 sal_uLong SotExchange::GetFormatIdFromMimeType( const String& rMimeType )
409 {
410     const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
411 	sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
412 	for( i = SOT_FORMAT_STRING; i <= nMax;  ++i )
413 		if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
414 			return i;
415 
416 	// BM: the chart format 105 ("StarChartDocument 5.0") was written
417 	// only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0")
418 	// The registry only contains the entry for the 42 format id.
419 	nMax = SOT_FORMATSTR_ID_USER_END;
420 	for( i = SOT_FORMAT_RTF; i <= nMax;  ++i )
421 		if( rMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
422 			return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
423 					 ? SOT_FORMATSTR_ID_STARCHART_50
424 					 : i );
425 
426 	// dann in der dynamischen Liste
427 	List& rL = InitFormats_Impl();
428 	::rtl::OUString aMimeType( rMimeType );
429 	for( i = 0, nMax = rL.Count(); i < nMax; i++ )
430 	{
431 		DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i );
432 		if( pFlavor && aMimeType == pFlavor->MimeType )
433 			return i + SOT_FORMATSTR_ID_USER_END + 1;
434 	}
435 
436 	return 0;
437 }
438 
439 /*************************************************************************
440 |*
441 |*    SotExchange::GetFormatName()
442 |*
443 |*    Beschreibung      CLIP.SDW
444 *************************************************************************/
GetFormat(const DataFlavor & rFlavor)445 sal_uLong SotExchange::GetFormat( const DataFlavor& rFlavor )
446 {
447 	// teste zuerst die Standard - Name
448 	const ::rtl::OUString& rMimeType = rFlavor.MimeType;
449 	const String aMimeType( rMimeType );
450 	sal_uLong i, nMax = SOT_FORMAT_FILE_LIST;
451     const DataFlavorRepresentation *pFormatArray_Impl = FormatArray_Impl::get();
452 	for( i = SOT_FORMAT_STRING; i <= nMax;  ++i )
453 		if( aMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
454 			return i;
455 
456 	// BM: the chart format 105 ("StarChartDocument 5.0") was written
457 	// only into 5.1 chart documents - in 5.0 and 5.2 it was 42 ("StarChart 5.0")
458 	// The registry only contains the entry for the 42 format id.
459 	nMax = SOT_FORMATSTR_ID_USER_END;
460 	for( i = SOT_FORMAT_RTF; i <= nMax;  ++i )
461 		if( aMimeType.EqualsAscii( pFormatArray_Impl[ i ].pMimeType ) )
462 			return ( (i == SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50)
463 					 ? SOT_FORMATSTR_ID_STARCHART_50
464 					 : i );
465 
466 	// dann in der dynamischen Liste
467 	List& rL = InitFormats_Impl();
468 	for( i = 0, nMax = rL.Count(); i < nMax; i++ )
469 	{
470 		DataFlavor* pFlavor = (DataFlavor*) rL.GetObject( i );
471 		if( pFlavor && rMimeType == pFlavor->MimeType )
472 			return i + SOT_FORMATSTR_ID_USER_END + 1;
473 	}
474 
475 	return 0;
476 }
477 
478 /*************************************************************************
479 |*
480 |*    SotExchange::GetFormatName()
481 |*
482 |*    Beschreibung      CLIP.SDW
483 *************************************************************************/
GetFormatName(sal_uLong nFormat)484 String SotExchange::GetFormatName( sal_uLong nFormat )
485 {
486 	DataFlavor	aFlavor;
487 	String		aRet;
488 
489 	if( GetFormatDataFlavor( nFormat, aFlavor ) )
490 		aRet = aFlavor.HumanPresentableName;
491 
492 	return aRet;
493 }
494 
IsInternal(const SvGlobalName & rName)495 sal_Bool SotExchange::IsInternal( const SvGlobalName& rName )
496 {
497     if ( rName == SvGlobalName(SO3_SW_CLASSID_60) ||
498          rName == SvGlobalName(SO3_SC_CLASSID_60) ||
499          rName == SvGlobalName(SO3_SIMPRESS_CLASSID_60) ||
500          rName == SvGlobalName(SO3_SDRAW_CLASSID_60) ||
501          rName == SvGlobalName(SO3_SCH_CLASSID_60) ||
502          rName == SvGlobalName(SO3_SM_CLASSID_60) ||
503          rName == SvGlobalName(SO3_SWWEB_CLASSID_60) ||
504          rName == SvGlobalName(SO3_SWGLOB_CLASSID_60) )
505         return sal_True;
506     return sal_False;
507 }
508