update dev300-m58
[ooovba.git] / oox / source / dump / oledumper.cxx
blob721820090bb095b9dce1048fedfd2144b18515e9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: oledumper.cxx,v $
10 * $Revision: 1.1.2.13 $
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 #include "oox/dump/oledumper.hxx"
32 #include <com/sun/star/io/XInputStream.hpp>
33 #include <com/sun/star/io/XOutputStream.hpp>
34 #include <osl/thread.h>
35 #include <osl/file.hxx>
36 #include <rtl/tencinfo.h>
37 #include "oox/helper/binaryoutputstream.hxx"
38 #include "oox/core/filterbase.hxx"
39 #include "oox/ole/vbainputstream.hxx"
40 #include "oox/xls/biffhelper.hxx"
42 #if OOX_INCLUDE_DUMPER
44 using ::rtl::OUString;
45 using ::rtl::OUStringBuffer;
46 using ::rtl::OString;
47 using ::rtl::OStringToOUString;
48 using ::com::sun::star::uno::Reference;
49 using ::com::sun::star::io::XInputStream;
50 using ::com::sun::star::io::XOutputStream;
52 namespace oox {
53 namespace dump {
55 // ============================================================================
56 // ============================================================================
58 StdFontObject::StdFontObject( const InputObjectBase& rParent ) :
59 InputObjectBase( rParent )
63 void StdFontObject::implDump()
65 dumpDec< sal_uInt8 >( "version" );
66 dumpDec< sal_uInt16 >( "charset", "CHARSET" );
67 dumpHex< sal_uInt8 >( "flags", "STDFONT-FLAGS" );
68 dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
69 dumpDec< sal_uInt32 >( "height", "STDFONT-HEIGHT" );
70 dumpCharArray( "name", in().readuInt8(), RTL_TEXTENCODING_ASCII_US );
73 // ============================================================================
75 StdPicObject::StdPicObject( const InputObjectBase& rParent ) :
76 InputObjectBase( rParent )
80 void StdPicObject::implDump()
82 dumpHex< sal_uInt32 >( "identifier" );
83 sal_uInt32 nSize = dumpHex< sal_uInt32 >( "image-size", "CONV-DEC" );
84 dumpBinary( "image-data", nSize );
87 // ============================================================================
89 namespace {
91 const sal_uInt32 STDHLINK_HASTARGET = 0x00000001; /// Has hyperlink moniker.
92 const sal_uInt32 STDHLINK_ABSOLUTE = 0x00000002; /// Absolute path.
93 const sal_uInt32 STDHLINK_HASLOCATION = 0x00000008; /// Has target location.
94 const sal_uInt32 STDHLINK_HASDISPLAY = 0x00000010; /// Has display string.
95 const sal_uInt32 STDHLINK_HASGUID = 0x00000020; /// Has identification GUID.
96 const sal_uInt32 STDHLINK_HASTIME = 0x00000040; /// Has creation time.
97 const sal_uInt32 STDHLINK_HASFRAME = 0x00000080; /// Has frame.
98 const sal_uInt32 STDHLINK_ASSTRING = 0x00000100; /// Hyperlink as simple string.
100 } // namespace
102 StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent ) :
103 InputObjectBase( rParent )
107 void StdHlinkObject::implDump()
109 dumpDec< sal_uInt32 >( "stream-version" );
110 sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "STDHLINK-FLAGS" );
111 if( getFlag( nFlags, STDHLINK_HASDISPLAY ) )
112 dumpHyperlinkString( "display", true );
113 if( getFlag( nFlags, STDHLINK_HASFRAME ) )
114 dumpHyperlinkString( "frame", true );
115 if( getFlag( nFlags, STDHLINK_HASTARGET ) )
117 if( getFlag( nFlags, STDHLINK_ASSTRING ) )
118 dumpHyperlinkString( "filename", true );
119 else if( !dumpGuidAndMoniker() )
120 return;
122 if( getFlag( nFlags, STDHLINK_HASLOCATION ) )
123 dumpHyperlinkString( "location", true );
124 if( getFlag( nFlags, STDHLINK_HASGUID ) )
125 dumpGuid( "id-guid" );
126 if( getFlag( nFlags, STDHLINK_HASTIME ) )
127 dumpFileTime( "creation-time" );
130 OUString StdHlinkObject::dumpHyperlinkString( const String& rName, bool bUnicode )
132 sal_Int32 nLen = in().readInt32();
133 return bUnicode ? dumpUnicodeArray( rName, nLen ) : dumpCharArray( rName, nLen, osl_getThreadTextEncoding() );
136 bool StdHlinkObject::dumpGuidAndMoniker()
138 bool bValidMoniker = true;
139 OUString aGuid = cfg().getStringOption( dumpGuid( "moniker" ), OUString() );
140 IndentGuard aIndGuard( out() );
141 if( aGuid.equalsAscii( "URLMoniker" ) )
142 dumpUrlMoniker();
143 else if( aGuid.equalsAscii( "FileMoniker" ) )
144 dumpFileMoniker();
145 else if( aGuid.equalsAscii( "ItemMoniker" ) )
146 dumpItemMoniker();
147 else if( aGuid.equalsAscii( "AntiMoniker" ) )
148 dumpAntiMoniker();
149 else if( aGuid.equalsAscii( "CompositeMoniker" ) )
150 dumpCompositeMoniker();
151 else
152 bValidMoniker = false;
153 return bValidMoniker;
156 void StdHlinkObject::dumpUrlMoniker()
158 sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
159 sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
160 dumpNullUnicodeArray( "url" );
161 if( in().tell() + 24 == nEndPos )
163 dumpGuid( "implementation-id" );
164 dumpDec< sal_uInt32 >( "version" );
165 dumpHex< sal_uInt32 >( "flags", "STDHLINK-URL-FLAGS" );
167 dumpRemainingTo( nEndPos );
170 void StdHlinkObject::dumpFileMoniker()
172 dumpDec< sal_Int16 >( "up-levels" );
173 dumpHyperlinkString( "ansi-filename", false );
174 dumpDec< sal_Int16 >( "server-path-len" );
175 dumpHex< sal_uInt16 >( "version" );
176 dumpUnused( 20 );
177 sal_Int32 nBytes = dumpDec< sal_Int32 >( "total-bytes" );
178 sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
179 if( nBytes > 0 )
181 sal_Int32 nFileBytes = dumpDec< sal_Int32 >( "uni-filename-bytes" );
182 dumpDec< sal_uInt16 >( "key-value" );
183 dumpUnicodeArray( "unicode-filename", nFileBytes / 2 );
185 dumpRemainingTo( nEndPos );
188 void StdHlinkObject::dumpItemMoniker()
190 sal_Int32 nBytes = dumpDec< sal_Int32 >( "delimiter-bytes" );
191 sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
192 dumpNullCharArray( "ansi-delimiter", osl_getThreadTextEncoding() );
193 if( in().tell() < nEndPos )
194 dumpUnicodeArray( "unicode-delimiter", (nEndPos - in().tell()) / 2 );
195 in().seek( nEndPos );
197 nBytes = dumpDec< sal_Int32 >( "item-bytes" );
198 nEndPos = in().tell() + ::std::max< sal_Int32 >( nBytes, 0 );
199 dumpNullCharArray( "ansi-item", osl_getThreadTextEncoding() );
200 if( in().tell() < nEndPos )
201 dumpUnicodeArray( "unicode-item", (nEndPos - in().tell()) / 2 );
202 in().seek( nEndPos );
205 void StdHlinkObject::dumpAntiMoniker()
207 dumpDec< sal_Int32 >( "count" );
210 void StdHlinkObject::dumpCompositeMoniker()
212 sal_Int32 nCount = dumpDec< sal_Int32 >( "moniker-count" );
213 for( sal_Int32 nIndex = 0; !in().isEof() && (nIndex < nCount); ++nIndex )
214 dumpGuidAndMoniker();
217 // ============================================================================
218 // ============================================================================
220 namespace {
222 const sal_Int32 OLEPROP_ID_DICTIONARY = 0;
223 const sal_Int32 OLEPROP_ID_CODEPAGE = 1;
225 const sal_Int32 OLEPROP_TYPE_INT16 = 2;
226 const sal_Int32 OLEPROP_TYPE_INT32 = 3;
227 const sal_Int32 OLEPROP_TYPE_FLOAT = 4;
228 const sal_Int32 OLEPROP_TYPE_DOUBLE = 5;
229 const sal_Int32 OLEPROP_TYPE_DATE = 7;
230 const sal_Int32 OLEPROP_TYPE_STRING = 8;
231 const sal_Int32 OLEPROP_TYPE_STATUS = 10;
232 const sal_Int32 OLEPROP_TYPE_BOOL = 11;
233 const sal_Int32 OLEPROP_TYPE_VARIANT = 12;
234 const sal_Int32 OLEPROP_TYPE_INT8 = 16;
235 const sal_Int32 OLEPROP_TYPE_UINT8 = 17;
236 const sal_Int32 OLEPROP_TYPE_UINT16 = 18;
237 const sal_Int32 OLEPROP_TYPE_UINT32 = 19;
238 const sal_Int32 OLEPROP_TYPE_INT64 = 20;
239 const sal_Int32 OLEPROP_TYPE_UINT64 = 21;
240 const sal_Int32 OLEPROP_TYPE_STRING8 = 30;
241 const sal_Int32 OLEPROP_TYPE_STRING16 = 31;
242 const sal_Int32 OLEPROP_TYPE_FILETIME = 64;
243 const sal_Int32 OLEPROP_TYPE_BLOB = 65;
244 const sal_Int32 OLEPROP_TYPE_STREAM = 66;
245 const sal_Int32 OLEPROP_TYPE_STORAGE = 67;
246 const sal_Int32 OLEPROP_TYPE_CLIPFMT = 71;
248 const sal_uInt16 CODEPAGE_UNICODE = 1200;
250 const sal_uInt32 OCX_STRING_COMPRESSED = 0x80000000;
252 } // namespace
254 // ============================================================================
256 OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
257 BinaryStreamObject( rParent, rxStrm, rSysFileName )
261 void OlePropertyStreamObject::implDump()
263 BinaryInputStream& rStrm = in();
264 Output& rOut = out();
266 OUStringVector aGuidVec;
267 ::std::vector< sal_uInt32 > aStartPosVec;
269 // dump header
270 writeEmptyItem( "HEADER" );
272 IndentGuard aIndGuard( rOut );
273 dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
274 dumpDec< sal_uInt16 >( "version" );
275 dumpDec< sal_uInt16 >( "os-minor" );
276 dumpDec< sal_uInt16 >( "os-type", "OLEPROP-OSTYPE" );
277 dumpGuid( "guid" );
278 sal_Int32 nSectCount = dumpDec< sal_Int32 >( "section-count" );
280 // dump table of section positions
282 TableGuard aTabGuard( rOut, 15, 60 );
283 rOut.resetItemIndex();
284 for( sal_Int32 nSectIdx = 0; !rStrm.isEof() && (nSectIdx < nSectCount); ++nSectIdx )
286 MultiItemsGuard aMultiGuard( rOut );
287 writeEmptyItem( "#section" );
288 aGuidVec.push_back( dumpGuid( "guid" ) );
289 aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" ) );
293 rOut.emptyLine();
295 // dump sections
296 for( size_t nSectIdx = 0; !rStrm.isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
297 dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
300 void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
302 BinaryInputStream& rStrm = in();
303 Output& rOut = out();
305 // property ID names
306 mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
307 OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
308 if( aGuidName.equalsAscii( "GlobalDocProp" ) )
309 mxPropIds->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
310 else if( aGuidName.equalsAscii( "BuiltinDocProp" ) )
311 mxPropIds->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
312 else
313 mxPropIds->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
315 // property ID/position map
316 typedef ::std::map< sal_Int32, sal_uInt32 > PropertyPosMap;
317 PropertyPosMap aPropMap;
319 // dump section header line
320 writeSectionHeader( rGuid, nStartPos );
322 // seek to section
323 IndentGuard aIndGuard( rOut );
324 if( startElement( nStartPos ) )
326 // dump section header
327 dumpDec< sal_Int32 >( "size" );
328 sal_Int32 nPropCount = dumpDec< sal_Int32 >( "property-count" );
330 // dump table of property positions
332 TableGuard aTabGuard( rOut, 15, 25 );
333 rOut.resetItemIndex();
334 for( sal_Int32 nPropIdx = 0; !rStrm.isEof() && (nPropIdx < nPropCount); ++nPropIdx )
336 MultiItemsGuard aMultiGuard( rOut );
337 writeEmptyItem( "#property" );
338 sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
339 sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" );
340 aPropMap[ nPropId ] = nPropPos;
344 rOut.emptyLine();
346 // code page property
347 meTextEnc = osl_getThreadTextEncoding();
348 mbIsUnicode = false;
349 PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
350 if( aCodePageIt != aPropMap.end() )
352 dumpCodePageProperty( aCodePageIt->second );
353 aPropMap.erase( aCodePageIt );
356 // dictionary property
357 PropertyPosMap::iterator aDictIt = aPropMap.find( OLEPROP_ID_DICTIONARY );
358 if( aDictIt != aPropMap.end() )
360 dumpDictionaryProperty( aDictIt->second );
361 aPropMap.erase( aDictIt );
364 // other properties
365 for( PropertyPosMap::const_iterator aIt = aPropMap.begin(), aEnd = aPropMap.end(); aIt != aEnd; ++aIt )
366 dumpProperty( aIt->first, aIt->second );
368 // remove the user defined list of property ID names
369 cfg().eraseNameList( "OLEPROP-IDS" );
372 void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
374 writePropertyHeader( nPropId, nStartPos );
375 IndentGuard aIndGuard( out() );
376 if( startElement( nStartPos ) )
377 dumpPropertyContents( nPropId );
378 out().emptyLine();
381 void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
383 writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
384 IndentGuard aIndGuard( out() );
385 if( startElement( nStartPos ) )
387 sal_Int32 nType = dumpPropertyType();
388 if( nType == OLEPROP_TYPE_INT16 )
390 sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
391 rtl_TextEncoding nNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
392 if( nNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
393 meTextEnc = nNewTextEnc;
394 mbIsUnicode = nCodePage == CODEPAGE_UNICODE;
396 else
397 dumpPropertyContents( OLEPROP_ID_CODEPAGE );
399 out().emptyLine();
402 void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
404 writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
405 IndentGuard aIndGuard( out() );
406 if( startElement( nStartPos ) )
408 sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
409 for( sal_Int32 nIdx = 0; !in().isEof() && (nIdx < nCount); ++nIdx )
411 MultiItemsGuard aMultiGuard( out() );
412 TableGuard aTabGuard( out(), 10, 20 );
413 sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
414 OUString aName = dumpString8( "name" );
415 if( mxPropIds.get() )
416 mxPropIds->setName( nId, aName );
419 out().emptyLine();
422 void OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
424 sal_Int32 nType = dumpPropertyType();
425 if( getFlag< sal_Int32 >( nType, 0x1000 ) ) // vector
427 sal_Int32 nBaseType = nType & 0x0FFF;
428 sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
429 for( sal_Int32 nElemIdx = 0; !in().isEof() && (nElemIdx < nElemCount); ++nElemIdx )
431 out().resetItemIndex( nElemIdx );
432 writeEmptyItem( "#element" );
433 IndentGuard aIndGuard( out() );
434 dumpPropertyValue( nPropId, nBaseType );
437 else if( !getFlag< sal_Int32 >( nType, 0x7000 ) )
439 dumpPropertyValue( nPropId, nType );
443 void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType )
445 switch( nBaseType )
447 case OLEPROP_TYPE_INT16: dumpDec< sal_Int16 >( "value" ); break;
448 case OLEPROP_TYPE_INT32: dumpDec< sal_Int32 >( "value" ); break;
449 case OLEPROP_TYPE_FLOAT: dumpDec< float >( "value" ); break;
450 case OLEPROP_TYPE_DOUBLE: dumpDec< double >( "value" ); break;
451 case OLEPROP_TYPE_DATE: dumpDec< double >( "date" ); break;
452 case OLEPROP_TYPE_STRING: dumpString8( "value" ); break;
453 case OLEPROP_TYPE_STATUS: dumpHex< sal_Int32 >( "status" ); break;
454 case OLEPROP_TYPE_BOOL: dumpBool< sal_Int16 >( "value" ); break;
455 case OLEPROP_TYPE_VARIANT: dumpPropertyContents( nPropId ); break;
456 case OLEPROP_TYPE_INT8: dumpDec< sal_Int8 >( "value" ); break;
457 case OLEPROP_TYPE_UINT8: dumpDec< sal_uInt8 >( "value" ); break;
458 case OLEPROP_TYPE_UINT16: dumpDec< sal_uInt16 >( "value" ); break;
459 case OLEPROP_TYPE_UINT32: dumpDec< sal_uInt32 >( "value" ); break;
460 case OLEPROP_TYPE_INT64: dumpDec< sal_Int64 >( "value" ); break;
461 case OLEPROP_TYPE_UINT64: dumpDec< sal_uInt64 >( "value" ); break;
462 case OLEPROP_TYPE_STRING8: dumpString8( "value" ); break;
463 case OLEPROP_TYPE_STRING16: dumpString16( "value" ); break;
464 case OLEPROP_TYPE_FILETIME: dumpFileTime( "file-time" ); break;
465 case OLEPROP_TYPE_BLOB: dumpBlob( "data" ); break;
466 case OLEPROP_TYPE_STREAM: dumpString8( "stream-name" ); break;
467 case OLEPROP_TYPE_STORAGE: dumpString8( "storage-name" ); break;
468 case OLEPROP_TYPE_CLIPFMT: dumpBlob( "clip-data" ); break;
472 sal_Int32 OlePropertyStreamObject::dumpPropertyType()
474 return dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" );
477 void OlePropertyStreamObject::dumpBlob( const String& rName )
479 sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
480 if( nSize > 0 )
481 dumpBinary( rName, nSize );
484 OUString OlePropertyStreamObject::dumpString8( const String& rName )
486 sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
487 return mbIsUnicode ? dumpCharArray16( rName, nLen ) : dumpCharArray8( rName, nLen );
490 OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32 nLen )
492 OUString aData;
493 size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
494 if( nNewLen > 0 )
496 ::std::vector< sal_Char > aBuffer( nNewLen + 1 );
497 in().readMemory( &aBuffer.front(), nNewLen );
498 aBuffer[ nNewLen ] = 0;
499 aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc );
501 writeStringItem( rName, aData );
502 return aData;
505 OUString OlePropertyStreamObject::dumpString16( const String& rName )
507 sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
508 return dumpCharArray16( rName, nLen );
511 OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int32 nLen )
513 size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
514 ::std::vector< sal_Unicode > aBuffer;
515 aBuffer.reserve( nNewLen + 1 );
516 for( size_t nIdx = 0; nIdx < nNewLen; ++nIdx )
517 aBuffer.push_back( static_cast< sal_Unicode >( in().readuInt16() ) );
518 aBuffer.push_back( 0 );
519 OUString aData( &aBuffer.front() );
520 writeStringItem( rName, aData );
521 if( nNewLen & 1 ) dumpUnused( 2 ); // always padding to 32bit
522 return aData;
525 bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
527 in().seek( nStartPos );
528 if( in().isEof() )
529 writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
530 return !in().isEof();
533 void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
535 MultiItemsGuard aMultiGuard( out() );
536 writeEmptyItem( "SECTION" );
537 writeHexItem( "pos", nStartPos, "CONV-DEC" );
538 writeGuidItem( "guid", rGuid );
541 void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
543 MultiItemsGuard aMultiGuard( out() );
544 writeEmptyItem( "PROPERTY" );
545 writeHexItem( "pos", nStartPos, "CONV-DEC" );
546 writeDecItem( "id", nPropId, mxPropIds );
549 // ============================================================================
551 OleStorageObject::OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
553 construct( rParent, rxStrg, rSysPath );
556 void OleStorageObject::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
558 StorageObjectBase::construct( rParent, rxStrg, rSysPath );
561 void OleStorageObject::construct( const ObjectBase& rParent )
563 StorageObjectBase::construct( rParent );
566 void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
568 if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
569 OlePropertyStreamObject( *this, rxStrm, rSysFileName ).dump();
570 else
571 BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
574 // ============================================================================
575 // ============================================================================
577 void OcxPropertyObjectBase::construct( const ObjectBase& rParent,
578 const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const String& rPropNameList, bool b64BitPropFlags )
580 InputObjectBase::construct( rParent, rxStrm, rSysFileName );
581 constructOcxPropObj( rPropNameList, b64BitPropFlags );
584 void OcxPropertyObjectBase::construct( const OutputObjectBase& rParent,
585 const BinaryInputStreamRef& rxStrm, const String& rPropNameList, bool b64BitPropFlags )
587 InputObjectBase::construct( rParent, rxStrm );
588 constructOcxPropObj( rPropNameList, b64BitPropFlags );
591 void OcxPropertyObjectBase::construct( const InputObjectBase& rParent,
592 const String& rPropNameList, bool b64BitPropFlags )
594 InputObjectBase::construct( rParent );
595 constructOcxPropObj( rPropNameList, b64BitPropFlags );
598 bool OcxPropertyObjectBase::implIsValid() const
600 return InputObjectBase::implIsValid() && in().isSeekable();
603 void OcxPropertyObjectBase::implDump()
605 mbValid = true;
606 // header
607 setAlignAnchor();
608 dumpVersion();
609 sal_uInt16 nSize = dumpDec< sal_uInt16 >( "size" );
610 mnPropertiesEnd = in().tell() + nSize;
611 // property flags
612 maLargeProps.clear();
613 maStreamProps.clear();
614 mnPropFlags = dumpHex< sal_Int64, sal_uInt32 >( mb64BitPropFlags, "properties", mxPropNames );
615 mnCurrProp = 0;
616 // properties
617 dumpShortProperties();
618 dumpLargeProperties();
619 setAlignAnchor();
620 if( ensureValid() )
621 implDumpExtended();
624 void OcxPropertyObjectBase::implDumpShortProperties()
628 void OcxPropertyObjectBase::implDumpExtended()
632 bool OcxPropertyObjectBase::ensureValid( bool bCondition )
634 if( mbValid && (!bCondition || in().isEof()) )
636 if( !bCondition )
637 writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
638 mbValid = false;
640 return mbValid;
643 void OcxPropertyObjectBase::setAlignAnchor()
645 mnPropertiesStart = in().tell();
648 bool OcxPropertyObjectBase::startNextProperty()
650 if( mnCurrProp == 0 ) mnCurrProp = 1; else mnCurrProp <<= 1;
651 bool bHasProp = getFlag( mnPropFlags, mnCurrProp );
652 setFlag( mnPropFlags, mnCurrProp, false );
653 return ensureValid() && bHasProp;
656 OUString OcxPropertyObjectBase::getPropertyName() const
658 return cfg().getName( mxPropNames, mnCurrProp );
661 sal_uInt32 OcxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
663 if( startNextProperty() )
665 alignInput< sal_uInt32 >();
666 return dumpHex< sal_uInt32 >( getPropertyName(), pcNameList );
668 return nDefault;
671 sal_uInt32 OcxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
673 if( startNextProperty() )
675 MultiItemsGuard aMultiGuard( out() );
676 alignInput< sal_uInt32 >();
677 sal_uInt32 nColor = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-COLOR" );
678 switch( extractValue< sal_uInt8 >( nColor, 24, 8 ) )
680 case 0x00: writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) ); break;
681 case 0x01: writeDecItem( "palette-index", extractValue< sal_uInt16 >( nColor, 0, 16 ) ); break;
682 case 0x02: writeColorABGRItem( "rgb", extractValue< sal_Int32 >( nColor, 0, 24 ) ); break;
683 case 0x80: writeDecItem( "sys-color", extractValue< sal_uInt16 >( nColor, 0, 16 ), "OCX-SYSTEMCOLOR" ); break;
685 return nColor;
687 return nDefault;
690 sal_Unicode OcxPropertyObjectBase::dumpUnicodeProperty()
692 if( startNextProperty() )
694 alignInput< sal_uInt16 >();
695 return dumpUnicode( getPropertyName() );
697 return '\0';
700 void OcxPropertyObjectBase::dumpUnknownProperty()
702 if( startNextProperty() )
703 ensureValid( false );
706 void OcxPropertyObjectBase::dumpPosProperty()
708 if( startNextProperty() )
709 maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_POS, getPropertyName(), 8 ) );
712 void OcxPropertyObjectBase::dumpSizeProperty()
714 if( startNextProperty() )
715 maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_SIZE, getPropertyName(), 8 ) );
718 void OcxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
720 if( startNextProperty() )
721 maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_GUID, getPropertyName(), 16, pValue ) );
724 void OcxPropertyObjectBase::dumpStringProperty( OUString* pValue )
726 if( startNextProperty() )
728 alignInput< sal_uInt32 >();
729 sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "OCX-STRINGLEN" );
730 maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRING, getPropertyName(), nLen, pValue ) );
734 void OcxPropertyObjectBase::dumpStringArrayProperty()
736 if( startNextProperty() )
738 alignInput< sal_uInt32 >();
739 sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "CONV-DEC" );
740 maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRINGARRAY, getPropertyName(), nLen ) );
744 void OcxPropertyObjectBase::dumpStreamProperty()
746 if( startNextProperty() )
748 alignInput< sal_uInt16 >();
749 sal_uInt16 nData = dumpHex< sal_uInt16 >( getPropertyName() );
750 maStreamProps.push_back( StreamProperty( getPropertyName(), nData ) );
754 void OcxPropertyObjectBase::dumpEmbeddedFont()
756 if( ensureValid() )
758 writeEmptyItem( "embedded-fontdata" );
759 IndentGuard aIndGuard( out() );
760 OcxCFontNewObject( *this ).dump();
764 void OcxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
766 dumpRemainingTo( nPos );
767 mbValid = true;
768 ensureValid();
771 void OcxPropertyObjectBase::constructOcxPropObj( const String& rPropNameList, bool b64BitPropFlags )
773 if( InputObjectBase::implIsValid() )
775 mxPropNames = cfg().getNameList( rPropNameList );
776 mb64BitPropFlags = b64BitPropFlags;
777 mbValid = true;
781 void OcxPropertyObjectBase::dumpVersion()
783 ItemGuard aItem( out(), "version" );
784 sal_uInt8 nMinor, nMajor;
785 in() >> nMinor >> nMajor;
786 out().writeDec( nMajor );
787 out().writeChar( '.' );
788 out().writeDec( nMinor );
791 OUString OcxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
793 bool bCompressed = getFlag( nSize, OCX_STRING_COMPRESSED );
794 sal_uInt32 nBufSize = extractValue< sal_uInt32 >( nSize, 0, 31 );
795 OUString aString = bCompressed ?
796 dumpCharArray( rName, nBufSize, RTL_TEXTENCODING_ISO_8859_1 ) :
797 dumpUnicodeArray( rName, bArray ? nBufSize : (nBufSize / 2) );
798 alignInput< sal_Int32 >();
799 return aString;
802 void OcxPropertyObjectBase::dumpShortProperties()
804 if( ensureValid() )
806 writeEmptyItem( "short-properties" );
807 IndentGuard aIndGuard( out() );
808 implDumpShortProperties();
809 alignInput< sal_uInt32 >();
813 void OcxPropertyObjectBase::dumpLargeProperties()
815 if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
817 writeEmptyItem( "large-properties" );
818 IndentGuard aIndGuard( out() );
819 for( LargePropertyVector::iterator aIt = maLargeProps.begin(), aEnd = maLargeProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
821 switch( aIt->mePropType )
823 case LargeProperty::PROPTYPE_POS:
825 MultiItemsGuard aMultiGuard( out() );
826 writeEmptyItem( aIt->maItemName );
827 dumpDec< sal_Int32 >( "top", "CONV-HMM-TO-CM" );
828 dumpDec< sal_Int32 >( "left", "CONV-HMM-TO-CM" );
830 break;
831 case LargeProperty::PROPTYPE_SIZE:
833 MultiItemsGuard aMultiGuard( out() );
834 writeEmptyItem( aIt->maItemName );
835 dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
836 dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
838 break;
839 case LargeProperty::PROPTYPE_GUID:
841 OUString aGuid = dumpGuid( aIt->maItemName );
842 if( aIt->mpItemValue )
843 *aIt->mpItemValue = cfg().getStringOption( aGuid, OUString() );
845 break;
846 case LargeProperty::PROPTYPE_STRING:
848 OUString aString = dumpString( aIt->maItemName, aIt->mnDataSize, false );
849 if( aIt->mpItemValue )
850 *aIt->mpItemValue = aString;
852 break;
853 case LargeProperty::PROPTYPE_STRINGARRAY:
855 writeEmptyItem( aIt->maItemName );
856 IndentGuard aIndGuard2( out() );
857 out().resetItemIndex();
858 sal_Int64 nEndPos = in().tell() + aIt->mnDataSize;
859 while( in().tell() < nEndPos )
861 MultiItemsGuard aMultiGuard( out() );
862 sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "OCX-ARRAYSTRINGLEN" );
863 dumpString( "string", nDataSize, true );
865 dumpToPosition( nEndPos );
867 break;
871 dumpToPosition( mnPropertiesEnd );
873 if( ensureValid() && !maStreamProps.empty() )
875 writeEmptyItem( "stream-properties" );
876 IndentGuard aIndGuard( out() );
877 for( StreamPropertyVector::iterator aIt = maStreamProps.begin(), aEnd = maStreamProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
879 writeEmptyItem( aIt->maItemName );
880 if( ensureValid( aIt->mnData == 0xFFFF ) )
882 IndentGuard aIndGuard2( out() );
883 OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
884 if( aClassName.equalsAscii( "StdFont" ) )
885 StdFontObject( *this ).dump();
886 else if( aClassName.equalsAscii( "StdPic" ) )
887 StdPicObject( *this ).dump();
888 else if( aClassName.equalsAscii( "CFontNew" ) )
889 OcxCFontNewObject( *this ).dump();
890 else
891 ensureValid( false );
897 // ============================================================================
899 OcxCFontNewObject::OcxCFontNewObject( const InputObjectBase& rParent )
901 OcxPropertyObjectBase::construct( rParent, "OCX-CFONTNEW-PROPERTIES" );
904 void OcxCFontNewObject::implDumpShortProperties()
906 dumpStringProperty();
907 dumpFlagsProperty( 0, "OCX-CFONTNEW-FLAGS" );
908 dumpDecProperty< sal_Int32 >( 160 );
909 dumpDecProperty< sal_Int32 >( 0 );
910 dumpDecProperty< sal_uInt8 >( 1, "CHARSET" );
911 dumpDecProperty< sal_uInt8 >( 0, "FONT-PITCHFAMILY" );
912 dumpDecProperty< sal_uInt8 >( 1, "OCX-CFONTNEW-ALIGNMENT" );
913 dumpDecProperty< sal_uInt16 >( 400, "FONT-WEIGHT" );
916 // ============================================================================
918 OcxColumnInfoObject::OcxColumnInfoObject( const InputObjectBase& rParent )
920 OcxPropertyObjectBase::construct( rParent, "OCX-COLUMNINFO-PROPERTIES" );
923 void OcxColumnInfoObject::implDumpShortProperties()
925 dumpDecProperty< sal_Int32 >( -1, "CONV-HMM-TO-CM" );
928 // ============================================================================
930 OcxCommandButtonObject::OcxCommandButtonObject( const InputObjectBase& rParent )
932 OcxPropertyObjectBase::construct( rParent, "OCX-COMMANDBUTTON-PROPERTIES" );
935 void OcxCommandButtonObject::implDumpShortProperties()
937 dumpColorProperty( 0x80000012 );
938 dumpColorProperty( 0x80000008 );
939 dumpFlagsProperty( 0x0000001B );
940 dumpStringProperty();
941 dumpImagePosProperty();
942 dumpSizeProperty();
943 dumpMousePtrProperty();
944 dumpStreamProperty();
945 dumpUnicodeProperty();
946 dumpBoolProperty();
947 dumpStreamProperty();
950 void OcxCommandButtonObject::implDumpExtended()
952 dumpEmbeddedFont();
955 // ============================================================================
957 OcxMorphControlObject::OcxMorphControlObject( const InputObjectBase& rParent )
959 OcxPropertyObjectBase::construct( rParent, "OCX-MORPH-PROPERTIES", true );
962 void OcxMorphControlObject::implDumpShortProperties()
964 dumpFlagsProperty( 0x2C80081B );
965 dumpColorProperty( 0x80000005 );
966 dumpColorProperty( 0x80000008 );
967 dumpDecProperty< sal_uInt32 >( 0 );
968 dumpBorderStyleProperty< sal_uInt8 >( 0 );
969 dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SCROLLBARS" );
970 mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-CONTROLTYPE" );
971 dumpMousePtrProperty();
972 dumpSizeProperty();
973 dumpUnicodeProperty();
974 dumpDecProperty< sal_uInt32 >( 0, "CONV-HMM-TO-CM" );
975 dumpDecProperty< sal_uInt16 >( 1, "OCX-MORPH-BOUNDCOLUMN" );
976 dumpDecProperty< sal_Int16 >( -1, "OCX-MORPH-TEXTCOLUMN" );
977 dumpDecProperty< sal_Int16 >( 1, "OCX-MORPH-COLUMNCOUNT" );
978 dumpDecProperty< sal_uInt16 >( 8 );
979 mnColInfoCount = dumpDecProperty< sal_uInt16 >( 1 );
980 dumpDecProperty< sal_uInt8 >( 2, "OCX-MORPH-MATCHENTRYTYPE" );
981 dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-LISTSTYLE" );
982 dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SHOWDROPDOWNMODE" );
983 dumpUnknownProperty();
984 dumpDecProperty< sal_uInt8 >( 1, "OCX-MORPH-DROPDOWNSTYLE" );
985 dumpDecProperty< sal_uInt8 >( 0, "OCX-MORPH-SELECTIONTYPE" );
986 dumpStringProperty();
987 dumpStringProperty();
988 dumpImagePosProperty();
989 dumpColorProperty( 0x80000006 );
990 dumpSpecialEffectProperty< sal_uInt32 >( 2 );
991 dumpStreamProperty();
992 dumpStreamProperty();
993 dumpUnicodeProperty();
994 dumpUnknownProperty();
995 dumpBoolProperty();
996 dumpStringProperty();
999 void OcxMorphControlObject::implDumpExtended()
1001 dumpEmbeddedFont();
1002 dumpColumnInfos();
1005 void OcxMorphControlObject::dumpColumnInfos()
1007 if( ensureValid() && (mnColInfoCount > 0) && ((mnCtrlType == 2) || (mnCtrlType == 3)) )
1009 out().resetItemIndex();
1010 for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < mnColInfoCount); ++nIdx )
1012 writeEmptyItem( "#column-info" );
1013 IndentGuard aIndGuard( out() );
1014 OcxColumnInfoObject( *this ).dump();
1019 // ============================================================================
1021 OcxLabelObject::OcxLabelObject( const InputObjectBase& rParent )
1023 OcxPropertyObjectBase::construct( rParent, "OCX-LABEL-PROPERTIES" );
1026 void OcxLabelObject::implDumpShortProperties()
1028 dumpColorProperty( 0x80000012 );
1029 dumpColorProperty( 0x8000000F );
1030 dumpFlagsProperty( 0x0080001B );
1031 dumpStringProperty();
1032 dumpImagePosProperty();
1033 dumpSizeProperty();
1034 dumpMousePtrProperty();
1035 dumpColorProperty( 0x80000006 );
1036 dumpBorderStyleProperty< sal_uInt16 >( 0 );
1037 dumpSpecialEffectProperty< sal_uInt16 >( 0 );
1038 dumpStreamProperty();
1039 dumpUnicodeProperty();
1040 dumpBoolProperty();
1041 dumpStreamProperty();
1044 void OcxLabelObject::implDumpExtended()
1046 dumpEmbeddedFont();
1049 // ============================================================================
1051 OcxImageObject::OcxImageObject( const InputObjectBase& rParent )
1053 OcxPropertyObjectBase::construct( rParent, "OCX-IMAGE-PROPERTIES" );
1056 void OcxImageObject::implDumpShortProperties()
1058 dumpUnknownProperty();
1059 dumpUnknownProperty();
1060 dumpBoolProperty();
1061 dumpColorProperty( 0x80000006 );
1062 dumpColorProperty( 0x8000000F );
1063 dumpBorderStyleProperty< sal_uInt8 >( 1 );
1064 dumpMousePtrProperty();
1065 dumpImageSizeModeProperty();
1066 dumpSpecialEffectProperty< sal_uInt8 >( 0 );
1067 dumpSizeProperty();
1068 dumpStreamProperty();
1069 dumpImageAlignProperty();
1070 dumpBoolProperty();
1071 dumpFlagsProperty( 0x0000001B );
1072 dumpStreamProperty();
1075 // ============================================================================
1077 OcxScrollBarObject::OcxScrollBarObject( const InputObjectBase& rParent )
1079 OcxPropertyObjectBase::construct( rParent, "OCX-SCROLLBAR-PROPERTIES" );
1082 void OcxScrollBarObject::implDumpShortProperties()
1084 dumpColorProperty( 0x80000012 );
1085 dumpColorProperty( 0x8000000F );
1086 dumpFlagsProperty( 0x0000001B );
1087 dumpSizeProperty();
1088 dumpMousePtrProperty();
1089 dumpDecProperty< sal_Int32 >( 0 );
1090 dumpDecProperty< sal_Int32 >( 32767 );
1091 dumpDecProperty< sal_Int32 >( 0 );
1092 dumpHexProperty< sal_uInt32 >( 0 );
1093 dumpEnabledProperty();
1094 dumpEnabledProperty();
1095 dumpDecProperty< sal_Int32 >( 1 );
1096 dumpDecProperty< sal_Int32 >( 1 );
1097 dumpOrientationProperty();
1098 dumpDecProperty< sal_Int16 >( -1, "OCX-SCROLLBAR-PROPTHUMB" );
1099 dumpDelayProperty();
1100 dumpStreamProperty();
1103 // ============================================================================
1105 OcxSpinButtonObject::OcxSpinButtonObject( const InputObjectBase& rParent )
1107 OcxPropertyObjectBase::construct( rParent, "OCX-SPINBUTTON-PROPERTIES" );
1110 void OcxSpinButtonObject::implDumpShortProperties()
1112 dumpColorProperty( 0x80000012 );
1113 dumpColorProperty( 0x8000000F );
1114 dumpFlagsProperty( 0x0000001B );
1115 dumpSizeProperty();
1116 dumpHexProperty< sal_uInt32 >( 0 );
1117 dumpDecProperty< sal_Int32 >( 0 );
1118 dumpDecProperty< sal_Int32 >( 100 );
1119 dumpDecProperty< sal_Int32 >( 0 );
1120 dumpEnabledProperty();
1121 dumpEnabledProperty();
1122 dumpDecProperty< sal_Int32 >( 1 );
1123 dumpOrientationProperty();
1124 dumpDelayProperty();
1125 dumpStreamProperty();
1126 dumpMousePtrProperty();
1129 // ============================================================================
1131 OcxTabStripObject::OcxTabStripObject( const InputObjectBase& rParent )
1133 OcxPropertyObjectBase::construct( rParent, "OCX-TABSTRIP-PROPERTIES" );
1136 void OcxTabStripObject::implDumpShortProperties()
1138 dumpDecProperty< sal_Int32 >( -1 );
1139 dumpColorProperty( 0x8000000F );
1140 dumpColorProperty( 0x80000012 );
1141 dumpUnknownProperty();
1142 dumpSizeProperty();
1143 dumpStringArrayProperty();
1144 dumpMousePtrProperty();
1145 dumpUnknownProperty();
1146 dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-ORIENTATION" );
1147 dumpDecProperty< sal_uInt32 >( 0, "OCX-TABSTRIP-TABSTYLE" );
1148 dumpBoolProperty();
1149 dumpHmmProperty();
1150 dumpHmmProperty();
1151 dumpBoolProperty();
1152 dumpUnknownProperty();
1153 dumpStringArrayProperty();
1154 dumpUnknownProperty();
1155 dumpStringArrayProperty();
1156 dumpFlagsProperty( 0x0000001B );
1157 dumpBoolProperty();
1158 dumpDecProperty< sal_uInt32 >( 0 );
1159 dumpStringArrayProperty();
1160 mnTabFlagCount = dumpDecProperty< sal_Int32 >( 0 );
1161 dumpStringArrayProperty();
1162 dumpStreamProperty();
1165 void OcxTabStripObject::implDumpExtended()
1167 dumpEmbeddedFont();
1168 if( mnTabFlagCount > 0 )
1170 writeEmptyItem( "tab-flags" );
1171 IndentGuard aIndGuard( out() );
1172 out().resetItemIndex();
1173 for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnTabFlagCount); ++nIdx )
1174 dumpHex< sal_uInt32 >( "#flags", "OCX-TABSTRIP-FLAGS" );
1178 // ============================================================================
1180 OcxControlObject::OcxControlObject( const InputObjectBase& rParent, const OUString& rProgId, sal_Int64 nLength ) :
1181 maProgId( rProgId ),
1182 mnLength( nLength )
1184 InputObjectBase::construct( rParent );
1187 void OcxControlObject::implDump()
1189 sal_Int64 nEndPos = in().tell() + ::std::max< sal_Int64 >( mnLength, 0 );
1190 if( (maProgId.getLength() > 0) && (mnLength > 0) && !in().isEof() )
1192 if( maProgId.equalsAscii( "Forms.CommandButton.1" ) )
1193 OcxCommandButtonObject( *this ).dump();
1194 else if( maProgId.equalsAscii( "Forms.TextBox.1" ) ||
1195 maProgId.equalsAscii( "Forms.ListBox.1" ) ||
1196 maProgId.equalsAscii( "Forms.ComboBox.1" ) ||
1197 maProgId.equalsAscii( "Forms.CheckBox.1" ) ||
1198 maProgId.equalsAscii( "Forms.OptionButton.1" ) ||
1199 maProgId.equalsAscii( "Forms.ToggleButton.1" ) ||
1200 maProgId.equalsAscii( "RefEdit.Ctrl" ) )
1201 OcxMorphControlObject( *this ).dump();
1202 else if( maProgId.equalsAscii( "Forms.Label.1" ) )
1203 OcxLabelObject( *this ).dump();
1204 else if( maProgId.equalsAscii( "Forms.Image.1" ) )
1205 OcxImageObject( *this ).dump();
1206 else if( maProgId.equalsAscii( "Forms.ScrollBar.1" ) )
1207 OcxScrollBarObject( *this ).dump();
1208 else if( maProgId.equalsAscii( "Forms.SpinButton.1" ) )
1209 OcxSpinButtonObject( *this ).dump();
1210 else if( maProgId.equalsAscii( "Forms.TabStrip.1" ) )
1211 OcxTabStripObject( *this ).dump();
1212 else if( maProgId.equalsAscii( "StdPic" ) )
1213 StdPicObject( *this ).dump();
1215 dumpRemainingTo( nEndPos );
1218 // ============================================================================
1220 OcxGuidControlObject::OcxGuidControlObject( const InputObjectBase& rParent, sal_Int64 nLength ) :
1221 mnLength( nLength )
1223 InputObjectBase::construct( rParent );
1226 OcxGuidControlObject::OcxGuidControlObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
1228 mnLength = rxStrm.get() ? rxStrm->getLength() : -1;
1229 InputObjectBase::construct( rParent, rxStrm );
1232 OcxGuidControlObject::OcxGuidControlObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
1234 mnLength = rxStrm.get() ? rxStrm->getLength() : -1;
1235 InputObjectBase::construct( rParent, rxStrm, rSysFileName );
1238 void OcxGuidControlObject::implDump()
1240 OUString aProgId = cfg().getStringOption( dumpGuid(), OUString() );
1241 OcxControlObject( *this, aProgId, mnLength - 16 ).dump();
1244 // ============================================================================
1246 OcxControlsStreamObject::OcxControlsStreamObject( const ObjectBase& rParent,
1247 const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
1248 mrFormData( rFormData )
1250 InputObjectBase::construct( rParent, rxStrm, rSysFileName );
1253 void OcxControlsStreamObject::implDump()
1255 for( OcxFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !in().isEof() && (aIt != aEnd); ++aIt )
1257 if( (aIt->mbInStream) && (aIt->mnLength > 0) )
1259 out().emptyLine();
1260 writeDecItem( "control-id", aIt->mnId );
1261 writeInfoItem( "prog-id", aIt->maProgId );
1262 IndentGuard aIndGuard( out() );
1263 OcxControlObject( *this, aIt->maProgId, aIt->mnLength ).dump();
1266 dumpRemainingStream();
1269 // ============================================================================
1270 // ============================================================================
1272 OcxPageObject::OcxPageObject( const InputObjectBase& rParent )
1274 OcxPropertyObjectBase::construct( rParent, "OCX-PAGE-PROPERTIES" );
1277 void OcxPageObject::implDumpShortProperties()
1279 dumpUnknownProperty();
1280 dumpDecProperty< sal_uInt32 >( 0, "OCX-PAGE-TRANSITIONEFFECT" );
1281 dumpDecProperty< sal_uInt32 >( 0, "OCX-CONV-MS" );
1284 // ============================================================================
1286 OcxMultiPageObject::OcxMultiPageObject( const InputObjectBase& rParent )
1288 OcxPropertyObjectBase::construct( rParent, "OCX-MULTIPAGE-PROPERTIES" );
1291 void OcxMultiPageObject::implDumpShortProperties()
1293 dumpUnknownProperty();
1294 mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
1295 dumpDecProperty< sal_Int32 >( 0 );
1296 dumpBoolProperty();
1299 void OcxMultiPageObject::implDumpExtended()
1301 if( ensureValid() && (mnPageCount > 0) )
1303 writeEmptyItem( "page-ids" );
1304 IndentGuard aIndGuard( out() );
1305 out().resetItemIndex();
1306 for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
1307 dumpDec< sal_Int32 >( "#id" );
1311 // ============================================================================
1313 OcxMultiPageStreamObject::OcxMultiPageStreamObject( const ObjectBase& rParent,
1314 const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
1315 mrFormData( rFormData )
1317 InputObjectBase::construct( rParent, rxStrm, rSysFileName );
1320 void OcxMultiPageStreamObject::implDump()
1322 for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !in().isEof() && (nIdx < nCount); ++nIdx )
1324 out().emptyLine();
1325 writeEmptyItem( "page" );
1326 IndentGuard aIndGuard( out() );
1327 OcxPageObject( *this ).dump();
1329 if( !in().isEof() )
1331 out().emptyLine();
1332 writeEmptyItem( "multi-page" );
1333 IndentGuard aIndGuard( out() );
1334 OcxMultiPageObject( *this ).dump();
1336 dumpRemainingStream();
1339 // ============================================================================
1340 // ============================================================================
1342 OcxFormClassInfoObject::OcxFormClassInfoObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
1343 mrFormData( rFormData )
1345 OcxPropertyObjectBase::construct( rParent, "OCX-CLASSINFO-PROPERTIES" );
1348 void OcxFormClassInfoObject::implDumpShortProperties()
1350 mrFormData.maClassInfoProgIds.push_back( OUString() );
1351 dumpGuidProperty( &mrFormData.maClassInfoProgIds.back() );
1352 dumpGuidProperty();
1353 dumpUnknownProperty();
1354 dumpGuidProperty();
1355 dumpFlagsProperty( 0, "OCX-CLASSINFO-FLAGS" );
1356 dumpDecProperty< sal_Int32 >( -1 );
1357 dumpDecProperty< sal_uInt16 >( 0 );
1358 dumpDecProperty< sal_uInt16 >( 0 );
1359 dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
1360 dumpDecProperty< sal_uInt16 >( 0 );
1361 dumpDecProperty< sal_uInt16 >( 0 );
1362 dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
1363 dumpDecProperty< sal_Int32 >( -1 );
1364 dumpDecProperty< sal_uInt16 >( 0 );
1367 // ============================================================================
1369 namespace {
1371 const sal_uInt32 OCX_FORMSITE_OBJSTREAM = 0x0010;
1373 const sal_uInt16 OCX_FORMSITE_CLASSTABLEINDEX = 0x8000;
1374 const sal_uInt16 OCX_FORMSITE_CLASSTABLEMASK = 0x7FFF;
1376 } // namespace
1378 // ----------------------------------------------------------------------------
1380 OcxFormSiteObject::OcxFormSiteObject( const InputObjectBase& rParent, OcxFormSharedData& rFormData ) :
1381 mrFormData( rFormData )
1383 OcxPropertyObjectBase::construct( rParent, "OCX-FORMSITE-PROPERTIES" );
1386 void OcxFormSiteObject::implDumpShortProperties()
1388 OcxFormSiteInfo aSiteInfo;
1389 dumpStringProperty();
1390 dumpStringProperty();
1391 sal_Int32 nId = dumpDecProperty< sal_Int32 >( 0 );
1392 dumpDecProperty< sal_Int32 >( 0 );
1393 sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "OCX-FORMSITE-FLAGS" );
1394 sal_uInt32 nLength = dumpDecProperty< sal_uInt32 >( 0 );
1395 dumpDecProperty< sal_Int16 >( -1 );
1396 sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "OCX-FORMSITE-CLASSIDCACHE" );
1397 dumpPosProperty();
1398 dumpDecProperty< sal_uInt16 >( 0 );
1399 dumpUnknownProperty();
1400 dumpStringProperty();
1401 dumpStringProperty();
1402 dumpStringProperty();
1403 dumpStringProperty();
1405 sal_uInt16 nIndex = nClassId & OCX_FORMSITE_CLASSTABLEMASK;
1406 if( getFlag( nClassId, OCX_FORMSITE_CLASSTABLEINDEX ) )
1408 if( nIndex < mrFormData.maClassInfoProgIds.size() )
1409 aSiteInfo.maProgId = mrFormData.maClassInfoProgIds[ nIndex ];
1411 else
1413 if( cfg().hasName( "OCX-FORMSITE-CLASSNAMES", nIndex ) )
1414 aSiteInfo.maProgId = cfg().getName( "OCX-FORMSITE-CLASSNAMES", nIndex );
1416 aSiteInfo.mnId = nId;
1417 aSiteInfo.mnLength = nLength;
1418 aSiteInfo.mbInStream = getFlag( nFlags, OCX_FORMSITE_OBJSTREAM );
1420 mrFormData.maSiteInfos.push_back( aSiteInfo );
1423 // ============================================================================
1425 OcxFormDesignExtObject::OcxFormDesignExtObject( const InputObjectBase& rParent )
1427 OcxPropertyObjectBase::construct( rParent, "OCX-FORMDESIGNEXT-PROPERTIES" );
1430 void OcxFormDesignExtObject::implDumpShortProperties()
1432 dumpFlagsProperty( 0x00015F55, "OCX-FORMDESIGNEXT-FLAGS" );
1433 dumpHmmProperty();
1434 dumpHmmProperty();
1435 dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-CLICKCTRLMODE" );
1436 dumpDecProperty< sal_Int8 >( 0, "OCX-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
1439 // ============================================================================
1441 namespace {
1443 const sal_uInt32 OCX_FORM_HASDESIGNEXTENDER = 0x00004000;
1444 const sal_uInt32 OCX_FORM_SKIPCLASSTABLE = 0x00008000;
1446 const sal_uInt8 OCX_FORM_SITECOUNTTYPE_COUNT = 0x80;
1447 const sal_uInt8 OCX_FORM_SITECOUNTTYPE_MASK = 0x7F;
1449 } // namespace
1451 // ----------------------------------------------------------------------------
1453 OcxFormObject::OcxFormObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, OcxFormSharedData& rFormData ) :
1454 mrFormData( rFormData )
1456 OcxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "OCX-FORM-PROPERTIES" );
1459 void OcxFormObject::implDumpShortProperties()
1461 dumpUnknownProperty();
1462 dumpColorProperty( 0x8000000F );
1463 dumpColorProperty( 0x80000012 );
1464 dumpDecProperty< sal_uInt32 >( 0 );
1465 dumpUnknownProperty();
1466 dumpUnknownProperty();
1467 mnFlags = dumpFlagsProperty( 0x00000004, "OCX-FORM-FLAGS" );
1468 dumpBorderStyleProperty< sal_uInt8 >( 0 );
1469 dumpMousePtrProperty();
1470 dumpHexProperty< sal_uInt8 >( 0x0C, "OCX-FORM-SCROLLBARS" );
1471 dumpSizeProperty();
1472 dumpSizeProperty();
1473 dumpPosProperty();
1474 dumpDecProperty< sal_uInt32 >( 0 );
1475 dumpUnknownProperty();
1476 dumpStreamProperty();
1477 dumpDecProperty< sal_uInt8 >( 0, "OCX-FORM-CYCLE" );
1478 dumpSpecialEffectProperty< sal_uInt8 >( 0 );
1479 dumpColorProperty( 0x80000012 );
1480 dumpStringProperty();
1481 dumpStreamProperty();
1482 dumpStreamProperty();
1483 dumpDecProperty< sal_Int32 >( 100, "CONV-PERCENT" );
1484 dumpImageAlignProperty();
1485 dumpBoolProperty();
1486 dumpImageSizeModeProperty();
1487 dumpDecProperty< sal_uInt32 >( 0 );
1488 dumpDecProperty< sal_uInt32 >( 0 );
1491 void OcxFormObject::implDumpExtended()
1493 dumpClassInfos();
1494 dumpSiteData();
1495 dumpDesignExtender();
1496 dumpRemainingStream();
1499 void OcxFormObject::dumpClassInfos()
1501 if( ensureValid() && !getFlag( mnFlags, OCX_FORM_SKIPCLASSTABLE ) )
1503 out().emptyLine();
1504 sal_uInt16 nCount = dumpDec< sal_uInt16 >( "class-info-count" );
1505 out().resetItemIndex();
1506 for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
1508 writeEmptyItem( "#class-info" );
1509 IndentGuard aIndGuard( out() );
1510 OcxFormClassInfoObject( *this, mrFormData ).dump();
1515 void OcxFormObject::dumpFormSites( sal_uInt32 nCount )
1517 out().resetItemIndex();
1518 for( sal_uInt32 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
1520 out().emptyLine();
1521 writeEmptyItem( "#form-site" );
1522 IndentGuard aIndGuard( out() );
1523 OcxFormSiteObject( *this, mrFormData ).dump();
1527 void OcxFormObject::dumpSiteData()
1529 if( ensureValid() )
1531 out().emptyLine();
1532 setAlignAnchor();
1533 sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" );
1534 sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" );
1535 sal_Int64 nEndPos = in().tell() + nSiteLength;
1536 if( ensureValid( nEndPos <= in().getLength() ) )
1538 out().resetItemIndex();
1539 sal_uInt32 nSiteIdx = 0;
1540 while( ensureValid() && (nSiteIdx < nSiteCount) )
1542 out().emptyLine();
1543 writeEmptyItem( "#site-info" );
1544 IndentGuard aIndGuard( out() );
1545 dumpDec< sal_uInt8 >( "depth" );
1546 sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "OCX-FORM-SITE-TYPECOUNT" );
1547 if( getFlag( nTypeCount, OCX_FORM_SITECOUNTTYPE_COUNT ) )
1549 dumpDec< sal_uInt8 >( "repeated-type" );
1550 nSiteIdx += (nTypeCount & OCX_FORM_SITECOUNTTYPE_MASK);
1552 else
1554 ++nSiteIdx;
1557 alignInput< sal_uInt32 >();
1558 dumpFormSites( nSiteCount );
1559 dumpToPosition( nEndPos );
1564 void OcxFormObject::dumpDesignExtender()
1566 if( ensureValid() && getFlag( mnFlags, OCX_FORM_HASDESIGNEXTENDER ) )
1568 out().emptyLine();
1569 writeEmptyItem( "design-extender" );
1570 IndentGuard aIndGuard( out() );
1571 OcxFormDesignExtObject( *this ).dump();
1575 // ============================================================================
1577 OcxFormStorageObject::OcxFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
1578 OleStorageObject( rParent, rxStrg, rSysPath )
1580 addPreferredStream( "f" );
1583 void OcxFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
1585 if( rStrmName.equalsAscii( "f" ) )
1586 OcxFormObject( *this, rxStrm, rSysFileName, maFormData ).dump();
1587 else if( rStrmName.equalsAscii( "o" ) )
1588 OcxControlsStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
1589 else if( rStrmName.equalsAscii( "x" ) )
1590 OcxMultiPageStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
1591 else
1592 OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
1595 void OcxFormStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
1597 if( isFormStorage( rStrgPath ) )
1598 OcxFormStorageObject( *this, rxStrg, rSysPath ).dump();
1599 else
1600 OleStorageObject( *this, rxStrg, rSysPath ).dump();
1603 bool OcxFormStorageObject::isFormStorage( const OUString& rStrgPath ) const
1605 if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
1607 OUString aId = rStrgPath.copy( 1 );
1608 if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
1609 aId = aId.copy( 1 );
1610 sal_Int32 nId = aId.toInt32();
1611 if( (nId > 0) && (OUString::valueOf( nId ) == aId) )
1612 for( OcxFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
1613 if( aIt->mnId == nId )
1614 return true;
1616 return false;
1619 // ============================================================================
1620 // ============================================================================
1622 VbaSharedData::VbaSharedData() :
1623 meTextEnc( osl_getThreadTextEncoding() )
1627 bool VbaSharedData::isModuleStream( const ::rtl::OUString& rStrmName ) const
1629 return maStrmOffsets.count( rStrmName ) > 0;
1632 sal_Int32 VbaSharedData::getStreamOffset( const OUString& rStrmName ) const
1634 StreamOffsetMap::const_iterator aIt = maStrmOffsets.find( rStrmName );
1635 return (aIt == maStrmOffsets.end()) ? 0 : aIt->second;
1638 // ============================================================================
1640 VbaDirStreamObject::VbaDirStreamObject( const ObjectBase& rParent,
1641 const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaSharedData& rVbaData ) :
1642 mrVbaData( rVbaData )
1644 mxInStrm = rxStrm;
1645 if( mxInStrm.get() )
1647 BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxInStrm ) );
1648 SequenceRecordObjectBase::construct( rParent, xVbaStrm, rSysFileName, "VBA-DIR-RECORD-NAMES", "VBA-DIR-SIMPLE-RECORDS" );
1652 bool VbaDirStreamObject::implIsValid() const
1654 return mxInStrm.get() && SequenceRecordObjectBase::implIsValid();
1657 bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
1659 ornRecId = rBaseStrm.readuInt16();
1660 ornRecSize = rBaseStrm.readInt32();
1662 // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
1663 if( ornRecId == 9 )
1664 ornRecSize = 6;
1666 return !rBaseStrm.isEof();
1669 void VbaDirStreamObject::implDumpRecordBody()
1671 switch( getRecId() )
1673 case 0x0003:
1674 mrVbaData.meTextEnc = ::oox::xls::BiffHelper::calcTextEncodingFromCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
1675 break;
1676 case 0x0004:
1677 dumpByteString( "name" );
1678 break;
1679 case 0x0005:
1680 dumpByteString( "description" );
1681 break;
1682 case 0x0006:
1683 dumpByteString( "helpfile-path" );
1684 break;
1685 case 0x0009:
1686 dumpDec< sal_uInt32 >( "major" );
1687 dumpDec< sal_uInt16 >( "minor" );
1688 break;
1689 case 0x000C:
1690 dumpByteString( "constants" );
1691 break;
1692 case 0x000D:
1693 dumpByteStringWithLength( "lib-id" );
1694 dumpUnused( 6 );
1695 break;
1696 case 0x000E:
1697 dumpByteStringWithLength( "lib-id-absolute" );
1698 dumpByteStringWithLength( "lib-id-relative" );
1699 dumpDec< sal_uInt32 >( "major" );
1700 dumpDec< sal_uInt16 >( "minor" );
1701 break;
1702 case 0x0016:
1703 dumpByteString( "name" );
1704 break;
1705 case 0x0019:
1706 dumpByteString( "name" );
1707 maCurrStream = OUString();
1708 mnCurrOffset = 0;
1709 break;
1710 case 0x001A:
1711 maCurrStream = dumpByteString( "stream-name" );
1712 break;
1713 case 0x001C:
1714 dumpByteString( "description" );
1715 break;
1716 case 0x002B:
1717 if( maCurrStream.getLength() > 0 )
1718 mrVbaData.maStrmOffsets[ maCurrStream ] = mnCurrOffset;
1719 maCurrStream = OUString();
1720 mnCurrOffset = 0;
1721 break;
1722 case 0x002F:
1723 dumpByteStringWithLength( "lib-id-twiddled" );
1724 dumpUnused( 6 );
1725 break;
1726 case 0x0030:
1727 dumpByteStringWithLength( "lib-id-extended" );
1728 dumpUnused( 6 );
1729 dumpGuid( "original-typelib" );
1730 dumpDec< sal_uInt32 >( "cookie" );
1731 break;
1732 case 0x0031:
1733 mnCurrOffset = dumpHex< sal_Int32 >( "stream-offset", "CONV-DEC" );
1734 break;
1735 case 0x0032:
1736 dumpUniString( "stream-name" );
1737 break;
1738 case 0x0033:
1739 dumpByteString( "lib-id-original" );
1740 break;
1741 case 0x003C:
1742 dumpUniString( "constants" );
1743 break;
1744 case 0x003D:
1745 dumpUniString( "helpfile-path" );
1746 break;
1747 case 0x003E:
1748 dumpUniString( "name" );
1749 break;
1750 case 0x0040:
1751 dumpUniString( "description" );
1752 break;
1753 case 0x0047:
1754 dumpUniString( "name" );
1755 break;
1756 case 0x0048:
1757 dumpUniString( "description" );
1758 break;
1762 OUString VbaDirStreamObject::dumpByteString( const String& rName )
1764 return dumpCharArray( rName, static_cast< sal_Int32 >( getRecSize() ), mrVbaData.meTextEnc );
1767 OUString VbaDirStreamObject::dumpUniString( const String& rName )
1769 return dumpUnicodeArray( rName, static_cast< sal_Int32 >( getRecSize() / 2 ) );
1772 OUString VbaDirStreamObject::dumpByteStringWithLength( const String& rName )
1774 return dumpCharArray( rName, in().readInt32(), mrVbaData.meTextEnc );
1777 // ============================================================================
1779 VbaModuleStreamObject::VbaModuleStreamObject(
1780 const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm,
1781 const OUString& rSysFileName, VbaSharedData& rVbaData, sal_Int32 nStrmOffset ) :
1782 mrVbaData( rVbaData ),
1783 mnStrmOffset( nStrmOffset )
1785 InputObjectBase::construct( rParent, rxStrm, rSysFileName );
1788 void VbaModuleStreamObject::implDump()
1790 dumpBinary( "perf-cache", mnStrmOffset );
1791 out().emptyLine();
1792 writeEmptyItem( "source-code" );
1793 IndentGuard aIndGuard( out() );
1794 BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( in() ) );
1795 TextStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump();
1798 // ============================================================================
1800 VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
1801 OleStorageObject( rParent, rxStrg, rSysPath ),
1802 mrVbaData( rVbaData )
1804 addPreferredStream( "dir" );
1807 void VbaStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
1809 if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "dir" ) )
1810 VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump();
1811 else if( mrVbaData.isModuleStream( rStrmName ) )
1812 VbaModuleStreamObject( *this, rxStrm, rSysFileName, mrVbaData, mrVbaData.getStreamOffset( rStrmName ) ).dump();
1813 else
1814 OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
1817 // ============================================================================
1819 VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
1820 OcxFormStorageObject( rParent, rxStrg, rSysPath ),
1821 mrVbaData( rVbaData )
1825 void VbaFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
1827 if( rStrmName.equalsAscii( "\003VBFrame" ) )
1828 TextStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump();
1829 else
1830 OcxFormStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
1833 // ============================================================================
1835 VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
1836 OleStorageObject( rParent, rxStrg, rSysPath )
1838 addPreferredStorage( "VBA" );
1841 void VbaProjectStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
1843 if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "PROJECT" ) )
1844 TextStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump();
1845 else
1846 OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
1849 void VbaProjectStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
1851 if( rStrgPath.equalsAscii( "VBA" ) )
1852 VbaStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
1853 else
1854 VbaFormStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
1857 // ============================================================================
1858 // ============================================================================
1860 } // namespace dump
1861 } // namespace oox
1863 #endif