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