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