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