148123e16SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
348123e16SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
448123e16SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
548123e16SAndrew Rist  * distributed with this work for additional information
648123e16SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
748123e16SAndrew Rist  * to you under the Apache License, Version 2.0 (the
848123e16SAndrew Rist  * "License"); you may not use this file except in compliance
948123e16SAndrew Rist  * with the License.  You may obtain a copy of the License at
1048123e16SAndrew Rist  *
1148123e16SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1248123e16SAndrew Rist  *
1348123e16SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1448123e16SAndrew Rist  * software distributed under the License is distributed on an
1548123e16SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1648123e16SAndrew Rist  * KIND, either express or implied.  See the License for the
1748123e16SAndrew Rist  * specific language governing permissions and limitations
1848123e16SAndrew Rist  * under the License.
1948123e16SAndrew Rist  *
2048123e16SAndrew Rist  *************************************************************/
2148123e16SAndrew Rist 
2248123e16SAndrew 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
279*45fd3b9aSArmin Le Grand 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_DIBV5, CPPUTYPE_DEFAULT));
280cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_DIB, CPPUTYPE_DEFAULT));
281cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", "Bitmap", "Bitmap", CF_BITMAP, CPPUTYPE_DEFAULT));
282cdf0e10cSrcweir 	// SOT_FORMAT_STRING
283cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("text/plain;charset=utf-16", "Unicode-Text", "", CF_UNICODETEXT, CppuType_String));
284cdf0e10cSrcweir 	// Format Locale - for internal use
285cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-locale;windows_formatname=\"Locale\"", "Locale", "Locale", CF_LOCALE, CPPUTYPE_DEFAULT));
286cdf0e10cSrcweir 	// SOT_FORMAT_WMF
287cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", "Windows MetaFile", "Image WMF", CF_METAFILEPICT, CPPUTYPE_DEFAULT));
288cdf0e10cSrcweir 	// SOT_FORMAT_EMF
289cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-emf;windows_formatname=\"Image EMF\"", "Windows Enhanced MetaFile", "Image EMF", CF_ENHMETAFILE, CPPUTYPE_DEFAULT));
290cdf0e10cSrcweir 	// SOT_FORMAT_FILE_LIST
291cdf0e10cSrcweir     m_TranslTable.push_back(FormatEntry("application/x-openoffice-filelist;windows_formatname=\"FileList\"", "FileList", "FileList", CF_HDROP, CPPUTYPE_DEFAULT));
292cdf0e10cSrcweir     //SOT_FORMATSTR_ID_SYLK
293cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk;windows_formatname=\"Sylk\"", "Sylk", "Sylk", CF_SYLK, CPPUTYPE_DEFAULT ) );
294cdf0e10cSrcweir 	// SOT_FORMAT_GDIMETAFILE
295cdf0e10cSrcweir     m_TranslTable.push_back(FormatEntry("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"", "GDIMetaFile", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
296cdf0e10cSrcweir     // SOT_FORMAT_PRIVATE
297cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-private;windows_formatname=\"Private\"", "Private", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
298cdf0e10cSrcweir 	// SOT_FORMAT_FILE
299cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-file;windows_formatname=\"FileName\"", "FileName", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
300cdf0e10cSrcweir 	// SOT_FORMAT_RTF
301cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("text/richtext", "Rich Text Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
302cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_DRAWING
303cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-drawing;windows_formatname=\"Drawing Format\"", "Drawing Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
304cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_SVXB
305cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-svbx;windows_formatname=\"SVXB (StarView Bitmap/Animation)\"", "SVXB (StarView Bitmap/Animation)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
306cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_SVIM
307cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-svim;windows_formatname=\"SVIM (StarView ImageMap)\"", "SVIM (StarView ImageMap)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
308cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_XFA
309cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-xfa;windows_formatname=\"XFA (XOutDev FillAttr)\"", "XFA (XOutDev FillAttr)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
310cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_EDITENGINE
311cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-editengine;windows_formatname=\"EditEngineFormat\"", "EditEngineFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
312cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_INTERNALLINK_STATE
313cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-internallink-state;windows_formatname=\"StatusInfo vom SvxInternalLink\"", "StatusInfo vom SvxInternalLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
314cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_SOLK
315cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-solk;windows_formatname=\"SOLK (StarOffice Link)\"", "SOLK (StarOffice Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
316cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
317cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-bookmark;windows_formatname=\"Netscape Bookmark\"", "Netscape Bookmark", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
318cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_TREELISTBOX
319cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-treelistbox;windows_formatname=\"SV_LBOX_DD_FORMAT\"", "SV_LBOX_DD_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
320cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_NATIVE
321cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
322cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_OWNERLINK
323cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-ownerlink;windows_formatname=\"OwnerLink\"", "OwnerLink", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
324cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARSERVER
325cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starserver;windows_formatname=\"StarServerFormat\"", "StarServerFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
326cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STAROBJECT
327cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject;windows_formatname=\"StarObjectFormat\"", "StarObjectFormat", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
328cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_APPLETOBJECT
329cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-appletobject;windows_formatname=\"Applet Object\"", "Applet Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
330cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_PLUGIN_OBJECT
331cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-plugin-object;windows_formatname=\"PlugIn Object\"", "PlugIn Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
332cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARWRITER_30
333cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-30;windows_formatname=\"StarWriter 3.0\"", "StarWriter 3.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
334cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITER_40
335cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-40;windows_formatname=\"StarWriter 4.0\"", "StarWriter 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
336cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITER_50
337cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starwriter-50;windows_formatname=\"StarWriter 5.0\"", "StarWriter 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
338cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITERWEB_40
339cdf0e10cSrcweir 	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));
340cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITERWEB_50
341cdf0e10cSrcweir 	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));
342cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITERGLOB_40
343cdf0e10cSrcweir 	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));
344cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARWRITERGLOB_50
345cdf0e10cSrcweir 	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));
346cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARDRAW
347cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw;windows_formatname=\"StarDrawDocument\"", "StarDrawDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
348cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARDRAW_40
349cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-40;windows_formatname=\"StarDrawDocument 4.0\"", "StarDrawDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
350cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARIMPRESS_50
351cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimpress-50;windows_formatname=\"StarImpress 5.0\"", "StarImpress 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
352cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARDRAW_50
353cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-50;windows_formatname=\"StarDraw 5.0\"", "StarDraw 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
354cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARCALC
355cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc;windows_formatname=\"StarCalcDocument\"", "StarCalcDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
356cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARCALC_40
357cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-40;windows_formatname=\"StarCalc 4.0\"", "StarCalc 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
358cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARCALC_50
359cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starcalc-50;windows_formatname=\"StarCalc 5.0\"", "StarCalc 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
360cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARCHART
361cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart;windows_formatname=\"StarChartDocument\"", "StarChartDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
362cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARCHART_40
363cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-40;windows_formatname=\"StarChartDocument 4.0\"", "StarChartDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
364cdf0e10cSrcweir 	// SOT_FORMATSTR_ID_STARCHART_50
365cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchart-50;windows_formatname=\"StarChart 5.0\"", "StarChart 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
366cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARIMAGE
367cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage;windows_formatname=\"StarImageDocument\"", "StarImageDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
368cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARIMAGE_40
369cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-40;windows_formatname=\"StarImageDocument 4.0\"", "StarImageDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
370cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARIMAGE_50
371cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starimage-50;windows_formatname=\"StarImage 5.0\"",  "StarImage 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
372cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARMATH
373cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath;windows_formatname=\"StarMath\"", "StarMath", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
374cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARMATH_40
375cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-40;windows_formatname=\"StarMathDocument 4.0\"", "StarMathDocument 4.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
376cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARMATH_50
377cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starmath-50;windows_formatname=\"StarMath 5.0\"", "StarMath 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
378cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STAROBJECT_PAINTDOC
379cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starobject-paintdoc;windows_formatname=\"StarObjectPaintDocument\"", "StarObjectPaintDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
380cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_FILLED_AREA
381cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-filled-area;windows_formatname=\"FilledArea\"", "FilledArea", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
382cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_HTML
383cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("text/html", "HTML (HyperText Markup Language)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
384cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_HTML_SIMPLE
385cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-html-simple;windows_formatname=\"HTML Format\"", "HTML Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
386cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_CHAOS
387cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-chaos;windows_formatname=\"FORMAT_CHAOS\"", "FORMAT_CHAOS", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
388cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_CNT_MSGATTACHFILE
389cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-msgattachfile;windows_formatname=\"CNT_MSGATTACHFILE_FORMAT\"", "CNT_MSGATTACHFILE_FORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
390cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_BIFF_5
391cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff5;windows_formatname=\"Biff5\"", "Biff5", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
392cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_BIFF__5
393cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-5;windows_formatname=\"Biff 5\"", "Biff 5", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
394cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_BIFF_8
395cdf0e10cSrcweir     m_TranslTable.push_back(FormatEntry("application/x-openoffice-biff-8;windows_formatname=\"Biff8\"", "Biff8", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
396cdf0e10cSrcweir     //SOT_FORMATSTR_ID_SYLK_BIGCAPS
397cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sylk-bigcaps;windows_formatname=\"SYLK\"", "SYLK", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
398cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_LINK
399cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-link;windows_formatname=\"Link\"", "Link", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
400cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARDRAW_TABBAR
401cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-stardraw-tabbar;windows_formatname=\"StarDraw TabBar\"", "StarDraw TabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
402cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SONLK
403cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sonlk;windows_formatname=\"SONLK (StarOffice Navi Link)\"", "SONLK (StarOffice Navi Link)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
404cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_MSWORD_DOC
405cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/msword", "MSWordDoc", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
406cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STAR_FRAMESET_DOC
407cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-star-frameset-doc;windows_formatname=\"StarFrameSetDocument\"", "StarFrameSetDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
408cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_OFFICE_DOC
409cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-office-doc;windows_formatname=\"OfficeDocument\"", "OfficeDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
410cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_NOTES_DOCINFO
411cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-docinfo;windows_formatname=\"NotesDocInfo\"", "NotesDocInfo", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
412cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_NOTES_HNOTE
413cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-hnote;windows_formatname=\"NoteshNote\"", "NoteshNote", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
414cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_NOTES_NATIVE
415cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-notes-native;windows_formatname=\"Native\"", "Native", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
416cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SFX_DOC
417cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sfx-doc;windows_formatname=\"SfxDocument\"", "SfxDocument", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
418cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EVDF
419cdf0e10cSrcweir 	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));
420cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_ESDF
421cdf0e10cSrcweir 	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));
422cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_IDF
423cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-idf;windows_formatname=\"IDF (Iconview Dummy Format)\"", "IDF (Iconview Dummy Format)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
424cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EFTP
425cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-eftp;windows_formatname=\"EFTP (Explorer Ftp File)\"", "EFTP (Explorer Ftp File)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
426cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EFD
427cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-efd;windows_formatname=\"EFD (Explorer Ftp Dir)\"", "EFD (Explorer Ftp Dir)", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
428cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SVX_FORMFIELDEXCH
429cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-svx-formfieldexch;windows_formatname=\"SvxFormFieldExch\"", "SvxFormFieldExch", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
430cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EXTENDED_TABBAR
431cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-extended-tabbar;windows_formatname=\"ExtendedTabBar\"", "ExtendedTabBar", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
432cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_DATAEXCHANGE
433cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-dataexchange;windows_formatname=\"SBA-DATAFORMAT\"", "SBA-DATAFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
434cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE
435cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-fielddataexchange;windows_formatname=\"SBA-FIELDFORMAT\"", "SBA-FIELDFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
436cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_PRIVATE_URL
437cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-private-url;windows_formatname=\"SBA-PRIVATEURLFORMAT\"", "SBA-PRIVATEURLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
438cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_TABED
439cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabed;windows_formatname=\"Tabed\"", "Tabed", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
440cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_TABID
441cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-tabid;windows_formatname=\"Tabid\"", "Tabid", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
442cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_JOIN
443cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-join;windows_formatname=\"SBA-JOINFORMAT\"", "SBA-JOINFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
444cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_OBJECTDESCRIPTOR
445cdf0e10cSrcweir 	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));
446cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR
447cdf0e10cSrcweir 	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));
448cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EMBED_SOURCE
449cdf0e10cSrcweir 	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));
450cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_LINK_SOURCE
451cdf0e10cSrcweir 	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));
452cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EMBEDDED_OBJ
453cdf0e10cSrcweir 	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));
454cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_FILECONTENT
455cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-filecontent;windows_formatname=\"" CFSTR_FILECONTENTS "\"", CFSTR_FILECONTENTS, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
456cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
457cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-filegrpdescriptor;windows_formatname=\"" CFSTR_FILEDESCRIPTOR "\"", CFSTR_FILEDESCRIPTOR, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
458cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_FILENAME
459cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-filename;windows_formatname=\"" CFSTR_FILENAME "\"", CFSTR_FILENAME, NULL, CF_INVALID, CPPUTYPE_DEFAULT));
460cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SD_OLE
461cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sd-ole;windows_formatname=\"SD-OLE\"", "SD-OLE", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
462cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE
463cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-embedded-obj-ole;windows_formatname=\"Embedded Object\"", "Embedded Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
464cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_EMBED_SOURCE_OLE
465cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-embed-source-ole;windows_formatname=\"Embed Source\"", "Embed Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
466cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE
467cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-objectdescriptor-ole;windows_formatname=\"Object Descriptor\"", "Object Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
468cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_LINKSRCDESCRIPTOR_OLE
469cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-linkdescriptor-ole;windows_formatname=\"Link Source Descriptor\"", "Link Source Descriptor", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
470cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_LINK_SOURCE_OLE
471cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-link-source-ole;windows_formatname=\"Link Source\"", "Link Source", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
472cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE
473cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-ctrldataexchange;windows_formatname=\"SBA-CTRLFORMAT\"", "SBA-CTRLFORMAT", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
474cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_OUTPLACE_OBJ
475cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-outplace-obj;windows_formatname=\"OutPlace Object\"", "OutPlace Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
476cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_CNT_OWN_CLIP
477cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-cnt-own-clip;windows_formatname=\"CntOwnClipboard\"", "CntOwnClipboard", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
478cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_INET_IMAGE
479cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-inet-image;windows_formatname=\"SO-INet-Image\"", "SO-INet-Image", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
480cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_NETSCAPE_IMAGE
481cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-netscape-image;windows_formatname=\"Netscape Image Format\"", "Netscape Image Format", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
482cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_SBA_FORMEXCHANGE
483cdf0e10cSrcweir 	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
484cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-sba-reportexchange;windows_formatname=\"SBA_REPORTEXCHANGE\"", "SBA_REPORTEXCHANGE", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
485cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
486cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-uniformresourcelocator;windows_formatname=\"UniformResourceLocator\"", "UniformResourceLocator", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
487cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARCHARTDOCUMENT_50
488cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-starchartdocument-50;windows_formatname=\"StarChartDocument 5.0\"", "StarChartDocument 5.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
489cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_GRAPHOBJ
490cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-graphobj;windows_formatname=\"Graphic Object\"", "Graphic Object", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
491cdf0e10cSrcweir     //SOT_FORMATSTR_ID_STARWRITER_60
492cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer", "Writer 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
493cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITERWEB_60
494cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.web", "Writer/Web 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
495cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWRITERGLOB_60
496cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.writer.global", "Writer/Global 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
497cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARWDRAW_60
498cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.draw", "Draw 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
499cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARIMPRESS_60
500cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.impress", "Impress 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
501cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARCALC_60
502cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.calc", "Calc 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
503cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARCHART_60
504cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.chart", "Chart 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
505cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_STARMATH_60
506cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.math", "Math 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
507cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_DIALOG_60
508cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/vnd.sun.xml.dialog", "Dialog 6.0", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
509cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_BMP
510cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("image/bmp", "Windows Bitmap", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
511*45fd3b9aSArmin Le Grand 	//SOT_FORMATSTR_ID_PNG
512*45fd3b9aSArmin Le Grand 	m_TranslTable.push_back(FormatEntry("image/png", "PNG", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
513cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_DUMMY3
514cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy3;windows_formatname=\"SO_DUMMYFORMAT_3\"", "SO_DUMMYFORMAT_3", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
515cdf0e10cSrcweir 	//SOT_FORMATSTR_ID_DUMMY4
516cdf0e10cSrcweir 	m_TranslTable.push_back(FormatEntry("application/x-openoffice-dummy4;windows_formatname=\"SO_DUMMYFORMAT_4\"", "SO_DUMMYFORMAT_4", NULL, CF_INVALID, CPPUTYPE_DEFAULT));
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
519cdf0e10cSrcweir // -------------------------------------------------
520cdf0e10cSrcweir //
521cdf0e10cSrcweir // -------------------------------------------------
522cdf0e10cSrcweir 
523cdf0e10cSrcweir void SAL_CALL CDataFormatTranslator::findDataFlavorForStandardFormatId( sal_Int32 aStandardFormatId, DataFlavor& aDataFlavor ) const
524cdf0e10cSrcweir {
525cdf0e10cSrcweir 	/*
526cdf0e10cSrcweir 		we break the for loop if we find the first CF_INVALID
527cdf0e10cSrcweir 		because in the translation table the entries with a
528cdf0e10cSrcweir 		standard clipboard format id appear before the other
529cdf0e10cSrcweir 		entries with CF_INVALID
530cdf0e10cSrcweir 	*/
531cdf0e10cSrcweir 	vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
532cdf0e10cSrcweir 	for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
533cdf0e10cSrcweir 	{
534cdf0e10cSrcweir 		sal_Int32 stdId = citer->aStandardFormatId;
535cdf0e10cSrcweir 		if ( aStandardFormatId == stdId )
536cdf0e10cSrcweir 		{
537cdf0e10cSrcweir 			aDataFlavor = citer->aDataFlavor;
538cdf0e10cSrcweir 			break;
539cdf0e10cSrcweir 		}
540cdf0e10cSrcweir 		else if ( stdId == CF_INVALID )
541cdf0e10cSrcweir 			break;
542cdf0e10cSrcweir 	}
543cdf0e10cSrcweir }
544cdf0e10cSrcweir 
545cdf0e10cSrcweir // -------------------------------------------------
546cdf0e10cSrcweir //
547cdf0e10cSrcweir // -------------------------------------------------
548cdf0e10cSrcweir 
549cdf0e10cSrcweir void SAL_CALL CDataFormatTranslator::findDataFlavorForNativeFormatName( const OUString& aNativeFormatName, DataFlavor& aDataFlavor ) const
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
552cdf0e10cSrcweir 	for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( );
553cdf0e10cSrcweir 		  citer != citer_end;
554cdf0e10cSrcweir 		  ++citer )
555cdf0e10cSrcweir 	{
556cdf0e10cSrcweir 		if ( aNativeFormatName.equalsIgnoreAsciiCase( citer->aNativeFormatName ) )
557cdf0e10cSrcweir 		{
558cdf0e10cSrcweir 			aDataFlavor = citer->aDataFlavor;
559cdf0e10cSrcweir 			break;
560cdf0e10cSrcweir 		}
561cdf0e10cSrcweir 	}
562cdf0e10cSrcweir }
563cdf0e10cSrcweir 
564cdf0e10cSrcweir // -------------------------------------------------
565cdf0e10cSrcweir //
566cdf0e10cSrcweir // -------------------------------------------------
567cdf0e10cSrcweir 
568cdf0e10cSrcweir void SAL_CALL CDataFormatTranslator::findStandardFormatIdForCharset( const OUString& aCharset, Any& aAny ) const
569cdf0e10cSrcweir {
570cdf0e10cSrcweir 	if ( aCharset.equalsIgnoreAsciiCase( OUSTR( utf-16 ) ) )
571cdf0e10cSrcweir 		aAny <<= static_cast< sal_Int32 >( CF_UNICODETEXT );
572cdf0e10cSrcweir 	else
573cdf0e10cSrcweir 	{
574cdf0e10cSrcweir 		sal_Int32 wincp = getWinCPFromMimeCharset( aCharset );
575cdf0e10cSrcweir 		if ( IsOEMCP ( wincp ) )
576cdf0e10cSrcweir 			aAny <<= static_cast< sal_Int32 >( CF_OEMTEXT );
577cdf0e10cSrcweir 	}
578cdf0e10cSrcweir }
579cdf0e10cSrcweir 
580cdf0e10cSrcweir // -------------------------------------------------
581cdf0e10cSrcweir //
582cdf0e10cSrcweir // -------------------------------------------------
583cdf0e10cSrcweir 
584cdf0e10cSrcweir void SAL_CALL CDataFormatTranslator::setStandardFormatIdForNativeFormatName( const OUString& aNativeFormatName, Any& aAny ) const
585cdf0e10cSrcweir {
586cdf0e10cSrcweir 	vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
587cdf0e10cSrcweir 	for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
588cdf0e10cSrcweir 	{
589cdf0e10cSrcweir 		if ( aNativeFormatName.equalsIgnoreAsciiCase( citer->aNativeFormatName ) &&
590cdf0e10cSrcweir 			 (CF_INVALID != citer->aStandardFormatId) )
591cdf0e10cSrcweir 		{
592cdf0e10cSrcweir 			aAny <<= citer->aStandardFormatId;
593cdf0e10cSrcweir 			break;
594cdf0e10cSrcweir 		}
595cdf0e10cSrcweir 	}
596cdf0e10cSrcweir }
597cdf0e10cSrcweir 
598cdf0e10cSrcweir // -------------------------------------------------
599cdf0e10cSrcweir //
600cdf0e10cSrcweir // -------------------------------------------------
601cdf0e10cSrcweir 
602cdf0e10cSrcweir void SAL_CALL CDataFormatTranslator::findStdFormatIdOrNativeFormatNameForFullMediaType(
603cdf0e10cSrcweir 	const Reference< XMimeContentTypeFactory >& aRefXMimeFactory,
604cdf0e10cSrcweir 	const OUString& aFullMediaType,
605cdf0e10cSrcweir 	Any& aAny ) const
606cdf0e10cSrcweir {
607cdf0e10cSrcweir 	vector< FormatEntry >::const_iterator citer_end = m_TranslTable.end( );
608cdf0e10cSrcweir 	for ( vector< FormatEntry >::const_iterator citer = m_TranslTable.begin( ); citer != citer_end; ++citer )
609cdf0e10cSrcweir 	{
610cdf0e10cSrcweir 		Reference< XMimeContentType >
611cdf0e10cSrcweir 		refXMime( aRefXMimeFactory->createMimeContentType( citer->aDataFlavor.MimeType ) );
612cdf0e10cSrcweir 		if ( aFullMediaType.equalsIgnoreAsciiCase( refXMime->getFullMediaType( ) ) )
613cdf0e10cSrcweir 		{
614cdf0e10cSrcweir 			sal_Int32 cf = citer->aStandardFormatId;
615cdf0e10cSrcweir 			if ( CF_INVALID != cf )
616cdf0e10cSrcweir 				aAny <<= cf;
617cdf0e10cSrcweir 			else
618cdf0e10cSrcweir 			{
619cdf0e10cSrcweir 				OSL_ENSURE( citer->aNativeFormatName.getLength( ),
620cdf0e10cSrcweir 					"Invalid standard format id and empty native format name in translation table" );
621cdf0e10cSrcweir 				aAny <<= citer->aNativeFormatName;
622cdf0e10cSrcweir 			}
623cdf0e10cSrcweir 			break;
624cdf0e10cSrcweir 		}
625cdf0e10cSrcweir 	}
626cdf0e10cSrcweir }
627cdf0e10cSrcweir 
628cdf0e10cSrcweir // -------------------------------------------------
629cdf0e10cSrcweir //
630cdf0e10cSrcweir // -------------------------------------------------
631cdf0e10cSrcweir 
632cdf0e10cSrcweir inline sal_Bool CDataFormatTranslator::isTextPlainMediaType( const OUString& fullMediaType ) const
633cdf0e10cSrcweir {
634cdf0e10cSrcweir 	return (fullMediaType.equalsIgnoreAsciiCase(OUSTR(text/plain)));
635cdf0e10cSrcweir }
636cdf0e10cSrcweir 
637cdf0e10cSrcweir // -------------------------------------------------
638cdf0e10cSrcweir //
639cdf0e10cSrcweir // -------------------------------------------------
640cdf0e10cSrcweir 
641cdf0e10cSrcweir DataFlavor SAL_CALL CDataFormatTranslator::mkDataFlv(const OUString& cnttype, const OUString& hpname, Type dtype)
642cdf0e10cSrcweir {
643cdf0e10cSrcweir 	DataFlavor dflv;
644cdf0e10cSrcweir 	dflv.MimeType             = cnttype;
645cdf0e10cSrcweir 	dflv.HumanPresentableName = hpname;
646cdf0e10cSrcweir 	dflv.DataType             = dtype;
647cdf0e10cSrcweir 	return dflv;
648cdf0e10cSrcweir }
649