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