xref: /aoo42x/main/oox/source/dump/oledumper.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/dump/oledumper.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp>
31*cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp>
32*cdf0e10cSrcweir #include <osl/file.hxx>
33*cdf0e10cSrcweir #include <osl/thread.h>
34*cdf0e10cSrcweir #include <rtl/tencinfo.h>
35*cdf0e10cSrcweir #include "oox/core/filterbase.hxx"
36*cdf0e10cSrcweir #include "oox/helper/binaryoutputstream.hxx"
37*cdf0e10cSrcweir #include "oox/ole/olestorage.hxx"
38*cdf0e10cSrcweir #include "oox/ole/vbainputstream.hxx"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #if OOX_INCLUDE_DUMPER
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir namespace oox {
43*cdf0e10cSrcweir namespace dump {
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // ============================================================================
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir using namespace ::com::sun::star::io;
48*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir using ::rtl::OString;
51*cdf0e10cSrcweir using ::rtl::OStringToOUString;
52*cdf0e10cSrcweir using ::rtl::OUString;
53*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // ============================================================================
56*cdf0e10cSrcweir // ============================================================================
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir OUString OleInputObjectBase::dumpAnsiString32( const String& rName )
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir     return dumpCharArray( rName, mxStrm->readInt32(), RTL_TEXTENCODING_MS_1252 );
61*cdf0e10cSrcweir }
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir OUString OleInputObjectBase::dumpUniString32( const String& rName )
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir     return dumpUnicodeArray( rName, mxStrm->readInt32() );
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir sal_Int32 OleInputObjectBase::dumpStdClipboardFormat( const String& rName )
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir     return dumpDec< sal_Int32 >( rName( "clipboard-format" ), "OLE-STD-CLIPBOARD-FORMAT" );
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir OUString OleInputObjectBase::dumpAnsiString32OrStdClip( const String& rName )
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir     sal_Int32 nLen = mxStrm->readInt32();
76*cdf0e10cSrcweir     return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpCharArray( rName, nLen, RTL_TEXTENCODING_MS_1252 );
77*cdf0e10cSrcweir }
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir OUString OleInputObjectBase::dumpUniString32OrStdClip( const String& rName )
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir     sal_Int32 nLen = mxStrm->readInt32();
82*cdf0e10cSrcweir     return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpUnicodeArray( rName, nLen );
83*cdf0e10cSrcweir }
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir void OleInputObjectBase::writeOleColorItem( const String& rName, sal_uInt32 nColor )
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
88*cdf0e10cSrcweir     writeHexItem( rName, nColor, "OLE-COLOR" );
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir sal_uInt32 OleInputObjectBase::dumpOleColor( const String& rName )
92*cdf0e10cSrcweir {
93*cdf0e10cSrcweir     sal_uInt32 nOleColor = mxStrm->readuInt32();
94*cdf0e10cSrcweir     writeOleColorItem( rName, nOleColor );
95*cdf0e10cSrcweir     return nOleColor;
96*cdf0e10cSrcweir }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir // ============================================================================
99*cdf0e10cSrcweir // ============================================================================
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir StdFontObject::StdFontObject( const InputObjectBase& rParent )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     construct( rParent );
104*cdf0e10cSrcweir }
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir void StdFontObject::implDump()
107*cdf0e10cSrcweir {
108*cdf0e10cSrcweir     dumpDec< sal_uInt8 >( "version" );
109*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "charset", "CHARSET" );
110*cdf0e10cSrcweir     dumpHex< sal_uInt8 >( "flags", "STDFONT-FLAGS" );
111*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
112*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "height", "STDFONT-HEIGHT" );
113*cdf0e10cSrcweir     dumpCharArray( "name", mxStrm->readuInt8(), RTL_TEXTENCODING_ASCII_US );
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir // ============================================================================
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir StdPicObject::StdPicObject( const InputObjectBase& rParent )
119*cdf0e10cSrcweir {
120*cdf0e10cSrcweir     construct( rParent );
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir void StdPicObject::implDump()
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "identifier", "STDPIC-ID" );
126*cdf0e10cSrcweir     sal_uInt32 nSize = dumpHex< sal_uInt32 >( "image-size", "CONV-DEC" );
127*cdf0e10cSrcweir     dumpBinary( "image-data", nSize );
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir // ============================================================================
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir namespace {
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASTARGET         = 0x00000001;   /// Has hyperlink moniker.
135*cdf0e10cSrcweir const sal_uInt32 STDHLINK_ABSOLUTE          = 0x00000002;   /// Absolute path.
136*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASLOCATION       = 0x00000008;   /// Has target location.
137*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASDISPLAY        = 0x00000010;   /// Has display string.
138*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASGUID           = 0x00000020;   /// Has identification GUID.
139*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASTIME           = 0x00000040;   /// Has creation time.
140*cdf0e10cSrcweir const sal_uInt32 STDHLINK_HASFRAME          = 0x00000080;   /// Has frame.
141*cdf0e10cSrcweir const sal_uInt32 STDHLINK_ASSTRING          = 0x00000100;   /// Hyperlink as simple string.
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir } // namespace
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent )
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir     construct( rParent );
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir void StdHlinkObject::implDump()
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "stream-version" );
153*cdf0e10cSrcweir     sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "STDHLINK-FLAGS" );
154*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASDISPLAY ) )
155*cdf0e10cSrcweir         dumpHyperlinkString( "display", true );
156*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASFRAME ) )
157*cdf0e10cSrcweir         dumpHyperlinkString( "frame", true );
158*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASTARGET ) )
159*cdf0e10cSrcweir     {
160*cdf0e10cSrcweir         if( getFlag( nFlags, STDHLINK_ASSTRING ) )
161*cdf0e10cSrcweir             dumpHyperlinkString( "filename", true );
162*cdf0e10cSrcweir         else if( !dumpGuidAndMoniker() )
163*cdf0e10cSrcweir             return;
164*cdf0e10cSrcweir     }
165*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASLOCATION ) )
166*cdf0e10cSrcweir         dumpHyperlinkString( "location", true );
167*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASGUID ) )
168*cdf0e10cSrcweir         dumpGuid( "id-guid" );
169*cdf0e10cSrcweir     if( getFlag( nFlags, STDHLINK_HASTIME ) )
170*cdf0e10cSrcweir         dumpFileTime( "creation-time" );
171*cdf0e10cSrcweir }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir OUString StdHlinkObject::dumpHyperlinkString( const String& rName, bool bUnicode )
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir     return bUnicode ? dumpUniString32( rName ) : dumpAnsiString32( rName );
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir bool StdHlinkObject::dumpGuidAndMoniker()
179*cdf0e10cSrcweir {
180*cdf0e10cSrcweir     bool bValidMoniker = true;
181*cdf0e10cSrcweir     OUString aGuid = cfg().getStringOption( dumpGuid( "moniker" ), OUString() );
182*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
183*cdf0e10cSrcweir     if( aGuid.equalsAscii( "URLMoniker" ) )
184*cdf0e10cSrcweir         dumpUrlMoniker();
185*cdf0e10cSrcweir     else if( aGuid.equalsAscii( "FileMoniker" ) )
186*cdf0e10cSrcweir         dumpFileMoniker();
187*cdf0e10cSrcweir     else if( aGuid.equalsAscii( "ItemMoniker" ) )
188*cdf0e10cSrcweir         dumpItemMoniker();
189*cdf0e10cSrcweir     else if( aGuid.equalsAscii( "AntiMoniker" ) )
190*cdf0e10cSrcweir         dumpAntiMoniker();
191*cdf0e10cSrcweir     else if( aGuid.equalsAscii( "CompositeMoniker" ) )
192*cdf0e10cSrcweir         dumpCompositeMoniker();
193*cdf0e10cSrcweir     else
194*cdf0e10cSrcweir         bValidMoniker = false;
195*cdf0e10cSrcweir     return bValidMoniker;
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir void StdHlinkObject::dumpUrlMoniker()
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir     sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
201*cdf0e10cSrcweir     sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
202*cdf0e10cSrcweir     dumpNullUnicodeArray( "url" );
203*cdf0e10cSrcweir     if( mxStrm->tell() + 24 == nEndPos )
204*cdf0e10cSrcweir     {
205*cdf0e10cSrcweir         dumpGuid( "implementation-id" );
206*cdf0e10cSrcweir         dumpDec< sal_uInt32 >( "version" );
207*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "flags", "STDHLINK-URL-FLAGS" );
208*cdf0e10cSrcweir     }
209*cdf0e10cSrcweir     dumpRemainingTo( nEndPos );
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir void StdHlinkObject::dumpFileMoniker()
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir     dumpDec< sal_Int16 >( "up-levels" );
215*cdf0e10cSrcweir     dumpHyperlinkString( "ansi-filename", false );
216*cdf0e10cSrcweir     dumpDec< sal_Int16 >( "server-path-len" );
217*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "version" );
218*cdf0e10cSrcweir     dumpUnused( 20 );
219*cdf0e10cSrcweir     sal_Int32 nBytes = dumpDec< sal_Int32 >( "total-bytes" );
220*cdf0e10cSrcweir     sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
221*cdf0e10cSrcweir     if( nBytes > 0 )
222*cdf0e10cSrcweir     {
223*cdf0e10cSrcweir         sal_Int32 nFileBytes = dumpDec< sal_Int32 >( "uni-filename-bytes" );
224*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "key-value" );
225*cdf0e10cSrcweir         dumpUnicodeArray( "unicode-filename", nFileBytes / 2 );
226*cdf0e10cSrcweir     }
227*cdf0e10cSrcweir     dumpRemainingTo( nEndPos );
228*cdf0e10cSrcweir }
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir void StdHlinkObject::dumpItemMoniker()
231*cdf0e10cSrcweir {
232*cdf0e10cSrcweir     sal_Int32 nBytes = dumpDec< sal_Int32 >( "delimiter-bytes" );
233*cdf0e10cSrcweir     sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
234*cdf0e10cSrcweir     dumpNullCharArray( "ansi-delimiter", RTL_TEXTENCODING_MS_1252 );
235*cdf0e10cSrcweir     if( mxStrm->tell() < nEndPos )
236*cdf0e10cSrcweir         dumpUnicodeArray( "unicode-delimiter", (nEndPos - mxStrm->tell()) / 2 );
237*cdf0e10cSrcweir     mxStrm->seek( nEndPos );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir     nBytes = dumpDec< sal_Int32 >( "item-bytes" );
240*cdf0e10cSrcweir     nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
241*cdf0e10cSrcweir     dumpNullCharArray( "ansi-item", RTL_TEXTENCODING_MS_1252 );
242*cdf0e10cSrcweir     if( mxStrm->tell() < nEndPos )
243*cdf0e10cSrcweir         dumpUnicodeArray( "unicode-item", (nEndPos - mxStrm->tell()) / 2 );
244*cdf0e10cSrcweir     mxStrm->seek( nEndPos );
245*cdf0e10cSrcweir }
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir void StdHlinkObject::dumpAntiMoniker()
248*cdf0e10cSrcweir {
249*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "count" );
250*cdf0e10cSrcweir }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir void StdHlinkObject::dumpCompositeMoniker()
253*cdf0e10cSrcweir {
254*cdf0e10cSrcweir     sal_Int32 nCount = dumpDec< sal_Int32 >( "moniker-count" );
255*cdf0e10cSrcweir     for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
256*cdf0e10cSrcweir         dumpGuidAndMoniker();
257*cdf0e10cSrcweir }
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir // ============================================================================
260*cdf0e10cSrcweir // ============================================================================
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir OleStreamObject::OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir     construct( rParent, rxStrm, rSysFileName );
265*cdf0e10cSrcweir }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir // ============================================================================
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir OleCompObjObject::OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
270*cdf0e10cSrcweir     OleStreamObject( rParent, rxStrm, rSysFileName )
271*cdf0e10cSrcweir {
272*cdf0e10cSrcweir }
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir void OleCompObjObject::implDump()
275*cdf0e10cSrcweir {
276*cdf0e10cSrcweir     dumpUnused( 4 );
277*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "version" );
278*cdf0e10cSrcweir     dumpUnused( 20 );
279*cdf0e10cSrcweir     dumpAnsiString32( "ansi-display-name" );
280*cdf0e10cSrcweir     dumpAnsiString32OrStdClip( "ansi-clipboard-format" );
281*cdf0e10cSrcweir     if( mxStrm->getRemaining() >= 4 )
282*cdf0e10cSrcweir     {
283*cdf0e10cSrcweir         sal_Int32 nLen = mxStrm->readInt32();
284*cdf0e10cSrcweir         if( (0 <= nLen) && (nLen <= 40) )
285*cdf0e10cSrcweir         {
286*cdf0e10cSrcweir             dumpCharArray( "ansi-unused", nLen, RTL_TEXTENCODING_MS_1252 );
287*cdf0e10cSrcweir             if( (mxStrm->getRemaining() >= 4) && (dumpHex< sal_Int32 >( "unicode-marker" ) == 0x71B239F4) )
288*cdf0e10cSrcweir             {
289*cdf0e10cSrcweir                 dumpUniString32( "unicode-display-name" );
290*cdf0e10cSrcweir                 dumpUniString32OrStdClip( "unicode-clipboard-format" );
291*cdf0e10cSrcweir                 dumpUniString32( "unicode-unused" );
292*cdf0e10cSrcweir             }
293*cdf0e10cSrcweir         }
294*cdf0e10cSrcweir         else
295*cdf0e10cSrcweir             writeDecItem( "length", nLen );
296*cdf0e10cSrcweir     }
297*cdf0e10cSrcweir     dumpRemainingStream();
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir // ============================================================================
301*cdf0e10cSrcweir // ============================================================================
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir namespace {
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir const sal_Int32 OLEPROP_ID_DICTIONARY   = 0;
306*cdf0e10cSrcweir const sal_Int32 OLEPROP_ID_CODEPAGE     = 1;
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_INT16     = 2;
309*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_INT32     = 3;
310*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_FLOAT     = 4;
311*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_DOUBLE    = 5;
312*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_DATE      = 7;
313*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STRING    = 8;
314*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STATUS    = 10;
315*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_BOOL      = 11;
316*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_VARIANT   = 12;
317*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_INT8      = 16;
318*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_UINT8     = 17;
319*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_UINT16    = 18;
320*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_UINT32    = 19;
321*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_INT64     = 20;
322*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_UINT64    = 21;
323*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STRING8   = 30;
324*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STRING16  = 31;
325*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_FILETIME  = 64;
326*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_BLOB      = 65;
327*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STREAM    = 66;
328*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_STORAGE   = 67;
329*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_CLIPFMT   = 71;
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_SIMPLE    = 0x0000;
332*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_VECTOR    = 0x1000;
333*cdf0e10cSrcweir const sal_uInt16 OLEPROP_TYPE_ARRAY     = 0x2000;
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir const sal_uInt16 CODEPAGE_UNICODE       = 1200;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir const sal_uInt32 AX_STRING_COMPRESSED   = 0x80000000;
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir } // namespace
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir // ============================================================================
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
344*cdf0e10cSrcweir {
345*cdf0e10cSrcweir     construct( rParent, rxStrm, rSysFileName );
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir void OlePropertyStreamObject::implDump()
349*cdf0e10cSrcweir {
350*cdf0e10cSrcweir     OUStringVector aGuidVec;
351*cdf0e10cSrcweir     ::std::vector< sal_uInt32 > aStartPosVec;
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir     // dump header
354*cdf0e10cSrcweir     writeEmptyItem( "HEADER" );
355*cdf0e10cSrcweir     {
356*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
357*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
358*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "version" );
359*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "os-minor" );
360*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "os-type", "OLEPROP-OSTYPE" );
361*cdf0e10cSrcweir         dumpGuid( "guid" );
362*cdf0e10cSrcweir         sal_Int32 nSectCount = dumpDec< sal_Int32 >( "section-count" );
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir         // dump table of section positions
365*cdf0e10cSrcweir         {
366*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 15, 60 );
367*cdf0e10cSrcweir             mxOut->resetItemIndex();
368*cdf0e10cSrcweir             for( sal_Int32 nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < nSectCount); ++nSectIdx )
369*cdf0e10cSrcweir             {
370*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
371*cdf0e10cSrcweir                 writeEmptyItem( "#section" );
372*cdf0e10cSrcweir                 aGuidVec.push_back( dumpGuid( "guid" ) );
373*cdf0e10cSrcweir                 aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" ) );
374*cdf0e10cSrcweir             }
375*cdf0e10cSrcweir         }
376*cdf0e10cSrcweir     }
377*cdf0e10cSrcweir     mxOut->emptyLine();
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir     // dump sections
380*cdf0e10cSrcweir     for( size_t nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
381*cdf0e10cSrcweir         dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
382*cdf0e10cSrcweir }
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
385*cdf0e10cSrcweir {
386*cdf0e10cSrcweir     // property ID names
387*cdf0e10cSrcweir     mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
388*cdf0e10cSrcweir     OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
389*cdf0e10cSrcweir     if( aGuidName.equalsAscii( "GlobalDocProp" ) )
390*cdf0e10cSrcweir         mxPropIds->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
391*cdf0e10cSrcweir     else if( aGuidName.equalsAscii( "BuiltinDocProp" ) )
392*cdf0e10cSrcweir         mxPropIds->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
393*cdf0e10cSrcweir     else
394*cdf0e10cSrcweir         mxPropIds->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir     // property ID/position map
397*cdf0e10cSrcweir     typedef ::std::map< sal_Int32, sal_uInt32 > PropertyPosMap;
398*cdf0e10cSrcweir     PropertyPosMap aPropMap;
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir     // dump section header line
401*cdf0e10cSrcweir     writeSectionHeader( rGuid, nStartPos );
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir     // seek to section
404*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
405*cdf0e10cSrcweir     if( startElement( nStartPos ) )
406*cdf0e10cSrcweir     {
407*cdf0e10cSrcweir         // dump section header
408*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "size" );
409*cdf0e10cSrcweir         sal_Int32 nPropCount = dumpDec< sal_Int32 >( "property-count" );
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir         // dump table of property positions
412*cdf0e10cSrcweir         {
413*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 15, 25 );
414*cdf0e10cSrcweir             mxOut->resetItemIndex();
415*cdf0e10cSrcweir             for( sal_Int32 nPropIdx = 0; !mxStrm->isEof() && (nPropIdx < nPropCount); ++nPropIdx )
416*cdf0e10cSrcweir             {
417*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
418*cdf0e10cSrcweir                 writeEmptyItem( "#property" );
419*cdf0e10cSrcweir                 sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
420*cdf0e10cSrcweir                 sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" );
421*cdf0e10cSrcweir                 aPropMap[ nPropId ] = nPropPos;
422*cdf0e10cSrcweir             }
423*cdf0e10cSrcweir         }
424*cdf0e10cSrcweir     }
425*cdf0e10cSrcweir     mxOut->emptyLine();
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir     // code page property
428*cdf0e10cSrcweir     meTextEnc = RTL_TEXTENCODING_MS_1252;
429*cdf0e10cSrcweir     mbIsUnicode = false;
430*cdf0e10cSrcweir     PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
431*cdf0e10cSrcweir     if( aCodePageIt != aPropMap.end() )
432*cdf0e10cSrcweir     {
433*cdf0e10cSrcweir         dumpCodePageProperty( aCodePageIt->second );
434*cdf0e10cSrcweir         aPropMap.erase( aCodePageIt );
435*cdf0e10cSrcweir     }
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir     // dictionary property
438*cdf0e10cSrcweir     PropertyPosMap::iterator aDictIt = aPropMap.find( OLEPROP_ID_DICTIONARY );
439*cdf0e10cSrcweir     if( aDictIt != aPropMap.end() )
440*cdf0e10cSrcweir     {
441*cdf0e10cSrcweir         dumpDictionaryProperty( aDictIt->second );
442*cdf0e10cSrcweir         aPropMap.erase( aDictIt );
443*cdf0e10cSrcweir     }
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir     // other properties
446*cdf0e10cSrcweir     for( PropertyPosMap::const_iterator aIt = aPropMap.begin(), aEnd = aPropMap.end(); aIt != aEnd; ++aIt )
447*cdf0e10cSrcweir         dumpProperty( aIt->first, aIt->second );
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir     // remove the user defined list of property ID names
450*cdf0e10cSrcweir     cfg().eraseNameList( "OLEPROP-IDS" );
451*cdf0e10cSrcweir }
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
454*cdf0e10cSrcweir {
455*cdf0e10cSrcweir     writePropertyHeader( nPropId, nStartPos );
456*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
457*cdf0e10cSrcweir     if( startElement( nStartPos ) )
458*cdf0e10cSrcweir         dumpPropertyContents( nPropId );
459*cdf0e10cSrcweir     mxOut->emptyLine();
460*cdf0e10cSrcweir }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir     writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
465*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
466*cdf0e10cSrcweir     if( startElement( nStartPos ) )
467*cdf0e10cSrcweir     {
468*cdf0e10cSrcweir         sal_uInt16 nType = dumpPropertyType();
469*cdf0e10cSrcweir         if( nType == OLEPROP_TYPE_INT16 )
470*cdf0e10cSrcweir         {
471*cdf0e10cSrcweir             sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
472*cdf0e10cSrcweir             rtl_TextEncoding eNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
473*cdf0e10cSrcweir             if( eNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
474*cdf0e10cSrcweir                 meTextEnc = eNewTextEnc;
475*cdf0e10cSrcweir             mbIsUnicode = nCodePage == CODEPAGE_UNICODE;
476*cdf0e10cSrcweir         }
477*cdf0e10cSrcweir         else
478*cdf0e10cSrcweir             dumpPropertyContents( OLEPROP_ID_CODEPAGE );
479*cdf0e10cSrcweir     }
480*cdf0e10cSrcweir     mxOut->emptyLine();
481*cdf0e10cSrcweir }
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
484*cdf0e10cSrcweir {
485*cdf0e10cSrcweir     writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
486*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
487*cdf0e10cSrcweir     if( startElement( nStartPos ) )
488*cdf0e10cSrcweir     {
489*cdf0e10cSrcweir         sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
490*cdf0e10cSrcweir         for( sal_Int32 nIdx = 0; !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
491*cdf0e10cSrcweir         {
492*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
493*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 10, 20 );
494*cdf0e10cSrcweir             sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
495*cdf0e10cSrcweir             OUString aName = dumpString8( "name" );
496*cdf0e10cSrcweir             if( mxPropIds.get() )
497*cdf0e10cSrcweir                 mxPropIds->setName( nId, aName );
498*cdf0e10cSrcweir         }
499*cdf0e10cSrcweir     }
500*cdf0e10cSrcweir     mxOut->emptyLine();
501*cdf0e10cSrcweir }
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir sal_uInt16 OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
504*cdf0e10cSrcweir {
505*cdf0e10cSrcweir     sal_uInt16 nType = dumpPropertyType();
506*cdf0e10cSrcweir     sal_uInt16 nBaseType = static_cast< sal_uInt16 >( nType & 0x0FFF );
507*cdf0e10cSrcweir     sal_uInt16 nArrayType = static_cast< sal_uInt16 >( nType & 0xF000 );
508*cdf0e10cSrcweir     switch( nArrayType )
509*cdf0e10cSrcweir     {
510*cdf0e10cSrcweir         case OLEPROP_TYPE_SIMPLE:   dumpPropertyValue( nPropId, nBaseType );    break;
511*cdf0e10cSrcweir         case OLEPROP_TYPE_VECTOR:   dumpPropertyVector( nPropId, nBaseType );   break;
512*cdf0e10cSrcweir         case OLEPROP_TYPE_ARRAY:    dumpPropertyArray( nPropId, nBaseType );    break;
513*cdf0e10cSrcweir     }
514*cdf0e10cSrcweir     return nType;
515*cdf0e10cSrcweir }
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType )
518*cdf0e10cSrcweir {
519*cdf0e10cSrcweir     switch( nBaseType )
520*cdf0e10cSrcweir     {
521*cdf0e10cSrcweir         case OLEPROP_TYPE_INT16:        dumpDec< sal_Int16 >( "value" );        break;
522*cdf0e10cSrcweir         case OLEPROP_TYPE_INT32:        dumpDec< sal_Int32 >( "value" );        break;
523*cdf0e10cSrcweir         case OLEPROP_TYPE_FLOAT:        dumpDec< float >( "value" );            break;
524*cdf0e10cSrcweir         case OLEPROP_TYPE_DOUBLE:       dumpDec< double >( "value" );           break;
525*cdf0e10cSrcweir         case OLEPROP_TYPE_DATE:         dumpDec< double >( "date" );            break;
526*cdf0e10cSrcweir         case OLEPROP_TYPE_STRING:       dumpString8( "value" );                 break;
527*cdf0e10cSrcweir         case OLEPROP_TYPE_STATUS:       dumpHex< sal_Int32 >( "status" );       break;
528*cdf0e10cSrcweir         case OLEPROP_TYPE_BOOL:         dumpBool< sal_Int16 >( "value" );       break;
529*cdf0e10cSrcweir         case OLEPROP_TYPE_VARIANT:      dumpPropertyContents( nPropId );        break;
530*cdf0e10cSrcweir         case OLEPROP_TYPE_INT8:         dumpDec< sal_Int8 >( "value" );         break;
531*cdf0e10cSrcweir         case OLEPROP_TYPE_UINT8:        dumpDec< sal_uInt8 >( "value" );        break;
532*cdf0e10cSrcweir         case OLEPROP_TYPE_UINT16:       dumpDec< sal_uInt16 >( "value" );       break;
533*cdf0e10cSrcweir         case OLEPROP_TYPE_UINT32:       dumpDec< sal_uInt32 >( "value" );       break;
534*cdf0e10cSrcweir         case OLEPROP_TYPE_INT64:        dumpDec< sal_Int64 >( "value" );        break;
535*cdf0e10cSrcweir         case OLEPROP_TYPE_UINT64:       dumpDec< sal_uInt64 >( "value" );       break;
536*cdf0e10cSrcweir         case OLEPROP_TYPE_STRING8:      dumpString8( "value" );                 break;
537*cdf0e10cSrcweir         case OLEPROP_TYPE_STRING16:     dumpString16( "value" );                break;
538*cdf0e10cSrcweir         case OLEPROP_TYPE_FILETIME:     dumpFileTime( "file-time" );            break;
539*cdf0e10cSrcweir         case OLEPROP_TYPE_BLOB:         dumpBlob( nPropId, "data" );            break;
540*cdf0e10cSrcweir         case OLEPROP_TYPE_STREAM:       dumpString8( "stream-name" );           break;
541*cdf0e10cSrcweir         case OLEPROP_TYPE_STORAGE:      dumpString8( "storage-name" );          break;
542*cdf0e10cSrcweir         case OLEPROP_TYPE_CLIPFMT:      dumpBlob( nPropId, "clip-data" );       break;
543*cdf0e10cSrcweir     }
544*cdf0e10cSrcweir }
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir void OlePropertyStreamObject::dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType )
547*cdf0e10cSrcweir {
548*cdf0e10cSrcweir     sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
549*cdf0e10cSrcweir     for( sal_Int32 nElemIdx = 0; !mxStrm->isEof() && (nElemIdx < nElemCount); ++nElemIdx )
550*cdf0e10cSrcweir     {
551*cdf0e10cSrcweir         mxOut->resetItemIndex( nElemIdx );
552*cdf0e10cSrcweir         writeEmptyItem( "#element" );
553*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
554*cdf0e10cSrcweir         dumpPropertyValue( nPropId, nBaseType );
555*cdf0e10cSrcweir     }
556*cdf0e10cSrcweir }
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir void OlePropertyStreamObject::dumpPropertyArray( sal_Int32 /*nPropId*/, sal_uInt16 /*nBaseType*/ )
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir     // TODO
561*cdf0e10cSrcweir }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir sal_uInt16 OlePropertyStreamObject::dumpPropertyType()
564*cdf0e10cSrcweir {
565*cdf0e10cSrcweir     return static_cast< sal_uInt16 >( dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" ) & 0xFFFF );
566*cdf0e10cSrcweir }
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir void OlePropertyStreamObject::dumpBlob( sal_Int32 nPropId, const String& rName )
569*cdf0e10cSrcweir {
570*cdf0e10cSrcweir     sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
571*cdf0e10cSrcweir     if( nSize > 0 )
572*cdf0e10cSrcweir     {
573*cdf0e10cSrcweir         OUString aPropName = mxPropIds->getName( cfg(), nPropId );
574*cdf0e10cSrcweir         if( aPropName == CREATE_OUSTRING( "'_PID_HLINKS'" ) )
575*cdf0e10cSrcweir             dumpHlinks( nSize );
576*cdf0e10cSrcweir         else
577*cdf0e10cSrcweir             dumpBinary( rName, nSize );
578*cdf0e10cSrcweir     }
579*cdf0e10cSrcweir }
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir OUString OlePropertyStreamObject::dumpString8( const String& rName )
582*cdf0e10cSrcweir {
583*cdf0e10cSrcweir     sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
584*cdf0e10cSrcweir     return mbIsUnicode ? dumpCharArray16( rName, nLen ) : dumpCharArray8( rName, nLen );
585*cdf0e10cSrcweir }
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32 nLen )
588*cdf0e10cSrcweir {
589*cdf0e10cSrcweir     sal_Int32 nNewLen = getLimitedValue< sal_Int32, sal_Int32 >( nLen, 0, 1024 );
590*cdf0e10cSrcweir     OUString aData = mxStrm->readCharArrayUC( nNewLen, meTextEnc );
591*cdf0e10cSrcweir     writeStringItem( rName, aData );
592*cdf0e10cSrcweir     return aData;
593*cdf0e10cSrcweir }
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir OUString OlePropertyStreamObject::dumpString16( const String& rName )
596*cdf0e10cSrcweir {
597*cdf0e10cSrcweir     sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
598*cdf0e10cSrcweir     return dumpCharArray16( rName, nLen );
599*cdf0e10cSrcweir }
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int32 nLen )
602*cdf0e10cSrcweir {
603*cdf0e10cSrcweir     sal_Int32 nNewLen = getLimitedValue< sal_Int32, sal_Int32 >( nLen, 0, 1024 );
604*cdf0e10cSrcweir     OUString aData = mxStrm->readUnicodeArray( nNewLen );
605*cdf0e10cSrcweir     writeStringItem( rName, aData );
606*cdf0e10cSrcweir     if( nNewLen & 1 ) dumpUnused( 2 ); // always padding to 32bit
607*cdf0e10cSrcweir     return aData;
608*cdf0e10cSrcweir }
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir bool OlePropertyStreamObject::dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType )
611*cdf0e10cSrcweir {
612*cdf0e10cSrcweir     writeEmptyItem( rName );
613*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
614*cdf0e10cSrcweir     return (dumpPropertyContents( -1 ) == nExpectedType) && !mxStrm->isEof();
615*cdf0e10cSrcweir }
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir void OlePropertyStreamObject::dumpHlinks( sal_Int32 nSize )
618*cdf0e10cSrcweir {
619*cdf0e10cSrcweir     sal_Int64 nEndPos = mxStrm->tell() + nSize;
620*cdf0e10cSrcweir     sal_Int32 nCount = dumpDec< sal_Int32 >( "property-count" );
621*cdf0e10cSrcweir     bool bValid = true;
622*cdf0e10cSrcweir     for( sal_Int32 nHlinkIndex = 0, nHlinkCount = nCount / 6; bValid && !mxStrm->isEof() && (nHlinkIndex < nHlinkCount); ++nHlinkIndex )
623*cdf0e10cSrcweir     {
624*cdf0e10cSrcweir         writeEmptyItem( "HYPERLINK" );
625*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
626*cdf0e10cSrcweir         bValid =
627*cdf0e10cSrcweir             dumpTypedProperty( "hash", OLEPROP_TYPE_INT32 ) &&
628*cdf0e10cSrcweir             dumpTypedProperty( "app", OLEPROP_TYPE_INT32 ) &&
629*cdf0e10cSrcweir             dumpTypedProperty( "shape-id", OLEPROP_TYPE_INT32 ) &&
630*cdf0e10cSrcweir             dumpTypedProperty( "info", OLEPROP_TYPE_INT32 ) &&
631*cdf0e10cSrcweir             dumpTypedProperty( "target", OLEPROP_TYPE_STRING16 ) &&
632*cdf0e10cSrcweir             dumpTypedProperty( "location", OLEPROP_TYPE_STRING16 );
633*cdf0e10cSrcweir     }
634*cdf0e10cSrcweir     dumpRemainingTo( nEndPos );
635*cdf0e10cSrcweir }
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
638*cdf0e10cSrcweir {
639*cdf0e10cSrcweir     mxStrm->seek( nStartPos );
640*cdf0e10cSrcweir     if( mxStrm->isEof() )
641*cdf0e10cSrcweir         writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
642*cdf0e10cSrcweir     return !mxStrm->isEof();
643*cdf0e10cSrcweir }
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
648*cdf0e10cSrcweir     writeEmptyItem( "SECTION" );
649*cdf0e10cSrcweir     writeHexItem( "pos", nStartPos, "CONV-DEC" );
650*cdf0e10cSrcweir     writeGuidItem( "guid", rGuid );
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
656*cdf0e10cSrcweir     writeEmptyItem( "PROPERTY" );
657*cdf0e10cSrcweir     writeHexItem( "pos", nStartPos, "CONV-DEC" );
658*cdf0e10cSrcweir     writeDecItem( "id", nPropId, mxPropIds );
659*cdf0e10cSrcweir }
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir // ============================================================================
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir OleStorageObject::OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
664*cdf0e10cSrcweir {
665*cdf0e10cSrcweir     construct( rParent, rxStrg, rSysPath );
666*cdf0e10cSrcweir }
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir void OleStorageObject::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
669*cdf0e10cSrcweir {
670*cdf0e10cSrcweir     StorageObjectBase::construct( rParent, rxStrg, rSysPath );
671*cdf0e10cSrcweir }
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir void OleStorageObject::construct( const ObjectBase& rParent )
674*cdf0e10cSrcweir {
675*cdf0e10cSrcweir     StorageObjectBase::construct( rParent );
676*cdf0e10cSrcweir }
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir void OleStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
679*cdf0e10cSrcweir {
680*cdf0e10cSrcweir     if( rStrmName.equalsAscii( "\001CompObj" ) )
681*cdf0e10cSrcweir         OleCompObjObject( *this, rxStrm, rSysFileName ).dump();
682*cdf0e10cSrcweir     else if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
683*cdf0e10cSrcweir         OlePropertyStreamObject( *this, rxStrm, rSysFileName ).dump();
684*cdf0e10cSrcweir     else
685*cdf0e10cSrcweir         BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
686*cdf0e10cSrcweir }
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir // ============================================================================
689*cdf0e10cSrcweir // ============================================================================
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir ComCtlObjectBase::ComCtlObjectBase( const InputObjectBase& rParent,
692*cdf0e10cSrcweir         sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion, bool bCommonPart, bool bComplexPart ) :
693*cdf0e10cSrcweir     mnDataId5( nDataId5 ),
694*cdf0e10cSrcweir     mnDataId6( nDataId6 ),
695*cdf0e10cSrcweir     mnVersion( nVersion ),
696*cdf0e10cSrcweir     mbCommonPart( bCommonPart ),
697*cdf0e10cSrcweir     mbComplexPart( bComplexPart )
698*cdf0e10cSrcweir {
699*cdf0e10cSrcweir     construct( rParent );
700*cdf0e10cSrcweir }
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir void ComCtlObjectBase::implDump()
703*cdf0e10cSrcweir {
704*cdf0e10cSrcweir     sal_uInt32 nCommonSize = 0;
705*cdf0e10cSrcweir     dumpComCtlSize() && dumpComCtlData( nCommonSize ) && (!mbCommonPart || dumpComCtlCommon( nCommonSize )) && (!mbComplexPart || dumpComCtlComplex());
706*cdf0e10cSrcweir }
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir void ComCtlObjectBase::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
709*cdf0e10cSrcweir {
710*cdf0e10cSrcweir }
711*cdf0e10cSrcweir 
712*cdf0e10cSrcweir void ComCtlObjectBase::implDumpCommonTrailing()
713*cdf0e10cSrcweir {
714*cdf0e10cSrcweir }
715*cdf0e10cSrcweir 
716*cdf0e10cSrcweir bool ComCtlObjectBase::dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor )
717*cdf0e10cSrcweir {
718*cdf0e10cSrcweir     // no idea if all this is correct...
719*cdf0e10cSrcweir     sal_uInt32 nId = dumpHex< sal_uInt32 >( "header-id", "COMCTL-HEADER-IDS" );
720*cdf0e10cSrcweir     ItemGuard aItem( mxOut, "version" );
721*cdf0e10cSrcweir     sal_uInt16 nMinor, nMajor;
722*cdf0e10cSrcweir     *mxStrm >> nMinor >> nMajor;
723*cdf0e10cSrcweir     mxOut->writeDec( nMajor );
724*cdf0e10cSrcweir     mxOut->writeChar( '.' );
725*cdf0e10cSrcweir     mxOut->writeDec( nMinor );
726*cdf0e10cSrcweir     return !mxStrm->isEof() && (nId == nExpId) && ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor));
727*cdf0e10cSrcweir }
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir bool ComCtlObjectBase::dumpComCtlSize()
730*cdf0e10cSrcweir {
731*cdf0e10cSrcweir     if( dumpComCtlHeader( 0x12344321, 0, 8 ) )
732*cdf0e10cSrcweir     {
733*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
734*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
735*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
736*cdf0e10cSrcweir         return !mxStrm->isEof();
737*cdf0e10cSrcweir     }
738*cdf0e10cSrcweir     return false;
739*cdf0e10cSrcweir }
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir bool ComCtlObjectBase::dumpComCtlData( sal_uInt32& ornCommonPartSize )
742*cdf0e10cSrcweir {
743*cdf0e10cSrcweir     if( dumpComCtlHeader( (mnVersion == 5) ? mnDataId5 : mnDataId6, mnVersion ) )
744*cdf0e10cSrcweir     {
745*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
746*cdf0e10cSrcweir         if( mbCommonPart )
747*cdf0e10cSrcweir             ornCommonPartSize = dumpDec< sal_uInt32 >( "common-part-size" );
748*cdf0e10cSrcweir         implDumpProperties();
749*cdf0e10cSrcweir         return !mxStrm->isEof();
750*cdf0e10cSrcweir     }
751*cdf0e10cSrcweir     return false;
752*cdf0e10cSrcweir }
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir bool ComCtlObjectBase::dumpComCtlCommon( sal_uInt32 nPartSize )
755*cdf0e10cSrcweir {
756*cdf0e10cSrcweir     sal_Int64 nEndPos = mxStrm->tell() + nPartSize;
757*cdf0e10cSrcweir     if( (nPartSize >= 16) && dumpComCtlHeader( 0xABCDEF01, 5, 0 ) )
758*cdf0e10cSrcweir     {
759*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
760*cdf0e10cSrcweir         dumpUnknown( 4 );
761*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "common-flags", "COMCTL-COMMON-FLAGS" );
762*cdf0e10cSrcweir         implDumpCommonExtra( nEndPos );
763*cdf0e10cSrcweir         dumpRemainingTo( nEndPos );
764*cdf0e10cSrcweir         implDumpCommonTrailing();
765*cdf0e10cSrcweir         return !mxStrm->isEof();
766*cdf0e10cSrcweir     }
767*cdf0e10cSrcweir     return false;
768*cdf0e10cSrcweir }
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir bool ComCtlObjectBase::dumpComCtlComplex()
771*cdf0e10cSrcweir {
772*cdf0e10cSrcweir     if( dumpComCtlHeader( 0xBDECDE1F, 5, 1 ) )
773*cdf0e10cSrcweir     {
774*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
775*cdf0e10cSrcweir         sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "comctl-complex-flags", "COMCTL-COMPLEX-FLAGS" );
776*cdf0e10cSrcweir         if( !mxStrm->isEof() && (nFlags & 0x01) )
777*cdf0e10cSrcweir         {
778*cdf0e10cSrcweir             writeEmptyItem( "font" );
779*cdf0e10cSrcweir             IndentGuard aIndGuard2( mxOut );
780*cdf0e10cSrcweir             OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
781*cdf0e10cSrcweir             if( aClassName.equalsAscii( "StdFont" ) )
782*cdf0e10cSrcweir                 StdFontObject( *this ).dump();
783*cdf0e10cSrcweir         }
784*cdf0e10cSrcweir         if( !mxStrm->isEof() && (nFlags & 0x02) )
785*cdf0e10cSrcweir         {
786*cdf0e10cSrcweir             writeEmptyItem( "mouse-icon" );
787*cdf0e10cSrcweir             IndentGuard aIndGuard2( mxOut );
788*cdf0e10cSrcweir             OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
789*cdf0e10cSrcweir             if( aClassName.equalsAscii( "StdPic" ) )
790*cdf0e10cSrcweir                 StdPicObject( *this ).dump();
791*cdf0e10cSrcweir         }
792*cdf0e10cSrcweir         return !mxStrm->isEof();
793*cdf0e10cSrcweir     }
794*cdf0e10cSrcweir     return false;
795*cdf0e10cSrcweir }
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir // ============================================================================
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir ComCtlScrollBarObject::ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
800*cdf0e10cSrcweir     ComCtlObjectBase( rParent, SAL_MAX_UINT32, 0x99470A83, nVersion, true, true )
801*cdf0e10cSrcweir {
802*cdf0e10cSrcweir }
803*cdf0e10cSrcweir 
804*cdf0e10cSrcweir void ComCtlScrollBarObject::implDumpProperties()
805*cdf0e10cSrcweir {
806*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "flags", "COMCTL-SCROLLBAR-FLAGS" );
807*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "large-change" );
808*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "small-change" );
809*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "min" );
810*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "max" );
811*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "value" );
812*cdf0e10cSrcweir }
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir // ============================================================================
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir ComCtlProgressBarObject::ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
817*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E84, 0x97AB8A01, nVersion, true, true )
818*cdf0e10cSrcweir {
819*cdf0e10cSrcweir }
820*cdf0e10cSrcweir 
821*cdf0e10cSrcweir void ComCtlProgressBarObject::implDumpProperties()
822*cdf0e10cSrcweir {
823*cdf0e10cSrcweir     dumpDec< float >( "min" );
824*cdf0e10cSrcweir     dumpDec< float >( "max" );
825*cdf0e10cSrcweir     if( mnVersion == 6 )
826*cdf0e10cSrcweir     {
827*cdf0e10cSrcweir         dumpBool< sal_uInt16 >( "vertical" );
828*cdf0e10cSrcweir         dumpBool< sal_uInt16 >( "smooth-scroll" );
829*cdf0e10cSrcweir     }
830*cdf0e10cSrcweir }
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir // ============================================================================
833*cdf0e10cSrcweir 
834*cdf0e10cSrcweir ComCtlSliderObject::ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
835*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E86, 0x0A2BAE11, nVersion, true, true )
836*cdf0e10cSrcweir {
837*cdf0e10cSrcweir }
838*cdf0e10cSrcweir 
839*cdf0e10cSrcweir void ComCtlSliderObject::implDumpProperties()
840*cdf0e10cSrcweir {
841*cdf0e10cSrcweir     dumpBool< sal_Int32 >( "vertical" );
842*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "large-change" );
843*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "small-change" );
844*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "min" );
845*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "max" );
846*cdf0e10cSrcweir     dumpDec< sal_Int16 >( "select-range", "COMCTL-SLIDER-SELECTRANGE" );
847*cdf0e10cSrcweir     dumpUnused( 2 );
848*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "select-start" );
849*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "select-length" );
850*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "tick-style", "COMCTL-SLIDER-TICKSTYLE" );
851*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "tick-frequency" );
852*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "value" );
853*cdf0e10cSrcweir     if( mnVersion == 6 )
854*cdf0e10cSrcweir         dumpBool< sal_Int32 >( "tooltip-below" );
855*cdf0e10cSrcweir }
856*cdf0e10cSrcweir 
857*cdf0e10cSrcweir // ============================================================================
858*cdf0e10cSrcweir 
859*cdf0e10cSrcweir ComCtlUpDownObject::ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
860*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xFF3626A0, 0xFF3626A0, nVersion, false, false )
861*cdf0e10cSrcweir {
862*cdf0e10cSrcweir }
863*cdf0e10cSrcweir 
864*cdf0e10cSrcweir void ComCtlUpDownObject::implDumpProperties()
865*cdf0e10cSrcweir {
866*cdf0e10cSrcweir     dumpUnknown( 16 ); // buddy-property, somehow
867*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "buddy-control" );
868*cdf0e10cSrcweir     dumpUnknown( 8 );
869*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "value" );
870*cdf0e10cSrcweir     dumpUnknown( 4 );
871*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "increment" );
872*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "max" );
873*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "min" );
874*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "flags-1", "COMCTL-UPDOWN-FLAGS1" );
875*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "flags-2", "COMCTL-UPDOWN-FLAGS2" );
876*cdf0e10cSrcweir     dumpUnknown( 4 );
877*cdf0e10cSrcweir }
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir // ============================================================================
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir ComCtlImageListObject::ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
882*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E80, 0xE6E17E80, nVersion, true, false )
883*cdf0e10cSrcweir {
884*cdf0e10cSrcweir }
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir void ComCtlImageListObject::implDumpProperties()
887*cdf0e10cSrcweir {
888*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "image-width" );
889*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "image-height" );
890*cdf0e10cSrcweir     dumpOleColor( "mask-color" );
891*cdf0e10cSrcweir     dumpBool< sal_Int16 >( "use-mask-color" );
892*cdf0e10cSrcweir     dumpUnknown( 2 );
893*cdf0e10cSrcweir }
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir void ComCtlImageListObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
896*cdf0e10cSrcweir {
897*cdf0e10cSrcweir     dumpUnknown( 4 );
898*cdf0e10cSrcweir     dumpOleColor( "back-color" );
899*cdf0e10cSrcweir     dumpUnknown( 4 );
900*cdf0e10cSrcweir     sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
901*cdf0e10cSrcweir     mxOut->resetItemIndex();
902*cdf0e10cSrcweir     for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
903*cdf0e10cSrcweir     {
904*cdf0e10cSrcweir         writeEmptyItem( "#image" );
905*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
906*cdf0e10cSrcweir         sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "text-flags", "COMCTL-IMAGELIST-TEXTFLAGS" );
907*cdf0e10cSrcweir         if( nFlags & 0x01 ) dumpUniString32( "caption" );
908*cdf0e10cSrcweir         if( nFlags & 0x02 ) dumpUniString32( "key" );
909*cdf0e10cSrcweir     }
910*cdf0e10cSrcweir }
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir void ComCtlImageListObject::implDumpCommonTrailing()
913*cdf0e10cSrcweir {
914*cdf0e10cSrcweir     sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
915*cdf0e10cSrcweir     mxOut->resetItemIndex();
916*cdf0e10cSrcweir     for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
917*cdf0e10cSrcweir     {
918*cdf0e10cSrcweir         writeEmptyItem( "#image" );
919*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
920*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "index" );
921*cdf0e10cSrcweir         StdPicObject( *this ).dump();
922*cdf0e10cSrcweir     }
923*cdf0e10cSrcweir }
924*cdf0e10cSrcweir 
925*cdf0e10cSrcweir // ============================================================================
926*cdf0e10cSrcweir 
927*cdf0e10cSrcweir ComCtlTabStripObject::ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
928*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E8A, 0xD12A7AC1, nVersion, true, true )
929*cdf0e10cSrcweir {
930*cdf0e10cSrcweir }
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir void ComCtlTabStripObject::implDumpProperties()
933*cdf0e10cSrcweir {
934*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "flags-1", "COMCTL-TABSTRIP-FLAGS1" );
935*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "tab-fixed-width", "CONV-HMM-TO-CM" );
936*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "tab-fixed-height", "CONV-HMM-TO-CM" );
937*cdf0e10cSrcweir     if( mnVersion == 6 )
938*cdf0e10cSrcweir     {
939*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TABSTRIP-FLAGS2" );
940*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "tab-min-width", "CONV-HMM-TO-CM" );
941*cdf0e10cSrcweir         dumpUnknown( 2 );
942*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "flags-3", "COMCTL-TABSTRIP-FLAGS3" );
943*cdf0e10cSrcweir     }
944*cdf0e10cSrcweir }
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir void ComCtlTabStripObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
947*cdf0e10cSrcweir {
948*cdf0e10cSrcweir     dumpUnknown( 12 );
949*cdf0e10cSrcweir     dumpUniString32( "image-list" );
950*cdf0e10cSrcweir     sal_Int32 nTabCount = dumpDec< sal_Int32 >( "tab-count" );
951*cdf0e10cSrcweir     mxOut->resetItemIndex();
952*cdf0e10cSrcweir     for( sal_Int32 nTabIndex = 0; (nTabIndex < nTabCount) && !mxStrm->isEof(); ++nTabIndex )
953*cdf0e10cSrcweir     {
954*cdf0e10cSrcweir         writeEmptyItem( "#tab" );
955*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
956*cdf0e10cSrcweir         dumpUnknown( 4 );
957*cdf0e10cSrcweir         sal_uInt32 nTabFlags = dumpHex< sal_uInt32 >( "tab-flags", "COMCTL-TABSTRIP-TABFLAGS" );
958*cdf0e10cSrcweir         if( nTabFlags & 0x01 ) dumpUniString32( "caption" );
959*cdf0e10cSrcweir         if( nTabFlags & 0x02 ) dumpUniString32( "key" );
960*cdf0e10cSrcweir         if( nTabFlags & 0x04 ) dumpUniString32( "tag" );
961*cdf0e10cSrcweir         if( nTabFlags & 0x08 ) dumpUniString32( "tooltip" );
962*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "image-id" );
963*cdf0e10cSrcweir     }
964*cdf0e10cSrcweir }
965*cdf0e10cSrcweir 
966*cdf0e10cSrcweir // ============================================================================
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir ComCtlTreeViewObject::ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
969*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E8E, 0x6AC13CB1, nVersion, true, true ),
970*cdf0e10cSrcweir     mnStringFlags( 0 )
971*cdf0e10cSrcweir {
972*cdf0e10cSrcweir }
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir void ComCtlTreeViewObject::implDumpProperties()
975*cdf0e10cSrcweir {
976*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "flags", "COMCTL-TREEVIEW-FLAGS" );
977*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "indentation", "CONV-HMM-TO-CM" );
978*cdf0e10cSrcweir     if( mnVersion == 6 )
979*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TREEVIEW-FLAGS2" );
980*cdf0e10cSrcweir     mnStringFlags = dumpHex< sal_uInt32 >( "string-flags", "COMCTL-TREEVIEW-STRINGFLAGS" );
981*cdf0e10cSrcweir }
982*cdf0e10cSrcweir 
983*cdf0e10cSrcweir void ComCtlTreeViewObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
984*cdf0e10cSrcweir {
985*cdf0e10cSrcweir     dumpOleColor( "text-color" );
986*cdf0e10cSrcweir     dumpOleColor( "back-color" );
987*cdf0e10cSrcweir     dumpUnknown( 4 );
988*cdf0e10cSrcweir     if( mnStringFlags & 0x02 )
989*cdf0e10cSrcweir         dumpUniString32( "image-list" );
990*cdf0e10cSrcweir     dumpUniString32( "path-separator" );
991*cdf0e10cSrcweir }
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir // ============================================================================
994*cdf0e10cSrcweir 
995*cdf0e10cSrcweir ComCtlStatusBarObject::ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
996*cdf0e10cSrcweir     ComCtlObjectBase( rParent, 0xE6E17E88, SAL_MAX_UINT32, nVersion, true, true )
997*cdf0e10cSrcweir {
998*cdf0e10cSrcweir }
999*cdf0e10cSrcweir 
1000*cdf0e10cSrcweir void ComCtlStatusBarObject::implDumpProperties()
1001*cdf0e10cSrcweir {
1002*cdf0e10cSrcweir     dumpBool< sal_Int32 >( "style-simple-text" );
1003*cdf0e10cSrcweir     dumpBool< sal_Int16 >( "show-tips" );
1004*cdf0e10cSrcweir     dumpUnknown( 2 );
1005*cdf0e10cSrcweir }
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir void ComCtlStatusBarObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
1008*cdf0e10cSrcweir {
1009*cdf0e10cSrcweir     dumpUnknown( 12 );
1010*cdf0e10cSrcweir     dumpUniString32( "simple-text" );
1011*cdf0e10cSrcweir     sal_Int32 nPanelCount = dumpDec< sal_Int32 >( "panel-count" );
1012*cdf0e10cSrcweir     mxOut->resetItemIndex();
1013*cdf0e10cSrcweir     for( sal_Int32 nPanelIndex = 0; (nPanelIndex < nPanelCount) && !mxStrm->isEof(); ++nPanelIndex )
1014*cdf0e10cSrcweir     {
1015*cdf0e10cSrcweir         writeEmptyItem( "#panel" );
1016*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1017*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "panel-flags", "COMCTL-STATUSBAR-PANELFLAGS" );
1018*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "current-width", "CONV-HMM-TO-CM" );
1019*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "minimal-width", "CONV-HMM-TO-CM" );
1020*cdf0e10cSrcweir         sal_uInt32 nTextFlags = dumpHex< sal_uInt32 >( "text-flags", "COMCTL-STATUSBAR-TEXTFLAGS" );
1021*cdf0e10cSrcweir         if( nTextFlags & 0x01 ) dumpUniString32( "text" );
1022*cdf0e10cSrcweir         if( nTextFlags & 0x02 ) dumpUniString32( "vis-text" );
1023*cdf0e10cSrcweir         if( nTextFlags & 0x04 ) dumpUniString32( "key" );
1024*cdf0e10cSrcweir         if( nTextFlags & 0x08 ) dumpUniString32( "tag" );
1025*cdf0e10cSrcweir         if( nTextFlags & 0x10 ) dumpUniString32( "tooltip" );
1026*cdf0e10cSrcweir     }
1027*cdf0e10cSrcweir }
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir void ComCtlStatusBarObject::implDumpCommonTrailing()
1030*cdf0e10cSrcweir {
1031*cdf0e10cSrcweir     sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
1032*cdf0e10cSrcweir     mxOut->resetItemIndex();
1033*cdf0e10cSrcweir     for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
1034*cdf0e10cSrcweir     {
1035*cdf0e10cSrcweir         writeEmptyItem( "#image" );
1036*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1037*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "panel-index" );
1038*cdf0e10cSrcweir         StdPicObject( *this ).dump();
1039*cdf0e10cSrcweir     }
1040*cdf0e10cSrcweir }
1041*cdf0e10cSrcweir 
1042*cdf0e10cSrcweir // ============================================================================
1043*cdf0e10cSrcweir // ============================================================================
1044*cdf0e10cSrcweir 
1045*cdf0e10cSrcweir void AxPropertyObjectBase::construct( const ObjectBase& rParent,
1046*cdf0e10cSrcweir         const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const String& rPropNameList, bool b64BitPropFlags )
1047*cdf0e10cSrcweir {
1048*cdf0e10cSrcweir     OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
1049*cdf0e10cSrcweir     constructAxPropObj( rPropNameList, b64BitPropFlags );
1050*cdf0e10cSrcweir }
1051*cdf0e10cSrcweir 
1052*cdf0e10cSrcweir void AxPropertyObjectBase::construct( const OutputObjectBase& rParent,
1053*cdf0e10cSrcweir         const BinaryInputStreamRef& rxStrm, const String& rPropNameList, bool b64BitPropFlags )
1054*cdf0e10cSrcweir {
1055*cdf0e10cSrcweir     OleInputObjectBase::construct( rParent, rxStrm );
1056*cdf0e10cSrcweir     constructAxPropObj( rPropNameList, b64BitPropFlags );
1057*cdf0e10cSrcweir }
1058*cdf0e10cSrcweir 
1059*cdf0e10cSrcweir void AxPropertyObjectBase::construct( const InputObjectBase& rParent,
1060*cdf0e10cSrcweir         const String& rPropNameList, bool b64BitPropFlags )
1061*cdf0e10cSrcweir {
1062*cdf0e10cSrcweir     OleInputObjectBase::construct( rParent );
1063*cdf0e10cSrcweir     constructAxPropObj( rPropNameList, b64BitPropFlags );
1064*cdf0e10cSrcweir }
1065*cdf0e10cSrcweir 
1066*cdf0e10cSrcweir bool AxPropertyObjectBase::implIsValid() const
1067*cdf0e10cSrcweir {
1068*cdf0e10cSrcweir     return OleInputObjectBase::implIsValid() && mxStrm->isSeekable();
1069*cdf0e10cSrcweir }
1070*cdf0e10cSrcweir 
1071*cdf0e10cSrcweir void AxPropertyObjectBase::implDump()
1072*cdf0e10cSrcweir {
1073*cdf0e10cSrcweir     mbValid = true;
1074*cdf0e10cSrcweir     // header
1075*cdf0e10cSrcweir     setAlignAnchor();
1076*cdf0e10cSrcweir     dumpVersion();
1077*cdf0e10cSrcweir     sal_uInt16 nSize = dumpDec< sal_uInt16 >( "size" );
1078*cdf0e10cSrcweir     mnPropertiesEnd = mxStrm->tell() + nSize;
1079*cdf0e10cSrcweir     // property flags
1080*cdf0e10cSrcweir     maLargeProps.clear();
1081*cdf0e10cSrcweir     maStreamProps.clear();
1082*cdf0e10cSrcweir     mnPropFlags = dumpHex< sal_Int64, sal_uInt32 >( mb64BitPropFlags, "properties", mxPropNames );
1083*cdf0e10cSrcweir     mnCurrProp = 0;
1084*cdf0e10cSrcweir     // properties
1085*cdf0e10cSrcweir     dumpShortProperties();
1086*cdf0e10cSrcweir     dumpLargeProperties();
1087*cdf0e10cSrcweir     setAlignAnchor();
1088*cdf0e10cSrcweir     if( ensureValid() )
1089*cdf0e10cSrcweir         implDumpExtended();
1090*cdf0e10cSrcweir }
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir void AxPropertyObjectBase::implDumpShortProperties()
1093*cdf0e10cSrcweir {
1094*cdf0e10cSrcweir }
1095*cdf0e10cSrcweir 
1096*cdf0e10cSrcweir void AxPropertyObjectBase::implDumpExtended()
1097*cdf0e10cSrcweir {
1098*cdf0e10cSrcweir }
1099*cdf0e10cSrcweir 
1100*cdf0e10cSrcweir bool AxPropertyObjectBase::ensureValid( bool bCondition )
1101*cdf0e10cSrcweir {
1102*cdf0e10cSrcweir     if( mbValid && (!bCondition || mxStrm->isEof()) )
1103*cdf0e10cSrcweir     {
1104*cdf0e10cSrcweir         if( !bCondition )
1105*cdf0e10cSrcweir             writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
1106*cdf0e10cSrcweir         mbValid = false;
1107*cdf0e10cSrcweir     }
1108*cdf0e10cSrcweir     return mbValid;
1109*cdf0e10cSrcweir }
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir void AxPropertyObjectBase::setAlignAnchor()
1112*cdf0e10cSrcweir {
1113*cdf0e10cSrcweir     mnPropertiesStart = mxStrm->tell();
1114*cdf0e10cSrcweir }
1115*cdf0e10cSrcweir 
1116*cdf0e10cSrcweir bool AxPropertyObjectBase::startNextProperty()
1117*cdf0e10cSrcweir {
1118*cdf0e10cSrcweir     if( mnCurrProp == 0 ) mnCurrProp = 1; else mnCurrProp <<= 1;
1119*cdf0e10cSrcweir     bool bHasProp = getFlag( mnPropFlags, mnCurrProp );
1120*cdf0e10cSrcweir     setFlag( mnPropFlags, mnCurrProp, false );
1121*cdf0e10cSrcweir     return ensureValid() && bHasProp;
1122*cdf0e10cSrcweir }
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir OUString AxPropertyObjectBase::getPropertyName() const
1125*cdf0e10cSrcweir {
1126*cdf0e10cSrcweir     return cfg().getName( mxPropNames, mnCurrProp );
1127*cdf0e10cSrcweir }
1128*cdf0e10cSrcweir 
1129*cdf0e10cSrcweir sal_uInt32 AxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
1130*cdf0e10cSrcweir {
1131*cdf0e10cSrcweir     if( startNextProperty() )
1132*cdf0e10cSrcweir     {
1133*cdf0e10cSrcweir         alignInput< sal_uInt32 >();
1134*cdf0e10cSrcweir         return dumpHex< sal_uInt32 >( getPropertyName(), pcNameList );
1135*cdf0e10cSrcweir     }
1136*cdf0e10cSrcweir     return nDefault;
1137*cdf0e10cSrcweir }
1138*cdf0e10cSrcweir 
1139*cdf0e10cSrcweir sal_uInt32 AxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
1140*cdf0e10cSrcweir {
1141*cdf0e10cSrcweir     if( startNextProperty() )
1142*cdf0e10cSrcweir     {
1143*cdf0e10cSrcweir         alignInput< sal_uInt32 >();
1144*cdf0e10cSrcweir         return dumpOleColor( getPropertyName() );
1145*cdf0e10cSrcweir     }
1146*cdf0e10cSrcweir     return nDefault;
1147*cdf0e10cSrcweir }
1148*cdf0e10cSrcweir 
1149*cdf0e10cSrcweir sal_Unicode AxPropertyObjectBase::dumpUnicodeProperty()
1150*cdf0e10cSrcweir {
1151*cdf0e10cSrcweir     if( startNextProperty() )
1152*cdf0e10cSrcweir     {
1153*cdf0e10cSrcweir         alignInput< sal_uInt16 >();
1154*cdf0e10cSrcweir         return dumpUnicode( getPropertyName() );
1155*cdf0e10cSrcweir     }
1156*cdf0e10cSrcweir     return '\0';
1157*cdf0e10cSrcweir }
1158*cdf0e10cSrcweir 
1159*cdf0e10cSrcweir void AxPropertyObjectBase::dumpUnknownProperty()
1160*cdf0e10cSrcweir {
1161*cdf0e10cSrcweir     if( startNextProperty() )
1162*cdf0e10cSrcweir         ensureValid( false );
1163*cdf0e10cSrcweir }
1164*cdf0e10cSrcweir 
1165*cdf0e10cSrcweir void AxPropertyObjectBase::dumpPosProperty()
1166*cdf0e10cSrcweir {
1167*cdf0e10cSrcweir     if( startNextProperty() )
1168*cdf0e10cSrcweir         maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_POS, getPropertyName(), 8 ) );
1169*cdf0e10cSrcweir }
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir void AxPropertyObjectBase::dumpSizeProperty()
1172*cdf0e10cSrcweir {
1173*cdf0e10cSrcweir     if( startNextProperty() )
1174*cdf0e10cSrcweir         maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_SIZE, getPropertyName(), 8 ) );
1175*cdf0e10cSrcweir }
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir void AxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
1178*cdf0e10cSrcweir {
1179*cdf0e10cSrcweir     if( startNextProperty() )
1180*cdf0e10cSrcweir         maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_GUID, getPropertyName(), 16, pValue ) );
1181*cdf0e10cSrcweir }
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir void AxPropertyObjectBase::dumpStringProperty( OUString* pValue )
1184*cdf0e10cSrcweir {
1185*cdf0e10cSrcweir     if( startNextProperty() )
1186*cdf0e10cSrcweir     {
1187*cdf0e10cSrcweir         alignInput< sal_uInt32 >();
1188*cdf0e10cSrcweir         sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "AX-STRINGLEN" );
1189*cdf0e10cSrcweir         maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRING, getPropertyName(), nLen, pValue ) );
1190*cdf0e10cSrcweir     }
1191*cdf0e10cSrcweir }
1192*cdf0e10cSrcweir 
1193*cdf0e10cSrcweir void AxPropertyObjectBase::dumpStringArrayProperty()
1194*cdf0e10cSrcweir {
1195*cdf0e10cSrcweir     if( startNextProperty() )
1196*cdf0e10cSrcweir     {
1197*cdf0e10cSrcweir         alignInput< sal_uInt32 >();
1198*cdf0e10cSrcweir         sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "CONV-DEC" );
1199*cdf0e10cSrcweir         maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRINGARRAY, getPropertyName(), nLen ) );
1200*cdf0e10cSrcweir     }
1201*cdf0e10cSrcweir }
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir void AxPropertyObjectBase::dumpStreamProperty()
1204*cdf0e10cSrcweir {
1205*cdf0e10cSrcweir     if( startNextProperty() )
1206*cdf0e10cSrcweir     {
1207*cdf0e10cSrcweir         alignInput< sal_uInt16 >();
1208*cdf0e10cSrcweir         sal_uInt16 nData = dumpHex< sal_uInt16 >( getPropertyName() );
1209*cdf0e10cSrcweir         maStreamProps.push_back( StreamProperty( getPropertyName(), nData ) );
1210*cdf0e10cSrcweir     }
1211*cdf0e10cSrcweir }
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir void AxPropertyObjectBase::dumpEmbeddedFont()
1214*cdf0e10cSrcweir {
1215*cdf0e10cSrcweir     if( ensureValid() )
1216*cdf0e10cSrcweir     {
1217*cdf0e10cSrcweir         writeEmptyItem( "embedded-fontdata" );
1218*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1219*cdf0e10cSrcweir         AxCFontNewObject( *this ).dump();
1220*cdf0e10cSrcweir     }
1221*cdf0e10cSrcweir }
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir void AxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
1224*cdf0e10cSrcweir {
1225*cdf0e10cSrcweir     dumpRemainingTo( nPos );
1226*cdf0e10cSrcweir     mbValid = true;
1227*cdf0e10cSrcweir     ensureValid();
1228*cdf0e10cSrcweir }
1229*cdf0e10cSrcweir 
1230*cdf0e10cSrcweir void AxPropertyObjectBase::constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags )
1231*cdf0e10cSrcweir {
1232*cdf0e10cSrcweir     if( OleInputObjectBase::implIsValid() )
1233*cdf0e10cSrcweir     {
1234*cdf0e10cSrcweir         mxPropNames = cfg().getNameList( rPropNameList );
1235*cdf0e10cSrcweir         mb64BitPropFlags = b64BitPropFlags;
1236*cdf0e10cSrcweir         mbValid = true;
1237*cdf0e10cSrcweir     }
1238*cdf0e10cSrcweir }
1239*cdf0e10cSrcweir 
1240*cdf0e10cSrcweir void AxPropertyObjectBase::dumpVersion()
1241*cdf0e10cSrcweir {
1242*cdf0e10cSrcweir     ItemGuard aItem( mxOut, "version" );
1243*cdf0e10cSrcweir     sal_uInt8 nMinor, nMajor;
1244*cdf0e10cSrcweir     *mxStrm >> nMinor >> nMajor;
1245*cdf0e10cSrcweir     mxOut->writeDec( nMajor );
1246*cdf0e10cSrcweir     mxOut->writeChar( '.' );
1247*cdf0e10cSrcweir     mxOut->writeDec( nMinor );
1248*cdf0e10cSrcweir }
1249*cdf0e10cSrcweir 
1250*cdf0e10cSrcweir OUString AxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
1251*cdf0e10cSrcweir {
1252*cdf0e10cSrcweir     bool bCompressed = getFlag( nSize, AX_STRING_COMPRESSED );
1253*cdf0e10cSrcweir     sal_uInt32 nBufSize = extractValue< sal_uInt32 >( nSize, 0, 31 );
1254*cdf0e10cSrcweir     OUString aString = bCompressed ?
1255*cdf0e10cSrcweir         dumpCharArray( rName, nBufSize, RTL_TEXTENCODING_ISO_8859_1 ) :
1256*cdf0e10cSrcweir         dumpUnicodeArray( rName, bArray ? nBufSize : (nBufSize / 2) );
1257*cdf0e10cSrcweir     alignInput< sal_Int32 >();
1258*cdf0e10cSrcweir     return aString;
1259*cdf0e10cSrcweir }
1260*cdf0e10cSrcweir 
1261*cdf0e10cSrcweir void AxPropertyObjectBase::dumpShortProperties()
1262*cdf0e10cSrcweir {
1263*cdf0e10cSrcweir     if( ensureValid() )
1264*cdf0e10cSrcweir     {
1265*cdf0e10cSrcweir         writeEmptyItem( "short-properties" );
1266*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1267*cdf0e10cSrcweir         implDumpShortProperties();
1268*cdf0e10cSrcweir         alignInput< sal_uInt32 >();
1269*cdf0e10cSrcweir     }
1270*cdf0e10cSrcweir }
1271*cdf0e10cSrcweir 
1272*cdf0e10cSrcweir void AxPropertyObjectBase::dumpLargeProperties()
1273*cdf0e10cSrcweir {
1274*cdf0e10cSrcweir     if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
1275*cdf0e10cSrcweir     {
1276*cdf0e10cSrcweir         writeEmptyItem( "large-properties" );
1277*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1278*cdf0e10cSrcweir         for( LargePropertyVector::iterator aIt = maLargeProps.begin(), aEnd = maLargeProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
1279*cdf0e10cSrcweir         {
1280*cdf0e10cSrcweir             switch( aIt->mePropType )
1281*cdf0e10cSrcweir             {
1282*cdf0e10cSrcweir                 case LargeProperty::PROPTYPE_POS:
1283*cdf0e10cSrcweir                 {
1284*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
1285*cdf0e10cSrcweir                     writeEmptyItem( aIt->maItemName );
1286*cdf0e10cSrcweir                     dumpDec< sal_Int32 >( "top", "CONV-HMM-TO-CM" );
1287*cdf0e10cSrcweir                     dumpDec< sal_Int32 >( "left", "CONV-HMM-TO-CM" );
1288*cdf0e10cSrcweir                 }
1289*cdf0e10cSrcweir                 break;
1290*cdf0e10cSrcweir                 case LargeProperty::PROPTYPE_SIZE:
1291*cdf0e10cSrcweir                 {
1292*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
1293*cdf0e10cSrcweir                     writeEmptyItem( aIt->maItemName );
1294*cdf0e10cSrcweir                     dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
1295*cdf0e10cSrcweir                     dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
1296*cdf0e10cSrcweir                 }
1297*cdf0e10cSrcweir                 break;
1298*cdf0e10cSrcweir                 case LargeProperty::PROPTYPE_GUID:
1299*cdf0e10cSrcweir                 {
1300*cdf0e10cSrcweir                     OUString aGuid = dumpGuid( aIt->maItemName );
1301*cdf0e10cSrcweir                     if( aIt->mpItemValue )
1302*cdf0e10cSrcweir                         *aIt->mpItemValue = cfg().getStringOption( aGuid, OUString() );
1303*cdf0e10cSrcweir                 }
1304*cdf0e10cSrcweir                 break;
1305*cdf0e10cSrcweir                 case LargeProperty::PROPTYPE_STRING:
1306*cdf0e10cSrcweir                 {
1307*cdf0e10cSrcweir                     OUString aString = dumpString( aIt->maItemName, aIt->mnDataSize, false );
1308*cdf0e10cSrcweir                     if( aIt->mpItemValue )
1309*cdf0e10cSrcweir                         *aIt->mpItemValue = aString;
1310*cdf0e10cSrcweir                 }
1311*cdf0e10cSrcweir                 break;
1312*cdf0e10cSrcweir                 case LargeProperty::PROPTYPE_STRINGARRAY:
1313*cdf0e10cSrcweir                 {
1314*cdf0e10cSrcweir                     writeEmptyItem( aIt->maItemName );
1315*cdf0e10cSrcweir                     IndentGuard aIndGuard2( mxOut );
1316*cdf0e10cSrcweir                     mxOut->resetItemIndex();
1317*cdf0e10cSrcweir                     sal_Int64 nEndPos = mxStrm->tell() + aIt->mnDataSize;
1318*cdf0e10cSrcweir                     while( mxStrm->tell() < nEndPos )
1319*cdf0e10cSrcweir                     {
1320*cdf0e10cSrcweir                         MultiItemsGuard aMultiGuard( mxOut );
1321*cdf0e10cSrcweir                         sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "AX-ARRAYSTRINGLEN" );
1322*cdf0e10cSrcweir                         dumpString( "string", nDataSize, true );
1323*cdf0e10cSrcweir                     }
1324*cdf0e10cSrcweir                     dumpToPosition( nEndPos );
1325*cdf0e10cSrcweir                 }
1326*cdf0e10cSrcweir                 break;
1327*cdf0e10cSrcweir             }
1328*cdf0e10cSrcweir         }
1329*cdf0e10cSrcweir     }
1330*cdf0e10cSrcweir     dumpToPosition( mnPropertiesEnd );
1331*cdf0e10cSrcweir 
1332*cdf0e10cSrcweir     if( ensureValid() && !maStreamProps.empty() )
1333*cdf0e10cSrcweir     {
1334*cdf0e10cSrcweir         writeEmptyItem( "stream-properties" );
1335*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1336*cdf0e10cSrcweir         for( StreamPropertyVector::iterator aIt = maStreamProps.begin(), aEnd = maStreamProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
1337*cdf0e10cSrcweir         {
1338*cdf0e10cSrcweir             writeEmptyItem( aIt->maItemName );
1339*cdf0e10cSrcweir             if( ensureValid( aIt->mnData == 0xFFFF ) )
1340*cdf0e10cSrcweir             {
1341*cdf0e10cSrcweir                 IndentGuard aIndGuard2( mxOut );
1342*cdf0e10cSrcweir                 OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
1343*cdf0e10cSrcweir                 if( aClassName.equalsAscii( "StdFont" ) )
1344*cdf0e10cSrcweir                     StdFontObject( *this ).dump();
1345*cdf0e10cSrcweir                 else if( aClassName.equalsAscii( "StdPic" ) )
1346*cdf0e10cSrcweir                     StdPicObject( *this ).dump();
1347*cdf0e10cSrcweir                 else if( aClassName.equalsAscii( "CFontNew" ) )
1348*cdf0e10cSrcweir                     AxCFontNewObject( *this ).dump();
1349*cdf0e10cSrcweir                 else
1350*cdf0e10cSrcweir                     ensureValid( false );
1351*cdf0e10cSrcweir             }
1352*cdf0e10cSrcweir         }
1353*cdf0e10cSrcweir     }
1354*cdf0e10cSrcweir }
1355*cdf0e10cSrcweir 
1356*cdf0e10cSrcweir // ============================================================================
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir AxCFontNewObject::AxCFontNewObject( const InputObjectBase& rParent )
1359*cdf0e10cSrcweir {
1360*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-CFONTNEW-PROPERTIES" );
1361*cdf0e10cSrcweir }
1362*cdf0e10cSrcweir 
1363*cdf0e10cSrcweir void AxCFontNewObject::implDumpShortProperties()
1364*cdf0e10cSrcweir {
1365*cdf0e10cSrcweir     dumpStringProperty();
1366*cdf0e10cSrcweir     dumpFlagsProperty( 0, "AX-CFONTNEW-FLAGS" );
1367*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 160 );
1368*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1369*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( WINDOWS_CHARSET_DEFAULT, "CHARSET" );
1370*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "FONT-PITCHFAMILY" );
1371*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 1, "AX-CFONTNEW-ALIGNMENT" );
1372*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 400, "FONT-WEIGHT" );
1373*cdf0e10cSrcweir }
1374*cdf0e10cSrcweir 
1375*cdf0e10cSrcweir // ============================================================================
1376*cdf0e10cSrcweir 
1377*cdf0e10cSrcweir AxColumnInfoObject::AxColumnInfoObject( const InputObjectBase& rParent )
1378*cdf0e10cSrcweir {
1379*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-COLUMNINFO-PROPERTIES" );
1380*cdf0e10cSrcweir }
1381*cdf0e10cSrcweir 
1382*cdf0e10cSrcweir void AxColumnInfoObject::implDumpShortProperties()
1383*cdf0e10cSrcweir {
1384*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( -1, "CONV-HMM-TO-CM" );
1385*cdf0e10cSrcweir }
1386*cdf0e10cSrcweir 
1387*cdf0e10cSrcweir // ============================================================================
1388*cdf0e10cSrcweir 
1389*cdf0e10cSrcweir AxCommandButtonObject::AxCommandButtonObject( const InputObjectBase& rParent )
1390*cdf0e10cSrcweir {
1391*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-COMMANDBUTTON-PROPERTIES" );
1392*cdf0e10cSrcweir }
1393*cdf0e10cSrcweir 
1394*cdf0e10cSrcweir void AxCommandButtonObject::implDumpShortProperties()
1395*cdf0e10cSrcweir {
1396*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1397*cdf0e10cSrcweir     dumpColorProperty( 0x80000008 );
1398*cdf0e10cSrcweir     dumpFlagsProperty( 0x0000001B );
1399*cdf0e10cSrcweir     dumpStringProperty();
1400*cdf0e10cSrcweir     dumpImagePosProperty();
1401*cdf0e10cSrcweir     dumpSizeProperty();
1402*cdf0e10cSrcweir     dumpMousePtrProperty();
1403*cdf0e10cSrcweir     dumpStreamProperty();
1404*cdf0e10cSrcweir     dumpUnicodeProperty();
1405*cdf0e10cSrcweir     dumpBoolProperty();
1406*cdf0e10cSrcweir     dumpStreamProperty();
1407*cdf0e10cSrcweir }
1408*cdf0e10cSrcweir 
1409*cdf0e10cSrcweir void AxCommandButtonObject::implDumpExtended()
1410*cdf0e10cSrcweir {
1411*cdf0e10cSrcweir     dumpEmbeddedFont();
1412*cdf0e10cSrcweir }
1413*cdf0e10cSrcweir 
1414*cdf0e10cSrcweir // ============================================================================
1415*cdf0e10cSrcweir 
1416*cdf0e10cSrcweir AxMorphControlObject::AxMorphControlObject( const InputObjectBase& rParent )
1417*cdf0e10cSrcweir {
1418*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-MORPH-PROPERTIES", true );
1419*cdf0e10cSrcweir }
1420*cdf0e10cSrcweir 
1421*cdf0e10cSrcweir void AxMorphControlObject::implDumpShortProperties()
1422*cdf0e10cSrcweir {
1423*cdf0e10cSrcweir     dumpFlagsProperty( 0x2C80081B );
1424*cdf0e10cSrcweir     dumpColorProperty( 0x80000005 );
1425*cdf0e10cSrcweir     dumpColorProperty( 0x80000008 );
1426*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1427*cdf0e10cSrcweir     dumpBorderStyleProperty< sal_uInt8 >( 0 );
1428*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SCROLLBARS" );
1429*cdf0e10cSrcweir     mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-CONTROLTYPE" );
1430*cdf0e10cSrcweir     dumpMousePtrProperty();
1431*cdf0e10cSrcweir     dumpSizeProperty();
1432*cdf0e10cSrcweir     dumpUnicodeProperty();
1433*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0, "CONV-HMM-TO-CM" );
1434*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 1, "AX-MORPH-BOUNDCOLUMN" );
1435*cdf0e10cSrcweir     dumpDecProperty< sal_Int16 >( -1, "AX-MORPH-TEXTCOLUMN" );
1436*cdf0e10cSrcweir     dumpDecProperty< sal_Int16 >( 1, "AX-MORPH-COLUMNCOUNT" );
1437*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 8 );
1438*cdf0e10cSrcweir     mnColInfoCount = dumpDecProperty< sal_uInt16 >( 1 );
1439*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 2, "AX-MORPH-MATCHENTRYTYPE" );
1440*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-LISTSTYLE" );
1441*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SHOWDROPDOWNMODE" );
1442*cdf0e10cSrcweir     dumpUnknownProperty();
1443*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-DROPDOWNSTYLE" );
1444*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SELECTIONTYPE" );
1445*cdf0e10cSrcweir     dumpStringProperty();
1446*cdf0e10cSrcweir     dumpStringProperty();
1447*cdf0e10cSrcweir     dumpImagePosProperty();
1448*cdf0e10cSrcweir     dumpColorProperty( 0x80000006 );
1449*cdf0e10cSrcweir     dumpSpecialEffectProperty< sal_uInt32 >( 2 );
1450*cdf0e10cSrcweir     dumpStreamProperty();
1451*cdf0e10cSrcweir     dumpStreamProperty();
1452*cdf0e10cSrcweir     dumpUnicodeProperty();
1453*cdf0e10cSrcweir     dumpUnknownProperty();
1454*cdf0e10cSrcweir     dumpBoolProperty();
1455*cdf0e10cSrcweir     dumpStringProperty();
1456*cdf0e10cSrcweir }
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir void AxMorphControlObject::implDumpExtended()
1459*cdf0e10cSrcweir {
1460*cdf0e10cSrcweir     dumpEmbeddedFont();
1461*cdf0e10cSrcweir     dumpColumnInfos();
1462*cdf0e10cSrcweir }
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir void AxMorphControlObject::dumpColumnInfos()
1465*cdf0e10cSrcweir {
1466*cdf0e10cSrcweir     if( ensureValid() && (mnColInfoCount > 0) && ((mnCtrlType == 2) || (mnCtrlType == 3)) )
1467*cdf0e10cSrcweir     {
1468*cdf0e10cSrcweir         mxOut->resetItemIndex();
1469*cdf0e10cSrcweir         for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < mnColInfoCount); ++nIdx )
1470*cdf0e10cSrcweir         {
1471*cdf0e10cSrcweir             writeEmptyItem( "#column-info" );
1472*cdf0e10cSrcweir             IndentGuard aIndGuard( mxOut );
1473*cdf0e10cSrcweir             AxColumnInfoObject( *this ).dump();
1474*cdf0e10cSrcweir         }
1475*cdf0e10cSrcweir     }
1476*cdf0e10cSrcweir }
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir // ============================================================================
1479*cdf0e10cSrcweir 
1480*cdf0e10cSrcweir AxLabelObject::AxLabelObject( const InputObjectBase& rParent )
1481*cdf0e10cSrcweir {
1482*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-LABEL-PROPERTIES" );
1483*cdf0e10cSrcweir }
1484*cdf0e10cSrcweir 
1485*cdf0e10cSrcweir void AxLabelObject::implDumpShortProperties()
1486*cdf0e10cSrcweir {
1487*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1488*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1489*cdf0e10cSrcweir     dumpFlagsProperty( 0x0080001B );
1490*cdf0e10cSrcweir     dumpStringProperty();
1491*cdf0e10cSrcweir     dumpImagePosProperty();
1492*cdf0e10cSrcweir     dumpSizeProperty();
1493*cdf0e10cSrcweir     dumpMousePtrProperty();
1494*cdf0e10cSrcweir     dumpColorProperty( 0x80000006 );
1495*cdf0e10cSrcweir     dumpBorderStyleProperty< sal_uInt16 >( 0 );
1496*cdf0e10cSrcweir     dumpSpecialEffectProperty< sal_uInt16 >( 0 );
1497*cdf0e10cSrcweir     dumpStreamProperty();
1498*cdf0e10cSrcweir     dumpUnicodeProperty();
1499*cdf0e10cSrcweir     dumpStreamProperty();
1500*cdf0e10cSrcweir }
1501*cdf0e10cSrcweir 
1502*cdf0e10cSrcweir void AxLabelObject::implDumpExtended()
1503*cdf0e10cSrcweir {
1504*cdf0e10cSrcweir     dumpEmbeddedFont();
1505*cdf0e10cSrcweir }
1506*cdf0e10cSrcweir 
1507*cdf0e10cSrcweir // ============================================================================
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir AxImageObject::AxImageObject( const InputObjectBase& rParent )
1510*cdf0e10cSrcweir {
1511*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-IMAGE-PROPERTIES" );
1512*cdf0e10cSrcweir }
1513*cdf0e10cSrcweir 
1514*cdf0e10cSrcweir void AxImageObject::implDumpShortProperties()
1515*cdf0e10cSrcweir {
1516*cdf0e10cSrcweir     dumpUnknownProperty();
1517*cdf0e10cSrcweir     dumpUnknownProperty();
1518*cdf0e10cSrcweir     dumpBoolProperty();
1519*cdf0e10cSrcweir     dumpColorProperty( 0x80000006 );
1520*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1521*cdf0e10cSrcweir     dumpBorderStyleProperty< sal_uInt8 >( 1 );
1522*cdf0e10cSrcweir     dumpMousePtrProperty();
1523*cdf0e10cSrcweir     dumpImageSizeModeProperty();
1524*cdf0e10cSrcweir     dumpSpecialEffectProperty< sal_uInt8 >( 0 );
1525*cdf0e10cSrcweir     dumpSizeProperty();
1526*cdf0e10cSrcweir     dumpStreamProperty();
1527*cdf0e10cSrcweir     dumpImageAlignProperty();
1528*cdf0e10cSrcweir     dumpBoolProperty();
1529*cdf0e10cSrcweir     dumpFlagsProperty( 0x0000001B );
1530*cdf0e10cSrcweir     dumpStreamProperty();
1531*cdf0e10cSrcweir }
1532*cdf0e10cSrcweir 
1533*cdf0e10cSrcweir // ============================================================================
1534*cdf0e10cSrcweir 
1535*cdf0e10cSrcweir AxScrollBarObject::AxScrollBarObject( const InputObjectBase& rParent )
1536*cdf0e10cSrcweir {
1537*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-SCROLLBAR-PROPERTIES" );
1538*cdf0e10cSrcweir }
1539*cdf0e10cSrcweir 
1540*cdf0e10cSrcweir void AxScrollBarObject::implDumpShortProperties()
1541*cdf0e10cSrcweir {
1542*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1543*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1544*cdf0e10cSrcweir     dumpFlagsProperty( 0x0000001B );
1545*cdf0e10cSrcweir     dumpSizeProperty();
1546*cdf0e10cSrcweir     dumpMousePtrProperty();
1547*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1548*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 32767 );
1549*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1550*cdf0e10cSrcweir     dumpHexProperty< sal_uInt32 >( 0 );
1551*cdf0e10cSrcweir     dumpEnabledProperty();
1552*cdf0e10cSrcweir     dumpEnabledProperty();
1553*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 1 );
1554*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 1 );
1555*cdf0e10cSrcweir     dumpOrientationProperty();
1556*cdf0e10cSrcweir     dumpDecProperty< sal_Int16 >( -1, "AX-SCROLLBAR-PROPTHUMB" );
1557*cdf0e10cSrcweir     dumpDelayProperty();
1558*cdf0e10cSrcweir     dumpStreamProperty();
1559*cdf0e10cSrcweir }
1560*cdf0e10cSrcweir 
1561*cdf0e10cSrcweir // ============================================================================
1562*cdf0e10cSrcweir 
1563*cdf0e10cSrcweir AxSpinButtonObject::AxSpinButtonObject( const InputObjectBase& rParent )
1564*cdf0e10cSrcweir {
1565*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-SPINBUTTON-PROPERTIES" );
1566*cdf0e10cSrcweir }
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir void AxSpinButtonObject::implDumpShortProperties()
1569*cdf0e10cSrcweir {
1570*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1571*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1572*cdf0e10cSrcweir     dumpFlagsProperty( 0x0000001B );
1573*cdf0e10cSrcweir     dumpSizeProperty();
1574*cdf0e10cSrcweir     dumpHexProperty< sal_uInt32 >( 0 );
1575*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1576*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 100 );
1577*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1578*cdf0e10cSrcweir     dumpEnabledProperty();
1579*cdf0e10cSrcweir     dumpEnabledProperty();
1580*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 1 );
1581*cdf0e10cSrcweir     dumpOrientationProperty();
1582*cdf0e10cSrcweir     dumpDelayProperty();
1583*cdf0e10cSrcweir     dumpStreamProperty();
1584*cdf0e10cSrcweir     dumpMousePtrProperty();
1585*cdf0e10cSrcweir }
1586*cdf0e10cSrcweir 
1587*cdf0e10cSrcweir // ============================================================================
1588*cdf0e10cSrcweir 
1589*cdf0e10cSrcweir AxTabStripObject::AxTabStripObject( const InputObjectBase& rParent )
1590*cdf0e10cSrcweir {
1591*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "AX-TABSTRIP-PROPERTIES" );
1592*cdf0e10cSrcweir }
1593*cdf0e10cSrcweir 
1594*cdf0e10cSrcweir void AxTabStripObject::implDumpShortProperties()
1595*cdf0e10cSrcweir {
1596*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( -1 );
1597*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1598*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1599*cdf0e10cSrcweir     dumpUnknownProperty();
1600*cdf0e10cSrcweir     dumpSizeProperty();
1601*cdf0e10cSrcweir     dumpStringArrayProperty();
1602*cdf0e10cSrcweir     dumpMousePtrProperty();
1603*cdf0e10cSrcweir     dumpUnknownProperty();
1604*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-ORIENTATION" );
1605*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-TABSTYLE" );
1606*cdf0e10cSrcweir     dumpBoolProperty();
1607*cdf0e10cSrcweir     dumpHmmProperty();
1608*cdf0e10cSrcweir     dumpHmmProperty();
1609*cdf0e10cSrcweir     dumpBoolProperty();
1610*cdf0e10cSrcweir     dumpUnknownProperty();
1611*cdf0e10cSrcweir     dumpStringArrayProperty();
1612*cdf0e10cSrcweir     dumpUnknownProperty();
1613*cdf0e10cSrcweir     dumpStringArrayProperty();
1614*cdf0e10cSrcweir     dumpFlagsProperty( 0x0000001B );
1615*cdf0e10cSrcweir     dumpBoolProperty();
1616*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1617*cdf0e10cSrcweir     dumpStringArrayProperty();
1618*cdf0e10cSrcweir     mnTabFlagCount = dumpDecProperty< sal_Int32 >( 0 );
1619*cdf0e10cSrcweir     dumpStringArrayProperty();
1620*cdf0e10cSrcweir     dumpStreamProperty();
1621*cdf0e10cSrcweir }
1622*cdf0e10cSrcweir 
1623*cdf0e10cSrcweir void AxTabStripObject::implDumpExtended()
1624*cdf0e10cSrcweir {
1625*cdf0e10cSrcweir     dumpEmbeddedFont();
1626*cdf0e10cSrcweir     if( mnTabFlagCount > 0 )
1627*cdf0e10cSrcweir     {
1628*cdf0e10cSrcweir         writeEmptyItem( "tab-flags" );
1629*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1630*cdf0e10cSrcweir         mxOut->resetItemIndex();
1631*cdf0e10cSrcweir         for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnTabFlagCount); ++nIdx )
1632*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "#flags", "AX-TABSTRIP-FLAGS" );
1633*cdf0e10cSrcweir     }
1634*cdf0e10cSrcweir }
1635*cdf0e10cSrcweir 
1636*cdf0e10cSrcweir // ============================================================================
1637*cdf0e10cSrcweir // ============================================================================
1638*cdf0e10cSrcweir 
1639*cdf0e10cSrcweir FormControlStreamObject::FormControlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const OUString* pProgId )
1640*cdf0e10cSrcweir {
1641*cdf0e10cSrcweir     construct( rParent, rxStrm, rSysFileName );
1642*cdf0e10cSrcweir     constructFormCtrlStrmObj( pProgId );
1643*cdf0e10cSrcweir }
1644*cdf0e10cSrcweir 
1645*cdf0e10cSrcweir FormControlStreamObject::FormControlStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString* pProgId )
1646*cdf0e10cSrcweir {
1647*cdf0e10cSrcweir     construct( rParent, rxStrm );
1648*cdf0e10cSrcweir     constructFormCtrlStrmObj( pProgId );
1649*cdf0e10cSrcweir }
1650*cdf0e10cSrcweir 
1651*cdf0e10cSrcweir void FormControlStreamObject::implDump()
1652*cdf0e10cSrcweir {
1653*cdf0e10cSrcweir     if( mbReadGuid )
1654*cdf0e10cSrcweir         maProgId = cfg().getStringOption( dumpGuid(), OUString() );
1655*cdf0e10cSrcweir 
1656*cdf0e10cSrcweir     if( (maProgId.getLength() > 0) && !mxStrm->isEof() )
1657*cdf0e10cSrcweir     {
1658*cdf0e10cSrcweir         if( maProgId.equalsAscii( "Forms.CommandButton.1" ) )
1659*cdf0e10cSrcweir             AxCommandButtonObject( *this ).dump();
1660*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.TextBox.1" ) ||
1661*cdf0e10cSrcweir                  maProgId.equalsAscii( "Forms.ListBox.1" ) ||
1662*cdf0e10cSrcweir                  maProgId.equalsAscii( "Forms.ComboBox.1" ) ||
1663*cdf0e10cSrcweir                  maProgId.equalsAscii( "Forms.CheckBox.1" ) ||
1664*cdf0e10cSrcweir                  maProgId.equalsAscii( "Forms.OptionButton.1" ) ||
1665*cdf0e10cSrcweir                  maProgId.equalsAscii( "Forms.ToggleButton.1" ) ||
1666*cdf0e10cSrcweir                  maProgId.equalsAscii( "RefEdit.Ctrl" ) )
1667*cdf0e10cSrcweir             AxMorphControlObject( *this ).dump();
1668*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.Label.1" ) )
1669*cdf0e10cSrcweir             AxLabelObject( *this ).dump();
1670*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.Image.1" ) )
1671*cdf0e10cSrcweir             AxImageObject( *this ).dump();
1672*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.ScrollBar.1" ) )
1673*cdf0e10cSrcweir             AxScrollBarObject( *this ).dump();
1674*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.SpinButton.1" ) )
1675*cdf0e10cSrcweir             AxSpinButtonObject( *this ).dump();
1676*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "Forms.TabStrip.1" ) )
1677*cdf0e10cSrcweir             AxTabStripObject( *this ).dump();
1678*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComCtl2.FlatScrollBar.2" ) )
1679*cdf0e10cSrcweir             ComCtlScrollBarObject( *this, 6 ).dump();
1680*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.ProgCtrl.1" ) )
1681*cdf0e10cSrcweir             ComCtlProgressBarObject( *this, 5 ).dump();
1682*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComctlLib.ProgCtrl.2" ) )
1683*cdf0e10cSrcweir             ComCtlProgressBarObject( *this, 6 ).dump();
1684*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.Slider.1" ) )
1685*cdf0e10cSrcweir             ComCtlSliderObject( *this, 5 ).dump();
1686*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComctlLib.Slider.2" ) )
1687*cdf0e10cSrcweir             ComCtlSliderObject( *this, 6 ).dump();
1688*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "ComCtl2.UpDown.1" ) )
1689*cdf0e10cSrcweir             ComCtlUpDownObject( *this, 5 ).dump();
1690*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComCtl2.UpDown.2" ) )
1691*cdf0e10cSrcweir             ComCtlUpDownObject( *this, 6 ).dump();
1692*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.ImageListCtrl.1" ) )
1693*cdf0e10cSrcweir             ComCtlImageListObject( *this, 5 ).dump();
1694*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComctlLib.ImageListCtrl.2" ) )
1695*cdf0e10cSrcweir             ComCtlImageListObject( *this, 6 ).dump();
1696*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.TabStrip.1" ) )
1697*cdf0e10cSrcweir             ComCtlTabStripObject( *this, 5 ).dump();
1698*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComctlLib.TabStrip.2" ) )
1699*cdf0e10cSrcweir             ComCtlTabStripObject( *this, 6 ).dump();
1700*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.TreeCtrl.1" ) )
1701*cdf0e10cSrcweir             ComCtlTreeViewObject( *this, 5 ).dump();
1702*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "MSComctlLib.TreeCtrl.2" ) )
1703*cdf0e10cSrcweir             ComCtlTreeViewObject( *this, 6 ).dump();
1704*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "COMCTL.SBarCtrl.1" ) )
1705*cdf0e10cSrcweir             ComCtlStatusBarObject( *this, 5 ).dump();
1706*cdf0e10cSrcweir         else if( maProgId.equalsAscii( "StdPic" ) )
1707*cdf0e10cSrcweir             StdPicObject( *this ).dump();
1708*cdf0e10cSrcweir     }
1709*cdf0e10cSrcweir     dumpRemainingStream();
1710*cdf0e10cSrcweir }
1711*cdf0e10cSrcweir 
1712*cdf0e10cSrcweir void FormControlStreamObject::constructFormCtrlStrmObj( const OUString* pProgId )
1713*cdf0e10cSrcweir {
1714*cdf0e10cSrcweir     mbReadGuid = pProgId == 0;
1715*cdf0e10cSrcweir     if( pProgId )
1716*cdf0e10cSrcweir         maProgId = *pProgId;
1717*cdf0e10cSrcweir }
1718*cdf0e10cSrcweir 
1719*cdf0e10cSrcweir // ============================================================================
1720*cdf0e10cSrcweir // ============================================================================
1721*cdf0e10cSrcweir 
1722*cdf0e10cSrcweir VbaFormClassInfoObject::VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
1723*cdf0e10cSrcweir     mrFormData( rFormData )
1724*cdf0e10cSrcweir {
1725*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "VBA-CLASSINFO-PROPERTIES" );
1726*cdf0e10cSrcweir }
1727*cdf0e10cSrcweir 
1728*cdf0e10cSrcweir void VbaFormClassInfoObject::implDumpShortProperties()
1729*cdf0e10cSrcweir {
1730*cdf0e10cSrcweir     mrFormData.maClassInfoProgIds.push_back( OUString() );
1731*cdf0e10cSrcweir     dumpGuidProperty( &mrFormData.maClassInfoProgIds.back() );
1732*cdf0e10cSrcweir     dumpGuidProperty();
1733*cdf0e10cSrcweir     dumpUnknownProperty();
1734*cdf0e10cSrcweir     dumpGuidProperty();
1735*cdf0e10cSrcweir     dumpFlagsProperty( 0, "VBA-CLASSINFO-FLAGS" );
1736*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1737*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( -1 );
1738*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1739*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1740*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
1741*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1742*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1743*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
1744*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( -1 );
1745*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1746*cdf0e10cSrcweir }
1747*cdf0e10cSrcweir 
1748*cdf0e10cSrcweir // ============================================================================
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir namespace {
1751*cdf0e10cSrcweir 
1752*cdf0e10cSrcweir const sal_uInt32 VBA_FORMSITE_OBJSTREAM         = 0x0010;
1753*cdf0e10cSrcweir 
1754*cdf0e10cSrcweir const sal_uInt16 VBA_FORMSITE_CLASSTABLEINDEX   = 0x8000;
1755*cdf0e10cSrcweir const sal_uInt16 VBA_FORMSITE_CLASSTABLEMASK    = 0x7FFF;
1756*cdf0e10cSrcweir 
1757*cdf0e10cSrcweir } // namespace
1758*cdf0e10cSrcweir 
1759*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1760*cdf0e10cSrcweir 
1761*cdf0e10cSrcweir VbaFormSiteObject::VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
1762*cdf0e10cSrcweir     mrFormData( rFormData )
1763*cdf0e10cSrcweir {
1764*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "VBA-FORMSITE-PROPERTIES" );
1765*cdf0e10cSrcweir }
1766*cdf0e10cSrcweir 
1767*cdf0e10cSrcweir void VbaFormSiteObject::implDumpShortProperties()
1768*cdf0e10cSrcweir {
1769*cdf0e10cSrcweir     VbaFormSiteInfo aSiteInfo;
1770*cdf0e10cSrcweir     dumpStringProperty();
1771*cdf0e10cSrcweir     dumpStringProperty();
1772*cdf0e10cSrcweir     sal_Int32 nId = dumpDecProperty< sal_Int32 >( 0 );
1773*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
1774*cdf0e10cSrcweir     sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "VBA-FORMSITE-FLAGS" );
1775*cdf0e10cSrcweir     sal_uInt32 nLength = dumpDecProperty< sal_uInt32 >( 0 );
1776*cdf0e10cSrcweir     dumpDecProperty< sal_Int16 >( -1 );
1777*cdf0e10cSrcweir     sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "VBA-FORMSITE-CLASSIDCACHE" );
1778*cdf0e10cSrcweir     dumpPosProperty();
1779*cdf0e10cSrcweir     dumpDecProperty< sal_uInt16 >( 0 );
1780*cdf0e10cSrcweir     dumpUnknownProperty();
1781*cdf0e10cSrcweir     dumpStringProperty();
1782*cdf0e10cSrcweir     dumpStringProperty();
1783*cdf0e10cSrcweir     dumpStringProperty();
1784*cdf0e10cSrcweir     dumpStringProperty();
1785*cdf0e10cSrcweir 
1786*cdf0e10cSrcweir     sal_uInt16 nIndex = nClassId & VBA_FORMSITE_CLASSTABLEMASK;
1787*cdf0e10cSrcweir     if( getFlag( nClassId, VBA_FORMSITE_CLASSTABLEINDEX ) )
1788*cdf0e10cSrcweir     {
1789*cdf0e10cSrcweir         if( nIndex < mrFormData.maClassInfoProgIds.size() )
1790*cdf0e10cSrcweir             aSiteInfo.maProgId = mrFormData.maClassInfoProgIds[ nIndex ];
1791*cdf0e10cSrcweir     }
1792*cdf0e10cSrcweir     else
1793*cdf0e10cSrcweir     {
1794*cdf0e10cSrcweir         if( cfg().hasName( "VBA-FORMSITE-CLASSNAMES", nIndex ) )
1795*cdf0e10cSrcweir             aSiteInfo.maProgId = cfg().getName( "VBA-FORMSITE-CLASSNAMES", nIndex );
1796*cdf0e10cSrcweir     }
1797*cdf0e10cSrcweir     aSiteInfo.mnId = nId;
1798*cdf0e10cSrcweir     aSiteInfo.mnLength = nLength;
1799*cdf0e10cSrcweir     aSiteInfo.mbInStream = getFlag( nFlags, VBA_FORMSITE_OBJSTREAM );
1800*cdf0e10cSrcweir 
1801*cdf0e10cSrcweir     mrFormData.maSiteInfos.push_back( aSiteInfo );
1802*cdf0e10cSrcweir }
1803*cdf0e10cSrcweir 
1804*cdf0e10cSrcweir // ============================================================================
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir VbaFormDesignExtObject::VbaFormDesignExtObject( const InputObjectBase& rParent )
1807*cdf0e10cSrcweir {
1808*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "VBA-FORMDESIGNEXT-PROPERTIES" );
1809*cdf0e10cSrcweir }
1810*cdf0e10cSrcweir 
1811*cdf0e10cSrcweir void VbaFormDesignExtObject::implDumpShortProperties()
1812*cdf0e10cSrcweir {
1813*cdf0e10cSrcweir     dumpFlagsProperty( 0x00015F55, "VBA-FORMDESIGNEXT-FLAGS" );
1814*cdf0e10cSrcweir     dumpHmmProperty();
1815*cdf0e10cSrcweir     dumpHmmProperty();
1816*cdf0e10cSrcweir     dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-CLICKCTRLMODE" );
1817*cdf0e10cSrcweir     dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
1818*cdf0e10cSrcweir }
1819*cdf0e10cSrcweir 
1820*cdf0e10cSrcweir // ============================================================================
1821*cdf0e10cSrcweir 
1822*cdf0e10cSrcweir namespace {
1823*cdf0e10cSrcweir 
1824*cdf0e10cSrcweir const sal_uInt32 AX_FORM_HASDESIGNEXTENDER      = 0x00004000;
1825*cdf0e10cSrcweir const sal_uInt32 AX_FORM_SKIPCLASSTABLE         = 0x00008000;
1826*cdf0e10cSrcweir 
1827*cdf0e10cSrcweir const sal_uInt8 AX_FORM_SITECOUNTTYPE_COUNT     = 0x80;
1828*cdf0e10cSrcweir const sal_uInt8 AX_FORM_SITECOUNTTYPE_MASK      = 0x7F;
1829*cdf0e10cSrcweir 
1830*cdf0e10cSrcweir } // namespace
1831*cdf0e10cSrcweir 
1832*cdf0e10cSrcweir // ----------------------------------------------------------------------------
1833*cdf0e10cSrcweir 
1834*cdf0e10cSrcweir VbaFStreamObject::VbaFStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
1835*cdf0e10cSrcweir     mrFormData( rFormData )
1836*cdf0e10cSrcweir {
1837*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "VBA-FORM-PROPERTIES" );
1838*cdf0e10cSrcweir }
1839*cdf0e10cSrcweir 
1840*cdf0e10cSrcweir void VbaFStreamObject::implDumpShortProperties()
1841*cdf0e10cSrcweir {
1842*cdf0e10cSrcweir     dumpUnknownProperty();
1843*cdf0e10cSrcweir     dumpColorProperty( 0x8000000F );
1844*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1845*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1846*cdf0e10cSrcweir     dumpUnknownProperty();
1847*cdf0e10cSrcweir     dumpUnknownProperty();
1848*cdf0e10cSrcweir     mnFlags = dumpFlagsProperty( 0x00000004, "VBA-FORM-FLAGS" );
1849*cdf0e10cSrcweir     dumpBorderStyleProperty< sal_uInt8 >( 0 );
1850*cdf0e10cSrcweir     dumpMousePtrProperty();
1851*cdf0e10cSrcweir     dumpHexProperty< sal_uInt8 >( 0x0C, "VBA-FORM-SCROLLBARS" );
1852*cdf0e10cSrcweir     dumpSizeProperty();
1853*cdf0e10cSrcweir     dumpSizeProperty();
1854*cdf0e10cSrcweir     dumpPosProperty();
1855*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1856*cdf0e10cSrcweir     dumpUnknownProperty();
1857*cdf0e10cSrcweir     dumpStreamProperty();
1858*cdf0e10cSrcweir     dumpDecProperty< sal_uInt8 >( 0, "VBA-FORM-CYCLE" );
1859*cdf0e10cSrcweir     dumpSpecialEffectProperty< sal_uInt8 >( 0 );
1860*cdf0e10cSrcweir     dumpColorProperty( 0x80000012 );
1861*cdf0e10cSrcweir     dumpStringProperty();
1862*cdf0e10cSrcweir     dumpStreamProperty();
1863*cdf0e10cSrcweir     dumpStreamProperty();
1864*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 100, "CONV-PERCENT" );
1865*cdf0e10cSrcweir     dumpImageAlignProperty();
1866*cdf0e10cSrcweir     dumpBoolProperty();
1867*cdf0e10cSrcweir     dumpImageSizeModeProperty();
1868*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1869*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0 );
1870*cdf0e10cSrcweir }
1871*cdf0e10cSrcweir 
1872*cdf0e10cSrcweir void VbaFStreamObject::implDumpExtended()
1873*cdf0e10cSrcweir {
1874*cdf0e10cSrcweir     dumpClassInfos();
1875*cdf0e10cSrcweir     dumpSiteData();
1876*cdf0e10cSrcweir     dumpDesignExtender();
1877*cdf0e10cSrcweir     dumpRemainingStream();
1878*cdf0e10cSrcweir }
1879*cdf0e10cSrcweir 
1880*cdf0e10cSrcweir void VbaFStreamObject::dumpClassInfos()
1881*cdf0e10cSrcweir {
1882*cdf0e10cSrcweir     if( ensureValid() && !getFlag( mnFlags, AX_FORM_SKIPCLASSTABLE ) )
1883*cdf0e10cSrcweir     {
1884*cdf0e10cSrcweir         mxOut->emptyLine();
1885*cdf0e10cSrcweir         sal_uInt16 nCount = dumpDec< sal_uInt16 >( "class-info-count" );
1886*cdf0e10cSrcweir         mxOut->resetItemIndex();
1887*cdf0e10cSrcweir         for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
1888*cdf0e10cSrcweir         {
1889*cdf0e10cSrcweir             writeEmptyItem( "#class-info" );
1890*cdf0e10cSrcweir             IndentGuard aIndGuard( mxOut );
1891*cdf0e10cSrcweir             VbaFormClassInfoObject( *this, mrFormData ).dump();
1892*cdf0e10cSrcweir         }
1893*cdf0e10cSrcweir     }
1894*cdf0e10cSrcweir }
1895*cdf0e10cSrcweir 
1896*cdf0e10cSrcweir void VbaFStreamObject::dumpFormSites( sal_uInt32 nCount )
1897*cdf0e10cSrcweir {
1898*cdf0e10cSrcweir     mxOut->resetItemIndex();
1899*cdf0e10cSrcweir     for( sal_uInt32 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
1900*cdf0e10cSrcweir     {
1901*cdf0e10cSrcweir         mxOut->emptyLine();
1902*cdf0e10cSrcweir         writeEmptyItem( "#form-site" );
1903*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1904*cdf0e10cSrcweir         VbaFormSiteObject( *this, mrFormData ).dump();
1905*cdf0e10cSrcweir     }
1906*cdf0e10cSrcweir }
1907*cdf0e10cSrcweir 
1908*cdf0e10cSrcweir void VbaFStreamObject::dumpSiteData()
1909*cdf0e10cSrcweir {
1910*cdf0e10cSrcweir     if( ensureValid() )
1911*cdf0e10cSrcweir     {
1912*cdf0e10cSrcweir         mxOut->emptyLine();
1913*cdf0e10cSrcweir         setAlignAnchor();
1914*cdf0e10cSrcweir         sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" );
1915*cdf0e10cSrcweir         sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" );
1916*cdf0e10cSrcweir         sal_Int64 nEndPos = mxStrm->tell() + nSiteLength;
1917*cdf0e10cSrcweir         if( ensureValid( nEndPos <= mxStrm->size() ) )
1918*cdf0e10cSrcweir         {
1919*cdf0e10cSrcweir             mxOut->resetItemIndex();
1920*cdf0e10cSrcweir             sal_uInt32 nSiteIdx = 0;
1921*cdf0e10cSrcweir             while( ensureValid() && (nSiteIdx < nSiteCount) )
1922*cdf0e10cSrcweir             {
1923*cdf0e10cSrcweir                 mxOut->emptyLine();
1924*cdf0e10cSrcweir                 writeEmptyItem( "#site-info" );
1925*cdf0e10cSrcweir                 IndentGuard aIndGuard( mxOut );
1926*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "depth" );
1927*cdf0e10cSrcweir                 sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "VBA-FORM-SITE-TYPECOUNT" );
1928*cdf0e10cSrcweir                 if( getFlag( nTypeCount, AX_FORM_SITECOUNTTYPE_COUNT ) )
1929*cdf0e10cSrcweir                 {
1930*cdf0e10cSrcweir                     dumpDec< sal_uInt8 >( "repeated-type" );
1931*cdf0e10cSrcweir                     nSiteIdx += (nTypeCount & AX_FORM_SITECOUNTTYPE_MASK);
1932*cdf0e10cSrcweir                 }
1933*cdf0e10cSrcweir                 else
1934*cdf0e10cSrcweir                 {
1935*cdf0e10cSrcweir                     ++nSiteIdx;
1936*cdf0e10cSrcweir                 }
1937*cdf0e10cSrcweir             }
1938*cdf0e10cSrcweir             alignInput< sal_uInt32 >();
1939*cdf0e10cSrcweir             dumpFormSites( nSiteCount );
1940*cdf0e10cSrcweir             dumpToPosition( nEndPos );
1941*cdf0e10cSrcweir         }
1942*cdf0e10cSrcweir     }
1943*cdf0e10cSrcweir }
1944*cdf0e10cSrcweir 
1945*cdf0e10cSrcweir void VbaFStreamObject::dumpDesignExtender()
1946*cdf0e10cSrcweir {
1947*cdf0e10cSrcweir     if( ensureValid() && getFlag( mnFlags, AX_FORM_HASDESIGNEXTENDER ) )
1948*cdf0e10cSrcweir     {
1949*cdf0e10cSrcweir         mxOut->emptyLine();
1950*cdf0e10cSrcweir         writeEmptyItem( "design-extender" );
1951*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1952*cdf0e10cSrcweir         VbaFormDesignExtObject( *this ).dump();
1953*cdf0e10cSrcweir     }
1954*cdf0e10cSrcweir }
1955*cdf0e10cSrcweir 
1956*cdf0e10cSrcweir // ============================================================================
1957*cdf0e10cSrcweir 
1958*cdf0e10cSrcweir VbaOStreamObject::VbaOStreamObject( const ObjectBase& rParent,
1959*cdf0e10cSrcweir         const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
1960*cdf0e10cSrcweir     mrFormData( rFormData )
1961*cdf0e10cSrcweir {
1962*cdf0e10cSrcweir     OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
1963*cdf0e10cSrcweir }
1964*cdf0e10cSrcweir 
1965*cdf0e10cSrcweir void VbaOStreamObject::implDump()
1966*cdf0e10cSrcweir {
1967*cdf0e10cSrcweir     for( VbaFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
1968*cdf0e10cSrcweir     {
1969*cdf0e10cSrcweir         if( (aIt->mbInStream) && (aIt->mnLength > 0) )
1970*cdf0e10cSrcweir         {
1971*cdf0e10cSrcweir             mxOut->emptyLine();
1972*cdf0e10cSrcweir             writeDecItem( "control-id", aIt->mnId );
1973*cdf0e10cSrcweir             writeInfoItem( "prog-id", aIt->maProgId );
1974*cdf0e10cSrcweir             IndentGuard aIndGuard( mxOut );
1975*cdf0e10cSrcweir             BinaryInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, aIt->mnLength ) );
1976*cdf0e10cSrcweir             FormControlStreamObject( *this, xRelStrm, &aIt->maProgId ).dump();
1977*cdf0e10cSrcweir         }
1978*cdf0e10cSrcweir     }
1979*cdf0e10cSrcweir     dumpRemainingStream();
1980*cdf0e10cSrcweir }
1981*cdf0e10cSrcweir 
1982*cdf0e10cSrcweir // ============================================================================
1983*cdf0e10cSrcweir 
1984*cdf0e10cSrcweir VbaPageObject::VbaPageObject( const InputObjectBase& rParent )
1985*cdf0e10cSrcweir {
1986*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "VBA-PAGE-PROPERTIES" );
1987*cdf0e10cSrcweir }
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir void VbaPageObject::implDumpShortProperties()
1990*cdf0e10cSrcweir {
1991*cdf0e10cSrcweir     dumpUnknownProperty();
1992*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0, "VBA-PAGE-TRANSITIONEFFECT" );
1993*cdf0e10cSrcweir     dumpDecProperty< sal_uInt32 >( 0, "AX-CONV-MS" );
1994*cdf0e10cSrcweir }
1995*cdf0e10cSrcweir 
1996*cdf0e10cSrcweir // ============================================================================
1997*cdf0e10cSrcweir 
1998*cdf0e10cSrcweir VbaMultiPageObject::VbaMultiPageObject( const InputObjectBase& rParent )
1999*cdf0e10cSrcweir {
2000*cdf0e10cSrcweir     AxPropertyObjectBase::construct( rParent, "VBA-MULTIPAGE-PROPERTIES" );
2001*cdf0e10cSrcweir }
2002*cdf0e10cSrcweir 
2003*cdf0e10cSrcweir void VbaMultiPageObject::implDumpShortProperties()
2004*cdf0e10cSrcweir {
2005*cdf0e10cSrcweir     dumpUnknownProperty();
2006*cdf0e10cSrcweir     mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
2007*cdf0e10cSrcweir     dumpDecProperty< sal_Int32 >( 0 );
2008*cdf0e10cSrcweir     dumpBoolProperty();
2009*cdf0e10cSrcweir }
2010*cdf0e10cSrcweir 
2011*cdf0e10cSrcweir void VbaMultiPageObject::implDumpExtended()
2012*cdf0e10cSrcweir {
2013*cdf0e10cSrcweir     if( ensureValid() && (mnPageCount > 0) )
2014*cdf0e10cSrcweir     {
2015*cdf0e10cSrcweir         writeEmptyItem( "page-ids" );
2016*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
2017*cdf0e10cSrcweir         mxOut->resetItemIndex();
2018*cdf0e10cSrcweir         for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
2019*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "#id" );
2020*cdf0e10cSrcweir     }
2021*cdf0e10cSrcweir }
2022*cdf0e10cSrcweir 
2023*cdf0e10cSrcweir // ============================================================================
2024*cdf0e10cSrcweir 
2025*cdf0e10cSrcweir VbaXStreamObject::VbaXStreamObject( const ObjectBase& rParent,
2026*cdf0e10cSrcweir         const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
2027*cdf0e10cSrcweir     mrFormData( rFormData )
2028*cdf0e10cSrcweir {
2029*cdf0e10cSrcweir     InputObjectBase::construct( rParent, rxStrm,  rSysFileName );
2030*cdf0e10cSrcweir }
2031*cdf0e10cSrcweir 
2032*cdf0e10cSrcweir void VbaXStreamObject::implDump()
2033*cdf0e10cSrcweir {
2034*cdf0e10cSrcweir     for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
2035*cdf0e10cSrcweir     {
2036*cdf0e10cSrcweir         mxOut->emptyLine();
2037*cdf0e10cSrcweir         writeEmptyItem( "page" );
2038*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
2039*cdf0e10cSrcweir         VbaPageObject( *this ).dump();
2040*cdf0e10cSrcweir     }
2041*cdf0e10cSrcweir     if( !mxStrm->isEof() )
2042*cdf0e10cSrcweir     {
2043*cdf0e10cSrcweir         mxOut->emptyLine();
2044*cdf0e10cSrcweir         writeEmptyItem( "multi-page" );
2045*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
2046*cdf0e10cSrcweir         VbaMultiPageObject( *this ).dump();
2047*cdf0e10cSrcweir     }
2048*cdf0e10cSrcweir     dumpRemainingStream();
2049*cdf0e10cSrcweir }
2050*cdf0e10cSrcweir 
2051*cdf0e10cSrcweir // ============================================================================
2052*cdf0e10cSrcweir 
2053*cdf0e10cSrcweir VbaContainerStorageObject::VbaContainerStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
2054*cdf0e10cSrcweir     OleStorageObject( rParent, rxStrg, rSysPath )
2055*cdf0e10cSrcweir {
2056*cdf0e10cSrcweir     addPreferredStream( "f" );
2057*cdf0e10cSrcweir }
2058*cdf0e10cSrcweir 
2059*cdf0e10cSrcweir void VbaContainerStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2060*cdf0e10cSrcweir {
2061*cdf0e10cSrcweir     if( rStrmName.equalsAscii( "f" ) )
2062*cdf0e10cSrcweir         VbaFStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
2063*cdf0e10cSrcweir     else if( rStrmName.equalsAscii( "o" ) )
2064*cdf0e10cSrcweir         VbaOStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
2065*cdf0e10cSrcweir     else if( rStrmName.equalsAscii( "x" ) )
2066*cdf0e10cSrcweir         VbaXStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
2067*cdf0e10cSrcweir     else
2068*cdf0e10cSrcweir         OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
2069*cdf0e10cSrcweir }
2070*cdf0e10cSrcweir 
2071*cdf0e10cSrcweir void VbaContainerStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
2072*cdf0e10cSrcweir {
2073*cdf0e10cSrcweir     if( isFormStorage( rStrgPath ) )
2074*cdf0e10cSrcweir         VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
2075*cdf0e10cSrcweir     else
2076*cdf0e10cSrcweir         OleStorageObject( *this, rxStrg, rSysPath ).dump();
2077*cdf0e10cSrcweir }
2078*cdf0e10cSrcweir 
2079*cdf0e10cSrcweir bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const
2080*cdf0e10cSrcweir {
2081*cdf0e10cSrcweir     if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
2082*cdf0e10cSrcweir     {
2083*cdf0e10cSrcweir         OUString aId = rStrgPath.copy( 1 );
2084*cdf0e10cSrcweir         if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
2085*cdf0e10cSrcweir             aId = aId.copy( 1 );
2086*cdf0e10cSrcweir         sal_Int32 nId = aId.toInt32();
2087*cdf0e10cSrcweir         if( (nId > 0) && (OUString::valueOf( nId ) == aId) )
2088*cdf0e10cSrcweir             for( VbaFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
2089*cdf0e10cSrcweir                 if( aIt->mnId == nId )
2090*cdf0e10cSrcweir                     return true;
2091*cdf0e10cSrcweir     }
2092*cdf0e10cSrcweir     return false;
2093*cdf0e10cSrcweir }
2094*cdf0e10cSrcweir 
2095*cdf0e10cSrcweir // ============================================================================
2096*cdf0e10cSrcweir // ============================================================================
2097*cdf0e10cSrcweir 
2098*cdf0e10cSrcweir VbaSharedData::VbaSharedData() :
2099*cdf0e10cSrcweir     meTextEnc( RTL_TEXTENCODING_MS_1252 )
2100*cdf0e10cSrcweir {
2101*cdf0e10cSrcweir }
2102*cdf0e10cSrcweir 
2103*cdf0e10cSrcweir bool VbaSharedData::isModuleStream( const ::rtl::OUString& rStrmName ) const
2104*cdf0e10cSrcweir {
2105*cdf0e10cSrcweir     return maStrmOffsets.count( rStrmName ) > 0;
2106*cdf0e10cSrcweir }
2107*cdf0e10cSrcweir 
2108*cdf0e10cSrcweir sal_Int32 VbaSharedData::getStreamOffset( const OUString& rStrmName ) const
2109*cdf0e10cSrcweir {
2110*cdf0e10cSrcweir     StreamOffsetMap::const_iterator aIt = maStrmOffsets.find( rStrmName );
2111*cdf0e10cSrcweir     return (aIt == maStrmOffsets.end()) ? 0 : aIt->second;
2112*cdf0e10cSrcweir }
2113*cdf0e10cSrcweir 
2114*cdf0e10cSrcweir // ============================================================================
2115*cdf0e10cSrcweir 
2116*cdf0e10cSrcweir VbaDirStreamObject::VbaDirStreamObject( const ObjectBase& rParent,
2117*cdf0e10cSrcweir         const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaSharedData& rVbaData ) :
2118*cdf0e10cSrcweir     mrVbaData( rVbaData )
2119*cdf0e10cSrcweir {
2120*cdf0e10cSrcweir     mxInStrm = rxStrm;
2121*cdf0e10cSrcweir     if( mxInStrm.get() )
2122*cdf0e10cSrcweir     {
2123*cdf0e10cSrcweir         BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxInStrm ) );
2124*cdf0e10cSrcweir         SequenceRecordObjectBase::construct( rParent, xVbaStrm, rSysFileName, "VBA-DIR-RECORD-NAMES", "VBA-DIR-SIMPLE-RECORDS" );
2125*cdf0e10cSrcweir     }
2126*cdf0e10cSrcweir }
2127*cdf0e10cSrcweir 
2128*cdf0e10cSrcweir bool VbaDirStreamObject::implIsValid() const
2129*cdf0e10cSrcweir {
2130*cdf0e10cSrcweir     return mxInStrm.get() && SequenceRecordObjectBase::implIsValid();
2131*cdf0e10cSrcweir }
2132*cdf0e10cSrcweir 
2133*cdf0e10cSrcweir bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
2134*cdf0e10cSrcweir {
2135*cdf0e10cSrcweir     ornRecId = rBaseStrm.readuInt16();
2136*cdf0e10cSrcweir     ornRecSize = rBaseStrm.readInt32();
2137*cdf0e10cSrcweir 
2138*cdf0e10cSrcweir     // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
2139*cdf0e10cSrcweir     if( ornRecId == 9 )
2140*cdf0e10cSrcweir         ornRecSize = 6;
2141*cdf0e10cSrcweir 
2142*cdf0e10cSrcweir     return !rBaseStrm.isEof();
2143*cdf0e10cSrcweir }
2144*cdf0e10cSrcweir 
2145*cdf0e10cSrcweir void VbaDirStreamObject::implDumpRecordBody()
2146*cdf0e10cSrcweir {
2147*cdf0e10cSrcweir     switch( getRecId() )
2148*cdf0e10cSrcweir     {
2149*cdf0e10cSrcweir         case 0x0003:
2150*cdf0e10cSrcweir             mrVbaData.meTextEnc = rtl_getTextEncodingFromWindowsCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
2151*cdf0e10cSrcweir         break;
2152*cdf0e10cSrcweir         case 0x0004:
2153*cdf0e10cSrcweir             dumpByteString( "name" );
2154*cdf0e10cSrcweir         break;
2155*cdf0e10cSrcweir         case 0x0005:
2156*cdf0e10cSrcweir             dumpByteString( "description" );
2157*cdf0e10cSrcweir         break;
2158*cdf0e10cSrcweir         case 0x0006:
2159*cdf0e10cSrcweir             dumpByteString( "helpfile-path" );
2160*cdf0e10cSrcweir         break;
2161*cdf0e10cSrcweir         case 0x0009:
2162*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "major" );
2163*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "minor" );
2164*cdf0e10cSrcweir         break;
2165*cdf0e10cSrcweir         case 0x000C:
2166*cdf0e10cSrcweir             dumpByteString( "constants" );
2167*cdf0e10cSrcweir         break;
2168*cdf0e10cSrcweir         case 0x000D:
2169*cdf0e10cSrcweir             dumpByteStringWithLength( "lib-id" );
2170*cdf0e10cSrcweir             dumpUnused( 6 );
2171*cdf0e10cSrcweir         break;
2172*cdf0e10cSrcweir         case 0x000E:
2173*cdf0e10cSrcweir             dumpByteStringWithLength( "lib-id-absolute" );
2174*cdf0e10cSrcweir             dumpByteStringWithLength( "lib-id-relative" );
2175*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "major" );
2176*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "minor" );
2177*cdf0e10cSrcweir         break;
2178*cdf0e10cSrcweir         case 0x0016:
2179*cdf0e10cSrcweir             dumpByteString( "name" );
2180*cdf0e10cSrcweir         break;
2181*cdf0e10cSrcweir         case 0x0019:
2182*cdf0e10cSrcweir             dumpByteString( "name" );
2183*cdf0e10cSrcweir             maCurrStream = OUString();
2184*cdf0e10cSrcweir             mnCurrOffset = 0;
2185*cdf0e10cSrcweir         break;
2186*cdf0e10cSrcweir         case 0x001A:
2187*cdf0e10cSrcweir             maCurrStream = dumpByteString( "stream-name" );
2188*cdf0e10cSrcweir         break;
2189*cdf0e10cSrcweir         case 0x001C:
2190*cdf0e10cSrcweir             dumpByteString( "description" );
2191*cdf0e10cSrcweir         break;
2192*cdf0e10cSrcweir         case 0x002B:
2193*cdf0e10cSrcweir             if( maCurrStream.getLength() > 0 )
2194*cdf0e10cSrcweir                 mrVbaData.maStrmOffsets[ maCurrStream ] = mnCurrOffset;
2195*cdf0e10cSrcweir             maCurrStream = OUString();
2196*cdf0e10cSrcweir             mnCurrOffset = 0;
2197*cdf0e10cSrcweir         break;
2198*cdf0e10cSrcweir         case 0x002F:
2199*cdf0e10cSrcweir             dumpByteStringWithLength( "lib-id-twiddled" );
2200*cdf0e10cSrcweir             dumpUnused( 6 );
2201*cdf0e10cSrcweir         break;
2202*cdf0e10cSrcweir         case 0x0030:
2203*cdf0e10cSrcweir             dumpByteStringWithLength( "lib-id-extended" );
2204*cdf0e10cSrcweir             dumpUnused( 6 );
2205*cdf0e10cSrcweir             dumpGuid( "original-typelib" );
2206*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "cookie" );
2207*cdf0e10cSrcweir         break;
2208*cdf0e10cSrcweir         case 0x0031:
2209*cdf0e10cSrcweir             mnCurrOffset = dumpHex< sal_Int32 >( "stream-offset", "CONV-DEC" );
2210*cdf0e10cSrcweir         break;
2211*cdf0e10cSrcweir         case 0x0032:
2212*cdf0e10cSrcweir             dumpUniString( "stream-name" );
2213*cdf0e10cSrcweir         break;
2214*cdf0e10cSrcweir         case 0x0033:
2215*cdf0e10cSrcweir             dumpByteString( "lib-id-original" );
2216*cdf0e10cSrcweir         break;
2217*cdf0e10cSrcweir         case 0x003C:
2218*cdf0e10cSrcweir             dumpUniString( "constants" );
2219*cdf0e10cSrcweir         break;
2220*cdf0e10cSrcweir         case 0x003D:
2221*cdf0e10cSrcweir             dumpByteString( "helpfile-path" );
2222*cdf0e10cSrcweir         break;
2223*cdf0e10cSrcweir         case 0x003E:
2224*cdf0e10cSrcweir             dumpUniString( "name" );
2225*cdf0e10cSrcweir         break;
2226*cdf0e10cSrcweir         case 0x0040:
2227*cdf0e10cSrcweir             dumpUniString( "description" );
2228*cdf0e10cSrcweir         break;
2229*cdf0e10cSrcweir         case 0x0047:
2230*cdf0e10cSrcweir             dumpUniString( "name" );
2231*cdf0e10cSrcweir         break;
2232*cdf0e10cSrcweir         case 0x0048:
2233*cdf0e10cSrcweir             dumpUniString( "description" );
2234*cdf0e10cSrcweir         break;
2235*cdf0e10cSrcweir     }
2236*cdf0e10cSrcweir }
2237*cdf0e10cSrcweir 
2238*cdf0e10cSrcweir OUString VbaDirStreamObject::dumpByteString( const String& rName )
2239*cdf0e10cSrcweir {
2240*cdf0e10cSrcweir     return dumpCharArray( rName, static_cast< sal_Int32 >( getRecSize() ), mrVbaData.meTextEnc );
2241*cdf0e10cSrcweir }
2242*cdf0e10cSrcweir 
2243*cdf0e10cSrcweir OUString VbaDirStreamObject::dumpUniString( const String& rName )
2244*cdf0e10cSrcweir {
2245*cdf0e10cSrcweir     return dumpUnicodeArray( rName, static_cast< sal_Int32 >( getRecSize() / 2 ) );
2246*cdf0e10cSrcweir }
2247*cdf0e10cSrcweir 
2248*cdf0e10cSrcweir OUString VbaDirStreamObject::dumpByteStringWithLength( const String& rName )
2249*cdf0e10cSrcweir {
2250*cdf0e10cSrcweir     return dumpCharArray( rName, mxStrm->readInt32(), mrVbaData.meTextEnc );
2251*cdf0e10cSrcweir }
2252*cdf0e10cSrcweir 
2253*cdf0e10cSrcweir // ============================================================================
2254*cdf0e10cSrcweir 
2255*cdf0e10cSrcweir VbaModuleStreamObject::VbaModuleStreamObject(
2256*cdf0e10cSrcweir         const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm,
2257*cdf0e10cSrcweir         const OUString& rSysFileName, VbaSharedData& rVbaData, sal_Int32 nStrmOffset ) :
2258*cdf0e10cSrcweir     mrVbaData( rVbaData ),
2259*cdf0e10cSrcweir     mnStrmOffset( nStrmOffset )
2260*cdf0e10cSrcweir {
2261*cdf0e10cSrcweir     InputObjectBase::construct( rParent, rxStrm, rSysFileName );
2262*cdf0e10cSrcweir }
2263*cdf0e10cSrcweir 
2264*cdf0e10cSrcweir void VbaModuleStreamObject::implDump()
2265*cdf0e10cSrcweir {
2266*cdf0e10cSrcweir     dumpBinary( "perf-cache", mnStrmOffset );
2267*cdf0e10cSrcweir     mxOut->emptyLine();
2268*cdf0e10cSrcweir     writeEmptyItem( "source-code" );
2269*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
2270*cdf0e10cSrcweir     BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxStrm ) );
2271*cdf0e10cSrcweir     TextLineStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump();
2272*cdf0e10cSrcweir }
2273*cdf0e10cSrcweir 
2274*cdf0e10cSrcweir // ============================================================================
2275*cdf0e10cSrcweir 
2276*cdf0e10cSrcweir VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
2277*cdf0e10cSrcweir     OleStorageObject( rParent, rxStrg, rSysPath ),
2278*cdf0e10cSrcweir     mrVbaData( rVbaData )
2279*cdf0e10cSrcweir {
2280*cdf0e10cSrcweir     addPreferredStream( "dir" );
2281*cdf0e10cSrcweir }
2282*cdf0e10cSrcweir 
2283*cdf0e10cSrcweir void VbaStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2284*cdf0e10cSrcweir {
2285*cdf0e10cSrcweir     if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "dir" ) )
2286*cdf0e10cSrcweir         VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump();
2287*cdf0e10cSrcweir     else if( mrVbaData.isModuleStream( rStrmName ) )
2288*cdf0e10cSrcweir         VbaModuleStreamObject( *this, rxStrm, rSysFileName, mrVbaData, mrVbaData.getStreamOffset( rStrmName ) ).dump();
2289*cdf0e10cSrcweir     else
2290*cdf0e10cSrcweir         OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
2291*cdf0e10cSrcweir }
2292*cdf0e10cSrcweir 
2293*cdf0e10cSrcweir // ============================================================================
2294*cdf0e10cSrcweir 
2295*cdf0e10cSrcweir VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
2296*cdf0e10cSrcweir     VbaContainerStorageObject( rParent, rxStrg, rSysPath ),
2297*cdf0e10cSrcweir     mrVbaData( rVbaData )
2298*cdf0e10cSrcweir {
2299*cdf0e10cSrcweir }
2300*cdf0e10cSrcweir 
2301*cdf0e10cSrcweir void VbaFormStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2302*cdf0e10cSrcweir {
2303*cdf0e10cSrcweir     if( rStrmName.equalsAscii( "\003VBFrame" ) )
2304*cdf0e10cSrcweir         TextLineStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump();
2305*cdf0e10cSrcweir     else
2306*cdf0e10cSrcweir         VbaContainerStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
2307*cdf0e10cSrcweir }
2308*cdf0e10cSrcweir 
2309*cdf0e10cSrcweir // ============================================================================
2310*cdf0e10cSrcweir 
2311*cdf0e10cSrcweir VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
2312*cdf0e10cSrcweir     OleStorageObject( rParent, rxStrg, rSysPath )
2313*cdf0e10cSrcweir {
2314*cdf0e10cSrcweir     addPreferredStorage( "VBA" );
2315*cdf0e10cSrcweir }
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir void VbaProjectStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2318*cdf0e10cSrcweir {
2319*cdf0e10cSrcweir     if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "PROJECT" ) )
2320*cdf0e10cSrcweir         TextLineStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump();
2321*cdf0e10cSrcweir     else
2322*cdf0e10cSrcweir         OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
2323*cdf0e10cSrcweir }
2324*cdf0e10cSrcweir 
2325*cdf0e10cSrcweir void VbaProjectStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
2326*cdf0e10cSrcweir {
2327*cdf0e10cSrcweir     if( rStrgPath.equalsAscii( "VBA" ) )
2328*cdf0e10cSrcweir         VbaStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
2329*cdf0e10cSrcweir     else
2330*cdf0e10cSrcweir         VbaFormStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
2331*cdf0e10cSrcweir }
2332*cdf0e10cSrcweir 
2333*cdf0e10cSrcweir // ============================================================================
2334*cdf0e10cSrcweir // ============================================================================
2335*cdf0e10cSrcweir 
2336*cdf0e10cSrcweir ActiveXStorageObject::ActiveXStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
2337*cdf0e10cSrcweir     VbaContainerStorageObject( rParent, rxStrg, rSysPath )
2338*cdf0e10cSrcweir {
2339*cdf0e10cSrcweir }
2340*cdf0e10cSrcweir 
2341*cdf0e10cSrcweir void ActiveXStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
2342*cdf0e10cSrcweir {
2343*cdf0e10cSrcweir     FormControlStreamObject( *this, rxStrm, rSysFileName ).dump();
2344*cdf0e10cSrcweir }
2345*cdf0e10cSrcweir 
2346*cdf0e10cSrcweir // ============================================================================
2347*cdf0e10cSrcweir // ============================================================================
2348*cdf0e10cSrcweir 
2349*cdf0e10cSrcweir } // namespace dump
2350*cdf0e10cSrcweir } // namespace oox
2351*cdf0e10cSrcweir 
2352*cdf0e10cSrcweir #endif
2353