xref: /AOO41X/main/oox/source/dump/biffdumper.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/dump/biffdumper.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <osl/thread.h>
31*cdf0e10cSrcweir #include <rtl/tencinfo.h>
32*cdf0e10cSrcweir #include "oox/core/filterbase.hxx"
33*cdf0e10cSrcweir #include "oox/dump/oledumper.hxx"
34*cdf0e10cSrcweir #include "oox/ole/olestorage.hxx"
35*cdf0e10cSrcweir #include "oox/xls/biffdetector.hxx"
36*cdf0e10cSrcweir #include "oox/xls/biffinputstream.hxx"
37*cdf0e10cSrcweir #include "oox/xls/formulabase.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #if OOX_INCLUDE_DUMPER
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir namespace oox {
42*cdf0e10cSrcweir namespace dump {
43*cdf0e10cSrcweir namespace biff {
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir // ============================================================================
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir using namespace ::com::sun::star::io;
48*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
49*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
50*cdf0e10cSrcweir using namespace ::com::sun::star::util;
51*cdf0e10cSrcweir using namespace ::oox::xls;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir using ::comphelper::MediaDescriptor;
54*cdf0e10cSrcweir using ::oox::core::FilterBase;
55*cdf0e10cSrcweir using ::rtl::OString;
56*cdf0e10cSrcweir using ::rtl::OStringBuffer;
57*cdf0e10cSrcweir using ::rtl::OStringToOUString;
58*cdf0e10cSrcweir using ::rtl::OUString;
59*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir // ============================================================================
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir namespace  {
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir // constants ------------------------------------------------------------------
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir const sal_uInt16 BIFF_FONTFLAG_BOLD         = 0x0001;
68*cdf0e10cSrcweir const sal_uInt16 BIFF_FONTFLAG_ITALIC       = 0x0002;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_GROUP         = 0;
71*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_LINE          = 1;
72*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_RECTANGLE     = 2;
73*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_OVAL          = 3;
74*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_ARC           = 4;
75*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_CHART         = 5;
76*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_TEXT          = 6;
77*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_BUTTON        = 7;
78*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_PICTURE       = 8;
79*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_POLYGON       = 9;
80*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_CHECKBOX      = 11;
81*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_OPTIONBUTTON  = 12;
82*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_EDIT          = 13;
83*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_LABEL         = 14;
84*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_DIALOG        = 15;
85*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_SPIN          = 16;
86*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_SCROLLBAR     = 17;
87*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_LISTBOX       = 18;
88*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_GROUPBOX      = 19;
89*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_DROPDOWN      = 20;
90*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_NOTE          = 25;
91*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJTYPE_DRAWING       = 30;
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJFLAGS_CONTROL      = 0x0010;   /// Form control.
94*cdf0e10cSrcweir const sal_uInt16 BIFF_OBJFLAGS_CTLSSTREAM   = 0x0020;   /// Data in Ctls stream.
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir const sal_uInt16 BIFF_STYLE_BUILTIN         = 0x8000;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir const sal_uInt16 BIFF_PT_NOSTRING           = 0xFFFF;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir // ----------------------------------------------------------------------------
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir void lclDumpDffClientPos( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm, const String& rName, sal_uInt16 nSubScale )
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( rxOut );
105*cdf0e10cSrcweir     TableGuard aTabGuard( rxOut, 17 );
106*cdf0e10cSrcweir     {
107*cdf0e10cSrcweir         sal_uInt16 nPos = rxStrm->readuInt16();
108*cdf0e10cSrcweir         ItemGuard aItem( rxOut, rName );
109*cdf0e10cSrcweir         rxOut->writeDec( nPos );
110*cdf0e10cSrcweir     }
111*cdf0e10cSrcweir     {
112*cdf0e10cSrcweir         sal_uInt16 nSubUnits = rxStrm->readuInt16();
113*cdf0e10cSrcweir         ItemGuard aItem( rxOut, "sub-units" );
114*cdf0e10cSrcweir         rxOut->writeDec( nSubUnits );
115*cdf0e10cSrcweir         rxOut->writeChar( '/' );
116*cdf0e10cSrcweir         rxOut->writeDec( nSubScale );
117*cdf0e10cSrcweir     }
118*cdf0e10cSrcweir }
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir void lclDumpDffClientRect( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     lclDumpDffClientPos( rxOut, rxStrm, "start-col", 1024 );
123*cdf0e10cSrcweir     lclDumpDffClientPos( rxOut, rxStrm, "start-row", 256 );
124*cdf0e10cSrcweir     lclDumpDffClientPos( rxOut, rxStrm, "end-col", 1024 );
125*cdf0e10cSrcweir     lclDumpDffClientPos( rxOut, rxStrm, "end-row", 256 );
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir } // namespace
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir // ============================================================================
131*cdf0e10cSrcweir // ============================================================================
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
134*cdf0e10cSrcweir {
135*cdf0e10cSrcweir     DffStreamObject::construct( rParent, rxStrm );
136*cdf0e10cSrcweir }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir void BiffDffStreamObject::implDumpClientAnchor()
139*cdf0e10cSrcweir {
140*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "DFF-CLIENTANCHOR-FLAGS" );
141*cdf0e10cSrcweir     lclDumpDffClientRect( mxOut, mxStrm );
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir // ============================================================================
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir BiffCtlsStreamObject::BiffCtlsStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir     InputObjectBase::construct( rParent, rxStrm );
149*cdf0e10cSrcweir     mnStartPos = mnLength = 0;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir void BiffCtlsStreamObject::dumpControl( sal_uInt32 nStartPos, sal_uInt32 nLength )
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir     mnStartPos = nStartPos;
155*cdf0e10cSrcweir     mnLength = nLength;
156*cdf0e10cSrcweir     dump();
157*cdf0e10cSrcweir     mnStartPos = mnLength = 0;
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir void BiffCtlsStreamObject::implDump()
161*cdf0e10cSrcweir {
162*cdf0e10cSrcweir     if( mnLength > 0 )
163*cdf0e10cSrcweir     {
164*cdf0e10cSrcweir         mxOut->emptyLine();
165*cdf0e10cSrcweir         writeEmptyItem( "CTLS-START" );
166*cdf0e10cSrcweir         {
167*cdf0e10cSrcweir             IndentGuard aIndGuard( mxOut );
168*cdf0e10cSrcweir             mxStrm->seek( mnStartPos );
169*cdf0e10cSrcweir             BinaryInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, mnLength ) );
170*cdf0e10cSrcweir             FormControlStreamObject( *this, xRelStrm ).dump();
171*cdf0e10cSrcweir         }
172*cdf0e10cSrcweir         writeEmptyItem( "CTLS-END" );
173*cdf0e10cSrcweir         mxOut->emptyLine();
174*cdf0e10cSrcweir     }
175*cdf0e10cSrcweir }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir // ============================================================================
178*cdf0e10cSrcweir // ============================================================================
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir BiffConfig::BiffConfig( const Config& rParent, BiffType eBiff ) :
181*cdf0e10cSrcweir     meBiff( eBiff )
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     Config::construct( rParent );
184*cdf0e10cSrcweir }
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir bool BiffConfig::implIsValid() const
187*cdf0e10cSrcweir {
188*cdf0e10cSrcweir     return (meBiff != BIFF_UNKNOWN) && Config::implIsValid();
189*cdf0e10cSrcweir }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir NameListRef BiffConfig::implGetNameList( const OUString& rKey ) const
192*cdf0e10cSrcweir {
193*cdf0e10cSrcweir     NameListRef xList = Config::implGetNameList( rKey );
194*cdf0e10cSrcweir     if( !xList )
195*cdf0e10cSrcweir     {
196*cdf0e10cSrcweir         OUString aBaseKey = rKey + CREATE_OUSTRING( "-BIFF" );
197*cdf0e10cSrcweir         switch( meBiff )
198*cdf0e10cSrcweir         {
199*cdf0e10cSrcweir             // fall-through intended!
200*cdf0e10cSrcweir             case BIFF8: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '8' ) ) );
201*cdf0e10cSrcweir             case BIFF5: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '5' ) ) );
202*cdf0e10cSrcweir             case BIFF4: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '4' ) ) );
203*cdf0e10cSrcweir             case BIFF3: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '3' ) ) );
204*cdf0e10cSrcweir             case BIFF2: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '2' ) ) );
205*cdf0e10cSrcweir             case BIFF_UNKNOWN: break;
206*cdf0e10cSrcweir         }
207*cdf0e10cSrcweir     }
208*cdf0e10cSrcweir     return xList;
209*cdf0e10cSrcweir }
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir // ============================================================================
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir BiffSharedData::BiffSharedData( BiffType eBiff ) :
214*cdf0e10cSrcweir     meBiff( eBiff ),
215*cdf0e10cSrcweir     meTextEnc( osl_getThreadTextEncoding() )
216*cdf0e10cSrcweir {
217*cdf0e10cSrcweir }
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir void BiffSharedData::initializePerSheet()
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir     maFontEncs.clear();
222*cdf0e10cSrcweir     maXfFontIds.clear();
223*cdf0e10cSrcweir     meTextEnc = osl_getThreadTextEncoding();
224*cdf0e10cSrcweir }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir void BiffSharedData::setTextEncoding( rtl_TextEncoding eTextEnc )
227*cdf0e10cSrcweir {
228*cdf0e10cSrcweir     if( eTextEnc != RTL_TEXTENCODING_DONTKNOW )
229*cdf0e10cSrcweir         meTextEnc = eTextEnc;
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir sal_uInt16 BiffSharedData::getFontCount() const
233*cdf0e10cSrcweir {
234*cdf0e10cSrcweir     return static_cast< sal_uInt16 >( maFontEncs.size() );
235*cdf0e10cSrcweir }
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir rtl_TextEncoding BiffSharedData::getFontEncoding( sal_uInt16 nFontId ) const
238*cdf0e10cSrcweir {
239*cdf0e10cSrcweir     return (nFontId < getFontCount()) ? maFontEncs[ nFontId ] : meTextEnc;
240*cdf0e10cSrcweir }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir void BiffSharedData::appendFontEncoding( rtl_TextEncoding eFontEnc )
243*cdf0e10cSrcweir {
244*cdf0e10cSrcweir     maFontEncs.push_back( (eFontEnc == RTL_TEXTENCODING_DONTKNOW) ? meTextEnc : eFontEnc );
245*cdf0e10cSrcweir     if( maFontEncs.size() == 4 )
246*cdf0e10cSrcweir         maFontEncs.push_back( meTextEnc );
247*cdf0e10cSrcweir }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir sal_uInt16 BiffSharedData::getXfCount() const
250*cdf0e10cSrcweir {
251*cdf0e10cSrcweir     return static_cast< sal_uInt16 >( maXfFontIds.size() );
252*cdf0e10cSrcweir }
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir rtl_TextEncoding BiffSharedData::getXfEncoding( sal_uInt16 nXfId ) const
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir     sal_uInt16 nFontId = (nXfId < getXfCount()) ? maXfFontIds[ nXfId ] : 0;
257*cdf0e10cSrcweir     return getFontEncoding( nFontId );
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir void BiffSharedData::appendXfFontId( sal_uInt16 nFontId )
261*cdf0e10cSrcweir {
262*cdf0e10cSrcweir     maXfFontIds.push_back( nFontId );
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir bool BiffSharedData::implIsValid() const
266*cdf0e10cSrcweir {
267*cdf0e10cSrcweir     return meBiff != BIFF_UNKNOWN;
268*cdf0e10cSrcweir }
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir // ============================================================================
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir BiffObjectBase::~BiffObjectBase()
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir void BiffObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
277*cdf0e10cSrcweir {
278*cdf0e10cSrcweir     if( rParent.isValid() && rxStrm.get() && (eBiff != BIFF_UNKNOWN) )
279*cdf0e10cSrcweir     {
280*cdf0e10cSrcweir         mxBiffData.reset( new BiffSharedData( eBiff ) );
281*cdf0e10cSrcweir         mxBiffStrm.reset( new BiffInputStream( *rxStrm ) );
282*cdf0e10cSrcweir         RecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
283*cdf0e10cSrcweir         if( RecordObjectBase::implIsValid() )
284*cdf0e10cSrcweir         {
285*cdf0e10cSrcweir             reconstructConfig( ConfigRef( new BiffConfig( cfg(), eBiff ) ) );
286*cdf0e10cSrcweir             mxDffObj.reset( new BiffDffStreamObject( *this, mxBiffStrm ) );
287*cdf0e10cSrcweir             if( StorageBase* pRootStrg = cfg().getRootStorage().get() )
288*cdf0e10cSrcweir             {
289*cdf0e10cSrcweir                 BinaryInputStreamRef xCtlsStrm( new BinaryXInputStream( pRootStrg->openInputStream( CREATE_OUSTRING( "Ctls" ) ), true ) );
290*cdf0e10cSrcweir                 mxCtlsObj.reset( new BiffCtlsStreamObject( *this, xCtlsStrm ) );
291*cdf0e10cSrcweir             }
292*cdf0e10cSrcweir             const Config& rCfg = cfg();
293*cdf0e10cSrcweir             mxErrCodes = rCfg.getNameList( "ERRORCODES" );
294*cdf0e10cSrcweir             mxConstType = rCfg.getNameList( "CONSTVALUE-TYPE" );
295*cdf0e10cSrcweir             mxResultType = rCfg.getNameList( "FORMULA-RESULTTYPE" );
296*cdf0e10cSrcweir             mnLastRecId = BIFF_ID_UNKNOWN;
297*cdf0e10cSrcweir             mbMergeContRec = rCfg.getBoolOption( "merge-continue-record", true );
298*cdf0e10cSrcweir         }
299*cdf0e10cSrcweir     }
300*cdf0e10cSrcweir }
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir void BiffObjectBase::construct( const BiffObjectBase& rParent )
303*cdf0e10cSrcweir {
304*cdf0e10cSrcweir     *this = rParent;
305*cdf0e10cSrcweir }
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir bool BiffObjectBase::implIsValid() const
308*cdf0e10cSrcweir {
309*cdf0e10cSrcweir     return isValid( mxBiffData ) && mxBiffStrm.get() && isValid( mxDffObj ) && InputObjectBase::implIsValid();
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
313*cdf0e10cSrcweir {
314*cdf0e10cSrcweir     // previous record
315*cdf0e10cSrcweir     mnLastRecId = mxBiffStrm->getRecId();
316*cdf0e10cSrcweir     switch( mnLastRecId )
317*cdf0e10cSrcweir     {
318*cdf0e10cSrcweir         case BIFF_ID_CHBEGIN:
319*cdf0e10cSrcweir             mxOut->incIndent();
320*cdf0e10cSrcweir         break;
321*cdf0e10cSrcweir     }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir     // start next record
324*cdf0e10cSrcweir     bool bValid = mxBiffStrm->startNextRecord();
325*cdf0e10cSrcweir     ornRecPos = mxBiffStrm->tellBase() - 4;
326*cdf0e10cSrcweir     ornRecId = mxBiffStrm->getRecId();
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir     // special CONTINUE handling
329*cdf0e10cSrcweir     mxBiffStrm->resetRecord( mbMergeContRec );
330*cdf0e10cSrcweir     if( mbMergeContRec ) switch( mxBiffStrm->getRecId() )
331*cdf0e10cSrcweir     {
332*cdf0e10cSrcweir         case BIFF_ID_OBJ:
333*cdf0e10cSrcweir         case BIFF_ID_TXO:
334*cdf0e10cSrcweir         case BIFF_ID_EOF:
335*cdf0e10cSrcweir         case BIFF_ID_CONT:
336*cdf0e10cSrcweir             mxBiffStrm->resetRecord( false );
337*cdf0e10cSrcweir         break;
338*cdf0e10cSrcweir         case BIFF_ID_MSODRAWINGGROUP:
339*cdf0e10cSrcweir         case BIFF_ID_CHESCHERFORMAT:
340*cdf0e10cSrcweir             mxBiffStrm->resetRecord( true, mxBiffStrm->getRecId() );
341*cdf0e10cSrcweir         break;
342*cdf0e10cSrcweir     }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir     // record specific settings
345*cdf0e10cSrcweir     switch( mxBiffStrm->getRecId() )
346*cdf0e10cSrcweir     {
347*cdf0e10cSrcweir         case BIFF2_ID_BOF:
348*cdf0e10cSrcweir         case BIFF3_ID_BOF:
349*cdf0e10cSrcweir         case BIFF4_ID_BOF:
350*cdf0e10cSrcweir         case BIFF5_ID_BOF:
351*cdf0e10cSrcweir         case BIFF_ID_INTERFACEHDR:
352*cdf0e10cSrcweir             mxBiffStrm->enableDecoder( false );
353*cdf0e10cSrcweir         break;
354*cdf0e10cSrcweir         case BIFF_ID_CHEND:
355*cdf0e10cSrcweir             mxOut->decIndent();
356*cdf0e10cSrcweir         break;
357*cdf0e10cSrcweir     }
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir     ornRecSize = mxBiffStrm->size();
360*cdf0e10cSrcweir     return bValid;
361*cdf0e10cSrcweir }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir OUString BiffObjectBase::getErrorName( sal_uInt8 nErrCode ) const
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir     return cfg().getName( mxErrCodes, nErrCode );
366*cdf0e10cSrcweir }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir // ----------------------------------------------------------------------------
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir sal_Int32 BiffObjectBase::readCol( bool bCol16Bit )
371*cdf0e10cSrcweir {
372*cdf0e10cSrcweir     return bCol16Bit ? mxBiffStrm->readuInt16() : mxBiffStrm->readuInt8();
373*cdf0e10cSrcweir }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir sal_Int32 BiffObjectBase::readRow( bool bRow32Bit )
376*cdf0e10cSrcweir {
377*cdf0e10cSrcweir     return bRow32Bit ? mxBiffStrm->readInt32() : mxBiffStrm->readuInt16();
378*cdf0e10cSrcweir }
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir void BiffObjectBase::readAddress( Address& orAddress, bool bCol16Bit, bool bRow32Bit )
381*cdf0e10cSrcweir {
382*cdf0e10cSrcweir     orAddress.mnRow = readRow( bRow32Bit );
383*cdf0e10cSrcweir     orAddress.mnCol = readCol( bCol16Bit );
384*cdf0e10cSrcweir }
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir void BiffObjectBase::readRange( Range& orRange, bool bCol16Bit, bool bRow32Bit )
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir     orRange.maFirst.mnRow = readRow( bRow32Bit );
389*cdf0e10cSrcweir     orRange.maLast.mnRow = readRow( bRow32Bit );
390*cdf0e10cSrcweir     orRange.maFirst.mnCol = readCol( bCol16Bit );
391*cdf0e10cSrcweir     orRange.maLast.mnCol = readCol( bCol16Bit );
392*cdf0e10cSrcweir }
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir void BiffObjectBase::readRangeList( RangeList& orRanges, bool bCol16Bit, bool bRow32Bit )
395*cdf0e10cSrcweir {
396*cdf0e10cSrcweir     sal_uInt16 nCount;
397*cdf0e10cSrcweir     *mxBiffStrm >> nCount;
398*cdf0e10cSrcweir     orRanges.resize( nCount );
399*cdf0e10cSrcweir     for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxBiffStrm->isEof() && (aIt != aEnd); ++aIt )
400*cdf0e10cSrcweir         readRange( *aIt, bCol16Bit, bRow32Bit );
401*cdf0e10cSrcweir }
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir // ----------------------------------------------------------------------------
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir void BiffObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
406*cdf0e10cSrcweir {
407*cdf0e10cSrcweir     writeDecItem( rName, nBool, "BOOLEAN" );
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir void BiffObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
411*cdf0e10cSrcweir {
412*cdf0e10cSrcweir     writeHexItem( rName, nErrCode, mxErrCodes );
413*cdf0e10cSrcweir }
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir void BiffObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
416*cdf0e10cSrcweir {
417*cdf0e10cSrcweir     if( !rPortions.empty() )
418*cdf0e10cSrcweir     {
419*cdf0e10cSrcweir         writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
420*cdf0e10cSrcweir         TableGuard aTabGuard( mxOut, 14 );
421*cdf0e10cSrcweir         for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
422*cdf0e10cSrcweir         {
423*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
424*cdf0e10cSrcweir             writeDecItem( "char-pos", aIt->mnPos );
425*cdf0e10cSrcweir             writeDecItem( "font-idx", aIt->mnFontId, "FONTNAMES" );
426*cdf0e10cSrcweir         }
427*cdf0e10cSrcweir     }
428*cdf0e10cSrcweir }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir // ----------------------------------------------------------------------------
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir OUString BiffObjectBase::dumpByteString( const String& rName, BiffStringFlags nFlags, rtl_TextEncoding eDefaultTextEnc )
433*cdf0e10cSrcweir {
434*cdf0e10cSrcweir     OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_EXTRAFONTS) ) ), "BiffObjectBase::dumpByteString - unknown flag" );
435*cdf0e10cSrcweir     bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
436*cdf0e10cSrcweir 
437*cdf0e10cSrcweir     OString aString = mxBiffStrm->readByteString( !b8BitLength, true );
438*cdf0e10cSrcweir     FontPortionModelList aPortions;
439*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
440*cdf0e10cSrcweir         aPortions.importPortions( *mxBiffStrm, false );
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir     // create string portions
443*cdf0e10cSrcweir     OUStringBuffer aBuffer;
444*cdf0e10cSrcweir     sal_Int32 nStrLen = aString.getLength();
445*cdf0e10cSrcweir     if( nStrLen > 0 )
446*cdf0e10cSrcweir     {
447*cdf0e10cSrcweir         // add leading and trailing string position to ease the following loop
448*cdf0e10cSrcweir         if( aPortions.empty() || (aPortions.front().mnPos > 0) )
449*cdf0e10cSrcweir             aPortions.insert( aPortions.begin(), FontPortionModel( 0, -1 ) );
450*cdf0e10cSrcweir         if( aPortions.back().mnPos < nStrLen )
451*cdf0e10cSrcweir             aPortions.push_back( FontPortionModel( nStrLen, -1 ) );
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir         // use global text encoding, if nothing special is specified
454*cdf0e10cSrcweir         if( eDefaultTextEnc == RTL_TEXTENCODING_DONTKNOW )
455*cdf0e10cSrcweir             eDefaultTextEnc = getBiffData().getTextEncoding();
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir         // create all string portions according to the font id vector
458*cdf0e10cSrcweir         for( FontPortionModelList::const_iterator aIt = aPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
459*cdf0e10cSrcweir         {
460*cdf0e10cSrcweir             sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
461*cdf0e10cSrcweir             if( nPortionLen > 0 )
462*cdf0e10cSrcweir             {
463*cdf0e10cSrcweir                 // convert byte string to unicode string, using current font encoding
464*cdf0e10cSrcweir                 rtl_TextEncoding eTextEnc = mxBiffData->getFontEncoding( static_cast< sal_uInt16 >( aIt->mnFontId ) );
465*cdf0e10cSrcweir                 if( eTextEnc == RTL_TEXTENCODING_DONTKNOW )
466*cdf0e10cSrcweir                     eTextEnc = eDefaultTextEnc;
467*cdf0e10cSrcweir                 aBuffer.append( OStringToOUString( aString.copy( aIt->mnPos, nPortionLen ), eTextEnc ) );
468*cdf0e10cSrcweir             }
469*cdf0e10cSrcweir         }
470*cdf0e10cSrcweir     }
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir     OUString aUniStr = aBuffer.makeStringAndClear();
473*cdf0e10cSrcweir     writeStringItem( rName( "text" ), aUniStr );
474*cdf0e10cSrcweir     return aUniStr;
475*cdf0e10cSrcweir }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFlags )
478*cdf0e10cSrcweir {
479*cdf0e10cSrcweir     OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_SMARTFLAGS) ) ), "BiffObjectBase::dumpUniString - unknown flag" );
480*cdf0e10cSrcweir     bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir     // --- string header ---
483*cdf0e10cSrcweir     sal_uInt16 nChars = b8BitLength ? mxBiffStrm->readuInt8() : mxBiffStrm->readuInt16();
484*cdf0e10cSrcweir     sal_uInt8 nFlagField = 0;
485*cdf0e10cSrcweir     if( (nChars > 0) || !getFlag( nFlags, BIFF_STR_SMARTFLAGS ) )
486*cdf0e10cSrcweir         *mxBiffStrm >> nFlagField;
487*cdf0e10cSrcweir     bool b16Bit    = getFlag( nFlagField, BIFF_STRF_16BIT );
488*cdf0e10cSrcweir     bool bFonts    = getFlag( nFlagField, BIFF_STRF_RICH );
489*cdf0e10cSrcweir     bool bPhonetic = getFlag( nFlagField, BIFF_STRF_PHONETIC );
490*cdf0e10cSrcweir     sal_uInt16 nFontCount = bFonts ? mxBiffStrm->readuInt16() : 0;
491*cdf0e10cSrcweir     sal_uInt32 nPhoneticSize = bPhonetic ? mxBiffStrm->readuInt32() : 0;
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir     // --- character array ---
494*cdf0e10cSrcweir     OUString aString = mxBiffStrm->readUniStringChars( nChars, b16Bit, true );
495*cdf0e10cSrcweir     writeStringItem( rName( "text" ), aString );
496*cdf0e10cSrcweir 
497*cdf0e10cSrcweir     // --- formatting ---
498*cdf0e10cSrcweir     // #122185# bRich flag may be set, but format runs may be missing
499*cdf0e10cSrcweir     if( nFontCount > 0 )
500*cdf0e10cSrcweir     {
501*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
502*cdf0e10cSrcweir         FontPortionModelList aPortions;
503*cdf0e10cSrcweir         aPortions.importPortions( *mxBiffStrm, nFontCount, BIFF_FONTPORTION_16BIT );
504*cdf0e10cSrcweir         writeFontPortions( aPortions );
505*cdf0e10cSrcweir     }
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir     // --- phonetic information ---
508*cdf0e10cSrcweir     // #122185# bPhonetic flag may be set, but phonetic data may be missing
509*cdf0e10cSrcweir     if( nPhoneticSize > 0 )
510*cdf0e10cSrcweir     {
511*cdf0e10cSrcweir         sal_Int64 nStrmPos = mxBiffStrm->tell();
512*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
513*cdf0e10cSrcweir         writeEmptyItem( "phonetic-data" );
514*cdf0e10cSrcweir         dumpUnused( 2 );
515*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "size" );
516*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "font-idx", "FONTNAMES" );
517*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "flags", "PHONETICPR-FLAGS" );
518*cdf0e10cSrcweir         sal_uInt16 nCount = dumpDec< sal_uInt16 >( "portion-count" );
519*cdf0e10cSrcweir         sal_uInt16 nLen = dumpDec< sal_uInt16 >( "text-len" );
520*cdf0e10cSrcweir         dumpUnicodeArray( "text", mxBiffStrm->readuInt16() );
521*cdf0e10cSrcweir         if( nLen == 0 ) dumpUnused( 2 );
522*cdf0e10cSrcweir         for( sal_uInt16 nPortion = 0; !mxBiffStrm->isEof() && (nPortion < nCount); ++nPortion )
523*cdf0e10cSrcweir         {
524*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
525*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "first-portion-char" );
526*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "first-main-char" );
527*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "main-char-count" );
528*cdf0e10cSrcweir         }
529*cdf0e10cSrcweir         dumpRemainingTo( nStrmPos + nPhoneticSize );
530*cdf0e10cSrcweir     }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir     return aString;
533*cdf0e10cSrcweir }
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir OUString BiffObjectBase::dumpString( const String& rName, BiffStringFlags nByteFlags, BiffStringFlags nUniFlags, rtl_TextEncoding eDefaultTextEnc )
536*cdf0e10cSrcweir {
537*cdf0e10cSrcweir     return (getBiff() == BIFF8) ? dumpUniString( rName, nUniFlags ) : dumpByteString( rName, nByteFlags, eDefaultTextEnc );
538*cdf0e10cSrcweir }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir OUString BiffObjectBase::dumpSegmentedUniString( const String& rName )
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir     sal_Int32 nLength = mxBiffStrm->readInt32();
543*cdf0e10cSrcweir     OUStringBuffer aBuffer;
544*cdf0e10cSrcweir     while( !mxBiffStrm->isEof() && (aBuffer.getLength() < nLength) )
545*cdf0e10cSrcweir         aBuffer.append( mxBiffStrm->readUniString() );
546*cdf0e10cSrcweir     OUString aString = aBuffer.makeStringAndClear();
547*cdf0e10cSrcweir     writeStringItem( rName, aString );
548*cdf0e10cSrcweir     return aString;
549*cdf0e10cSrcweir }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir void BiffObjectBase::dumpSegmentedUniStringArray( const String& rName )
552*cdf0e10cSrcweir {
553*cdf0e10cSrcweir     writeEmptyItem( rName );
554*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
555*cdf0e10cSrcweir     mxOut->resetItemIndex();
556*cdf0e10cSrcweir     for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !mxBiffStrm->isEof() && (nIndex < nCount); ++nIndex )
557*cdf0e10cSrcweir         dumpSegmentedUniString( "#entry" );
558*cdf0e10cSrcweir }
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir sal_uInt8 BiffObjectBase::dumpBoolean( const String& rName )
561*cdf0e10cSrcweir {
562*cdf0e10cSrcweir     sal_uInt8 nBool;
563*cdf0e10cSrcweir     *mxBiffStrm >> nBool;
564*cdf0e10cSrcweir     writeBooleanItem( rName( "boolean" ), nBool );
565*cdf0e10cSrcweir     return nBool;
566*cdf0e10cSrcweir }
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir sal_uInt8 BiffObjectBase::dumpErrorCode( const String& rName )
569*cdf0e10cSrcweir {
570*cdf0e10cSrcweir     sal_uInt8 nErrCode;
571*cdf0e10cSrcweir     *mxBiffStrm >> nErrCode;
572*cdf0e10cSrcweir     writeErrorCodeItem( rName( "error-code" ), nErrCode );
573*cdf0e10cSrcweir     return nErrCode;
574*cdf0e10cSrcweir }
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir rtl_TextEncoding BiffObjectBase::dumpCodePage( const String& rName )
577*cdf0e10cSrcweir {
578*cdf0e10cSrcweir     sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( rName( "codepage" ), "CODEPAGES" );
579*cdf0e10cSrcweir     return BiffHelper::calcTextEncodingFromCodePage( nCodePage );
580*cdf0e10cSrcweir }
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir void BiffObjectBase::dumpFormulaResult( const String& rName )
583*cdf0e10cSrcweir {
584*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
585*cdf0e10cSrcweir     sal_uInt8 pnResult[ 8 ];
586*cdf0e10cSrcweir     mxBiffStrm->readMemory( pnResult, 8 );
587*cdf0e10cSrcweir     writeArrayItem( rName( "result" ), pnResult, 8 );
588*cdf0e10cSrcweir     if( (pnResult[ 6 ] == 0xFF) && (pnResult[ 7 ] == 0xFF) )
589*cdf0e10cSrcweir     {
590*cdf0e10cSrcweir         sal_uInt8 nType = pnResult[ 0 ];
591*cdf0e10cSrcweir         sal_uInt8 nData = pnResult[ 2 ];
592*cdf0e10cSrcweir         writeHexItem( "type", nType, mxResultType );
593*cdf0e10cSrcweir         switch( nType )
594*cdf0e10cSrcweir         {
595*cdf0e10cSrcweir             case 1: writeBooleanItem( "value", nData );     break;
596*cdf0e10cSrcweir             case 2: writeErrorCodeItem( "value", nData );   break;
597*cdf0e10cSrcweir         }
598*cdf0e10cSrcweir     }
599*cdf0e10cSrcweir     else
600*cdf0e10cSrcweir     {
601*cdf0e10cSrcweir         double* pfValue = reinterpret_cast< double* >( pnResult );
602*cdf0e10cSrcweir         ByteOrderConverter::convertLittleEndian( *pfValue );
603*cdf0e10cSrcweir         writeDecItem( "value", *pfValue );
604*cdf0e10cSrcweir     }
605*cdf0e10cSrcweir }
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir sal_Int32 BiffObjectBase::dumpColIndex( const String& rName, bool bCol16Bit )
608*cdf0e10cSrcweir {
609*cdf0e10cSrcweir     sal_Int32 nCol = readCol( bCol16Bit );
610*cdf0e10cSrcweir     writeColIndexItem( rName( "col-idx" ), nCol );
611*cdf0e10cSrcweir     return nCol;
612*cdf0e10cSrcweir }
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir sal_Int32 BiffObjectBase::dumpRowIndex( const String& rName, bool bRow32Bit )
615*cdf0e10cSrcweir {
616*cdf0e10cSrcweir     sal_Int32 nRow = readRow( bRow32Bit );
617*cdf0e10cSrcweir     writeRowIndexItem( rName( "row-idx" ), nRow );
618*cdf0e10cSrcweir     return nRow;
619*cdf0e10cSrcweir }
620*cdf0e10cSrcweir 
621*cdf0e10cSrcweir sal_Int32 BiffObjectBase::dumpColRange( const String& rName, bool bCol16Bit )
622*cdf0e10cSrcweir {
623*cdf0e10cSrcweir     sal_Int32 nCol1 = readCol( bCol16Bit );
624*cdf0e10cSrcweir     sal_Int32 nCol2 = readCol( bCol16Bit );
625*cdf0e10cSrcweir     writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
626*cdf0e10cSrcweir     return nCol2 - nCol1 + 1;
627*cdf0e10cSrcweir }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir sal_Int32 BiffObjectBase::dumpRowRange( const String& rName, bool bRow32Bit )
630*cdf0e10cSrcweir {
631*cdf0e10cSrcweir     sal_Int32 nRow1 = readRow( bRow32Bit );
632*cdf0e10cSrcweir     sal_Int32 nRow2 = readRow( bRow32Bit );
633*cdf0e10cSrcweir     writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
634*cdf0e10cSrcweir     return nRow2 - nRow1 + 1;
635*cdf0e10cSrcweir }
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir Address BiffObjectBase::dumpAddress( const String& rName, bool bCol16Bit, bool bRow32Bit )
638*cdf0e10cSrcweir {
639*cdf0e10cSrcweir     Address aPos;
640*cdf0e10cSrcweir     readAddress( aPos, bCol16Bit, bRow32Bit );
641*cdf0e10cSrcweir     writeAddressItem( rName( "addr" ), aPos );
642*cdf0e10cSrcweir     return aPos;
643*cdf0e10cSrcweir }
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir Range BiffObjectBase::dumpRange( const String& rName, bool bCol16Bit, bool bRow32Bit )
646*cdf0e10cSrcweir {
647*cdf0e10cSrcweir     Range aRange;
648*cdf0e10cSrcweir     readRange( aRange, bCol16Bit, bRow32Bit );
649*cdf0e10cSrcweir     writeRangeItem( rName( "range" ), aRange );
650*cdf0e10cSrcweir     return aRange;
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir void BiffObjectBase::dumpRangeList( const String& rName, bool bCol16Bit, bool bRow32Bit )
654*cdf0e10cSrcweir {
655*cdf0e10cSrcweir     RangeList aRanges;
656*cdf0e10cSrcweir     readRangeList( aRanges, bCol16Bit, bRow32Bit );
657*cdf0e10cSrcweir     writeRangeListItem( rName( "range-list" ), aRanges );
658*cdf0e10cSrcweir }
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir void BiffObjectBase::dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows )
661*cdf0e10cSrcweir {
662*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
663*cdf0e10cSrcweir     rnCols = dumpDec< sal_uInt8 >( "width" );
664*cdf0e10cSrcweir     rnRows = dumpDec< sal_uInt16 >( "height" );
665*cdf0e10cSrcweir     switch( getBiff() )
666*cdf0e10cSrcweir     {
667*cdf0e10cSrcweir         case BIFF2:
668*cdf0e10cSrcweir         case BIFF3:
669*cdf0e10cSrcweir         case BIFF4:
670*cdf0e10cSrcweir         case BIFF5: if( rnCols == 0 ) rnCols = 256; break;
671*cdf0e10cSrcweir         case BIFF8: ++rnCols; ++rnRows;             break;
672*cdf0e10cSrcweir         case BIFF_UNKNOWN:                          break;
673*cdf0e10cSrcweir     }
674*cdf0e10cSrcweir     ItemGuard aItem( mxOut, "size" );
675*cdf0e10cSrcweir     mxOut->writeDec( rnCols );
676*cdf0e10cSrcweir     mxOut->writeChar( 'x' );
677*cdf0e10cSrcweir     mxOut->writeDec( rnRows );
678*cdf0e10cSrcweir     aItem.cont();
679*cdf0e10cSrcweir     mxOut->writeDec( rnCols * rnRows );
680*cdf0e10cSrcweir }
681*cdf0e10cSrcweir 
682*cdf0e10cSrcweir OUString BiffObjectBase::dumpConstValue( sal_Unicode cStrQuote )
683*cdf0e10cSrcweir {
684*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
685*cdf0e10cSrcweir     OUStringBuffer aValue;
686*cdf0e10cSrcweir     switch( dumpDec< sal_uInt8 >( "type", mxConstType ) )
687*cdf0e10cSrcweir     {
688*cdf0e10cSrcweir         case BIFF_DATATYPE_EMPTY:
689*cdf0e10cSrcweir             dumpUnused( 8 );
690*cdf0e10cSrcweir             aValue.append( OOX_DUMP_EMPTYVALUE );
691*cdf0e10cSrcweir         break;
692*cdf0e10cSrcweir         case BIFF_DATATYPE_DOUBLE:
693*cdf0e10cSrcweir             dumpDec< double >( "value" );
694*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
695*cdf0e10cSrcweir         break;
696*cdf0e10cSrcweir         case BIFF_DATATYPE_STRING:
697*cdf0e10cSrcweir             aValue.append( dumpString( "value", BIFF_STR_8BITLENGTH ) );
698*cdf0e10cSrcweir             StringHelper::enclose( aValue, cStrQuote );
699*cdf0e10cSrcweir         break;
700*cdf0e10cSrcweir         case BIFF_DATATYPE_BOOL:
701*cdf0e10cSrcweir             dumpBoolean( "value" );
702*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
703*cdf0e10cSrcweir             dumpUnused( 7 );
704*cdf0e10cSrcweir         break;
705*cdf0e10cSrcweir         case BIFF_DATATYPE_ERROR:
706*cdf0e10cSrcweir             dumpErrorCode( "value" );
707*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
708*cdf0e10cSrcweir             dumpUnused( 7 );
709*cdf0e10cSrcweir         break;
710*cdf0e10cSrcweir     }
711*cdf0e10cSrcweir     return aValue.makeStringAndClear();
712*cdf0e10cSrcweir }
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir sal_uInt16 BiffObjectBase::dumpRepeatedRecId()
715*cdf0e10cSrcweir {
716*cdf0e10cSrcweir     return dumpHex< sal_uInt16 >( "repeated-rec-id", getRecNames() );
717*cdf0e10cSrcweir }
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir void BiffObjectBase::dumpFrHeader( bool bWithFlags, bool bWithRange )
720*cdf0e10cSrcweir {
721*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "fr-rec-id", getRecNames() );
722*cdf0e10cSrcweir     sal_Int16 nFlags = bWithFlags ? dumpHex< sal_uInt16 >( "fr-flags", "FR-FLAGS" ) : 0x0001;
723*cdf0e10cSrcweir     if( bWithRange )
724*cdf0e10cSrcweir     {
725*cdf0e10cSrcweir         if( getFlag< sal_uInt16 >( nFlags, 0x0001 ) )
726*cdf0e10cSrcweir             dumpRange( "fr-range" );
727*cdf0e10cSrcweir         else
728*cdf0e10cSrcweir             dumpUnused( 8 );
729*cdf0e10cSrcweir     }
730*cdf0e10cSrcweir }
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir void BiffObjectBase::dumpDffClientRect()
733*cdf0e10cSrcweir {
734*cdf0e10cSrcweir     lclDumpDffClientRect( mxOut, mxStrm );
735*cdf0e10cSrcweir }
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir void BiffObjectBase::dumpEmbeddedDff()
738*cdf0e10cSrcweir {
739*cdf0e10cSrcweir     mxOut->decIndent();
740*cdf0e10cSrcweir     writeEmptyItem( "EMBEDDED-DFF-START" );
741*cdf0e10cSrcweir     mxOut->incIndent();
742*cdf0e10cSrcweir     mxDffObj->dump();
743*cdf0e10cSrcweir     mxOut->emptyLine();
744*cdf0e10cSrcweir     mxOut->decIndent();
745*cdf0e10cSrcweir     writeEmptyItem( "EMBEDDED-DFF-END" );
746*cdf0e10cSrcweir     mxOut->incIndent();
747*cdf0e10cSrcweir }
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir void BiffObjectBase::dumpControl()
750*cdf0e10cSrcweir {
751*cdf0e10cSrcweir     sal_uInt32 nStartPos = dumpHex< sal_uInt32 >( "ctls-stream-pos", "CONV-DEC" );
752*cdf0e10cSrcweir     sal_uInt32 nLength = dumpHex< sal_uInt32 >( "ctls-stream-length", "CONV-DEC" );
753*cdf0e10cSrcweir     if( isValid( mxCtlsObj ) )
754*cdf0e10cSrcweir         mxCtlsObj->dumpControl( nStartPos, nLength );
755*cdf0e10cSrcweir }
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir // ============================================================================
758*cdf0e10cSrcweir // ============================================================================
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir FormulaObject::FormulaObject( const BiffObjectBase& rParent ) :
761*cdf0e10cSrcweir     mnSize( 0 )
762*cdf0e10cSrcweir {
763*cdf0e10cSrcweir     BiffObjectBase::construct( rParent );
764*cdf0e10cSrcweir     constructFmlaObj();
765*cdf0e10cSrcweir }
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir FormulaObject::~FormulaObject()
768*cdf0e10cSrcweir {
769*cdf0e10cSrcweir }
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir sal_uInt16 FormulaObject::readFormulaSize()
772*cdf0e10cSrcweir {
773*cdf0e10cSrcweir     return (getBiff() == BIFF2) ? getBiffStream().readuInt8() : getBiffStream().readuInt16();
774*cdf0e10cSrcweir }
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir sal_uInt16 FormulaObject::dumpFormulaSize( const String& rName )
777*cdf0e10cSrcweir {
778*cdf0e10cSrcweir     sal_uInt16 nSize = readFormulaSize();
779*cdf0e10cSrcweir     writeDecItem( rName( "formula-size" ), nSize );
780*cdf0e10cSrcweir     return nSize;
781*cdf0e10cSrcweir }
782*cdf0e10cSrcweir 
783*cdf0e10cSrcweir void FormulaObject::dumpCellFormula( const String& rName, sal_uInt16 nSize )
784*cdf0e10cSrcweir {
785*cdf0e10cSrcweir     dumpFormula( rName, nSize, false );
786*cdf0e10cSrcweir }
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir void FormulaObject::dumpCellFormula( const String& rName )
789*cdf0e10cSrcweir {
790*cdf0e10cSrcweir     dumpFormula( rName, false );
791*cdf0e10cSrcweir }
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir void FormulaObject::dumpNameFormula( const String& rName, sal_uInt16 nSize )
794*cdf0e10cSrcweir {
795*cdf0e10cSrcweir     dumpFormula( rName, nSize, true );
796*cdf0e10cSrcweir }
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir void FormulaObject::dumpNameFormula( const String& rName )
799*cdf0e10cSrcweir {
800*cdf0e10cSrcweir     dumpFormula( rName, true );
801*cdf0e10cSrcweir }
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir void FormulaObject::implDump()
804*cdf0e10cSrcweir {
805*cdf0e10cSrcweir     {
806*cdf0e10cSrcweir         MultiItemsGuard aMultiGuard( mxOut );
807*cdf0e10cSrcweir         writeEmptyItem( maName );
808*cdf0e10cSrcweir         writeDecItem( "formula-size", mnSize );
809*cdf0e10cSrcweir     }
810*cdf0e10cSrcweir     if( mnSize == 0 ) return;
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir     sal_Int64 nStartPos = mxStrm->tell();
813*cdf0e10cSrcweir     sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->size() );
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir     bool bValid = mxTokens.get();
816*cdf0e10cSrcweir     mxStack.reset( new FormulaStack );
817*cdf0e10cSrcweir     maAddData.clear();
818*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
819*cdf0e10cSrcweir     {
820*cdf0e10cSrcweir         TableGuard aTabGuard( mxOut, 8, 18 );
821*cdf0e10cSrcweir         while( bValid && !mxStrm->isEof() && (mxStrm->tell() < nEndPos) )
822*cdf0e10cSrcweir         {
823*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
824*cdf0e10cSrcweir             writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
825*cdf0e10cSrcweir             sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
826*cdf0e10cSrcweir             bValid = mxTokens->hasName( nTokenId );
827*cdf0e10cSrcweir             if( bValid )
828*cdf0e10cSrcweir             {
829*cdf0e10cSrcweir                 sal_uInt8 nTokClass = nTokenId & BIFF_TOKCLASS_MASK;
830*cdf0e10cSrcweir                 sal_uInt8 nBaseId = nTokenId & BIFF_TOKID_MASK;
831*cdf0e10cSrcweir                 if( nTokClass == BIFF_TOKCLASS_NONE )
832*cdf0e10cSrcweir                 {
833*cdf0e10cSrcweir                     switch( nBaseId )
834*cdf0e10cSrcweir                     {
835*cdf0e10cSrcweir                         case BIFF_TOKID_EXP:        dumpExpToken( "EXP" );          break;
836*cdf0e10cSrcweir                         case BIFF_TOKID_TBL:        dumpExpToken( "TBL" );          break;
837*cdf0e10cSrcweir                         case BIFF_TOKID_ADD:        dumpBinaryOpToken( "+" );       break;
838*cdf0e10cSrcweir                         case BIFF_TOKID_SUB:        dumpBinaryOpToken( "-" );       break;
839*cdf0e10cSrcweir                         case BIFF_TOKID_MUL:        dumpBinaryOpToken( "*" );       break;
840*cdf0e10cSrcweir                         case BIFF_TOKID_DIV:        dumpBinaryOpToken( "/" );       break;
841*cdf0e10cSrcweir                         case BIFF_TOKID_POWER:      dumpBinaryOpToken( "^" );       break;
842*cdf0e10cSrcweir                         case BIFF_TOKID_CONCAT:     dumpBinaryOpToken( "&" );       break;
843*cdf0e10cSrcweir                         case BIFF_TOKID_LT:         dumpBinaryOpToken( "<" );       break;
844*cdf0e10cSrcweir                         case BIFF_TOKID_LE:         dumpBinaryOpToken( "<=" );      break;
845*cdf0e10cSrcweir                         case BIFF_TOKID_EQ:         dumpBinaryOpToken( "=" );       break;
846*cdf0e10cSrcweir                         case BIFF_TOKID_GE:         dumpBinaryOpToken( ">=" );      break;
847*cdf0e10cSrcweir                         case BIFF_TOKID_GT:         dumpBinaryOpToken( "<" );       break;
848*cdf0e10cSrcweir                         case BIFF_TOKID_NE:         dumpBinaryOpToken( "<>" );      break;
849*cdf0e10cSrcweir                         case BIFF_TOKID_ISECT:      dumpBinaryOpToken( " " );       break;
850*cdf0e10cSrcweir                         case BIFF_TOKID_LIST:       dumpBinaryOpToken( "," );       break;
851*cdf0e10cSrcweir                         case BIFF_TOKID_RANGE:      dumpBinaryOpToken( ":" );       break;
852*cdf0e10cSrcweir                         case BIFF_TOKID_UPLUS:      dumpUnaryOpToken( "+", "" );    break;
853*cdf0e10cSrcweir                         case BIFF_TOKID_UMINUS:     dumpUnaryOpToken( "-", "" );    break;
854*cdf0e10cSrcweir                         case BIFF_TOKID_PERCENT:    dumpUnaryOpToken( "", "%" );    break;
855*cdf0e10cSrcweir                         case BIFF_TOKID_PAREN:      dumpUnaryOpToken( "(", ")" );   break;
856*cdf0e10cSrcweir                         case BIFF_TOKID_MISSARG:    dumpMissArgToken();             break;
857*cdf0e10cSrcweir                         case BIFF_TOKID_STR:        dumpStringToken();              break;
858*cdf0e10cSrcweir                         case BIFF_TOKID_NLR:        bValid = dumpNlrToken();        break;
859*cdf0e10cSrcweir                         case BIFF_TOKID_ATTR:       bValid = dumpAttrToken();       break;
860*cdf0e10cSrcweir                         case BIFF_TOKID_SHEET:      dumpSheetToken();               break;
861*cdf0e10cSrcweir                         case BIFF_TOKID_ENDSHEET:   dumpEndSheetToken();            break;
862*cdf0e10cSrcweir                         case BIFF_TOKID_ERR:        dumpErrorToken();               break;
863*cdf0e10cSrcweir                         case BIFF_TOKID_BOOL:       dumpBoolToken();                break;
864*cdf0e10cSrcweir                         case BIFF_TOKID_INT:        dumpIntToken();                 break;
865*cdf0e10cSrcweir                         case BIFF_TOKID_NUM:        dumpDoubleToken();              break;
866*cdf0e10cSrcweir                         default:                    bValid = false;
867*cdf0e10cSrcweir                     }
868*cdf0e10cSrcweir                 }
869*cdf0e10cSrcweir                 else
870*cdf0e10cSrcweir                 {
871*cdf0e10cSrcweir                     OUString aTokClass = cfg().getName( mxClasses, nTokClass );
872*cdf0e10cSrcweir                     switch( nBaseId )
873*cdf0e10cSrcweir                     {
874*cdf0e10cSrcweir                         case BIFF_TOKID_ARRAY:      dumpArrayToken( aTokClass );                break;
875*cdf0e10cSrcweir                         case BIFF_TOKID_FUNC:       dumpFuncToken( aTokClass );                 break;
876*cdf0e10cSrcweir                         case BIFF_TOKID_FUNCVAR:    dumpFuncVarToken( aTokClass );              break;
877*cdf0e10cSrcweir                         case BIFF_TOKID_NAME:       dumpNameToken( aTokClass );                 break;
878*cdf0e10cSrcweir                         case BIFF_TOKID_REF:        dumpRefToken( aTokClass, false );           break;
879*cdf0e10cSrcweir                         case BIFF_TOKID_AREA:       dumpAreaToken( aTokClass, false );          break;
880*cdf0e10cSrcweir                         case BIFF_TOKID_MEMAREA:    dumpMemAreaToken( aTokClass, true );        break;
881*cdf0e10cSrcweir                         case BIFF_TOKID_MEMERR:     dumpMemAreaToken( aTokClass, false );       break;
882*cdf0e10cSrcweir                         case BIFF_TOKID_MEMNOMEM:   dumpMemAreaToken( aTokClass, false );       break;
883*cdf0e10cSrcweir                         case BIFF_TOKID_MEMFUNC:    dumpMemFuncToken( aTokClass );              break;
884*cdf0e10cSrcweir                         case BIFF_TOKID_REFERR:     dumpRefErrToken( aTokClass, false );        break;
885*cdf0e10cSrcweir                         case BIFF_TOKID_AREAERR:    dumpRefErrToken( aTokClass, true );         break;
886*cdf0e10cSrcweir                         case BIFF_TOKID_REFN:       dumpRefToken( aTokClass, true );            break;
887*cdf0e10cSrcweir                         case BIFF_TOKID_AREAN:      dumpAreaToken( aTokClass, true );           break;
888*cdf0e10cSrcweir                         case BIFF_TOKID_MEMAREAN:   dumpMemFuncToken( aTokClass );              break;
889*cdf0e10cSrcweir                         case BIFF_TOKID_MEMNOMEMN:  dumpMemFuncToken( aTokClass );              break;
890*cdf0e10cSrcweir                         case BIFF_TOKID_FUNCCE:     dumpCmdToken( aTokClass );                  break;
891*cdf0e10cSrcweir                         case BIFF_TOKID_NAMEX:      dumpNameXToken( aTokClass );                break;
892*cdf0e10cSrcweir                         case BIFF_TOKID_REF3D:      dumpRef3dToken( aTokClass, mbNameMode );    break;
893*cdf0e10cSrcweir                         case BIFF_TOKID_AREA3D:     dumpArea3dToken( aTokClass, mbNameMode );   break;
894*cdf0e10cSrcweir                         case BIFF_TOKID_REFERR3D:   dumpRefErr3dToken( aTokClass, false );      break;
895*cdf0e10cSrcweir                         case BIFF_TOKID_AREAERR3D:  dumpRefErr3dToken( aTokClass, true );       break;
896*cdf0e10cSrcweir                         default:                    bValid = false;
897*cdf0e10cSrcweir                     }
898*cdf0e10cSrcweir                 }
899*cdf0e10cSrcweir             }
900*cdf0e10cSrcweir         }
901*cdf0e10cSrcweir     }
902*cdf0e10cSrcweir     bValid = nEndPos == mxStrm->tell();
903*cdf0e10cSrcweir     if( bValid )
904*cdf0e10cSrcweir     {
905*cdf0e10cSrcweir         dumpAddTokenData();
906*cdf0e10cSrcweir         writeInfoItem( "formula", mxStack->getFormulaString() );
907*cdf0e10cSrcweir         writeInfoItem( "classes", mxStack->getClassesString() );
908*cdf0e10cSrcweir     }
909*cdf0e10cSrcweir     else
910*cdf0e10cSrcweir         dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), nEndPos - mxStrm->tell(), false );
911*cdf0e10cSrcweir 
912*cdf0e10cSrcweir     mnSize = 0;
913*cdf0e10cSrcweir }
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir void FormulaObject::dumpFormula( const String& rName, sal_uInt16 nSize, bool bNameMode )
916*cdf0e10cSrcweir {
917*cdf0e10cSrcweir     maName = rName( "formula" );
918*cdf0e10cSrcweir     mnSize = nSize;
919*cdf0e10cSrcweir     mbNameMode = bNameMode;
920*cdf0e10cSrcweir     dump();
921*cdf0e10cSrcweir     mnSize = 0;
922*cdf0e10cSrcweir }
923*cdf0e10cSrcweir 
924*cdf0e10cSrcweir void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
925*cdf0e10cSrcweir {
926*cdf0e10cSrcweir     dumpFormula( rName, readFormulaSize(), bNameMode );
927*cdf0e10cSrcweir }
928*cdf0e10cSrcweir 
929*cdf0e10cSrcweir // private --------------------------------------------------------------------
930*cdf0e10cSrcweir 
931*cdf0e10cSrcweir void FormulaObject::constructFmlaObj()
932*cdf0e10cSrcweir {
933*cdf0e10cSrcweir     if( BiffObjectBase::implIsValid() )
934*cdf0e10cSrcweir     {
935*cdf0e10cSrcweir         mxFuncProv.reset( new FunctionProvider( FILTER_BIFF, getBiff(), true ) );
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir         Config& rCfg = cfg();
938*cdf0e10cSrcweir         mxClasses   = rCfg.getNameList( "TOKENCLASSES" );
939*cdf0e10cSrcweir         mxRelFlags  = rCfg.getNameList( "REFRELFLAGS" );
940*cdf0e10cSrcweir         mxNlrTypes  = rCfg.getNameList( "NLRTYPES" );
941*cdf0e10cSrcweir         mxAttrTypes = rCfg.getNameList( "ATTRTYPES" );
942*cdf0e10cSrcweir         mxSpTypes   = rCfg.getNameList( "ATTRSPACETYPES" );
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir         // create classified token names
945*cdf0e10cSrcweir         mxTokens = rCfg.createNameList< ConstList >( "TOKENS" );
946*cdf0e10cSrcweir         mxTokens->includeList( rCfg.getNameList( "BASETOKENS" ) );
947*cdf0e10cSrcweir 
948*cdf0e10cSrcweir         NameListRef xClassTokens = rCfg.getNameList( "CLASSTOKENS" );
949*cdf0e10cSrcweir         if( mxClasses.get() && xClassTokens.get() )
950*cdf0e10cSrcweir             for( NameListBase::const_iterator aCIt = mxClasses->begin(), aCEnd = mxClasses->end(); aCIt != aCEnd; ++aCIt )
951*cdf0e10cSrcweir                 for( NameListBase::const_iterator aTIt = xClassTokens->begin(), aTEnd = xClassTokens->end(); aTIt != aTEnd; ++aTIt )
952*cdf0e10cSrcweir                     mxTokens->setName( aCIt->first | aTIt->first, aTIt->second + aCIt->second );
953*cdf0e10cSrcweir 
954*cdf0e10cSrcweir         mnColCount = 256;
955*cdf0e10cSrcweir         mnRowCount = (getBiff() == BIFF8) ? 65536 : 16384;
956*cdf0e10cSrcweir     }
957*cdf0e10cSrcweir }
958*cdf0e10cSrcweir 
959*cdf0e10cSrcweir // ----------------------------------------------------------------------------
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir namespace {
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir OUString lclCreateName( const OUString& rRef, sal_uInt16 nNameIdx )
964*cdf0e10cSrcweir {
965*cdf0e10cSrcweir     OUStringBuffer aName( rRef );
966*cdf0e10cSrcweir     StringHelper::appendIndexedText( aName, CREATE_OUSTRING( "NAME" ), nNameIdx );
967*cdf0e10cSrcweir     return aName.makeStringAndClear();
968*cdf0e10cSrcweir }
969*cdf0e10cSrcweir 
970*cdf0e10cSrcweir OUString lclCreateNlr( const OUString& rData, bool bRel = true )
971*cdf0e10cSrcweir {
972*cdf0e10cSrcweir     OUStringBuffer aNlr;
973*cdf0e10cSrcweir     if( !bRel ) aNlr.append( OOX_DUMP_ADDRABS );
974*cdf0e10cSrcweir     StringHelper::appendIndexedText( aNlr, CREATE_OUSTRING( "NLR" ), rData );
975*cdf0e10cSrcweir     return aNlr.makeStringAndClear();
976*cdf0e10cSrcweir }
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir OUString lclCreateNlr( const TokenAddress& rPos )
979*cdf0e10cSrcweir {
980*cdf0e10cSrcweir     OUStringBuffer aAddr;
981*cdf0e10cSrcweir     StringHelper::appendAddrCol( aAddr, rPos.mnCol, true );
982*cdf0e10cSrcweir     StringHelper::appendAddrRow( aAddr, rPos.mnRow, true );
983*cdf0e10cSrcweir     return lclCreateNlr( aAddr.makeStringAndClear(), rPos.mbRelRow );
984*cdf0e10cSrcweir }
985*cdf0e10cSrcweir 
986*cdf0e10cSrcweir } // namespace
987*cdf0e10cSrcweir 
988*cdf0e10cSrcweir // ----------------------------------------------------------------------------
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir TokenAddress FormulaObject::createTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const
991*cdf0e10cSrcweir {
992*cdf0e10cSrcweir     TokenAddress aPos;
993*cdf0e10cSrcweir     aPos.mnCol = nCol;
994*cdf0e10cSrcweir     if( bRelC && bNameMode && (nCol >= mnColCount / 2) ) aPos.mnCol -= mnColCount;
995*cdf0e10cSrcweir     aPos.mbRelCol = bRelC;
996*cdf0e10cSrcweir     aPos.mnRow = nRow;
997*cdf0e10cSrcweir     if( bRelR && bNameMode && (nRow >= mnRowCount / 2) ) aPos.mnRow -= mnRowCount;
998*cdf0e10cSrcweir     aPos.mbRelRow = bRelR;
999*cdf0e10cSrcweir     return aPos;
1000*cdf0e10cSrcweir }
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir OUString FormulaObject::createRef( const OUString& rData ) const
1003*cdf0e10cSrcweir {
1004*cdf0e10cSrcweir     return maRefPrefix + rData;
1005*cdf0e10cSrcweir }
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir OUString FormulaObject::createName( sal_uInt16 nNameIdx ) const
1008*cdf0e10cSrcweir {
1009*cdf0e10cSrcweir     return lclCreateName( maRefPrefix, nNameIdx );
1010*cdf0e10cSrcweir }
1011*cdf0e10cSrcweir 
1012*cdf0e10cSrcweir OUString FormulaObject::createPlaceHolder( size_t nIdx ) const
1013*cdf0e10cSrcweir {
1014*cdf0e10cSrcweir     OUStringBuffer aStr;
1015*cdf0e10cSrcweir     StringHelper::appendDec( aStr, static_cast< sal_uInt32 >( nIdx ) );
1016*cdf0e10cSrcweir     StringHelper::enclose( aStr, OOX_DUMP_PLACEHOLDER );
1017*cdf0e10cSrcweir     return aStr.makeStringAndClear();
1018*cdf0e10cSrcweir }
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir OUString FormulaObject::createPlaceHolder() const
1021*cdf0e10cSrcweir {
1022*cdf0e10cSrcweir     return createPlaceHolder( maAddData.size() );
1023*cdf0e10cSrcweir }
1024*cdf0e10cSrcweir 
1025*cdf0e10cSrcweir sal_uInt16 FormulaObject::readFuncId()
1026*cdf0e10cSrcweir {
1027*cdf0e10cSrcweir     return (getBiff() >= BIFF4) ? mxStrm->readuInt16() : mxStrm->readuInt8();
1028*cdf0e10cSrcweir }
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
1031*cdf0e10cSrcweir {
1032*cdf0e10cSrcweir     ItemGuard aItemGuard( mxOut, "func-id" );
1033*cdf0e10cSrcweir     writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
1034*cdf0e10cSrcweir     OUStringBuffer aBuffer;
1035*cdf0e10cSrcweir     const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiffFuncId( nFuncId );
1036*cdf0e10cSrcweir     if( pFuncInfo )
1037*cdf0e10cSrcweir         aBuffer.append( pFuncInfo->maOoxFuncName );
1038*cdf0e10cSrcweir     else
1039*cdf0e10cSrcweir     {
1040*cdf0e10cSrcweir         bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
1041*cdf0e10cSrcweir         aBuffer.appendAscii( bCmd ? "CMD" : "FUNC" );
1042*cdf0e10cSrcweir         StringHelper::appendIndex( aBuffer, nFuncId & BIFF_TOK_FUNCVAR_FUNCIDMASK );
1043*cdf0e10cSrcweir     }
1044*cdf0e10cSrcweir     OUString aFuncName = aBuffer.makeStringAndClear();
1045*cdf0e10cSrcweir     aItemGuard.cont();
1046*cdf0e10cSrcweir     mxOut->writeChar( OOX_DUMP_STRQUOTE );
1047*cdf0e10cSrcweir     mxOut->writeString( aFuncName );
1048*cdf0e10cSrcweir     mxOut->writeChar( OOX_DUMP_STRQUOTE );
1049*cdf0e10cSrcweir     if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
1050*cdf0e10cSrcweir     return aFuncName;
1051*cdf0e10cSrcweir }
1052*cdf0e10cSrcweir 
1053*cdf0e10cSrcweir sal_uInt16 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
1054*cdf0e10cSrcweir {
1055*cdf0e10cSrcweir     sal_uInt16 nCol = 0;
1056*cdf0e10cSrcweir     if( getBiff() == BIFF8 )
1057*cdf0e10cSrcweir     {
1058*cdf0e10cSrcweir         nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
1059*cdf0e10cSrcweir         rbRelC = getFlag( nCol, BIFF_TOK_REF_COLREL );
1060*cdf0e10cSrcweir         rbRelR = getFlag( nCol, BIFF_TOK_REF_ROWREL );
1061*cdf0e10cSrcweir         nCol &= BIFF_TOK_REF_COLMASK;
1062*cdf0e10cSrcweir     }
1063*cdf0e10cSrcweir     else
1064*cdf0e10cSrcweir         nCol = dumpDec< sal_uInt8 >( rName );
1065*cdf0e10cSrcweir     return nCol;
1066*cdf0e10cSrcweir }
1067*cdf0e10cSrcweir 
1068*cdf0e10cSrcweir sal_uInt16 FormulaObject::dumpTokenRow( const String& rName, bool& rbRelC, bool& rbRelR )
1069*cdf0e10cSrcweir {
1070*cdf0e10cSrcweir     sal_uInt16 nRow = 0;
1071*cdf0e10cSrcweir     if( getBiff() == BIFF8 )
1072*cdf0e10cSrcweir         nRow = dumpDec< sal_uInt16 >( rName );
1073*cdf0e10cSrcweir     else
1074*cdf0e10cSrcweir     {
1075*cdf0e10cSrcweir         nRow = dumpHex< sal_uInt16 >( rName, mxRelFlags );
1076*cdf0e10cSrcweir         rbRelC = getFlag( nRow, BIFF_TOK_REF_COLREL );
1077*cdf0e10cSrcweir         rbRelR = getFlag( nRow, BIFF_TOK_REF_ROWREL );
1078*cdf0e10cSrcweir         nRow &= BIFF_TOK_REF_ROWMASK;
1079*cdf0e10cSrcweir     }
1080*cdf0e10cSrcweir     return nRow;
1081*cdf0e10cSrcweir }
1082*cdf0e10cSrcweir 
1083*cdf0e10cSrcweir TokenAddress FormulaObject::dumpTokenAddress( bool bNameMode )
1084*cdf0e10cSrcweir {
1085*cdf0e10cSrcweir     bool bRelC = false;
1086*cdf0e10cSrcweir     bool bRelR = false;
1087*cdf0e10cSrcweir     sal_uInt16 nRow = dumpTokenRow( "row", bRelC, bRelR );
1088*cdf0e10cSrcweir     sal_uInt16 nCol = dumpTokenCol( "col", bRelC, bRelR );
1089*cdf0e10cSrcweir     return createTokenAddress( nCol, nRow, bRelC, bRelR, bNameMode );
1090*cdf0e10cSrcweir }
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir TokenRange FormulaObject::dumpTokenRange( bool bNameMode )
1093*cdf0e10cSrcweir {
1094*cdf0e10cSrcweir     bool bRelC1 = false;
1095*cdf0e10cSrcweir     bool bRelR1 = false;
1096*cdf0e10cSrcweir     bool bRelC2 = false;
1097*cdf0e10cSrcweir     bool bRelR2 = false;
1098*cdf0e10cSrcweir     sal_uInt16 nRow1 = dumpTokenRow( "row1", bRelC1, bRelR1 );
1099*cdf0e10cSrcweir     sal_uInt16 nRow2 = dumpTokenRow( "row2", bRelC2, bRelR2 );
1100*cdf0e10cSrcweir     sal_uInt16 nCol1 = dumpTokenCol( "col1", bRelC1, bRelR1 );
1101*cdf0e10cSrcweir     sal_uInt16 nCol2 = dumpTokenCol( "col2", bRelC2, bRelR2 );
1102*cdf0e10cSrcweir     TokenRange aRange;
1103*cdf0e10cSrcweir     aRange.maFirst = createTokenAddress( nCol1, nRow1, bRelC1, bRelR1, bNameMode );
1104*cdf0e10cSrcweir     aRange.maLast  = createTokenAddress( nCol2, nRow2, bRelC2, bRelR2, bNameMode );
1105*cdf0e10cSrcweir     return aRange;
1106*cdf0e10cSrcweir }
1107*cdf0e10cSrcweir 
1108*cdf0e10cSrcweir sal_Int16 FormulaObject::readTokenRefIdx()
1109*cdf0e10cSrcweir {
1110*cdf0e10cSrcweir     sal_Int16 nRefIdx = dumpDec< sal_Int16 >( "ref-idx" );
1111*cdf0e10cSrcweir     switch( getBiff() )
1112*cdf0e10cSrcweir     {
1113*cdf0e10cSrcweir         case BIFF2: dumpUnused( 1 );    break;
1114*cdf0e10cSrcweir         case BIFF3: dumpUnused( 2 );    break;
1115*cdf0e10cSrcweir         case BIFF4: dumpUnused( 2 );    break;
1116*cdf0e10cSrcweir         case BIFF5: dumpUnused( 8 );    break;
1117*cdf0e10cSrcweir         case BIFF8:                     break;
1118*cdf0e10cSrcweir         case BIFF_UNKNOWN:              break;
1119*cdf0e10cSrcweir     }
1120*cdf0e10cSrcweir     return nRefIdx;
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir OUString FormulaObject::dumpTokenRefIdx()
1124*cdf0e10cSrcweir {
1125*cdf0e10cSrcweir     OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
1126*cdf0e10cSrcweir     StringHelper::appendIndex( aRef, readTokenRefIdx() );
1127*cdf0e10cSrcweir     aRef.append( OOX_DUMP_TABSEP );
1128*cdf0e10cSrcweir     return aRef.makeStringAndClear();
1129*cdf0e10cSrcweir }
1130*cdf0e10cSrcweir 
1131*cdf0e10cSrcweir OUString FormulaObject::dumpTokenRefTabIdxs()
1132*cdf0e10cSrcweir {
1133*cdf0e10cSrcweir     sal_Int16 nRefIdx = readTokenRefIdx();
1134*cdf0e10cSrcweir     OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
1135*cdf0e10cSrcweir     StringHelper::appendIndex( aRef, nRefIdx );
1136*cdf0e10cSrcweir     if( getBiff() == BIFF5 )
1137*cdf0e10cSrcweir     {
1138*cdf0e10cSrcweir         dumpDec< sal_Int16 >( "tab1" );
1139*cdf0e10cSrcweir         sal_Int16 nTab2 = dumpDec< sal_Int16 >( "tab2" );
1140*cdf0e10cSrcweir         if( (nRefIdx > 0) && (nTab2 > 0) && (nRefIdx != nTab2) )
1141*cdf0e10cSrcweir         {
1142*cdf0e10cSrcweir             aRef.append( OOX_DUMP_RANGESEP );
1143*cdf0e10cSrcweir             aRef.appendAscii( "REF" );
1144*cdf0e10cSrcweir             StringHelper::appendIndex( aRef, nTab2 );
1145*cdf0e10cSrcweir         }
1146*cdf0e10cSrcweir     }
1147*cdf0e10cSrcweir     aRef.append( OOX_DUMP_TABSEP );
1148*cdf0e10cSrcweir     return aRef.makeStringAndClear();
1149*cdf0e10cSrcweir }
1150*cdf0e10cSrcweir 
1151*cdf0e10cSrcweir void FormulaObject::dumpIntToken()
1152*cdf0e10cSrcweir {
1153*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "value" );
1154*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
1155*cdf0e10cSrcweir }
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir void FormulaObject::dumpDoubleToken()
1158*cdf0e10cSrcweir {
1159*cdf0e10cSrcweir     dumpDec< double >( "value" );
1160*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
1161*cdf0e10cSrcweir }
1162*cdf0e10cSrcweir 
1163*cdf0e10cSrcweir void FormulaObject::dumpStringToken()
1164*cdf0e10cSrcweir {
1165*cdf0e10cSrcweir     OUStringBuffer aValue;
1166*cdf0e10cSrcweir     aValue.append( dumpString( "value", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH ) );
1167*cdf0e10cSrcweir     StringHelper::enclose( aValue, OOX_DUMP_FMLASTRQUOTE );
1168*cdf0e10cSrcweir     mxStack->pushOperand( aValue.makeStringAndClear() );
1169*cdf0e10cSrcweir }
1170*cdf0e10cSrcweir 
1171*cdf0e10cSrcweir void FormulaObject::dumpBoolToken()
1172*cdf0e10cSrcweir {
1173*cdf0e10cSrcweir     dumpBoolean( "value" );
1174*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
1175*cdf0e10cSrcweir }
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir void FormulaObject::dumpErrorToken()
1178*cdf0e10cSrcweir {
1179*cdf0e10cSrcweir     dumpErrorCode( "value" );
1180*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
1181*cdf0e10cSrcweir }
1182*cdf0e10cSrcweir 
1183*cdf0e10cSrcweir void FormulaObject::dumpMissArgToken()
1184*cdf0e10cSrcweir {
1185*cdf0e10cSrcweir     mxStack->pushOperand( OUString( OOX_DUMP_EMPTYVALUE ) );
1186*cdf0e10cSrcweir }
1187*cdf0e10cSrcweir 
1188*cdf0e10cSrcweir void FormulaObject::dumpArrayToken( const OUString& rTokClass )
1189*cdf0e10cSrcweir {
1190*cdf0e10cSrcweir     dumpUnused( (getBiff() == BIFF2) ? 6 : 7 );
1191*cdf0e10cSrcweir     mxStack->pushOperand( createPlaceHolder(), rTokClass );
1192*cdf0e10cSrcweir     maAddData.push_back( ADDDATA_ARRAY );
1193*cdf0e10cSrcweir }
1194*cdf0e10cSrcweir 
1195*cdf0e10cSrcweir void FormulaObject::dumpNameToken( const OUString& rTokClass )
1196*cdf0e10cSrcweir {
1197*cdf0e10cSrcweir     sal_uInt16 nNameIdx = dumpDec< sal_uInt16 >( "name-idx" );
1198*cdf0e10cSrcweir     switch( getBiff() )
1199*cdf0e10cSrcweir     {
1200*cdf0e10cSrcweir         case BIFF2: dumpUnused( 5 );    break;
1201*cdf0e10cSrcweir         case BIFF3:
1202*cdf0e10cSrcweir         case BIFF4: dumpUnused( 8 );    break;
1203*cdf0e10cSrcweir         case BIFF5: dumpUnused( 12 );   break;
1204*cdf0e10cSrcweir         case BIFF8: dumpUnused( 2 );    break;
1205*cdf0e10cSrcweir         case BIFF_UNKNOWN:              break;
1206*cdf0e10cSrcweir     }
1207*cdf0e10cSrcweir     mxStack->pushOperand( createName( nNameIdx ), rTokClass );
1208*cdf0e10cSrcweir }
1209*cdf0e10cSrcweir 
1210*cdf0e10cSrcweir void FormulaObject::dumpNameXToken( const OUString& rTokClass )
1211*cdf0e10cSrcweir {
1212*cdf0e10cSrcweir     OUString aRef = dumpTokenRefIdx();
1213*cdf0e10cSrcweir     sal_uInt16 nNameIdx = dumpDec< sal_uInt16 >( "name-idx" );
1214*cdf0e10cSrcweir     dumpUnused( (getBiff() == BIFF8) ? 2 : 12 );
1215*cdf0e10cSrcweir     mxStack->pushOperand( lclCreateName( aRef, nNameIdx ), rTokClass );
1216*cdf0e10cSrcweir }
1217*cdf0e10cSrcweir 
1218*cdf0e10cSrcweir void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
1219*cdf0e10cSrcweir {
1220*cdf0e10cSrcweir     TokenAddress aPos = dumpTokenAddress( bNameMode );
1221*cdf0e10cSrcweir     writeTokenAddressItem( "addr", aPos, bNameMode );
1222*cdf0e10cSrcweir     mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
1223*cdf0e10cSrcweir }
1224*cdf0e10cSrcweir 
1225*cdf0e10cSrcweir void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
1226*cdf0e10cSrcweir {
1227*cdf0e10cSrcweir     TokenRange aRange = dumpTokenRange( bNameMode );
1228*cdf0e10cSrcweir     writeTokenRangeItem( "range", aRange, bNameMode );
1229*cdf0e10cSrcweir     mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
1230*cdf0e10cSrcweir }
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
1233*cdf0e10cSrcweir {
1234*cdf0e10cSrcweir     dumpUnused( ((getBiff() == BIFF8) ? 4 : 3) * (bArea ? 2 : 1) );
1235*cdf0e10cSrcweir     mxStack->pushOperand( createRef( getErrorName( BIFF_ERR_REF ) ), rTokClass );
1236*cdf0e10cSrcweir }
1237*cdf0e10cSrcweir 
1238*cdf0e10cSrcweir void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
1239*cdf0e10cSrcweir {
1240*cdf0e10cSrcweir     OUString aRef = dumpTokenRefTabIdxs();
1241*cdf0e10cSrcweir     TokenAddress aPos = dumpTokenAddress( bNameMode );
1242*cdf0e10cSrcweir     writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
1243*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
1244*cdf0e10cSrcweir }
1245*cdf0e10cSrcweir 
1246*cdf0e10cSrcweir void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
1247*cdf0e10cSrcweir {
1248*cdf0e10cSrcweir     OUString aRef = dumpTokenRefTabIdxs();
1249*cdf0e10cSrcweir     TokenRange aRange = dumpTokenRange( bNameMode );
1250*cdf0e10cSrcweir     writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
1251*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
1252*cdf0e10cSrcweir }
1253*cdf0e10cSrcweir 
1254*cdf0e10cSrcweir void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
1255*cdf0e10cSrcweir {
1256*cdf0e10cSrcweir     OUString aRef = dumpTokenRefTabIdxs();
1257*cdf0e10cSrcweir     dumpUnused( ((getBiff() == BIFF8) ? 4 : 3) * (bArea ? 2 : 1) );
1258*cdf0e10cSrcweir     mxStack->pushOperand( aRef + getErrorName( BIFF_ERR_REF ), rTokClass );
1259*cdf0e10cSrcweir }
1260*cdf0e10cSrcweir 
1261*cdf0e10cSrcweir void FormulaObject::dumpMemFuncToken( const OUString& /*rTokClass*/ )
1262*cdf0e10cSrcweir {
1263*cdf0e10cSrcweir     dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "size" );
1264*cdf0e10cSrcweir }
1265*cdf0e10cSrcweir 
1266*cdf0e10cSrcweir void FormulaObject::dumpMemAreaToken( const OUString& rTokClass, bool bAddData )
1267*cdf0e10cSrcweir {
1268*cdf0e10cSrcweir     dumpUnused( (getBiff() == BIFF2) ? 3 : 4 );
1269*cdf0e10cSrcweir     dumpMemFuncToken( rTokClass );
1270*cdf0e10cSrcweir     if( bAddData )
1271*cdf0e10cSrcweir         maAddData.push_back( ADDDATA_MEMAREA );
1272*cdf0e10cSrcweir }
1273*cdf0e10cSrcweir 
1274*cdf0e10cSrcweir void FormulaObject::dumpExpToken( const String& rName )
1275*cdf0e10cSrcweir {
1276*cdf0e10cSrcweir     Address aPos;
1277*cdf0e10cSrcweir     aPos.mnRow = dumpDec< sal_uInt16 >( "row" );
1278*cdf0e10cSrcweir     aPos.mnCol = dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "col" );
1279*cdf0e10cSrcweir     writeAddressItem( "base-addr", aPos );
1280*cdf0e10cSrcweir     OUStringBuffer aOp( rName );
1281*cdf0e10cSrcweir     StringHelper::appendIndex( aOp, mxOut->getLastItemValue() );
1282*cdf0e10cSrcweir     mxStack->pushOperand( aOp.makeStringAndClear() );
1283*cdf0e10cSrcweir }
1284*cdf0e10cSrcweir 
1285*cdf0e10cSrcweir void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
1286*cdf0e10cSrcweir {
1287*cdf0e10cSrcweir     mxStack->pushUnaryOp( rLOp, rROp );
1288*cdf0e10cSrcweir }
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir void FormulaObject::dumpBinaryOpToken( const String& rOp )
1291*cdf0e10cSrcweir {
1292*cdf0e10cSrcweir     mxStack->pushBinaryOp( rOp );
1293*cdf0e10cSrcweir }
1294*cdf0e10cSrcweir 
1295*cdf0e10cSrcweir void FormulaObject::dumpFuncToken( const OUString& rTokClass )
1296*cdf0e10cSrcweir {
1297*cdf0e10cSrcweir     sal_uInt16 nFuncId = readFuncId();
1298*cdf0e10cSrcweir     const FunctionInfo* pFuncInfo = 0;
1299*cdf0e10cSrcweir     OUString aFuncName = writeFuncIdItem( nFuncId, &pFuncInfo );
1300*cdf0e10cSrcweir     if( pFuncInfo && (pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount) )
1301*cdf0e10cSrcweir         mxStack->pushFuncOp( aFuncName, rTokClass, pFuncInfo->mnMinParamCount );
1302*cdf0e10cSrcweir     else
1303*cdf0e10cSrcweir         mxStack->setError();
1304*cdf0e10cSrcweir }
1305*cdf0e10cSrcweir 
1306*cdf0e10cSrcweir void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
1307*cdf0e10cSrcweir {
1308*cdf0e10cSrcweir     sal_uInt8 nParamCount;
1309*cdf0e10cSrcweir     *mxStrm >> nParamCount;
1310*cdf0e10cSrcweir     sal_uInt16 nFuncId = readFuncId();
1311*cdf0e10cSrcweir     bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
1312*cdf0e10cSrcweir     if( bCmd )
1313*cdf0e10cSrcweir         writeHexItem( "param-count", nParamCount, "PARAMCOUNT-CMD" );
1314*cdf0e10cSrcweir     else
1315*cdf0e10cSrcweir         writeDecItem( "param-count", nParamCount );
1316*cdf0e10cSrcweir     OUString aFuncName = writeFuncIdItem( nFuncId );
1317*cdf0e10cSrcweir     if( bCmd && getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
1318*cdf0e10cSrcweir     {
1319*cdf0e10cSrcweir         aFuncName += OUString( OOX_DUMP_CMDPROMPT );
1320*cdf0e10cSrcweir         nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
1321*cdf0e10cSrcweir     }
1322*cdf0e10cSrcweir     mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
1323*cdf0e10cSrcweir }
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir void FormulaObject::dumpCmdToken( const OUString& rTokClass )
1326*cdf0e10cSrcweir {
1327*cdf0e10cSrcweir     sal_uInt8 nParamCount = dumpDec< sal_uInt8 >( "param-count", "PARAMCOUNT-CMD" );
1328*cdf0e10cSrcweir     sal_uInt16 nCmdId = readFuncId() | BIFF_TOK_FUNCVAR_CMD;
1329*cdf0e10cSrcweir     OUString aFuncName = writeFuncIdItem( nCmdId );
1330*cdf0e10cSrcweir     if( getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
1331*cdf0e10cSrcweir     {
1332*cdf0e10cSrcweir         aFuncName += OUString( OOX_DUMP_CMDPROMPT );
1333*cdf0e10cSrcweir         nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
1334*cdf0e10cSrcweir     }
1335*cdf0e10cSrcweir     mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
1336*cdf0e10cSrcweir }
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir void FormulaObject::dumpSheetToken()
1339*cdf0e10cSrcweir {
1340*cdf0e10cSrcweir     dumpUnused( (getBiff() == BIFF2) ? 4 : 6 );
1341*cdf0e10cSrcweir     maRefPrefix = dumpTokenRefIdx();
1342*cdf0e10cSrcweir }
1343*cdf0e10cSrcweir 
1344*cdf0e10cSrcweir void FormulaObject::dumpEndSheetToken()
1345*cdf0e10cSrcweir {
1346*cdf0e10cSrcweir     dumpUnused( (getBiff() == BIFF2) ? 3 : 4 );
1347*cdf0e10cSrcweir     maRefPrefix = OUString();
1348*cdf0e10cSrcweir }
1349*cdf0e10cSrcweir 
1350*cdf0e10cSrcweir bool FormulaObject::dumpAttrToken()
1351*cdf0e10cSrcweir {
1352*cdf0e10cSrcweir     bool bValid = true;
1353*cdf0e10cSrcweir     bool bBiff2 = getBiff() == BIFF2;
1354*cdf0e10cSrcweir     sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxAttrTypes );
1355*cdf0e10cSrcweir     switch( nType )
1356*cdf0e10cSrcweir     {
1357*cdf0e10cSrcweir         case BIFF_TOK_ATTR_VOLATILE:
1358*cdf0e10cSrcweir             dumpUnused( bBiff2 ? 1 : 2 );
1359*cdf0e10cSrcweir         break;
1360*cdf0e10cSrcweir         case BIFF_TOK_ATTR_IF:
1361*cdf0e10cSrcweir             dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip" );
1362*cdf0e10cSrcweir         break;
1363*cdf0e10cSrcweir         case BIFF_TOK_ATTR_CHOOSE:
1364*cdf0e10cSrcweir         {
1365*cdf0e10cSrcweir             sal_uInt16 nCount = dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "choices" );
1366*cdf0e10cSrcweir             mxOut->resetItemIndex();
1367*cdf0e10cSrcweir             for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
1368*cdf0e10cSrcweir                 dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "#skip" );
1369*cdf0e10cSrcweir             dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip-err" );
1370*cdf0e10cSrcweir         }
1371*cdf0e10cSrcweir         break;
1372*cdf0e10cSrcweir         case 0:     // in array formulas and defined names, the skip-bit may be 0
1373*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SKIP:
1374*cdf0e10cSrcweir             dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip" );
1375*cdf0e10cSrcweir         break;
1376*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SUM:
1377*cdf0e10cSrcweir             dumpUnused( bBiff2 ? 1 : 2 );
1378*cdf0e10cSrcweir             mxStack->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS ), 1 );
1379*cdf0e10cSrcweir         break;
1380*cdf0e10cSrcweir         case BIFF_TOK_ATTR_ASSIGN:
1381*cdf0e10cSrcweir             dumpUnused( bBiff2 ? 1 : 2 );
1382*cdf0e10cSrcweir         break;
1383*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SPACE:
1384*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
1385*cdf0e10cSrcweir             switch( getBiff() )
1386*cdf0e10cSrcweir             {
1387*cdf0e10cSrcweir                 case BIFF2:
1388*cdf0e10cSrcweir                     bValid = false;
1389*cdf0e10cSrcweir                 break;
1390*cdf0e10cSrcweir                 case BIFF3:
1391*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "leading-spaces" );
1392*cdf0e10cSrcweir                 break;
1393*cdf0e10cSrcweir                 case BIFF4:
1394*cdf0e10cSrcweir                 case BIFF5:
1395*cdf0e10cSrcweir                 case BIFF8:
1396*cdf0e10cSrcweir                     dumpDec< sal_uInt8 >( "char-type", mxSpTypes );
1397*cdf0e10cSrcweir                     dumpDec< sal_uInt8 >( "char-count" );
1398*cdf0e10cSrcweir                 break;
1399*cdf0e10cSrcweir                 case BIFF_UNKNOWN: break;
1400*cdf0e10cSrcweir             }
1401*cdf0e10cSrcweir         break;
1402*cdf0e10cSrcweir         default:
1403*cdf0e10cSrcweir             bValid = false;
1404*cdf0e10cSrcweir     }
1405*cdf0e10cSrcweir     return bValid;
1406*cdf0e10cSrcweir }
1407*cdf0e10cSrcweir 
1408*cdf0e10cSrcweir bool FormulaObject::dumpNlrToken()
1409*cdf0e10cSrcweir {
1410*cdf0e10cSrcweir     const OUString aRefClass = cfg().getName( mxClasses, BIFF_TOKCLASS_REF );
1411*cdf0e10cSrcweir     const OUString aValClass = cfg().getName( mxClasses, BIFF_TOKCLASS_VAL );
1412*cdf0e10cSrcweir 
1413*cdf0e10cSrcweir     bool bValid = true;
1414*cdf0e10cSrcweir     sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxNlrTypes );
1415*cdf0e10cSrcweir     switch( nType )
1416*cdf0e10cSrcweir     {
1417*cdf0e10cSrcweir         case BIFF_TOK_NLR_ERR:      dumpNlrErrToken();                      break;
1418*cdf0e10cSrcweir         case BIFF_TOK_NLR_ROWR:     dumpNlrColRowToken( aRefClass, false ); break;
1419*cdf0e10cSrcweir         case BIFF_TOK_NLR_COLR:     dumpNlrColRowToken( aRefClass, false ); break;
1420*cdf0e10cSrcweir         case BIFF_TOK_NLR_ROWV:     dumpNlrColRowToken( aValClass, false ); break;
1421*cdf0e10cSrcweir         case BIFF_TOK_NLR_COLV:     dumpNlrColRowToken( aValClass, false ); break;
1422*cdf0e10cSrcweir         case BIFF_TOK_NLR_RANGE:    dumpNlrRangeToken( aRefClass, false );  break;
1423*cdf0e10cSrcweir         case BIFF_TOK_NLR_SRANGE:   dumpNlrRangeToken( aRefClass, true );   break;
1424*cdf0e10cSrcweir         case BIFF_TOK_NLR_SROWR:    dumpNlrColRowToken( aRefClass, true );  break;
1425*cdf0e10cSrcweir         case BIFF_TOK_NLR_SCOLR:    dumpNlrColRowToken( aRefClass, true );  break;
1426*cdf0e10cSrcweir         case BIFF_TOK_NLR_SROWV:    dumpNlrColRowToken( aValClass, true );  break;
1427*cdf0e10cSrcweir         case BIFF_TOK_NLR_SCOLV:    dumpNlrColRowToken( aValClass, true );  break;
1428*cdf0e10cSrcweir         case BIFF_TOK_NLR_RANGEERR: dumpNlrRangeErrToken();                 break;
1429*cdf0e10cSrcweir         default:                    bValid = false;
1430*cdf0e10cSrcweir     }
1431*cdf0e10cSrcweir     return bValid;
1432*cdf0e10cSrcweir }
1433*cdf0e10cSrcweir 
1434*cdf0e10cSrcweir void FormulaObject::dumpNlrErrToken()
1435*cdf0e10cSrcweir {
1436*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "delname-idx" );
1437*cdf0e10cSrcweir     mxStack->pushOperand( lclCreateNlr( getErrorName( BIFF_ERR_NAME ) ) );
1438*cdf0e10cSrcweir }
1439*cdf0e10cSrcweir 
1440*cdf0e10cSrcweir void FormulaObject::dumpNlrColRowToken( const OUString& rTokClass, bool bAddData )
1441*cdf0e10cSrcweir {
1442*cdf0e10cSrcweir     if( bAddData )
1443*cdf0e10cSrcweir     {
1444*cdf0e10cSrcweir         dumpUnused( 4 );
1445*cdf0e10cSrcweir         mxStack->pushOperand( createPlaceHolder(), rTokClass );
1446*cdf0e10cSrcweir         maAddData.push_back( ADDDATA_NLR );
1447*cdf0e10cSrcweir     }
1448*cdf0e10cSrcweir     else
1449*cdf0e10cSrcweir     {
1450*cdf0e10cSrcweir         TokenAddress aPos = dumpTokenAddress( false );
1451*cdf0e10cSrcweir         writeInfoItem( "addr", lclCreateNlr( aPos ) );
1452*cdf0e10cSrcweir         mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
1453*cdf0e10cSrcweir     }
1454*cdf0e10cSrcweir }
1455*cdf0e10cSrcweir 
1456*cdf0e10cSrcweir void FormulaObject::dumpNlrRangeToken( const OUString& rTokClass, bool bAddData )
1457*cdf0e10cSrcweir {
1458*cdf0e10cSrcweir     if( bAddData )
1459*cdf0e10cSrcweir     {
1460*cdf0e10cSrcweir         dumpUnused( 4 );
1461*cdf0e10cSrcweir         mxStack->pushOperand( createPlaceHolder(), rTokClass );
1462*cdf0e10cSrcweir         maAddData.push_back( ADDDATA_NLR );
1463*cdf0e10cSrcweir     }
1464*cdf0e10cSrcweir     else
1465*cdf0e10cSrcweir     {
1466*cdf0e10cSrcweir         TokenAddress aPos = dumpTokenAddress( false );
1467*cdf0e10cSrcweir         writeInfoItem( "addr", lclCreateNlr( aPos ) );
1468*cdf0e10cSrcweir         mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
1469*cdf0e10cSrcweir     }
1470*cdf0e10cSrcweir     dumpUnknown( 1 );
1471*cdf0e10cSrcweir     dumpRange( "target-range" );
1472*cdf0e10cSrcweir }
1473*cdf0e10cSrcweir 
1474*cdf0e10cSrcweir void FormulaObject::dumpNlrRangeErrToken()
1475*cdf0e10cSrcweir {
1476*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "delname-idx" );
1477*cdf0e10cSrcweir     dumpUnused( 9 );
1478*cdf0e10cSrcweir     mxStack->pushOperand( lclCreateNlr( getErrorName( BIFF_ERR_NAME ) ) );
1479*cdf0e10cSrcweir }
1480*cdf0e10cSrcweir 
1481*cdf0e10cSrcweir void FormulaObject::dumpAddTokenData()
1482*cdf0e10cSrcweir {
1483*cdf0e10cSrcweir     mxOut->resetItemIndex();
1484*cdf0e10cSrcweir     for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); aIt != aEnd; ++aIt )
1485*cdf0e10cSrcweir     {
1486*cdf0e10cSrcweir         AddDataType eType = *aIt;
1487*cdf0e10cSrcweir 
1488*cdf0e10cSrcweir         {
1489*cdf0e10cSrcweir             ItemGuard aItem( mxOut, "#add-data" );
1490*cdf0e10cSrcweir             switch( eType )
1491*cdf0e10cSrcweir             {
1492*cdf0e10cSrcweir                 case ADDDATA_NLR:       mxOut->writeAscii( "tNlr" );      break;
1493*cdf0e10cSrcweir                 case ADDDATA_ARRAY:     mxOut->writeAscii( "tArray" );    break;
1494*cdf0e10cSrcweir                 case ADDDATA_MEMAREA:   mxOut->writeAscii( "tMemArea" );  break;
1495*cdf0e10cSrcweir             }
1496*cdf0e10cSrcweir         }
1497*cdf0e10cSrcweir 
1498*cdf0e10cSrcweir         size_t nIdx = aIt - maAddData.begin();
1499*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
1500*cdf0e10cSrcweir         switch( eType )
1501*cdf0e10cSrcweir         {
1502*cdf0e10cSrcweir             case ADDDATA_NLR:       dumpAddDataNlr( nIdx );     break;
1503*cdf0e10cSrcweir             case ADDDATA_ARRAY:     dumpAddDataArray( nIdx );   break;
1504*cdf0e10cSrcweir             case ADDDATA_MEMAREA:   dumpAddDataMemArea( nIdx ); break;
1505*cdf0e10cSrcweir         }
1506*cdf0e10cSrcweir     }
1507*cdf0e10cSrcweir }
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir void FormulaObject::dumpAddDataNlr( size_t nIdx )
1510*cdf0e10cSrcweir {
1511*cdf0e10cSrcweir     sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "NLRADDFLAGS" );
1512*cdf0e10cSrcweir     sal_uInt32 nCount = nFlags & BIFF_TOK_NLR_ADDMASK;
1513*cdf0e10cSrcweir     OUStringBuffer aBuffer;
1514*cdf0e10cSrcweir     for( sal_uInt32 nPos = 0; nPos < nCount; ++nPos )
1515*cdf0e10cSrcweir     {
1516*cdf0e10cSrcweir         Address aPos;
1517*cdf0e10cSrcweir         readAddress( aPos );
1518*cdf0e10cSrcweir         OUStringBuffer aAddr;
1519*cdf0e10cSrcweir         StringHelper::appendAddress( aAddr, aPos );
1520*cdf0e10cSrcweir         StringHelper::appendToken( aBuffer, aAddr.makeStringAndClear(), OOX_DUMP_LISTSEP );
1521*cdf0e10cSrcweir     }
1522*cdf0e10cSrcweir     OUString aAddrList = aBuffer.makeStringAndClear();
1523*cdf0e10cSrcweir     writeInfoItem( "stacked-positions", aAddrList );
1524*cdf0e10cSrcweir     mxStack->replaceOnTop( createPlaceHolder( nIdx ), lclCreateNlr( aAddrList ) );
1525*cdf0e10cSrcweir }
1526*cdf0e10cSrcweir 
1527*cdf0e10cSrcweir void FormulaObject::dumpAddDataArray( size_t nIdx )
1528*cdf0e10cSrcweir {
1529*cdf0e10cSrcweir     sal_uInt32 nCols, nRows;
1530*cdf0e10cSrcweir     dumpConstArrayHeader( nCols, nRows );
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir     OUStringBuffer aOp;
1533*cdf0e10cSrcweir     TableGuard aTabGuard( mxOut, 17 );
1534*cdf0e10cSrcweir     for( sal_uInt32 nRow = 0; nRow < nRows; ++nRow )
1535*cdf0e10cSrcweir     {
1536*cdf0e10cSrcweir         OUStringBuffer aArrayLine;
1537*cdf0e10cSrcweir         for( sal_uInt32 nCol = 0; nCol < nCols; ++nCol )
1538*cdf0e10cSrcweir             StringHelper::appendToken( aArrayLine, dumpConstValue( OOX_DUMP_FMLASTRQUOTE ), OOX_DUMP_LISTSEP );
1539*cdf0e10cSrcweir         StringHelper::appendToken( aOp, aArrayLine.makeStringAndClear(), OOX_DUMP_ARRAYSEP );
1540*cdf0e10cSrcweir     }
1541*cdf0e10cSrcweir     StringHelper::enclose( aOp, '{', '}' );
1542*cdf0e10cSrcweir     mxStack->replaceOnTop( createPlaceHolder( nIdx ), aOp.makeStringAndClear() );
1543*cdf0e10cSrcweir }
1544*cdf0e10cSrcweir 
1545*cdf0e10cSrcweir void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
1546*cdf0e10cSrcweir {
1547*cdf0e10cSrcweir     dumpRangeList( EMPTY_STRING, getBiff() == BIFF8 );
1548*cdf0e10cSrcweir }
1549*cdf0e10cSrcweir 
1550*cdf0e10cSrcweir // ============================================================================
1551*cdf0e10cSrcweir // ============================================================================
1552*cdf0e10cSrcweir 
1553*cdf0e10cSrcweir RecordStreamObject::~RecordStreamObject()
1554*cdf0e10cSrcweir {
1555*cdf0e10cSrcweir }
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir void RecordStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
1558*cdf0e10cSrcweir {
1559*cdf0e10cSrcweir     BiffObjectBase::construct( rParent, rxStrm, eBiff, rSysFileName );
1560*cdf0e10cSrcweir     if( BiffObjectBase::implIsValid() )
1561*cdf0e10cSrcweir         mxFmlaObj.reset( new FormulaObject( *this ) );
1562*cdf0e10cSrcweir }
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir bool RecordStreamObject::implIsValid() const
1565*cdf0e10cSrcweir {
1566*cdf0e10cSrcweir     return isValid( mxFmlaObj ) && BiffObjectBase::implIsValid();
1567*cdf0e10cSrcweir }
1568*cdf0e10cSrcweir 
1569*cdf0e10cSrcweir // ============================================================================
1570*cdf0e10cSrcweir 
1571*cdf0e10cSrcweir WorkbookStreamObject::WorkbookStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
1572*cdf0e10cSrcweir {
1573*cdf0e10cSrcweir     if( rxStrm.get() )
1574*cdf0e10cSrcweir     {
1575*cdf0e10cSrcweir         BiffType eBiff = BiffDetector::detectStreamBiffVersion( *rxStrm );
1576*cdf0e10cSrcweir         RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
1577*cdf0e10cSrcweir         if( RecordStreamObject::implIsValid() )
1578*cdf0e10cSrcweir         {
1579*cdf0e10cSrcweir             Config& rCfg = cfg();
1580*cdf0e10cSrcweir             mxColors = rCfg.getNameList( "COLORS" );
1581*cdf0e10cSrcweir             mxBorderStyles = rCfg.getNameList( "BORDERSTYLES" );
1582*cdf0e10cSrcweir             mxFillPatterns = rCfg.getNameList( "FILLPATTERNS" );
1583*cdf0e10cSrcweir             mnPTRowFields = 0;
1584*cdf0e10cSrcweir             mnPTColFields = 0;
1585*cdf0e10cSrcweir             mnPTRowColItemsIdx = 0;
1586*cdf0e10cSrcweir             mbHasDff = false;
1587*cdf0e10cSrcweir             initializePerSheet();
1588*cdf0e10cSrcweir         }
1589*cdf0e10cSrcweir     }
1590*cdf0e10cSrcweir }
1591*cdf0e10cSrcweir 
1592*cdf0e10cSrcweir WorkbookStreamObject::~WorkbookStreamObject()
1593*cdf0e10cSrcweir {
1594*cdf0e10cSrcweir     if( WorkbookStreamObject::implIsValid() )
1595*cdf0e10cSrcweir     {
1596*cdf0e10cSrcweir         Config& rCfg = cfg();
1597*cdf0e10cSrcweir         rCfg.eraseNameList( "FONTNAMES" );
1598*cdf0e10cSrcweir         rCfg.eraseNameList( "FORMATS" );
1599*cdf0e10cSrcweir     }
1600*cdf0e10cSrcweir }
1601*cdf0e10cSrcweir 
1602*cdf0e10cSrcweir void WorkbookStreamObject::implDumpRecordBody()
1603*cdf0e10cSrcweir {
1604*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
1605*cdf0e10cSrcweir     sal_uInt16 nRecId = rStrm.getRecId();
1606*cdf0e10cSrcweir     sal_Int64 nRecSize = rStrm.size();
1607*cdf0e10cSrcweir     BiffType eBiff = getBiff();
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir     switch( nRecId )
1610*cdf0e10cSrcweir     {
1611*cdf0e10cSrcweir         case BIFF2_ID_ARRAY:
1612*cdf0e10cSrcweir         case BIFF3_ID_ARRAY:
1613*cdf0e10cSrcweir             dumpRange( "array-range", false );
1614*cdf0e10cSrcweir             dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "ARRAY-FLAGS" );
1615*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpUnused( 4 );
1616*cdf0e10cSrcweir             getFormulaDumper().dumpCellFormula();
1617*cdf0e10cSrcweir         break;
1618*cdf0e10cSrcweir 
1619*cdf0e10cSrcweir         case BIFF2_ID_BLANK:
1620*cdf0e10cSrcweir         case BIFF3_ID_BLANK:
1621*cdf0e10cSrcweir             dumpCellHeader( nRecId == BIFF2_ID_BLANK );
1622*cdf0e10cSrcweir         break;
1623*cdf0e10cSrcweir 
1624*cdf0e10cSrcweir         case BIFF2_ID_BOF:
1625*cdf0e10cSrcweir         case BIFF3_ID_BOF:
1626*cdf0e10cSrcweir         case BIFF4_ID_BOF:
1627*cdf0e10cSrcweir         case BIFF5_ID_BOF:
1628*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "bof-type", "BOF-BIFFTYPE" );
1629*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "sheet-type", "BOF-SHEETTYPE" );
1630*cdf0e10cSrcweir             if( nRecSize >= 6 )  dumpDec< sal_uInt16 >( "build-id" );
1631*cdf0e10cSrcweir             if( nRecSize >= 8 )  dumpDec< sal_uInt16 >( "build-year" );
1632*cdf0e10cSrcweir             if( nRecSize >= 12 ) dumpHex< sal_uInt32 >( "history-flags", "BOF-HISTORY-FLAGS" );
1633*cdf0e10cSrcweir             if( nRecSize >= 16 ) dumpHex< sal_uInt32 >( "lowest-version", "BOF-LOWESTVERSION-FLAGS" );
1634*cdf0e10cSrcweir             if( (eBiff == BIFF4) && (getLastRecId() != BIFF_ID_OBJ) )
1635*cdf0e10cSrcweir                 initializePerSheet();
1636*cdf0e10cSrcweir         break;
1637*cdf0e10cSrcweir 
1638*cdf0e10cSrcweir         case BIFF_ID_BOOKEXT:
1639*cdf0e10cSrcweir             dumpFrHeader( true, true );
1640*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "rec-size" );
1641*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags-1", "BOOKEXT-FLAGS1" );
1642*cdf0e10cSrcweir             if( rStrm.getRemaining() > 0 ) dumpHex< sal_uInt8 >( "flags-2", "BOOKEXT-FLAGS2" );
1643*cdf0e10cSrcweir             if( rStrm.getRemaining() > 0 ) dumpHex< sal_uInt8 >( "flags-3", "BOOKEXT-FLAGS3" );
1644*cdf0e10cSrcweir         break;
1645*cdf0e10cSrcweir 
1646*cdf0e10cSrcweir         case BIFF2_ID_BOOLERR:
1647*cdf0e10cSrcweir         case BIFF3_ID_BOOLERR:
1648*cdf0e10cSrcweir             dumpCellHeader( nRecId == BIFF2_ID_BOOLERR );
1649*cdf0e10cSrcweir             dumpBoolErr();
1650*cdf0e10cSrcweir         break;
1651*cdf0e10cSrcweir 
1652*cdf0e10cSrcweir         case BIFF_ID_CFHEADER:
1653*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "rule-count" );
1654*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CFHEADER-FLAGS" );
1655*cdf0e10cSrcweir             dumpRange( "bounding-range" );
1656*cdf0e10cSrcweir             dumpRangeList();
1657*cdf0e10cSrcweir         break;
1658*cdf0e10cSrcweir 
1659*cdf0e10cSrcweir         case BIFF_ID_CFRULE:
1660*cdf0e10cSrcweir         {
1661*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "type", "CFRULE-TYPE" );
1662*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
1663*cdf0e10cSrcweir             sal_uInt16 nFmla1Size = dumpDec< sal_uInt16 >( "formula1-size" );
1664*cdf0e10cSrcweir             sal_uInt16 nFmla2Size = dumpDec< sal_uInt16 >( "formula2-size" );
1665*cdf0e10cSrcweir             dumpCfRuleProp();
1666*cdf0e10cSrcweir             if( nFmla1Size > 0 ) getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
1667*cdf0e10cSrcweir             if( nFmla2Size > 0 ) getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
1668*cdf0e10cSrcweir         }
1669*cdf0e10cSrcweir         break;
1670*cdf0e10cSrcweir 
1671*cdf0e10cSrcweir         case BIFF_ID_CFRULE12:
1672*cdf0e10cSrcweir         {
1673*cdf0e10cSrcweir             dumpFrHeader( true, true );
1674*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "type", "CFRULE12-TYPE" );
1675*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
1676*cdf0e10cSrcweir             sal_uInt16 nFmla1Size = dumpDec< sal_uInt16 >( "formula1-size" );
1677*cdf0e10cSrcweir             sal_uInt16 nFmla2Size = dumpDec< sal_uInt16 >( "formula2-size" );
1678*cdf0e10cSrcweir             dumpDxf12Prop();
1679*cdf0e10cSrcweir             if( nFmla1Size > 0 ) getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
1680*cdf0e10cSrcweir             if( nFmla2Size > 0 ) getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
1681*cdf0e10cSrcweir             getFormulaDumper().dumpNameFormula( "active-formula" );
1682*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "CFRULE12-FLAGS" );
1683*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "priority" );
1684*cdf0e10cSrcweir             dumpCfRule12Param( dumpDec< sal_uInt16 >( "sub-type", "CFRULE12-SUBTYPE" ) );
1685*cdf0e10cSrcweir         }
1686*cdf0e10cSrcweir         break;
1687*cdf0e10cSrcweir 
1688*cdf0e10cSrcweir         case BIFF_ID_CFRULEEXT:
1689*cdf0e10cSrcweir             dumpFrHeader( true, true );
1690*cdf0e10cSrcweir             dumpBool< sal_uInt32 >( "cfrule12-follows" );
1691*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "cfheader-id" );
1692*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 25 )
1693*cdf0e10cSrcweir             {
1694*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "cfrule-idx" );
1695*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
1696*cdf0e10cSrcweir                 sal_uInt8 nSubType = dumpDec< sal_uInt8 >( "sub-type", "CFRULE12-SUBTYPE" );
1697*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "priority" );
1698*cdf0e10cSrcweir                 dumpHex< sal_uInt8 >( "flags", "CFRULEEXT-FLAGS" );
1699*cdf0e10cSrcweir                 if( dumpBoolean( "has-dxf-data" ) ) dumpDxf12Prop();
1700*cdf0e10cSrcweir                 dumpCfRule12Param( nSubType );
1701*cdf0e10cSrcweir             }
1702*cdf0e10cSrcweir         break;
1703*cdf0e10cSrcweir 
1704*cdf0e10cSrcweir         case BIFF_ID_CH3DDATAFORMAT:
1705*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "base", "CH3DDATAFORMAT-BASE" );
1706*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "top", "CH3DDATAFORMAT-TOP" );
1707*cdf0e10cSrcweir         break;
1708*cdf0e10cSrcweir 
1709*cdf0e10cSrcweir         case BIFF_ID_CHAREAFORMAT:
1710*cdf0e10cSrcweir             dumpColorABGR( "fg-color" );
1711*cdf0e10cSrcweir             dumpColorABGR( "bg-color" );
1712*cdf0e10cSrcweir             dumpPatternIdx();
1713*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHAREAFORMAT-FLAGS" );
1714*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx( "fg-color-idx" );
1715*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx( "bg-color-idx" );
1716*cdf0e10cSrcweir         break;
1717*cdf0e10cSrcweir 
1718*cdf0e10cSrcweir         case BIFF_ID_CHAXESSET:
1719*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "axesset-id", "CHAXESSET-ID" );
1720*cdf0e10cSrcweir             dumpRect< sal_Int32 >( "inner-plotarea-pos", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
1721*cdf0e10cSrcweir         break;
1722*cdf0e10cSrcweir 
1723*cdf0e10cSrcweir         case BIFF_ID_CHAXIS:
1724*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "axis-type", "CHAXIS-TYPE" );
1725*cdf0e10cSrcweir             if( eBiff <= BIFF4 )
1726*cdf0e10cSrcweir                 dumpRect< sal_Int32 >( "position", "CONV-TWIP-TO-CM" );
1727*cdf0e10cSrcweir             else
1728*cdf0e10cSrcweir                 dumpUnused( 16 );
1729*cdf0e10cSrcweir         break;
1730*cdf0e10cSrcweir 
1731*cdf0e10cSrcweir         case BIFF_ID_CHBAR:
1732*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "overlap", "CONV-PERCENT-NEG" );
1733*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "gap", "CONV-PERCENT" );
1734*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHBAR-FLAGS" );
1735*cdf0e10cSrcweir         break;
1736*cdf0e10cSrcweir 
1737*cdf0e10cSrcweir         case BIFF_ID_CHCHART:
1738*cdf0e10cSrcweir             dumpRect< sal_Int32 >( "chart-frame", "CONV-PT1616-TO-CM", FORMATTYPE_FIX );
1739*cdf0e10cSrcweir         break;
1740*cdf0e10cSrcweir 
1741*cdf0e10cSrcweir         case BIFF_ID_CHCHART3D:
1742*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "rotation-angle", "CONV-DEG" );
1743*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "elevation-angle", "CONV-DEG" );
1744*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "eye-distance" );
1745*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "relative-height", "CONV-PERCENT" );
1746*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "relative-depth", "CONV-PERCENT" );
1747*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "depth-gap", "CONV-PERCENT" );
1748*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHCHART3D-FLAGS" );
1749*cdf0e10cSrcweir         break;
1750*cdf0e10cSrcweir 
1751*cdf0e10cSrcweir         case BIFF_ID_CHDATAFORMAT:
1752*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "point-idx", "CHDATAFORMAT-POINTIDX" );
1753*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "series-idx" );
1754*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpDec< sal_Int16 >( "format-idx", "CHDATAFORMAT-FORMATIDX" );
1755*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpHex< sal_uInt16 >( "flags", "CHDATAFORMAT-FLAGS" );
1756*cdf0e10cSrcweir         break;
1757*cdf0e10cSrcweir 
1758*cdf0e10cSrcweir         case BIFF_ID_CHDATERANGE:
1759*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "minimum-date" );
1760*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "maximum-date" );
1761*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "major-unit-value" );
1762*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "major-unit", "CHDATERANGE-UNIT" );
1763*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "minor-unit-value" );
1764*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "minor-unit", "CHDATERANGE-UNIT" );
1765*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "base-unit", "CHDATERANGE-UNIT" );
1766*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "axis-crossing-date" );
1767*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHDATERANGE-FLAGS" );
1768*cdf0e10cSrcweir         break;
1769*cdf0e10cSrcweir 
1770*cdf0e10cSrcweir         case BIFF_ID_CHECKCOMPAT:
1771*cdf0e10cSrcweir             dumpFrHeader( true, true );
1772*cdf0e10cSrcweir             dumpBool< sal_uInt32 >( "check-compatibility" );
1773*cdf0e10cSrcweir         break;
1774*cdf0e10cSrcweir 
1775*cdf0e10cSrcweir         case BIFF_ID_CHESCHERFORMAT:
1776*cdf0e10cSrcweir             dumpEmbeddedDff();
1777*cdf0e10cSrcweir         break;
1778*cdf0e10cSrcweir 
1779*cdf0e10cSrcweir         case BIFF_ID_CHFRAME:
1780*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "format", "CHFRAME-FORMAT" );
1781*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRAME-FLAGS" );
1782*cdf0e10cSrcweir         break;
1783*cdf0e10cSrcweir 
1784*cdf0e10cSrcweir         case BIFF_ID_CHFRAMEPOS:
1785*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "tl-mode", "CHFRAMEPOS-POSMODE" );
1786*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "br-mode", "CHFRAMEPOS-POSMODE" );
1787*cdf0e10cSrcweir             dumpRectWithGaps< sal_Int16 >( "position", 2 );
1788*cdf0e10cSrcweir         break;
1789*cdf0e10cSrcweir 
1790*cdf0e10cSrcweir         case BIFF_ID_CHFRBLOCKBEGIN:
1791*cdf0e10cSrcweir             dumpFrHeader( true, false );
1792*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" );
1793*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "context" );
1794*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "value-1" );
1795*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "value-2" );
1796*cdf0e10cSrcweir         break;
1797*cdf0e10cSrcweir 
1798*cdf0e10cSrcweir         case BIFF_ID_CHFRBLOCKEND:
1799*cdf0e10cSrcweir             dumpFrHeader( true, false );
1800*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" );
1801*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 6 )
1802*cdf0e10cSrcweir                 dumpUnused( 6 );
1803*cdf0e10cSrcweir         break;
1804*cdf0e10cSrcweir 
1805*cdf0e10cSrcweir         case BIFF_ID_CHFRCATEGORYPROPS:
1806*cdf0e10cSrcweir             dumpFrHeader( true, false );
1807*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "label-offset", "CONV-PERCENT" );
1808*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "alignment", "CHFRCATEGORYPROPS-ALIGN" );
1809*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRCATEGORYPROPS-FLAGS" );
1810*cdf0e10cSrcweir         break;
1811*cdf0e10cSrcweir 
1812*cdf0e10cSrcweir         case BIFF_ID_CHFREXTPROPS:
1813*cdf0e10cSrcweir         {
1814*cdf0e10cSrcweir             dumpFrHeader( true, true );
1815*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "data-size" );
1816*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "version" );
1817*cdf0e10cSrcweir             dumpUnused( 1 );
1818*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "parent", "CHFREXTPROPS-PARENT" );
1819*cdf0e10cSrcweir             dumpChFrExtProps();
1820*cdf0e10cSrcweir             dumpUnused( 4 );
1821*cdf0e10cSrcweir         }
1822*cdf0e10cSrcweir         break;
1823*cdf0e10cSrcweir 
1824*cdf0e10cSrcweir         case BIFF_ID_CHFRINFO:
1825*cdf0e10cSrcweir         {
1826*cdf0e10cSrcweir             dumpFrHeader( true, false );
1827*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "creator", "CHFRINFO-APPVERSION" );
1828*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "writer", "CHFRINFO-APPVERSION" );
1829*cdf0e10cSrcweir             sal_uInt16 nCount = dumpDec< sal_uInt16 >( "rec-range-count" );
1830*cdf0e10cSrcweir             mxOut->resetItemIndex();
1831*cdf0e10cSrcweir             for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
1832*cdf0e10cSrcweir                 dumpHexPair< sal_uInt16 >( "#rec-range", '-' );
1833*cdf0e10cSrcweir         }
1834*cdf0e10cSrcweir         break;
1835*cdf0e10cSrcweir 
1836*cdf0e10cSrcweir         case BIFF_ID_CHFRLABELPROPS:
1837*cdf0e10cSrcweir             dumpFrHeader( true, true );
1838*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRLABELPROPS-FLAGS" );
1839*cdf0e10cSrcweir             dumpUniString( "separator", BIFF_STR_SMARTFLAGS );
1840*cdf0e10cSrcweir         break;
1841*cdf0e10cSrcweir 
1842*cdf0e10cSrcweir         case BIFF_ID_CHFRLAYOUT:
1843*cdf0e10cSrcweir             dumpFrHeader( true, true );
1844*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "checksum" );
1845*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRLAYOUT-FLAGS" );
1846*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" );
1847*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" );
1848*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" );
1849*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" );
1850*cdf0e10cSrcweir             dumpRect< double >( "position" );
1851*cdf0e10cSrcweir             dumpUnused( 2 );
1852*cdf0e10cSrcweir         break;
1853*cdf0e10cSrcweir 
1854*cdf0e10cSrcweir         case BIFF_ID_CHFRPLOTAREALAYOUT:
1855*cdf0e10cSrcweir             dumpFrHeader( true, true );
1856*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "checksum" );
1857*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRPLOTAREALAYOUT-FLAGS" );
1858*cdf0e10cSrcweir             dumpRect< sal_Int16 >( "position" );
1859*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" );
1860*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" );
1861*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" );
1862*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" );
1863*cdf0e10cSrcweir             dumpRect< double >( "position" );
1864*cdf0e10cSrcweir             dumpUnused( 2 );
1865*cdf0e10cSrcweir         break;
1866*cdf0e10cSrcweir 
1867*cdf0e10cSrcweir         case BIFF_ID_CHFRSHAPEPROPS:
1868*cdf0e10cSrcweir             dumpFrHeader( true, true );
1869*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "context" );
1870*cdf0e10cSrcweir             dumpUnused( 2 );
1871*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "checksum" );
1872*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "xml-size" );
1873*cdf0e10cSrcweir         break;
1874*cdf0e10cSrcweir 
1875*cdf0e10cSrcweir         case BIFF_ID_CHFRTEXTPROPS:
1876*cdf0e10cSrcweir             dumpFrHeader( true, true );
1877*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "checksum" );
1878*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "xml-size" );
1879*cdf0e10cSrcweir         break;
1880*cdf0e10cSrcweir 
1881*cdf0e10cSrcweir         case BIFF_ID_CHFRUNITPROPS:
1882*cdf0e10cSrcweir             dumpFrHeader( true, false );
1883*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "preset", "CHFRUNITPROPS-PRESET" );
1884*cdf0e10cSrcweir             dumpDec< double >( "unit" );
1885*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHFRUNITPROPS-FLAGS" );
1886*cdf0e10cSrcweir         break;
1887*cdf0e10cSrcweir 
1888*cdf0e10cSrcweir         case BIFF_ID_CHFRWRAPPER:
1889*cdf0e10cSrcweir             dumpFrHeader( true, false );
1890*cdf0e10cSrcweir         break;
1891*cdf0e10cSrcweir 
1892*cdf0e10cSrcweir         case BIFF_ID_CHLABELRANGE:
1893*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "axis-crossing" );
1894*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "label-frequency" );
1895*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "tick-frequency" );
1896*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHLABELRANGE-FLAGS" );
1897*cdf0e10cSrcweir         break;
1898*cdf0e10cSrcweir 
1899*cdf0e10cSrcweir         case BIFF_ID_CHLEGEND:
1900*cdf0e10cSrcweir             dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
1901*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "docked-pos", "CHLEGEND-DOCKPOS" );
1902*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "spacing", "CHLEGEND-SPACING" );
1903*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHLEGEND-FLAGS" );
1904*cdf0e10cSrcweir         break;
1905*cdf0e10cSrcweir 
1906*cdf0e10cSrcweir         case BIFF_ID_CHLINEFORMAT:
1907*cdf0e10cSrcweir             dumpColorABGR();
1908*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "line-type", "CHLINEFORMAT-LINETYPE" );
1909*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "line-weight", "CHLINEFORMAT-LINEWEIGHT" );
1910*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHLINEFORMAT-FLAGS" );
1911*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx();
1912*cdf0e10cSrcweir         break;
1913*cdf0e10cSrcweir 
1914*cdf0e10cSrcweir         case BIFF_ID_CHMARKERFORMAT:
1915*cdf0e10cSrcweir             dumpColorABGR( "border-color" );
1916*cdf0e10cSrcweir             dumpColorABGR( "fill-color" );
1917*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "marker-type", "CHMARKERFORMAT-TYPE" );
1918*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHMARKERFORMAT-FLAGS" );
1919*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx( "border-color-idx" );
1920*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx( "fill-color-idx" );
1921*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_Int32 >( "marker-size", "CONV-TWIP-TO-PT" );
1922*cdf0e10cSrcweir         break;
1923*cdf0e10cSrcweir 
1924*cdf0e10cSrcweir         case BIFF_ID_CHOBJECTLINK:
1925*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "link-target", "CHOBJECTLINK-TARGET" );
1926*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "series-idx" );
1927*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "point-idx", "CHOBJECTLINK-POINT" );
1928*cdf0e10cSrcweir         break;
1929*cdf0e10cSrcweir 
1930*cdf0e10cSrcweir         case BIFF_ID_CHPICFORMAT:
1931*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bitmap-mode", "CHPICFORMAT-BITMAP-MODE" );
1932*cdf0e10cSrcweir             dumpUnused( 2 );
1933*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHPICFORMAT-FLAGS" );
1934*cdf0e10cSrcweir             dumpDec< double >( "scaling-factor" );
1935*cdf0e10cSrcweir         break;
1936*cdf0e10cSrcweir 
1937*cdf0e10cSrcweir         case BIFF_ID_CHPIE:
1938*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "angle", "CONV-DEG" );
1939*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpDec< sal_uInt16 >( "hole-size" );
1940*cdf0e10cSrcweir             if( eBiff >= BIFF8 ) dumpHex< sal_uInt16 >( "flags", "CHPIE-FLAGS" );
1941*cdf0e10cSrcweir         break;
1942*cdf0e10cSrcweir 
1943*cdf0e10cSrcweir         case BIFF_ID_CHPIVOTFLAGS:
1944*cdf0e10cSrcweir             dumpRepeatedRecId();
1945*cdf0e10cSrcweir             dumpUnused( 2 );
1946*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHPIVOTFLAGS-FLAGS" );
1947*cdf0e10cSrcweir         break;
1948*cdf0e10cSrcweir 
1949*cdf0e10cSrcweir         case BIFF8_ID_CHPIVOTREF:
1950*cdf0e10cSrcweir             dumpRepeatedRecId();
1951*cdf0e10cSrcweir             dumpUnused( 4 );
1952*cdf0e10cSrcweir             dumpUniString( "ref", BIFF_STR_8BITLENGTH );
1953*cdf0e10cSrcweir         break;
1954*cdf0e10cSrcweir 
1955*cdf0e10cSrcweir         case BIFF_ID_CHPLOTGROWTH:
1956*cdf0e10cSrcweir             dumpFix< sal_Int32 >( "horizontal-growth" );
1957*cdf0e10cSrcweir             dumpFix< sal_Int32 >( "vertical-growth" );
1958*cdf0e10cSrcweir         break;
1959*cdf0e10cSrcweir 
1960*cdf0e10cSrcweir         case BIFF_ID_CHPROPERTIES:
1961*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHPROPERTIES-FLAGS" );
1962*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "empty-cells", "CHPROPERTIES-EMPTYCELLS" );
1963*cdf0e10cSrcweir         break;
1964*cdf0e10cSrcweir 
1965*cdf0e10cSrcweir         case BIFF_ID_CHSCATTER:
1966*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubble-size", "CONV-PERCENT" );
1967*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "size-type", "CHSCATTER-SIZETYPE" );
1968*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags", "CHSCATTER-FLAGS" );
1969*cdf0e10cSrcweir         break;
1970*cdf0e10cSrcweir 
1971*cdf0e10cSrcweir         case BIFF_ID_CHSERERRORBAR:
1972*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "type", "CHSERERRORBAR-TYPE" );
1973*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "source", "CHSERERRORBAR-SOURCE" );
1974*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "draw-t-shape" );
1975*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "draw-line" );
1976*cdf0e10cSrcweir             dumpDec< double >( "value" );
1977*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "custom-count" );
1978*cdf0e10cSrcweir         break;
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir         case BIFF_ID_CHSERIES:
1981*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "categories-type", "CHSERIES-TYPE" );
1982*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "values-type", "CHSERIES-TYPE" );
1983*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "categories-count" );
1984*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "values-count" );
1985*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubbles-type", "CHSERIES-TYPE" );
1986*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubbles-count" );
1987*cdf0e10cSrcweir         break;
1988*cdf0e10cSrcweir 
1989*cdf0e10cSrcweir         case BIFF_ID_CHSERTRENDLINE:
1990*cdf0e10cSrcweir             switch( dumpDec< sal_uInt8 >( "type", "CHSERTRENDLINE-TYPE" ) )
1991*cdf0e10cSrcweir             {
1992*cdf0e10cSrcweir                 case 0:     dumpDec< sal_uInt8 >( "order" );            break;
1993*cdf0e10cSrcweir                 case 4:     dumpDec< sal_uInt8 >( "average-period" );   break;
1994*cdf0e10cSrcweir                 default:    dumpUnused( 1 );
1995*cdf0e10cSrcweir             }
1996*cdf0e10cSrcweir             dumpDec< double >( "intercept" );
1997*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-equation" );
1998*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-r-sqrare" );
1999*cdf0e10cSrcweir             dumpDec< double >( "forecast-forward" );
2000*cdf0e10cSrcweir             dumpDec< double >( "forecast-backward" );
2001*cdf0e10cSrcweir         break;
2002*cdf0e10cSrcweir 
2003*cdf0e10cSrcweir         case BIFF_ID_CHSOURCELINK:
2004*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "link-target", "CHSOURCELINK-TARGET" );
2005*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "link-type", "CHSOURCELINK-TYPE" );
2006*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHSOURCELINK-FLAGS" );
2007*cdf0e10cSrcweir             dumpFormatIdx();
2008*cdf0e10cSrcweir             getFormulaDumper().dumpNameFormula();
2009*cdf0e10cSrcweir         break;
2010*cdf0e10cSrcweir 
2011*cdf0e10cSrcweir         case BIFF_ID_CHSTRING:
2012*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "text-type", "CHSTRING-TYPE" );
2013*cdf0e10cSrcweir             dumpString( "text", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
2014*cdf0e10cSrcweir         break;
2015*cdf0e10cSrcweir 
2016*cdf0e10cSrcweir         case BIFF_ID_CHTEXT:
2017*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "horizontal-align", "CHTEXT-HORALIGN" );
2018*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "vertical-align", "CHTEXT-VERALIGN" );
2019*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "fill-mode", "CHTEXT-FILLMODE" );
2020*cdf0e10cSrcweir             dumpColorABGR();
2021*cdf0e10cSrcweir             dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
2022*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags-1", "CHTEXT-FLAGS1" );
2023*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx();
2024*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags-2", "CHTEXT-FLAGS2" );
2025*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "rotation", "TEXTROTATION" );
2026*cdf0e10cSrcweir         break;
2027*cdf0e10cSrcweir 
2028*cdf0e10cSrcweir         case BIFF_ID_CHTICK:
2029*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "major-ticks", "CHTICK-TYPE" );
2030*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "minor-ticks", "CHTICK-TYPE" );
2031*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "label-position", "CHTICK-LABELPOS" );
2032*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "fill-mode", "CHTEXT-FILLMODE" );
2033*cdf0e10cSrcweir             dumpColorABGR( "label-color" );
2034*cdf0e10cSrcweir             dumpUnused( 16 );
2035*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHTICK-FLAGS" );
2036*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpColorIdx( "label-color-idx" );
2037*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "label-rotation", "TEXTROTATION" );
2038*cdf0e10cSrcweir         break;
2039*cdf0e10cSrcweir 
2040*cdf0e10cSrcweir         case BIFF_ID_CHTYPEGROUP:
2041*cdf0e10cSrcweir             dumpUnused( 16 );
2042*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHTYPEGROUP-FLAGS" );
2043*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpDec< sal_uInt16 >( "group-idx" );
2044*cdf0e10cSrcweir         break;
2045*cdf0e10cSrcweir 
2046*cdf0e10cSrcweir         case BIFF_ID_CHVALUERANGE:
2047*cdf0e10cSrcweir             dumpDec< double >( "minimum" );
2048*cdf0e10cSrcweir             dumpDec< double >( "maximum" );
2049*cdf0e10cSrcweir             dumpDec< double >( "major-inc" );
2050*cdf0e10cSrcweir             dumpDec< double >( "minor-inc" );
2051*cdf0e10cSrcweir             dumpDec< double >( "axis-crossing" );
2052*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHVALUERANGE-FLAGS" );
2053*cdf0e10cSrcweir         break;
2054*cdf0e10cSrcweir 
2055*cdf0e10cSrcweir         case BIFF_ID_CODENAME:
2056*cdf0e10cSrcweir             dumpUniString( "codename" );
2057*cdf0e10cSrcweir         break;
2058*cdf0e10cSrcweir 
2059*cdf0e10cSrcweir         case BIFF_ID_CODEPAGE:
2060*cdf0e10cSrcweir             getBiffData().setTextEncoding( dumpCodePage() );
2061*cdf0e10cSrcweir             mbHasCodePage = true;
2062*cdf0e10cSrcweir         break;
2063*cdf0e10cSrcweir 
2064*cdf0e10cSrcweir         case BIFF_ID_COLINFO:
2065*cdf0e10cSrcweir             dumpColRange();
2066*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "col-width", "CONV-COLWIDTH" );
2067*cdf0e10cSrcweir             dumpXfIdx( "xf-idx" );
2068*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "COLINFO-FLAGS" );
2069*cdf0e10cSrcweir             dumpUnused( 2 );
2070*cdf0e10cSrcweir         break;
2071*cdf0e10cSrcweir 
2072*cdf0e10cSrcweir         case BIFF_ID_COLUMNDEFAULT:
2073*cdf0e10cSrcweir             mxOut->resetItemIndex();
2074*cdf0e10cSrcweir             for( sal_Int32 nCol = 0, nCount = dumpColRange(); nCol < nCount; ++nCol )
2075*cdf0e10cSrcweir                 dumpXfIdx( "#xf-idx", true );
2076*cdf0e10cSrcweir             dumpUnused( 2 );
2077*cdf0e10cSrcweir         break;
2078*cdf0e10cSrcweir 
2079*cdf0e10cSrcweir         case BIFF_ID_COLWIDTH:
2080*cdf0e10cSrcweir             dumpColRange( EMPTY_STRING, false );
2081*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "col-width", "CONV-COLWIDTH" );
2082*cdf0e10cSrcweir         break;
2083*cdf0e10cSrcweir 
2084*cdf0e10cSrcweir         case BIFF_ID_COMPRESSPICS:
2085*cdf0e10cSrcweir             dumpFrHeader( true, true );
2086*cdf0e10cSrcweir             dumpBool< sal_uInt32 >( "recommend-compress-pics" );
2087*cdf0e10cSrcweir         break;
2088*cdf0e10cSrcweir 
2089*cdf0e10cSrcweir         case BIFF_ID_CONNECTION:
2090*cdf0e10cSrcweir         {
2091*cdf0e10cSrcweir             dumpFrHeader( true, false );
2092*cdf0e10cSrcweir             sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
2093*cdf0e10cSrcweir             sal_uInt16 nFlags1 = dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
2094*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "param-count" );
2095*cdf0e10cSrcweir             dumpUnused( 2 );
2096*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "querytable-flags", "QUERYTABLESETTINGS-FLAGS" );
2097*cdf0e10cSrcweir             switch( nType )
2098*cdf0e10cSrcweir             {
2099*cdf0e10cSrcweir                 case 4:     dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" );     break;
2100*cdf0e10cSrcweir                 case 5:     dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" );   break;
2101*cdf0e10cSrcweir                 case 7:     dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" );       break;
2102*cdf0e10cSrcweir                 default:    dumpUnused( 2 );
2103*cdf0e10cSrcweir             }
2104*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "edited-version" );
2105*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
2106*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
2107*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
2108*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
2109*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
2110*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
2111*cdf0e10cSrcweir             dumpUnused( 1 );
2112*cdf0e10cSrcweir             dumpSegmentedUniString( "source-file" );
2113*cdf0e10cSrcweir             dumpSegmentedUniString( "source-conn-file" );
2114*cdf0e10cSrcweir             dumpSegmentedUniString( "name" );
2115*cdf0e10cSrcweir             dumpSegmentedUniString( "description" );
2116*cdf0e10cSrcweir             dumpSegmentedUniString( "sso-id" );
2117*cdf0e10cSrcweir             if( nFlags1 & 0x0004 ) dumpSegmentedUniString( "table-names" );
2118*cdf0e10cSrcweir             if( nFlags1 & 0x0010 )
2119*cdf0e10cSrcweir             {
2120*cdf0e10cSrcweir                 break;   // TODO: parameter array structure
2121*cdf0e10cSrcweir             }
2122*cdf0e10cSrcweir             bool bEscape = false;
2123*cdf0e10cSrcweir             switch( nType )
2124*cdf0e10cSrcweir             {
2125*cdf0e10cSrcweir                 case 1:
2126*cdf0e10cSrcweir                     dumpSegmentedUniString( "connection-string" );
2127*cdf0e10cSrcweir                 break;
2128*cdf0e10cSrcweir                 case 4:
2129*cdf0e10cSrcweir                     dumpSegmentedUniStringArray( "urls" );
2130*cdf0e10cSrcweir                     dumpSegmentedUniStringArray( "post-method" );
2131*cdf0e10cSrcweir                 break;
2132*cdf0e10cSrcweir                 case 5:
2133*cdf0e10cSrcweir                     bEscape = true;
2134*cdf0e10cSrcweir                 break;
2135*cdf0e10cSrcweir                 case 6:
2136*cdf0e10cSrcweir                     bEscape = true;
2137*cdf0e10cSrcweir                 break;
2138*cdf0e10cSrcweir             }
2139*cdf0e10cSrcweir             if( bEscape )
2140*cdf0e10cSrcweir                 break;
2141*cdf0e10cSrcweir             dumpSegmentedUniStringArray( "sql-command" );
2142*cdf0e10cSrcweir             dumpSegmentedUniStringArray( "orig-sql-command" );
2143*cdf0e10cSrcweir             dumpSegmentedUniStringArray( "webquery-dialog-url" );
2144*cdf0e10cSrcweir             switch( dumpDec< sal_uInt8 >( "linked-object-type", "CONNECTION-LINKEDOBJECTTYPE" ) )
2145*cdf0e10cSrcweir             {
2146*cdf0e10cSrcweir                 case 1: dumpSegmentedUniString( "defined-name" );   break;
2147*cdf0e10cSrcweir                 case 2: dumpHex< sal_uInt16 >( "cache-id" );        break;
2148*cdf0e10cSrcweir             }
2149*cdf0e10cSrcweir         }
2150*cdf0e10cSrcweir         break;
2151*cdf0e10cSrcweir 
2152*cdf0e10cSrcweir         case BIFF_ID_CONT:
2153*cdf0e10cSrcweir             if( (eBiff == BIFF8) && (getLastRecId() == BIFF_ID_OBJ) )
2154*cdf0e10cSrcweir                 dumpEmbeddedDff();
2155*cdf0e10cSrcweir         break;
2156*cdf0e10cSrcweir 
2157*cdf0e10cSrcweir         case BIFF_ID_COORDLIST:
2158*cdf0e10cSrcweir         {
2159*cdf0e10cSrcweir             mxOut->resetItemIndex();
2160*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 12, 10 );
2161*cdf0e10cSrcweir             while( rStrm.getRemaining() >= 4 )
2162*cdf0e10cSrcweir             {
2163*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
2164*cdf0e10cSrcweir                 writeEmptyItem( "#point" );
2165*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "x" );
2166*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "y" );
2167*cdf0e10cSrcweir             }
2168*cdf0e10cSrcweir         }
2169*cdf0e10cSrcweir         break;
2170*cdf0e10cSrcweir 
2171*cdf0e10cSrcweir         case BIFF_ID_COUNTRY:
2172*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "ui-country", "COUNTRY" );
2173*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "sys-country", "COUNTRY" );
2174*cdf0e10cSrcweir         break;
2175*cdf0e10cSrcweir 
2176*cdf0e10cSrcweir         case BIFF_ID_CRN:
2177*cdf0e10cSrcweir         {
2178*cdf0e10cSrcweir             sal_Int32 nCol2 = dumpColIndex( "last-col-idx", false );
2179*cdf0e10cSrcweir             sal_Int32 nCol1 = dumpColIndex( "first-col-idx", false );
2180*cdf0e10cSrcweir             sal_Int32 nRow = dumpRowIndex( "row-idx" );
2181*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 14, 17 );
2182*cdf0e10cSrcweir             for( Address aPos( nCol1, nRow ); !rStrm.isEof() && (aPos.mnCol <= nCol2); ++aPos.mnCol )
2183*cdf0e10cSrcweir             {
2184*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
2185*cdf0e10cSrcweir                 writeAddressItem( "pos", aPos );
2186*cdf0e10cSrcweir                 dumpConstValue();
2187*cdf0e10cSrcweir             }
2188*cdf0e10cSrcweir         }
2189*cdf0e10cSrcweir         break;
2190*cdf0e10cSrcweir 
2191*cdf0e10cSrcweir         case BIFF_ID_DCONBINAME:
2192*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "builtin-id", "DEFINEDNAME-BUILTINID" );
2193*cdf0e10cSrcweir             dumpUnused( 3 );
2194*cdf0e10cSrcweir             dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
2195*cdf0e10cSrcweir         break;
2196*cdf0e10cSrcweir 
2197*cdf0e10cSrcweir         case BIFF_ID_DCONNAME:
2198*cdf0e10cSrcweir             dumpString( "source-name", BIFF_STR_8BITLENGTH );
2199*cdf0e10cSrcweir             dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
2200*cdf0e10cSrcweir         break;
2201*cdf0e10cSrcweir 
2202*cdf0e10cSrcweir         case BIFF_ID_DCONREF:
2203*cdf0e10cSrcweir             dumpRange( "source-range", false );
2204*cdf0e10cSrcweir             dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
2205*cdf0e10cSrcweir         break;
2206*cdf0e10cSrcweir 
2207*cdf0e10cSrcweir         case BIFF2_ID_DATATABLE:
2208*cdf0e10cSrcweir             dumpRange( "table-range", false );
2209*cdf0e10cSrcweir             dumpBoolean( "recalc-always" );
2210*cdf0e10cSrcweir             dumpBoolean( "row-table" );
2211*cdf0e10cSrcweir             dumpAddress( "ref1" );
2212*cdf0e10cSrcweir         break;
2213*cdf0e10cSrcweir 
2214*cdf0e10cSrcweir         case BIFF3_ID_DATATABLE:
2215*cdf0e10cSrcweir             dumpRange( "table-range", false );
2216*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "DATATABLE-FLAGS" );
2217*cdf0e10cSrcweir             dumpAddress( "ref1" );
2218*cdf0e10cSrcweir             dumpAddress( "ref2" );
2219*cdf0e10cSrcweir         break;
2220*cdf0e10cSrcweir 
2221*cdf0e10cSrcweir         case BIFF2_ID_DATATABLE2:
2222*cdf0e10cSrcweir             dumpRange( "table-range", false );
2223*cdf0e10cSrcweir             dumpBoolean( "recalc-always" );
2224*cdf0e10cSrcweir             dumpUnused( 1 );
2225*cdf0e10cSrcweir             dumpAddress( "ref1" );
2226*cdf0e10cSrcweir             dumpAddress( "ref2" );
2227*cdf0e10cSrcweir         break;
2228*cdf0e10cSrcweir 
2229*cdf0e10cSrcweir         case BIFF_ID_DATAVALIDATION:
2230*cdf0e10cSrcweir         {
2231*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "DATAVALIDATION-FLAGS" );
2232*cdf0e10cSrcweir             dumpUniString( "input-title" );
2233*cdf0e10cSrcweir             dumpUniString( "error-title" );
2234*cdf0e10cSrcweir             dumpUniString( "input-message" );
2235*cdf0e10cSrcweir             dumpUniString( "error-message" );
2236*cdf0e10cSrcweir             sal_uInt16 nFmla1Size = getFormulaDumper().dumpFormulaSize( "formula1-size" );
2237*cdf0e10cSrcweir             dumpUnused( 2 );
2238*cdf0e10cSrcweir             if( nFmla1Size > 0 )
2239*cdf0e10cSrcweir                 getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
2240*cdf0e10cSrcweir             sal_uInt16 nFmla2Size = getFormulaDumper().dumpFormulaSize( "formula2-size" );
2241*cdf0e10cSrcweir             dumpUnused( 2 );
2242*cdf0e10cSrcweir             if( nFmla2Size > 0 )
2243*cdf0e10cSrcweir                 getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
2244*cdf0e10cSrcweir             dumpRangeList();
2245*cdf0e10cSrcweir         }
2246*cdf0e10cSrcweir         break;
2247*cdf0e10cSrcweir 
2248*cdf0e10cSrcweir         case BIFF_ID_DATAVALIDATIONS:
2249*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "DATAVALIDATIONS-FLAGS" );
2250*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "input-box-pos-x" );
2251*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "input-box-pos-y" );
2252*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "dropdown-object-id" );
2253*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "dval-entry-count" );
2254*cdf0e10cSrcweir         break;
2255*cdf0e10cSrcweir 
2256*cdf0e10cSrcweir         case BIFF_ID_DBCELL:
2257*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "reverse-offset-to-row" );
2258*cdf0e10cSrcweir             mxOut->resetItemIndex();
2259*cdf0e10cSrcweir             while( rStrm.getRemaining() >= 2 )
2260*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "#cell-offset" );
2261*cdf0e10cSrcweir         break;
2262*cdf0e10cSrcweir 
2263*cdf0e10cSrcweir         case BIFF_ID_DBQUERY:
2264*cdf0e10cSrcweir             if( eBiff == BIFF8 )
2265*cdf0e10cSrcweir             {
2266*cdf0e10cSrcweir                 if( (getLastRecId() != BIFF_ID_PCITEM_STRING) && (getLastRecId() != BIFF_ID_DBQUERY) )
2267*cdf0e10cSrcweir                 {
2268*cdf0e10cSrcweir                     dumpHex< sal_uInt16 >( "flags", "DBQUERY-FLAGS" );
2269*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "sql-param-count" );
2270*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "command-count" );
2271*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "post-method-count" );
2272*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "server-sql-count" );
2273*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "odbc-connection-count" );
2274*cdf0e10cSrcweir                 }
2275*cdf0e10cSrcweir             }
2276*cdf0e10cSrcweir         break;
2277*cdf0e10cSrcweir 
2278*cdf0e10cSrcweir         case BIFF2_ID_DEFINEDNAME:
2279*cdf0e10cSrcweir         case BIFF3_ID_DEFINEDNAME:
2280*cdf0e10cSrcweir         {
2281*cdf0e10cSrcweir             rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
2282*cdf0e10cSrcweir             dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "DEFINEDNAME-FLAGS" );
2283*cdf0e10cSrcweir             if( eBiff == BIFF2 ) dumpDec< sal_uInt8 >( "macro-type", "DEFINEDNAME-MACROTYPE-BIFF2" );
2284*cdf0e10cSrcweir             dumpChar( "accelerator", eTextEnc );
2285*cdf0e10cSrcweir             sal_uInt8 nNameLen = dumpDec< sal_uInt8 >( "name-len" );
2286*cdf0e10cSrcweir             sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize();
2287*cdf0e10cSrcweir             if( eBiff >= BIFF5 )
2288*cdf0e10cSrcweir             {
2289*cdf0e10cSrcweir                 bool bBiff8 = eBiff == BIFF8;
2290*cdf0e10cSrcweir                 if( bBiff8 ) dumpUnused( 2 ); else dumpDec< sal_uInt16 >( "externsheet-idx", "DEFINEDNAME-SHEETIDX" );
2291*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "sheet-idx", "DEFINEDNAME-SHEETIDX" );
2292*cdf0e10cSrcweir                 sal_uInt8 nMenuLen = dumpDec< sal_uInt8 >( "menu-text-len" );
2293*cdf0e10cSrcweir                 sal_uInt8 nDescrLen = dumpDec< sal_uInt8 >( "description-text-len" );
2294*cdf0e10cSrcweir                 sal_uInt8 nHelpLen = dumpDec< sal_uInt8 >( "help-text-len" );
2295*cdf0e10cSrcweir                 sal_uInt8 nStatusLen = dumpDec< sal_uInt8 >( "statusbar-text-len" );
2296*cdf0e10cSrcweir                 writeStringItem( "name", bBiff8 ? rStrm.readUniStringBody( nNameLen, true ) : rStrm.readCharArrayUC( nNameLen, eTextEnc, true ) );
2297*cdf0e10cSrcweir                 getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
2298*cdf0e10cSrcweir                 if( nMenuLen > 0 ) writeStringItem( "menu-text", bBiff8 ? rStrm.readUniStringBody( nMenuLen, true ) : rStrm.readCharArrayUC( nMenuLen, eTextEnc, true ) );
2299*cdf0e10cSrcweir                 if( nDescrLen > 0 ) writeStringItem( "description-text", bBiff8 ? rStrm.readUniStringBody( nDescrLen, true ) : rStrm.readCharArrayUC( nDescrLen, eTextEnc, true ) );
2300*cdf0e10cSrcweir                 if( nHelpLen > 0 ) writeStringItem( "help-text", bBiff8 ? rStrm.readUniStringBody( nHelpLen, true ) : rStrm.readCharArrayUC( nHelpLen, eTextEnc, true ) );
2301*cdf0e10cSrcweir                 if( nStatusLen > 0 ) writeStringItem( "statusbar-text", bBiff8 ? rStrm.readUniStringBody( nStatusLen, true ) : rStrm.readCharArrayUC( nStatusLen, eTextEnc, true ) );
2302*cdf0e10cSrcweir             }
2303*cdf0e10cSrcweir             else
2304*cdf0e10cSrcweir             {
2305*cdf0e10cSrcweir                 writeStringItem( "name", rStrm.readCharArrayUC( nNameLen, eTextEnc, true ) );
2306*cdf0e10cSrcweir                 getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
2307*cdf0e10cSrcweir                 if( eBiff == BIFF2 ) getFormulaDumper().dumpFormulaSize();
2308*cdf0e10cSrcweir             }
2309*cdf0e10cSrcweir         }
2310*cdf0e10cSrcweir         break;
2311*cdf0e10cSrcweir 
2312*cdf0e10cSrcweir         case BIFF3_ID_DEFROWHEIGHT:
2313*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "DEFROWHEIGHT-FLAGS" );
2314*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "row-height", "CONV-TWIP-TO-PT" );
2315*cdf0e10cSrcweir         break;
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir         case BIFF2_ID_DIMENSION:
2318*cdf0e10cSrcweir         case BIFF3_ID_DIMENSION:
2319*cdf0e10cSrcweir             dumpRange( "used-area", true, (nRecId == BIFF3_ID_DIMENSION) && (eBiff == BIFF8) );
2320*cdf0e10cSrcweir             if( nRecId == BIFF3_ID_DIMENSION ) dumpUnused( 2 );
2321*cdf0e10cSrcweir         break;
2322*cdf0e10cSrcweir 
2323*cdf0e10cSrcweir         case BIFF_ID_DXF:
2324*cdf0e10cSrcweir             dumpFrHeader( true, true );
2325*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "DXF-FLAGS" );
2326*cdf0e10cSrcweir             dumpDxfProp();
2327*cdf0e10cSrcweir         break;
2328*cdf0e10cSrcweir 
2329*cdf0e10cSrcweir         case BIFF_ID_EXTERNALBOOK:
2330*cdf0e10cSrcweir         {
2331*cdf0e10cSrcweir             sal_uInt16 nCount = dumpDec< sal_uInt16 >( "sheet-count" );
2332*cdf0e10cSrcweir             if( rStrm.getRemaining() == 2 )
2333*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "special-key", "EXTERNALBOOK-KEY" );
2334*cdf0e10cSrcweir             else
2335*cdf0e10cSrcweir             {
2336*cdf0e10cSrcweir                 dumpString( "workbook-url" );
2337*cdf0e10cSrcweir                 mxOut->resetItemIndex();
2338*cdf0e10cSrcweir                 for( sal_uInt16 nSheet = 0; !rStrm.isEof() && (nSheet < nCount); ++nSheet )
2339*cdf0e10cSrcweir                     dumpString( "#sheet-name" );
2340*cdf0e10cSrcweir             }
2341*cdf0e10cSrcweir         }
2342*cdf0e10cSrcweir         break;
2343*cdf0e10cSrcweir 
2344*cdf0e10cSrcweir         case BIFF2_ID_EXTERNALNAME:
2345*cdf0e10cSrcweir         case BIFF3_ID_EXTERNALNAME:
2346*cdf0e10cSrcweir         {
2347*cdf0e10cSrcweir             sal_uInt16 nFlags = (eBiff >= BIFF3) ? dumpHex< sal_uInt16 >( "flags", "EXTERNALNAME-FLAGS" ) : 0;
2348*cdf0e10cSrcweir             if( eBiff >= BIFF5 )
2349*cdf0e10cSrcweir             {
2350*cdf0e10cSrcweir                 if( getFlag< sal_uInt16 >( nFlags, 0x0010 ) )
2351*cdf0e10cSrcweir                 {
2352*cdf0e10cSrcweir                     dumpHex< sal_uInt32 >( "storage-id" );
2353*cdf0e10cSrcweir                 }
2354*cdf0e10cSrcweir                 else
2355*cdf0e10cSrcweir                 {
2356*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "externsheet-idx" );
2357*cdf0e10cSrcweir                     dumpUnused( 2 );
2358*cdf0e10cSrcweir                 }
2359*cdf0e10cSrcweir             }
2360*cdf0e10cSrcweir             OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
2361*cdf0e10cSrcweir             if( (aName.getLength() > 0) && (aName[ 0 ] == 1) && (rStrm.getRemaining() >= 2) )
2362*cdf0e10cSrcweir                 getFormulaDumper().dumpNameFormula();
2363*cdf0e10cSrcweir         }
2364*cdf0e10cSrcweir         break;
2365*cdf0e10cSrcweir 
2366*cdf0e10cSrcweir         case BIFF_ID_EXTERNSHEET:
2367*cdf0e10cSrcweir             if( eBiff == BIFF8 )
2368*cdf0e10cSrcweir             {
2369*cdf0e10cSrcweir                 sal_uInt16 nCount = dumpDec< sal_uInt16 >( "ref-count" );
2370*cdf0e10cSrcweir                 TableGuard aTabGuard( mxOut, 10, 17, 24 );
2371*cdf0e10cSrcweir                 mxOut->resetItemIndex();
2372*cdf0e10cSrcweir                 for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nCount); ++nRefId )
2373*cdf0e10cSrcweir                 {
2374*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
2375*cdf0e10cSrcweir                     writeEmptyItem( "#ref" );
2376*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "extbook-idx" );
2377*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "first-sheet", "EXTERNSHEET-IDX" );
2378*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "last-sheet", "EXTERNSHEET-IDX" );
2379*cdf0e10cSrcweir                 }
2380*cdf0e10cSrcweir             }
2381*cdf0e10cSrcweir             else
2382*cdf0e10cSrcweir             {
2383*cdf0e10cSrcweir                 OStringBuffer aUrl( rStrm.readByteString( false, true ) );
2384*cdf0e10cSrcweir                 if( (aUrl.getLength() > 0) && (aUrl[ 0 ] == '\x03') )
2385*cdf0e10cSrcweir                     aUrl.append( static_cast< sal_Char >( rStrm.readuInt8() ) );
2386*cdf0e10cSrcweir                 writeStringItem( "encoded-url", OStringToOUString( aUrl.makeStringAndClear(), getBiffData().getTextEncoding() ) );
2387*cdf0e10cSrcweir             }
2388*cdf0e10cSrcweir         break;
2389*cdf0e10cSrcweir 
2390*cdf0e10cSrcweir         case BIFF_ID_FILEPASS:
2391*cdf0e10cSrcweir         {
2392*cdf0e10cSrcweir             rStrm.enableDecoder( false );
2393*cdf0e10cSrcweir             if( eBiff == BIFF8 )
2394*cdf0e10cSrcweir             {
2395*cdf0e10cSrcweir                 switch( dumpDec< sal_uInt16 >( "type", "FILEPASS-TYPE" ) )
2396*cdf0e10cSrcweir                 {
2397*cdf0e10cSrcweir                     case 0:
2398*cdf0e10cSrcweir                         dumpHex< sal_uInt16 >( "key" );
2399*cdf0e10cSrcweir                         dumpHex< sal_uInt16 >( "verifier" );
2400*cdf0e10cSrcweir                     break;
2401*cdf0e10cSrcweir                     case 1:
2402*cdf0e10cSrcweir                     {
2403*cdf0e10cSrcweir                         sal_uInt16 nMajor = dumpDec< sal_uInt16 >( "major-version", "FILEPASS-MAJOR" );
2404*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "minor-version" );
2405*cdf0e10cSrcweir                         switch( nMajor )
2406*cdf0e10cSrcweir                         {
2407*cdf0e10cSrcweir                             case 1:
2408*cdf0e10cSrcweir                                 dumpArray( "salt", 16 );
2409*cdf0e10cSrcweir                                 dumpArray( "verifier", 16 );
2410*cdf0e10cSrcweir                                 dumpArray( "verifier-hash", 16 );
2411*cdf0e10cSrcweir                             break;
2412*cdf0e10cSrcweir                         }
2413*cdf0e10cSrcweir                     }
2414*cdf0e10cSrcweir                     break;
2415*cdf0e10cSrcweir                 }
2416*cdf0e10cSrcweir             }
2417*cdf0e10cSrcweir             else
2418*cdf0e10cSrcweir             {
2419*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "key" );
2420*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "verifier" );
2421*cdf0e10cSrcweir             }
2422*cdf0e10cSrcweir             rStrm.seekToStart();
2423*cdf0e10cSrcweir             BiffDecoderRef xDecoder = BiffCodecHelper::implReadFilePass( rStrm, eBiff );
2424*cdf0e10cSrcweir             if( xDecoder.get() )
2425*cdf0e10cSrcweir                 cfg().requestEncryptionData( *xDecoder );
2426*cdf0e10cSrcweir             setBinaryOnlyMode( !xDecoder || !xDecoder->isValid() );
2427*cdf0e10cSrcweir         }
2428*cdf0e10cSrcweir         break;
2429*cdf0e10cSrcweir 
2430*cdf0e10cSrcweir         case BIFF_ID_FILESHARING:
2431*cdf0e10cSrcweir             dumpBool< sal_uInt16 >( "recommend-read-only" );
2432*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "password-hash" );
2433*cdf0e10cSrcweir             dumpString( "password-creator", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
2434*cdf0e10cSrcweir         break;
2435*cdf0e10cSrcweir 
2436*cdf0e10cSrcweir         case BIFF_ID_FILTERCOLUMN:
2437*cdf0e10cSrcweir         {
2438*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "column-index" );
2439*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
2440*cdf0e10cSrcweir             sal_uInt8 nStrLen1 = dumpFilterColumnOperator( "operator-1" );
2441*cdf0e10cSrcweir             sal_uInt8 nStrLen2 = dumpFilterColumnOperator( "operator-2" );
2442*cdf0e10cSrcweir             bool bBiff8 = eBiff == BIFF8;
2443*cdf0e10cSrcweir             rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
2444*cdf0e10cSrcweir             if( nStrLen1 > 0 ) writeStringItem( "string-1", bBiff8 ? rStrm.readUniStringBody( nStrLen1, true ) : rStrm.readCharArrayUC( nStrLen1, eTextEnc, true ) );
2445*cdf0e10cSrcweir             if( nStrLen2 > 0 ) writeStringItem( "string-2", bBiff8 ? rStrm.readUniStringBody( nStrLen2, true ) : rStrm.readCharArrayUC( nStrLen2, eTextEnc, true ) );
2446*cdf0e10cSrcweir         }
2447*cdf0e10cSrcweir         break;
2448*cdf0e10cSrcweir 
2449*cdf0e10cSrcweir         case BIFF2_ID_FONT:
2450*cdf0e10cSrcweir         case BIFF3_ID_FONT:
2451*cdf0e10cSrcweir             dumpFontRec();
2452*cdf0e10cSrcweir         break;
2453*cdf0e10cSrcweir 
2454*cdf0e10cSrcweir         case BIFF_ID_FORCEFULLCALC:
2455*cdf0e10cSrcweir             dumpFrHeader( true, true );
2456*cdf0e10cSrcweir             dumpBool< sal_Int32 >( "recalc-all-formulas" );
2457*cdf0e10cSrcweir         break;
2458*cdf0e10cSrcweir 
2459*cdf0e10cSrcweir         case BIFF2_ID_FORMAT:
2460*cdf0e10cSrcweir         case BIFF4_ID_FORMAT:
2461*cdf0e10cSrcweir             dumpFormatRec();
2462*cdf0e10cSrcweir         break;
2463*cdf0e10cSrcweir 
2464*cdf0e10cSrcweir         case BIFF2_ID_FORMULA:
2465*cdf0e10cSrcweir         case BIFF3_ID_FORMULA:
2466*cdf0e10cSrcweir         case BIFF4_ID_FORMULA:
2467*cdf0e10cSrcweir             dumpCellHeader( eBiff == BIFF2 );
2468*cdf0e10cSrcweir             dumpFormulaResult();
2469*cdf0e10cSrcweir             dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "FORMULA-FLAGS" );
2470*cdf0e10cSrcweir             if( eBiff >= BIFF5 ) dumpUnused( 4 );
2471*cdf0e10cSrcweir             getFormulaDumper().dumpCellFormula();
2472*cdf0e10cSrcweir         break;
2473*cdf0e10cSrcweir 
2474*cdf0e10cSrcweir         case BIFF_ID_FOOTER:
2475*cdf0e10cSrcweir             if( rStrm.getRemaining() > 0 )
2476*cdf0e10cSrcweir                 dumpString( "footer", BIFF_STR_8BITLENGTH );
2477*cdf0e10cSrcweir         break;
2478*cdf0e10cSrcweir 
2479*cdf0e10cSrcweir         case BIFF_ID_GUTS:
2480*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "row-outlines-width" );
2481*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "column-outlines-height" );
2482*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "row-levels", "GUTS-LEVELS" );
2483*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "column-levels", "GUTS-LEVELS" );
2484*cdf0e10cSrcweir         break;
2485*cdf0e10cSrcweir 
2486*cdf0e10cSrcweir         case BIFF_ID_HEADER:
2487*cdf0e10cSrcweir             if( rStrm.getRemaining() > 0 )
2488*cdf0e10cSrcweir                 dumpString( "header", BIFF_STR_8BITLENGTH );
2489*cdf0e10cSrcweir         break;
2490*cdf0e10cSrcweir 
2491*cdf0e10cSrcweir         case BIFF_ID_HEADERFOOTER:
2492*cdf0e10cSrcweir         {
2493*cdf0e10cSrcweir             dumpFrHeader( true, true );
2494*cdf0e10cSrcweir             dumpGuid( "view-guid" );
2495*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "HEADERFOOTER-FLAGS" );
2496*cdf0e10cSrcweir             sal_uInt16 nEvenHLen = dumpDec< sal_uInt16 >( "even-h-len" );
2497*cdf0e10cSrcweir             sal_uInt16 nEvenFLen = dumpDec< sal_uInt16 >( "even-f-len" );
2498*cdf0e10cSrcweir             sal_uInt16 nFirstHLen = dumpDec< sal_uInt16 >( "first-h-len" );
2499*cdf0e10cSrcweir             sal_uInt16 nFirstFLen = dumpDec< sal_uInt16 >( "first-f-len" );
2500*cdf0e10cSrcweir             if( nEvenHLen > 0 ) dumpUniString( "even-h" );
2501*cdf0e10cSrcweir             if( nEvenFLen > 0 ) dumpUniString( "even-f" );
2502*cdf0e10cSrcweir             if( nFirstHLen > 0 ) dumpUniString( "first-h" );
2503*cdf0e10cSrcweir             if( nFirstFLen > 0 ) dumpUniString( "first-f" );
2504*cdf0e10cSrcweir         }
2505*cdf0e10cSrcweir         break;
2506*cdf0e10cSrcweir 
2507*cdf0e10cSrcweir         case BIFF_ID_HYPERLINK:
2508*cdf0e10cSrcweir             dumpRange();
2509*cdf0e10cSrcweir             if( cfg().getStringOption( dumpGuid( "guid" ), OUString() ).equalsAscii( "StdHlink" ) )
2510*cdf0e10cSrcweir                 StdHlinkObject( *this ).dump();
2511*cdf0e10cSrcweir         break;
2512*cdf0e10cSrcweir 
2513*cdf0e10cSrcweir         case BIFF3_ID_IMGDATA:
2514*cdf0e10cSrcweir         case BIFF8_ID_IMGDATA:
2515*cdf0e10cSrcweir         {
2516*cdf0e10cSrcweir             sal_uInt16 nFormat = dumpDec< sal_uInt16 >( "image-format", "IMGDATA-FORMAT" );
2517*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "environment", "IMGDATA-ENV" );
2518*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "data-size" );
2519*cdf0e10cSrcweir             if( nFormat == 9 )
2520*cdf0e10cSrcweir             {
2521*cdf0e10cSrcweir                 writeEmptyItem( "bitmap-header" );
2522*cdf0e10cSrcweir                 IndentGuard aIndGuard( mxOut );
2523*cdf0e10cSrcweir                 if( dumpDec< sal_uInt32 >( "header-size" ) == 12 )
2524*cdf0e10cSrcweir                 {
2525*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "width" );
2526*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "height" );
2527*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "planes" );
2528*cdf0e10cSrcweir                     dumpDec< sal_Int16 >( "bit-count" );
2529*cdf0e10cSrcweir                 }
2530*cdf0e10cSrcweir             }
2531*cdf0e10cSrcweir         }
2532*cdf0e10cSrcweir         break;
2533*cdf0e10cSrcweir 
2534*cdf0e10cSrcweir         case BIFF2_ID_INDEX:
2535*cdf0e10cSrcweir         case BIFF3_ID_INDEX:
2536*cdf0e10cSrcweir             if( eBiff <= BIFF4 )
2537*cdf0e10cSrcweir                 dumpHex< sal_uInt32 >( "first-defname-pos", "CONV-DEC" );
2538*cdf0e10cSrcweir             else
2539*cdf0e10cSrcweir                 dumpUnused( 4 );
2540*cdf0e10cSrcweir             dumpRowIndex( "first-row-with-cell", eBiff == BIFF8 );
2541*cdf0e10cSrcweir             dumpRowIndex( "first-free-row", eBiff == BIFF8 );
2542*cdf0e10cSrcweir             if( nRecId == BIFF3_ID_INDEX ) dumpHex< sal_uInt32 >( (eBiff <= BIFF4) ? "first-xf-pos" : "defcolwidth-pos", "CONV-DEC" );
2543*cdf0e10cSrcweir             mxOut->resetItemIndex();
2544*cdf0e10cSrcweir             while( rStrm.getRemaining() >= 4 )
2545*cdf0e10cSrcweir                 dumpHex< sal_uInt32 >( "#first-row-pos-of-block", "CONV-DEC" );
2546*cdf0e10cSrcweir         break;
2547*cdf0e10cSrcweir 
2548*cdf0e10cSrcweir         case BIFF2_ID_INTEGER:
2549*cdf0e10cSrcweir             dumpCellHeader( true );
2550*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "value" );
2551*cdf0e10cSrcweir         break;
2552*cdf0e10cSrcweir 
2553*cdf0e10cSrcweir         case BIFF2_ID_LABEL:
2554*cdf0e10cSrcweir         case BIFF3_ID_LABEL:
2555*cdf0e10cSrcweir         {
2556*cdf0e10cSrcweir             bool bBiff2 = nRecId == BIFF2_ID_LABEL;
2557*cdf0e10cSrcweir             sal_uInt16 nXfIdx = dumpCellHeader( bBiff2 );
2558*cdf0e10cSrcweir             rtl_TextEncoding eOldTextEnc = getBiffData().getTextEncoding();
2559*cdf0e10cSrcweir             getBiffData().setTextEncoding( getBiffData().getXfEncoding( nXfIdx ) );
2560*cdf0e10cSrcweir             dumpString( "value", bBiff2 ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT );
2561*cdf0e10cSrcweir             getBiffData().setTextEncoding( eOldTextEnc );
2562*cdf0e10cSrcweir         }
2563*cdf0e10cSrcweir         break;
2564*cdf0e10cSrcweir 
2565*cdf0e10cSrcweir         case BIFF_ID_LABELRANGES:
2566*cdf0e10cSrcweir             dumpRangeList( "row-ranges" );
2567*cdf0e10cSrcweir             dumpRangeList( "col-ranges" );
2568*cdf0e10cSrcweir         break;
2569*cdf0e10cSrcweir 
2570*cdf0e10cSrcweir         case BIFF_ID_LABELSST:
2571*cdf0e10cSrcweir             dumpCellHeader();
2572*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sst-idx" );
2573*cdf0e10cSrcweir         break;
2574*cdf0e10cSrcweir 
2575*cdf0e10cSrcweir         case BIFF_ID_MERGEDCELLS:
2576*cdf0e10cSrcweir             mxOut->resetItemIndex();
2577*cdf0e10cSrcweir             for( sal_uInt16 nIdx = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !rStrm.isEof() && (nIdx < nCount); ++nIdx )
2578*cdf0e10cSrcweir                 dumpRange( "#range" );
2579*cdf0e10cSrcweir         break;
2580*cdf0e10cSrcweir 
2581*cdf0e10cSrcweir         case BIFF_ID_MSODRAWING:
2582*cdf0e10cSrcweir         case BIFF_ID_MSODRAWINGGROUP:
2583*cdf0e10cSrcweir         case BIFF_ID_MSODRAWINGSEL:
2584*cdf0e10cSrcweir             dumpEmbeddedDff();
2585*cdf0e10cSrcweir             mbHasDff = true;
2586*cdf0e10cSrcweir         break;
2587*cdf0e10cSrcweir 
2588*cdf0e10cSrcweir         case BIFF_ID_MTHREADSETTINGS:
2589*cdf0e10cSrcweir             dumpFrHeader( true, true );
2590*cdf0e10cSrcweir             dumpBool< sal_Int32 >( "multi-thread-enabled" );
2591*cdf0e10cSrcweir             dumpBool< sal_Int32 >( "manual-thread-count" );
2592*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "thread-count" );
2593*cdf0e10cSrcweir         break;
2594*cdf0e10cSrcweir 
2595*cdf0e10cSrcweir         case BIFF_ID_MULTBLANK:
2596*cdf0e10cSrcweir         {
2597*cdf0e10cSrcweir             Address aPos = dumpAddress();
2598*cdf0e10cSrcweir             {
2599*cdf0e10cSrcweir                 TableGuard aTabGuard( mxOut, 12 );
2600*cdf0e10cSrcweir                 for( ; rStrm.getRemaining() >= 4; ++aPos.mnCol )
2601*cdf0e10cSrcweir                 {
2602*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
2603*cdf0e10cSrcweir                     writeAddressItem( "pos", aPos );
2604*cdf0e10cSrcweir                     dumpXfIdx();
2605*cdf0e10cSrcweir                 }
2606*cdf0e10cSrcweir             }
2607*cdf0e10cSrcweir             dumpColIndex( "last-col-idx" );
2608*cdf0e10cSrcweir         }
2609*cdf0e10cSrcweir         break;
2610*cdf0e10cSrcweir 
2611*cdf0e10cSrcweir         case BIFF_ID_MULTRK:
2612*cdf0e10cSrcweir         {
2613*cdf0e10cSrcweir             Address aPos = dumpAddress();
2614*cdf0e10cSrcweir             {
2615*cdf0e10cSrcweir                 TableGuard aTabGuard( mxOut, 12, 12 );
2616*cdf0e10cSrcweir                 for( ; rStrm.getRemaining() >= 8; ++aPos.mnCol )
2617*cdf0e10cSrcweir                 {
2618*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
2619*cdf0e10cSrcweir                     writeAddressItem( "pos", aPos );
2620*cdf0e10cSrcweir                     dumpXfIdx();
2621*cdf0e10cSrcweir                     dumpRk( "value" );
2622*cdf0e10cSrcweir                 }
2623*cdf0e10cSrcweir             }
2624*cdf0e10cSrcweir             dumpColIndex( "last-col-idx" );
2625*cdf0e10cSrcweir         }
2626*cdf0e10cSrcweir         break;
2627*cdf0e10cSrcweir 
2628*cdf0e10cSrcweir         case BIFF_ID_NOTE:
2629*cdf0e10cSrcweir             dumpAddress( "anchor-cell" );
2630*cdf0e10cSrcweir             if( eBiff == BIFF8 )
2631*cdf0e10cSrcweir             {
2632*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "flags", "NOTE-FLAGS" );
2633*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "obj-id" );
2634*cdf0e10cSrcweir                 dumpUniString( "author" );
2635*cdf0e10cSrcweir                 dumpUnused( 1 );
2636*cdf0e10cSrcweir             }
2637*cdf0e10cSrcweir             else
2638*cdf0e10cSrcweir             {
2639*cdf0e10cSrcweir                 sal_uInt16 nTextLen = dumpDec< sal_uInt16 >( "text-len" );
2640*cdf0e10cSrcweir                 nTextLen = ::std::min( nTextLen, static_cast< sal_uInt16 >( rStrm.getRemaining() ) );
2641*cdf0e10cSrcweir                 writeStringItem( "note-text", rStrm.readCharArrayUC( nTextLen, getBiffData().getTextEncoding(), true ) );
2642*cdf0e10cSrcweir             }
2643*cdf0e10cSrcweir         break;
2644*cdf0e10cSrcweir 
2645*cdf0e10cSrcweir         case BIFF_ID_NOTESOUND:
2646*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "identifier" );
2647*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "total-data-size" );
2648*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "wave-data-size" );
2649*cdf0e10cSrcweir             if( dumpDec< sal_uInt32 >( "fmt-size" ) >= 16 )
2650*cdf0e10cSrcweir             {
2651*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "format", "NOTESOUND-FORMAT" );
2652*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "channels" );
2653*cdf0e10cSrcweir                 dumpDec< sal_uInt32 >( "sampling-rate" );
2654*cdf0e10cSrcweir                 dumpDec< sal_uInt32 >( "data-rate" );
2655*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "data-block-size" );
2656*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "bits-per-sample" );
2657*cdf0e10cSrcweir             }
2658*cdf0e10cSrcweir         break;
2659*cdf0e10cSrcweir 
2660*cdf0e10cSrcweir         case BIFF2_ID_NUMBER:
2661*cdf0e10cSrcweir         case BIFF3_ID_NUMBER:
2662*cdf0e10cSrcweir             dumpCellHeader( nRecId == BIFF2_ID_NUMBER );
2663*cdf0e10cSrcweir             dumpDec< double >( "value" );
2664*cdf0e10cSrcweir         break;
2665*cdf0e10cSrcweir 
2666*cdf0e10cSrcweir         case BIFF_ID_OBJ:
2667*cdf0e10cSrcweir             dumpObjRec();
2668*cdf0e10cSrcweir         break;
2669*cdf0e10cSrcweir 
2670*cdf0e10cSrcweir         case BIFF_ID_OLESIZE:
2671*cdf0e10cSrcweir             dumpUnused( 2 );
2672*cdf0e10cSrcweir             dumpRange( "visible-range", false );
2673*cdf0e10cSrcweir         break;
2674*cdf0e10cSrcweir 
2675*cdf0e10cSrcweir         case BIFF_ID_PAGELAYOUTVIEW:
2676*cdf0e10cSrcweir             dumpFrHeader( true, true );
2677*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "scaling", "CONV-PERCENT" );
2678*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PAGELAYOUTVIEW-FLAGS" );
2679*cdf0e10cSrcweir         break;
2680*cdf0e10cSrcweir 
2681*cdf0e10cSrcweir         case BIFF_ID_PAGESETUP:
2682*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "paper-size", "PAGESETUP-PAPERSIZE" );
2683*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "scaling", "CONV-PERCENT" );
2684*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "first-page" );
2685*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "scale-to-width", "PAGESETUP-SCALETOPAGES" );
2686*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "scale-to-height", "PAGESETUP-SCALETOPAGES" );
2687*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PAGESETUP-FLAGS" );
2688*cdf0e10cSrcweir             if( eBiff >= BIFF5 )
2689*cdf0e10cSrcweir             {
2690*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "horizontal-res", "PAGESETUP-DPI" );
2691*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "vertical-res", "PAGESETUP-DPI" );
2692*cdf0e10cSrcweir                 dumpDec< double >( "header-margin", "CONV-INCH-TO-CM" );
2693*cdf0e10cSrcweir                 dumpDec< double >( "footer-margin", "CONV-INCH-TO-CM" );
2694*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "copies" );
2695*cdf0e10cSrcweir             }
2696*cdf0e10cSrcweir         break;
2697*cdf0e10cSrcweir 
2698*cdf0e10cSrcweir         case BIFF_ID_PALETTE:
2699*cdf0e10cSrcweir             mxOut->resetItemIndex( 8 );
2700*cdf0e10cSrcweir             for( sal_uInt16 nIdx = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !rStrm.isEof() && (nIdx < nCount); ++nIdx )
2701*cdf0e10cSrcweir             {
2702*cdf0e10cSrcweir                 OUStringBuffer aColorName;
2703*cdf0e10cSrcweir                 StringHelper::appendHex( aColorName, dumpColorABGR( "#color" ) );
2704*cdf0e10cSrcweir                 mxColors->setName( nIdx + 8, aColorName.makeStringAndClear() );
2705*cdf0e10cSrcweir             }
2706*cdf0e10cSrcweir         break;
2707*cdf0e10cSrcweir 
2708*cdf0e10cSrcweir         case BIFF_ID_PANE:
2709*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "x-pos", "CONV-TWIP-TO-CM" );
2710*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "y-pos", "CONV-TWIP-TO-CM" );
2711*cdf0e10cSrcweir             dumpAddress( "first-visible-cell" );
2712*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "active-pane", "PANE-ID" );
2713*cdf0e10cSrcweir         break;
2714*cdf0e10cSrcweir 
2715*cdf0e10cSrcweir         case BIFF_ID_PCITEM_STRING:
2716*cdf0e10cSrcweir             dumpString( "value" );
2717*cdf0e10cSrcweir         break;
2718*cdf0e10cSrcweir 
2719*cdf0e10cSrcweir         case BIFF_ID_PHONETICPR:
2720*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
2721*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PHONETICPR-FLAGS" );
2722*cdf0e10cSrcweir             dumpRangeList( "show-phonetic" );
2723*cdf0e10cSrcweir         break;
2724*cdf0e10cSrcweir 
2725*cdf0e10cSrcweir         case BIFF_ID_PROJEXTSHEET:
2726*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "sheet-type", "PROJEXTSHEET-TYPE" );
2727*cdf0e10cSrcweir             dumpUnused( 1 );
2728*cdf0e10cSrcweir             dumpByteString( "sheet-link", BIFF_STR_8BITLENGTH );
2729*cdf0e10cSrcweir         break;
2730*cdf0e10cSrcweir 
2731*cdf0e10cSrcweir         case BIFF_ID_PTDATAFIELD:
2732*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "field" );
2733*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
2734*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
2735*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "base-field" );
2736*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "base-item", "PTDATAFIELD-BASEITEM" );
2737*cdf0e10cSrcweir             dumpFormatIdx();
2738*cdf0e10cSrcweir             dumpPivotString( "name" );
2739*cdf0e10cSrcweir         break;
2740*cdf0e10cSrcweir 
2741*cdf0e10cSrcweir         case BIFF_ID_PTDEFINITION:
2742*cdf0e10cSrcweir         {
2743*cdf0e10cSrcweir             dumpRange( "output-range" );
2744*cdf0e10cSrcweir             dumpRowIndex( "first-header-row-idx" );
2745*cdf0e10cSrcweir             dumpAddress( "first-data-pos" );
2746*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "cache-idx" );
2747*cdf0e10cSrcweir             dumpUnused( 2 );
2748*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "default-data-axis", "PTFIELD-AXISTYPE" );
2749*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "default-data-pos", "PTDEFINITION-DATAFIELD-POS" );
2750*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "field-count" );
2751*cdf0e10cSrcweir             mnPTRowFields = dumpDec< sal_uInt16 >( "row-field-count" );
2752*cdf0e10cSrcweir             mnPTColFields = dumpDec< sal_uInt16 >( "column-field-count" );
2753*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "page-field-count" );
2754*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "data-field-count" );
2755*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "data-row-count" );
2756*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "data-column-count" );
2757*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PTDEFINITION-FLAGS" );
2758*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "auto-format-idx" );
2759*cdf0e10cSrcweir             sal_uInt16 nTabNameLen = dumpDec< sal_uInt16 >( "table-name-len" );
2760*cdf0e10cSrcweir             sal_uInt16 nDataNameLen = dumpDec< sal_uInt16 >( "data-name-len" );
2761*cdf0e10cSrcweir             dumpPivotString( "table-name", nTabNameLen );
2762*cdf0e10cSrcweir             dumpPivotString( "data-name", nDataNameLen );
2763*cdf0e10cSrcweir             mnPTRowColItemsIdx = 0;
2764*cdf0e10cSrcweir         }
2765*cdf0e10cSrcweir         break;
2766*cdf0e10cSrcweir 
2767*cdf0e10cSrcweir         case BIFF_ID_PTDEFINITION2:
2768*cdf0e10cSrcweir         {
2769*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "format-rec-count" );
2770*cdf0e10cSrcweir             sal_uInt16 nErrCaptLen = dumpDec< sal_uInt16 >( "error-caption-len" );
2771*cdf0e10cSrcweir             sal_uInt16 nMissCaptLen = dumpDec< sal_uInt16 >( "missing-caption-len" );
2772*cdf0e10cSrcweir             sal_uInt16 nTagLen = dumpDec< sal_uInt16 >( "tag-len" );
2773*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "select-rec-count" );
2774*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "page-rows" );
2775*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "page-cols" );
2776*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "PTDEFINITION2-FLAGS" );
2777*cdf0e10cSrcweir             sal_uInt16 nPageStyleLen = dumpDec< sal_uInt16 >( "page-field-style-len" );
2778*cdf0e10cSrcweir             sal_uInt16 nTabStyleLen = dumpDec< sal_uInt16 >( "pivot-table-style-len" );
2779*cdf0e10cSrcweir             sal_uInt16 nVacStyleLen = dumpDec< sal_uInt16 >( "vacated-style-len" );
2780*cdf0e10cSrcweir             dumpPivotString( "error-caption", nErrCaptLen );
2781*cdf0e10cSrcweir             dumpPivotString( "missing-caption", nMissCaptLen );
2782*cdf0e10cSrcweir             dumpPivotString( "tag", nTagLen );
2783*cdf0e10cSrcweir             dumpPivotString( "page-field-style", nPageStyleLen );
2784*cdf0e10cSrcweir             dumpPivotString( "pivot-table-style", nTabStyleLen );
2785*cdf0e10cSrcweir             dumpPivotString( "vacated-style", nVacStyleLen );
2786*cdf0e10cSrcweir         }
2787*cdf0e10cSrcweir         break;
2788*cdf0e10cSrcweir 
2789*cdf0e10cSrcweir         case BIFF_ID_PTFIELD:
2790*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "axis-type", "PTFIELD-AXISTYPE" );
2791*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "subtotal-count" );
2792*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "subtotals", "PTFIELD-SUBTOTALS" );
2793*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "item-count" );
2794*cdf0e10cSrcweir             dumpPivotString( "field-name" );
2795*cdf0e10cSrcweir         break;
2796*cdf0e10cSrcweir 
2797*cdf0e10cSrcweir         case BIFF_ID_PTFIELD2:
2798*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "PTFIELD2-FLAGS" );
2799*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "autosort-basefield-idx" );
2800*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "autoshow-basefield-idx" );
2801*cdf0e10cSrcweir             dumpFormatIdx();
2802*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 2 )
2803*cdf0e10cSrcweir             {
2804*cdf0e10cSrcweir                 sal_uInt16 nFuncNameLen = dumpDec< sal_uInt16 >( "subtotal-func-name-len" );
2805*cdf0e10cSrcweir                 dumpUnused( 8 );
2806*cdf0e10cSrcweir                 dumpPivotString( "subtotal-func-name", nFuncNameLen );
2807*cdf0e10cSrcweir             }
2808*cdf0e10cSrcweir         break;
2809*cdf0e10cSrcweir 
2810*cdf0e10cSrcweir         case BIFF_ID_PTFITEM:
2811*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "item-type", "PTFITEM-ITEMTYPE" );
2812*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
2813*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "cache-idx", "PTFITEM-CACHEIDX" );
2814*cdf0e10cSrcweir             dumpPivotString( "item-name" );
2815*cdf0e10cSrcweir         break;
2816*cdf0e10cSrcweir 
2817*cdf0e10cSrcweir         case BIFF_ID_PTPAGEFIELDS:
2818*cdf0e10cSrcweir         {
2819*cdf0e10cSrcweir             mxOut->resetItemIndex();
2820*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 17, 17, 17 );
2821*cdf0e10cSrcweir             while( rStrm.getRemaining() >= 6 )
2822*cdf0e10cSrcweir             {
2823*cdf0e10cSrcweir                 writeEmptyItem( "#page-field" );
2824*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
2825*cdf0e10cSrcweir                 IndentGuard aIndGuard( mxOut );
2826*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "base-field" );
2827*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "item", "PTPAGEFIELDS-ITEM" );
2828*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "dropdown-obj-id" );
2829*cdf0e10cSrcweir             }
2830*cdf0e10cSrcweir         }
2831*cdf0e10cSrcweir         break;
2832*cdf0e10cSrcweir 
2833*cdf0e10cSrcweir         case BIFF_ID_PTROWCOLFIELDS:
2834*cdf0e10cSrcweir             mxOut->resetItemIndex();
2835*cdf0e10cSrcweir             for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
2836*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "#field-idx" );
2837*cdf0e10cSrcweir         break;
2838*cdf0e10cSrcweir 
2839*cdf0e10cSrcweir         case BIFF_ID_PTROWCOLITEMS:
2840*cdf0e10cSrcweir             if( mnPTRowColItemsIdx < 2 )
2841*cdf0e10cSrcweir             {
2842*cdf0e10cSrcweir                 sal_uInt16 nCount = (mnPTRowColItemsIdx == 0) ? mnPTRowFields : mnPTColFields;
2843*cdf0e10cSrcweir                 sal_Int64 nLineSize = 8 + 2 * nCount;
2844*cdf0e10cSrcweir                 mxOut->resetItemIndex();
2845*cdf0e10cSrcweir                 while( rStrm.getRemaining() >= nLineSize )
2846*cdf0e10cSrcweir                 {
2847*cdf0e10cSrcweir                     writeEmptyItem( "#line-data" );
2848*cdf0e10cSrcweir                     IndentGuard aIndGuard( mxOut );
2849*cdf0e10cSrcweir                     MultiItemsGuard aMultiGuard( mxOut );
2850*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "ident-count" );
2851*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "item-type", "PTROWCOLITEMS-ITEMTYPE" );
2852*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "used-count" );
2853*cdf0e10cSrcweir                     dumpHex< sal_uInt16 >( "flags", "PTROWCOLITEMS-FLAGS" );
2854*cdf0e10cSrcweir                     OUStringBuffer aItemList;
2855*cdf0e10cSrcweir                     for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
2856*cdf0e10cSrcweir                         StringHelper::appendToken( aItemList, mxStrm->readInt16() );
2857*cdf0e10cSrcweir                     writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
2858*cdf0e10cSrcweir                 }
2859*cdf0e10cSrcweir                 ++mnPTRowColItemsIdx;
2860*cdf0e10cSrcweir             }
2861*cdf0e10cSrcweir         break;
2862*cdf0e10cSrcweir 
2863*cdf0e10cSrcweir         case BIFF_ID_QUERYTABLE:
2864*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "QUERYTABLE-FLAGS" );
2865*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "autoformat-id" );
2866*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "autoformat-flags", "QUERYTABLE-AUTOFORMAT-FLAGS" );
2867*cdf0e10cSrcweir             dumpUnused( 4 );
2868*cdf0e10cSrcweir             dumpUniString( "defined-name" );
2869*cdf0e10cSrcweir             dumpUnused( 2 );
2870*cdf0e10cSrcweir         break;
2871*cdf0e10cSrcweir 
2872*cdf0e10cSrcweir         case BIFF_ID_QUERYTABLEREFRESH:
2873*cdf0e10cSrcweir         {
2874*cdf0e10cSrcweir             dumpFrHeader( true, false );
2875*cdf0e10cSrcweir             bool bPivot = dumpBool< sal_uInt16 >( "pivot-table" );
2876*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "QUERYTABLEREFRESH-FLAGS" );
2877*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( bPivot ? "pivottable-flags" : "querytable-flags", bPivot ? "QUERYTABLEREFRESH-PTFLAGS" : "QUERYTABLEREFRESH-QTFLAGS" );
2878*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
2879*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
2880*cdf0e10cSrcweir             dumpUnused( 2 );
2881*cdf0e10cSrcweir             dumpUniString( "table-name" );
2882*cdf0e10cSrcweir             dumpUnused( 2 );
2883*cdf0e10cSrcweir         }
2884*cdf0e10cSrcweir         break;
2885*cdf0e10cSrcweir 
2886*cdf0e10cSrcweir         case BIFF_ID_QUERYTABLESETTINGS:
2887*cdf0e10cSrcweir         {
2888*cdf0e10cSrcweir             dumpFrHeader( true, false );
2889*cdf0e10cSrcweir             sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
2890*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags-1", "QUERYTABLESETTINGS-FLAGS" );
2891*cdf0e10cSrcweir             switch( nType )
2892*cdf0e10cSrcweir             {
2893*cdf0e10cSrcweir                 case 4:     dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" );     break;
2894*cdf0e10cSrcweir                 case 5:     dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" );   break;
2895*cdf0e10cSrcweir                 case 7:     dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" );       break;
2896*cdf0e10cSrcweir                 default:    dumpUnused( 2 );
2897*cdf0e10cSrcweir             }
2898*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "ext-flags", "QUERYTABLESETTINGS-EXT-FLAGS" );
2899*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "edited-version" );
2900*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
2901*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
2902*cdf0e10cSrcweir             dumpUnused( 3 );
2903*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "oledb-count" );
2904*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "future-data-size" );
2905*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
2906*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
2907*cdf0e10cSrcweir         }
2908*cdf0e10cSrcweir         break;
2909*cdf0e10cSrcweir 
2910*cdf0e10cSrcweir         case BIFF_ID_QUERYTABLESTRING:
2911*cdf0e10cSrcweir             dumpFrHeader( true, false );
2912*cdf0e10cSrcweir             dumpUniString( "connection-string" );
2913*cdf0e10cSrcweir         break;
2914*cdf0e10cSrcweir 
2915*cdf0e10cSrcweir         case BIFF_ID_RECALCID:
2916*cdf0e10cSrcweir             dumpFrHeader( true, false );
2917*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "recalc-engine-id" );
2918*cdf0e10cSrcweir         break;
2919*cdf0e10cSrcweir 
2920*cdf0e10cSrcweir         case BIFF_ID_RK:
2921*cdf0e10cSrcweir             dumpCellHeader();
2922*cdf0e10cSrcweir             dumpRk( "value" );
2923*cdf0e10cSrcweir         break;
2924*cdf0e10cSrcweir 
2925*cdf0e10cSrcweir         case BIFF2_ID_ROW:
2926*cdf0e10cSrcweir         {
2927*cdf0e10cSrcweir             dumpRowIndex();
2928*cdf0e10cSrcweir             dumpColIndex( "first-used-col-idx" );
2929*cdf0e10cSrcweir             dumpColIndex( "first-free-col-idx" );
2930*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "height", "ROW-HEIGHT" );
2931*cdf0e10cSrcweir             dumpUnused( 2 );
2932*cdf0e10cSrcweir             bool bHasDefXf = dumpBool< sal_uInt8 >( "custom-format" );
2933*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "cell-offset" );
2934*cdf0e10cSrcweir             if( bHasDefXf ) dumpXfIdx( "custom-format", true );
2935*cdf0e10cSrcweir             if( bHasDefXf ) dumpXfIdx( "custom-xf-idx", false );
2936*cdf0e10cSrcweir         }
2937*cdf0e10cSrcweir         break;
2938*cdf0e10cSrcweir 
2939*cdf0e10cSrcweir         case BIFF3_ID_ROW:
2940*cdf0e10cSrcweir             dumpRowIndex();
2941*cdf0e10cSrcweir             dumpColIndex( "first-used-col-idx" );
2942*cdf0e10cSrcweir             dumpColIndex( "first-free-col-idx" );
2943*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "height", "ROW-HEIGHT" );
2944*cdf0e10cSrcweir             dumpUnused( (eBiff <= BIFF4) ? 2 : 4 );
2945*cdf0e10cSrcweir             if( eBiff <= BIFF4 ) dumpDec< sal_uInt16 >( "cell-offset" );
2946*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "ROW-FLAGS" );
2947*cdf0e10cSrcweir         break;
2948*cdf0e10cSrcweir 
2949*cdf0e10cSrcweir         case BIFF_ID_RSTRING:
2950*cdf0e10cSrcweir         {
2951*cdf0e10cSrcweir             sal_uInt16 nXfIdx = dumpCellHeader();
2952*cdf0e10cSrcweir             rtl_TextEncoding eOldTextEnc = getBiffData().getTextEncoding();
2953*cdf0e10cSrcweir             getBiffData().setTextEncoding( getBiffData().getXfEncoding( nXfIdx ) );
2954*cdf0e10cSrcweir             dumpString( "value" );
2955*cdf0e10cSrcweir             getBiffData().setTextEncoding( eOldTextEnc );
2956*cdf0e10cSrcweir             FontPortionModelList aPortions;
2957*cdf0e10cSrcweir             aPortions.importPortions( rStrm, eBiff == BIFF8 );
2958*cdf0e10cSrcweir             writeFontPortions( aPortions );
2959*cdf0e10cSrcweir         }
2960*cdf0e10cSrcweir         break;
2961*cdf0e10cSrcweir 
2962*cdf0e10cSrcweir         case BIFF_ID_SCENARIO:
2963*cdf0e10cSrcweir         {
2964*cdf0e10cSrcweir             sal_uInt16 nCellCount = dumpDec< sal_uInt16 >( "cell-count" );
2965*cdf0e10cSrcweir             // two bytes instead of flag field
2966*cdf0e10cSrcweir             dumpBoolean( "locked" );
2967*cdf0e10cSrcweir             dumpBoolean( "hidden" );
2968*cdf0e10cSrcweir             sal_uInt16 nNameLen = dumpDec< sal_uInt8 >( "name-len" );
2969*cdf0e10cSrcweir             sal_uInt16 nCommentLen = dumpDec< sal_uInt8 >( "comment-len" );
2970*cdf0e10cSrcweir             sal_uInt16 nUserLen = dumpDec< sal_uInt8 >( "user-len" );
2971*cdf0e10cSrcweir             writeStringItem( "name", rStrm.readUniStringBody( nNameLen, true ) );
2972*cdf0e10cSrcweir             if( nUserLen > 0 ) dumpUniString( "user" );         // repeated string length
2973*cdf0e10cSrcweir             if( nCommentLen > 0 ) dumpUniString( "comment" );   // repeated string length
2974*cdf0e10cSrcweir             mxOut->resetItemIndex();
2975*cdf0e10cSrcweir             for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
2976*cdf0e10cSrcweir                 dumpAddress( "#pos" );
2977*cdf0e10cSrcweir             mxOut->resetItemIndex();
2978*cdf0e10cSrcweir             for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
2979*cdf0e10cSrcweir                 dumpString( "#value" );
2980*cdf0e10cSrcweir             dumpUnused( 2 * nCellCount );
2981*cdf0e10cSrcweir         }
2982*cdf0e10cSrcweir         break;
2983*cdf0e10cSrcweir 
2984*cdf0e10cSrcweir         case BIFF_ID_SCENARIOS:
2985*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "count" );
2986*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "selected" );
2987*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "shown" );
2988*cdf0e10cSrcweir             dumpRangeList( "result-cells" );
2989*cdf0e10cSrcweir         break;
2990*cdf0e10cSrcweir 
2991*cdf0e10cSrcweir         case BIFF_ID_SCL:
2992*cdf0e10cSrcweir         {
2993*cdf0e10cSrcweir             sal_uInt16 nNum = dumpDec< sal_uInt16 >( "numerator" );
2994*cdf0e10cSrcweir             sal_uInt16 nDen = dumpDec< sal_uInt16 >( "denominator" );
2995*cdf0e10cSrcweir             if( nDen > 0 ) writeDecItem( "current-zoom", static_cast< sal_uInt16 >( nNum * 100 / nDen ), "CONV-PERCENT" );
2996*cdf0e10cSrcweir         }
2997*cdf0e10cSrcweir         break;
2998*cdf0e10cSrcweir 
2999*cdf0e10cSrcweir         case BIFF_ID_SCREENTIP:
3000*cdf0e10cSrcweir             dumpFrHeader( false, true );
3001*cdf0e10cSrcweir             dumpNullUnicodeArray( "tooltip" );
3002*cdf0e10cSrcweir         break;
3003*cdf0e10cSrcweir 
3004*cdf0e10cSrcweir         case BIFF_ID_SELECTION:
3005*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "pane", "PANE-ID" );
3006*cdf0e10cSrcweir             dumpAddress( "active-cell" );
3007*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "list-idx" );
3008*cdf0e10cSrcweir             dumpRangeList( "selection", false );
3009*cdf0e10cSrcweir         break;
3010*cdf0e10cSrcweir 
3011*cdf0e10cSrcweir         case BIFF_ID_SHAREDFEATHEAD:
3012*cdf0e10cSrcweir         {
3013*cdf0e10cSrcweir             dumpFrHeader( true, true );
3014*cdf0e10cSrcweir             sal_uInt16 nType = dumpDec< sal_uInt16 >( "feature-type", "SHAREDFEATHEAD-TYPE" );
3015*cdf0e10cSrcweir             dumpUnused( 1 );
3016*cdf0e10cSrcweir             if( dumpBool< sal_Int32 >( "has-data" ) ) switch( nType )
3017*cdf0e10cSrcweir             {
3018*cdf0e10cSrcweir                 case 2:
3019*cdf0e10cSrcweir                     dumpHex< sal_uInt32 >( "allowed-flags", "SHAREDFEATHEAD-PROT-FLAGS" );
3020*cdf0e10cSrcweir                 break;
3021*cdf0e10cSrcweir             }
3022*cdf0e10cSrcweir         }
3023*cdf0e10cSrcweir         break;
3024*cdf0e10cSrcweir 
3025*cdf0e10cSrcweir         case BIFF_ID_SHAREDFMLA:
3026*cdf0e10cSrcweir             dumpRange( "formula-range", false );
3027*cdf0e10cSrcweir             dumpUnused( 1 );
3028*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "cell-count" );
3029*cdf0e10cSrcweir             getFormulaDumper().dumpCellFormula();
3030*cdf0e10cSrcweir         break;
3031*cdf0e10cSrcweir 
3032*cdf0e10cSrcweir         case BIFF_ID_SHEET:
3033*cdf0e10cSrcweir             if( eBiff >= BIFF5 )
3034*cdf0e10cSrcweir             {
3035*cdf0e10cSrcweir                 rStrm.enableDecoder( false );
3036*cdf0e10cSrcweir                 dumpHex< sal_uInt32 >( "sheet-stream-pos", "CONV-DEC" );
3037*cdf0e10cSrcweir                 rStrm.enableDecoder( true );
3038*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "sheet-state", "SHEET-STATE" );
3039*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "sheet-type", "SHEET-TYPE" );
3040*cdf0e10cSrcweir             }
3041*cdf0e10cSrcweir             dumpString( "sheet-name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
3042*cdf0e10cSrcweir         break;
3043*cdf0e10cSrcweir 
3044*cdf0e10cSrcweir         case BIFF_ID_SHEETEXT:
3045*cdf0e10cSrcweir             dumpFrHeader( true, true );
3046*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "rec-size" );
3047*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "flags-1", "SHEETEXT-FLAGS1" );
3048*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 20 )
3049*cdf0e10cSrcweir             {
3050*cdf0e10cSrcweir                 dumpDec< sal_uInt32 >( "flags-2", "SHEETEXT-FLAGS2" );
3051*cdf0e10cSrcweir                 dumpExtCfColor( "tab-color" );
3052*cdf0e10cSrcweir             }
3053*cdf0e10cSrcweir         break;
3054*cdf0e10cSrcweir 
3055*cdf0e10cSrcweir         case BIFF_ID_SHEETHEADER:
3056*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "substream-size", "CONV-DEC" );
3057*cdf0e10cSrcweir             dumpByteString( "sheet-name", BIFF_STR_8BITLENGTH );
3058*cdf0e10cSrcweir         break;
3059*cdf0e10cSrcweir 
3060*cdf0e10cSrcweir         case BIFF_ID_SST:
3061*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "string-cell-count" );
3062*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "sst-size" );
3063*cdf0e10cSrcweir             mxOut->resetItemIndex();
3064*cdf0e10cSrcweir             while( !rStrm.isEof() && (rStrm.getRemaining() >= 3) )
3065*cdf0e10cSrcweir                 dumpUniString( "#entry" );
3066*cdf0e10cSrcweir         break;
3067*cdf0e10cSrcweir 
3068*cdf0e10cSrcweir         case BIFF2_ID_STRING:
3069*cdf0e10cSrcweir         case BIFF3_ID_STRING:
3070*cdf0e10cSrcweir             dumpString( "result", ((nRecId == BIFF2_ID_STRING) && (eBiff <= BIFF4)) ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT );
3071*cdf0e10cSrcweir         break;
3072*cdf0e10cSrcweir 
3073*cdf0e10cSrcweir         case BIFF_ID_STYLE:
3074*cdf0e10cSrcweir         {
3075*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "STYLE-FLAGS" );
3076*cdf0e10cSrcweir             if( getFlag( nFlags, BIFF_STYLE_BUILTIN ) )
3077*cdf0e10cSrcweir             {
3078*cdf0e10cSrcweir                 dumpDec< sal_Int8 >( "builtin-idx", "STYLE-BUILTIN" );
3079*cdf0e10cSrcweir                 dumpDec< sal_Int8 >( "outline-level" );
3080*cdf0e10cSrcweir             }
3081*cdf0e10cSrcweir             else
3082*cdf0e10cSrcweir                 dumpString( "style-name", BIFF_STR_8BITLENGTH );
3083*cdf0e10cSrcweir         }
3084*cdf0e10cSrcweir         break;
3085*cdf0e10cSrcweir 
3086*cdf0e10cSrcweir         case BIFF_ID_STYLEEXT:
3087*cdf0e10cSrcweir             dumpFrHeader( true, true );
3088*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "STYLEEXT-FLAGS" );
3089*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "category", "STYLEEXT-CATEGORY" );
3090*cdf0e10cSrcweir             dumpDec< sal_Int8 >( "builtin-idx", "STYLEEXT-BUILTIN" );
3091*cdf0e10cSrcweir             dumpDec< sal_Int8 >( "outline-level" );
3092*cdf0e10cSrcweir             dumpUnicodeArray( "style-name", rStrm.readuInt16() );
3093*cdf0e10cSrcweir             dumpDxfProp();
3094*cdf0e10cSrcweir         break;
3095*cdf0e10cSrcweir 
3096*cdf0e10cSrcweir         case BIFF_ID_TABLESTYLES:
3097*cdf0e10cSrcweir         {
3098*cdf0e10cSrcweir             dumpFrHeader( true, true );
3099*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "table-style-count" );
3100*cdf0e10cSrcweir             sal_uInt16 nDefTableLen, nDefPivotLen;
3101*cdf0e10cSrcweir             rStrm >> nDefTableLen >> nDefPivotLen;
3102*cdf0e10cSrcweir             dumpUnicodeArray( "def-table-style", nDefTableLen );
3103*cdf0e10cSrcweir             dumpUnicodeArray( "def-pivot-style", nDefPivotLen );
3104*cdf0e10cSrcweir         }
3105*cdf0e10cSrcweir         break;
3106*cdf0e10cSrcweir 
3107*cdf0e10cSrcweir         case BIFF_ID_THEME:
3108*cdf0e10cSrcweir             dumpFrHeader( true, true );
3109*cdf0e10cSrcweir             dumpDec< sal_uInt32 >( "theme-version", "THEME-VERSION" );
3110*cdf0e10cSrcweir         break;
3111*cdf0e10cSrcweir 
3112*cdf0e10cSrcweir         case BIFF_ID_TXO:
3113*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "TXO-FLAGS" );
3114*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
3115*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
3116*cdf0e10cSrcweir             dumpUnicode( "accelerator" );
3117*cdf0e10cSrcweir             dumpUnicode( "fareast-accelerator" );
3118*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "text-len" );
3119*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "format-run-size" );
3120*cdf0e10cSrcweir             dumpUnused( 4 );
3121*cdf0e10cSrcweir         break;
3122*cdf0e10cSrcweir 
3123*cdf0e10cSrcweir         case BIFF_ID_WINDOW1:
3124*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "window-x", "CONV-TWIP-TO-CM" );
3125*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "window-y", "CONV-TWIP-TO-CM" );
3126*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "window-width", "CONV-TWIP-TO-CM" );
3127*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "window-height", "CONV-TWIP-TO-CM" );
3128*cdf0e10cSrcweir             if( eBiff <= BIFF4 )
3129*cdf0e10cSrcweir             {
3130*cdf0e10cSrcweir                 dumpBool< sal_uInt8 >( "hidden" );
3131*cdf0e10cSrcweir             }
3132*cdf0e10cSrcweir             else
3133*cdf0e10cSrcweir             {
3134*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "flags", "WINDOW1-FLAGS" );
3135*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "active-tab" );
3136*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "first-visible-tab" );
3137*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "selected-tabs" );
3138*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "tabbar-ratio", "WINDOW1-TABBARRATIO" );
3139*cdf0e10cSrcweir             }
3140*cdf0e10cSrcweir         break;
3141*cdf0e10cSrcweir 
3142*cdf0e10cSrcweir         case BIFF2_ID_WINDOW2:
3143*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-formulas" );
3144*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-gridlines" );
3145*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-headings" );
3146*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "frozen-panes" );
3147*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "show-zeros" );
3148*cdf0e10cSrcweir             dumpAddress( "first-visible-cell" );
3149*cdf0e10cSrcweir             dumpBool< sal_uInt8 >( "auto-grid-color" );
3150*cdf0e10cSrcweir             dumpColorABGR( "grid-color" );
3151*cdf0e10cSrcweir         break;
3152*cdf0e10cSrcweir 
3153*cdf0e10cSrcweir         case BIFF3_ID_WINDOW2:
3154*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "WINDOW2-FLAGS" );
3155*cdf0e10cSrcweir             dumpAddress( "first-visible-cell" );
3156*cdf0e10cSrcweir             if( eBiff == BIFF8 )
3157*cdf0e10cSrcweir             {
3158*cdf0e10cSrcweir                 dumpColorIdx( "grid-color-idx" );
3159*cdf0e10cSrcweir                 dumpUnused( 2 );
3160*cdf0e10cSrcweir                 if( rStrm.getRemaining() >= 8 )
3161*cdf0e10cSrcweir                 {
3162*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "pagebreak-zoom", "CONV-PERCENT" );
3163*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "normal-zoom", "CONV-PERCENT" );
3164*cdf0e10cSrcweir                     dumpUnused( 4 );
3165*cdf0e10cSrcweir                 }
3166*cdf0e10cSrcweir             }
3167*cdf0e10cSrcweir             else
3168*cdf0e10cSrcweir                 dumpColorABGR( "grid-color" );
3169*cdf0e10cSrcweir         break;
3170*cdf0e10cSrcweir 
3171*cdf0e10cSrcweir         case BIFF_ID_WRITEACCESS:
3172*cdf0e10cSrcweir             dumpString( "user-name", BIFF_STR_8BITLENGTH );
3173*cdf0e10cSrcweir         break;
3174*cdf0e10cSrcweir 
3175*cdf0e10cSrcweir         case BIFF_ID_XCT:
3176*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "crn-count" );
3177*cdf0e10cSrcweir             if( eBiff == BIFF8 ) dumpDec< sal_Int16 >( "sheet-idx" );
3178*cdf0e10cSrcweir         break;
3179*cdf0e10cSrcweir 
3180*cdf0e10cSrcweir         case BIFF2_ID_XF:
3181*cdf0e10cSrcweir         case BIFF3_ID_XF:
3182*cdf0e10cSrcweir         case BIFF4_ID_XF:
3183*cdf0e10cSrcweir         case BIFF5_ID_XF:
3184*cdf0e10cSrcweir             dumpXfRec();
3185*cdf0e10cSrcweir         break;
3186*cdf0e10cSrcweir 
3187*cdf0e10cSrcweir         case BIFF_ID_XFCRC:
3188*cdf0e10cSrcweir             dumpFrHeader( true, true );
3189*cdf0e10cSrcweir             dumpUnused( 2 );
3190*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "xf-count" );
3191*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "xf-checksum" );
3192*cdf0e10cSrcweir         break;
3193*cdf0e10cSrcweir 
3194*cdf0e10cSrcweir         case BIFF_ID_XFEXT:
3195*cdf0e10cSrcweir             dumpFrHeader( true, true );
3196*cdf0e10cSrcweir             dumpUnused( 2 );
3197*cdf0e10cSrcweir             dumpXfIdx( "xf-idx" );
3198*cdf0e10cSrcweir             dumpUnused( 2 );
3199*cdf0e10cSrcweir             dumpXfExtProp();
3200*cdf0e10cSrcweir         break;
3201*cdf0e10cSrcweir     }
3202*cdf0e10cSrcweir }
3203*cdf0e10cSrcweir 
3204*cdf0e10cSrcweir void WorkbookStreamObject::initializePerSheet()
3205*cdf0e10cSrcweir {
3206*cdf0e10cSrcweir     getBiffData().initializePerSheet();
3207*cdf0e10cSrcweir     mxFontNames = cfg().createNameList< ConstList >( "FONTNAMES" );
3208*cdf0e10cSrcweir     mxFontNames->setName( 0, createFontName( CREATE_OUSTRING( "Arial" ), 200, false, false ) );
3209*cdf0e10cSrcweir     mxFormats = cfg().createNameList< ConstList >( "FORMATS" );
3210*cdf0e10cSrcweir     mxFormats->includeList( cfg().getNameList( "BUILTIN-FORMATS" ) );
3211*cdf0e10cSrcweir     mnFormatIdx = 0;
3212*cdf0e10cSrcweir     mbHasCodePage = false;
3213*cdf0e10cSrcweir }
3214*cdf0e10cSrcweir 
3215*cdf0e10cSrcweir OUString WorkbookStreamObject::createFontName( const OUString& rName, sal_uInt16 nHeight, bool bBold, bool bItalic ) const
3216*cdf0e10cSrcweir {
3217*cdf0e10cSrcweir     OUStringBuffer aName( rName );
3218*cdf0e10cSrcweir     StringHelper::enclose( aName, OOX_DUMP_STRQUOTE );
3219*cdf0e10cSrcweir     StringHelper::appendToken( aName, cfg().getName( "CONV-TWIP-TO-PT", nHeight ), ',' );
3220*cdf0e10cSrcweir     if( bBold )
3221*cdf0e10cSrcweir         StringHelper::appendToken( aName, CREATE_OUSTRING( "bold" ), ',' );
3222*cdf0e10cSrcweir     if( bItalic )
3223*cdf0e10cSrcweir         StringHelper::appendToken( aName, CREATE_OUSTRING( "italic" ), ',' );
3224*cdf0e10cSrcweir     return aName.makeStringAndClear();
3225*cdf0e10cSrcweir }
3226*cdf0e10cSrcweir 
3227*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpPatternIdx( const String& rName, bool b16Bit )
3228*cdf0e10cSrcweir {
3229*cdf0e10cSrcweir     return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "fill-pattern" ), mxFillPatterns );
3230*cdf0e10cSrcweir }
3231*cdf0e10cSrcweir 
3232*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpColorIdx( const String& rName, bool b16Bit )
3233*cdf0e10cSrcweir {
3234*cdf0e10cSrcweir     return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "color-idx" ), mxColors );
3235*cdf0e10cSrcweir }
3236*cdf0e10cSrcweir 
3237*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpFontIdx( const String& rName, bool b16Bit )
3238*cdf0e10cSrcweir {
3239*cdf0e10cSrcweir     return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "font-idx" ), mxFontNames );
3240*cdf0e10cSrcweir }
3241*cdf0e10cSrcweir 
3242*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpFormatIdx( const String& rName )
3243*cdf0e10cSrcweir {
3244*cdf0e10cSrcweir     return dumpDec< sal_uInt16, sal_uInt8 >( getBiff() >= BIFF5, rName( "fmt-idx" ), mxFormats );
3245*cdf0e10cSrcweir }
3246*cdf0e10cSrcweir 
3247*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpXfIdx( const String& rName, bool bBiff2Style )
3248*cdf0e10cSrcweir {
3249*cdf0e10cSrcweir     String aName = rName( "xf-idx" );
3250*cdf0e10cSrcweir     sal_uInt16 nXfIdx = 0;
3251*cdf0e10cSrcweir     if( bBiff2Style )
3252*cdf0e10cSrcweir     {
3253*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( aName, "CELL-XFINDEX" );
3254*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( "fmt-font-idx", "CELL-XFFORMAT" );
3255*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( "style", "CELL-XFSTYLE" );
3256*cdf0e10cSrcweir     }
3257*cdf0e10cSrcweir     else
3258*cdf0e10cSrcweir         nXfIdx = dumpDec< sal_uInt16 >( aName );
3259*cdf0e10cSrcweir     return nXfIdx;
3260*cdf0e10cSrcweir }
3261*cdf0e10cSrcweir 
3262*cdf0e10cSrcweir void WorkbookStreamObject::dumpExtColorValue( sal_uInt32 nColorType )
3263*cdf0e10cSrcweir {
3264*cdf0e10cSrcweir     switch( nColorType )
3265*cdf0e10cSrcweir     {
3266*cdf0e10cSrcweir         case 0:     dumpUnused( 4 );                                break;
3267*cdf0e10cSrcweir         case 1:     dumpDec< sal_uInt32 >( "color-idx", mxColors ); break;
3268*cdf0e10cSrcweir         case 2:     dumpColorABGR();                                break;
3269*cdf0e10cSrcweir         case 3:     dumpDec< sal_uInt32 >( "theme-id" );            break;
3270*cdf0e10cSrcweir         case 4:     dumpUnused( 4 );                                break;
3271*cdf0e10cSrcweir         default:    dumpUnknown( 4 );
3272*cdf0e10cSrcweir     }
3273*cdf0e10cSrcweir }
3274*cdf0e10cSrcweir 
3275*cdf0e10cSrcweir void WorkbookStreamObject::dumpExtColor( const String& rName )
3276*cdf0e10cSrcweir {
3277*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
3278*cdf0e10cSrcweir     writeEmptyItem( rName( "color" ) );
3279*cdf0e10cSrcweir     switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "EXTCOLOR-FLAGS" ), 1, 7 ) )
3280*cdf0e10cSrcweir     {
3281*cdf0e10cSrcweir         case 0:     dumpUnused( 1 );                    break;
3282*cdf0e10cSrcweir         case 1:     dumpColorIdx( "color-idx", false ); break;
3283*cdf0e10cSrcweir         case 2:     dumpUnused( 1 );                    break;
3284*cdf0e10cSrcweir         case 3:     dumpDec< sal_uInt8 >( "theme-id" ); break;
3285*cdf0e10cSrcweir         case 4:     dumpUnused( 1 );                    break;
3286*cdf0e10cSrcweir         default:    dumpUnknown( 1 );
3287*cdf0e10cSrcweir     }
3288*cdf0e10cSrcweir     dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
3289*cdf0e10cSrcweir     dumpColorABGR();
3290*cdf0e10cSrcweir }
3291*cdf0e10cSrcweir 
3292*cdf0e10cSrcweir void WorkbookStreamObject::dumpExtCfColor( const String& rName )
3293*cdf0e10cSrcweir {
3294*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
3295*cdf0e10cSrcweir     writeEmptyItem( rName( "color" ) );
3296*cdf0e10cSrcweir     dumpExtColorValue( dumpExtColorType< sal_uInt32 >() );
3297*cdf0e10cSrcweir     dumpDec< double >( "tint", "CONV-FLOAT-TO-PERC" );
3298*cdf0e10cSrcweir }
3299*cdf0e10cSrcweir 
3300*cdf0e10cSrcweir void WorkbookStreamObject::dumpExtGradientHead()
3301*cdf0e10cSrcweir {
3302*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "gradient-type", "EXTGRADIENT-TYPE" );
3303*cdf0e10cSrcweir     dumpDec< double >( "linear-angle" );
3304*cdf0e10cSrcweir     dumpDec< double >( "pos-left" );
3305*cdf0e10cSrcweir     dumpDec< double >( "pos-right" );
3306*cdf0e10cSrcweir     dumpDec< double >( "pos-top" );
3307*cdf0e10cSrcweir     dumpDec< double >( "pos-bottom" );
3308*cdf0e10cSrcweir }
3309*cdf0e10cSrcweir 
3310*cdf0e10cSrcweir sal_uInt8 WorkbookStreamObject::dumpFilterColumnOperator( const String& rName )
3311*cdf0e10cSrcweir {
3312*cdf0e10cSrcweir     sal_uInt8 nStrLen = 0;
3313*cdf0e10cSrcweir     writeEmptyItem( rName );
3314*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
3315*cdf0e10cSrcweir     sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "FILTERCOLUMN-DATATYPE" );
3316*cdf0e10cSrcweir     dumpDec< sal_uInt8 >( "operator", "FILTERCOLUMN-OPERATOR" );
3317*cdf0e10cSrcweir     switch( nType )
3318*cdf0e10cSrcweir     {
3319*cdf0e10cSrcweir         case 2:
3320*cdf0e10cSrcweir             dumpRk( "value" );
3321*cdf0e10cSrcweir             dumpUnused( 4 );
3322*cdf0e10cSrcweir         break;
3323*cdf0e10cSrcweir         case 4:
3324*cdf0e10cSrcweir             dumpDec< double >( "value" );
3325*cdf0e10cSrcweir         break;
3326*cdf0e10cSrcweir         case 6:
3327*cdf0e10cSrcweir             dumpUnused( 4 );
3328*cdf0e10cSrcweir             nStrLen = dumpDec< sal_uInt8 >( "length" );
3329*cdf0e10cSrcweir             dumpBoolean( "simple" );
3330*cdf0e10cSrcweir             dumpUnused( 2 );
3331*cdf0e10cSrcweir         break;
3332*cdf0e10cSrcweir         case 8:
3333*cdf0e10cSrcweir             dumpBoolErr();
3334*cdf0e10cSrcweir             dumpUnused( 6 );
3335*cdf0e10cSrcweir         break;
3336*cdf0e10cSrcweir         default:
3337*cdf0e10cSrcweir             dumpUnused( 8 );
3338*cdf0e10cSrcweir     }
3339*cdf0e10cSrcweir     return nStrLen;
3340*cdf0e10cSrcweir }
3341*cdf0e10cSrcweir 
3342*cdf0e10cSrcweir OUString WorkbookStreamObject::dumpPivotString( const String& rName, sal_uInt16 nStrLen )
3343*cdf0e10cSrcweir {
3344*cdf0e10cSrcweir     OUString aString;
3345*cdf0e10cSrcweir     if( nStrLen != BIFF_PT_NOSTRING )
3346*cdf0e10cSrcweir     {
3347*cdf0e10cSrcweir         aString = (getBiff() == BIFF8) ?
3348*cdf0e10cSrcweir             getBiffStream().readUniStringBody( nStrLen ) :
3349*cdf0e10cSrcweir             getBiffStream().readCharArrayUC( nStrLen, getBiffData().getTextEncoding() );
3350*cdf0e10cSrcweir         writeStringItem( rName, aString );
3351*cdf0e10cSrcweir     }
3352*cdf0e10cSrcweir     return aString;
3353*cdf0e10cSrcweir }
3354*cdf0e10cSrcweir 
3355*cdf0e10cSrcweir OUString WorkbookStreamObject::dumpPivotString( const String& rName )
3356*cdf0e10cSrcweir {
3357*cdf0e10cSrcweir     sal_uInt16 nStrLen = dumpDec< sal_uInt16 >( "string-len", "PIVOT-NAMELEN" );
3358*cdf0e10cSrcweir     return dumpPivotString( rName, nStrLen );
3359*cdf0e10cSrcweir }
3360*cdf0e10cSrcweir 
3361*cdf0e10cSrcweir sal_uInt16 WorkbookStreamObject::dumpCellHeader( bool bBiff2Style )
3362*cdf0e10cSrcweir {
3363*cdf0e10cSrcweir     dumpAddress();
3364*cdf0e10cSrcweir     return dumpXfIdx( EMPTY_STRING, bBiff2Style );
3365*cdf0e10cSrcweir }
3366*cdf0e10cSrcweir 
3367*cdf0e10cSrcweir void WorkbookStreamObject::dumpBoolErr()
3368*cdf0e10cSrcweir {
3369*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
3370*cdf0e10cSrcweir     sal_uInt8 nValue = dumpHex< sal_uInt8 >( "value" );
3371*cdf0e10cSrcweir     bool bErrCode = dumpBool< sal_uInt8 >( "is-error-code" );
3372*cdf0e10cSrcweir     if( bErrCode )
3373*cdf0e10cSrcweir         writeErrorCodeItem( "error-code", nValue );
3374*cdf0e10cSrcweir     else
3375*cdf0e10cSrcweir         writeBooleanItem( "boolean", nValue );
3376*cdf0e10cSrcweir }
3377*cdf0e10cSrcweir 
3378*cdf0e10cSrcweir void WorkbookStreamObject::dumpCfRuleProp()
3379*cdf0e10cSrcweir {
3380*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
3381*cdf0e10cSrcweir     sal_uInt32 nFlags1 = dumpHex< sal_uInt32 >( "flags-1", "CFRULE-FLAGS1" );
3382*cdf0e10cSrcweir     sal_uInt16 nFlags2 = dumpHex< sal_uInt16 >( "flags-2", "CFRULE-FLAGS2" );
3383*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x02000000 ) )
3384*cdf0e10cSrcweir     {
3385*cdf0e10cSrcweir         writeEmptyItem( "numfmt-block" );
3386*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3387*cdf0e10cSrcweir         if( getFlag< sal_uInt16 >( nFlags2, 0x0001 ) )
3388*cdf0e10cSrcweir         {
3389*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "size" );
3390*cdf0e10cSrcweir             dumpUniString( "numfmt" );
3391*cdf0e10cSrcweir         }
3392*cdf0e10cSrcweir         else
3393*cdf0e10cSrcweir         {
3394*cdf0e10cSrcweir             dumpUnused( 1 );
3395*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "fmt-idx", mxFormats );
3396*cdf0e10cSrcweir         }
3397*cdf0e10cSrcweir     }
3398*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x04000000 ) )
3399*cdf0e10cSrcweir     {
3400*cdf0e10cSrcweir         writeEmptyItem( "font-block" );
3401*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3402*cdf0e10cSrcweir         sal_Int64 nRecPos = rStrm.tell();
3403*cdf0e10cSrcweir         dumpUniString( "name", BIFF_STR_8BITLENGTH );
3404*cdf0e10cSrcweir         dumpUnused( static_cast< sal_Int32 >( nRecPos + 64 - rStrm.tell() ) );
3405*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
3406*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "flags", "CFRULE-FONTFLAGS" );
3407*cdf0e10cSrcweir         dumpDec< sal_Int16 >( "weight", "CFRULE-FONTWEIGHT" );
3408*cdf0e10cSrcweir         dumpDec< sal_Int16 >( "escapement", "CFRULE-FONTESCAPEMENT" );
3409*cdf0e10cSrcweir         dumpDec< sal_Int8 >( "underline", "CFRULE-FONTUNDERLINE" );
3410*cdf0e10cSrcweir         dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
3411*cdf0e10cSrcweir         dumpDec< sal_uInt8 >( "charset", "CHARSET" );
3412*cdf0e10cSrcweir         dumpUnused( 1 );
3413*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "color", "CFRULE-FONTCOLOR" );
3414*cdf0e10cSrcweir         dumpUnused( 4 );
3415*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "used-flags", "CFRULE-FONTUSEDFLAGS" );
3416*cdf0e10cSrcweir         dumpDec< sal_uInt32 >( "escapement-used", "CFRULE-FONTUSED" );
3417*cdf0e10cSrcweir         dumpDec< sal_uInt32 >( "underline-used", "CFRULE-FONTUSED" );
3418*cdf0e10cSrcweir         dumpDec< sal_uInt32 >( "weight-used", "CFRULE-FONTUSED" );
3419*cdf0e10cSrcweir         dumpUnused( 4 );
3420*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "first-char" );
3421*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "char-count" );
3422*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "font-idx" );
3423*cdf0e10cSrcweir     }
3424*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x08000000 ) )
3425*cdf0e10cSrcweir     {
3426*cdf0e10cSrcweir         writeEmptyItem( "alignment-block" );
3427*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3428*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( "alignent", "CFRULE-ALIGNMENT" );
3429*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( "rotation", "TEXTROTATION" );
3430*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "indent", "CFRULE-INDENT" );
3431*cdf0e10cSrcweir         dumpDec< sal_Int32 >( "relative-indent" );
3432*cdf0e10cSrcweir     }
3433*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x10000000 ) )
3434*cdf0e10cSrcweir     {
3435*cdf0e10cSrcweir         writeEmptyItem( "border-block" );
3436*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3437*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "border-style", "XF-BORDERSTYLE" );
3438*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "border-color1", "XF-BORDERCOLOR1" );
3439*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "border-color2", "CFRULE-BORDERCOLOR2" );
3440*cdf0e10cSrcweir     }
3441*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x20000000 ) )
3442*cdf0e10cSrcweir     {
3443*cdf0e10cSrcweir         writeEmptyItem( "pattern-block" );
3444*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3445*cdf0e10cSrcweir         dumpHex< sal_uInt32 >( "pattern", "CFRULE-FILLBLOCK" );
3446*cdf0e10cSrcweir     }
3447*cdf0e10cSrcweir     if( getFlag< sal_uInt32 >( nFlags1, 0x40000000 ) )
3448*cdf0e10cSrcweir     {
3449*cdf0e10cSrcweir         writeEmptyItem( "protection-block" );
3450*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3451*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "flags", "CFRULE-PROTECTION-FLAGS" );
3452*cdf0e10cSrcweir     }
3453*cdf0e10cSrcweir }
3454*cdf0e10cSrcweir 
3455*cdf0e10cSrcweir void WorkbookStreamObject::dumpXfExtProp()
3456*cdf0e10cSrcweir {
3457*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
3458*cdf0e10cSrcweir     for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
3459*cdf0e10cSrcweir     {
3460*cdf0e10cSrcweir         mxOut->startMultiItems();
3461*cdf0e10cSrcweir         sal_Int64 nStartPos = rStrm.tell();
3462*cdf0e10cSrcweir         writeEmptyItem( "SUBREC" );
3463*cdf0e10cSrcweir         sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "XFEXT-SUBREC" );
3464*cdf0e10cSrcweir         sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
3465*cdf0e10cSrcweir         sal_Int64 nEndPos = nStartPos + nSubRecSize;
3466*cdf0e10cSrcweir         mxOut->endMultiItems();
3467*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3468*cdf0e10cSrcweir         switch( nSubRecId )
3469*cdf0e10cSrcweir         {
3470*cdf0e10cSrcweir             case 4: case 5: case 7: case 8: case 9: case 10: case 11: case 13:
3471*cdf0e10cSrcweir             {
3472*cdf0e10cSrcweir                 sal_uInt16 nColorType = dumpExtColorType< sal_uInt16 >();
3473*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
3474*cdf0e10cSrcweir                 dumpExtColorValue( nColorType );
3475*cdf0e10cSrcweir                 dumpUnused( 8 );
3476*cdf0e10cSrcweir             }
3477*cdf0e10cSrcweir             break;
3478*cdf0e10cSrcweir             case 6:
3479*cdf0e10cSrcweir                 dumpExtGradientHead();
3480*cdf0e10cSrcweir                 mxOut->resetItemIndex();
3481*cdf0e10cSrcweir                 for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
3482*cdf0e10cSrcweir                 {
3483*cdf0e10cSrcweir                     writeEmptyItem( "#stop" );
3484*cdf0e10cSrcweir                     IndentGuard aIndGuard2( mxOut );
3485*cdf0e10cSrcweir                     sal_uInt16 nColorType = dumpExtColorType< sal_uInt16 >();
3486*cdf0e10cSrcweir                     dumpExtColorValue( nColorType );
3487*cdf0e10cSrcweir                     dumpDec< double >( "stop-pos" );
3488*cdf0e10cSrcweir                     dumpDec< double >( "tint", "CONV-FLOAT-TO-PERC" );
3489*cdf0e10cSrcweir                 }
3490*cdf0e10cSrcweir             break;
3491*cdf0e10cSrcweir             case 14:
3492*cdf0e10cSrcweir                 dumpDec< sal_Int8 >( "font-scheme", "EXTFONT-SCHEME" );
3493*cdf0e10cSrcweir             break;
3494*cdf0e10cSrcweir             case 15:
3495*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "indent" );
3496*cdf0e10cSrcweir             break;
3497*cdf0e10cSrcweir         }
3498*cdf0e10cSrcweir         dumpRemainingTo( nEndPos );
3499*cdf0e10cSrcweir     }
3500*cdf0e10cSrcweir }
3501*cdf0e10cSrcweir 
3502*cdf0e10cSrcweir void WorkbookStreamObject::dumpDxfProp()
3503*cdf0e10cSrcweir {
3504*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
3505*cdf0e10cSrcweir     dumpUnused( 2 );
3506*cdf0e10cSrcweir     for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
3507*cdf0e10cSrcweir     {
3508*cdf0e10cSrcweir         mxOut->startMultiItems();
3509*cdf0e10cSrcweir         sal_Int64 nStartPos = rStrm.tell();
3510*cdf0e10cSrcweir         writeEmptyItem( "SUBREC" );
3511*cdf0e10cSrcweir         sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
3512*cdf0e10cSrcweir         sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
3513*cdf0e10cSrcweir         sal_Int64 nEndPos = nStartPos + nSubRecSize;
3514*cdf0e10cSrcweir         mxOut->endMultiItems();
3515*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3516*cdf0e10cSrcweir         switch( nSubRecId )
3517*cdf0e10cSrcweir         {
3518*cdf0e10cSrcweir             case 0:
3519*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "pattern", mxFillPatterns );
3520*cdf0e10cSrcweir             break;
3521*cdf0e10cSrcweir             case 1: case 2: case 5:
3522*cdf0e10cSrcweir                 dumpExtColor();
3523*cdf0e10cSrcweir             break;
3524*cdf0e10cSrcweir             case 3:
3525*cdf0e10cSrcweir                 dumpExtGradientHead();
3526*cdf0e10cSrcweir             break;
3527*cdf0e10cSrcweir             case 4:
3528*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "index" );
3529*cdf0e10cSrcweir                 dumpDec< double >( "stop-position" );
3530*cdf0e10cSrcweir                 dumpExtColor( "stop-color" );
3531*cdf0e10cSrcweir             break;
3532*cdf0e10cSrcweir             case 6: case 7: case 8: case 9: case 10: case 11: case 12:
3533*cdf0e10cSrcweir                 dumpExtColor( "color" );
3534*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "style", mxBorderStyles );
3535*cdf0e10cSrcweir             break;
3536*cdf0e10cSrcweir             case 13: case 14:
3537*cdf0e10cSrcweir                 dumpBoolean( "value" );
3538*cdf0e10cSrcweir             break;
3539*cdf0e10cSrcweir             case 15:
3540*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "alignment", "XF-HORALIGN" );
3541*cdf0e10cSrcweir             break;
3542*cdf0e10cSrcweir             case 16:
3543*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "alignment", "XF-VERALIGN" );
3544*cdf0e10cSrcweir             break;
3545*cdf0e10cSrcweir             case 17:
3546*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
3547*cdf0e10cSrcweir             break;
3548*cdf0e10cSrcweir             case 18:
3549*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "indent" );
3550*cdf0e10cSrcweir             break;
3551*cdf0e10cSrcweir             case 19:
3552*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "text-dir", "XF-TEXTDIRECTION" );
3553*cdf0e10cSrcweir             break;
3554*cdf0e10cSrcweir             case 20: case 21: case 22: case 23:
3555*cdf0e10cSrcweir                 dumpBoolean( "value" );
3556*cdf0e10cSrcweir             break;
3557*cdf0e10cSrcweir             case 24:
3558*cdf0e10cSrcweir                 dumpUnicodeArray( "name", rStrm.readuInt16() );
3559*cdf0e10cSrcweir             break;
3560*cdf0e10cSrcweir             case 25:
3561*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
3562*cdf0e10cSrcweir             break;
3563*cdf0e10cSrcweir             case 26:
3564*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "underline", "FONT-UNDERLINE" );
3565*cdf0e10cSrcweir             break;
3566*cdf0e10cSrcweir             case 27:
3567*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
3568*cdf0e10cSrcweir             break;
3569*cdf0e10cSrcweir             case 28: case 29: case 30: case 31: case 32: case 33:
3570*cdf0e10cSrcweir                 dumpBoolean( "value" );
3571*cdf0e10cSrcweir             break;
3572*cdf0e10cSrcweir             case 34:
3573*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "charset", "CHARSET" );
3574*cdf0e10cSrcweir             break;
3575*cdf0e10cSrcweir             case 35:
3576*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
3577*cdf0e10cSrcweir             break;
3578*cdf0e10cSrcweir             case 36:
3579*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
3580*cdf0e10cSrcweir             break;
3581*cdf0e10cSrcweir             case 37:
3582*cdf0e10cSrcweir                 dumpDec< sal_uInt8 >( "scheme", "EXTFONT-SCHEME" );
3583*cdf0e10cSrcweir             break;
3584*cdf0e10cSrcweir             case 38:
3585*cdf0e10cSrcweir                 dumpUnicodeArray( "numfmt", rStrm.readuInt16() );
3586*cdf0e10cSrcweir             break;
3587*cdf0e10cSrcweir             case 41:
3588*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "fmt-idx", mxFormats );
3589*cdf0e10cSrcweir             break;
3590*cdf0e10cSrcweir             case 42:
3591*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "relative-indent" );
3592*cdf0e10cSrcweir             break;
3593*cdf0e10cSrcweir             case 43: case 44:
3594*cdf0e10cSrcweir                 dumpBoolean( "value" );
3595*cdf0e10cSrcweir             break;
3596*cdf0e10cSrcweir         }
3597*cdf0e10cSrcweir         dumpRemainingTo( nEndPos );
3598*cdf0e10cSrcweir     }
3599*cdf0e10cSrcweir }
3600*cdf0e10cSrcweir 
3601*cdf0e10cSrcweir void WorkbookStreamObject::dumpDxf12Prop()
3602*cdf0e10cSrcweir {
3603*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
3604*cdf0e10cSrcweir     writeEmptyItem( "dxf-data" );
3605*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
3606*cdf0e10cSrcweir     sal_uInt32 nSize = dumpDec< sal_uInt32 >( "dxf-size" );
3607*cdf0e10cSrcweir     if( nSize == 0 )
3608*cdf0e10cSrcweir     {
3609*cdf0e10cSrcweir         dumpUnused( 2 );
3610*cdf0e10cSrcweir     }
3611*cdf0e10cSrcweir     else
3612*cdf0e10cSrcweir     {
3613*cdf0e10cSrcweir         sal_Int64 nEndPos = rStrm.tell() + nSize;
3614*cdf0e10cSrcweir         dumpCfRuleProp();
3615*cdf0e10cSrcweir         if( rStrm.tell() + 8 <= nEndPos )
3616*cdf0e10cSrcweir         {
3617*cdf0e10cSrcweir             dumpUnused( 6 );
3618*cdf0e10cSrcweir             dumpXfExtProp();
3619*cdf0e10cSrcweir         }
3620*cdf0e10cSrcweir         dumpRemainingTo( nEndPos );
3621*cdf0e10cSrcweir     }
3622*cdf0e10cSrcweir }
3623*cdf0e10cSrcweir 
3624*cdf0e10cSrcweir void WorkbookStreamObject::dumpCfRule12Param( sal_uInt16 nSubType )
3625*cdf0e10cSrcweir {
3626*cdf0e10cSrcweir     sal_uInt8 nSize = dumpDec< sal_uInt8 >( "params-size" );
3627*cdf0e10cSrcweir     sal_Int64 nEndPos = getBiffStream().tell() + nSize;
3628*cdf0e10cSrcweir     {
3629*cdf0e10cSrcweir         writeEmptyItem( "params" );
3630*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
3631*cdf0e10cSrcweir         switch( nSubType )
3632*cdf0e10cSrcweir         {
3633*cdf0e10cSrcweir             case 5:
3634*cdf0e10cSrcweir                 dumpHex< sal_uInt8 >( "flags", "CFRULE12-TOP10-FLAGS" );
3635*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "rank" );
3636*cdf0e10cSrcweir                 dumpUnused( 13 );
3637*cdf0e10cSrcweir             break;
3638*cdf0e10cSrcweir             case 8:
3639*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "operator", "CFRULE12-TEXT-OPERATOR" );
3640*cdf0e10cSrcweir                 dumpUnused( 14 );
3641*cdf0e10cSrcweir             break;
3642*cdf0e10cSrcweir             case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24:
3643*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "operator", "CFRULE12-DATE-OPERATOR" );
3644*cdf0e10cSrcweir                 dumpUnused( 14 );
3645*cdf0e10cSrcweir             break;
3646*cdf0e10cSrcweir             case 25: case 26: case 29: case 30:
3647*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "std-dev" );
3648*cdf0e10cSrcweir                 dumpUnused( 14 );
3649*cdf0e10cSrcweir             break;
3650*cdf0e10cSrcweir             default:
3651*cdf0e10cSrcweir                 dumpUnused( 16 );
3652*cdf0e10cSrcweir         }
3653*cdf0e10cSrcweir     }
3654*cdf0e10cSrcweir     dumpRemainingTo( nEndPos );
3655*cdf0e10cSrcweir }
3656*cdf0e10cSrcweir 
3657*cdf0e10cSrcweir void WorkbookStreamObject::dumpFontRec()
3658*cdf0e10cSrcweir {
3659*cdf0e10cSrcweir     sal_uInt16 nFontId = getBiffData().getFontCount();
3660*cdf0e10cSrcweir     mxOut->resetItemIndex( nFontId );
3661*cdf0e10cSrcweir     writeEmptyItem( "#font" );
3662*cdf0e10cSrcweir     sal_uInt16 nHeight = dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
3663*cdf0e10cSrcweir     sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
3664*cdf0e10cSrcweir     bool bBold = getFlag( nFlags, BIFF_FONTFLAG_BOLD );
3665*cdf0e10cSrcweir     bool bItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
3666*cdf0e10cSrcweir     rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
3667*cdf0e10cSrcweir     if( getBiff() >= BIFF3 )
3668*cdf0e10cSrcweir         dumpColorIdx();
3669*cdf0e10cSrcweir     if( getBiff() >= BIFF5 )
3670*cdf0e10cSrcweir     {
3671*cdf0e10cSrcweir         bBold = dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" ) > 450;
3672*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
3673*cdf0e10cSrcweir         dumpDec< sal_uInt8 >( "underline", "FONT-UNDERLINE" );
3674*cdf0e10cSrcweir         dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
3675*cdf0e10cSrcweir         sal_uInt8 nCharSet = dumpDec< sal_uInt8 >( "charset", "CHARSET" );
3676*cdf0e10cSrcweir         eFontEnc = rtl_getTextEncodingFromWindowsCharset( nCharSet );
3677*cdf0e10cSrcweir         dumpUnused( 1 );
3678*cdf0e10cSrcweir     }
3679*cdf0e10cSrcweir     OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
3680*cdf0e10cSrcweir 
3681*cdf0e10cSrcweir     // append font data to vector
3682*cdf0e10cSrcweir     mxFontNames->setName( nFontId, createFontName( aName, nHeight, bBold, bItalic ) );
3683*cdf0e10cSrcweir 
3684*cdf0e10cSrcweir     // store font encoding
3685*cdf0e10cSrcweir     getBiffData().appendFontEncoding( eFontEnc );
3686*cdf0e10cSrcweir 
3687*cdf0e10cSrcweir     // set font encoding as default text encoding in case of missing CODEPAGE record
3688*cdf0e10cSrcweir     if( !mbHasCodePage && (nFontId == 0) )
3689*cdf0e10cSrcweir         getBiffData().setTextEncoding( eFontEnc );
3690*cdf0e10cSrcweir }
3691*cdf0e10cSrcweir 
3692*cdf0e10cSrcweir void WorkbookStreamObject::dumpFormatRec()
3693*cdf0e10cSrcweir {
3694*cdf0e10cSrcweir     sal_uInt16 nFormatIdx = 0;
3695*cdf0e10cSrcweir     switch( getBiff() )
3696*cdf0e10cSrcweir     {
3697*cdf0e10cSrcweir         case BIFF2:
3698*cdf0e10cSrcweir         case BIFF3:
3699*cdf0e10cSrcweir             nFormatIdx = mnFormatIdx++;
3700*cdf0e10cSrcweir             mxOut->resetItemIndex( nFormatIdx );
3701*cdf0e10cSrcweir             writeEmptyItem( "#fmt" );
3702*cdf0e10cSrcweir         break;
3703*cdf0e10cSrcweir         case BIFF4:
3704*cdf0e10cSrcweir             nFormatIdx = mnFormatIdx++;
3705*cdf0e10cSrcweir             mxOut->resetItemIndex( nFormatIdx );
3706*cdf0e10cSrcweir             writeEmptyItem( "#fmt" );
3707*cdf0e10cSrcweir             dumpUnused( 2 );
3708*cdf0e10cSrcweir         break;
3709*cdf0e10cSrcweir         case BIFF5:
3710*cdf0e10cSrcweir         case BIFF8:
3711*cdf0e10cSrcweir             getBiffStream() >> nFormatIdx;
3712*cdf0e10cSrcweir             mxOut->resetItemIndex( nFormatIdx );
3713*cdf0e10cSrcweir             writeEmptyItem( "#fmt" );
3714*cdf0e10cSrcweir             writeDecItem( "fmt-idx", nFormatIdx );
3715*cdf0e10cSrcweir         break;
3716*cdf0e10cSrcweir         case BIFF_UNKNOWN: break;
3717*cdf0e10cSrcweir     }
3718*cdf0e10cSrcweir     OUString aFormat = dumpString( "format", BIFF_STR_8BITLENGTH );
3719*cdf0e10cSrcweir     mxFormats->setName( nFormatIdx, aFormat );
3720*cdf0e10cSrcweir }
3721*cdf0e10cSrcweir 
3722*cdf0e10cSrcweir void WorkbookStreamObject::dumpXfRec()
3723*cdf0e10cSrcweir {
3724*cdf0e10cSrcweir     sal_uInt16 nXfId = getBiffData().getXfCount();
3725*cdf0e10cSrcweir     mxOut->resetItemIndex( nXfId );
3726*cdf0e10cSrcweir     writeEmptyItem( "#xf" );
3727*cdf0e10cSrcweir     sal_uInt16 nFontId = dumpFontIdx( EMPTY_STRING, getBiff() >= BIFF5 );
3728*cdf0e10cSrcweir     switch( getBiff() )
3729*cdf0e10cSrcweir     {
3730*cdf0e10cSrcweir         case BIFF2:
3731*cdf0e10cSrcweir             dumpUnused( 1 );
3732*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "type-flags", "XF-TYPEFLAGS" );
3733*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "style-flags", "XF-STYLEFLAGS" );
3734*cdf0e10cSrcweir         break;
3735*cdf0e10cSrcweir         case BIFF3:
3736*cdf0e10cSrcweir             dumpFormatIdx();
3737*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "type-flags", "XF-TYPEFLAGS" );
3738*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
3739*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "alignment", "XF-ALIGNMENT" );
3740*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "fill-style", "XF-FILL" );
3741*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
3742*cdf0e10cSrcweir         break;
3743*cdf0e10cSrcweir         case BIFF4:
3744*cdf0e10cSrcweir             dumpFormatIdx();
3745*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
3746*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
3747*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
3748*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "fill-style", "XF-FILL" );
3749*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
3750*cdf0e10cSrcweir         break;
3751*cdf0e10cSrcweir         case BIFF5:
3752*cdf0e10cSrcweir             dumpFormatIdx();
3753*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
3754*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
3755*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "orientation", "XF-ORIENTATTRIBS" );
3756*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "fill-style", "XF-FILL" );
3757*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
3758*cdf0e10cSrcweir         break;
3759*cdf0e10cSrcweir         case BIFF8:
3760*cdf0e10cSrcweir             dumpFormatIdx();
3761*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
3762*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
3763*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
3764*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "text-flags", "XF-TEXTFLAGS" );
3765*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
3766*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "border-style", "XF-BORDERSTYLE" );
3767*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "border-color1", "XF-BORDERCOLOR1" );
3768*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "border-color2", "XF-BORDERCOLOR2" );
3769*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "fill-color", "XF-FILLCOLOR" );
3770*cdf0e10cSrcweir         break;
3771*cdf0e10cSrcweir         case BIFF_UNKNOWN: break;
3772*cdf0e10cSrcweir     }
3773*cdf0e10cSrcweir     getBiffData().appendXfFontId( nFontId );
3774*cdf0e10cSrcweir }
3775*cdf0e10cSrcweir 
3776*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRec()
3777*cdf0e10cSrcweir {
3778*cdf0e10cSrcweir     switch( getBiff() )
3779*cdf0e10cSrcweir     {
3780*cdf0e10cSrcweir         case BIFF3:
3781*cdf0e10cSrcweir             dumpObjRecBiff3();
3782*cdf0e10cSrcweir         break;
3783*cdf0e10cSrcweir         case BIFF4:
3784*cdf0e10cSrcweir             dumpObjRecBiff4();
3785*cdf0e10cSrcweir         break;
3786*cdf0e10cSrcweir         case BIFF5:
3787*cdf0e10cSrcweir             dumpObjRecBiff5();
3788*cdf0e10cSrcweir         break;
3789*cdf0e10cSrcweir         case BIFF8:
3790*cdf0e10cSrcweir             // #i61786# OBJ records without DFF stream are in BIFF5 format
3791*cdf0e10cSrcweir             if( mbHasDff ) dumpObjRecBiff8(); else dumpObjRecBiff5();
3792*cdf0e10cSrcweir         break;
3793*cdf0e10cSrcweir         default:;
3794*cdf0e10cSrcweir     }
3795*cdf0e10cSrcweir }
3796*cdf0e10cSrcweir 
3797*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecBiff3()
3798*cdf0e10cSrcweir {
3799*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "obj-count" );
3800*cdf0e10cSrcweir     sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
3801*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "obj-id" );
3802*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
3803*cdf0e10cSrcweir     dumpDffClientRect();
3804*cdf0e10cSrcweir     sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
3805*cdf0e10cSrcweir     dumpUnused( 2 );
3806*cdf0e10cSrcweir     sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
3807*cdf0e10cSrcweir     switch( nObjType )
3808*cdf0e10cSrcweir     {
3809*cdf0e10cSrcweir         case BIFF_OBJTYPE_GROUP:
3810*cdf0e10cSrcweir             dumpUnused( 4 );
3811*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "next-ungrouped-id" );
3812*cdf0e10cSrcweir             dumpUnused( 16 );
3813*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3814*cdf0e10cSrcweir         break;
3815*cdf0e10cSrcweir         case BIFF_OBJTYPE_LINE:
3816*cdf0e10cSrcweir             dumpObjRecLineData();
3817*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
3818*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
3819*cdf0e10cSrcweir             dumpUnused( 1 );
3820*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3821*cdf0e10cSrcweir         break;
3822*cdf0e10cSrcweir         case BIFF_OBJTYPE_RECTANGLE:
3823*cdf0e10cSrcweir         case BIFF_OBJTYPE_OVAL:
3824*cdf0e10cSrcweir             dumpObjRecRectData();
3825*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3826*cdf0e10cSrcweir         break;
3827*cdf0e10cSrcweir         case BIFF_OBJTYPE_ARC:
3828*cdf0e10cSrcweir             dumpObjRecFillData();
3829*cdf0e10cSrcweir             dumpObjRecLineData();
3830*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
3831*cdf0e10cSrcweir             dumpUnused( 1 );
3832*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3833*cdf0e10cSrcweir         break;
3834*cdf0e10cSrcweir         case BIFF_OBJTYPE_CHART:
3835*cdf0e10cSrcweir             dumpObjRecRectData();
3836*cdf0e10cSrcweir             dumpUnused( 18 );
3837*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3838*cdf0e10cSrcweir         break;
3839*cdf0e10cSrcweir         case BIFF_OBJTYPE_TEXT:
3840*cdf0e10cSrcweir         case BIFF_OBJTYPE_BUTTON:
3841*cdf0e10cSrcweir             dumpObjRecRectData();
3842*cdf0e10cSrcweir             dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
3843*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3844*cdf0e10cSrcweir             dumpObjRecString( "text", nTextLen, false );
3845*cdf0e10cSrcweir             dumpObjRecTextFmt( nFormatSize );
3846*cdf0e10cSrcweir         break;
3847*cdf0e10cSrcweir         case BIFF_OBJTYPE_PICTURE:
3848*cdf0e10cSrcweir             dumpObjRecRectData();
3849*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
3850*cdf0e10cSrcweir             dumpUnused( 4 );
3851*cdf0e10cSrcweir             nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
3852*cdf0e10cSrcweir             dumpUnused( 2 );
3853*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
3854*cdf0e10cSrcweir             dumpObjRecString( "macro", nMacroSize, true );
3855*cdf0e10cSrcweir             dumpObjRecPictFmla( nLinkSize );
3856*cdf0e10cSrcweir         break;
3857*cdf0e10cSrcweir     }
3858*cdf0e10cSrcweir }
3859*cdf0e10cSrcweir 
3860*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecBiff4()
3861*cdf0e10cSrcweir {
3862*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "obj-count" );
3863*cdf0e10cSrcweir     sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
3864*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "obj-id" );
3865*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
3866*cdf0e10cSrcweir     dumpDffClientRect();
3867*cdf0e10cSrcweir     sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
3868*cdf0e10cSrcweir     dumpUnused( 2 );
3869*cdf0e10cSrcweir     sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
3870*cdf0e10cSrcweir     switch( nObjType )
3871*cdf0e10cSrcweir     {
3872*cdf0e10cSrcweir         case BIFF_OBJTYPE_GROUP:
3873*cdf0e10cSrcweir             dumpUnused( 4 );
3874*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "next-ungrouped-id" );
3875*cdf0e10cSrcweir             dumpUnused( 16 );
3876*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3877*cdf0e10cSrcweir         break;
3878*cdf0e10cSrcweir         case BIFF_OBJTYPE_LINE:
3879*cdf0e10cSrcweir             dumpObjRecLineData();
3880*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
3881*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
3882*cdf0e10cSrcweir             dumpUnused( 1 );
3883*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3884*cdf0e10cSrcweir         break;
3885*cdf0e10cSrcweir         case BIFF_OBJTYPE_RECTANGLE:
3886*cdf0e10cSrcweir         case BIFF_OBJTYPE_OVAL:
3887*cdf0e10cSrcweir             dumpObjRecRectData();
3888*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3889*cdf0e10cSrcweir         break;
3890*cdf0e10cSrcweir         case BIFF_OBJTYPE_ARC:
3891*cdf0e10cSrcweir             dumpObjRecFillData();
3892*cdf0e10cSrcweir             dumpObjRecLineData();
3893*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
3894*cdf0e10cSrcweir             dumpUnused( 1 );
3895*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3896*cdf0e10cSrcweir         break;
3897*cdf0e10cSrcweir         case BIFF_OBJTYPE_CHART:
3898*cdf0e10cSrcweir             dumpObjRecRectData();
3899*cdf0e10cSrcweir             dumpUnused( 18 );
3900*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3901*cdf0e10cSrcweir         break;
3902*cdf0e10cSrcweir         case BIFF_OBJTYPE_TEXT:
3903*cdf0e10cSrcweir         case BIFF_OBJTYPE_BUTTON:
3904*cdf0e10cSrcweir             dumpObjRecRectData();
3905*cdf0e10cSrcweir             dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
3906*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3907*cdf0e10cSrcweir             dumpObjRecString( "text", nTextLen, false );
3908*cdf0e10cSrcweir             dumpObjRecTextFmt( nFormatSize );
3909*cdf0e10cSrcweir         break;
3910*cdf0e10cSrcweir         case BIFF_OBJTYPE_PICTURE:
3911*cdf0e10cSrcweir             dumpObjRecRectData();
3912*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
3913*cdf0e10cSrcweir             dumpUnused( 4 );
3914*cdf0e10cSrcweir             nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
3915*cdf0e10cSrcweir             dumpUnused( 2 );
3916*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
3917*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3918*cdf0e10cSrcweir             dumpObjRecPictFmla( nLinkSize );
3919*cdf0e10cSrcweir         break;
3920*cdf0e10cSrcweir         case BIFF_OBJTYPE_POLYGON:
3921*cdf0e10cSrcweir             dumpObjRecRectData();
3922*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
3923*cdf0e10cSrcweir             dumpUnused( 10 );
3924*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "point-count" );
3925*cdf0e10cSrcweir             dumpUnused( 8 );
3926*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3927*cdf0e10cSrcweir         break;
3928*cdf0e10cSrcweir     }
3929*cdf0e10cSrcweir }
3930*cdf0e10cSrcweir 
3931*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecBiff5()
3932*cdf0e10cSrcweir {
3933*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
3934*cdf0e10cSrcweir     dumpDec< sal_uInt32 >( "obj-count" );
3935*cdf0e10cSrcweir     sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
3936*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "obj-id" );
3937*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
3938*cdf0e10cSrcweir     dumpDffClientRect();
3939*cdf0e10cSrcweir     sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
3940*cdf0e10cSrcweir     dumpUnused( 2 );
3941*cdf0e10cSrcweir     sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "name-len" );
3942*cdf0e10cSrcweir     dumpUnused( 2 );
3943*cdf0e10cSrcweir     sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
3944*cdf0e10cSrcweir     switch( nObjType )
3945*cdf0e10cSrcweir     {
3946*cdf0e10cSrcweir         case BIFF_OBJTYPE_GROUP:
3947*cdf0e10cSrcweir             dumpUnused( 4 );
3948*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "next-ungrouped-id" );
3949*cdf0e10cSrcweir             dumpUnused( 16 );
3950*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3951*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3952*cdf0e10cSrcweir         break;
3953*cdf0e10cSrcweir         case BIFF_OBJTYPE_LINE:
3954*cdf0e10cSrcweir             dumpObjRecLineData();
3955*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
3956*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
3957*cdf0e10cSrcweir             dumpUnused( 1 );
3958*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3959*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3960*cdf0e10cSrcweir         break;
3961*cdf0e10cSrcweir         case BIFF_OBJTYPE_RECTANGLE:
3962*cdf0e10cSrcweir         case BIFF_OBJTYPE_OVAL:
3963*cdf0e10cSrcweir             dumpObjRecRectData();
3964*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3965*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3966*cdf0e10cSrcweir         break;
3967*cdf0e10cSrcweir         case BIFF_OBJTYPE_ARC:
3968*cdf0e10cSrcweir             dumpObjRecFillData();
3969*cdf0e10cSrcweir             dumpObjRecLineData();
3970*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
3971*cdf0e10cSrcweir             dumpUnused( 1 );
3972*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3973*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3974*cdf0e10cSrcweir         break;
3975*cdf0e10cSrcweir         case BIFF_OBJTYPE_CHART:
3976*cdf0e10cSrcweir             dumpObjRecRectData();
3977*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "chart-flags", "OBJ-CHART-FLAGS" );
3978*cdf0e10cSrcweir             dumpUnused( 16 );
3979*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3980*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3981*cdf0e10cSrcweir         break;
3982*cdf0e10cSrcweir         case BIFF_OBJTYPE_TEXT:
3983*cdf0e10cSrcweir         case BIFF_OBJTYPE_BUTTON:
3984*cdf0e10cSrcweir         case BIFF_OBJTYPE_LABEL:
3985*cdf0e10cSrcweir         case BIFF_OBJTYPE_DIALOG:
3986*cdf0e10cSrcweir             dumpObjRecRectData();
3987*cdf0e10cSrcweir             dumpObjRecTextDataBiff5( nTextLen, nFormatSize, nLinkSize );
3988*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
3989*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
3990*cdf0e10cSrcweir             dumpObjRecString( "text", nTextLen, false );
3991*cdf0e10cSrcweir             dumpObjRecFmla( "text-link", nLinkSize );
3992*cdf0e10cSrcweir             dumpObjRecTextFmt( nFormatSize );
3993*cdf0e10cSrcweir         break;
3994*cdf0e10cSrcweir         case BIFF_OBJTYPE_PICTURE:
3995*cdf0e10cSrcweir             dumpObjRecRectData();
3996*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
3997*cdf0e10cSrcweir             dumpUnused( 4 );
3998*cdf0e10cSrcweir             nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
3999*cdf0e10cSrcweir             dumpUnused( 2 );
4000*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
4001*cdf0e10cSrcweir             dumpUnused( 4 );
4002*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4003*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
4004*cdf0e10cSrcweir             dumpObjRecPictFmla( nLinkSize );
4005*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 4 )
4006*cdf0e10cSrcweir                 dumpHex< sal_uInt32 >( "ole-storage-id" );
4007*cdf0e10cSrcweir         break;
4008*cdf0e10cSrcweir         case BIFF_OBJTYPE_POLYGON:
4009*cdf0e10cSrcweir             dumpObjRecRectData();
4010*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
4011*cdf0e10cSrcweir             dumpUnused( 10 );
4012*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "point-count" );
4013*cdf0e10cSrcweir             dumpUnused( 8 );
4014*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4015*cdf0e10cSrcweir             dumpObjRecFmla( "macro", nMacroSize );
4016*cdf0e10cSrcweir         break;
4017*cdf0e10cSrcweir         case BIFF_OBJTYPE_CHECKBOX:
4018*cdf0e10cSrcweir             dumpObjRecRectData();
4019*cdf0e10cSrcweir             dumpUnused( 10 );
4020*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4021*cdf0e10cSrcweir             dumpUnused( 20 );
4022*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4023*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4024*cdf0e10cSrcweir             dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4025*cdf0e10cSrcweir             dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4026*cdf0e10cSrcweir             dumpObjRecCblsData();
4027*cdf0e10cSrcweir         break;
4028*cdf0e10cSrcweir         case BIFF_OBJTYPE_OPTIONBUTTON:
4029*cdf0e10cSrcweir             dumpObjRecRectData();
4030*cdf0e10cSrcweir             dumpUnused( 10 );
4031*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4032*cdf0e10cSrcweir             dumpUnused( 32 );
4033*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4034*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4035*cdf0e10cSrcweir             dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4036*cdf0e10cSrcweir             dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4037*cdf0e10cSrcweir             dumpObjRecCblsData();
4038*cdf0e10cSrcweir             dumpObjRecRboData();
4039*cdf0e10cSrcweir         break;
4040*cdf0e10cSrcweir         case BIFF_OBJTYPE_EDIT:
4041*cdf0e10cSrcweir             dumpObjRecRectData();
4042*cdf0e10cSrcweir             dumpUnused( 10 );
4043*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4044*cdf0e10cSrcweir             dumpUnused( 14 );
4045*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4046*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4047*cdf0e10cSrcweir             dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4048*cdf0e10cSrcweir             dumpObjRecEdoData();
4049*cdf0e10cSrcweir         break;
4050*cdf0e10cSrcweir         case BIFF_OBJTYPE_SPIN:
4051*cdf0e10cSrcweir         case BIFF_OBJTYPE_SCROLLBAR:
4052*cdf0e10cSrcweir             dumpObjRecRectData();
4053*cdf0e10cSrcweir             dumpObjRecSbsData();
4054*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4055*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4056*cdf0e10cSrcweir             dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4057*cdf0e10cSrcweir         break;
4058*cdf0e10cSrcweir         case BIFF_OBJTYPE_LISTBOX:
4059*cdf0e10cSrcweir             dumpObjRecRectData();
4060*cdf0e10cSrcweir             dumpObjRecSbsData();
4061*cdf0e10cSrcweir             dumpUnused( 18 );
4062*cdf0e10cSrcweir             dumpFontIdx( "font-idx" );
4063*cdf0e10cSrcweir             dumpUnused( 4 );
4064*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4065*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4066*cdf0e10cSrcweir             dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4067*cdf0e10cSrcweir             dumpObjRecLbsData();
4068*cdf0e10cSrcweir         break;
4069*cdf0e10cSrcweir         case BIFF_OBJTYPE_GROUPBOX:
4070*cdf0e10cSrcweir             dumpObjRecRectData();
4071*cdf0e10cSrcweir             dumpUnused( 10 );
4072*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4073*cdf0e10cSrcweir             dumpUnused( 26 );
4074*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4075*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4076*cdf0e10cSrcweir             dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4077*cdf0e10cSrcweir             dumpObjRecGboData();
4078*cdf0e10cSrcweir         break;
4079*cdf0e10cSrcweir         case BIFF_OBJTYPE_DROPDOWN:
4080*cdf0e10cSrcweir             dumpObjRecRectData();
4081*cdf0e10cSrcweir             dumpObjRecSbsData();
4082*cdf0e10cSrcweir             dumpUnused( 18 );
4083*cdf0e10cSrcweir             dumpFontIdx( "font-idx" );
4084*cdf0e10cSrcweir             dumpUnused( 14 );
4085*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bounding-left" );
4086*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bounding-top" );
4087*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bounding-right" );
4088*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bounding-bottom" );
4089*cdf0e10cSrcweir             dumpUnused( 4 );
4090*cdf0e10cSrcweir             dumpObjRecString( "obj-name", nNameLen, true );
4091*cdf0e10cSrcweir             dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
4092*cdf0e10cSrcweir             dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4093*cdf0e10cSrcweir             dumpObjRecLbsData();
4094*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "type", "OBJ-DROPDOWN-TYPE" );
4095*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "line-count" );
4096*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "min-list-width" );
4097*cdf0e10cSrcweir             dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4098*cdf0e10cSrcweir         break;
4099*cdf0e10cSrcweir     }
4100*cdf0e10cSrcweir }
4101*cdf0e10cSrcweir 
4102*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecBiff8()
4103*cdf0e10cSrcweir {
4104*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
4105*cdf0e10cSrcweir     NameListRef xRecNames = cfg().getNameList( "OBJ-RECNAMES" );
4106*cdf0e10cSrcweir     sal_uInt16 nObjType = 0xFFFF;
4107*cdf0e10cSrcweir     bool bControl = false;
4108*cdf0e10cSrcweir     bool bCtlsStrm = false;
4109*cdf0e10cSrcweir     bool bLoop = true;
4110*cdf0e10cSrcweir     while( bLoop && (rStrm.getRemaining() >= 4) )
4111*cdf0e10cSrcweir     {
4112*cdf0e10cSrcweir         mxOut->emptyLine();
4113*cdf0e10cSrcweir         sal_uInt16 nSubRecId, nSubRecSize;
4114*cdf0e10cSrcweir         {
4115*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
4116*cdf0e10cSrcweir             writeEmptyItem( "OBJREC" );
4117*cdf0e10cSrcweir             writeHexItem( "pos", static_cast< sal_uInt32 >( rStrm.tell() ) );
4118*cdf0e10cSrcweir             rStrm >> nSubRecId >> nSubRecSize;
4119*cdf0e10cSrcweir             writeHexItem( "size", nSubRecSize );
4120*cdf0e10cSrcweir             writeHexItem( "id", nSubRecId, xRecNames );
4121*cdf0e10cSrcweir         }
4122*cdf0e10cSrcweir 
4123*cdf0e10cSrcweir         sal_Int64 nSubRecStart = rStrm.tell();
4124*cdf0e10cSrcweir         // sometimes the last subrecord has an invalid length
4125*cdf0e10cSrcweir         sal_Int64 nRealRecSize = ::std::min< sal_Int64 >( nSubRecSize, rStrm.getRemaining() );
4126*cdf0e10cSrcweir         sal_Int64 nSubRecEnd = nSubRecStart + nRealRecSize;
4127*cdf0e10cSrcweir 
4128*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
4129*cdf0e10cSrcweir         switch( nSubRecId )
4130*cdf0e10cSrcweir         {
4131*cdf0e10cSrcweir             case BIFF_ID_OBJMACRO:
4132*cdf0e10cSrcweir                 dumpObjRecFmlaRaw();
4133*cdf0e10cSrcweir             break;
4134*cdf0e10cSrcweir             case BIFF_ID_OBJCF:
4135*cdf0e10cSrcweir                 dumpDec< sal_Int16 >( "clipboard-format", "IMGDATA-FORMAT" );
4136*cdf0e10cSrcweir             break;
4137*cdf0e10cSrcweir             case BIFF_ID_OBJFLAGS:
4138*cdf0e10cSrcweir             {
4139*cdf0e10cSrcweir                 sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OBJFLAGS-FLAGS" );
4140*cdf0e10cSrcweir                 bControl = getFlag( nFlags, BIFF_OBJFLAGS_CONTROL );
4141*cdf0e10cSrcweir                 bCtlsStrm = getFlag( nFlags, BIFF_OBJFLAGS_CTLSSTREAM );
4142*cdf0e10cSrcweir             }
4143*cdf0e10cSrcweir             break;
4144*cdf0e10cSrcweir             case BIFF_ID_OBJPICTFMLA:
4145*cdf0e10cSrcweir             {
4146*cdf0e10cSrcweir                 dumpObjRecPictFmla( dumpDec< sal_uInt16 >( "pic-link-size" ) );
4147*cdf0e10cSrcweir                 if( rStrm.tell() + 4 <= nSubRecEnd )
4148*cdf0e10cSrcweir                 {
4149*cdf0e10cSrcweir                     if( bControl && bCtlsStrm )
4150*cdf0e10cSrcweir                         dumpControl();
4151*cdf0e10cSrcweir                     else
4152*cdf0e10cSrcweir                         dumpHex< sal_uInt32 >( "ole-storage-id" );
4153*cdf0e10cSrcweir                 }
4154*cdf0e10cSrcweir                 if( bControl && (rStrm.tell() + 8 <= nSubRecEnd) )
4155*cdf0e10cSrcweir                 {
4156*cdf0e10cSrcweir                     sal_uInt32 nKeySize = dumpDec< sal_uInt32 >( "licence-key-size" );
4157*cdf0e10cSrcweir                     if( nKeySize > 0 )
4158*cdf0e10cSrcweir                     {
4159*cdf0e10cSrcweir                         IndentGuard aIndGuard2( mxOut );
4160*cdf0e10cSrcweir                         sal_Int64 nKeyEnd = rStrm.tell() + nKeySize;
4161*cdf0e10cSrcweir                         dumpArray( "licence-key", static_cast< sal_Int32 >( nKeySize ) );
4162*cdf0e10cSrcweir                         rStrm.seek( nKeyEnd );
4163*cdf0e10cSrcweir                     }
4164*cdf0e10cSrcweir                     dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
4165*cdf0e10cSrcweir                     dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
4166*cdf0e10cSrcweir                 }
4167*cdf0e10cSrcweir             }
4168*cdf0e10cSrcweir             break;
4169*cdf0e10cSrcweir             case BIFF_ID_OBJCBLS:
4170*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
4171*cdf0e10cSrcweir                 dumpUnused( 4 );
4172*cdf0e10cSrcweir                 dumpUnicode( "accelerator" );
4173*cdf0e10cSrcweir                 dumpUnicode( "fareast-accelerator" );
4174*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
4175*cdf0e10cSrcweir             break;
4176*cdf0e10cSrcweir             case BIFF_ID_OBJRBO:
4177*cdf0e10cSrcweir                 dumpUnused( 4 );
4178*cdf0e10cSrcweir                 dumpBool< sal_uInt16 >( "first-in-group" );
4179*cdf0e10cSrcweir             break;
4180*cdf0e10cSrcweir             case BIFF_ID_OBJSBS:
4181*cdf0e10cSrcweir                 dumpObjRecSbsData();
4182*cdf0e10cSrcweir             break;
4183*cdf0e10cSrcweir             case BIFF_ID_OBJGBODATA:
4184*cdf0e10cSrcweir                 dumpObjRecGboData();
4185*cdf0e10cSrcweir             break;
4186*cdf0e10cSrcweir             case BIFF_ID_OBJEDODATA:
4187*cdf0e10cSrcweir                 dumpObjRecEdoData();
4188*cdf0e10cSrcweir             break;
4189*cdf0e10cSrcweir             case BIFF_ID_OBJRBODATA:
4190*cdf0e10cSrcweir                 dumpObjRecRboData();
4191*cdf0e10cSrcweir             break;
4192*cdf0e10cSrcweir             case BIFF_ID_OBJCBLSDATA:
4193*cdf0e10cSrcweir                 dumpObjRecCblsData();
4194*cdf0e10cSrcweir             break;
4195*cdf0e10cSrcweir             case BIFF_ID_OBJLBSDATA:
4196*cdf0e10cSrcweir                 dumpObjRecLbsData();
4197*cdf0e10cSrcweir                 if( nObjType == BIFF_OBJTYPE_DROPDOWN )
4198*cdf0e10cSrcweir                 {
4199*cdf0e10cSrcweir                     dumpHex< sal_uInt16 >( "dropdown-flags", "OBJ-DROPDOWN-FLAGS" );
4200*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "line-count" );
4201*cdf0e10cSrcweir                     dumpDec< sal_uInt16 >( "min-list-width" );
4202*cdf0e10cSrcweir                     dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
4203*cdf0e10cSrcweir                 }
4204*cdf0e10cSrcweir             break;
4205*cdf0e10cSrcweir             case BIFF_ID_OBJCBLSFMLA:
4206*cdf0e10cSrcweir             case BIFF_ID_OBJSBSFMLA:
4207*cdf0e10cSrcweir                 dumpObjRecFmlaRaw();
4208*cdf0e10cSrcweir             break;
4209*cdf0e10cSrcweir             case BIFF_ID_OBJCMO:
4210*cdf0e10cSrcweir                 nObjType = dumpDec< sal_uInt16 >( "type", "OBJ-TYPE" );
4211*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "id" );
4212*cdf0e10cSrcweir                 dumpHex< sal_uInt16 >( "flags", "OBJCMO-FLAGS" );
4213*cdf0e10cSrcweir                 dumpUnused( 12 );
4214*cdf0e10cSrcweir             break;
4215*cdf0e10cSrcweir         }
4216*cdf0e10cSrcweir         // remaining undumped data
4217*cdf0e10cSrcweir         if( !rStrm.isEof() && (rStrm.tell() == nSubRecStart) )
4218*cdf0e10cSrcweir             dumpRawBinary( nRealRecSize, false );
4219*cdf0e10cSrcweir         else
4220*cdf0e10cSrcweir             dumpRemainingTo( nSubRecEnd );
4221*cdf0e10cSrcweir     }
4222*cdf0e10cSrcweir }
4223*cdf0e10cSrcweir 
4224*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecLineData()
4225*cdf0e10cSrcweir {
4226*cdf0e10cSrcweir     dumpColorIdx( "line-color-idx", false );
4227*cdf0e10cSrcweir     dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
4228*cdf0e10cSrcweir     dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
4229*cdf0e10cSrcweir     dumpHex< sal_uInt8 >( "line-flags", "OBJ-AUTO-FLAGS" );
4230*cdf0e10cSrcweir }
4231*cdf0e10cSrcweir 
4232*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecFillData()
4233*cdf0e10cSrcweir {
4234*cdf0e10cSrcweir     dumpColorIdx( "back-color-idx", false );
4235*cdf0e10cSrcweir     dumpColorIdx( "patt-color-idx", false );
4236*cdf0e10cSrcweir     dumpPatternIdx( EMPTY_STRING, false );
4237*cdf0e10cSrcweir     dumpHex< sal_uInt8 >( "area-flags", "OBJ-AUTO-FLAGS" );
4238*cdf0e10cSrcweir }
4239*cdf0e10cSrcweir 
4240*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecRectData()
4241*cdf0e10cSrcweir {
4242*cdf0e10cSrcweir     dumpObjRecFillData();
4243*cdf0e10cSrcweir     dumpObjRecLineData();
4244*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "frame-style", "OBJ-FRAMESTYLE-FLAGS" );
4245*cdf0e10cSrcweir }
4246*cdf0e10cSrcweir 
4247*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecTextDataBiff3( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize )
4248*cdf0e10cSrcweir {
4249*cdf0e10cSrcweir     ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
4250*cdf0e10cSrcweir     dumpUnused( 2 );
4251*cdf0e10cSrcweir     ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
4252*cdf0e10cSrcweir     dumpFontIdx( "default-font-idx" );
4253*cdf0e10cSrcweir     dumpUnused( 2 );
4254*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4255*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
4256*cdf0e10cSrcweir     dumpUnused( 8 );
4257*cdf0e10cSrcweir }
4258*cdf0e10cSrcweir 
4259*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecTextDataBiff5( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize, sal_uInt16& ornLinkSize )
4260*cdf0e10cSrcweir {
4261*cdf0e10cSrcweir     ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
4262*cdf0e10cSrcweir     dumpUnused( 2 );
4263*cdf0e10cSrcweir     ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
4264*cdf0e10cSrcweir     dumpFontIdx( "default-font-idx" );
4265*cdf0e10cSrcweir     dumpUnused( 2 );
4266*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
4267*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
4268*cdf0e10cSrcweir     dumpUnused( 2 );
4269*cdf0e10cSrcweir     ornLinkSize = dumpDec< sal_uInt16 >( "link-size" );
4270*cdf0e10cSrcweir     dumpUnused( 2 );
4271*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
4272*cdf0e10cSrcweir     dumpUnicode( "accelerator" );
4273*cdf0e10cSrcweir     dumpUnicode( "fareast-accelerator" );
4274*cdf0e10cSrcweir }
4275*cdf0e10cSrcweir 
4276*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecSbsData()
4277*cdf0e10cSrcweir {
4278*cdf0e10cSrcweir     dumpUnused( 4 );
4279*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "value" );
4280*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "min" );
4281*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "max" );
4282*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "step" );
4283*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "page-step" );
4284*cdf0e10cSrcweir     dumpBool< sal_uInt16 >( "horizontal" );
4285*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "thumb-width" );
4286*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "scrollbar-flags", "OBJ-SCROLLBAR-FLAGS" );
4287*cdf0e10cSrcweir }
4288*cdf0e10cSrcweir 
4289*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecGboData()
4290*cdf0e10cSrcweir {
4291*cdf0e10cSrcweir     dumpUnicode( "accelerator" );
4292*cdf0e10cSrcweir     dumpUnicode( "fareast-accelerator" );
4293*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "groupbox-flags", "OBJ-GROUPBOX-FLAGS" );
4294*cdf0e10cSrcweir }
4295*cdf0e10cSrcweir 
4296*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecEdoData()
4297*cdf0e10cSrcweir {
4298*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "type", "OBJ-EDIT-TYPE" );
4299*cdf0e10cSrcweir     dumpBool< sal_uInt16 >( "multiline" );
4300*cdf0e10cSrcweir     dumpBool< sal_uInt16 >( "scrollbar" );
4301*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "listbox-obj-id" );
4302*cdf0e10cSrcweir }
4303*cdf0e10cSrcweir 
4304*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecRboData()
4305*cdf0e10cSrcweir {
4306*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "next-in-group" );
4307*cdf0e10cSrcweir     dumpBool< sal_uInt16 >( "first-in-group" );
4308*cdf0e10cSrcweir }
4309*cdf0e10cSrcweir 
4310*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecCblsData()
4311*cdf0e10cSrcweir {
4312*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
4313*cdf0e10cSrcweir     dumpUnicode( "accelerator" );
4314*cdf0e10cSrcweir     dumpUnicode( "fareast-accelerator" );
4315*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
4316*cdf0e10cSrcweir }
4317*cdf0e10cSrcweir 
4318*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecLbsData()
4319*cdf0e10cSrcweir {
4320*cdf0e10cSrcweir     dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
4321*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "entry-count" );
4322*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "selected-entry" );
4323*cdf0e10cSrcweir     dumpHex< sal_uInt16 >( "listbox-flags", "OBJ-LISTBOX-FLAGS" );
4324*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "edit-obj-id" );
4325*cdf0e10cSrcweir }
4326*cdf0e10cSrcweir 
4327*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecPadding()
4328*cdf0e10cSrcweir {
4329*cdf0e10cSrcweir     if( getBiffStream().tell() & 1 )
4330*cdf0e10cSrcweir     {
4331*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
4332*cdf0e10cSrcweir         dumpHex< sal_uInt8 >( "padding" );
4333*cdf0e10cSrcweir     }
4334*cdf0e10cSrcweir }
4335*cdf0e10cSrcweir 
4336*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecString( const String& rName, sal_uInt16 nTextLen, bool bRepeatLen )
4337*cdf0e10cSrcweir {
4338*cdf0e10cSrcweir     if( nTextLen > 0 )
4339*cdf0e10cSrcweir     {
4340*cdf0e10cSrcweir         if( bRepeatLen )
4341*cdf0e10cSrcweir             dumpByteString( rName, BIFF_STR_8BITLENGTH );
4342*cdf0e10cSrcweir         else
4343*cdf0e10cSrcweir             writeStringItem( rName, getBiffStream().readCharArrayUC( nTextLen, getBiffData().getTextEncoding() ) );
4344*cdf0e10cSrcweir         dumpObjRecPadding();
4345*cdf0e10cSrcweir     }
4346*cdf0e10cSrcweir }
4347*cdf0e10cSrcweir 
4348*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecTextFmt( sal_uInt16 nFormatSize )
4349*cdf0e10cSrcweir {
4350*cdf0e10cSrcweir     FontPortionModelList aPortions;
4351*cdf0e10cSrcweir     aPortions.importPortions( getBiffStream(), nFormatSize / 8, BIFF_FONTPORTION_OBJ );
4352*cdf0e10cSrcweir     writeFontPortions( aPortions );
4353*cdf0e10cSrcweir }
4354*cdf0e10cSrcweir 
4355*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecFmlaRaw()
4356*cdf0e10cSrcweir {
4357*cdf0e10cSrcweir     sal_uInt16 nFmlaSize = dumpDec< sal_uInt16 >( "fmla-size" );
4358*cdf0e10cSrcweir     dumpUnused( 4 );
4359*cdf0e10cSrcweir     getFormulaDumper().dumpNameFormula( "fmla", nFmlaSize );
4360*cdf0e10cSrcweir     dumpObjRecPadding();
4361*cdf0e10cSrcweir }
4362*cdf0e10cSrcweir 
4363*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize )
4364*cdf0e10cSrcweir {
4365*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
4366*cdf0e10cSrcweir     if( nFmlaSize > 0 )
4367*cdf0e10cSrcweir     {
4368*cdf0e10cSrcweir         writeEmptyItem( rName );
4369*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
4370*cdf0e10cSrcweir         sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
4371*cdf0e10cSrcweir         dumpObjRecFmlaRaw();
4372*cdf0e10cSrcweir         if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
4373*cdf0e10cSrcweir             writeEmptyItem( OOX_DUMP_ERRASCII( "fmla-size" ) );
4374*cdf0e10cSrcweir         dumpRemainingTo( nStrmEnd );
4375*cdf0e10cSrcweir     }
4376*cdf0e10cSrcweir }
4377*cdf0e10cSrcweir 
4378*cdf0e10cSrcweir void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize )
4379*cdf0e10cSrcweir {
4380*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
4381*cdf0e10cSrcweir     if( nFmlaSize > 0 )
4382*cdf0e10cSrcweir     {
4383*cdf0e10cSrcweir         writeEmptyItem( "pic-link" );
4384*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
4385*cdf0e10cSrcweir         sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
4386*cdf0e10cSrcweir         if( (getBiff() == BIFF3) && (nStrmEnd & 1) ) ++nStrmEnd; // BIFF3 size without padding
4387*cdf0e10cSrcweir         dumpObjRecFmlaRaw();
4388*cdf0e10cSrcweir         if( rStrm.tell() + 2 <= nStrmEnd )
4389*cdf0e10cSrcweir         {
4390*cdf0e10cSrcweir             dumpString( "class-name", BIFF_STR_DEFAULT, BIFF_STR_SMARTFLAGS );
4391*cdf0e10cSrcweir             dumpObjRecPadding();
4392*cdf0e10cSrcweir         }
4393*cdf0e10cSrcweir         if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
4394*cdf0e10cSrcweir             writeEmptyItem( OOX_DUMP_ERRASCII( "pic-link-size" ) );
4395*cdf0e10cSrcweir         dumpRemainingTo( nStrmEnd );
4396*cdf0e10cSrcweir     }
4397*cdf0e10cSrcweir }
4398*cdf0e10cSrcweir 
4399*cdf0e10cSrcweir void WorkbookStreamObject::dumpChFrExtProps()
4400*cdf0e10cSrcweir {
4401*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
4402*cdf0e10cSrcweir     bool bValid = true;
4403*cdf0e10cSrcweir     while( bValid && (rStrm.getRemaining() > 4) )
4404*cdf0e10cSrcweir     {
4405*cdf0e10cSrcweir         ChFrExtPropInfo aInfo = dumpChFrExtPropHeader();
4406*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
4407*cdf0e10cSrcweir         switch( aInfo.first )
4408*cdf0e10cSrcweir         {
4409*cdf0e10cSrcweir             case 0: // start
4410*cdf0e10cSrcweir             case 1: // end
4411*cdf0e10cSrcweir             break;
4412*cdf0e10cSrcweir             case 2: // bool
4413*cdf0e10cSrcweir                 dumpBoolean( "value" );
4414*cdf0e10cSrcweir                 dumpUnused( 1 );
4415*cdf0e10cSrcweir             break;
4416*cdf0e10cSrcweir             case 3: // double
4417*cdf0e10cSrcweir                 dumpUnused( 4 );
4418*cdf0e10cSrcweir                 dumpDec< double >( "value", aInfo.second );
4419*cdf0e10cSrcweir             break;
4420*cdf0e10cSrcweir             case 4: // int32
4421*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "value", aInfo.second );
4422*cdf0e10cSrcweir             break;
4423*cdf0e10cSrcweir             case 5: // string
4424*cdf0e10cSrcweir                 dumpUnicodeArray( "value", rStrm.readInt32() );
4425*cdf0e10cSrcweir             break;
4426*cdf0e10cSrcweir             case 6: // uint16
4427*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "value", aInfo.second );
4428*cdf0e10cSrcweir             break;
4429*cdf0e10cSrcweir             case 7: // blob
4430*cdf0e10cSrcweir                 dumpBinary( "value", rStrm.readuInt32() );
4431*cdf0e10cSrcweir             break;
4432*cdf0e10cSrcweir             default:
4433*cdf0e10cSrcweir                 bValid = false;
4434*cdf0e10cSrcweir         }
4435*cdf0e10cSrcweir     }
4436*cdf0e10cSrcweir }
4437*cdf0e10cSrcweir 
4438*cdf0e10cSrcweir WorkbookStreamObject::ChFrExtPropInfo WorkbookStreamObject::dumpChFrExtPropHeader()
4439*cdf0e10cSrcweir {
4440*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
4441*cdf0e10cSrcweir     ChFrExtPropInfo aInfo;
4442*cdf0e10cSrcweir     aInfo.first = dumpDec< sal_uInt8 >( "datatype", "CHFREXTPROPS-TYPE" );
4443*cdf0e10cSrcweir     dumpUnused( 1 );
4444*cdf0e10cSrcweir     sal_uInt16 nTag = dumpDec< sal_uInt16 >( "tag", "CHFREXTPROPS-TAG" );
4445*cdf0e10cSrcweir     aInfo.second = cfg().getName( "CHFREXTPROPS-TAG-NAMELIST", nTag );
4446*cdf0e10cSrcweir     return aInfo;
4447*cdf0e10cSrcweir }
4448*cdf0e10cSrcweir 
4449*cdf0e10cSrcweir // ============================================================================
4450*cdf0e10cSrcweir 
4451*cdf0e10cSrcweir PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const ::rtl::OUString& rSysFileName )
4452*cdf0e10cSrcweir {
4453*cdf0e10cSrcweir     RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
4454*cdf0e10cSrcweir }
4455*cdf0e10cSrcweir 
4456*cdf0e10cSrcweir void PivotCacheStreamObject::implDumpRecordBody()
4457*cdf0e10cSrcweir {
4458*cdf0e10cSrcweir     BiffInputStream& rStrm = getBiffStream();
4459*cdf0e10cSrcweir     sal_uInt16 nRecId = rStrm.getRecId();
4460*cdf0e10cSrcweir 
4461*cdf0e10cSrcweir     switch( nRecId )
4462*cdf0e10cSrcweir     {
4463*cdf0e10cSrcweir         case BIFF_ID_PCDEFINITION:
4464*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "source-records" );
4465*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "cache-id" );
4466*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PCDEFINITION-FLAGS" );
4467*cdf0e10cSrcweir             dumpUnused( 2 );
4468*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "sourcedata-field-count" );
4469*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "cache-field-count" );
4470*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "report-record-count" );
4471*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "database-type", "PCDSOURCE-TYPE" );
4472*cdf0e10cSrcweir             dumpString( "user-name" );
4473*cdf0e10cSrcweir         break;
4474*cdf0e10cSrcweir 
4475*cdf0e10cSrcweir         case BIFF_ID_PCDEFINITION2:
4476*cdf0e10cSrcweir             dumpDec< double >( "refreshed-date" );
4477*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "formula-count" );
4478*cdf0e10cSrcweir         break;
4479*cdf0e10cSrcweir 
4480*cdf0e10cSrcweir         case BIFF_ID_PCDFDISCRETEPR:
4481*cdf0e10cSrcweir             mxOut->resetItemIndex();
4482*cdf0e10cSrcweir             while( !rStrm.isEof() && (rStrm.getRemaining() >= 2) )
4483*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "#item-index" );
4484*cdf0e10cSrcweir         break;
4485*cdf0e10cSrcweir 
4486*cdf0e10cSrcweir         case BIFF_ID_PCDFIELD:
4487*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
4488*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "group-parent-field" );
4489*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "group-base-field" );
4490*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "unique-items" );
4491*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "group-items" );
4492*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "base-items" );
4493*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "shared-items" );
4494*cdf0e10cSrcweir             if( rStrm.getRemaining() >= 3 )
4495*cdf0e10cSrcweir                 dumpString( "item-name" );
4496*cdf0e10cSrcweir         break;
4497*cdf0e10cSrcweir 
4498*cdf0e10cSrcweir         case BIFF_ID_PCITEM_DATE:
4499*cdf0e10cSrcweir         {
4500*cdf0e10cSrcweir             DateTime aDateTime;
4501*cdf0e10cSrcweir             aDateTime.Year = mxStrm->readuInt16();
4502*cdf0e10cSrcweir             aDateTime.Month = mxStrm->readuInt16();
4503*cdf0e10cSrcweir             aDateTime.Day = mxStrm->readuInt8();
4504*cdf0e10cSrcweir             aDateTime.Hours = mxStrm->readuInt8();
4505*cdf0e10cSrcweir             aDateTime.Minutes = mxStrm->readuInt8();
4506*cdf0e10cSrcweir             aDateTime.Seconds = mxStrm->readuInt8();
4507*cdf0e10cSrcweir             writeDateTimeItem( "value", aDateTime );
4508*cdf0e10cSrcweir         }
4509*cdf0e10cSrcweir         break;
4510*cdf0e10cSrcweir 
4511*cdf0e10cSrcweir         case BIFF_ID_PCITEM_STRING:
4512*cdf0e10cSrcweir             dumpString( "value" );
4513*cdf0e10cSrcweir         break;
4514*cdf0e10cSrcweir     }
4515*cdf0e10cSrcweir }
4516*cdf0e10cSrcweir 
4517*cdf0e10cSrcweir // ============================================================================
4518*cdf0e10cSrcweir // ============================================================================
4519*cdf0e10cSrcweir 
4520*cdf0e10cSrcweir RootStorageObject::RootStorageObject( const DumperBase& rParent )
4521*cdf0e10cSrcweir {
4522*cdf0e10cSrcweir     OleStorageObject::construct( rParent );
4523*cdf0e10cSrcweir     addPreferredStream( "Book" );
4524*cdf0e10cSrcweir     addPreferredStream( "Workbook" );
4525*cdf0e10cSrcweir }
4526*cdf0e10cSrcweir 
4527*cdf0e10cSrcweir void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
4528*cdf0e10cSrcweir {
4529*cdf0e10cSrcweir     if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAscii( "Book" ) || rStrmName.equalsAscii( "Workbook" )) )
4530*cdf0e10cSrcweir         WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
4531*cdf0e10cSrcweir     else if( rStrgPath.equalsAscii( "_SX_DB" ) )
4532*cdf0e10cSrcweir         PivotCacheStreamObject( *this, rxStrm, BIFF5, rSysFileName ).dump();
4533*cdf0e10cSrcweir     else if( rStrgPath.equalsAscii( "_SX_DB_CUR" ) )
4534*cdf0e10cSrcweir         PivotCacheStreamObject( *this, rxStrm, BIFF8, rSysFileName ).dump();
4535*cdf0e10cSrcweir     else
4536*cdf0e10cSrcweir         OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
4537*cdf0e10cSrcweir }
4538*cdf0e10cSrcweir 
4539*cdf0e10cSrcweir void RootStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
4540*cdf0e10cSrcweir {
4541*cdf0e10cSrcweir     if( rStrgPath.equalsAscii( "_VBA_PROJECT_CUR" ) )
4542*cdf0e10cSrcweir         VbaProjectStorageObject( *this, rxStrg, rSysPath ).dump();
4543*cdf0e10cSrcweir     else if( rStrgPath.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "MBD" ) ) )
4544*cdf0e10cSrcweir         VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
4545*cdf0e10cSrcweir     else
4546*cdf0e10cSrcweir         OleStorageObject::implDumpStorage( rxStrg, rStrgPath, rSysPath );
4547*cdf0e10cSrcweir }
4548*cdf0e10cSrcweir 
4549*cdf0e10cSrcweir void RootStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
4550*cdf0e10cSrcweir {
4551*cdf0e10cSrcweir     WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
4552*cdf0e10cSrcweir }
4553*cdf0e10cSrcweir 
4554*cdf0e10cSrcweir // ============================================================================
4555*cdf0e10cSrcweir // ============================================================================
4556*cdf0e10cSrcweir 
4557*cdf0e10cSrcweir #define DUMP_BIFF_CONFIG_ENVVAR "OOO_BIFFDUMPER"
4558*cdf0e10cSrcweir 
4559*cdf0e10cSrcweir Dumper::Dumper( const FilterBase& rFilter )
4560*cdf0e10cSrcweir {
4561*cdf0e10cSrcweir     ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rFilter ) );
4562*cdf0e10cSrcweir     DumperBase::construct( xCfg );
4563*cdf0e10cSrcweir }
4564*cdf0e10cSrcweir 
4565*cdf0e10cSrcweir Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
4566*cdf0e10cSrcweir {
4567*cdf0e10cSrcweir     if( rxContext.is() && rxInStrm.is() )
4568*cdf0e10cSrcweir     {
4569*cdf0e10cSrcweir         StorageRef xStrg( new ::oox::ole::OleStorage( rxContext, rxInStrm, true ) );
4570*cdf0e10cSrcweir         MediaDescriptor aMediaDesc;
4571*cdf0e10cSrcweir         ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName, aMediaDesc ) );
4572*cdf0e10cSrcweir         DumperBase::construct( xCfg );
4573*cdf0e10cSrcweir     }
4574*cdf0e10cSrcweir }
4575*cdf0e10cSrcweir 
4576*cdf0e10cSrcweir void Dumper::implDump()
4577*cdf0e10cSrcweir {
4578*cdf0e10cSrcweir     RootStorageObject( *this ).dump();
4579*cdf0e10cSrcweir }
4580*cdf0e10cSrcweir 
4581*cdf0e10cSrcweir // ============================================================================
4582*cdf0e10cSrcweir // ============================================================================
4583*cdf0e10cSrcweir 
4584*cdf0e10cSrcweir } // namespace biff
4585*cdf0e10cSrcweir } // namespace dump
4586*cdf0e10cSrcweir } // namespace oox
4587*cdf0e10cSrcweir 
4588*cdf0e10cSrcweir #endif
4589