1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 #ifndef OOX_DUMP_OLEDUMPER_HXX
25 #define OOX_DUMP_OLEDUMPER_HXX
26
27 #include "oox/helper/storagebase.hxx"
28 #include "oox/dump/dumperbase.hxx"
29
30 #if OOX_INCLUDE_DUMPER
31
32 namespace com { namespace sun { namespace star {
33 namespace io { class XInputStream; }
34 } } }
35
36 namespace oox {
37 namespace dump {
38
39 // ============================================================================
40 // ============================================================================
41
42 class OleInputObjectBase : public InputObjectBase
43 {
44 protected:
OleInputObjectBase()45 inline explicit OleInputObjectBase() {}
46
47 ::rtl::OUString dumpAnsiString32( const String& rName );
48 ::rtl::OUString dumpUniString32( const String& rName );
49
50 sal_Int32 dumpStdClipboardFormat( const String& rName = EMPTY_STRING );
51 ::rtl::OUString dumpAnsiString32OrStdClip( const String& rName );
52 ::rtl::OUString dumpUniString32OrStdClip( const String& rName );
53
54 void writeOleColorItem( const String& rName, sal_uInt32 nColor );
55 sal_uInt32 dumpOleColor( const String& rName );
56 };
57
58 // ============================================================================
59 // ============================================================================
60
61 class StdFontObject : public OleInputObjectBase
62 {
63 public:
64 explicit StdFontObject( const InputObjectBase& rParent );
65
66 protected:
67 virtual void implDump();
68 };
69
70 // ============================================================================
71
72 class StdPicObject : public OleInputObjectBase
73 {
74 public:
75 explicit StdPicObject( const InputObjectBase& rParent );
76
77 protected:
78 virtual void implDump();
79 };
80
81 // ============================================================================
82
83 class StdHlinkObject : public OleInputObjectBase
84 {
85 public:
86 explicit StdHlinkObject( const InputObjectBase& rParent );
87
88 protected:
89 virtual void implDump();
90
91 private:
92 ::rtl::OUString dumpHyperlinkString( const String& rName, bool bUnicode );
93
94 bool dumpGuidAndMoniker();
95 void dumpUrlMoniker();
96 void dumpFileMoniker();
97 void dumpItemMoniker();
98 void dumpAntiMoniker();
99 void dumpCompositeMoniker();
100 };
101
102 // ============================================================================
103 // ============================================================================
104
105 class OleStreamObject : public OleInputObjectBase
106 {
107 public:
108 explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
109 };
110
111 // ============================================================================
112
113 class OleCompObjObject : public OleStreamObject
114 {
115 public:
116 explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
117
118 protected:
119 virtual void implDump();
120 };
121
122 // ============================================================================
123 // ============================================================================
124
125 class OlePropertyStreamObject : public InputObjectBase
126 {
127 public:
128 explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
129
130 protected:
131 virtual void implDump();
132
133 private:
134 void dumpSection( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
135
136 void dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
137 void dumpCodePageProperty( sal_uInt32 nStartPos );
138 void dumpDictionaryProperty( sal_uInt32 nStartPos );
139
140 sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
141 void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
142 void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
143 void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType );
144
145 sal_uInt16 dumpPropertyType();
146 void dumpBlob( sal_Int32 nPropId, const String& rName );
147 ::rtl::OUString dumpString8( const String& rName );
148 ::rtl::OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
149 ::rtl::OUString dumpString16( const String& rName );
150 ::rtl::OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
151 bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
152 void dumpHlinks( sal_Int32 nSize );
153
154 bool startElement( sal_uInt32 nStartPos );
155 void writeSectionHeader( const ::rtl::OUString& rGuid, sal_uInt32 nStartPos );
156 void writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
157
158 private:
159 NameListRef mxPropIds;
160 rtl_TextEncoding meTextEnc;
161 bool mbIsUnicode;
162 };
163
164 // ============================================================================
165
166 class OleStorageObject : public StorageObjectBase
167 {
168 public:
169 explicit OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
170
171 protected:
OleStorageObject()172 inline explicit OleStorageObject() {}
173
174 using StorageObjectBase::construct;
175 void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
176 void construct( const ObjectBase& rParent );
177
178 virtual void implDumpStream(
179 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
180 const ::rtl::OUString& rStrgPath,
181 const ::rtl::OUString& rStrmName,
182 const ::rtl::OUString& rSysFileName );
183 };
184
185 // ============================================================================
186 // ============================================================================
187
188 class ComCtlObjectBase : public OleInputObjectBase
189 {
190 protected:
191 explicit ComCtlObjectBase(
192 const InputObjectBase& rParent,
193 sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
194 bool bCommonPart, bool bComplexPart );
195
196 virtual void implDump();
197 virtual void implDumpProperties() = 0;
198 virtual void implDumpCommonExtra( sal_Int64 nEndPos );
199 virtual void implDumpCommonTrailing();
200
201 private:
202 bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
203 bool dumpComCtlSize();
204 bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
205 bool dumpComCtlCommon( sal_uInt32 nPartSize );
206 bool dumpComCtlComplex();
207
208 protected:
209 sal_uInt32 mnDataId5;
210 sal_uInt32 mnDataId6;
211 sal_uInt16 mnVersion;
212 bool mbCommonPart;
213 bool mbComplexPart;
214 };
215
216 // ============================================================================
217
218 class ComCtlScrollBarObject : public ComCtlObjectBase
219 {
220 public:
221 explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
222
223 protected:
224 virtual void implDumpProperties();
225 };
226
227 // ============================================================================
228
229 class ComCtlProgressBarObject : public ComCtlObjectBase
230 {
231 public:
232 explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
233
234 protected:
235 virtual void implDumpProperties();
236 };
237
238 // ============================================================================
239
240 class ComCtlSliderObject : public ComCtlObjectBase
241 {
242 public:
243 explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
244
245 protected:
246 virtual void implDumpProperties();
247 };
248
249 // ============================================================================
250
251 class ComCtlUpDownObject : public ComCtlObjectBase
252 {
253 public:
254 explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
255
256 protected:
257 virtual void implDumpProperties();
258 };
259
260 // ============================================================================
261
262 class ComCtlImageListObject : public ComCtlObjectBase
263 {
264 public:
265 explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
266
267 protected:
268 virtual void implDumpProperties();
269 virtual void implDumpCommonExtra( sal_Int64 nEndPos );
270 virtual void implDumpCommonTrailing();
271 };
272
273 // ============================================================================
274
275 class ComCtlTabStripObject : public ComCtlObjectBase
276 {
277 public:
278 explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
279
280 protected:
281 virtual void implDumpProperties();
282 virtual void implDumpCommonExtra( sal_Int64 nEndPos );
283 };
284
285 // ============================================================================
286
287 class ComCtlTreeViewObject : public ComCtlObjectBase
288 {
289 public:
290 explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
291
292 protected:
293 virtual void implDumpProperties();
294 virtual void implDumpCommonExtra( sal_Int64 nEndPos );
295
296 private:
297 sal_uInt32 mnStringFlags;
298 };
299
300 // ============================================================================
301
302 class ComCtlStatusBarObject : public ComCtlObjectBase
303 {
304 public:
305 explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
306
307 protected:
308 virtual void implDumpProperties();
309 virtual void implDumpCommonExtra( sal_Int64 nEndPos );
310 virtual void implDumpCommonTrailing();
311 };
312
313 // ============================================================================
314 // ============================================================================
315
316 class AxPropertyObjectBase : public OleInputObjectBase
317 {
318 protected:
AxPropertyObjectBase()319 inline explicit AxPropertyObjectBase() {}
320
321 using OleInputObjectBase::construct;
322 void construct(
323 const ObjectBase& rParent,
324 const BinaryInputStreamRef& rxStrm,
325 const ::rtl::OUString& rSysFileName,
326 const String& rPropNameList,
327 bool b64BitPropFlags = false );
328 void construct(
329 const OutputObjectBase& rParent,
330 const BinaryInputStreamRef& rxStrm,
331 const String& rPropNameList,
332 bool b64BitPropFlags = false );
333 void construct(
334 const InputObjectBase& rParent,
335 const String& rPropNameList,
336 bool b64BitPropFlags = false );
337
338 virtual bool implIsValid() const;
339 virtual void implDump();
340
341 virtual void implDumpShortProperties();
342 virtual void implDumpExtended();
343
344 bool ensureValid( bool bCondition = true );
345
346 template< typename Type >
347 void alignInput();
348
349 void setAlignAnchor();
350 bool startNextProperty();
351 ::rtl::OUString getPropertyName() const;
352
353 template< typename Type >
354 Type dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
355 template< typename Type >
356 Type dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
357
dumpBoolProperty()358 inline bool dumpBoolProperty() { return startNextProperty(); }
dumpHmmProperty()359 inline sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
dumpMousePtrProperty()360 inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
361 template< typename Type >
dumpBorderStyleProperty(Type nDefault)362 inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
363 template< typename Type >
dumpSpecialEffectProperty(Type nDefault)364 inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
dumpEnabledProperty()365 inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
dumpOrientationProperty()366 inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
dumpDelayProperty()367 inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
dumpImagePosProperty()368 inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
dumpImageSizeModeProperty()369 inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
dumpImageAlignProperty()370 inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
371
372 sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "AX-FLAGS" );
373 sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
374 sal_Unicode dumpUnicodeProperty();
375 void dumpUnknownProperty();
376
377 void dumpPosProperty();
378 void dumpSizeProperty();
379 void dumpGuidProperty( ::rtl::OUString* pValue = 0 );
380 void dumpStringProperty( ::rtl::OUString* pValue = 0 );
381 void dumpStringArrayProperty();
382 void dumpStreamProperty();
383
384 void dumpEmbeddedFont();
385 void dumpToPosition( sal_Int64 nPos );
386
387 private:
388 void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
389
390 void dumpVersion();
391 ::rtl::OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
392 void dumpShortProperties();
393 void dumpLargeProperties();
394
395 private:
396 struct LargeProperty
397 {
398 enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
399
400 LargePropertyType mePropType;
401 ::rtl::OUString maItemName;
402 sal_uInt32 mnDataSize;
403 ::rtl::OUString* mpItemValue;
LargePropertyoox::dump::AxPropertyObjectBase::LargeProperty404 inline explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, ::rtl::OUString* pItemValue = 0 ) :
405 mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
406 };
407 typedef ::std::vector< LargeProperty > LargePropertyVector;
408
409 struct StreamProperty
410 {
411 ::rtl::OUString maItemName;
412 sal_uInt16 mnData;
StreamPropertyoox::dump::AxPropertyObjectBase::StreamProperty413 inline explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
414 maItemName( rItemName ), mnData( nData ) {}
415 };
416 typedef ::std::vector< StreamProperty > StreamPropertyVector;
417
418 LargePropertyVector maLargeProps;
419 StreamPropertyVector maStreamProps;
420 NameListRef mxPropNames;
421 sal_Int64 mnPropertiesStart;
422 sal_Int64 mnPropertiesEnd;
423 sal_Int64 mnPropFlags;
424 sal_Int64 mnCurrProp;
425 bool mb64BitPropFlags;
426 bool mbValid;
427 };
428
429 // ----------------------------------------------------------------------------
430
431 template< typename Type >
alignInput()432 void AxPropertyObjectBase::alignInput()
433 {
434 mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
435 }
436
437 template< typename Type >
dumpDecProperty(Type nDefault,const NameListWrapper & rListWrp)438 Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
439 {
440 if( startNextProperty() )
441 {
442 alignInput< Type >();
443 return dumpDec< Type >( getPropertyName(), rListWrp );
444 }
445 return nDefault;
446 }
447
448 template< typename Type >
dumpHexProperty(Type nDefault,const NameListWrapper & rListWrp)449 Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
450 {
451 if( startNextProperty() )
452 {
453 alignInput< Type >();
454 return dumpHex< Type >( getPropertyName(), rListWrp );
455 }
456 return nDefault;
457 }
458
459 // ============================================================================
460
461 class AxCFontNewObject : public AxPropertyObjectBase
462 {
463 public:
464 explicit AxCFontNewObject( const InputObjectBase& rParent );
465
466 protected:
467 virtual void implDumpShortProperties();
468 };
469
470 // ============================================================================
471
472 class AxColumnInfoObject : public AxPropertyObjectBase
473 {
474 public:
475 explicit AxColumnInfoObject( const InputObjectBase& rParent );
476
477 protected:
478 virtual void implDumpShortProperties();
479 };
480
481 // ============================================================================
482
483 class AxCommandButtonObject : public AxPropertyObjectBase
484 {
485 public:
486 explicit AxCommandButtonObject( const InputObjectBase& rParent );
487
488 protected:
489 virtual void implDumpShortProperties();
490 virtual void implDumpExtended();
491 };
492
493 // ============================================================================
494
495 class AxMorphControlObject : public AxPropertyObjectBase
496 {
497 public:
498 explicit AxMorphControlObject( const InputObjectBase& rParent );
499
500 protected:
501 virtual void implDumpShortProperties();
502 virtual void implDumpExtended();
503
504 private:
505 void dumpColumnInfos();
506
507 private:
508 sal_uInt16 mnColInfoCount;
509 sal_uInt8 mnCtrlType;
510 };
511
512 // ============================================================================
513
514 class AxLabelObject : public AxPropertyObjectBase
515 {
516 public:
517 explicit AxLabelObject( const InputObjectBase& rParent );
518
519 protected:
520 virtual void implDumpShortProperties();
521 virtual void implDumpExtended();
522 };
523
524 // ============================================================================
525
526 class AxImageObject : public AxPropertyObjectBase
527 {
528 public:
529 explicit AxImageObject( const InputObjectBase& rParent );
530
531 protected:
532 virtual void implDumpShortProperties();
533 };
534
535 // ============================================================================
536
537 class AxScrollBarObject : public AxPropertyObjectBase
538 {
539 public:
540 explicit AxScrollBarObject( const InputObjectBase& rParent );
541
542 protected:
543 virtual void implDumpShortProperties();
544 };
545
546 // ============================================================================
547
548 class AxSpinButtonObject : public AxPropertyObjectBase
549 {
550 public:
551 explicit AxSpinButtonObject( const InputObjectBase& rParent );
552
553 protected:
554 virtual void implDumpShortProperties();
555 };
556
557 // ============================================================================
558
559 class AxTabStripObject : public AxPropertyObjectBase
560 {
561 public:
562 explicit AxTabStripObject( const InputObjectBase& rParent );
563
564 protected:
565 virtual void implDumpShortProperties();
566 virtual void implDumpExtended();
567
568 private:
569 sal_Int32 mnTabFlagCount;
570 };
571
572 // ============================================================================
573 // ============================================================================
574
575 class FormControlStreamObject : public OleInputObjectBase
576 {
577 public:
578 explicit FormControlStreamObject(
579 const ObjectBase& rParent,
580 const BinaryInputStreamRef& rxStrm,
581 const ::rtl::OUString& rSysFileName,
582 const ::rtl::OUString* pProgId = 0 );
583 explicit FormControlStreamObject(
584 const OutputObjectBase& rParent,
585 const BinaryInputStreamRef& rxStrm,
586 const ::rtl::OUString* pProgId = 0 );
587
588 protected:
589 virtual void implDump();
590
591 private:
592 void constructFormCtrlStrmObj( const ::rtl::OUString* pProgId );
593
594 private:
595 ::rtl::OUString maProgId;
596 bool mbReadGuid;
597 };
598
599 // ============================================================================
600 // ============================================================================
601
602 struct VbaFormSiteInfo
603 {
604 ::rtl::OUString maProgId;
605 sal_Int32 mnId;
606 sal_uInt32 mnLength;
607 bool mbInStream;
608
VbaFormSiteInfooox::dump::VbaFormSiteInfo609 inline explicit VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
610 };
611
612 typedef ::std::vector< VbaFormSiteInfo > VbaFormSiteInfoVector;
613
614 // ============================================================================
615
616 struct VbaFormSharedData
617 {
618 OUStringVector maClassInfoProgIds;
619 VbaFormSiteInfoVector maSiteInfos;
620 };
621
622 // ============================================================================
623
624 class VbaFormClassInfoObject : public AxPropertyObjectBase
625 {
626 public:
627 explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
628
629 protected:
630 virtual void implDumpShortProperties();
631
632 private:
633 VbaFormSharedData& mrFormData;
634 };
635
636 // ============================================================================
637
638 class VbaFormSiteObject : public AxPropertyObjectBase
639 {
640 public:
641 explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
642
643 protected:
644 virtual void implDumpShortProperties();
645
646 private:
647 VbaFormSharedData& mrFormData;
648 };
649
650 // ============================================================================
651
652 class VbaFormDesignExtObject : public AxPropertyObjectBase
653 {
654 public:
655 explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
656
657 protected:
658 virtual void implDumpShortProperties();
659 };
660
661 // ============================================================================
662
663 class VbaFStreamObject : public AxPropertyObjectBase
664 {
665 public:
666 explicit VbaFStreamObject(
667 const ObjectBase& rParent,
668 const BinaryInputStreamRef& rxStrm,
669 const ::rtl::OUString& rSysFileName,
670 VbaFormSharedData& rFormData );
671
672 protected:
673 virtual void implDumpShortProperties();
674 virtual void implDumpExtended();
675
676 private:
677 void dumpClassInfos();
678 void dumpFormSites( sal_uInt32 nCount );
679 void dumpSiteData();
680 void dumpDesignExtender();
681
682 private:
683 VbaFormSharedData& mrFormData;
684 sal_uInt32 mnFlags;
685 };
686
687 // ============================================================================
688
689 class VbaOStreamObject : public OleInputObjectBase
690 {
691 public:
692 explicit VbaOStreamObject(
693 const ObjectBase& rParent,
694 const BinaryInputStreamRef& rxStrm,
695 const ::rtl::OUString& rSysFileName,
696 VbaFormSharedData& rFormData );
697
698 protected:
699 virtual void implDump();
700
701 private:
702 VbaFormSharedData& mrFormData;
703 };
704
705 // ============================================================================
706
707 class VbaPageObject : public AxPropertyObjectBase
708 {
709 public:
710 explicit VbaPageObject( const InputObjectBase& rParent );
711
712 protected:
713 virtual void implDumpShortProperties();
714 };
715
716 // ============================================================================
717
718 class VbaMultiPageObject : public AxPropertyObjectBase
719 {
720 public:
721 explicit VbaMultiPageObject( const InputObjectBase& rParent );
722
723 protected:
724 virtual void implDumpShortProperties();
725 virtual void implDumpExtended();
726
727 private:
728 sal_Int32 mnPageCount;
729 };
730
731 // ============================================================================
732
733 class VbaXStreamObject : public InputObjectBase
734 {
735 public:
736 explicit VbaXStreamObject(
737 const ObjectBase& rParent,
738 const BinaryInputStreamRef& rxStrm,
739 const ::rtl::OUString& rSysFileName,
740 VbaFormSharedData& rFormData );
741
742 protected:
743 virtual void implDump();
744
745 private:
746 VbaFormSharedData& mrFormData;
747 };
748
749 // ============================================================================
750
751 class VbaContainerStorageObject : public OleStorageObject
752 {
753 public:
754 explicit VbaContainerStorageObject(
755 const ObjectBase& rParent,
756 const StorageRef& rxStrg,
757 const ::rtl::OUString& rSysPath );
758
759 protected:
760 virtual void implDumpStream(
761 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
762 const ::rtl::OUString& rStrgPath,
763 const ::rtl::OUString& rStrmName,
764 const ::rtl::OUString& rSysFileName );
765
766 virtual void implDumpStorage(
767 const StorageRef& rxStrg,
768 const ::rtl::OUString& rStrgPath,
769 const ::rtl::OUString& rSysPath );
770
771 private:
772 bool isFormStorage( const ::rtl::OUString& rStrgPath ) const;
773
774 private:
775 VbaFormSharedData maFormData;
776 };
777
778 // ============================================================================
779 // ============================================================================
780
781 struct VbaSharedData
782 {
783 typedef ::std::map< ::rtl::OUString, sal_Int32 > StreamOffsetMap;
784
785 StreamOffsetMap maStrmOffsets;
786 rtl_TextEncoding meTextEnc;
787
788 explicit VbaSharedData();
789
790 bool isModuleStream( const ::rtl::OUString& rStrmName ) const;
791 sal_Int32 getStreamOffset( const ::rtl::OUString& rStrmName ) const;
792 };
793
794 // ============================================================================
795
796 class VbaDirStreamObject : public SequenceRecordObjectBase
797 {
798 public:
799 explicit VbaDirStreamObject(
800 const ObjectBase& rParent,
801 const BinaryInputStreamRef& rxStrm,
802 const ::rtl::OUString& rSysFileName,
803 VbaSharedData& rVbaData );
804
805 protected:
806 virtual bool implIsValid() const;
807 virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
808 virtual void implDumpRecordBody();
809
810 private:
811 ::rtl::OUString dumpByteString( const String& rName = EMPTY_STRING );
812 ::rtl::OUString dumpUniString( const String& rName = EMPTY_STRING );
813
814 ::rtl::OUString dumpByteStringWithLength( const String& rName = EMPTY_STRING );
815
816 private:
817 VbaSharedData& mrVbaData;
818 BinaryInputStreamRef mxInStrm;
819 ::rtl::OUString maCurrStream;
820 sal_Int32 mnCurrOffset;
821 };
822
823 // ============================================================================
824
825 class VbaModuleStreamObject : public InputObjectBase
826 {
827 public:
828 explicit VbaModuleStreamObject(
829 const ObjectBase& rParent,
830 const BinaryInputStreamRef& rxStrm,
831 const ::rtl::OUString& rSysFileName,
832 VbaSharedData& rVbaData,
833 sal_Int32 nStrmOffset );
834
835 protected:
836 virtual void implDump();
837
838 private:
839 VbaSharedData& mrVbaData;
840 sal_Int32 mnStrmOffset;
841 };
842
843 // ============================================================================
844
845 class VbaStorageObject : public OleStorageObject
846 {
847 public:
848 explicit VbaStorageObject(
849 const ObjectBase& rParent,
850 const StorageRef& rxStrg,
851 const ::rtl::OUString& rSysPath,
852 VbaSharedData& rVbaData );
853
854 protected:
855 virtual void implDumpStream(
856 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
857 const ::rtl::OUString& rStrgPath,
858 const ::rtl::OUString& rStrmName,
859 const ::rtl::OUString& rSysFileName );
860
861 private:
862 VbaSharedData& mrVbaData;
863 };
864
865 // ============================================================================
866
867 class VbaFormStorageObject : public VbaContainerStorageObject
868 {
869 public:
870 explicit VbaFormStorageObject(
871 const ObjectBase& rParent,
872 const StorageRef& rxStrg,
873 const ::rtl::OUString& rSysPath,
874 VbaSharedData& rVbaData );
875
876 protected:
877 virtual void implDumpStream(
878 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
879 const ::rtl::OUString& rStrgPath,
880 const ::rtl::OUString& rStrmName,
881 const ::rtl::OUString& rSysFileName );
882
883 private:
884 VbaSharedData& mrVbaData;
885 };
886
887 // ============================================================================
888
889 class VbaProjectStorageObject : public OleStorageObject
890 {
891 public:
892 explicit VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const ::rtl::OUString& rSysPath );
893
894 protected:
895 virtual void implDumpStream(
896 const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
897 const ::rtl::OUString& rStrgPath,
898 const ::rtl::OUString& rStrmName,
899 const ::rtl::OUString& rSysFileName );
900
901 virtual void implDumpStorage(
902 const StorageRef& rxStrg,
903 const ::rtl::OUString& rStrgPath,
904 const ::rtl::OUString& rSysPath );
905
906 private:
907 VbaSharedData maVbaData;
908 };
909
910 // ============================================================================
911 // ============================================================================
912
913 class ActiveXStorageObject : public VbaContainerStorageObject
914 {
915 public:
916 explicit ActiveXStorageObject(
917 const ObjectBase& rParent,
918 const StorageRef& rxStrg,
919 const ::rtl::OUString& rSysPath );
920
921 protected:
922 virtual void implDumpBaseStream(
923 const BinaryInputStreamRef& rxStrm,
924 const ::rtl::OUString& rSysFileName );
925 };
926
927 // ============================================================================
928 // ============================================================================
929
930 } // namespace dump
931 } // namespace oox
932
933 #endif
934 #endif
935