1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <string_view>
24 #include <oox/dump/oledumper.hxx>
26 #include <rtl/tencinfo.h>
27 #include <o3tl/string_view.hxx>
28 #include <oox/ole/vbainputstream.hxx>
34 using namespace ::com::sun::star::io
;
35 using namespace ::com::sun::star::uno
;
37 OUString
OleInputObjectBase::dumpAnsiString32( const String
& rName
)
39 return dumpCharArray( rName
, mxStrm
->readInt32(), RTL_TEXTENCODING_MS_1252
);
42 OUString
OleInputObjectBase::dumpUniString32( const String
& rName
)
44 return dumpUnicodeArray( rName
, mxStrm
->readInt32() );
47 sal_Int32
OleInputObjectBase::dumpStdClipboardFormat( const String
& rName
)
49 return dumpDec
< sal_Int32
>( rName( "clipboard-format" ), "OLE-STD-CLIPBOARD-FORMAT" );
52 OUString
OleInputObjectBase::dumpAnsiString32OrStdClip( const String
& rName
)
54 sal_Int32 nLen
= mxStrm
->readInt32();
55 return (nLen
< 0) ? OUString::number( dumpStdClipboardFormat( rName
) ) : dumpCharArray( rName
, nLen
, RTL_TEXTENCODING_MS_1252
);
58 OUString
OleInputObjectBase::dumpUniString32OrStdClip( const String
& rName
)
60 sal_Int32 nLen
= mxStrm
->readInt32();
61 return (nLen
< 0) ? OUString::number( dumpStdClipboardFormat( rName
) ) : dumpUnicodeArray( rName
, nLen
);
64 void OleInputObjectBase::writeOleColorItem( const String
& rName
, sal_uInt32 nColor
)
66 MultiItemsGuard
aMultiGuard( mxOut
);
67 writeHexItem( rName
, nColor
, "OLE-COLOR" );
70 sal_uInt32
OleInputObjectBase::dumpOleColor( const String
& rName
)
72 sal_uInt32 nOleColor
= mxStrm
->readuInt32();
73 writeOleColorItem( rName
, nOleColor
);
77 StdFontObject::StdFontObject( const InputObjectBase
& rParent
)
82 void StdFontObject::implDump()
84 dumpDec
< sal_uInt8
>( "version" );
85 dumpDec
< sal_uInt16
>( "charset", "CHARSET" );
86 dumpHex
< sal_uInt8
>( "flags", "STDFONT-FLAGS" );
87 dumpDec
< sal_uInt16
>( "weight", "FONT-WEIGHT" );
88 dumpDec
< sal_uInt32
>( "height", "STDFONT-HEIGHT" );
89 dumpCharArray( "name", mxStrm
->readuInt8(), RTL_TEXTENCODING_ASCII_US
);
92 StdPicObject::StdPicObject( const InputObjectBase
& rParent
)
97 void StdPicObject::implDump()
99 dumpHex
< sal_uInt32
>( "identifier", "STDPIC-ID" );
100 sal_uInt32 nSize
= dumpHex
< sal_uInt32
>( "image-size", "CONV-DEC" );
101 dumpBinary( "image-data", nSize
);
104 OleStreamObject::OleStreamObject( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
)
106 construct( rParent
, rxStrm
, rSysFileName
);
109 OleCompObjObject::OleCompObjObject( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
) :
110 OleStreamObject( rParent
, rxStrm
, rSysFileName
)
114 void OleCompObjObject::implDump()
117 dumpDec
< sal_uInt32
>( "version" );
119 dumpAnsiString32( "ansi-display-name" );
120 dumpAnsiString32OrStdClip( "ansi-clipboard-format" );
121 if( mxStrm
->getRemaining() >= 4 )
123 sal_Int32 nLen
= mxStrm
->readInt32();
124 if( (0 <= nLen
) && (nLen
<= 40) )
126 dumpCharArray( "ansi-unused", nLen
, RTL_TEXTENCODING_MS_1252
);
127 if( (mxStrm
->getRemaining() >= 4) && (dumpHex
< sal_Int32
>( "unicode-marker" ) == 0x71B239F4) )
129 dumpUniString32( "unicode-display-name" );
130 dumpUniString32OrStdClip( "unicode-clipboard-format" );
131 dumpUniString32( "unicode-unused" );
135 writeDecItem( "length", nLen
);
137 dumpRemainingStream();
142 const sal_Int32 OLEPROP_ID_DICTIONARY
= 0;
143 const sal_Int32 OLEPROP_ID_CODEPAGE
= 1;
145 const sal_uInt16 OLEPROP_TYPE_INT16
= 2;
146 const sal_uInt16 OLEPROP_TYPE_INT32
= 3;
147 const sal_uInt16 OLEPROP_TYPE_FLOAT
= 4;
148 const sal_uInt16 OLEPROP_TYPE_DOUBLE
= 5;
149 const sal_uInt16 OLEPROP_TYPE_DATE
= 7;
150 const sal_uInt16 OLEPROP_TYPE_STRING
= 8;
151 const sal_uInt16 OLEPROP_TYPE_STATUS
= 10;
152 const sal_uInt16 OLEPROP_TYPE_BOOL
= 11;
153 const sal_uInt16 OLEPROP_TYPE_VARIANT
= 12;
154 const sal_uInt16 OLEPROP_TYPE_INT8
= 16;
155 const sal_uInt16 OLEPROP_TYPE_UINT8
= 17;
156 const sal_uInt16 OLEPROP_TYPE_UINT16
= 18;
157 const sal_uInt16 OLEPROP_TYPE_UINT32
= 19;
158 const sal_uInt16 OLEPROP_TYPE_INT64
= 20;
159 const sal_uInt16 OLEPROP_TYPE_UINT64
= 21;
160 const sal_uInt16 OLEPROP_TYPE_STRING8
= 30;
161 const sal_uInt16 OLEPROP_TYPE_STRING16
= 31;
162 const sal_uInt16 OLEPROP_TYPE_FILETIME
= 64;
163 const sal_uInt16 OLEPROP_TYPE_BLOB
= 65;
164 const sal_uInt16 OLEPROP_TYPE_STREAM
= 66;
165 const sal_uInt16 OLEPROP_TYPE_STORAGE
= 67;
166 const sal_uInt16 OLEPROP_TYPE_CLIPFMT
= 71;
168 const sal_uInt16 OLEPROP_TYPE_SIMPLE
= 0x0000;
169 const sal_uInt16 OLEPROP_TYPE_VECTOR
= 0x1000;
170 const sal_uInt16 OLEPROP_TYPE_ARRAY
= 0x2000;
172 const sal_uInt16 CODEPAGE_UNICODE
= 1200;
174 const sal_uInt32 AX_STRING_COMPRESSED
= 0x80000000;
178 OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
)
180 construct( rParent
, rxStrm
, rSysFileName
);
183 void OlePropertyStreamObject::implDump()
185 OUStringVector aGuidVec
;
186 ::std::vector
< sal_uInt32
> aStartPosVec
;
189 writeEmptyItem( "HEADER" );
191 IndentGuard
aIndGuard( mxOut
);
192 dumpHex
< sal_uInt16
>( "byte-order", "OLEPROP-BYTE-ORDER" );
193 dumpDec
< sal_uInt16
>( "version" );
194 dumpDec
< sal_uInt16
>( "os-minor" );
195 dumpDec
< sal_uInt16
>( "os-type", "OLEPROP-OSTYPE" );
197 sal_Int32 nSectCount
= dumpDec
< sal_Int32
>( "section-count" );
199 // dump table of section positions
201 TableGuard
aTabGuard( mxOut
, 15, 60 );
202 mxOut
->resetItemIndex();
203 for( sal_Int32 nSectIdx
= 0; !mxStrm
->isEof() && (nSectIdx
< nSectCount
); ++nSectIdx
)
205 MultiItemsGuard
aMultiGuard( mxOut
);
206 writeEmptyItem( "#section" );
207 aGuidVec
.push_back( dumpGuid( "guid" ) );
208 aStartPosVec
.push_back( dumpHex
< sal_uInt32
>( "start-pos", "CONV-DEC" ) );
215 for( size_t nSectIdx
= 0; !mxStrm
->isEof() && (nSectIdx
< aStartPosVec
.size()); ++nSectIdx
)
216 dumpSection( aGuidVec
[ nSectIdx
], aStartPosVec
[ nSectIdx
] );
219 void OlePropertyStreamObject::dumpSection( const OUString
& rGuid
, sal_uInt32 nStartPos
)
222 mxPropIds
= cfg().createNameList
< ConstList
>( "OLEPROP-IDS" );
223 OUString aGuidName
= cfg().getStringOption( rGuid
, OUString() );
224 if ( aGuidName
== "GlobalDocProp" )
225 mxPropIds
->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
226 else if ( aGuidName
== "BuiltinDocProp" )
227 mxPropIds
->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
229 mxPropIds
->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
231 // property ID/position map
232 typedef ::std::map
< sal_Int32
, sal_uInt32
> PropertyPosMap
;
233 PropertyPosMap aPropMap
;
235 // dump section header line
236 writeSectionHeader( rGuid
, nStartPos
);
239 IndentGuard
aIndGuard( mxOut
);
240 if( startElement( nStartPos
) )
242 // dump section header
243 dumpDec
< sal_Int32
>( "size" );
244 sal_Int32 nPropCount
= dumpDec
< sal_Int32
>( "property-count" );
246 // dump table of property positions
248 TableGuard
aTabGuard( mxOut
, 15, 25 );
249 mxOut
->resetItemIndex();
250 for( sal_Int32 nPropIdx
= 0; !mxStrm
->isEof() && (nPropIdx
< nPropCount
); ++nPropIdx
)
252 MultiItemsGuard
aMultiGuard( mxOut
);
253 writeEmptyItem( "#property" );
254 sal_Int32 nPropId
= dumpDec
< sal_Int32
>( "id", mxPropIds
);
255 sal_uInt32 nPropPos
= nStartPos
+ dumpHex
< sal_uInt32
>( "start-pos", "CONV-DEC" );
256 aPropMap
[ nPropId
] = nPropPos
;
262 // code page property
263 meTextEnc
= RTL_TEXTENCODING_MS_1252
;
265 PropertyPosMap::iterator aCodePageIt
= aPropMap
.find( OLEPROP_ID_CODEPAGE
);
266 if( aCodePageIt
!= aPropMap
.end() )
268 dumpCodePageProperty( aCodePageIt
->second
);
269 aPropMap
.erase( aCodePageIt
);
272 // dictionary property
273 PropertyPosMap::iterator aDictIt
= aPropMap
.find( OLEPROP_ID_DICTIONARY
);
274 if( aDictIt
!= aPropMap
.end() )
276 dumpDictionaryProperty( aDictIt
->second
);
277 aPropMap
.erase( aDictIt
);
281 for (auto const& elem
: aPropMap
)
282 dumpProperty( elem
.first
, elem
.second
);
284 // remove the user defined list of property ID names
285 cfg().eraseNameList( "OLEPROP-IDS" );
288 void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId
, sal_uInt32 nStartPos
)
290 writePropertyHeader( nPropId
, nStartPos
);
291 IndentGuard
aIndGuard( mxOut
);
292 if( startElement( nStartPos
) )
293 dumpPropertyContents( nPropId
);
297 void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos
)
299 writePropertyHeader( OLEPROP_ID_CODEPAGE
, nStartPos
);
300 IndentGuard
aIndGuard( mxOut
);
301 if( startElement( nStartPos
) )
303 sal_uInt16 nType
= dumpPropertyType();
304 if( nType
== OLEPROP_TYPE_INT16
)
306 sal_uInt16 nCodePage
= dumpDec
< sal_uInt16
>( "codepage", "CODEPAGES" );
307 rtl_TextEncoding eNewTextEnc
= rtl_getTextEncodingFromWindowsCodePage( nCodePage
);
308 if( eNewTextEnc
!= RTL_TEXTENCODING_DONTKNOW
)
309 meTextEnc
= eNewTextEnc
;
310 mbIsUnicode
= nCodePage
== CODEPAGE_UNICODE
;
313 dumpPropertyContents( OLEPROP_ID_CODEPAGE
);
318 void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos
)
320 writePropertyHeader( OLEPROP_ID_DICTIONARY
, nStartPos
);
321 IndentGuard
aIndGuard( mxOut
);
322 if( startElement( nStartPos
) )
324 sal_Int32 nCount
= dumpDec
< sal_Int32
>( "count" );
325 for( sal_Int32 nIdx
= 0; !mxStrm
->isEof() && (nIdx
< nCount
); ++nIdx
)
327 MultiItemsGuard
aMultiGuard( mxOut
);
328 TableGuard
aTabGuard( mxOut
, 10, 20 );
329 sal_Int32 nId
= dumpDec
< sal_Int32
>( "id" );
330 OUString aName
= dumpString8( "name" );
332 mxPropIds
->setName( nId
, aName
);
338 sal_uInt16
OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId
)
340 sal_uInt16 nType
= dumpPropertyType();
341 sal_uInt16 nBaseType
= static_cast< sal_uInt16
>( nType
& 0x0FFF );
342 sal_uInt16 nArrayType
= static_cast< sal_uInt16
>( nType
& 0xF000 );
345 case OLEPROP_TYPE_SIMPLE
: dumpPropertyValue( nPropId
, nBaseType
); break;
346 case OLEPROP_TYPE_VECTOR
: dumpPropertyVector( nPropId
, nBaseType
); break;
347 case OLEPROP_TYPE_ARRAY
: /*TODO*/; break;
352 void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId
, sal_uInt16 nBaseType
)
356 case OLEPROP_TYPE_INT16
: dumpDec
< sal_Int16
>( "value" ); break;
357 case OLEPROP_TYPE_INT32
: dumpDec
< sal_Int32
>( "value" ); break;
358 case OLEPROP_TYPE_FLOAT
: dumpDec
< float >( "value" ); break;
359 case OLEPROP_TYPE_DOUBLE
: dumpDec
< double >( "value" ); break;
360 case OLEPROP_TYPE_DATE
: dumpDec
< double >( "date" ); break;
361 case OLEPROP_TYPE_STRING
: dumpString8( "value" ); break;
362 case OLEPROP_TYPE_STATUS
: dumpHex
< sal_Int32
>( "status" ); break;
363 case OLEPROP_TYPE_BOOL
: dumpBool
< sal_Int16
>( "value" ); break;
364 case OLEPROP_TYPE_VARIANT
: dumpPropertyContents( nPropId
); break;
365 case OLEPROP_TYPE_INT8
: dumpDec
< sal_Int8
>( "value" ); break;
366 case OLEPROP_TYPE_UINT8
: dumpDec
< sal_uInt8
>( "value" ); break;
367 case OLEPROP_TYPE_UINT16
: dumpDec
< sal_uInt16
>( "value" ); break;
368 case OLEPROP_TYPE_UINT32
: dumpDec
< sal_uInt32
>( "value" ); break;
369 case OLEPROP_TYPE_INT64
: dumpDec
< sal_Int64
>( "value" ); break;
370 case OLEPROP_TYPE_UINT64
: dumpDec
< sal_uInt64
>( "value" ); break;
371 case OLEPROP_TYPE_STRING8
: dumpString8( "value" ); break;
372 case OLEPROP_TYPE_STRING16
: dumpString16( "value" ); break;
373 case OLEPROP_TYPE_FILETIME
: dumpFileTime( "file-time" ); break;
374 case OLEPROP_TYPE_BLOB
: dumpBlob( nPropId
, "data" ); break;
375 case OLEPROP_TYPE_STREAM
: dumpString8( "stream-name" ); break;
376 case OLEPROP_TYPE_STORAGE
: dumpString8( "storage-name" ); break;
377 case OLEPROP_TYPE_CLIPFMT
: dumpBlob( nPropId
, "clip-data" ); break;
381 void OlePropertyStreamObject::dumpPropertyVector( sal_Int32 nPropId
, sal_uInt16 nBaseType
)
383 sal_Int32 nElemCount
= dumpDec
< sal_Int32
>( "element-count" );
384 for( sal_Int32 nElemIdx
= 0; !mxStrm
->isEof() && (nElemIdx
< nElemCount
); ++nElemIdx
)
386 mxOut
->resetItemIndex( nElemIdx
);
387 writeEmptyItem( "#element" );
388 IndentGuard
aIndGuard( mxOut
);
389 dumpPropertyValue( nPropId
, nBaseType
);
393 sal_uInt16
OlePropertyStreamObject::dumpPropertyType()
395 return static_cast< sal_uInt16
>( dumpHex
< sal_Int32
>( "type", "OLEPROP-TYPE" ) & 0xFFFF );
398 void OlePropertyStreamObject::dumpBlob( sal_Int32 nPropId
, const String
& rName
)
400 sal_Int32 nSize
= dumpDec
< sal_Int32
>( "data-size" );
403 OUString aPropName
= mxPropIds
->getName( cfg(), nPropId
);
404 if( aPropName
== "'_PID_HLINKS'" )
407 dumpBinary( rName
, nSize
);
411 OUString
OlePropertyStreamObject::dumpString8( const String
& rName
)
413 sal_Int32 nLen
= dumpDec
< sal_Int32
>( "string-len" );
414 return mbIsUnicode
? dumpCharArray16( rName
, nLen
) : dumpCharArray8( rName
, nLen
);
417 OUString
OlePropertyStreamObject::dumpCharArray8( const String
& rName
, sal_Int32 nLen
)
419 sal_Int32 nNewLen
= getLimitedValue
< sal_Int32
, sal_Int32
>( nLen
, 0, 1024 );
420 OUString aData
= mxStrm
->readCharArrayUC( nNewLen
, meTextEnc
);
421 writeStringItem( rName
, aData
);
425 OUString
OlePropertyStreamObject::dumpString16( const String
& rName
)
427 sal_Int32 nLen
= dumpDec
< sal_Int32
>( "string-len" );
428 return dumpCharArray16( rName
, nLen
);
431 OUString
OlePropertyStreamObject::dumpCharArray16( const String
& rName
, sal_Int32 nLen
)
433 sal_Int32 nNewLen
= getLimitedValue
< sal_Int32
, sal_Int32
>( nLen
, 0, 1024 );
434 OUString aData
= mxStrm
->readUnicodeArray( nNewLen
);
435 writeStringItem( rName
, aData
);
436 if( nNewLen
& 1 ) dumpUnused( 2 ); // always padding to 32bit
440 bool OlePropertyStreamObject::dumpTypedProperty( const String
& rName
, sal_uInt16 nExpectedType
)
442 writeEmptyItem( rName
);
443 IndentGuard
aIndGuard( mxOut
);
444 return (dumpPropertyContents( -1 ) == nExpectedType
) && !mxStrm
->isEof();
447 void OlePropertyStreamObject::dumpHlinks( sal_Int32 nSize
)
449 sal_Int64 nEndPos
= mxStrm
->tell() + nSize
;
450 sal_Int32 nCount
= dumpDec
< sal_Int32
>( "property-count" );
452 for( sal_Int32 nHlinkIndex
= 0, nHlinkCount
= nCount
/ 6; bValid
&& !mxStrm
->isEof() && (nHlinkIndex
< nHlinkCount
); ++nHlinkIndex
)
454 writeEmptyItem( "HYPERLINK" );
455 IndentGuard
aIndGuard( mxOut
);
457 dumpTypedProperty( "hash", OLEPROP_TYPE_INT32
) &&
458 dumpTypedProperty( "app", OLEPROP_TYPE_INT32
) &&
459 dumpTypedProperty( "shape-id", OLEPROP_TYPE_INT32
) &&
460 dumpTypedProperty( "info", OLEPROP_TYPE_INT32
) &&
461 dumpTypedProperty( "target", OLEPROP_TYPE_STRING16
) &&
462 dumpTypedProperty( "location", OLEPROP_TYPE_STRING16
);
464 dumpRemainingTo( nEndPos
);
467 bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos
)
469 mxStrm
->seek( nStartPos
);
470 if( mxStrm
->isEof() )
471 writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM
);
472 return !mxStrm
->isEof();
475 void OlePropertyStreamObject::writeSectionHeader( const OUString
& rGuid
, sal_uInt32 nStartPos
)
477 MultiItemsGuard
aMultiGuard( mxOut
);
478 writeEmptyItem( "SECTION" );
479 writeHexItem( "pos", nStartPos
, "CONV-DEC" );
480 writeGuidItem( "guid", rGuid
);
483 void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId
, sal_uInt32 nStartPos
)
485 MultiItemsGuard
aMultiGuard( mxOut
);
486 writeEmptyItem( "PROPERTY" );
487 writeHexItem( "pos", nStartPos
, "CONV-DEC" );
488 writeDecItem( "id", nPropId
, mxPropIds
);
491 OleStorageObject::OleStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
)
493 construct( rParent
, rxStrg
, rSysPath
);
496 void OleStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& /*rStrgPath*/, const OUString
& rStrmName
, const OUString
& rSysFileName
)
498 if ( rStrmName
== "\001CompObj" )
499 OleCompObjObject( *this, rxStrm
, rSysFileName
).dump();
500 else if( rStrmName
== "\005SummaryInformation" || rStrmName
== "\005DocumentSummaryInformation" )
501 OlePropertyStreamObject( *this, rxStrm
, rSysFileName
).dump();
503 BinaryStreamObject( *this, rxStrm
, rSysFileName
).dump();
506 ComCtlObjectBase::ComCtlObjectBase( const InputObjectBase
& rParent
,
507 sal_uInt32 nDataId5
, sal_uInt32 nDataId6
, sal_uInt16 nVersion
, bool bCommonPart
, bool bComplexPart
) :
508 mnDataId5( nDataId5
),
509 mnDataId6( nDataId6
),
510 mnVersion( nVersion
),
511 mbCommonPart( bCommonPart
),
512 mbComplexPart( bComplexPart
)
514 construct( rParent
);
517 void ComCtlObjectBase::implDump()
519 sal_uInt32 nCommonSize
= 0;
520 dumpComCtlSize() && dumpComCtlData( nCommonSize
) && (!mbCommonPart
|| dumpComCtlCommon( nCommonSize
)) && (!mbComplexPart
|| dumpComCtlComplex());
523 void ComCtlObjectBase::implDumpCommonExtra( sal_Int64
/*nEndPos*/ )
527 void ComCtlObjectBase::implDumpCommonTrailing()
531 bool ComCtlObjectBase::dumpComCtlHeader( sal_uInt32 nExpId
, sal_uInt16 nExpMajor
, sal_uInt16 nExpMinor
)
533 // no idea if all this is correct...
534 sal_uInt32 nId
= dumpHex
< sal_uInt32
>( "header-id", "COMCTL-HEADER-IDS" );
535 ItemGuard
aItem( mxOut
, "version" );
536 sal_uInt16 nMinor
= mxStrm
->readuInt16();
537 sal_uInt16 nMajor
= mxStrm
->readuInt16();
538 mxOut
->writeDec( nMajor
);
539 mxOut
->writeChar( '.' );
540 mxOut
->writeDec( nMinor
);
541 return !mxStrm
->isEof() && (nId
== nExpId
) && ((nExpMajor
== SAL_MAX_UINT16
) || (nExpMajor
== nMajor
)) && ((nExpMinor
== SAL_MAX_UINT16
) || (nExpMinor
== nMinor
));
544 bool ComCtlObjectBase::dumpComCtlSize()
546 if( dumpComCtlHeader( 0x12344321, 0, 8 ) )
548 IndentGuard
aIndGuard( mxOut
);
549 dumpDec
< sal_Int32
>( "width", "CONV-HMM-TO-CM" );
550 dumpDec
< sal_Int32
>( "height", "CONV-HMM-TO-CM" );
551 return !mxStrm
->isEof();
556 bool ComCtlObjectBase::dumpComCtlData( sal_uInt32
& ornCommonPartSize
)
558 if( dumpComCtlHeader( (mnVersion
== 5) ? mnDataId5
: mnDataId6
, mnVersion
) )
560 IndentGuard
aIndGuard( mxOut
);
562 ornCommonPartSize
= dumpDec
< sal_uInt32
>( "common-part-size" );
563 implDumpProperties();
564 return !mxStrm
->isEof();
569 bool ComCtlObjectBase::dumpComCtlCommon( sal_uInt32 nPartSize
)
571 sal_Int64 nEndPos
= mxStrm
->tell() + nPartSize
;
572 if( (nPartSize
>= 16) && dumpComCtlHeader( 0xABCDEF01, 5, 0 ) )
574 IndentGuard
aIndGuard( mxOut
);
576 dumpHex
< sal_uInt32
>( "common-flags", "COMCTL-COMMON-FLAGS" );
577 implDumpCommonExtra( nEndPos
);
578 dumpRemainingTo( nEndPos
);
579 implDumpCommonTrailing();
580 return !mxStrm
->isEof();
585 bool ComCtlObjectBase::dumpComCtlComplex()
587 if( dumpComCtlHeader( 0xBDECDE1F, 5, 1 ) )
589 IndentGuard
aIndGuard( mxOut
);
590 sal_uInt32 nFlags
= dumpHex
< sal_uInt32
>( "comctl-complex-flags", "COMCTL-COMPLEX-FLAGS" );
591 if( !mxStrm
->isEof() && (nFlags
& 0x01) )
593 writeEmptyItem( "font" );
594 IndentGuard
aIndGuard2( mxOut
);
595 OUString aClassName
= cfg().getStringOption( dumpGuid(), OUString() );
596 if ( aClassName
== "StdFont" )
597 StdFontObject( *this ).dump();
599 if( !mxStrm
->isEof() && (nFlags
& 0x02) )
601 writeEmptyItem( "mouse-icon" );
602 IndentGuard
aIndGuard2( mxOut
);
603 OUString aClassName
= cfg().getStringOption( dumpGuid(), OUString() );
604 if ( aClassName
== "StdPic" )
605 StdPicObject( *this ).dump();
607 return !mxStrm
->isEof();
612 ComCtlScrollBarObject::ComCtlScrollBarObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
613 ComCtlObjectBase( rParent
, SAL_MAX_UINT32
, 0x99470A83, nVersion
, true, true )
617 void ComCtlScrollBarObject::implDumpProperties()
619 dumpHex
< sal_uInt32
>( "flags", "COMCTL-SCROLLBAR-FLAGS" );
620 dumpDec
< sal_Int32
>( "large-change" );
621 dumpDec
< sal_Int32
>( "small-change" );
622 dumpDec
< sal_Int32
>( "min" );
623 dumpDec
< sal_Int32
>( "max" );
624 dumpDec
< sal_Int32
>( "value" );
627 ComCtlProgressBarObject::ComCtlProgressBarObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
628 ComCtlObjectBase( rParent
, 0xE6E17E84, 0x97AB8A01, nVersion
, true, true )
632 void ComCtlProgressBarObject::implDumpProperties()
634 dumpDec
< float >( "min" );
635 dumpDec
< float >( "max" );
638 dumpBool
< sal_uInt16
>( "vertical" );
639 dumpBool
< sal_uInt16
>( "smooth-scroll" );
643 ComCtlSliderObject::ComCtlSliderObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
644 ComCtlObjectBase( rParent
, 0xE6E17E86, 0x0A2BAE11, nVersion
, true, true )
648 void ComCtlSliderObject::implDumpProperties()
650 dumpBool
< sal_Int32
>( "vertical" );
651 dumpDec
< sal_Int32
>( "large-change" );
652 dumpDec
< sal_Int32
>( "small-change" );
653 dumpDec
< sal_Int32
>( "min" );
654 dumpDec
< sal_Int32
>( "max" );
655 dumpDec
< sal_Int16
>( "select-range", "COMCTL-SLIDER-SELECTRANGE" );
657 dumpDec
< sal_Int32
>( "select-start" );
658 dumpDec
< sal_Int32
>( "select-length" );
659 dumpDec
< sal_Int32
>( "tick-style", "COMCTL-SLIDER-TICKSTYLE" );
660 dumpDec
< sal_Int32
>( "tick-frequency" );
661 dumpDec
< sal_Int32
>( "value" );
663 dumpBool
< sal_Int32
>( "tooltip-below" );
666 ComCtlUpDownObject::ComCtlUpDownObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
667 ComCtlObjectBase( rParent
, 0xFF3626A0, 0xFF3626A0, nVersion
, false, false )
671 void ComCtlUpDownObject::implDumpProperties()
673 dumpUnknown( 16 ); // buddy-property, somehow
674 dumpDec
< sal_Int32
>( "buddy-control" );
676 dumpDec
< sal_Int32
>( "value" );
678 dumpDec
< sal_Int32
>( "increment" );
679 dumpDec
< sal_Int32
>( "max" );
680 dumpDec
< sal_Int32
>( "min" );
681 dumpHex
< sal_uInt32
>( "flags-1", "COMCTL-UPDOWN-FLAGS1" );
682 dumpHex
< sal_uInt32
>( "flags-2", "COMCTL-UPDOWN-FLAGS2" );
686 ComCtlImageListObject::ComCtlImageListObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
687 ComCtlObjectBase( rParent
, 0xE6E17E80, 0xE6E17E80, nVersion
, true, false )
691 void ComCtlImageListObject::implDumpProperties()
693 dumpDec
< sal_uInt16
>( "image-width" );
694 dumpDec
< sal_uInt16
>( "image-height" );
695 dumpOleColor( "mask-color" );
696 dumpBool
< sal_Int16
>( "use-mask-color" );
700 void ComCtlImageListObject::implDumpCommonExtra( sal_Int64
/*nEndPos*/ )
703 dumpOleColor( "back-color" );
705 sal_Int32 nImageCount
= dumpDec
< sal_Int32
>( "image-count" );
706 mxOut
->resetItemIndex();
707 for( sal_Int32 nImageIndex
= 0; (nImageIndex
< nImageCount
) && !mxStrm
->isEof(); ++nImageIndex
)
709 writeEmptyItem( "#image" );
710 IndentGuard
aIndGuard( mxOut
);
711 sal_uInt8 nFlags
= dumpHex
< sal_uInt8
>( "text-flags", "COMCTL-IMAGELIST-TEXTFLAGS" );
712 if( nFlags
& 0x01 ) dumpUniString32( "caption" );
713 if( nFlags
& 0x02 ) dumpUniString32( "key" );
717 void ComCtlImageListObject::implDumpCommonTrailing()
719 sal_Int32 nImageCount
= dumpDec
< sal_Int32
>( "image-count" );
720 mxOut
->resetItemIndex();
721 for( sal_Int32 nImageIndex
= 0; (nImageIndex
< nImageCount
) && !mxStrm
->isEof(); ++nImageIndex
)
723 writeEmptyItem( "#image" );
724 IndentGuard
aIndGuard( mxOut
);
725 dumpDec
< sal_Int32
>( "index" );
726 StdPicObject( *this ).dump();
730 ComCtlTabStripObject::ComCtlTabStripObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
731 ComCtlObjectBase( rParent
, 0xE6E17E8A, 0xD12A7AC1, nVersion
, true, true )
735 void ComCtlTabStripObject::implDumpProperties()
737 dumpHex
< sal_uInt32
>( "flags-1", "COMCTL-TABSTRIP-FLAGS1" );
738 dumpDec
< sal_uInt16
>( "tab-fixed-width", "CONV-HMM-TO-CM" );
739 dumpDec
< sal_uInt16
>( "tab-fixed-height", "CONV-HMM-TO-CM" );
742 dumpHex
< sal_uInt32
>( "flags-2", "COMCTL-TABSTRIP-FLAGS2" );
743 dumpDec
< sal_uInt16
>( "tab-min-width", "CONV-HMM-TO-CM" );
745 dumpHex
< sal_uInt32
>( "flags-3", "COMCTL-TABSTRIP-FLAGS3" );
749 void ComCtlTabStripObject::implDumpCommonExtra( sal_Int64
/*nEndPos*/ )
752 dumpUniString32( "image-list" );
753 sal_Int32 nTabCount
= dumpDec
< sal_Int32
>( "tab-count" );
754 mxOut
->resetItemIndex();
755 for( sal_Int32 nTabIndex
= 0; (nTabIndex
< nTabCount
) && !mxStrm
->isEof(); ++nTabIndex
)
757 writeEmptyItem( "#tab" );
758 IndentGuard
aIndGuard( mxOut
);
760 sal_uInt32 nTabFlags
= dumpHex
< sal_uInt32
>( "tab-flags", "COMCTL-TABSTRIP-TABFLAGS" );
761 if( nTabFlags
& 0x01 ) dumpUniString32( "caption" );
762 if( nTabFlags
& 0x02 ) dumpUniString32( "key" );
763 if( nTabFlags
& 0x04 ) dumpUniString32( "tag" );
764 if( nTabFlags
& 0x08 ) dumpUniString32( "tooltip" );
765 dumpDec
< sal_uInt16
>( "image-id" );
769 ComCtlTreeViewObject::ComCtlTreeViewObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
770 ComCtlObjectBase( rParent
, 0xE6E17E8E, 0x6AC13CB1, nVersion
, true, true ),
775 void ComCtlTreeViewObject::implDumpProperties()
777 dumpHex
< sal_uInt32
>( "flags", "COMCTL-TREEVIEW-FLAGS" );
778 dumpDec
< sal_Int32
>( "indentation", "CONV-HMM-TO-CM" );
780 dumpHex
< sal_uInt32
>( "flags-2", "COMCTL-TREEVIEW-FLAGS2" );
781 mnStringFlags
= dumpHex
< sal_uInt32
>( "string-flags", "COMCTL-TREEVIEW-STRINGFLAGS" );
784 void ComCtlTreeViewObject::implDumpCommonExtra( sal_Int64
/*nEndPos*/ )
786 dumpOleColor( "text-color" );
787 dumpOleColor( "back-color" );
789 if( mnStringFlags
& 0x02 )
790 dumpUniString32( "image-list" );
791 dumpUniString32( "path-separator" );
794 ComCtlStatusBarObject::ComCtlStatusBarObject( const InputObjectBase
& rParent
, sal_uInt16 nVersion
) :
795 ComCtlObjectBase( rParent
, 0xE6E17E88, SAL_MAX_UINT32
, nVersion
, true, true )
799 void ComCtlStatusBarObject::implDumpProperties()
801 dumpBool
< sal_Int32
>( "style-simple-text" );
802 dumpBool
< sal_Int16
>( "show-tips" );
806 void ComCtlStatusBarObject::implDumpCommonExtra( sal_Int64
/*nEndPos*/ )
809 dumpUniString32( "simple-text" );
810 sal_Int32 nPanelCount
= dumpDec
< sal_Int32
>( "panel-count" );
811 mxOut
->resetItemIndex();
812 for( sal_Int32 nPanelIndex
= 0; (nPanelIndex
< nPanelCount
) && !mxStrm
->isEof(); ++nPanelIndex
)
814 writeEmptyItem( "#panel" );
815 IndentGuard
aIndGuard( mxOut
);
816 dumpHex
< sal_uInt32
>( "panel-flags", "COMCTL-STATUSBAR-PANELFLAGS" );
817 dumpDec
< sal_Int32
>( "current-width", "CONV-HMM-TO-CM" );
818 dumpDec
< sal_Int32
>( "minimal-width", "CONV-HMM-TO-CM" );
819 sal_uInt32 nTextFlags
= dumpHex
< sal_uInt32
>( "text-flags", "COMCTL-STATUSBAR-TEXTFLAGS" );
820 if( nTextFlags
& 0x01 ) dumpUniString32( "text" );
821 if( nTextFlags
& 0x02 ) dumpUniString32( "vis-text" );
822 if( nTextFlags
& 0x04 ) dumpUniString32( "key" );
823 if( nTextFlags
& 0x08 ) dumpUniString32( "tag" );
824 if( nTextFlags
& 0x10 ) dumpUniString32( "tooltip" );
828 void ComCtlStatusBarObject::implDumpCommonTrailing()
830 sal_Int32 nImageCount
= dumpDec
< sal_Int32
>( "image-count" );
831 mxOut
->resetItemIndex();
832 for( sal_Int32 nImageIndex
= 0; (nImageIndex
< nImageCount
) && !mxStrm
->isEof(); ++nImageIndex
)
834 writeEmptyItem( "#image" );
835 IndentGuard
aIndGuard( mxOut
);
836 dumpDec
< sal_Int32
>( "panel-index" );
837 StdPicObject( *this ).dump();
841 void AxPropertyObjectBase::construct( const ObjectBase
& rParent
,
842 const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, const String
& rPropNameList
, bool b64BitPropFlags
)
844 OleInputObjectBase::construct( rParent
, rxStrm
, rSysFileName
);
845 constructAxPropObj( rPropNameList
, b64BitPropFlags
);
848 void AxPropertyObjectBase::construct( const InputObjectBase
& rParent
,
849 const String
& rPropNameList
, bool b64BitPropFlags
)
851 OleInputObjectBase::construct( rParent
);
852 constructAxPropObj( rPropNameList
, b64BitPropFlags
);
855 bool AxPropertyObjectBase::implIsValid() const
857 return OleInputObjectBase::implIsValid() && mxStrm
->isSeekable();
860 void AxPropertyObjectBase::implDump()
866 sal_uInt16 nSize
= dumpDec
< sal_uInt16
>( "size" );
867 mnPropertiesEnd
= mxStrm
->tell() + nSize
;
869 maLargeProps
.clear();
870 maStreamProps
.clear();
871 mnPropFlags
= dumpHex
< sal_Int64
, sal_uInt32
>( mb64BitPropFlags
, "properties", mxPropNames
);
874 dumpShortProperties();
875 dumpLargeProperties();
881 void AxPropertyObjectBase::implDumpShortProperties()
885 void AxPropertyObjectBase::implDumpExtended()
889 bool AxPropertyObjectBase::ensureValid( bool bCondition
)
891 if( mbValid
&& (!bCondition
|| mxStrm
->isEof()) )
894 writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
900 void AxPropertyObjectBase::setAlignAnchor()
902 mnPropertiesStart
= mxStrm
->tell();
905 bool AxPropertyObjectBase::startNextProperty()
907 if( mnCurrProp
== 0 ) mnCurrProp
= 1; else mnCurrProp
<<= 1;
908 bool bHasProp
= getFlag( mnPropFlags
, mnCurrProp
);
909 setFlag( mnPropFlags
, mnCurrProp
, false );
910 return ensureValid() && bHasProp
;
913 OUString
AxPropertyObjectBase::getPropertyName() const
915 return cfg().getName( mxPropNames
, mnCurrProp
);
918 sal_uInt32
AxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault
, const char* pcNameList
)
920 if( startNextProperty() )
922 alignInput
< sal_uInt32
>();
923 return dumpHex
< sal_uInt32
>( getPropertyName(), pcNameList
);
928 sal_uInt32
AxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault
)
930 if( startNextProperty() )
932 alignInput
< sal_uInt32
>();
933 return dumpOleColor( getPropertyName() );
938 sal_Unicode
AxPropertyObjectBase::dumpUnicodeProperty()
940 if( startNextProperty() )
942 alignInput
< sal_uInt16
>();
943 return dumpUnicode( getPropertyName() );
948 void AxPropertyObjectBase::dumpUnknownProperty()
950 if( startNextProperty() )
951 ensureValid( false );
954 void AxPropertyObjectBase::dumpPosProperty()
956 if( startNextProperty() )
957 maLargeProps
.emplace_back( LargeProperty::PROPTYPE_POS
, getPropertyName(), 8 );
960 void AxPropertyObjectBase::dumpSizeProperty()
962 if( startNextProperty() )
963 maLargeProps
.emplace_back( LargeProperty::PROPTYPE_SIZE
, getPropertyName(), 8 );
966 void AxPropertyObjectBase::dumpGuidProperty( OUString
* pValue
)
968 if( startNextProperty() )
969 maLargeProps
.emplace_back( LargeProperty::PROPTYPE_GUID
, getPropertyName(), 16, pValue
);
972 void AxPropertyObjectBase::dumpStringProperty( OUString
* pValue
)
974 if( startNextProperty() )
976 alignInput
< sal_uInt32
>();
977 sal_uInt32 nLen
= dumpHex
< sal_uInt32
>( getPropertyName(), "AX-STRINGLEN" );
978 maLargeProps
.emplace_back( LargeProperty::PROPTYPE_STRING
, getPropertyName(), nLen
, pValue
);
982 void AxPropertyObjectBase::dumpStringArrayProperty()
984 if( startNextProperty() )
986 alignInput
< sal_uInt32
>();
987 sal_uInt32 nLen
= dumpHex
< sal_uInt32
>( getPropertyName(), "CONV-DEC" );
988 maLargeProps
.emplace_back( LargeProperty::PROPTYPE_STRINGARRAY
, getPropertyName(), nLen
);
992 void AxPropertyObjectBase::dumpStreamProperty()
994 if( startNextProperty() )
996 alignInput
< sal_uInt16
>();
997 sal_uInt16 nData
= dumpHex
< sal_uInt16
>( getPropertyName() );
998 maStreamProps
.emplace_back( getPropertyName(), nData
);
1002 void AxPropertyObjectBase::dumpEmbeddedFont()
1006 writeEmptyItem( "embedded-fontdata" );
1007 IndentGuard
aIndGuard( mxOut
);
1008 AxCFontNewObject( *this ).dump();
1012 void AxPropertyObjectBase::dumpToPosition( sal_Int64 nPos
)
1014 dumpRemainingTo( nPos
);
1019 void AxPropertyObjectBase::constructAxPropObj( const String
& rPropNameList
, bool b64BitPropFlags
)
1021 if( OleInputObjectBase::implIsValid() )
1023 mxPropNames
= cfg().getNameList( rPropNameList
);
1024 mb64BitPropFlags
= b64BitPropFlags
;
1029 void AxPropertyObjectBase::dumpVersion()
1031 ItemGuard
aItem( mxOut
, "version" );
1032 sal_uInt8 nMinor
= mxStrm
->readuChar();
1033 sal_uInt8 nMajor
= mxStrm
->readuChar();
1034 mxOut
->writeDec( nMajor
);
1035 mxOut
->writeChar( '.' );
1036 mxOut
->writeDec( nMinor
);
1039 OUString
AxPropertyObjectBase::dumpString( const String
& rName
, sal_uInt32 nSize
, bool bArray
)
1041 bool bCompressed
= getFlag( nSize
, AX_STRING_COMPRESSED
);
1042 sal_uInt32 nBufSize
= extractValue
< sal_uInt32
>( nSize
, 0, 31 );
1043 OUString aString
= bCompressed
?
1044 dumpCharArray( rName
, nBufSize
, RTL_TEXTENCODING_ISO_8859_1
) :
1045 dumpUnicodeArray( rName
, bArray
? nBufSize
: (nBufSize
/ 2) );
1046 alignInput
< sal_Int32
>();
1050 void AxPropertyObjectBase::dumpShortProperties()
1054 writeEmptyItem( "short-properties" );
1055 IndentGuard
aIndGuard( mxOut
);
1056 implDumpShortProperties();
1057 alignInput
< sal_uInt32
>();
1061 void AxPropertyObjectBase::dumpLargeProperties()
1063 if( ensureValid( mnPropFlags
== 0 ) && !maLargeProps
.empty() )
1065 writeEmptyItem( "large-properties" );
1066 IndentGuard
aIndGuard( mxOut
);
1067 for (auto const& largeProp
: maLargeProps
)
1071 switch( largeProp
.mePropType
)
1073 case LargeProperty::PROPTYPE_POS
:
1075 MultiItemsGuard
aMultiGuard( mxOut
);
1076 writeEmptyItem( largeProp
.maItemName
);
1077 dumpDec
< sal_Int32
>( "top", "CONV-HMM-TO-CM" );
1078 dumpDec
< sal_Int32
>( "left", "CONV-HMM-TO-CM" );
1081 case LargeProperty::PROPTYPE_SIZE
:
1083 MultiItemsGuard
aMultiGuard( mxOut
);
1084 writeEmptyItem( largeProp
.maItemName
);
1085 dumpDec
< sal_Int32
>( "width", "CONV-HMM-TO-CM" );
1086 dumpDec
< sal_Int32
>( "height", "CONV-HMM-TO-CM" );
1089 case LargeProperty::PROPTYPE_GUID
:
1091 OUString aGuid
= dumpGuid( largeProp
.maItemName
);
1092 if( largeProp
.mpItemValue
)
1093 *largeProp
.mpItemValue
= cfg().getStringOption( aGuid
, OUString() );
1096 case LargeProperty::PROPTYPE_STRING
:
1098 OUString aString
= dumpString( largeProp
.maItemName
, largeProp
.mnDataSize
, false );
1099 if( largeProp
.mpItemValue
)
1100 *largeProp
.mpItemValue
= aString
;
1103 case LargeProperty::PROPTYPE_STRINGARRAY
:
1105 writeEmptyItem( largeProp
.maItemName
);
1106 IndentGuard
aIndGuard2( mxOut
);
1107 mxOut
->resetItemIndex();
1108 sal_Int64 nEndPos
= mxStrm
->tell() + largeProp
.mnDataSize
;
1109 while( mxStrm
->tell() < nEndPos
)
1111 MultiItemsGuard
aMultiGuard( mxOut
);
1112 sal_uInt32 nDataSize
= dumpHex
< sal_uInt32
>( "#flags", "AX-ARRAYSTRINGLEN" );
1113 dumpString( "string", nDataSize
, true );
1115 dumpToPosition( nEndPos
);
1121 dumpToPosition( mnPropertiesEnd
);
1123 if( !ensureValid() || maStreamProps
.empty() )
1126 writeEmptyItem( "stream-properties" );
1127 IndentGuard
aIndGuard( mxOut
);
1128 for (auto const& streamProp
: maStreamProps
)
1132 writeEmptyItem( streamProp
.maItemName
);
1133 if( ensureValid( streamProp
.mnData
== 0xFFFF ) )
1135 IndentGuard
aIndGuard2( mxOut
);
1136 OUString aClassName
= cfg().getStringOption( dumpGuid(), OUString() );
1137 if ( aClassName
== "StdFont" )
1138 StdFontObject( *this ).dump();
1139 else if ( aClassName
== "StdPic" )
1140 StdPicObject( *this ).dump();
1141 else if ( aClassName
== "CFontNew" )
1142 AxCFontNewObject( *this ).dump();
1144 ensureValid( false );
1149 AxCFontNewObject::AxCFontNewObject( const InputObjectBase
& rParent
)
1151 AxPropertyObjectBase::construct( rParent
, "AX-CFONTNEW-PROPERTIES" );
1154 void AxCFontNewObject::implDumpShortProperties()
1156 dumpStringProperty();
1157 dumpFlagsProperty( 0, "AX-CFONTNEW-FLAGS" );
1158 dumpDecProperty
< sal_Int32
>( 160 );
1159 dumpDecProperty
< sal_Int32
>( 0 );
1160 dumpDecProperty
< sal_uInt8
>( WINDOWS_CHARSET_DEFAULT
, "CHARSET" );
1161 dumpDecProperty
< sal_uInt8
>( 0, "FONT-PITCHFAMILY" );
1162 dumpDecProperty
< sal_uInt8
>( 1, "AX-CFONTNEW-ALIGNMENT" );
1163 dumpDecProperty
< sal_uInt16
>( 400, "FONT-WEIGHT" );
1166 AxColumnInfoObject::AxColumnInfoObject( const InputObjectBase
& rParent
)
1168 AxPropertyObjectBase::construct( rParent
, "AX-COLUMNINFO-PROPERTIES" );
1171 void AxColumnInfoObject::implDumpShortProperties()
1173 dumpDecProperty
< sal_Int32
>( -1, "CONV-HMM-TO-CM" );
1176 AxCommandButtonObject::AxCommandButtonObject( const InputObjectBase
& rParent
)
1178 AxPropertyObjectBase::construct( rParent
, "AX-COMMANDBUTTON-PROPERTIES" );
1181 void AxCommandButtonObject::implDumpShortProperties()
1183 dumpColorProperty( 0x80000012 );
1184 dumpColorProperty( 0x80000008 );
1185 dumpFlagsProperty( 0x0000001B );
1186 dumpStringProperty();
1187 dumpImagePosProperty();
1189 dumpMousePtrProperty();
1190 dumpStreamProperty();
1191 dumpUnicodeProperty();
1193 dumpStreamProperty();
1196 void AxCommandButtonObject::implDumpExtended()
1201 AxMorphControlObject::AxMorphControlObject( const InputObjectBase
& rParent
)
1203 AxPropertyObjectBase::construct( rParent
, "AX-MORPH-PROPERTIES", true );
1206 void AxMorphControlObject::implDumpShortProperties()
1208 dumpFlagsProperty( 0x2C80081B );
1209 dumpColorProperty( 0x80000005 );
1210 dumpColorProperty( 0x80000008 );
1211 dumpDecProperty
< sal_uInt32
>( 0 );
1212 dumpBorderStyleProperty
< sal_uInt8
>( 0 );
1213 dumpDecProperty
< sal_uInt8
>( 0, "AX-MORPH-SCROLLBARS" );
1214 mnCtrlType
= dumpDecProperty
< sal_uInt8
>( 1, "AX-MORPH-CONTROLTYPE" );
1215 dumpMousePtrProperty();
1217 dumpUnicodeProperty();
1218 dumpDecProperty
< sal_uInt32
>( 0, "CONV-HMM-TO-CM" );
1219 dumpDecProperty
< sal_uInt16
>( 1, "AX-MORPH-BOUNDCOLUMN" );
1220 dumpDecProperty
< sal_Int16
>( -1, "AX-MORPH-TEXTCOLUMN" );
1221 dumpDecProperty
< sal_Int16
>( 1, "AX-MORPH-COLUMNCOUNT" );
1222 dumpDecProperty
< sal_uInt16
>( 8 );
1223 mnColInfoCount
= dumpDecProperty
< sal_uInt16
>( 1 );
1224 dumpDecProperty
< sal_uInt8
>( 2, "AX-MORPH-MATCHENTRYTYPE" );
1225 dumpDecProperty
< sal_uInt8
>( 0, "AX-MORPH-LISTSTYLE" );
1226 dumpDecProperty
< sal_uInt8
>( 0, "AX-MORPH-SHOWDROPDOWNMODE" );
1227 dumpUnknownProperty();
1228 dumpDecProperty
< sal_uInt8
>( 1, "AX-MORPH-DROPDOWNSTYLE" );
1229 dumpDecProperty
< sal_uInt8
>( 0, "AX-MORPH-SELECTIONTYPE" );
1230 dumpStringProperty();
1231 dumpStringProperty();
1232 dumpImagePosProperty();
1233 dumpColorProperty( 0x80000006 );
1234 dumpSpecialEffectProperty
< sal_uInt32
>( 2 );
1235 dumpStreamProperty();
1236 dumpStreamProperty();
1237 dumpUnicodeProperty();
1238 dumpUnknownProperty();
1240 dumpStringProperty();
1243 void AxMorphControlObject::implDumpExtended()
1249 void AxMorphControlObject::dumpColumnInfos()
1251 if( ensureValid() && (mnColInfoCount
> 0) && ((mnCtrlType
== 2) || (mnCtrlType
== 3)) )
1253 mxOut
->resetItemIndex();
1254 for( sal_uInt16 nIdx
= 0; ensureValid() && (nIdx
< mnColInfoCount
); ++nIdx
)
1256 writeEmptyItem( "#column-info" );
1257 IndentGuard
aIndGuard( mxOut
);
1258 AxColumnInfoObject( *this ).dump();
1263 AxLabelObject::AxLabelObject( const InputObjectBase
& rParent
)
1265 AxPropertyObjectBase::construct( rParent
, "AX-LABEL-PROPERTIES" );
1268 void AxLabelObject::implDumpShortProperties()
1270 dumpColorProperty( 0x80000012 );
1271 dumpColorProperty( 0x8000000F );
1272 dumpFlagsProperty( 0x0080001B );
1273 dumpStringProperty();
1274 dumpImagePosProperty();
1276 dumpMousePtrProperty();
1277 dumpColorProperty( 0x80000006 );
1278 dumpBorderStyleProperty
< sal_uInt16
>( 0 );
1279 dumpSpecialEffectProperty
< sal_uInt16
>( 0 );
1280 dumpStreamProperty();
1281 dumpUnicodeProperty();
1282 dumpStreamProperty();
1285 void AxLabelObject::implDumpExtended()
1290 AxImageObject::AxImageObject( const InputObjectBase
& rParent
)
1292 AxPropertyObjectBase::construct( rParent
, "AX-IMAGE-PROPERTIES" );
1295 void AxImageObject::implDumpShortProperties()
1297 dumpUnknownProperty();
1298 dumpUnknownProperty();
1300 dumpColorProperty( 0x80000006 );
1301 dumpColorProperty( 0x8000000F );
1302 dumpBorderStyleProperty
< sal_uInt8
>( 1 );
1303 dumpMousePtrProperty();
1304 dumpImageSizeModeProperty();
1305 dumpSpecialEffectProperty
< sal_uInt8
>( 0 );
1307 dumpStreamProperty();
1308 dumpImageAlignProperty();
1310 dumpFlagsProperty( 0x0000001B );
1311 dumpStreamProperty();
1314 AxScrollBarObject::AxScrollBarObject( const InputObjectBase
& rParent
)
1316 AxPropertyObjectBase::construct( rParent
, "AX-SCROLLBAR-PROPERTIES" );
1319 void AxScrollBarObject::implDumpShortProperties()
1321 dumpColorProperty( 0x80000012 );
1322 dumpColorProperty( 0x8000000F );
1323 dumpFlagsProperty( 0x0000001B );
1325 dumpMousePtrProperty();
1326 dumpDecProperty
< sal_Int32
>( 0 );
1327 dumpDecProperty
< sal_Int32
>( 32767 );
1328 dumpDecProperty
< sal_Int32
>( 0 );
1329 dumpHexProperty
< sal_uInt32
>( 0 );
1330 dumpEnabledProperty();
1331 dumpEnabledProperty();
1332 dumpDecProperty
< sal_Int32
>( 1 );
1333 dumpDecProperty
< sal_Int32
>( 1 );
1334 dumpOrientationProperty();
1335 dumpDecProperty
< sal_Int16
>( -1, "AX-SCROLLBAR-PROPTHUMB" );
1336 dumpDelayProperty();
1337 dumpStreamProperty();
1340 AxSpinButtonObject::AxSpinButtonObject( const InputObjectBase
& rParent
)
1342 AxPropertyObjectBase::construct( rParent
, "AX-SPINBUTTON-PROPERTIES" );
1345 void AxSpinButtonObject::implDumpShortProperties()
1347 dumpColorProperty( 0x80000012 );
1348 dumpColorProperty( 0x8000000F );
1349 dumpFlagsProperty( 0x0000001B );
1351 dumpHexProperty
< sal_uInt32
>( 0 );
1352 dumpDecProperty
< sal_Int32
>( 0 );
1353 dumpDecProperty
< sal_Int32
>( 100 );
1354 dumpDecProperty
< sal_Int32
>( 0 );
1355 dumpEnabledProperty();
1356 dumpEnabledProperty();
1357 dumpDecProperty
< sal_Int32
>( 1 );
1358 dumpOrientationProperty();
1359 dumpDelayProperty();
1360 dumpStreamProperty();
1361 dumpMousePtrProperty();
1364 AxTabStripObject::AxTabStripObject( const InputObjectBase
& rParent
)
1366 AxPropertyObjectBase::construct( rParent
, "AX-TABSTRIP-PROPERTIES" );
1369 void AxTabStripObject::implDumpShortProperties()
1371 dumpDecProperty
< sal_Int32
>( -1 );
1372 dumpColorProperty( 0x8000000F );
1373 dumpColorProperty( 0x80000012 );
1374 dumpUnknownProperty();
1376 dumpStringArrayProperty();
1377 dumpMousePtrProperty();
1378 dumpUnknownProperty();
1379 dumpDecProperty
< sal_uInt32
>( 0, "AX-TABSTRIP-ORIENTATION" );
1380 dumpDecProperty
< sal_uInt32
>( 0, "AX-TABSTRIP-TABSTYLE" );
1385 dumpUnknownProperty();
1386 dumpStringArrayProperty();
1387 dumpUnknownProperty();
1388 dumpStringArrayProperty();
1389 dumpFlagsProperty( 0x0000001B );
1391 dumpDecProperty
< sal_uInt32
>( 0 );
1392 dumpStringArrayProperty();
1393 mnTabFlagCount
= dumpDecProperty
< sal_Int32
>( 0 );
1394 dumpStringArrayProperty();
1395 dumpStreamProperty();
1398 void AxTabStripObject::implDumpExtended()
1401 if( mnTabFlagCount
> 0 )
1403 writeEmptyItem( "tab-flags" );
1404 IndentGuard
aIndGuard( mxOut
);
1405 mxOut
->resetItemIndex();
1406 for( sal_Int32 nIdx
= 0; ensureValid() && (nIdx
< mnTabFlagCount
); ++nIdx
)
1407 dumpHex
< sal_uInt32
>( "#flags", "AX-TABSTRIP-FLAGS" );
1411 FormControlStreamObject::FormControlStreamObject( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, const OUString
* pProgId
)
1413 construct( rParent
, rxStrm
, rSysFileName
);
1414 constructFormCtrlStrmObj( pProgId
);
1417 FormControlStreamObject::FormControlStreamObject( const OutputObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
* pProgId
)
1419 construct( rParent
, rxStrm
);
1420 constructFormCtrlStrmObj( pProgId
);
1423 void FormControlStreamObject::implDump()
1426 maProgId
= cfg().getStringOption( dumpGuid(), OUString() );
1428 if( !maProgId
.isEmpty() && !mxStrm
->isEof() )
1430 if ( maProgId
== "Forms.CommandButton.1" )
1431 AxCommandButtonObject( *this ).dump();
1432 else if( maProgId
== "Forms.TextBox.1" ||
1433 maProgId
== "Forms.ListBox.1" ||
1434 maProgId
== "Forms.ComboBox.1" ||
1435 maProgId
== "Forms.CheckBox.1" ||
1436 maProgId
== "Forms.OptionButton.1" ||
1437 maProgId
== "Forms.ToggleButton.1" ||
1438 maProgId
== "RefEdit.Ctrl" )
1439 AxMorphControlObject( *this ).dump();
1440 else if ( maProgId
== "Forms.Label.1" )
1441 AxLabelObject( *this ).dump();
1442 else if ( maProgId
== "Forms.Image.1" )
1443 AxImageObject( *this ).dump();
1444 else if ( maProgId
== "Forms.ScrollBar.1" )
1445 AxScrollBarObject( *this ).dump();
1446 else if ( maProgId
== "Forms.SpinButton.1" )
1447 AxSpinButtonObject( *this ).dump();
1448 else if ( maProgId
== "Forms.TabStrip.1" )
1449 AxTabStripObject( *this ).dump();
1450 else if ( maProgId
== "MSComCtl2.FlatScrollBar.2" )
1451 ComCtlScrollBarObject( *this, 6 ).dump();
1452 else if ( maProgId
== "COMCTL.ProgCtrl.1" )
1453 ComCtlProgressBarObject( *this, 5 ).dump();
1454 else if ( maProgId
== "MSComctlLib.ProgCtrl.2" )
1455 ComCtlProgressBarObject( *this, 6 ).dump();
1456 else if ( maProgId
== "COMCTL.Slider.1" )
1457 ComCtlSliderObject( *this, 5 ).dump();
1458 else if ( maProgId
== "MSComctlLib.Slider.2" )
1459 ComCtlSliderObject( *this, 6 ).dump();
1460 else if ( maProgId
== "ComCtl2.UpDown.1" )
1461 ComCtlUpDownObject( *this, 5 ).dump();
1462 else if ( maProgId
== "MSComCtl2.UpDown.2" )
1463 ComCtlUpDownObject( *this, 6 ).dump();
1464 else if ( maProgId
== "COMCTL.ImageListCtrl.1" )
1465 ComCtlImageListObject( *this, 5 ).dump();
1466 else if ( maProgId
== "MSComctlLib.ImageListCtrl.2" )
1467 ComCtlImageListObject( *this, 6 ).dump();
1468 else if ( maProgId
== "COMCTL.TabStrip.1" )
1469 ComCtlTabStripObject( *this, 5 ).dump();
1470 else if ( maProgId
== "MSComctlLib.TabStrip.2" )
1471 ComCtlTabStripObject( *this, 6 ).dump();
1472 else if ( maProgId
== "COMCTL.TreeCtrl.1" )
1473 ComCtlTreeViewObject( *this, 5 ).dump();
1474 else if ( maProgId
== "MSComctlLib.TreeCtrl.2" )
1475 ComCtlTreeViewObject( *this, 6 ).dump();
1476 else if ( maProgId
== "COMCTL.SBarCtrl.1" )
1477 ComCtlStatusBarObject( *this, 5 ).dump();
1478 else if ( maProgId
== "StdPic" )
1479 StdPicObject( *this ).dump();
1481 dumpRemainingStream();
1484 void FormControlStreamObject::constructFormCtrlStrmObj( const OUString
* pProgId
)
1486 mbReadGuid
= pProgId
== nullptr;
1488 maProgId
= *pProgId
;
1491 VbaFormClassInfoObject::VbaFormClassInfoObject( const InputObjectBase
& rParent
, VbaFormSharedData
& rFormData
) :
1492 mrFormData( rFormData
)
1494 AxPropertyObjectBase::construct( rParent
, "VBA-CLASSINFO-PROPERTIES" );
1497 void VbaFormClassInfoObject::implDumpShortProperties()
1499 mrFormData
.maClassInfoProgIds
.emplace_back( );
1500 dumpGuidProperty( &mrFormData
.maClassInfoProgIds
.back() );
1502 dumpUnknownProperty();
1504 dumpFlagsProperty( 0, "VBA-CLASSINFO-FLAGS" );
1505 dumpDecProperty
< sal_uInt32
>( 0 );
1506 dumpDecProperty
< sal_Int32
>( -1 );
1507 dumpDecProperty
< sal_uInt16
>( 0 );
1508 dumpDecProperty
< sal_uInt16
>( 0 );
1509 dumpDecProperty
< sal_uInt16
>( 0, "OLEPROP-TYPE" );
1510 dumpDecProperty
< sal_uInt16
>( 0 );
1511 dumpDecProperty
< sal_uInt16
>( 0 );
1512 dumpDecProperty
< sal_uInt16
>( 0, "OLEPROP-TYPE" );
1513 dumpDecProperty
< sal_Int32
>( -1 );
1514 dumpDecProperty
< sal_uInt16
>( 0 );
1519 const sal_uInt32 VBA_FORMSITE_OBJSTREAM
= 0x0010;
1521 const sal_uInt16 VBA_FORMSITE_CLASSTABLEINDEX
= 0x8000;
1522 const sal_uInt16 VBA_FORMSITE_CLASSTABLEMASK
= 0x7FFF;
1526 VbaFormSiteObject::VbaFormSiteObject( const InputObjectBase
& rParent
, VbaFormSharedData
& rFormData
) :
1527 mrFormData( rFormData
)
1529 AxPropertyObjectBase::construct( rParent
, "VBA-FORMSITE-PROPERTIES" );
1532 void VbaFormSiteObject::implDumpShortProperties()
1534 VbaFormSiteInfo aSiteInfo
;
1535 dumpStringProperty();
1536 dumpStringProperty();
1537 sal_Int32 nId
= dumpDecProperty
< sal_Int32
>( 0 );
1538 dumpDecProperty
< sal_Int32
>( 0 );
1539 sal_uInt32 nFlags
= dumpFlagsProperty( 0x00000033, "VBA-FORMSITE-FLAGS" );
1540 sal_uInt32 nLength
= dumpDecProperty
< sal_uInt32
>( 0 );
1541 dumpDecProperty
< sal_Int16
>( -1 );
1542 sal_uInt16 nClassId
= dumpHexProperty
< sal_uInt16
>( 0x7FFF, "VBA-FORMSITE-CLASSIDCACHE" );
1544 dumpDecProperty
< sal_uInt16
>( 0 );
1545 dumpUnknownProperty();
1546 dumpStringProperty();
1547 dumpStringProperty();
1548 dumpStringProperty();
1549 dumpStringProperty();
1551 sal_uInt16 nIndex
= nClassId
& VBA_FORMSITE_CLASSTABLEMASK
;
1552 if( getFlag( nClassId
, VBA_FORMSITE_CLASSTABLEINDEX
) )
1554 if( nIndex
< mrFormData
.maClassInfoProgIds
.size() )
1555 aSiteInfo
.maProgId
= mrFormData
.maClassInfoProgIds
[ nIndex
];
1559 if( cfg().hasName( "VBA-FORMSITE-CLASSNAMES", nIndex
) )
1560 aSiteInfo
.maProgId
= cfg().getName( "VBA-FORMSITE-CLASSNAMES", nIndex
);
1562 aSiteInfo
.mnId
= nId
;
1563 aSiteInfo
.mnLength
= nLength
;
1564 aSiteInfo
.mbInStream
= getFlag( nFlags
, VBA_FORMSITE_OBJSTREAM
);
1566 mrFormData
.maSiteInfos
.push_back( aSiteInfo
);
1569 VbaFormDesignExtObject::VbaFormDesignExtObject( const InputObjectBase
& rParent
)
1571 AxPropertyObjectBase::construct( rParent
, "VBA-FORMDESIGNEXT-PROPERTIES" );
1574 void VbaFormDesignExtObject::implDumpShortProperties()
1576 dumpFlagsProperty( 0x00015F55, "VBA-FORMDESIGNEXT-FLAGS" );
1579 dumpDecProperty
< sal_Int8
>( 0, "VBA-FORMDESIGNEXT-CLICKCTRLMODE" );
1580 dumpDecProperty
< sal_Int8
>( 0, "VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
1585 const sal_uInt32 AX_FORM_HASDESIGNEXTENDER
= 0x00004000;
1586 const sal_uInt32 AX_FORM_SKIPCLASSTABLE
= 0x00008000;
1588 const sal_uInt8 AX_FORM_SITECOUNTTYPE_COUNT
= 0x80;
1589 const sal_uInt8 AX_FORM_SITECOUNTTYPE_MASK
= 0x7F;
1593 VbaFStreamObject::VbaFStreamObject( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, VbaFormSharedData
& rFormData
) :
1594 mrFormData( rFormData
)
1596 AxPropertyObjectBase::construct( rParent
, rxStrm
, rSysFileName
, "VBA-FORM-PROPERTIES" );
1599 void VbaFStreamObject::implDumpShortProperties()
1601 dumpUnknownProperty();
1602 dumpColorProperty( 0x8000000F );
1603 dumpColorProperty( 0x80000012 );
1604 dumpDecProperty
< sal_uInt32
>( 0 );
1605 dumpUnknownProperty();
1606 dumpUnknownProperty();
1607 mnFlags
= dumpFlagsProperty( 0x00000004, "VBA-FORM-FLAGS" );
1608 dumpBorderStyleProperty
< sal_uInt8
>( 0 );
1609 dumpMousePtrProperty();
1610 dumpHexProperty
< sal_uInt8
>( 0x0C, "VBA-FORM-SCROLLBARS" );
1614 dumpDecProperty
< sal_uInt32
>( 0 );
1615 dumpUnknownProperty();
1616 dumpStreamProperty();
1617 dumpDecProperty
< sal_uInt8
>( 0, "VBA-FORM-CYCLE" );
1618 dumpSpecialEffectProperty
< sal_uInt8
>( 0 );
1619 dumpColorProperty( 0x80000012 );
1620 dumpStringProperty();
1621 dumpStreamProperty();
1622 dumpStreamProperty();
1623 dumpDecProperty
< sal_Int32
>( 100, "CONV-PERCENT" );
1624 dumpImageAlignProperty();
1626 dumpImageSizeModeProperty();
1627 dumpDecProperty
< sal_uInt32
>( 0 );
1628 dumpDecProperty
< sal_uInt32
>( 0 );
1631 void VbaFStreamObject::implDumpExtended()
1635 dumpDesignExtender();
1636 dumpRemainingStream();
1639 void VbaFStreamObject::dumpClassInfos()
1641 if( ensureValid() && !getFlag( mnFlags
, AX_FORM_SKIPCLASSTABLE
) )
1644 sal_uInt16 nCount
= dumpDec
< sal_uInt16
>( "class-info-count" );
1645 mxOut
->resetItemIndex();
1646 for( sal_uInt16 nIdx
= 0; ensureValid() && (nIdx
< nCount
); ++nIdx
)
1648 writeEmptyItem( "#class-info" );
1649 IndentGuard
aIndGuard( mxOut
);
1650 VbaFormClassInfoObject( *this, mrFormData
).dump();
1655 void VbaFStreamObject::dumpFormSites( sal_uInt32 nCount
)
1657 mxOut
->resetItemIndex();
1658 for( sal_uInt32 nIdx
= 0; ensureValid() && (nIdx
< nCount
); ++nIdx
)
1661 writeEmptyItem( "#form-site" );
1662 IndentGuard
aIndGuard( mxOut
);
1663 VbaFormSiteObject( *this, mrFormData
).dump();
1667 void VbaFStreamObject::dumpSiteData()
1669 if( !ensureValid() )
1674 sal_uInt32 nSiteCount
= dumpDec
< sal_uInt32
>( "site-count" );
1675 sal_uInt32 nSiteLength
= dumpDec
< sal_uInt32
>( "site-data-size" );
1676 sal_Int64 nEndPos
= mxStrm
->tell() + nSiteLength
;
1677 if( !ensureValid( nEndPos
<= mxStrm
->size() ) )
1680 mxOut
->resetItemIndex();
1681 sal_uInt32 nSiteIdx
= 0;
1682 while( ensureValid() && (nSiteIdx
< nSiteCount
) )
1685 writeEmptyItem( "#site-info" );
1686 IndentGuard
aIndGuard( mxOut
);
1687 dumpDec
< sal_uInt8
>( "depth" );
1688 sal_uInt8 nTypeCount
= dumpHex
< sal_uInt8
>( "type-count", "VBA-FORM-SITE-TYPECOUNT" );
1689 if( getFlag( nTypeCount
, AX_FORM_SITECOUNTTYPE_COUNT
) )
1691 dumpDec
< sal_uInt8
>( "repeated-type" );
1692 nSiteIdx
+= (nTypeCount
& AX_FORM_SITECOUNTTYPE_MASK
);
1699 alignInput
< sal_uInt32
>();
1700 dumpFormSites( nSiteCount
);
1701 dumpToPosition( nEndPos
);
1704 void VbaFStreamObject::dumpDesignExtender()
1706 if( ensureValid() && getFlag( mnFlags
, AX_FORM_HASDESIGNEXTENDER
) )
1709 writeEmptyItem( "design-extender" );
1710 IndentGuard
aIndGuard( mxOut
);
1711 VbaFormDesignExtObject( *this ).dump();
1715 VbaOStreamObject::VbaOStreamObject( const ObjectBase
& rParent
,
1716 const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, VbaFormSharedData
& rFormData
) :
1717 mrFormData( rFormData
)
1719 OleInputObjectBase::construct( rParent
, rxStrm
, rSysFileName
);
1722 void VbaOStreamObject::implDump()
1724 for (auto const& siteInfo
: mrFormData
.maSiteInfos
)
1726 if (mxStrm
->isEof())
1728 if( (siteInfo
.mbInStream
) && (siteInfo
.mnLength
> 0) )
1731 writeDecItem( "control-id", siteInfo
.mnId
);
1732 writeInfoItem( "prog-id", siteInfo
.maProgId
);
1733 IndentGuard
aIndGuard( mxOut
);
1734 BinaryInputStreamRef
xRelStrm( std::make_shared
<RelativeInputStream
>( *mxStrm
, siteInfo
.mnLength
) );
1735 FormControlStreamObject( *this, xRelStrm
, &siteInfo
.maProgId
).dump();
1738 dumpRemainingStream();
1741 VbaPageObject::VbaPageObject( const InputObjectBase
& rParent
)
1743 AxPropertyObjectBase::construct( rParent
, "VBA-PAGE-PROPERTIES" );
1746 void VbaPageObject::implDumpShortProperties()
1748 dumpUnknownProperty();
1749 dumpDecProperty
< sal_uInt32
>( 0, "VBA-PAGE-TRANSITIONEFFECT" );
1750 dumpDecProperty
< sal_uInt32
>( 0, "AX-CONV-MS" );
1753 VbaMultiPageObject::VbaMultiPageObject( const InputObjectBase
& rParent
)
1755 AxPropertyObjectBase::construct( rParent
, "VBA-MULTIPAGE-PROPERTIES" );
1758 void VbaMultiPageObject::implDumpShortProperties()
1760 dumpUnknownProperty();
1761 mnPageCount
= dumpDecProperty
< sal_Int32
>( 0 );
1762 dumpDecProperty
< sal_Int32
>( 0 );
1766 void VbaMultiPageObject::implDumpExtended()
1768 if( ensureValid() && (mnPageCount
> 0) )
1770 writeEmptyItem( "page-ids" );
1771 IndentGuard
aIndGuard( mxOut
);
1772 mxOut
->resetItemIndex();
1773 for( sal_Int32 nIdx
= 0; ensureValid() && (nIdx
< mnPageCount
); ++nIdx
)
1774 dumpDec
< sal_Int32
>( "#id" );
1778 VbaXStreamObject::VbaXStreamObject( const ObjectBase
& rParent
,
1779 const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, VbaFormSharedData
& rFormData
) :
1780 mrFormData( rFormData
)
1782 InputObjectBase::construct( rParent
, rxStrm
, rSysFileName
);
1785 void VbaXStreamObject::implDump()
1787 for( size_t nIdx
= 0, nCount
= mrFormData
.maSiteInfos
.size(); !mxStrm
->isEof() && (nIdx
< nCount
); ++nIdx
)
1790 writeEmptyItem( "page" );
1791 IndentGuard
aIndGuard( mxOut
);
1792 VbaPageObject( *this ).dump();
1794 if( !mxStrm
->isEof() )
1797 writeEmptyItem( "multi-page" );
1798 IndentGuard
aIndGuard( mxOut
);
1799 VbaMultiPageObject( *this ).dump();
1801 dumpRemainingStream();
1804 VbaContainerStorageObject::VbaContainerStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
) :
1805 OleStorageObject( rParent
, rxStrg
, rSysPath
)
1807 addPreferredStream( "f" );
1810 void VbaContainerStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
1812 if ( rStrmName
== "f" )
1813 VbaFStreamObject( *this, rxStrm
, rSysFileName
, maFormData
).dump();
1814 else if ( rStrmName
== "o" )
1815 VbaOStreamObject( *this, rxStrm
, rSysFileName
, maFormData
).dump();
1816 else if ( rStrmName
== "x" )
1817 VbaXStreamObject( *this, rxStrm
, rSysFileName
, maFormData
).dump();
1819 OleStorageObject::implDumpStream( rxStrm
, rStrgPath
, rStrmName
, rSysFileName
);
1822 void VbaContainerStorageObject::implDumpStorage( const StorageRef
& rxStrg
, const OUString
& rStrgPath
, const OUString
& rSysPath
)
1824 if( isFormStorage( rStrgPath
) )
1825 VbaContainerStorageObject( *this, rxStrg
, rSysPath
).dump();
1827 OleStorageObject( *this, rxStrg
, rSysPath
).dump();
1830 bool VbaContainerStorageObject::isFormStorage( std::u16string_view rStrgPath
) const
1832 if( (rStrgPath
.size() >= 3) && (rStrgPath
[ 0 ] == 'i') )
1834 std::u16string_view aId
= rStrgPath
.substr( 1 );
1835 if( (aId
.size() == 2) && (aId
[ 0 ] == '0') )
1836 aId
= aId
.substr( 1 );
1837 sal_Int32 nId
= o3tl::toInt32(aId
);
1838 if( (nId
> 0) && (std::u16string_view(OUString::number( nId
)) == aId
) )
1839 for (auto const& siteInfo
: maFormData
.maSiteInfos
)
1840 if( siteInfo
.mnId
== nId
)
1846 VbaSharedData::VbaSharedData() :
1847 meTextEnc( RTL_TEXTENCODING_MS_1252
)
1851 bool VbaSharedData::isModuleStream( const OUString
& rStrmName
) const
1853 return maStrmOffsets
.count( rStrmName
) > 0;
1856 sal_Int32
VbaSharedData::getStreamOffset( const OUString
& rStrmName
) const
1858 StreamOffsetMap::const_iterator aIt
= maStrmOffsets
.find( rStrmName
);
1859 return (aIt
== maStrmOffsets
.end()) ? 0 : aIt
->second
;
1862 VbaDirStreamObject::VbaDirStreamObject( const ObjectBase
& rParent
,
1863 const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
, VbaSharedData
& rVbaData
) :
1864 mrVbaData( rVbaData
)
1869 BinaryInputStreamRef
xVbaStrm( std::make_shared
<::oox::ole::VbaInputStream
>( *mxInStrm
) );
1870 SequenceRecordObjectBase::construct( rParent
, xVbaStrm
, rSysFileName
, "VBA-DIR-RECORD-NAMES", "VBA-DIR-SIMPLE-RECORDS" );
1874 bool VbaDirStreamObject::implIsValid() const
1876 return mxInStrm
&& SequenceRecordObjectBase::implIsValid();
1879 bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream
& rBaseStrm
, sal_Int64
& ornRecId
, sal_Int64
& ornRecSize
)
1881 ornRecId
= rBaseStrm
.readuInt16();
1882 ornRecSize
= rBaseStrm
.readInt32();
1884 // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
1888 return !rBaseStrm
.isEof();
1891 void VbaDirStreamObject::implDumpRecordBody()
1893 switch( getRecId() )
1896 mrVbaData
.meTextEnc
= rtl_getTextEncodingFromWindowsCodePage( dumpDec
< sal_uInt16
>( "codepage", "CODEPAGES" ) );
1899 dumpByteString( "name" );
1902 dumpByteString( "description" );
1905 dumpByteString( "helpfile-path" );
1908 dumpDec
< sal_uInt32
>( "major" );
1909 dumpDec
< sal_uInt16
>( "minor" );
1912 dumpByteString( "constants" );
1915 dumpByteStringWithLength( "lib-id" );
1919 dumpByteStringWithLength( "lib-id-absolute" );
1920 dumpByteStringWithLength( "lib-id-relative" );
1921 dumpDec
< sal_uInt32
>( "major" );
1922 dumpDec
< sal_uInt16
>( "minor" );
1925 dumpByteString( "name" );
1928 dumpByteString( "name" );
1929 maCurrStream
.clear();
1933 maCurrStream
= dumpByteString( "stream-name" );
1936 dumpByteString( "description" );
1939 if( !maCurrStream
.isEmpty() )
1940 mrVbaData
.maStrmOffsets
[ maCurrStream
] = mnCurrOffset
;
1941 maCurrStream
.clear();
1945 dumpByteStringWithLength( "lib-id-twiddled" );
1949 dumpByteStringWithLength( "lib-id-extended" );
1951 dumpGuid( "original-typelib" );
1952 dumpDec
< sal_uInt32
>( "cookie" );
1955 mnCurrOffset
= dumpHex
< sal_Int32
>( "stream-offset", "CONV-DEC" );
1958 dumpUniString( "stream-name" );
1961 dumpByteString( "lib-id-original" );
1964 dumpUniString( "constants" );
1967 dumpByteString( "helpfile-path" );
1970 dumpUniString( "name" );
1973 dumpUniString( "description" );
1976 dumpUniString( "name" );
1979 dumpUniString( "description" );
1984 OUString
VbaDirStreamObject::dumpByteString( const String
& rName
)
1986 return dumpCharArray( rName
, static_cast< sal_Int32
>( getRecSize() ), mrVbaData
.meTextEnc
);
1989 OUString
VbaDirStreamObject::dumpUniString( const String
& rName
)
1991 return dumpUnicodeArray( rName
, static_cast< sal_Int32
>( getRecSize() / 2 ) );
1994 OUString
VbaDirStreamObject::dumpByteStringWithLength( const String
& rName
)
1996 return dumpCharArray( rName
, mxStrm
->readInt32(), mrVbaData
.meTextEnc
);
1999 VbaModuleStreamObject::VbaModuleStreamObject(
2000 const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
,
2001 const OUString
& rSysFileName
, VbaSharedData
& rVbaData
, sal_Int32 nStrmOffset
) :
2002 mrVbaData( rVbaData
),
2003 mnStrmOffset( nStrmOffset
)
2005 InputObjectBase::construct( rParent
, rxStrm
, rSysFileName
);
2008 void VbaModuleStreamObject::implDump()
2010 dumpBinary( "perf-cache", mnStrmOffset
);
2012 writeEmptyItem( "source-code" );
2013 IndentGuard
aIndGuard( mxOut
);
2014 BinaryInputStreamRef
xVbaStrm( std::make_shared
<::oox::ole::VbaInputStream
>( *mxStrm
) );
2015 TextLineStreamObject( *this, xVbaStrm
, mrVbaData
.meTextEnc
).dump();
2018 VbaStorageObject::VbaStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
, VbaSharedData
& rVbaData
) :
2019 OleStorageObject( rParent
, rxStrg
, rSysPath
),
2020 mrVbaData( rVbaData
)
2022 addPreferredStream( "dir" );
2025 void VbaStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
2027 if( rStrgPath
.isEmpty() && rStrmName
== "dir" )
2028 VbaDirStreamObject( *this, rxStrm
, rSysFileName
, mrVbaData
).dump();
2029 else if( mrVbaData
.isModuleStream( rStrmName
) )
2030 VbaModuleStreamObject( *this, rxStrm
, rSysFileName
, mrVbaData
, mrVbaData
.getStreamOffset( rStrmName
) ).dump();
2032 OleStorageObject::implDumpStream( rxStrm
, rStrgPath
, rStrmName
, rSysFileName
);
2035 VbaFormStorageObject::VbaFormStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
, VbaSharedData
& rVbaData
) :
2036 VbaContainerStorageObject( rParent
, rxStrg
, rSysPath
),
2037 mrVbaData( rVbaData
)
2041 void VbaFormStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
2043 if ( rStrmName
== "\003VBFrame" )
2044 TextLineStreamObject( *this, rxStrm
, mrVbaData
.meTextEnc
, rSysFileName
).dump();
2046 VbaContainerStorageObject::implDumpStream( rxStrm
, rStrgPath
, rStrmName
, rSysFileName
);
2049 VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
) :
2050 OleStorageObject( rParent
, rxStrg
, rSysPath
)
2052 addPreferredStorage( "VBA" );
2055 void VbaProjectStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
2057 if( rStrgPath
.isEmpty() && rStrmName
== "PROJECT" )
2058 TextLineStreamObject( *this, rxStrm
, maVbaData
.meTextEnc
, rSysFileName
).dump();
2060 OleStorageObject::implDumpStream( rxStrm
, rStrgPath
, rStrmName
, rSysFileName
);
2063 void VbaProjectStorageObject::implDumpStorage( const StorageRef
& rxStrg
, const OUString
& rStrgPath
, const OUString
& rSysPath
)
2065 if ( rStrgPath
== "VBA" )
2066 VbaStorageObject( *this, rxStrg
, rSysPath
, maVbaData
).dump();
2068 VbaFormStorageObject( *this, rxStrg
, rSysPath
, maVbaData
).dump();
2071 ActiveXStorageObject::ActiveXStorageObject( const ObjectBase
& rParent
, const StorageRef
& rxStrg
, const OUString
& rSysPath
) :
2072 VbaContainerStorageObject( rParent
, rxStrg
, rSysPath
)
2076 void ActiveXStorageObject::implDumpBaseStream( const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
)
2078 FormControlStreamObject( *this, rxStrm
, rSysFileName
).dump();
2085 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */