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