xref: /AOO41X/main/dtrans/source/win32/ftransl/ftransl.cxx (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
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_dtrans.hxx"
26 
27 //------------------------------------------------------------------------
28 // includes
29 //------------------------------------------------------------------------
30 #include <osl/diagnose.h>
31 
32 #ifndef _DFLVCONT_HXX_
33 #include "ftransl.hxx"
34 #endif
35 #include <com/sun/star/datatransfer/XMimeContentType.hpp>
36 #include "..\misc\ImplHelper.hxx"
37 
38 #if defined _MSC_VER
39 #pragma warning(push,1)
40 #pragma warning(disable:4917)
41 #endif
42 #include <shlobj.h>
43 #if defined _MSC_VER
44 #pragma warning(pop)
45 #endif
46 
47 //------------------------------------------------------------------------
48 // defines
49 //------------------------------------------------------------------------
50 
51 #define IMPL_NAME  "com.sun.star.datatransfer.DataFormatTranslator"
52 
53 #define MODULE_PRIVATE
54 #define CPPUTYPE_SEQSALINT8       getCppuType( (const Sequence< sal_Int8 >*) 0 )
55 #define CPPUTYPE_DEFAULT          CPPUTYPE_SEQSALINT8
56 #define CPPUTYPE_OUSTR            getCppuType( (const ::rtl::OUString*) 0 )
57 #define CPPUTYPE_SALINT32         getCppuType( ( sal_Int32 * ) 0 )
58 #define OUSTR( str )              OUString::createFromAscii( #str )
59 #define OUSTR_( str )             OUString::createFromAscii( str )
60 #define EMPTY_OUSTR               OUString::createFromAscii( "" )
61 //#define PRIVATE_OO                  OUString::createFromAscii( "application/x-openoffice;" "windows_formatname=" )
62 
63 const rtl::OUString Windows_FormatName = rtl::OUString::createFromAscii("windows_formatname");
64 const com::sun::star::uno::Type CppuType_ByteSequence = ::getCppuType((const com::sun::star::uno::Sequence<sal_Int8>*)0);
65 const com::sun::star::uno::Type CppuType_String       = ::getCppuType((const ::rtl::OUString*)0);
66 
67 //------------------------------------------------------------------------
68 // namespace directives
69 //------------------------------------------------------------------------
70 
71 using namespace rtl;
72 using namespace osl;
73 using namespace cppu;
74 using namespace std;
75 using namespace com::sun::star::uno;
76 using namespace com::sun::star::lang;
77 using namespace com::sun::star::datatransfer;
78 using namespace com::sun::star::container;
79 
80 //------------------------------------------------------------------------
81 // helper functions
82 //------------------------------------------------------------------------
83 
84 namespace MODULE_PRIVATE
85 {
86     Sequence< OUString > SAL_CALL DataFormatTranslator_getSupportedServiceNames( )
87     {
88         Sequence< OUString > aRet(1);
89         aRet[0] = OUString::createFromAscii("com.sun.star.datatransfer.DataFormatTranslator");
90         return aRet;
91     }
92 }
93 
94 //------------------------------------------------
95 //
96 //------------------------------------------------
97 
98 FormatEntry::FormatEntry()
99 {
100 }
101 
102 //------------------------------------------------
103 //
104 //------------------------------------------------
105 
106 FormatEntry::FormatEntry(
107     const char* mime_content_type,
108     const char* human_presentable_name,
109     const char* native_format_name,
110     CLIPFORMAT std_clipboard_format_id,
111     ::com::sun::star::uno::Type const & cppu_type)
112 {
113     aDataFlavor.MimeType             = rtl::OUString::createFromAscii(mime_content_type);
114     aDataFlavor.HumanPresentableName = rtl::OUString::createFromAscii(human_presentable_name);
115     aDataFlavor.DataType             = cppu_type;
116 
117     if (native_format_name)
118         aNativeFormatName = rtl::OUString::createFromAscii(native_format_name);
119     else
120         aNativeFormatName = rtl::OUString::createFromAscii(human_presentable_name);
121 
122     aStandardFormatId = std_clipboard_format_id;
123 }
124 
125 //------------------------------------------------------------------------
126 // ctor
127 //------------------------------------------------------------------------
128 
129 CDataFormatTranslator::CDataFormatTranslator( const Reference< XMultiServiceFactory >& rSrvMgr ) :
130     m_SrvMgr( rSrvMgr )
131 {
132     initTranslationTable( );
133 }
134 
135 //------------------------------------------------------------------------
136 //
137 //------------------------------------------------------------------------
138 
139 Any SAL_CALL CDataFormatTranslator::getSystemDataTypeFromDataFlavor( const DataFlavor& aDataFlavor )
140     throw( RuntimeException )
141 {
142     Any aAny;
143 
144     try
145     {
146         Reference< XMimeContentTypeFactory > refXMimeCntFactory( m_SrvMgr->createInstance(
147             OUSTR( com.sun.star.datatransfer.MimeContentTypeFactory ) ), UNO_QUERY );
148 
149         if ( !refXMimeCntFactory.is( ) )
150             throw RuntimeException( );
151 
152         Reference< XMimeContentType >
153             refXMimeCntType( refXMimeCntFactory->createMimeContentType( aDataFlavor.MimeType ) );
154 
155         OUString fullMediaType = refXMimeCntType->getFullMediaType( );
156         if ( isTextPlainMediaType( fullMediaType ) )
157         {
158             // default is CF_TEXT
159             aAny <<= static_cast< sal_Int32 >( CF_TEXT );
160 
161             if ( refXMimeCntType->hasParameter( OUSTR( charset ) ) )
162             {
163                 // but maybe it is unicode text or oem text
164                 OUString charset = refXMimeCntType->getParameterValue( OUSTR( charset ) );
165                 findStandardFormatIdForCharset( charset, aAny );
166             }
167         }
168         else
169         {
170             if (refXMimeCntType->hasParameter(Windows_FormatName))
171             {
172                 OUString winfmtname = refXMimeCntType->getParameterValue(Windows_FormatName);
173                 aAny <<= winfmtname;
174 
175                 setStandardFormatIdForNativeFormatName( winfmtname, aAny );
176             }
177             else
178                 findStdFormatIdOrNativeFormatNameForFullMediaType( refXMimeCntFactory, fullMediaType, aAny );
179         }
180     }
181     catch( IllegalArgumentException& )
182     {
183         OSL_ENSURE( sal_False, "Invalid content-type detected!" );
184     }
185     catch( NoSuchElementException& )
186     {
187         OSL_ENSURE( sal_False, "Illegal content-type parameter" );
188     }
189     catch( ... )
190     {
191         OSL_ENSURE( sal_False, "Unexpected error" );
192         throw;
193     }
194 
195     return aAny;
196 }
197 
198 //------------------------------------------------------------------------
199 //
200 //------------------------------------------------------------------------
201 
202 DataFlavor SAL_CALL CDataFormatTranslator::getDataFlavorFromSystemDataType( const Any& aSysDataType )
203     throw( RuntimeException )
204 {
205     OSL_PRECOND( aSysDataType.hasValue( ), "Empty system data type delivered" );
206 
207     DataFlavor aFlavor = mkDataFlv( EMPTY_OUSTR, EMPTY_OUSTR, CPPUTYPE_SEQSALINT8 );
208 
209     if ( aSysDataType.getValueType( ) == CPPUTYPE_SALINT32 )
210     {
211         sal_Int32 clipformat;
212         aSysDataType >>= clipformat;
213         if ( CF_INVALID != clipformat )
214             findDataFlavorForStandardFormatId( clipformat, aFlavor );
215     }
216     else if ( aSysDataType.getValueType( ) == CPPUTYPE_OUSTR )
217     {
218         OUString nativeFormatName;
219         aSysDataType >>= nativeFormatName;
220 
221         findDataFlavorForNativeFormatName( nativeFormatName, aFlavor );
222     }
223     else
224         OSL_ENSURE( sal_False, "Invalid data type received" );
225 
226     return aFlavor;
227 }
228 
229 // -------------------------------------------------
230 // XServiceInfo
231 // -------------------------------------------------
232 
233 OUString SAL_CALL CDataFormatTranslator::getImplementationName(  )
234     throw( RuntimeException )
235 {
236     return OUString::createFromAscii( IMPL_NAME );
237 }
238 
239 // -------------------------------------------------
240 //  XServiceInfo
241 // -------------------------------------------------
242 
243 sal_Bool SAL_CALL CDataFormatTranslator::supportsService( const OUString& ServiceName )
244     throw( RuntimeException )
245 {
246     Sequence < OUString > SupportedServicesNames = DataFormatTranslator_getSupportedServiceNames();
247 
248     for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
249         if (SupportedServicesNames[n].compareTo(ServiceName) == 0)
250             return sal_True;
251 
252     return sal_False;
253 }
254 
255 // -------------------------------------------------
256 //  XServiceInfo
257 // -------------------------------------------------
258 
259 Sequence< OUString > SAL_CALL CDataFormatTranslator::getSupportedServiceNames( )
260     throw( RuntimeException )
261 {
262     return DataFormatTranslator_getSupportedServiceNames( );
263 }
264 
265 // -------------------------------------------------
266 // to optimize searching we add all entries with a
267 // standard clipboard format number first, in the
268 // table before the entries with CF_INVALID
269 // if we are searching for a standard clipboard
270 // format number we can stop if we find the first
271 // CF_INVALID
272 // -------------------------------------------------
273 
274 void SAL_CALL CDataFormatTranslator::initTranslationTable()
275 {
276     //SOT_FORMATSTR_ID_DIF
277     m_TranslTable.push_back(FormatEntry("application/x-openoffice-dif;windows_formatname=\"DIF\"", "DIF", "DIF", CF_DIF, CPPUTYPE_DEFAULT));
278     // SOT_FORMAT_BITMAP
279     m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_DIB, CPPUTYPE_DEFAULT));
280     m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_BITMAP, CPPUTYPE_DEFAULT));
281     // SOT_FORMAT_STRING
282     m_TranslTable.push_back(FormatEntry("text/plain;charset=utf-16", "Unicode-Text", "", CF_UNICODETEXT, CppuType_String));
283     // Format Locale - for internal use
284     m_TranslTable.push_back(FormatEntry("application/x-openoffice-locale;windows_formatname=\"Locale\"", "Locale", "Locale", CF_LOCALE, CPPUTYPE_DEFAULT));
285     // SOT_FORMAT_WMF
286     m_TranslTable.push_back(FormatEntry("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", "Windows MetaFile", "Image WMF", CF_METAFILEPICT, CPPUTYPE_DEFAULT));
287     // SOT_FORMAT_EMF
288     m_TranslTable.push_back(FormatEntry("application/x-openoffice-emf;windows_formatname=\"Image EMF\"", "Windows Enhanced MetaFile", "Image EMF", CF_ENHMETAFILE, CPPUTYPE_DEFAULT));
289     // SOT_FORMAT_FILE_LIST
290     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", "FileList", CF_HDROP, CPPUTYPE_DEFAULT));
291     //SOT_FORMATSTR_ID_SYLK
292     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk;windows_formatname=\"Sylk\"", "Sylk", "Sylk", CF_SYLK, CPPUTYPE_DEFAULT ) );
293     // SOT_FORMAT_GDIMETAFILE
294     m_TranslTable.push_back(FormatEntry("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
295     // SOT_FORMAT_PRIVATE
296     m_TranslTable.push_back(FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", "Private", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
297     // SOT_FORMAT_FILE
298     m_TranslTable.push_back(FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
299     // SOT_FORMAT_RTF
300     m_TranslTable.push_back(FormatEntry("text/richtext", "Rich Text Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
301     // SOT_FORMATSTR_ID_DRAWING
302     m_TranslTable.push_back(FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
303     // SOT_FORMATSTR_ID_SVXB
304     m_TranslTable.push_back(FormatEntry("application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
305     // SOT_FORMATSTR_ID_SVIM
306     m_TranslTable.push_back(FormatEntry("application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
307     // SOT_FORMATSTR_ID_XFA
308     m_TranslTable.push_back(FormatEntry("application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
309     // SOT_FORMATSTR_ID_EDITENGINE
310     m_TranslTable.push_back(FormatEntry("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
311     // SOT_FORMATSTR_ID_INTERNALLINK_STATE
312     m_TranslTable.push_back(FormatEntry("application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
313     // SOT_FORMATSTR_ID_SOLK
314     m_TranslTable.push_back(FormatEntry("application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
315     // SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
316     m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
317     // SOT_FORMATSTR_ID_TREELISTBOX
318     m_TranslTable.push_back(FormatEntry("application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
319     // SOT_FORMATSTR_ID_NATIVE
320     m_TranslTable.push_back(FormatEntry("application/x-openoffice-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
321     // SOT_FORMATSTR_ID_OWNERLINK
322     m_TranslTable.push_back(FormatEntry("application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
323     // SOT_FORMATSTR_ID_STARSERVER
324     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
325     // SOT_FORMATSTR_ID_STAROBJECT
326     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
327     // SOT_FORMATSTR_ID_APPLETOBJECT
328     m_TranslTable.push_back(FormatEntry("application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
329     // SOT_FORMATSTR_ID_PLUGIN_OBJECT
330     m_TranslTable.push_back(FormatEntry("application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
331     // SOT_FORMATSTR_ID_STARWRITER_30
332     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
333     //SOT_FORMATSTR_ID_STARWRITER_40
334     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
335     //SOT_FORMATSTR_ID_STARWRITER_50
336     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
337     //SOT_FORMATSTR_ID_STARWRITERWEB_40
338     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterweb-40;windows_formatname=\"StarWriter/Web 4.0\"", "StarWriter/Web 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
339     //SOT_FORMATSTR_ID_STARWRITERWEB_50
340     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterweb-50;windows_formatname=\"StarWriter/Web 5.0\"", "StarWriter/Web 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
341     //SOT_FORMATSTR_ID_STARWRITERGLOB_40
342     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterglob-40;windows_formatname=\"StarWriter/Global 4.0\"", "StarWriter/Global 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
343     // SOT_FORMATSTR_ID_STARWRITERGLOB_50
344     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriterglob-50;windows_formatname=\"StarWriter/Global 5.0\"", "StarWriter/Global 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
345     //SOT_FORMATSTR_ID_STARDRAW
346     m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
347     //SOT_FORMATSTR_ID_STARDRAW_40
348     m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
349     //SOT_FORMATSTR_ID_STARIMPRESS_50
350     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
351     // SOT_FORMATSTR_ID_STARDRAW_50
352     m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
353     //SOT_FORMATSTR_ID_STARCALC
354     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
355     //SOT_FORMATSTR_ID_STARCALC_40
356     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
357     // SOT_FORMATSTR_ID_STARCALC_50
358     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
359     // SOT_FORMATSTR_ID_STARCHART
360     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
361     // SOT_FORMATSTR_ID_STARCHART_40
362     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
363     // SOT_FORMATSTR_ID_STARCHART_50
364     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
365     //SOT_FORMATSTR_ID_STARIMAGE
366     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
367     //SOT_FORMATSTR_ID_STARIMAGE_40
368     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
369     //SOT_FORMATSTR_ID_STARIMAGE_50
370     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"",  "StarImage 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
371     //SOT_FORMATSTR_ID_STARMATH
372     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
373     //SOT_FORMATSTR_ID_STARMATH_40
374     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
375     //SOT_FORMATSTR_ID_STARMATH_50
376     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
377     //SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC
378     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
379     //SOT_FORMATSTR_ID_FILLED_AREA
380     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
381     //SOT_FORMATSTR_ID_HTML
382     m_TranslTable.push_back(FormatEntry("text/html", "HTML (HyperText Markup Language)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
383     //SOT_FORMATSTR_ID_HTML_SIMPLE
384     m_TranslTable.push_back(FormatEntry("application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
385     //SOT_FORMATSTR_ID_CHAOS
386     m_TranslTable.push_back(FormatEntry("application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
387     //SOT_FORMATSTR_ID_CNT_MSGATTACHFILE
388     m_TranslTable.push_back(FormatEntry("application/x-openoffice-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
389     //SOT_FORMATSTR_ID_BIFF_5
390     m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
391     //SOT_FORMATSTR_ID_BIFF__5
392     m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
393     //SOT_FORMATSTR_ID_BIFF_8
394     m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
395     //SOT_FORMATSTR_ID_SYLK_BIGCAPS
396     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
397     //SOT_FORMATSTR_ID_LINK
398     m_TranslTable.push_back(FormatEntry("application/x-openoffice-link;windows_formatname=\"Link\"", "Link", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
399     //SOT_FORMATSTR_ID_STARDRAW_TABBAR
400     m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
401     //SOT_FORMATSTR_ID_SONLK
402     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
403     //SOT_FORMATSTR_ID_MSWORD_DOC
404     m_TranslTable.push_back(FormatEntry("application/msword", "MSWordDoc", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
405     //SOT_FORMATSTR_ID_STAR_FRAMESET_DOC
406     m_TranslTable.push_back(FormatEntry("application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
407     //SOT_FORMATSTR_ID_OFFICE_DOC
408     m_TranslTable.push_back(FormatEntry("application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
409     //SOT_FORMATSTR_ID_NOTES_DOCINFO
410     m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
411     //SOT_FORMATSTR_ID_NOTES_HNOTE
412     m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
413     //SOT_FORMATSTR_ID_NOTES_NATIVE
414     m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
415     //SOT_FORMATSTR_ID_SFX_DOC
416     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
417     //SOT_FORMATSTR_ID_EVDF
418     m_TranslTable.push_back(FormatEntry("application/x-openoffice-evdf;windows_formatname=\"EVDF (Explorer View Dummy Format)\"", "EVDF (Explorer View Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
419     //SOT_FORMATSTR_ID_ESDF
420     m_TranslTable.push_back(FormatEntry("application/x-openoffice-esdf;windows_formatname=\"ESDF (Explorer Search Dummy Format)\"", "ESDF (Explorer Search Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
421     //SOT_FORMATSTR_ID_IDF
422     m_TranslTable.push_back(FormatEntry("application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
423     //SOT_FORMATSTR_ID_EFTP
424     m_TranslTable.push_back(FormatEntry("application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
425     //SOT_FORMATSTR_ID_EFD
426     m_TranslTable.push_back(FormatEntry("application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
427     //SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH
428     m_TranslTable.push_back(FormatEntry("application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
429     //SOT_FORMATSTR_ID_EXTENDED_TABBAR
430     m_TranslTable.push_back(FormatEntry("application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
431     //SOT_FORMATSTR_ID_SBA_DATAEXCHANGE
432     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
433     //SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE
434     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
435     //SOT_FORMATSTR_ID_SBA_PRIVATE_URL
436     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
437     //SOT_FORMATSTR_ID_SBA_TABED
438     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\"", "Tabed", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
439     //SOT_FORMATSTR_ID_SBA_TABID
440     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
441     //SOT_FORMATSTR_ID_SBA_JOIN
442     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
443     //SOT_FORMATSTR_ID_OBJECTDESCRIPTOR
444     m_TranslTable.push_back(FormatEntry("application/x-openoffice-objectdescriptor-xml;windows_formatname=\"Star Object Descriptor (XML)\"", "Star Object Descriptor (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
445     //SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR
446     m_TranslTable.push_back(FormatEntry("application/x-openoffice-linksrcdescriptor-xml;windows_formatname=\"Star Link Source Descriptor (XML)\"", "Star Link Source Descriptor (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
447     //SOT_FORMATSTR_ID_EMBED_SOURCE
448     m_TranslTable.push_back(FormatEntry("application/x-openoffice-embed-source-xml;windows_formatname=\"Star Embed Source (XML)\"", "Star Embed Source (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
449     //SOT_FORMATSTR_ID_LINK_SOURCE
450     m_TranslTable.push_back(FormatEntry("application/x-openoffice-link-source-xml;windows_formatname=\"Star Link Source (XML)\"", "Star Link Source (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
451     //SOT_FORMATSTR_ID_EMBEDDED_OBJ
452     m_TranslTable.push_back(FormatEntry("application/x-openoffice-embedded-obj-xml;windows_formatname=\"Star Embedded Object (XML)\"", "Star Embedded Object (XML)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
453     //SOT_FORMATSTR_ID_FILECONTENT
454     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filecontent;windows_formatname=\"" CFSTR_FILECONTENTS "\"", CFSTR_FILECONTENTS, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
455     //SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
456     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filegrpdescriptor;windows_formatname=\"" CFSTR_FILEDESCRIPTOR "\"", CFSTR_FILEDESCRIPTOR, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
457     //SOT_FORMATSTR_ID_FILENAME
458     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filename;windows_formatname=\"" CFSTR_FILENAME "\"", CFSTR_FILENAME, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
459     //SOT_FORMATSTR_ID_SD_OLE
460     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
461     //SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE
462     m_TranslTable.push_back(FormatEntry("application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
463     //SOT_FORMATSTR_ID_EMBED_SOURCE_OLE
464     m_TranslTable.push_back(FormatEntry("application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
465     //SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE
466     m_TranslTable.push_back(FormatEntry("application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
467     //SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE
468     m_TranslTable.push_back(FormatEntry("application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
469     //SOT_FORMATSTR_ID_LINK_SOURCE_OLE
470     m_TranslTable.push_back(FormatEntry("application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
471     //SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE
472     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
473     //SOT_FORMATSTR_ID_OUTPLACE_OBJ
474     m_TranslTable.push_back(FormatEntry("application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
475     //SOT_FORMATSTR_ID_CNT_OWN_CLIP
476     m_TranslTable.push_back(FormatEntry("application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
477     //SOT_FORMATSTR_ID_INET_IMAGE
478     m_TranslTable.push_back(FormatEntry("application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
479     //SOT_FORMATSTR_ID_NETSCAPE_IMAGE
480     m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
481     //SOT_FORMATSTR_ID_SBA_FORMEXCHANGE
482     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-formexchange;windows_formatname=\"SBA_FORMEXCHANGE\"", "SBA_FORMEXCHANGE", NULL, CF_INVALID, CPPUTYPE_DEFAULT));  //SOT_FORMATSTR_ID_SBA_REPORTEXCHANGE
483     m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
484     //SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
485     m_TranslTable.push_back(FormatEntry("application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
486     //SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50
487     m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
488     //SOT_FORMATSTR_ID_GRAPHOBJ
489     m_TranslTable.push_back(FormatEntry("application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
490     //SOT_FORMATSTR_ID_STARWRITER_60
491     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer", "Writer 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
492     //SOT_FORMATSTR_ID_STARWRITERWEB_60
493     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.web", "Writer/Web 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
494     //SOT_FORMATSTR_ID_STARWRITERGLOB_60
495     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.global", "Writer/Global 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
496     //SOT_FORMATSTR_ID_STARWDRAW_60
497     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.draw", "Draw 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
498     //SOT_FORMATSTR_ID_STARIMPRESS_60
499     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.impress", "Impress 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
500     //SOT_FORMATSTR_ID_STARCALC_60
501     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.calc", "Calc 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
502     //SOT_FORMATSTR_ID_STARCHART_60
503     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.chart", "Chart 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
504     //SOT_FORMATSTR_ID_STARMATH_60
505     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.math", "Math 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
506     //SOT_FORMATSTR_ID_DIALOG_60
507     m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.dialog", "Dialog 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
508     //SOT_FORMATSTR_ID_BMP
509     m_TranslTable.push_back(FormatEntry("image/bmp", "Windows Bitmap", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
510     //SOT_FORMATSTR_ID_DUMMY3
511     m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
512     //SOT_FORMATSTR_ID_DUMMY4
513     m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
514 }
515 
516 // -------------------------------------------------
517 //
518 // -------------------------------------------------
519 
520 void SAL_CALL CDataFormatTranslator::findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, DataFlavor& aDataFlavor ) const
521 {
522     /*
523         we break the for loop if we find the first CF_INVALID
524         because in the translation table the entries with a
525         standard clipboard format id appear before the other
526         entries with CF_INVALID
527     */
528     vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
529     for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
530     {
531         sal_Int32 stdId = citer->aStandardFormatId;
532         if ( aStandardFormatId == stdId )
533         {
534             aDataFlavor = citer->aDataFlavor;
535             break;
536         }
537         else if ( stdId == CF_INVALID )
538             break;
539     }
540 }
541 
542 // -------------------------------------------------
543 //
544 // -------------------------------------------------
545 
546 void SAL_CALL CDataFormatTranslator::findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, DataFlavor& aDataFlavor ) const
547 {
548     vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
549     for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( );
550           citer != citer_end;
551           ++citer )
552     {
553         if ( aNativeFormatName.equalsIgnoreAsciiCase( citer->aNativeFormatName ) )
554         {
555             aDataFlavor = citer->aDataFlavor;
556             break;
557         }
558     }
559 }
560 
561 // -------------------------------------------------
562 //
563 // -------------------------------------------------
564 
565 void SAL_CALL CDataFormatTranslator::findStandardFormatIdForCharset( const OUString& aCharset, Any& aAny ) const
566 {
567     if ( aCharset.equalsIgnoreAsciiCase( OUSTR( utf-16 ) ) )
568         aAny <<= static_cast< sal_Int32 >( CF_UNICODETEXT );
569     else
570     {
571         sal_Int32 wincp = getWinCPFromMimeCharset( aCharset );
572         if ( IsOEMCP ( wincp ) )
573             aAny <<= static_cast< sal_Int32 >( CF_OEMTEXT );
574     }
575 }
576 
577 // -------------------------------------------------
578 //
579 // -------------------------------------------------
580 
581 void SAL_CALL CDataFormatTranslator::setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, Any& aAny ) const
582 {
583     vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
584     for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
585     {
586         if ( aNativeFormatName.equalsIgnoreAsciiCase( citer->aNativeFormatName ) &&
587              (CF_INVALID != citer->aStandardFormatId) )
588         {
589             aAny <<= citer->aStandardFormatId;
590             break;
591         }
592     }
593 }
594 
595 // -------------------------------------------------
596 //
597 // -------------------------------------------------
598 
599 void SAL_CALL CDataFormatTranslator::findStdFormatIdOrNativeFormatNameForFullMediaType(
600     const Reference< XMimeContentTypeFactory >& aRefXMimeFactory,
601     const OUString& aFullMediaType,
602     Any& aAny ) const
603 {
604     vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
605     for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
606     {
607         Reference< XMimeContentType >
608         refXMime( aRefXMimeFactory->createMimeContentType( citer->aDataFlavor.MimeType ) );
609         if ( aFullMediaType.equalsIgnoreAsciiCase( refXMime->getFullMediaType( ) ) )
610         {
611             sal_Int32 cf = citer->aStandardFormatId;
612             if ( CF_INVALID != cf )
613                 aAny <<= cf;
614             else
615             {
616                 OSL_ENSURE( citer->aNativeFormatName.getLength( ),
617                     "Invalid standard format id and empty native format name in translation table" );
618                 aAny <<= citer->aNativeFormatName;
619             }
620             break;
621         }
622     }
623 }
624 
625 // -------------------------------------------------
626 //
627 // -------------------------------------------------
628 
629 inline sal_Bool CDataFormatTranslator::isTextPlainMediaType( const OUString& fullMediaType ) const
630 {
631     return (fullMediaType.equalsIgnoreAsciiCase(OUSTR(text/plain)));
632 }
633 
634 // -------------------------------------------------
635 //
636 // -------------------------------------------------
637 
638 DataFlavor SAL_CALL CDataFormatTranslator::mkDataFlv(const OUString& cnttype, const OUString& hpname, Type dtype)
639 {
640     DataFlavor dflv;
641     dflv.MimeType             = cnttype;
642     dflv.HumanPresentableName = hpname;
643     dflv.DataType             = dtype;
644     return dflv;
645 }
646