xref: /aoo41x/main/oox/source/dump/xlsbdumper.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include "oox/dump/xlsbdumper.hxx"
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <com/sun/star/io/XTextInputStream.hpp>
31*cdf0e10cSrcweir #include "oox/core/filterbase.hxx"
32*cdf0e10cSrcweir #include "oox/dump/biffdumper.hxx"
33*cdf0e10cSrcweir #include "oox/dump/oledumper.hxx"
34*cdf0e10cSrcweir #include "oox/dump/pptxdumper.hxx"
35*cdf0e10cSrcweir #include "oox/helper/zipstorage.hxx"
36*cdf0e10cSrcweir #include "oox/ole/olestorage.hxx"
37*cdf0e10cSrcweir #include "oox/xls/biffhelper.hxx"
38*cdf0e10cSrcweir #include "oox/xls/formulabase.hxx"
39*cdf0e10cSrcweir #include "oox/xls/richstring.hxx"
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #if OOX_INCLUDE_DUMPER
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir namespace oox {
44*cdf0e10cSrcweir namespace dump {
45*cdf0e10cSrcweir namespace xlsb {
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir // ============================================================================
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir using namespace ::com::sun::star::io;
50*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
51*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
52*cdf0e10cSrcweir using namespace ::com::sun::star::util;
53*cdf0e10cSrcweir using namespace ::oox::xls;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir using ::comphelper::MediaDescriptor;
56*cdf0e10cSrcweir using ::oox::core::FilterBase;
57*cdf0e10cSrcweir using ::rtl::OUString;
58*cdf0e10cSrcweir using ::rtl::OUStringBuffer;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir // ============================================================================
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir namespace {
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir const sal_uInt8 BIFF12_STRINGFLAG_FONTS         = 0x01;
65*cdf0e10cSrcweir const sal_uInt8 BIFF12_STRINGFLAG_PHONETICS     = 0x02;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir const sal_uInt16 BIFF12_OLEOBJECT_LINKED        = 0x0001;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir } // namespace
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir // ============================================================================
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir RecordObjectBase::RecordObjectBase()
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir RecordObjectBase::~RecordObjectBase()
78*cdf0e10cSrcweir {
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir void RecordObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
82*cdf0e10cSrcweir {
83*cdf0e10cSrcweir     mxBiffStrm.reset( new SequenceInputStream( getRecordDataSequence() ) );
84*cdf0e10cSrcweir     SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
85*cdf0e10cSrcweir     if( SequenceRecordObjectBase::implIsValid() )
86*cdf0e10cSrcweir         mxErrCodes = cfg().getNameList( "ERRORCODES" );
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir void RecordObjectBase::construct( const RecordObjectBase& rParent )
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir     *this = rParent;
92*cdf0e10cSrcweir }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir bool RecordObjectBase::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir     sal_Int32 nRecId = 0, nRecSize = 0;
97*cdf0e10cSrcweir     bool bValid = readCompressedInt( rBaseStrm, nRecId ) && (nRecId >= 0) && readCompressedInt( rBaseStrm, nRecSize ) && (nRecSize >= 0);
98*cdf0e10cSrcweir     ornRecId = nRecId;
99*cdf0e10cSrcweir     ornRecSize = nRecSize;
100*cdf0e10cSrcweir     return bValid;
101*cdf0e10cSrcweir }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir OUString RecordObjectBase::getErrorName( sal_uInt8 nErrCode ) const
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir     return cfg().getName( mxErrCodes, nErrCode );
106*cdf0e10cSrcweir }
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir // ------------------------------------------------------------------------
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir void RecordObjectBase::readAddress( Address& orAddress )
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir     *mxStrm >> orAddress.mnRow >> orAddress.mnCol;
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir void RecordObjectBase::readRange( Range& orRange )
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir     *mxStrm >> orRange.maFirst.mnRow >> orRange.maLast.mnRow >> orRange.maFirst.mnCol >> orRange.maLast.mnCol;
118*cdf0e10cSrcweir }
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir void RecordObjectBase::readRangeList( RangeList& orRanges )
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     sal_Int32 nCount;
123*cdf0e10cSrcweir     *mxStrm >> nCount;
124*cdf0e10cSrcweir     if( nCount >= 0 )
125*cdf0e10cSrcweir     {
126*cdf0e10cSrcweir         orRanges.resize( getLimitedValue< size_t, sal_Int32 >( nCount, 0, SAL_MAX_UINT16 ) );
127*cdf0e10cSrcweir         for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
128*cdf0e10cSrcweir             readRange( *aIt );
129*cdf0e10cSrcweir     }
130*cdf0e10cSrcweir     else
131*cdf0e10cSrcweir         orRanges.clear();
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir // ----------------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir void RecordObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir     writeDecItem( rName, nBool, "BOOLEAN" );
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir void RecordObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir     writeHexItem( rName, nErrCode, mxErrCodes );
144*cdf0e10cSrcweir }
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir void RecordObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir     if( !rPortions.empty() )
149*cdf0e10cSrcweir     {
150*cdf0e10cSrcweir         writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
151*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
152*cdf0e10cSrcweir         TableGuard aTabGuard( mxOut, 14 );
153*cdf0e10cSrcweir         for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
154*cdf0e10cSrcweir         {
155*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
156*cdf0e10cSrcweir             writeDecItem( "char-pos", aIt->mnPos );
157*cdf0e10cSrcweir             writeDecItem( "font-id", aIt->mnFontId, "FONTNAMES" );
158*cdf0e10cSrcweir         }
159*cdf0e10cSrcweir     }
160*cdf0e10cSrcweir }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList& rPortions )
163*cdf0e10cSrcweir {
164*cdf0e10cSrcweir     if( !rPortions.empty() )
165*cdf0e10cSrcweir     {
166*cdf0e10cSrcweir         writeDecItem( "portion-count", static_cast< sal_uInt32 >( rPortions.size() ) );
167*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
168*cdf0e10cSrcweir         TableGuard aTabGuard( mxOut, 14, 21 );
169*cdf0e10cSrcweir         for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
170*cdf0e10cSrcweir         {
171*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
172*cdf0e10cSrcweir             writeDecItem( "char-pos", aIt->mnPos );
173*cdf0e10cSrcweir             writeDecItem( "base-text-start", aIt->mnBasePos );
174*cdf0e10cSrcweir             writeDecItem( "base-text-length", aIt->mnBaseLen );
175*cdf0e10cSrcweir         }
176*cdf0e10cSrcweir     }
177*cdf0e10cSrcweir }
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir // ----------------------------------------------------------------------------
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir sal_uInt8 RecordObjectBase::dumpBoolean( const String& rName )
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     sal_uInt8 nBool;
184*cdf0e10cSrcweir     *mxStrm >> nBool;
185*cdf0e10cSrcweir     writeBooleanItem( rName( "boolean" ), nBool );
186*cdf0e10cSrcweir     return nBool;
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir sal_uInt8 RecordObjectBase::dumpErrorCode( const String& rName )
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir     sal_uInt8 nErrCode;
192*cdf0e10cSrcweir     *mxStrm >> nErrCode;
193*cdf0e10cSrcweir     writeErrorCodeItem( rName( "error-code" ), nErrCode );
194*cdf0e10cSrcweir     return nErrCode;
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32BitLen )
198*cdf0e10cSrcweir {
199*cdf0e10cSrcweir     sal_uInt8 nFlags = bRich ? dumpHex< sal_uInt8 >( "flags", "STRING-FLAGS" ) : 0;
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     OUString aString = BiffHelper::readString( *mxBiffStrm, b32BitLen );
202*cdf0e10cSrcweir     writeStringItem( rName( "text" ), aString );
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     // --- formatting ---
205*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_STRINGFLAG_FONTS ) )
206*cdf0e10cSrcweir     {
207*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
208*cdf0e10cSrcweir         FontPortionModelList aPortions;
209*cdf0e10cSrcweir         aPortions.importPortions( *mxBiffStrm );
210*cdf0e10cSrcweir         writeFontPortions( aPortions );
211*cdf0e10cSrcweir     }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     // --- phonetic text ---
214*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_STRINGFLAG_PHONETICS ) )
215*cdf0e10cSrcweir     {
216*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
217*cdf0e10cSrcweir         dumpString( "phonetic-text" );
218*cdf0e10cSrcweir         PhoneticPortionModelList aPortions;
219*cdf0e10cSrcweir         aPortions.importPortions( *mxBiffStrm );
220*cdf0e10cSrcweir         writePhoneticPortions( aPortions );
221*cdf0e10cSrcweir         dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
222*cdf0e10cSrcweir         dumpHex< sal_uInt16 >( "flags", "PHONETIC-FLAGS" );
223*cdf0e10cSrcweir     }
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     return aString;
226*cdf0e10cSrcweir }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir void RecordObjectBase::dumpColor( const String& rName )
229*cdf0e10cSrcweir {
230*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
231*cdf0e10cSrcweir     writeEmptyItem( rName( "color" ) );
232*cdf0e10cSrcweir     switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "COLOR-FLAGS" ), 1, 7 ) )
233*cdf0e10cSrcweir     {
234*cdf0e10cSrcweir         case 0:     dumpUnused( 1 );                                    break;
235*cdf0e10cSrcweir         case 1:     dumpDec< sal_uInt8 >( "index", "PALETTE-COLORS" );  break;
236*cdf0e10cSrcweir         case 2:     dumpUnused( 1 );                                    break;
237*cdf0e10cSrcweir         case 3:     dumpDec< sal_uInt8 >( "theme-id" );                 break;
238*cdf0e10cSrcweir         default:    dumpUnknown( 1 );
239*cdf0e10cSrcweir     }
240*cdf0e10cSrcweir     dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
241*cdf0e10cSrcweir     dumpColorABGR();
242*cdf0e10cSrcweir }
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir DateTime RecordObjectBase::dumpPivotDateTime( const String& rName )
245*cdf0e10cSrcweir {
246*cdf0e10cSrcweir     DateTime aDateTime;
247*cdf0e10cSrcweir     aDateTime.Year = mxStrm->readuInt16();
248*cdf0e10cSrcweir     aDateTime.Month = mxStrm->readuInt16();
249*cdf0e10cSrcweir     aDateTime.Day = mxStrm->readuInt8();
250*cdf0e10cSrcweir     aDateTime.Hours = mxStrm->readuInt8();
251*cdf0e10cSrcweir     aDateTime.Minutes = mxStrm->readuInt8();
252*cdf0e10cSrcweir     aDateTime.Seconds = mxStrm->readuInt8();
253*cdf0e10cSrcweir     writeDateTimeItem( rName, aDateTime );
254*cdf0e10cSrcweir     return aDateTime;
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
258*cdf0e10cSrcweir {
259*cdf0e10cSrcweir     sal_Int32 nCol;
260*cdf0e10cSrcweir     *mxStrm >> nCol;
261*cdf0e10cSrcweir     writeColIndexItem( rName( "col-idx" ), nCol );
262*cdf0e10cSrcweir     return nCol;
263*cdf0e10cSrcweir }
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir sal_Int32 RecordObjectBase::dumpRowIndex( const String& rName )
266*cdf0e10cSrcweir {
267*cdf0e10cSrcweir     sal_Int32 nRow;
268*cdf0e10cSrcweir     *mxStrm >> nRow;
269*cdf0e10cSrcweir     writeRowIndexItem( rName( "row-idx" ), nRow );
270*cdf0e10cSrcweir     return nRow;
271*cdf0e10cSrcweir }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir sal_Int32 RecordObjectBase::dumpColRange( const String& rName )
274*cdf0e10cSrcweir {
275*cdf0e10cSrcweir     sal_Int32 nCol1, nCol2;
276*cdf0e10cSrcweir     *mxStrm >> nCol1 >> nCol2;
277*cdf0e10cSrcweir     writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
278*cdf0e10cSrcweir     return nCol2 - nCol1 + 1;
279*cdf0e10cSrcweir }
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir sal_Int32 RecordObjectBase::dumpRowRange( const String& rName )
282*cdf0e10cSrcweir {
283*cdf0e10cSrcweir     sal_Int32 nRow1, nRow2;
284*cdf0e10cSrcweir     *mxStrm >> nRow1 >> nRow2;
285*cdf0e10cSrcweir     writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
286*cdf0e10cSrcweir     return nRow2 - nRow1 + 1;
287*cdf0e10cSrcweir }
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir Address RecordObjectBase::dumpAddress( const String& rName )
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir     Address aPos;
292*cdf0e10cSrcweir     readAddress( aPos );
293*cdf0e10cSrcweir     writeAddressItem( rName( "addr" ), aPos );
294*cdf0e10cSrcweir     return aPos;
295*cdf0e10cSrcweir }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir Range RecordObjectBase::dumpRange( const String& rName )
298*cdf0e10cSrcweir {
299*cdf0e10cSrcweir     Range aRange;
300*cdf0e10cSrcweir     readRange( aRange );
301*cdf0e10cSrcweir     writeRangeItem( rName( "range" ), aRange );
302*cdf0e10cSrcweir     return aRange;
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir void RecordObjectBase::dumpRangeList( const String& rName )
306*cdf0e10cSrcweir {
307*cdf0e10cSrcweir     RangeList aRanges;
308*cdf0e10cSrcweir     readRangeList( aRanges );
309*cdf0e10cSrcweir     writeRangeListItem( rName( "range-list" ), aRanges );
310*cdf0e10cSrcweir }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir // private --------------------------------------------------------------------
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir bool RecordObjectBase::readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue )
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir     ornValue = 0;
317*cdf0e10cSrcweir     sal_uInt8 nByte;
318*cdf0e10cSrcweir     rStrm >> nByte;
319*cdf0e10cSrcweir     ornValue = nByte & 0x7F;
320*cdf0e10cSrcweir     if( (nByte & 0x80) != 0 )
321*cdf0e10cSrcweir     {
322*cdf0e10cSrcweir         rStrm >> nByte;
323*cdf0e10cSrcweir         ornValue |= sal_Int32( nByte & 0x7F ) << 7;
324*cdf0e10cSrcweir         if( (nByte & 0x80) != 0 )
325*cdf0e10cSrcweir         {
326*cdf0e10cSrcweir             rStrm >> nByte;
327*cdf0e10cSrcweir             ornValue |= sal_Int32( nByte & 0x7F ) << 14;
328*cdf0e10cSrcweir             if( (nByte & 0x80) != 0 )
329*cdf0e10cSrcweir             {
330*cdf0e10cSrcweir                 rStrm >> nByte;
331*cdf0e10cSrcweir                 ornValue |= sal_Int32( nByte & 0x7F ) << 21;
332*cdf0e10cSrcweir             }
333*cdf0e10cSrcweir         }
334*cdf0e10cSrcweir     }
335*cdf0e10cSrcweir     return !rStrm.isEof();
336*cdf0e10cSrcweir }
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir // ============================================================================
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir FormulaObject::FormulaObject( const RecordObjectBase& rParent ) :
341*cdf0e10cSrcweir     mnSize( 0 )
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir     RecordObjectBase::construct( rParent );
344*cdf0e10cSrcweir     constructFmlaObj();
345*cdf0e10cSrcweir }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir FormulaObject::~FormulaObject()
348*cdf0e10cSrcweir {
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir void FormulaObject::dumpCellFormula( const String& rName )
352*cdf0e10cSrcweir {
353*cdf0e10cSrcweir     dumpFormula( rName, false );
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir void FormulaObject::dumpNameFormula( const String& rName )
357*cdf0e10cSrcweir {
358*cdf0e10cSrcweir     dumpFormula( rName, true );
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir void FormulaObject::implDump()
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir     {
364*cdf0e10cSrcweir         MultiItemsGuard aMultiGuard( mxOut );
365*cdf0e10cSrcweir         writeEmptyItem( maName );
366*cdf0e10cSrcweir         writeDecItem( "formula-size", mnSize );
367*cdf0e10cSrcweir     }
368*cdf0e10cSrcweir     if( mnSize < 0 ) return;
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir     sal_Int64 nStartPos = mxStrm->tell();
371*cdf0e10cSrcweir     sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->size() );
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     bool bValid = mxTokens.get();
374*cdf0e10cSrcweir     mxStack.reset( new FormulaStack );
375*cdf0e10cSrcweir     maAddData.clear();
376*cdf0e10cSrcweir     IndentGuard aIndGuard( mxOut );
377*cdf0e10cSrcweir     {
378*cdf0e10cSrcweir         TableGuard aTabGuard( mxOut, 8, 18 );
379*cdf0e10cSrcweir         while( bValid && (mxStrm->tell() < nEndPos) )
380*cdf0e10cSrcweir         {
381*cdf0e10cSrcweir             MultiItemsGuard aMultiGuard( mxOut );
382*cdf0e10cSrcweir             writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
383*cdf0e10cSrcweir             sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
384*cdf0e10cSrcweir             bValid = mxTokens->hasName( nTokenId );
385*cdf0e10cSrcweir             if( bValid )
386*cdf0e10cSrcweir             {
387*cdf0e10cSrcweir                 sal_uInt8 nTokClass = nTokenId & BIFF_TOKCLASS_MASK;
388*cdf0e10cSrcweir                 sal_uInt8 nBaseId = nTokenId & BIFF_TOKID_MASK;
389*cdf0e10cSrcweir                 if( nTokClass == BIFF_TOKCLASS_NONE )
390*cdf0e10cSrcweir                 {
391*cdf0e10cSrcweir                     switch( nBaseId )
392*cdf0e10cSrcweir                     {
393*cdf0e10cSrcweir                         case BIFF_TOKID_EXP:        dumpExpToken( "EXP" );          break;
394*cdf0e10cSrcweir                         case BIFF_TOKID_ADD:        dumpBinaryOpToken( "+" );       break;
395*cdf0e10cSrcweir                         case BIFF_TOKID_SUB:        dumpBinaryOpToken( "-" );       break;
396*cdf0e10cSrcweir                         case BIFF_TOKID_MUL:        dumpBinaryOpToken( "*" );       break;
397*cdf0e10cSrcweir                         case BIFF_TOKID_DIV:        dumpBinaryOpToken( "/" );       break;
398*cdf0e10cSrcweir                         case BIFF_TOKID_POWER:      dumpBinaryOpToken( "^" );       break;
399*cdf0e10cSrcweir                         case BIFF_TOKID_CONCAT:     dumpBinaryOpToken( "&" );       break;
400*cdf0e10cSrcweir                         case BIFF_TOKID_LT:         dumpBinaryOpToken( "<" );       break;
401*cdf0e10cSrcweir                         case BIFF_TOKID_LE:         dumpBinaryOpToken( "<=" );      break;
402*cdf0e10cSrcweir                         case BIFF_TOKID_EQ:         dumpBinaryOpToken( "=" );       break;
403*cdf0e10cSrcweir                         case BIFF_TOKID_GE:         dumpBinaryOpToken( ">=" );      break;
404*cdf0e10cSrcweir                         case BIFF_TOKID_GT:         dumpBinaryOpToken( "<" );       break;
405*cdf0e10cSrcweir                         case BIFF_TOKID_NE:         dumpBinaryOpToken( "<>" );      break;
406*cdf0e10cSrcweir                         case BIFF_TOKID_ISECT:      dumpBinaryOpToken( " " );       break;
407*cdf0e10cSrcweir                         case BIFF_TOKID_LIST:       dumpBinaryOpToken( "," );       break;
408*cdf0e10cSrcweir                         case BIFF_TOKID_RANGE:      dumpBinaryOpToken( ":" );       break;
409*cdf0e10cSrcweir                         case BIFF_TOKID_UPLUS:      dumpUnaryOpToken( "+", "" );    break;
410*cdf0e10cSrcweir                         case BIFF_TOKID_UMINUS:     dumpUnaryOpToken( "-", "" );    break;
411*cdf0e10cSrcweir                         case BIFF_TOKID_PERCENT:    dumpUnaryOpToken( "", "%" );    break;
412*cdf0e10cSrcweir                         case BIFF_TOKID_PAREN:      dumpUnaryOpToken( "(", ")" );   break;
413*cdf0e10cSrcweir                         case BIFF_TOKID_MISSARG:    dumpMissArgToken();             break;
414*cdf0e10cSrcweir                         case BIFF_TOKID_STR:        dumpStringToken();              break;
415*cdf0e10cSrcweir                         case BIFF_TOKID_NLR:        bValid = dumpTableToken();      break;
416*cdf0e10cSrcweir                         case BIFF_TOKID_ATTR:       bValid = dumpAttrToken();       break;
417*cdf0e10cSrcweir                         case BIFF_TOKID_ERR:        dumpErrorToken();               break;
418*cdf0e10cSrcweir                         case BIFF_TOKID_BOOL:       dumpBoolToken();                break;
419*cdf0e10cSrcweir                         case BIFF_TOKID_INT:        dumpIntToken();                 break;
420*cdf0e10cSrcweir                         case BIFF_TOKID_NUM:        dumpDoubleToken();              break;
421*cdf0e10cSrcweir                         default:                    bValid = false;
422*cdf0e10cSrcweir                     }
423*cdf0e10cSrcweir                 }
424*cdf0e10cSrcweir                 else
425*cdf0e10cSrcweir                 {
426*cdf0e10cSrcweir                     OUString aTokClass = cfg().getName( mxClasses, nTokClass );
427*cdf0e10cSrcweir                     switch( nBaseId )
428*cdf0e10cSrcweir                     {
429*cdf0e10cSrcweir                         case BIFF_TOKID_ARRAY:      dumpArrayToken( aTokClass );                break;
430*cdf0e10cSrcweir                         case BIFF_TOKID_FUNC:       dumpFuncToken( aTokClass );                 break;
431*cdf0e10cSrcweir                         case BIFF_TOKID_FUNCVAR:    dumpFuncVarToken( aTokClass );              break;
432*cdf0e10cSrcweir                         case BIFF_TOKID_NAME:       dumpNameToken( aTokClass );                 break;
433*cdf0e10cSrcweir                         case BIFF_TOKID_REF:        dumpRefToken( aTokClass, false );           break;
434*cdf0e10cSrcweir                         case BIFF_TOKID_AREA:       dumpAreaToken( aTokClass, false );          break;
435*cdf0e10cSrcweir                         case BIFF_TOKID_MEMAREA:    dumpMemAreaToken( aTokClass, true );        break;
436*cdf0e10cSrcweir                         case BIFF_TOKID_MEMERR:     dumpMemAreaToken( aTokClass, false );       break;
437*cdf0e10cSrcweir                         case BIFF_TOKID_MEMNOMEM:   dumpMemAreaToken( aTokClass, false );       break;
438*cdf0e10cSrcweir                         case BIFF_TOKID_MEMFUNC:    dumpMemFuncToken( aTokClass );              break;
439*cdf0e10cSrcweir                         case BIFF_TOKID_REFERR:     dumpRefErrToken( aTokClass, false );        break;
440*cdf0e10cSrcweir                         case BIFF_TOKID_AREAERR:    dumpRefErrToken( aTokClass, true );         break;
441*cdf0e10cSrcweir                         case BIFF_TOKID_REFN:       dumpRefToken( aTokClass, true );            break;
442*cdf0e10cSrcweir                         case BIFF_TOKID_AREAN:      dumpAreaToken( aTokClass, true );           break;
443*cdf0e10cSrcweir                         case BIFF_TOKID_MEMAREAN:   dumpMemFuncToken( aTokClass );              break;
444*cdf0e10cSrcweir                         case BIFF_TOKID_MEMNOMEMN:  dumpMemFuncToken( aTokClass );              break;
445*cdf0e10cSrcweir                         case BIFF_TOKID_NAMEX:      dumpNameXToken( aTokClass );                break;
446*cdf0e10cSrcweir                         case BIFF_TOKID_REF3D:      dumpRef3dToken( aTokClass, mbNameMode );    break;
447*cdf0e10cSrcweir                         case BIFF_TOKID_AREA3D:     dumpArea3dToken( aTokClass, mbNameMode );   break;
448*cdf0e10cSrcweir                         case BIFF_TOKID_REFERR3D:   dumpRefErr3dToken( aTokClass, false );      break;
449*cdf0e10cSrcweir                         case BIFF_TOKID_AREAERR3D:  dumpRefErr3dToken( aTokClass, true );       break;
450*cdf0e10cSrcweir                         default:                    bValid = false;
451*cdf0e10cSrcweir                     }
452*cdf0e10cSrcweir                 }
453*cdf0e10cSrcweir             }
454*cdf0e10cSrcweir         }
455*cdf0e10cSrcweir     }
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir     if( nEndPos == mxStrm->tell() )
458*cdf0e10cSrcweir     {
459*cdf0e10cSrcweir         dumpAddTokenData();
460*cdf0e10cSrcweir         if( mnSize > 0 )
461*cdf0e10cSrcweir         {
462*cdf0e10cSrcweir             writeInfoItem( "formula", mxStack->getFormulaString() );
463*cdf0e10cSrcweir             writeInfoItem( "classes", mxStack->getClassesString() );
464*cdf0e10cSrcweir         }
465*cdf0e10cSrcweir     }
466*cdf0e10cSrcweir     else
467*cdf0e10cSrcweir     {
468*cdf0e10cSrcweir         dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - mxStrm->tell() ), false );
469*cdf0e10cSrcweir         sal_Int32 nAddDataSize = dumpDec< sal_Int32 >( "add-data-size" );
470*cdf0e10cSrcweir         dumpBinary( "add-data", nAddDataSize, false );
471*cdf0e10cSrcweir     }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir     mnSize = 0;
474*cdf0e10cSrcweir }
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
477*cdf0e10cSrcweir {
478*cdf0e10cSrcweir     maName = rName( "formula" );
479*cdf0e10cSrcweir     *mxStrm >> mnSize;
480*cdf0e10cSrcweir     mbNameMode = bNameMode;
481*cdf0e10cSrcweir     dump();
482*cdf0e10cSrcweir }
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir // private --------------------------------------------------------------------
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir void FormulaObject::constructFmlaObj()
487*cdf0e10cSrcweir {
488*cdf0e10cSrcweir     if( RecordObjectBase::implIsValid() )
489*cdf0e10cSrcweir     {
490*cdf0e10cSrcweir         mxFuncProv.reset( new FunctionProvider( FILTER_OOXML, BIFF_UNKNOWN, true ) );
491*cdf0e10cSrcweir 
492*cdf0e10cSrcweir         Config& rCfg = cfg();
493*cdf0e10cSrcweir         mxClasses   = rCfg.getNameList( "TOKENCLASSES" );
494*cdf0e10cSrcweir         mxRelFlags  = rCfg.getNameList( "REFRELFLAGS" );
495*cdf0e10cSrcweir         mxAttrTypes = rCfg.getNameList( "ATTRTYPES" );
496*cdf0e10cSrcweir         mxSpTypes   = rCfg.getNameList( "ATTRSPACETYPES" );
497*cdf0e10cSrcweir 
498*cdf0e10cSrcweir         // create classified token names
499*cdf0e10cSrcweir         mxTokens = rCfg.createNameList< ConstList >( "TOKENS" );
500*cdf0e10cSrcweir         mxTokens->includeList( rCfg.getNameList( "BASETOKENS" ) );
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir         NameListRef xClassTokens = rCfg.getNameList( "CLASSTOKENS" );
503*cdf0e10cSrcweir         if( mxClasses.get() && xClassTokens.get() )
504*cdf0e10cSrcweir             for( NameListBase::const_iterator aCIt = mxClasses->begin(), aCEnd = mxClasses->end(); aCIt != aCEnd; ++aCIt )
505*cdf0e10cSrcweir                 for( NameListBase::const_iterator aTIt = xClassTokens->begin(), aTEnd = xClassTokens->end(); aTIt != aTEnd; ++aTIt )
506*cdf0e10cSrcweir                     mxTokens->setName( aCIt->first | aTIt->first, aTIt->second + aCIt->second );
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir         mnColCount = 16384;
509*cdf0e10cSrcweir         mnRowCount = 1024 * 1024;
510*cdf0e10cSrcweir     }
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir // ----------------------------------------------------------------------------
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir namespace {
516*cdf0e10cSrcweir 
517*cdf0e10cSrcweir OUString lclCreateName( const OUString& rRef, sal_Int32 nNameId )
518*cdf0e10cSrcweir {
519*cdf0e10cSrcweir     OUStringBuffer aName( rRef );
520*cdf0e10cSrcweir     StringHelper::appendIndexedText( aName, CREATE_OUSTRING( "NAME" ), nNameId );
521*cdf0e10cSrcweir     return aName.makeStringAndClear();
522*cdf0e10cSrcweir }
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir } // namespace
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir // ----------------------------------------------------------------------------
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir TokenAddress FormulaObject::createTokenAddress( sal_Int32 nCol, sal_Int32 nRow, bool bRelC, bool bRelR, bool bNameMode ) const
529*cdf0e10cSrcweir {
530*cdf0e10cSrcweir     TokenAddress aPos;
531*cdf0e10cSrcweir     aPos.mnCol = nCol;
532*cdf0e10cSrcweir     if( bRelC && bNameMode && (nCol >= mnColCount / 2) ) aPos.mnCol -= mnColCount;
533*cdf0e10cSrcweir     aPos.mbRelCol = bRelC;
534*cdf0e10cSrcweir     aPos.mnRow = nRow;
535*cdf0e10cSrcweir     if( bRelR && bNameMode && (nRow >= mnRowCount / 2) ) aPos.mnRow -= mnRowCount;
536*cdf0e10cSrcweir     aPos.mbRelRow = bRelR;
537*cdf0e10cSrcweir     return aPos;
538*cdf0e10cSrcweir }
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir OUString FormulaObject::createRef( const OUString& rData ) const
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir     return maRefPrefix + rData;
543*cdf0e10cSrcweir }
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir OUString FormulaObject::createName( sal_Int32 nNameId ) const
546*cdf0e10cSrcweir {
547*cdf0e10cSrcweir     return lclCreateName( maRefPrefix, nNameId );
548*cdf0e10cSrcweir }
549*cdf0e10cSrcweir 
550*cdf0e10cSrcweir OUString FormulaObject::createPlaceHolder( size_t nIdx ) const
551*cdf0e10cSrcweir {
552*cdf0e10cSrcweir     OUStringBuffer aStr;
553*cdf0e10cSrcweir     StringHelper::appendDec( aStr, static_cast< sal_uInt32 >( nIdx ) );
554*cdf0e10cSrcweir     StringHelper::enclose( aStr, OOX_DUMP_PLACEHOLDER );
555*cdf0e10cSrcweir     return aStr.makeStringAndClear();
556*cdf0e10cSrcweir }
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir OUString FormulaObject::createPlaceHolder() const
559*cdf0e10cSrcweir {
560*cdf0e10cSrcweir     return createPlaceHolder( maAddData.size() );
561*cdf0e10cSrcweir }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
564*cdf0e10cSrcweir {
565*cdf0e10cSrcweir     ItemGuard aItem( mxOut, "func-id" );
566*cdf0e10cSrcweir     writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
567*cdf0e10cSrcweir     OUStringBuffer aBuffer;
568*cdf0e10cSrcweir     const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiff12FuncId( nFuncId );
569*cdf0e10cSrcweir     if( pFuncInfo )
570*cdf0e10cSrcweir         aBuffer.append( pFuncInfo->maOoxFuncName );
571*cdf0e10cSrcweir     else
572*cdf0e10cSrcweir     {
573*cdf0e10cSrcweir         bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
574*cdf0e10cSrcweir         aBuffer.appendAscii( bCmd ? "CMD" : "FUNC" );
575*cdf0e10cSrcweir         StringHelper::appendIndex( aBuffer, nFuncId & BIFF_TOK_FUNCVAR_FUNCIDMASK );
576*cdf0e10cSrcweir     }
577*cdf0e10cSrcweir     OUString aFuncName = aBuffer.makeStringAndClear();
578*cdf0e10cSrcweir     aItem.cont();
579*cdf0e10cSrcweir     mxOut->writeChar( OOX_DUMP_STRQUOTE );
580*cdf0e10cSrcweir     mxOut->writeString( aFuncName );
581*cdf0e10cSrcweir     mxOut->writeChar( OOX_DUMP_STRQUOTE );
582*cdf0e10cSrcweir     if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
583*cdf0e10cSrcweir     return aFuncName;
584*cdf0e10cSrcweir }
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir sal_Int32 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
587*cdf0e10cSrcweir {
588*cdf0e10cSrcweir     sal_uInt16 nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
589*cdf0e10cSrcweir     rbRelC = getFlag( nCol, BIFF12_TOK_REF_COLREL );
590*cdf0e10cSrcweir     rbRelR = getFlag( nCol, BIFF12_TOK_REF_ROWREL );
591*cdf0e10cSrcweir     nCol &= BIFF12_TOK_REF_COLMASK;
592*cdf0e10cSrcweir     return nCol;
593*cdf0e10cSrcweir }
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir sal_Int32 FormulaObject::dumpTokenRow( const String& rName )
596*cdf0e10cSrcweir {
597*cdf0e10cSrcweir     return dumpDec< sal_Int32 >( rName );
598*cdf0e10cSrcweir }
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir TokenAddress FormulaObject::dumpTokenAddress( bool bNameMode )
601*cdf0e10cSrcweir {
602*cdf0e10cSrcweir     bool bRelC = false;
603*cdf0e10cSrcweir     bool bRelR = false;
604*cdf0e10cSrcweir     sal_Int32 nRow = dumpTokenRow( "row" );
605*cdf0e10cSrcweir     sal_Int32 nCol = dumpTokenCol( "col", bRelC, bRelR );
606*cdf0e10cSrcweir     return createTokenAddress( nCol, nRow, bRelC, bRelR, bNameMode );
607*cdf0e10cSrcweir }
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir TokenRange FormulaObject::dumpTokenRange( bool bNameMode )
610*cdf0e10cSrcweir {
611*cdf0e10cSrcweir     bool bRelC1 = false;
612*cdf0e10cSrcweir     bool bRelR1 = false;
613*cdf0e10cSrcweir     bool bRelC2 = false;
614*cdf0e10cSrcweir     bool bRelR2 = false;
615*cdf0e10cSrcweir     sal_Int32 nRow1 = dumpTokenRow( "row1" );
616*cdf0e10cSrcweir     sal_Int32 nRow2 = dumpTokenRow( "row2" );
617*cdf0e10cSrcweir     sal_Int32 nCol1 = dumpTokenCol( "col1", bRelC1, bRelR1 );
618*cdf0e10cSrcweir     sal_Int32 nCol2 = dumpTokenCol( "col2", bRelC2, bRelR2 );
619*cdf0e10cSrcweir     TokenRange aRange;
620*cdf0e10cSrcweir     aRange.maFirst = createTokenAddress( nCol1, nRow1, bRelC1, bRelR1, bNameMode );
621*cdf0e10cSrcweir     aRange.maLast  = createTokenAddress( nCol2, nRow2, bRelC2, bRelR2, bNameMode );
622*cdf0e10cSrcweir     return aRange;
623*cdf0e10cSrcweir }
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir sal_Int16 FormulaObject::readTokenRefId()
626*cdf0e10cSrcweir {
627*cdf0e10cSrcweir     return dumpDec< sal_Int16 >( "ref-id" );
628*cdf0e10cSrcweir }
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir OUString FormulaObject::dumpTokenRefId()
631*cdf0e10cSrcweir {
632*cdf0e10cSrcweir     OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
633*cdf0e10cSrcweir     StringHelper::appendIndex( aRef, readTokenRefId() );
634*cdf0e10cSrcweir     aRef.append( OOX_DUMP_TABSEP );
635*cdf0e10cSrcweir     return aRef.makeStringAndClear();
636*cdf0e10cSrcweir }
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir void FormulaObject::dumpIntToken()
639*cdf0e10cSrcweir {
640*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "value" );
641*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
642*cdf0e10cSrcweir }
643*cdf0e10cSrcweir 
644*cdf0e10cSrcweir void FormulaObject::dumpDoubleToken()
645*cdf0e10cSrcweir {
646*cdf0e10cSrcweir     dumpDec< double >( "value" );
647*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir void FormulaObject::dumpStringToken()
651*cdf0e10cSrcweir {
652*cdf0e10cSrcweir     OUStringBuffer aBuffer( dumpString( "value", false, false ) );
653*cdf0e10cSrcweir     StringHelper::enclose( aBuffer, OOX_DUMP_FMLASTRQUOTE );
654*cdf0e10cSrcweir     mxStack->pushOperand( aBuffer.makeStringAndClear() );
655*cdf0e10cSrcweir }
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir void FormulaObject::dumpBoolToken()
658*cdf0e10cSrcweir {
659*cdf0e10cSrcweir     dumpBoolean( "value" );
660*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
661*cdf0e10cSrcweir }
662*cdf0e10cSrcweir 
663*cdf0e10cSrcweir void FormulaObject::dumpErrorToken()
664*cdf0e10cSrcweir {
665*cdf0e10cSrcweir     dumpErrorCode( "value" );
666*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue() );
667*cdf0e10cSrcweir }
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir void FormulaObject::dumpMissArgToken()
670*cdf0e10cSrcweir {
671*cdf0e10cSrcweir     mxStack->pushOperand( OUString( OOX_DUMP_EMPTYVALUE ) );
672*cdf0e10cSrcweir }
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir void FormulaObject::dumpArrayToken( const OUString& rTokClass )
675*cdf0e10cSrcweir {
676*cdf0e10cSrcweir     dumpUnused( 14 );
677*cdf0e10cSrcweir     mxStack->pushOperand( createPlaceHolder(), rTokClass );
678*cdf0e10cSrcweir     maAddData.push_back( ADDDATA_ARRAY );
679*cdf0e10cSrcweir }
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir void FormulaObject::dumpNameToken( const OUString& rTokClass )
682*cdf0e10cSrcweir {
683*cdf0e10cSrcweir     sal_Int32 nNameId = dumpDec< sal_Int32 >( "name-id" );
684*cdf0e10cSrcweir     mxStack->pushOperand( createName( nNameId ), rTokClass );
685*cdf0e10cSrcweir }
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir void FormulaObject::dumpNameXToken( const OUString& rTokClass )
688*cdf0e10cSrcweir {
689*cdf0e10cSrcweir     OUString aRef = dumpTokenRefId();
690*cdf0e10cSrcweir     sal_Int32 nNameId = dumpDec< sal_Int32 >( "name-id" );
691*cdf0e10cSrcweir     mxStack->pushOperand( lclCreateName( aRef, nNameId ), rTokClass );
692*cdf0e10cSrcweir }
693*cdf0e10cSrcweir 
694*cdf0e10cSrcweir void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
695*cdf0e10cSrcweir {
696*cdf0e10cSrcweir     TokenAddress aPos = dumpTokenAddress( bNameMode );
697*cdf0e10cSrcweir     writeTokenAddressItem( "addr", aPos, bNameMode );
698*cdf0e10cSrcweir     mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
699*cdf0e10cSrcweir }
700*cdf0e10cSrcweir 
701*cdf0e10cSrcweir void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
702*cdf0e10cSrcweir {
703*cdf0e10cSrcweir     TokenRange aRange = dumpTokenRange( bNameMode );
704*cdf0e10cSrcweir     writeTokenRangeItem( "range", aRange, bNameMode );
705*cdf0e10cSrcweir     mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
706*cdf0e10cSrcweir }
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
709*cdf0e10cSrcweir {
710*cdf0e10cSrcweir     dumpUnused( 4 * (bArea ? 2 : 1) );
711*cdf0e10cSrcweir     mxStack->pushOperand( createRef( getErrorName( BIFF_ERR_REF ) ), rTokClass );
712*cdf0e10cSrcweir }
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
715*cdf0e10cSrcweir {
716*cdf0e10cSrcweir     OUString aRef = dumpTokenRefId();
717*cdf0e10cSrcweir     TokenAddress aPos = dumpTokenAddress( bNameMode );
718*cdf0e10cSrcweir     writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
719*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
720*cdf0e10cSrcweir }
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
723*cdf0e10cSrcweir {
724*cdf0e10cSrcweir     OUString aRef = dumpTokenRefId();
725*cdf0e10cSrcweir     TokenRange aRange = dumpTokenRange( bNameMode );
726*cdf0e10cSrcweir     writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
727*cdf0e10cSrcweir     mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
728*cdf0e10cSrcweir }
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
731*cdf0e10cSrcweir {
732*cdf0e10cSrcweir     OUString aRef = dumpTokenRefId();
733*cdf0e10cSrcweir     dumpUnused( 4 * (bArea ? 2 : 1) );
734*cdf0e10cSrcweir     mxStack->pushOperand( aRef + getErrorName( BIFF_ERR_REF ), rTokClass );
735*cdf0e10cSrcweir }
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir void FormulaObject::dumpMemFuncToken( const OUString& /*rTokClass*/ )
738*cdf0e10cSrcweir {
739*cdf0e10cSrcweir     dumpDec< sal_uInt16 >( "size" );
740*cdf0e10cSrcweir }
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir void FormulaObject::dumpMemAreaToken( const OUString& rTokClass, bool bAddData )
743*cdf0e10cSrcweir {
744*cdf0e10cSrcweir     dumpUnused( 4 );
745*cdf0e10cSrcweir     dumpMemFuncToken( rTokClass );
746*cdf0e10cSrcweir     if( bAddData )
747*cdf0e10cSrcweir         maAddData.push_back( ADDDATA_MEMAREA );
748*cdf0e10cSrcweir }
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir void FormulaObject::dumpExpToken( const String& rName )
751*cdf0e10cSrcweir {
752*cdf0e10cSrcweir     Address aPos;
753*cdf0e10cSrcweir     dumpRowIndex( "base-row" );
754*cdf0e10cSrcweir     OUStringBuffer aOp( rName );
755*cdf0e10cSrcweir     StringHelper::appendIndex( aOp, createPlaceHolder() + mxOut->getLastItemValue() );
756*cdf0e10cSrcweir     mxStack->pushOperand( aOp.makeStringAndClear() );
757*cdf0e10cSrcweir     maAddData.push_back( ADDDATA_EXP );
758*cdf0e10cSrcweir }
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
761*cdf0e10cSrcweir {
762*cdf0e10cSrcweir     mxStack->pushUnaryOp( rLOp, rROp );
763*cdf0e10cSrcweir }
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir void FormulaObject::dumpBinaryOpToken( const String& rOp )
766*cdf0e10cSrcweir {
767*cdf0e10cSrcweir     mxStack->pushBinaryOp( rOp );
768*cdf0e10cSrcweir }
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir void FormulaObject::dumpFuncToken( const OUString& rTokClass )
771*cdf0e10cSrcweir {
772*cdf0e10cSrcweir     sal_uInt16 nFuncId;
773*cdf0e10cSrcweir     *mxStrm >> nFuncId;
774*cdf0e10cSrcweir     const FunctionInfo* pFuncInfo = 0;
775*cdf0e10cSrcweir     OUString aFuncName = writeFuncIdItem( nFuncId, &pFuncInfo );
776*cdf0e10cSrcweir     if( pFuncInfo && (pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount) )
777*cdf0e10cSrcweir         mxStack->pushFuncOp( aFuncName, rTokClass, pFuncInfo->mnMinParamCount );
778*cdf0e10cSrcweir     else
779*cdf0e10cSrcweir         mxStack->setError();
780*cdf0e10cSrcweir }
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
783*cdf0e10cSrcweir {
784*cdf0e10cSrcweir     sal_uInt8 nParamCount;
785*cdf0e10cSrcweir     sal_uInt16 nFuncId;
786*cdf0e10cSrcweir     *mxStrm >> nParamCount >> nFuncId;
787*cdf0e10cSrcweir     bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
788*cdf0e10cSrcweir     if( bCmd )
789*cdf0e10cSrcweir         writeHexItem( "param-count", nParamCount, "PARAMCOUNT-CMD" );
790*cdf0e10cSrcweir     else
791*cdf0e10cSrcweir         writeDecItem( "param-count", nParamCount );
792*cdf0e10cSrcweir     OUString aFuncName = writeFuncIdItem( nFuncId );
793*cdf0e10cSrcweir     if( bCmd && getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
794*cdf0e10cSrcweir     {
795*cdf0e10cSrcweir         aFuncName += OUString( OOX_DUMP_CMDPROMPT );
796*cdf0e10cSrcweir         nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
797*cdf0e10cSrcweir     }
798*cdf0e10cSrcweir     mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
799*cdf0e10cSrcweir }
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir bool FormulaObject::dumpTableToken()
802*cdf0e10cSrcweir {
803*cdf0e10cSrcweir     dumpUnused( 3 );
804*cdf0e10cSrcweir     sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "TABLEFLAGS" );
805*cdf0e10cSrcweir     sal_uInt16 nTabId = dumpDec< sal_uInt16 >( "table-id" );
806*cdf0e10cSrcweir     dumpUnused( 2 );
807*cdf0e10cSrcweir     {
808*cdf0e10cSrcweir         sal_uInt16 nCol1, nCol2;
809*cdf0e10cSrcweir         *mxStrm >> nCol1 >> nCol2;
810*cdf0e10cSrcweir         ItemGuard aItem( mxOut, "cols" );
811*cdf0e10cSrcweir         mxOut->writeDec( nCol1 );
812*cdf0e10cSrcweir         if( nCol1 != nCol2 )
813*cdf0e10cSrcweir         {
814*cdf0e10cSrcweir             mxOut->writeChar( OOX_DUMP_RANGESEP );
815*cdf0e10cSrcweir             mxOut->writeDec( nCol2 );
816*cdf0e10cSrcweir         }
817*cdf0e10cSrcweir     }
818*cdf0e10cSrcweir     OUStringBuffer aColRange;
819*cdf0e10cSrcweir     StringHelper::appendIndex( aColRange, mxOut->getLastItemValue() );
820*cdf0e10cSrcweir     OUStringBuffer aParams;
821*cdf0e10cSrcweir     size_t nParams = 0;
822*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_TOK_TABLE_ALL ) && ++nParams )
823*cdf0e10cSrcweir         StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#All]" ) );
824*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_TOK_TABLE_HEADERS ) && ++nParams )
825*cdf0e10cSrcweir         StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Headers]" ) );
826*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_TOK_TABLE_DATA ) && ++nParams )
827*cdf0e10cSrcweir         StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Data]" ) );
828*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_TOK_TABLE_TOTALS ) && ++nParams )
829*cdf0e10cSrcweir         StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Totals]" ) );
830*cdf0e10cSrcweir     if( getFlag( nFlags, BIFF12_TOK_TABLE_THISROW ) && ++nParams )
831*cdf0e10cSrcweir         StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#This Row]" ) );
832*cdf0e10cSrcweir     if( (getFlag( nFlags, BIFF12_TOK_TABLE_COLUMN ) || getFlag( nFlags, BIFF12_TOK_TABLE_COLRANGE )) && ++nParams )
833*cdf0e10cSrcweir         StringHelper::appendToken( aParams, aColRange.makeStringAndClear() );
834*cdf0e10cSrcweir     OUStringBuffer aOp;
835*cdf0e10cSrcweir     StringHelper::appendIndexedText( aOp, CREATE_OUSTRING( "TABLE" ), nTabId );
836*cdf0e10cSrcweir     if( nParams > 1 )
837*cdf0e10cSrcweir         StringHelper::appendIndex( aOp, aParams.makeStringAndClear() );
838*cdf0e10cSrcweir     else if( nParams == 1 )
839*cdf0e10cSrcweir         aOp.append( aParams.makeStringAndClear() );
840*cdf0e10cSrcweir     mxStack->pushOperand( aOp.makeStringAndClear() );
841*cdf0e10cSrcweir     return true;
842*cdf0e10cSrcweir }
843*cdf0e10cSrcweir 
844*cdf0e10cSrcweir bool FormulaObject::dumpAttrToken()
845*cdf0e10cSrcweir {
846*cdf0e10cSrcweir     bool bValid = true;
847*cdf0e10cSrcweir     sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxAttrTypes );
848*cdf0e10cSrcweir     switch( nType )
849*cdf0e10cSrcweir     {
850*cdf0e10cSrcweir         case BIFF_TOK_ATTR_VOLATILE:
851*cdf0e10cSrcweir             dumpUnused( 2 );
852*cdf0e10cSrcweir         break;
853*cdf0e10cSrcweir         case BIFF_TOK_ATTR_IF:
854*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "skip" );
855*cdf0e10cSrcweir         break;
856*cdf0e10cSrcweir         case BIFF_TOK_ATTR_CHOOSE:
857*cdf0e10cSrcweir         {
858*cdf0e10cSrcweir             sal_uInt16 nCount = dumpDec< sal_uInt16 >( "choices" );
859*cdf0e10cSrcweir             mxOut->resetItemIndex();
860*cdf0e10cSrcweir             for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
861*cdf0e10cSrcweir                 dumpDec< sal_uInt16 >( "#skip" );
862*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "skip-err" );
863*cdf0e10cSrcweir         }
864*cdf0e10cSrcweir         break;
865*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SKIP:
866*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "skip" );
867*cdf0e10cSrcweir         break;
868*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SUM:
869*cdf0e10cSrcweir             dumpUnused( 2 );
870*cdf0e10cSrcweir             mxStack->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS ), 1 );
871*cdf0e10cSrcweir         break;
872*cdf0e10cSrcweir         case BIFF_TOK_ATTR_ASSIGN:
873*cdf0e10cSrcweir             dumpUnused( 2 );
874*cdf0e10cSrcweir         break;
875*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SPACE:
876*cdf0e10cSrcweir         case BIFF_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
877*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "char-type", mxSpTypes );
878*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "char-count" );
879*cdf0e10cSrcweir         break;
880*cdf0e10cSrcweir         case BIFF_TOK_ATTR_IFERROR:
881*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "skip" );
882*cdf0e10cSrcweir         break;
883*cdf0e10cSrcweir         default:
884*cdf0e10cSrcweir             bValid = false;
885*cdf0e10cSrcweir     }
886*cdf0e10cSrcweir     return bValid;
887*cdf0e10cSrcweir }
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir void FormulaObject::dumpAddTokenData()
890*cdf0e10cSrcweir {
891*cdf0e10cSrcweir     mxOut->resetItemIndex();
892*cdf0e10cSrcweir     sal_Int32 nAddDataSize = (mxStrm->size() - mxStrm->tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
893*cdf0e10cSrcweir     sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nAddDataSize, mxStrm->size() );
894*cdf0e10cSrcweir     for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !mxStrm->isEof() && (mxStrm->tell() < nEndPos); ++aIt )
895*cdf0e10cSrcweir     {
896*cdf0e10cSrcweir         AddDataType eType = *aIt;
897*cdf0e10cSrcweir 
898*cdf0e10cSrcweir         {
899*cdf0e10cSrcweir             ItemGuard aItem( mxOut, "#add-data" );
900*cdf0e10cSrcweir             switch( eType )
901*cdf0e10cSrcweir             {
902*cdf0e10cSrcweir                 case ADDDATA_EXP:       mxOut->writeAscii( "tExp" );      break;
903*cdf0e10cSrcweir                 case ADDDATA_ARRAY:     mxOut->writeAscii( "tArray" );    break;
904*cdf0e10cSrcweir                 case ADDDATA_MEMAREA:   mxOut->writeAscii( "tMemArea" );  break;
905*cdf0e10cSrcweir             }
906*cdf0e10cSrcweir         }
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir         size_t nIdx = aIt - maAddData.begin();
909*cdf0e10cSrcweir         IndentGuard aIndGuard( mxOut );
910*cdf0e10cSrcweir         switch( eType )
911*cdf0e10cSrcweir         {
912*cdf0e10cSrcweir             case ADDDATA_EXP:       dumpAddDataExp( nIdx );     break;
913*cdf0e10cSrcweir             case ADDDATA_ARRAY:     dumpAddDataArray( nIdx );   break;
914*cdf0e10cSrcweir             case ADDDATA_MEMAREA:   dumpAddDataMemArea( nIdx ); break;
915*cdf0e10cSrcweir             default:;
916*cdf0e10cSrcweir         }
917*cdf0e10cSrcweir     }
918*cdf0e10cSrcweir }
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir void FormulaObject::dumpAddDataExp( size_t nIdx )
921*cdf0e10cSrcweir {
922*cdf0e10cSrcweir     dumpColIndex( "base-col" );
923*cdf0e10cSrcweir     mxStack->replaceOnTop( createPlaceHolder( nIdx ), mxOut->getLastItemValue() );
924*cdf0e10cSrcweir }
925*cdf0e10cSrcweir 
926*cdf0e10cSrcweir void FormulaObject::dumpAddDataArray( size_t nIdx )
927*cdf0e10cSrcweir {
928*cdf0e10cSrcweir     sal_Int32 nCols, nRows;
929*cdf0e10cSrcweir     dumpaddDataArrayHeader( nCols, nRows );
930*cdf0e10cSrcweir 
931*cdf0e10cSrcweir     OUStringBuffer aOp;
932*cdf0e10cSrcweir     TableGuard aTabGuard( mxOut, 17 );
933*cdf0e10cSrcweir     for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
934*cdf0e10cSrcweir     {
935*cdf0e10cSrcweir         OUStringBuffer aArrayLine;
936*cdf0e10cSrcweir         for( sal_Int32 nCol = 0; nCol < nCols; ++nCol )
937*cdf0e10cSrcweir             StringHelper::appendToken( aArrayLine, dumpaddDataArrayValue(), OOX_DUMP_LISTSEP );
938*cdf0e10cSrcweir         StringHelper::appendToken( aOp, aArrayLine.makeStringAndClear(), OOX_DUMP_ARRAYSEP );
939*cdf0e10cSrcweir     }
940*cdf0e10cSrcweir     StringHelper::enclose( aOp, '{', '}' );
941*cdf0e10cSrcweir     mxStack->replaceOnTop( createPlaceHolder( nIdx ), aOp.makeStringAndClear() );
942*cdf0e10cSrcweir }
943*cdf0e10cSrcweir 
944*cdf0e10cSrcweir void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
945*cdf0e10cSrcweir {
946*cdf0e10cSrcweir     dumpRangeList();
947*cdf0e10cSrcweir }
948*cdf0e10cSrcweir 
949*cdf0e10cSrcweir void FormulaObject::dumpaddDataArrayHeader( sal_Int32& rnCols, sal_Int32& rnRows )
950*cdf0e10cSrcweir {
951*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
952*cdf0e10cSrcweir     rnRows = dumpDec< sal_Int32 >( "height" );
953*cdf0e10cSrcweir     rnCols = dumpDec< sal_Int32 >( "width" );
954*cdf0e10cSrcweir     ItemGuard aItem( mxOut, "size" );
955*cdf0e10cSrcweir     mxOut->writeDec( rnCols );
956*cdf0e10cSrcweir     mxOut->writeChar( 'x' );
957*cdf0e10cSrcweir     mxOut->writeDec( rnRows );
958*cdf0e10cSrcweir     aItem.cont();
959*cdf0e10cSrcweir     mxOut->writeDec( rnCols * rnRows );
960*cdf0e10cSrcweir }
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir OUString FormulaObject::dumpaddDataArrayValue()
963*cdf0e10cSrcweir {
964*cdf0e10cSrcweir     MultiItemsGuard aMultiGuard( mxOut );
965*cdf0e10cSrcweir     OUStringBuffer aValue;
966*cdf0e10cSrcweir     switch( dumpDec< sal_uInt8 >( "type", "ARRAYVALUE-TYPE" ) )
967*cdf0e10cSrcweir     {
968*cdf0e10cSrcweir         case BIFF_TOK_ARRAY_DOUBLE:
969*cdf0e10cSrcweir             dumpDec< double >( "value" );
970*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
971*cdf0e10cSrcweir         break;
972*cdf0e10cSrcweir         case BIFF_TOK_ARRAY_STRING:
973*cdf0e10cSrcweir             aValue.append( dumpString( "value", false, false ) );
974*cdf0e10cSrcweir             StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE );
975*cdf0e10cSrcweir         break;
976*cdf0e10cSrcweir         case BIFF_TOK_ARRAY_BOOL:
977*cdf0e10cSrcweir             dumpBoolean( "value" );
978*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
979*cdf0e10cSrcweir         break;
980*cdf0e10cSrcweir         case BIFF_TOK_ARRAY_ERROR:
981*cdf0e10cSrcweir             dumpErrorCode( "value" );
982*cdf0e10cSrcweir             aValue.append( mxOut->getLastItemValue() );
983*cdf0e10cSrcweir             dumpUnused( 3 );
984*cdf0e10cSrcweir         break;
985*cdf0e10cSrcweir     }
986*cdf0e10cSrcweir     return aValue.makeStringAndClear();
987*cdf0e10cSrcweir }
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir // ============================================================================
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir RecordStreamObject::RecordStreamObject( ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
992*cdf0e10cSrcweir {
993*cdf0e10cSrcweir     RecordObjectBase::construct( rParent, rxStrm, rSysFileName );
994*cdf0e10cSrcweir     if( RecordObjectBase::implIsValid() )
995*cdf0e10cSrcweir         mxFmlaObj.reset( new FormulaObject( *this ) );
996*cdf0e10cSrcweir }
997*cdf0e10cSrcweir 
998*cdf0e10cSrcweir bool RecordStreamObject::implIsValid() const
999*cdf0e10cSrcweir {
1000*cdf0e10cSrcweir     return isValid( mxFmlaObj ) && RecordObjectBase::implIsValid();
1001*cdf0e10cSrcweir }
1002*cdf0e10cSrcweir 
1003*cdf0e10cSrcweir void RecordStreamObject::implDumpRecordBody()
1004*cdf0e10cSrcweir {
1005*cdf0e10cSrcweir     switch( getRecId() )
1006*cdf0e10cSrcweir     {
1007*cdf0e10cSrcweir         case BIFF12_ID_ARRAY:
1008*cdf0e10cSrcweir             dumpRange( "array-range" );
1009*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "ARRAY-FLAGS" );
1010*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
1011*cdf0e10cSrcweir         break;
1012*cdf0e10cSrcweir 
1013*cdf0e10cSrcweir         case BIFF12_ID_AUTOFILTER:
1014*cdf0e10cSrcweir             dumpRange( "filter-range" );
1015*cdf0e10cSrcweir         break;
1016*cdf0e10cSrcweir 
1017*cdf0e10cSrcweir         case BIFF12_ID_BINARYINDEXBLOCK:
1018*cdf0e10cSrcweir             dumpRowRange( "row-range" );
1019*cdf0e10cSrcweir             dumpUnknown( 12 );
1020*cdf0e10cSrcweir         break;
1021*cdf0e10cSrcweir 
1022*cdf0e10cSrcweir         case BIFF12_ID_BINARYINDEXROWS:
1023*cdf0e10cSrcweir         {
1024*cdf0e10cSrcweir             sal_uInt32 nUsedRows = dumpBin< sal_uInt32 >( "used-rows" );
1025*cdf0e10cSrcweir             dumpDec< sal_Int64 >( "stream-offset" );
1026*cdf0e10cSrcweir             for( ; nUsedRows > 0; nUsedRows >>= 1 )
1027*cdf0e10cSrcweir                 if( (nUsedRows & 1) != 0 )
1028*cdf0e10cSrcweir                     dumpBin< sal_uInt16 >( "used-columns" );
1029*cdf0e10cSrcweir         }
1030*cdf0e10cSrcweir         break;
1031*cdf0e10cSrcweir 
1032*cdf0e10cSrcweir         case BIFF12_ID_BORDER:
1033*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "BORDER-FLAGS" );
1034*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "top-style", "BORDERSTYLES" );
1035*cdf0e10cSrcweir             dumpColor( "top-color" );
1036*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "bottom-style", "BORDERSTYLES" );
1037*cdf0e10cSrcweir             dumpColor( "bottom-color" );
1038*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "left-style", "BORDERSTYLES" );
1039*cdf0e10cSrcweir             dumpColor( "left-color" );
1040*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "right-style", "BORDERSTYLES" );
1041*cdf0e10cSrcweir             dumpColor( "right-color" );
1042*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "diag-style", "BORDERSTYLES" );
1043*cdf0e10cSrcweir             dumpColor( "diag-color" );
1044*cdf0e10cSrcweir         break;
1045*cdf0e10cSrcweir 
1046*cdf0e10cSrcweir         case BIFF12_ID_BRK:
1047*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "id" );
1048*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "min" );
1049*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "max" );
1050*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "manual-break", "BOOLEAN" );
1051*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "pivot-break", "BOOLEAN" );
1052*cdf0e10cSrcweir         break;
1053*cdf0e10cSrcweir 
1054*cdf0e10cSrcweir         case BIFF12_ID_CALCPR:
1055*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "calc-id" );
1056*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "calc-mode", "CALCPR-CALCMODE" );
1057*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "iteration-count" );
1058*cdf0e10cSrcweir             dumpDec< double >( "iteration-delta" );
1059*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "processor-count" );
1060*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CALCPR-FLAGS" );
1061*cdf0e10cSrcweir         break;
1062*cdf0e10cSrcweir 
1063*cdf0e10cSrcweir         case BIFF12_ID_CELL_BLANK:
1064*cdf0e10cSrcweir             dumpCellHeader( true );
1065*cdf0e10cSrcweir         break;
1066*cdf0e10cSrcweir 
1067*cdf0e10cSrcweir         case BIFF12_ID_CELL_BOOL:
1068*cdf0e10cSrcweir             dumpCellHeader( true );
1069*cdf0e10cSrcweir             dumpBoolean();
1070*cdf0e10cSrcweir         break;
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir         case BIFF12_ID_CELL_DOUBLE:
1073*cdf0e10cSrcweir             dumpCellHeader( true );
1074*cdf0e10cSrcweir             dumpDec< double >( "value" );
1075*cdf0e10cSrcweir         break;
1076*cdf0e10cSrcweir 
1077*cdf0e10cSrcweir         case BIFF12_ID_CELL_ERROR:
1078*cdf0e10cSrcweir             dumpCellHeader( true );
1079*cdf0e10cSrcweir             dumpErrorCode();
1080*cdf0e10cSrcweir         break;
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir         case BIFF12_ID_CELL_RK:
1083*cdf0e10cSrcweir             dumpCellHeader( true );
1084*cdf0e10cSrcweir             dumpRk( "value" );
1085*cdf0e10cSrcweir         break;
1086*cdf0e10cSrcweir 
1087*cdf0e10cSrcweir         case BIFF12_ID_CELL_RSTRING:
1088*cdf0e10cSrcweir             dumpCellHeader( true );
1089*cdf0e10cSrcweir             dumpString( "value", true );
1090*cdf0e10cSrcweir         break;
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir         case BIFF12_ID_CELL_SI:
1093*cdf0e10cSrcweir             dumpCellHeader( true );
1094*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "string-id" );
1095*cdf0e10cSrcweir         break;
1096*cdf0e10cSrcweir 
1097*cdf0e10cSrcweir         case BIFF12_ID_CELL_STRING:
1098*cdf0e10cSrcweir             dumpCellHeader( true );
1099*cdf0e10cSrcweir             dumpString( "value" );
1100*cdf0e10cSrcweir         break;
1101*cdf0e10cSrcweir 
1102*cdf0e10cSrcweir         case BIFF12_ID_CELLSTYLE:
1103*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "xf-id" );
1104*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CELLSTYLE-FLAGS" );
1105*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "builtin-id", "CELLSTYLE-BUILTIN" );
1106*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "outline-level" );
1107*cdf0e10cSrcweir             dumpString( "name" );
1108*cdf0e10cSrcweir         break;
1109*cdf0e10cSrcweir 
1110*cdf0e10cSrcweir         case BIFF12_ID_CFCOLOR:
1111*cdf0e10cSrcweir             dumpColor();
1112*cdf0e10cSrcweir         break;
1113*cdf0e10cSrcweir 
1114*cdf0e10cSrcweir         case BIFF12_ID_CFRULE:
1115*cdf0e10cSrcweir         {
1116*cdf0e10cSrcweir             // type/subtype/operator is a mess...
1117*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "type", "CFRULE-TYPE" );
1118*cdf0e10cSrcweir             sal_Int32 nSubType = dumpDec< sal_Int32 >( "sub-type", "CFRULE-SUBTYPE" );
1119*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "dxf-id" );
1120*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "priority" );
1121*cdf0e10cSrcweir             switch( nSubType )
1122*cdf0e10cSrcweir             {
1123*cdf0e10cSrcweir                 case 0:     dumpDec< sal_Int32 >( "operator", "CFRULE-CELL-OPERATOR" ); break;
1124*cdf0e10cSrcweir                 case 5:     dumpDec< sal_Int32 >( "rank" );                             break;
1125*cdf0e10cSrcweir                 case 8:     dumpDec< sal_Int32 >( "operator", "CFRULE-TEXT-OPERATOR" ); break;
1126*cdf0e10cSrcweir                 case 15:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1127*cdf0e10cSrcweir                 case 16:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1128*cdf0e10cSrcweir                 case 17:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1129*cdf0e10cSrcweir                 case 18:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1130*cdf0e10cSrcweir                 case 19:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1131*cdf0e10cSrcweir                 case 20:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1132*cdf0e10cSrcweir                 case 21:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1133*cdf0e10cSrcweir                 case 22:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1134*cdf0e10cSrcweir                 case 23:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1135*cdf0e10cSrcweir                 case 24:    dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
1136*cdf0e10cSrcweir                 case 25:    dumpDec< sal_Int32 >( "std-dev" );                          break;
1137*cdf0e10cSrcweir                 case 26:    dumpDec< sal_Int32 >( "std-dev" );                          break;
1138*cdf0e10cSrcweir                 case 29:    dumpDec< sal_Int32 >( "std-dev" );                          break;
1139*cdf0e10cSrcweir                 case 30:    dumpDec< sal_Int32 >( "std-dev" );                          break;
1140*cdf0e10cSrcweir                 default:    dumpDec< sal_Int32 >( "operator", "CFRULE-OTHER-OPERATOR" );
1141*cdf0e10cSrcweir             }
1142*cdf0e10cSrcweir             dumpUnknown( 8 );
1143*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CFRULE-FLAGS" );
1144*cdf0e10cSrcweir             // for no obvious reason the formula sizes occur twice
1145*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "formula1-size" );
1146*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "formula2-size" );
1147*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "formula3-size" );
1148*cdf0e10cSrcweir             dumpString( "text" );
1149*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 8 )
1150*cdf0e10cSrcweir                 mxFmlaObj->dumpNameFormula( "formula1" );
1151*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 8 )
1152*cdf0e10cSrcweir                 mxFmlaObj->dumpNameFormula( "formula2" );
1153*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 8 )
1154*cdf0e10cSrcweir                 mxFmlaObj->dumpNameFormula( "formula3" );
1155*cdf0e10cSrcweir         }
1156*cdf0e10cSrcweir         break;
1157*cdf0e10cSrcweir 
1158*cdf0e10cSrcweir         case BIFF12_ID_CHARTPAGESETUP:
1159*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
1160*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
1161*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "vertical-res", "PAGESETUP-DPI" );
1162*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "copies" );
1163*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "first-page" );
1164*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHARTPAGESETUP-FLAGS" );
1165*cdf0e10cSrcweir             dumpString( "printer-settings-rel-id" );
1166*cdf0e10cSrcweir         break;
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir         case BIFF12_ID_CHARTPROTECTION:
1169*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "password-hash" );
1170*cdf0e10cSrcweir             // no flags field for the boolean flags?!?
1171*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "content-locked", "BOOLEAN" );
1172*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "objects-locked", "BOOLEAN" );
1173*cdf0e10cSrcweir         break;
1174*cdf0e10cSrcweir 
1175*cdf0e10cSrcweir         case BIFF12_ID_CHARTSHEETPR:
1176*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHARTSHEETPR-FLAGS" );
1177*cdf0e10cSrcweir             dumpColor( "tab-color" );
1178*cdf0e10cSrcweir             dumpString( "codename" );
1179*cdf0e10cSrcweir         break;
1180*cdf0e10cSrcweir 
1181*cdf0e10cSrcweir         case BIFF12_ID_CHARTSHEETVIEW:
1182*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CHARTSHEETVIEW-FLAGS" );
1183*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "zoom-scale", "CONV-PERCENT" );
1184*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "workbookview-id" );
1185*cdf0e10cSrcweir         break;
1186*cdf0e10cSrcweir 
1187*cdf0e10cSrcweir         case BIFF12_ID_COL:
1188*cdf0e10cSrcweir             dumpColRange();
1189*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "col-width", "CONV-COLWIDTH" );
1190*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "custom-xf-id" );
1191*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "COL-FLAGS" );
1192*cdf0e10cSrcweir         break;
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir         case BIFF12_ID_COLBREAKS:
1195*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
1196*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "manual-count" );
1197*cdf0e10cSrcweir         break;
1198*cdf0e10cSrcweir 
1199*cdf0e10cSrcweir         case BIFF12_ID_COLOR:
1200*cdf0e10cSrcweir             dumpColor();
1201*cdf0e10cSrcweir         break;
1202*cdf0e10cSrcweir 
1203*cdf0e10cSrcweir         case BIFF12_ID_COMMENT:
1204*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "author-id" );
1205*cdf0e10cSrcweir             dumpRange( "ref" );
1206*cdf0e10cSrcweir             dumpGuid();
1207*cdf0e10cSrcweir         break;
1208*cdf0e10cSrcweir 
1209*cdf0e10cSrcweir         case BIFF12_ID_COMMENTAUTHOR:
1210*cdf0e10cSrcweir             dumpString( "author" );
1211*cdf0e10cSrcweir         break;
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir         case BIFF12_ID_COMMENTTEXT:
1214*cdf0e10cSrcweir             dumpString( "text", true );
1215*cdf0e10cSrcweir         break;
1216*cdf0e10cSrcweir 
1217*cdf0e10cSrcweir         case BIFF12_ID_CONDFORMATTING:
1218*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "cfrule-count" );
1219*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "pivot-table", "BOOLEAN" );
1220*cdf0e10cSrcweir             dumpRangeList();
1221*cdf0e10cSrcweir         break;
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir         case BIFF12_ID_CONNECTION:
1224*cdf0e10cSrcweir         {
1225*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
1226*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
1227*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "save-password", "CONNECTION-SAVEPASSWORD" );
1228*cdf0e10cSrcweir             dumpUnused( 1 );
1229*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "refresh-interval", "CONNECTION-INTERVAL" );
1230*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
1231*cdf0e10cSrcweir             sal_uInt16 nStrFlags = dumpHex< sal_uInt16 >( "string-flags", "CONNECTION-STRINGFLAGS" );
1232*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "data-source-type", "CONNECTION-SOURCETYPE" );
1233*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
1234*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "id" );
1235*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
1236*cdf0e10cSrcweir             if( nStrFlags & 0x0001 ) dumpString( "source-file" );
1237*cdf0e10cSrcweir             if( nStrFlags & 0x0002 ) dumpString( "source-conn-file" );
1238*cdf0e10cSrcweir             if( nStrFlags & 0x0004 ) dumpString( "description" );
1239*cdf0e10cSrcweir             if( nStrFlags & 0x0008 ) dumpString( "name" );
1240*cdf0e10cSrcweir             if( nStrFlags & 0x0010 ) dumpString( "sso-id" );
1241*cdf0e10cSrcweir         }
1242*cdf0e10cSrcweir         break;
1243*cdf0e10cSrcweir 
1244*cdf0e10cSrcweir         case BIFF12_ID_CONTROL:
1245*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "shape-id" );
1246*cdf0e10cSrcweir             dumpString( "rel-id" );
1247*cdf0e10cSrcweir             dumpString( "name" );
1248*cdf0e10cSrcweir         break;
1249*cdf0e10cSrcweir 
1250*cdf0e10cSrcweir         case BIFF12_ID_CUSTOMFILTER:
1251*cdf0e10cSrcweir         {
1252*cdf0e10cSrcweir             sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "CUSTOMFILTER-DATATYPE" );
1253*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "operator", "CUSTOMFILTER-OPERATOR" );
1254*cdf0e10cSrcweir             switch( nType )
1255*cdf0e10cSrcweir             {
1256*cdf0e10cSrcweir                 case 4:     dumpDec< double >( "value" );               break;
1257*cdf0e10cSrcweir                 case 6:     dumpUnused( 8 ); dumpString( "value" );     break;
1258*cdf0e10cSrcweir                 case 8:     dumpBoolean( "value" ); dumpUnused( 7 );    break;
1259*cdf0e10cSrcweir                 default:    dumpUnused( 8 );
1260*cdf0e10cSrcweir             }
1261*cdf0e10cSrcweir         }
1262*cdf0e10cSrcweir         break;
1263*cdf0e10cSrcweir 
1264*cdf0e10cSrcweir         case BIFF12_ID_DATATABLE:
1265*cdf0e10cSrcweir             dumpRange( "table-range" );
1266*cdf0e10cSrcweir             dumpAddress( "ref1" );
1267*cdf0e10cSrcweir             dumpAddress( "ref2" );
1268*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "DATATABLE-FLAGS" );
1269*cdf0e10cSrcweir         break;
1270*cdf0e10cSrcweir 
1271*cdf0e10cSrcweir         case BIFF12_ID_DATAVALIDATION:
1272*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "DATAVALIDATION-FLAGS" );
1273*cdf0e10cSrcweir             dumpRangeList();
1274*cdf0e10cSrcweir             dumpString( "error-title" );
1275*cdf0e10cSrcweir             dumpString( "error-message" );
1276*cdf0e10cSrcweir             dumpString( "input-title" );
1277*cdf0e10cSrcweir             dumpString( "input-message" );
1278*cdf0e10cSrcweir             mxFmlaObj->dumpNameFormula( "formula1" );
1279*cdf0e10cSrcweir             mxFmlaObj->dumpNameFormula( "formula2" );
1280*cdf0e10cSrcweir         break;
1281*cdf0e10cSrcweir 
1282*cdf0e10cSrcweir         case BIFF12_ID_DATAVALIDATIONS:
1283*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "DATAVALIDATIONS-FLAGS" );
1284*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "input-x" );
1285*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "input-y" );
1286*cdf0e10cSrcweir             dumpUnused( 4 );
1287*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
1288*cdf0e10cSrcweir         break;
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir         case BIFF12_ID_DDEITEMVALUES:
1291*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "rows" );
1292*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "columns" );
1293*cdf0e10cSrcweir         break;
1294*cdf0e10cSrcweir 
1295*cdf0e10cSrcweir         case BIFF12_ID_DDEITEM_STRING:
1296*cdf0e10cSrcweir             dumpString( "value" );
1297*cdf0e10cSrcweir         break;
1298*cdf0e10cSrcweir 
1299*cdf0e10cSrcweir         case BIFF12_ID_DEFINEDNAME:
1300*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "DEFINEDNAME-FLAGS" );
1301*cdf0e10cSrcweir             dumpChar( "accelerator", RTL_TEXTENCODING_ISO_8859_1 );
1302*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-id", "DEFINEDNAME-SHEETID" );
1303*cdf0e10cSrcweir             dumpString( "name" );
1304*cdf0e10cSrcweir             mxFmlaObj->dumpNameFormula();
1305*cdf0e10cSrcweir             dumpString( "comment" );
1306*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 4 ) dumpString( "menu-text" );
1307*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 4 ) dumpString( "description-text" );
1308*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 4 ) dumpString( "help-text" );
1309*cdf0e10cSrcweir             if( mxStrm->getRemaining() >= 4 ) dumpString( "statusbar-text" );
1310*cdf0e10cSrcweir         break;
1311*cdf0e10cSrcweir 
1312*cdf0e10cSrcweir         case BIFF12_ID_DIMENSION:
1313*cdf0e10cSrcweir             dumpRange( "used-range" );
1314*cdf0e10cSrcweir         break;
1315*cdf0e10cSrcweir 
1316*cdf0e10cSrcweir         case BIFF12_ID_DISCRETEFILTER:
1317*cdf0e10cSrcweir             dumpString( "value" );
1318*cdf0e10cSrcweir         break;
1319*cdf0e10cSrcweir 
1320*cdf0e10cSrcweir         case BIFF12_ID_DISCRETEFILTERS:
1321*cdf0e10cSrcweir             dumpBool< sal_Int32 >( "show-blank" );
1322*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "calendar-type", "DISCRETEFILTERS-CALTYPE" );
1323*cdf0e10cSrcweir         break;
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir         case BIFF12_ID_DRAWING:
1326*cdf0e10cSrcweir             dumpString( "rel-id" );
1327*cdf0e10cSrcweir         break;
1328*cdf0e10cSrcweir 
1329*cdf0e10cSrcweir         case BIFF12_ID_DXF:
1330*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "DXF-FLAGS" );
1331*cdf0e10cSrcweir             for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
1332*cdf0e10cSrcweir             {
1333*cdf0e10cSrcweir                 mxOut->startMultiItems();
1334*cdf0e10cSrcweir                 sal_Int64 nStartPos = mxStrm->tell();
1335*cdf0e10cSrcweir                 writeEmptyItem( "SUBREC" );
1336*cdf0e10cSrcweir                 sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
1337*cdf0e10cSrcweir                 sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
1338*cdf0e10cSrcweir                 sal_Int64 nEndPos = nStartPos + nSubRecSize;
1339*cdf0e10cSrcweir                 mxOut->endMultiItems();
1340*cdf0e10cSrcweir                 IndentGuard aIndGuard( mxOut );
1341*cdf0e10cSrcweir                 switch( nSubRecId )
1342*cdf0e10cSrcweir                 {
1343*cdf0e10cSrcweir                     case 0:
1344*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "pattern", "FILLPATTERNS" );
1345*cdf0e10cSrcweir                     break;
1346*cdf0e10cSrcweir                     case 1: case 2: case 5:
1347*cdf0e10cSrcweir                         dumpColor();
1348*cdf0e10cSrcweir                     break;
1349*cdf0e10cSrcweir                     case 3:
1350*cdf0e10cSrcweir                         dumpGradientHead();
1351*cdf0e10cSrcweir                     break;
1352*cdf0e10cSrcweir                     case 4:
1353*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "index" );
1354*cdf0e10cSrcweir                         dumpDec< double >( "stop-position" );
1355*cdf0e10cSrcweir                         dumpColor( "stop-color" );
1356*cdf0e10cSrcweir                     break;
1357*cdf0e10cSrcweir                     case 6: case 7: case 8: case 9: case 10: case 11: case 12:
1358*cdf0e10cSrcweir                         dumpColor( "color" );
1359*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "style", "BORDERSTYLES" );
1360*cdf0e10cSrcweir                     break;
1361*cdf0e10cSrcweir                     case 13: case 14:
1362*cdf0e10cSrcweir                         dumpBoolean( "value" );
1363*cdf0e10cSrcweir                     break;
1364*cdf0e10cSrcweir                     case 15:
1365*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "alignment", "XF-HORALIGN" );
1366*cdf0e10cSrcweir                     break;
1367*cdf0e10cSrcweir                     case 16:
1368*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "alignment", "XF-VERALIGN" );
1369*cdf0e10cSrcweir                     break;
1370*cdf0e10cSrcweir                     case 17:
1371*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
1372*cdf0e10cSrcweir                     break;
1373*cdf0e10cSrcweir                     case 18:
1374*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "indent" );
1375*cdf0e10cSrcweir                     break;
1376*cdf0e10cSrcweir                     case 19:
1377*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "text-dir", "XF-TEXTDIRECTION" );
1378*cdf0e10cSrcweir                     break;
1379*cdf0e10cSrcweir                     case 20: case 21: case 22:
1380*cdf0e10cSrcweir                         dumpBoolean( "value" );
1381*cdf0e10cSrcweir                     break;
1382*cdf0e10cSrcweir                     case 24:
1383*cdf0e10cSrcweir                         dumpString( "name", false, false );
1384*cdf0e10cSrcweir                     break;
1385*cdf0e10cSrcweir                     case 25:
1386*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
1387*cdf0e10cSrcweir                     break;
1388*cdf0e10cSrcweir                     case 26:
1389*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "underline", "FONT-UNDERLINE" );
1390*cdf0e10cSrcweir                     break;
1391*cdf0e10cSrcweir                     case 27:
1392*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
1393*cdf0e10cSrcweir                     break;
1394*cdf0e10cSrcweir                     case 28: case 29: case 30: case 31: case 32: case 33:
1395*cdf0e10cSrcweir                         dumpBoolean( "value" );
1396*cdf0e10cSrcweir                     break;
1397*cdf0e10cSrcweir                     case 34:
1398*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "charset", "CHARSET" );
1399*cdf0e10cSrcweir                     break;
1400*cdf0e10cSrcweir                     case 35:
1401*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
1402*cdf0e10cSrcweir                     break;
1403*cdf0e10cSrcweir                     case 36:
1404*cdf0e10cSrcweir                         dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
1405*cdf0e10cSrcweir                     break;
1406*cdf0e10cSrcweir                     case 37:
1407*cdf0e10cSrcweir                         dumpDec< sal_uInt8 >( "scheme", "FONT-SCHEME" );
1408*cdf0e10cSrcweir                     break;
1409*cdf0e10cSrcweir                     case 38:
1410*cdf0e10cSrcweir                         dumpString( "numfmt", false, false );
1411*cdf0e10cSrcweir                     break;
1412*cdf0e10cSrcweir                     case 41:
1413*cdf0e10cSrcweir                         dumpDec< sal_uInt16 >( "numfmt-id" );
1414*cdf0e10cSrcweir                     break;
1415*cdf0e10cSrcweir                     case 42:
1416*cdf0e10cSrcweir                         dumpDec< sal_Int16 >( "relative-indent" );
1417*cdf0e10cSrcweir                     break;
1418*cdf0e10cSrcweir                     case 43: case 44:
1419*cdf0e10cSrcweir                         dumpBoolean( "value" );
1420*cdf0e10cSrcweir                     break;
1421*cdf0e10cSrcweir                 }
1422*cdf0e10cSrcweir                 dumpRemainingTo( nEndPos );
1423*cdf0e10cSrcweir             }
1424*cdf0e10cSrcweir         break;
1425*cdf0e10cSrcweir 
1426*cdf0e10cSrcweir         case BIFF12_ID_EXTCELL_BOOL:
1427*cdf0e10cSrcweir             dumpColIndex();
1428*cdf0e10cSrcweir             dumpBoolean();
1429*cdf0e10cSrcweir         break;
1430*cdf0e10cSrcweir 
1431*cdf0e10cSrcweir         case BIFF12_ID_EXTCELL_DOUBLE:
1432*cdf0e10cSrcweir             dumpColIndex();
1433*cdf0e10cSrcweir             dumpDec< double >( "value" );
1434*cdf0e10cSrcweir         break;
1435*cdf0e10cSrcweir 
1436*cdf0e10cSrcweir         case BIFF12_ID_EXTCELL_ERROR:
1437*cdf0e10cSrcweir             dumpColIndex();
1438*cdf0e10cSrcweir             dumpErrorCode();
1439*cdf0e10cSrcweir         break;
1440*cdf0e10cSrcweir 
1441*cdf0e10cSrcweir         case BIFF12_ID_EXTCELL_STRING:
1442*cdf0e10cSrcweir             dumpColIndex();
1443*cdf0e10cSrcweir             dumpString( "value" );
1444*cdf0e10cSrcweir         break;
1445*cdf0e10cSrcweir 
1446*cdf0e10cSrcweir         case BIFF12_ID_EXTERNALBOOK:
1447*cdf0e10cSrcweir             switch( dumpDec< sal_uInt16 >( "type", "EXTERNALBOOK-TYPE" ) )
1448*cdf0e10cSrcweir             {
1449*cdf0e10cSrcweir                 case 0:
1450*cdf0e10cSrcweir                     dumpString( "rel-id" );
1451*cdf0e10cSrcweir                     dumpDec< sal_Int32 >( "unused" );
1452*cdf0e10cSrcweir                 break;
1453*cdf0e10cSrcweir                 case 1:
1454*cdf0e10cSrcweir                     dumpString( "dde-service" );
1455*cdf0e10cSrcweir                     dumpString( "dde-topic" );
1456*cdf0e10cSrcweir                 break;
1457*cdf0e10cSrcweir                 case 2:
1458*cdf0e10cSrcweir                     dumpString( "rel-id" );
1459*cdf0e10cSrcweir                     dumpString( "prog-id" );
1460*cdf0e10cSrcweir                 break;
1461*cdf0e10cSrcweir             }
1462*cdf0e10cSrcweir         break;
1463*cdf0e10cSrcweir 
1464*cdf0e10cSrcweir         case BIFF12_ID_EXTERNALNAME:
1465*cdf0e10cSrcweir             dumpString( "name" );
1466*cdf0e10cSrcweir         break;
1467*cdf0e10cSrcweir 
1468*cdf0e10cSrcweir         case BIFF12_ID_EXTERNALNAMEFLAGS:
1469*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "EXTERNALNAMEFLAGS-FLAGS" );
1470*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-id" );
1471*cdf0e10cSrcweir             dumpBoolean( "is-dde-ole" );
1472*cdf0e10cSrcweir         break;
1473*cdf0e10cSrcweir 
1474*cdf0e10cSrcweir         case BIFF12_ID_EXTERNALREF:
1475*cdf0e10cSrcweir             dumpString( "rel-id" );
1476*cdf0e10cSrcweir         break;
1477*cdf0e10cSrcweir 
1478*cdf0e10cSrcweir         case BIFF12_ID_EXTERNALSHEETS:
1479*cdf0e10cSrcweir         {
1480*cdf0e10cSrcweir             sal_Int32 nCount = dumpDec< sal_Int32 >( "ref-count" );
1481*cdf0e10cSrcweir             TableGuard aTabGuard( mxOut, 13, 17, 24 );
1482*cdf0e10cSrcweir             mxOut->resetItemIndex();
1483*cdf0e10cSrcweir             for( sal_Int32 nRefId = 0; !mxStrm->isEof() && (nRefId < nCount); ++nRefId )
1484*cdf0e10cSrcweir             {
1485*cdf0e10cSrcweir                 MultiItemsGuard aMultiGuard( mxOut );
1486*cdf0e10cSrcweir                 writeEmptyItem( "#ref" );
1487*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "extref-id" );
1488*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "first-sheet", "EXTERNALSHEETS-ID" );
1489*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "last-sheet", "EXTERNALSHEETS-ID" );
1490*cdf0e10cSrcweir             }
1491*cdf0e10cSrcweir         }
1492*cdf0e10cSrcweir         break;
1493*cdf0e10cSrcweir 
1494*cdf0e10cSrcweir         case BIFF12_ID_EXTROW:
1495*cdf0e10cSrcweir             dumpRowIndex();
1496*cdf0e10cSrcweir         break;
1497*cdf0e10cSrcweir 
1498*cdf0e10cSrcweir         case BIFF12_ID_EXTSHEETDATA:
1499*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-id" );
1500*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "EXTSHEETDATA-FLAGS" );
1501*cdf0e10cSrcweir         break;
1502*cdf0e10cSrcweir 
1503*cdf0e10cSrcweir         case BIFF12_ID_EXTSHEETNAMES:
1504*cdf0e10cSrcweir             mxOut->resetItemIndex();
1505*cdf0e10cSrcweir             for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !mxStrm->isEof() && (nSheet < nCount); ++nSheet )
1506*cdf0e10cSrcweir                 dumpString( "#sheet-name" );
1507*cdf0e10cSrcweir         break;
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir         case BIFF12_ID_FILESHARING:
1510*cdf0e10cSrcweir             dumpBool< sal_uInt16 >( "recommend-read-only" );
1511*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "password-hash" );
1512*cdf0e10cSrcweir             dumpString( "password-creator" );
1513*cdf0e10cSrcweir         break;
1514*cdf0e10cSrcweir 
1515*cdf0e10cSrcweir         case BIFF12_ID_FILL:
1516*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "fill-pattern", "FILLPATTERNS" );
1517*cdf0e10cSrcweir             dumpColor( "fg-color" );
1518*cdf0e10cSrcweir             dumpColor( "bg-color" );
1519*cdf0e10cSrcweir             dumpGradientHead();
1520*cdf0e10cSrcweir             mxOut->resetItemIndex();
1521*cdf0e10cSrcweir             for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
1522*cdf0e10cSrcweir             {
1523*cdf0e10cSrcweir                 writeEmptyItem( "#stop" );
1524*cdf0e10cSrcweir                 IndentGuard aIndGuard( mxOut );
1525*cdf0e10cSrcweir                 dumpColor( "stop-color" );
1526*cdf0e10cSrcweir                 dumpDec< double >( "stop-position" );
1527*cdf0e10cSrcweir             }
1528*cdf0e10cSrcweir         break;
1529*cdf0e10cSrcweir 
1530*cdf0e10cSrcweir         case BIFF12_ID_FILEVERSION:
1531*cdf0e10cSrcweir             dumpGuid( "codename" );
1532*cdf0e10cSrcweir             dumpString( "app-name" );
1533*cdf0e10cSrcweir             dumpString( "last-edited" );
1534*cdf0e10cSrcweir             dumpString( "lowest-edited" );
1535*cdf0e10cSrcweir             dumpString( "build-version" );
1536*cdf0e10cSrcweir         break;
1537*cdf0e10cSrcweir 
1538*cdf0e10cSrcweir         case BIFF12_ID_FILTERCOLUMN:
1539*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "column-index" );
1540*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
1541*cdf0e10cSrcweir         break;
1542*cdf0e10cSrcweir 
1543*cdf0e10cSrcweir         case BIFF12_ID_FONT:
1544*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
1545*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
1546*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
1547*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
1548*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "underline", "FONT-UNDERLINE" );
1549*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
1550*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "charset", "CHARSET" );
1551*cdf0e10cSrcweir             dumpUnused( 1 );
1552*cdf0e10cSrcweir             dumpColor();
1553*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "scheme", "FONT-SCHEME" );
1554*cdf0e10cSrcweir             dumpString( "name" );
1555*cdf0e10cSrcweir         break;
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir         case BIFF12_ID_FORMULA_BOOL:
1558*cdf0e10cSrcweir             dumpCellHeader( true );
1559*cdf0e10cSrcweir             dumpBoolean();
1560*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
1561*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
1562*cdf0e10cSrcweir         break;
1563*cdf0e10cSrcweir 
1564*cdf0e10cSrcweir         case BIFF12_ID_FORMULA_DOUBLE:
1565*cdf0e10cSrcweir             dumpCellHeader( true );
1566*cdf0e10cSrcweir             dumpDec< double >( "value" );
1567*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
1568*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
1569*cdf0e10cSrcweir         break;
1570*cdf0e10cSrcweir 
1571*cdf0e10cSrcweir         case BIFF12_ID_FORMULA_ERROR:
1572*cdf0e10cSrcweir             dumpCellHeader( true );
1573*cdf0e10cSrcweir             dumpErrorCode();
1574*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
1575*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
1576*cdf0e10cSrcweir         break;
1577*cdf0e10cSrcweir 
1578*cdf0e10cSrcweir         case BIFF12_ID_FORMULA_STRING:
1579*cdf0e10cSrcweir             dumpCellHeader( true );
1580*cdf0e10cSrcweir             dumpString( "value" );
1581*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
1582*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
1583*cdf0e10cSrcweir         break;
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir         case BIFF12_ID_FUNCTIONGROUP:
1586*cdf0e10cSrcweir             dumpString( "name" );
1587*cdf0e10cSrcweir         break;
1588*cdf0e10cSrcweir 
1589*cdf0e10cSrcweir         case BIFF12_ID_HEADERFOOTER:
1590*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "HEADERFOOTER-FLAGS" );
1591*cdf0e10cSrcweir             dumpString( "odd-header" );
1592*cdf0e10cSrcweir             dumpString( "odd-footer" );
1593*cdf0e10cSrcweir             dumpString( "even-header" );
1594*cdf0e10cSrcweir             dumpString( "even-footer" );
1595*cdf0e10cSrcweir             dumpString( "first-header" );
1596*cdf0e10cSrcweir             dumpString( "first-footer" );
1597*cdf0e10cSrcweir         break;
1598*cdf0e10cSrcweir 
1599*cdf0e10cSrcweir         case BIFF12_ID_HYPERLINK:
1600*cdf0e10cSrcweir             dumpRange();
1601*cdf0e10cSrcweir             dumpString( "rel-id" );
1602*cdf0e10cSrcweir             dumpString( "location" );
1603*cdf0e10cSrcweir             dumpString( "tooltip" );
1604*cdf0e10cSrcweir             dumpString( "display" );
1605*cdf0e10cSrcweir         break;
1606*cdf0e10cSrcweir 
1607*cdf0e10cSrcweir         case BIFF12_ID_INPUTCELLS:
1608*cdf0e10cSrcweir             dumpAddress( "pos" );
1609*cdf0e10cSrcweir             dumpUnused( 8 );
1610*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "numfmt-id" );
1611*cdf0e10cSrcweir             dumpString( "value" );
1612*cdf0e10cSrcweir         break;
1613*cdf0e10cSrcweir 
1614*cdf0e10cSrcweir         case BIFF12_ID_LEGACYDRAWING:
1615*cdf0e10cSrcweir             dumpString( "rel-id" );
1616*cdf0e10cSrcweir         break;
1617*cdf0e10cSrcweir 
1618*cdf0e10cSrcweir         case BIFF12_ID_MERGECELL:
1619*cdf0e10cSrcweir             dumpRange();
1620*cdf0e10cSrcweir         break;
1621*cdf0e10cSrcweir 
1622*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_BLANK:
1623*cdf0e10cSrcweir             dumpCellHeader( false );
1624*cdf0e10cSrcweir         break;
1625*cdf0e10cSrcweir 
1626*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_BOOL:
1627*cdf0e10cSrcweir             dumpCellHeader( false );
1628*cdf0e10cSrcweir             dumpBoolean();
1629*cdf0e10cSrcweir         break;
1630*cdf0e10cSrcweir 
1631*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_DOUBLE:
1632*cdf0e10cSrcweir             dumpCellHeader( false );
1633*cdf0e10cSrcweir             dumpDec< double >( "value" );
1634*cdf0e10cSrcweir         break;
1635*cdf0e10cSrcweir 
1636*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_ERROR:
1637*cdf0e10cSrcweir             dumpCellHeader( false );
1638*cdf0e10cSrcweir             dumpErrorCode();
1639*cdf0e10cSrcweir         break;
1640*cdf0e10cSrcweir 
1641*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_RK:
1642*cdf0e10cSrcweir             dumpCellHeader( false );
1643*cdf0e10cSrcweir             dumpRk( "value" );
1644*cdf0e10cSrcweir         break;
1645*cdf0e10cSrcweir 
1646*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_RSTRING:
1647*cdf0e10cSrcweir             dumpCellHeader( false );
1648*cdf0e10cSrcweir             dumpString( "value", true );
1649*cdf0e10cSrcweir         break;
1650*cdf0e10cSrcweir 
1651*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_SI:
1652*cdf0e10cSrcweir             dumpCellHeader( false );
1653*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "string-id" );
1654*cdf0e10cSrcweir         break;
1655*cdf0e10cSrcweir 
1656*cdf0e10cSrcweir         case BIFF12_ID_MULTCELL_STRING:
1657*cdf0e10cSrcweir             dumpCellHeader( false );
1658*cdf0e10cSrcweir             dumpString( "value" );
1659*cdf0e10cSrcweir         break;
1660*cdf0e10cSrcweir 
1661*cdf0e10cSrcweir         case BIFF12_ID_NUMFMT:
1662*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "numfmt-id" );
1663*cdf0e10cSrcweir             dumpString( "format" );
1664*cdf0e10cSrcweir         break;
1665*cdf0e10cSrcweir 
1666*cdf0e10cSrcweir         case BIFF12_ID_OLEOBJECT:
1667*cdf0e10cSrcweir         {
1668*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "aspect", "OLEOBJECT-ASPECT" );
1669*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "update", "OLEOBJECT-UPDATE" );
1670*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "shape-id" );
1671*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OLEOBJECT-FLAGS" );
1672*cdf0e10cSrcweir             dumpString( "prog-id" );
1673*cdf0e10cSrcweir             if( getFlag( nFlags, BIFF12_OLEOBJECT_LINKED ) )
1674*cdf0e10cSrcweir                 mxFmlaObj->dumpNameFormula( "link" );
1675*cdf0e10cSrcweir             else
1676*cdf0e10cSrcweir                 dumpString( "rel-id" );
1677*cdf0e10cSrcweir         }
1678*cdf0e10cSrcweir         break;
1679*cdf0e10cSrcweir 
1680*cdf0e10cSrcweir         case BIFF12_ID_OLESIZE:
1681*cdf0e10cSrcweir             dumpRange( "visible-range" );
1682*cdf0e10cSrcweir         break;
1683*cdf0e10cSrcweir 
1684*cdf0e10cSrcweir         case BIFF12_ID_PAGEMARGINS:
1685*cdf0e10cSrcweir             dumpDec< double >( "left-margin" );
1686*cdf0e10cSrcweir             dumpDec< double >( "right-margin" );
1687*cdf0e10cSrcweir             dumpDec< double >( "top-margin" );
1688*cdf0e10cSrcweir             dumpDec< double >( "bottom-margin" );
1689*cdf0e10cSrcweir             dumpDec< double >( "header-margin" );
1690*cdf0e10cSrcweir             dumpDec< double >( "footer-margin" );
1691*cdf0e10cSrcweir         break;
1692*cdf0e10cSrcweir 
1693*cdf0e10cSrcweir         case BIFF12_ID_PAGESETUP:
1694*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
1695*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "scaling", "CONV-PERCENT" );
1696*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
1697*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "vertical-res", "PAGESETUP-DPI" );
1698*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "copies" );
1699*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "first-page" );
1700*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "scale-to-width", "PAGESETUP-SCALETOPAGES" );
1701*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "scale-to-height", "PAGESETUP-SCALETOPAGES" );
1702*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "PAGESETUP-FLAGS" );
1703*cdf0e10cSrcweir             dumpString( "printer-settings-rel-id" );
1704*cdf0e10cSrcweir         break;
1705*cdf0e10cSrcweir 
1706*cdf0e10cSrcweir         case BIFF12_ID_PANE:
1707*cdf0e10cSrcweir             dumpDec< double >( "x-split-pos" );
1708*cdf0e10cSrcweir             dumpDec< double >( "y-split-pos" );
1709*cdf0e10cSrcweir             dumpAddress( "second-top-left" );
1710*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "active-pane", "PANE-ID" );
1711*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "PANE-FLAGS" );
1712*cdf0e10cSrcweir         break;
1713*cdf0e10cSrcweir 
1714*cdf0e10cSrcweir         case BIFF12_ID_PCDEFINITION:
1715*cdf0e10cSrcweir         {
1716*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
1717*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
1718*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "created-version" );
1719*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags-1", "PCDEFINITION-FLAGS1" );
1720*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "missing-items-limit", "PCDEFINITION-MISSINGITEMS" );
1721*cdf0e10cSrcweir             dumpDec< double >( "refreshed-date" );
1722*cdf0e10cSrcweir             sal_uInt8 nFlags2 = dumpHex< sal_uInt8 >( "flags-2", "PCDEFINITION-FLAGS2" );
1723*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "record-count" );
1724*cdf0e10cSrcweir             if( nFlags2 & 0x01 ) dumpString( "refreshed-by" );
1725*cdf0e10cSrcweir             if( nFlags2 & 0x02 ) dumpString( "rel-id" );
1726*cdf0e10cSrcweir         }
1727*cdf0e10cSrcweir         break;
1728*cdf0e10cSrcweir 
1729*cdf0e10cSrcweir         case BIFF12_ID_PCDFIELD:
1730*cdf0e10cSrcweir         {
1731*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
1732*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "numfmt-id" );
1733*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "sql-datatype" );
1734*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "hierarchy" );
1735*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "hierarchy-level" );
1736*cdf0e10cSrcweir             sal_Int32 nMappingCount = dumpDec< sal_Int32 >( "property-mapping-count" );
1737*cdf0e10cSrcweir             dumpString( "name" );
1738*cdf0e10cSrcweir             if( nFlags & 0x0008 ) dumpString( "caption" );
1739*cdf0e10cSrcweir             if( nFlags & 0x0100 ) mxFmlaObj->dumpNameFormula( "formula" );
1740*cdf0e10cSrcweir             if( nMappingCount > 0 )
1741*cdf0e10cSrcweir             {
1742*cdf0e10cSrcweir                 sal_Int32 nBytes = dumpDec< sal_Int32 >( "property-mapping-size" );
1743*cdf0e10cSrcweir                 dumpArray( "property-mapping-indexes", nBytes );
1744*cdf0e10cSrcweir             }
1745*cdf0e10cSrcweir             if( nFlags & 0x0200 ) dumpString( "property-name" );
1746*cdf0e10cSrcweir         }
1747*cdf0e10cSrcweir         break;
1748*cdf0e10cSrcweir 
1749*cdf0e10cSrcweir         case BIFF12_ID_PCDFIELDGROUP:
1750*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "parent-field" );
1751*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "base-field" );
1752*cdf0e10cSrcweir         break;
1753*cdf0e10cSrcweir 
1754*cdf0e10cSrcweir         case BIFF12_ID_PCDFRANGEPR:
1755*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "group-by", "PCDFRANGEPR-GROUPBY" );
1756*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "PCDFRANGEPR-FLAGS" );
1757*cdf0e10cSrcweir             dumpDec< double >( "start-value" );
1758*cdf0e10cSrcweir             dumpDec< double >( "end-value" );
1759*cdf0e10cSrcweir             dumpDec< double >( "interval" );
1760*cdf0e10cSrcweir         break;
1761*cdf0e10cSrcweir 
1762*cdf0e10cSrcweir         case BIFF12_ID_PCDFSHAREDITEMS:
1763*cdf0e10cSrcweir         {
1764*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFSHAREDITEMS-FLAGS" );
1765*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
1766*cdf0e10cSrcweir             if( nFlags & 0x0100 ) dumpDec< double >( "min-value" );
1767*cdf0e10cSrcweir             if( nFlags & 0x0100 ) dumpDec< double >( "max-value" );
1768*cdf0e10cSrcweir         }
1769*cdf0e10cSrcweir         break;
1770*cdf0e10cSrcweir 
1771*cdf0e10cSrcweir         case BIFF12_ID_PCDSHEETSOURCE:
1772*cdf0e10cSrcweir         {
1773*cdf0e10cSrcweir             sal_uInt8 nIsDefName = dumpBoolean( "is-def-name" );
1774*cdf0e10cSrcweir             dumpBoolean( "is-builtin-def-name" );
1775*cdf0e10cSrcweir             sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PCDWORKSHEETSOURCE-FLAGS" );
1776*cdf0e10cSrcweir             if( nFlags & 0x02 ) dumpString( "sheet-name" );
1777*cdf0e10cSrcweir             if( nFlags & 0x01 ) dumpString( "rel-id" );
1778*cdf0e10cSrcweir             if( nIsDefName == 0 ) dumpRange(); else dumpString( "def-name" );
1779*cdf0e10cSrcweir         }
1780*cdf0e10cSrcweir         break;
1781*cdf0e10cSrcweir 
1782*cdf0e10cSrcweir         case BIFF12_ID_PCDSOURCE:
1783*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "source-type", "PCDSOURCE-TYPE" );
1784*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "connection-id" );
1785*cdf0e10cSrcweir         break;
1786*cdf0e10cSrcweir 
1787*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_ARRAY:
1788*cdf0e10cSrcweir         {
1789*cdf0e10cSrcweir             sal_uInt16 nType = dumpDec< sal_uInt16 >( "type", "PCITEM_ARRAY-TYPE" );
1790*cdf0e10cSrcweir             sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
1791*cdf0e10cSrcweir             mxOut->resetItemIndex();
1792*cdf0e10cSrcweir             for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
1793*cdf0e10cSrcweir             {
1794*cdf0e10cSrcweir                 switch( nType )
1795*cdf0e10cSrcweir                 {
1796*cdf0e10cSrcweir                     case 1:     dumpDec< double >( "#value" );  break;
1797*cdf0e10cSrcweir                     case 2:     dumpString( "#value" );         break;
1798*cdf0e10cSrcweir                     case 16:    dumpErrorCode( "#value" );      break;
1799*cdf0e10cSrcweir                     case 32:    dumpPivotDateTime( "#value" );  break;
1800*cdf0e10cSrcweir                     default:    nIdx = nCount;
1801*cdf0e10cSrcweir                 }
1802*cdf0e10cSrcweir             }
1803*cdf0e10cSrcweir         }
1804*cdf0e10cSrcweir         break;
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_BOOL:
1807*cdf0e10cSrcweir             dumpBoolean( "value" );
1808*cdf0e10cSrcweir         break;
1809*cdf0e10cSrcweir 
1810*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_DATE:
1811*cdf0e10cSrcweir             dumpPivotDateTime( "value" );
1812*cdf0e10cSrcweir         break;
1813*cdf0e10cSrcweir 
1814*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_DOUBLE:
1815*cdf0e10cSrcweir             dumpDec< double >( "value" );
1816*cdf0e10cSrcweir             // TODO: server formatting
1817*cdf0e10cSrcweir         break;
1818*cdf0e10cSrcweir 
1819*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_ERROR:
1820*cdf0e10cSrcweir             dumpErrorCode( "value" );
1821*cdf0e10cSrcweir             // TODO: server formatting
1822*cdf0e10cSrcweir         break;
1823*cdf0e10cSrcweir 
1824*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_INDEX:
1825*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "index" );
1826*cdf0e10cSrcweir         break;
1827*cdf0e10cSrcweir 
1828*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_MISSING:
1829*cdf0e10cSrcweir             // TODO: server formatting
1830*cdf0e10cSrcweir         break;
1831*cdf0e10cSrcweir 
1832*cdf0e10cSrcweir 
1833*cdf0e10cSrcweir         case BIFF12_ID_PCITEM_STRING:
1834*cdf0e10cSrcweir             dumpString( "value" );
1835*cdf0e10cSrcweir             // TODO: server formatting
1836*cdf0e10cSrcweir         break;
1837*cdf0e10cSrcweir 
1838*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_BOOL:
1839*cdf0e10cSrcweir             dumpBoolean( "value" );
1840*cdf0e10cSrcweir             // TODO: additional info
1841*cdf0e10cSrcweir         break;
1842*cdf0e10cSrcweir 
1843*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_DATE:
1844*cdf0e10cSrcweir             dumpPivotDateTime( "value" );
1845*cdf0e10cSrcweir             // TODO: additional info
1846*cdf0e10cSrcweir         break;
1847*cdf0e10cSrcweir 
1848*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_DOUBLE:
1849*cdf0e10cSrcweir             dumpDec< double >( "value" );
1850*cdf0e10cSrcweir             // TODO: additional info
1851*cdf0e10cSrcweir         break;
1852*cdf0e10cSrcweir 
1853*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_ERROR:
1854*cdf0e10cSrcweir             dumpErrorCode( "value" );
1855*cdf0e10cSrcweir             // TODO: additional info
1856*cdf0e10cSrcweir         break;
1857*cdf0e10cSrcweir 
1858*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_MISSING:
1859*cdf0e10cSrcweir             // TODO: additional info
1860*cdf0e10cSrcweir         break;
1861*cdf0e10cSrcweir 
1862*cdf0e10cSrcweir         case BIFF12_ID_PCITEMA_STRING:
1863*cdf0e10cSrcweir             dumpString( "value" );
1864*cdf0e10cSrcweir             // TODO: additional info
1865*cdf0e10cSrcweir         break;
1866*cdf0e10cSrcweir 
1867*cdf0e10cSrcweir         case BIFF12_ID_PHONETICPR:
1868*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
1869*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "type", "PHONETICPR-TYPE" );
1870*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "alignment", "PHONETICPR-ALIGNMENT" );
1871*cdf0e10cSrcweir         break;
1872*cdf0e10cSrcweir 
1873*cdf0e10cSrcweir         case BIFF12_ID_PICTURE:
1874*cdf0e10cSrcweir             dumpString( "rel-id" );
1875*cdf0e10cSrcweir         break;
1876*cdf0e10cSrcweir 
1877*cdf0e10cSrcweir         case BIFF12_ID_PIVOTAREA:
1878*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "field" );
1879*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "type", "PIVOTAREA-TYPE" );
1880*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags-1", "PIVOTAREA-FLAGS1" );
1881*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags-2", "PIVOTAREA-FLAGS2" );
1882*cdf0e10cSrcweir         break;
1883*cdf0e10cSrcweir 
1884*cdf0e10cSrcweir         case BIFF12_ID_PIVOTCACHE:
1885*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "cache-id" );
1886*cdf0e10cSrcweir             dumpString( "rel-id" );
1887*cdf0e10cSrcweir         break;
1888*cdf0e10cSrcweir 
1889*cdf0e10cSrcweir         case BIFF12_ID_PTCOLFIELDS:
1890*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
1891*cdf0e10cSrcweir             mxOut->resetItemIndex();
1892*cdf0e10cSrcweir             while( mxStrm->getRemaining() >= 4 )
1893*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
1894*cdf0e10cSrcweir         break;
1895*cdf0e10cSrcweir 
1896*cdf0e10cSrcweir         case BIFF12_ID_PTDATAFIELD:
1897*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "field" );
1898*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
1899*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
1900*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "base-field" );
1901*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "base-item", "PTDATAFIELD-BASEITEM" );
1902*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "number-format" );
1903*cdf0e10cSrcweir             if( dumpBool< sal_uInt8 >( "has-name" ) )
1904*cdf0e10cSrcweir                 dumpString( "name" );
1905*cdf0e10cSrcweir         break;
1906*cdf0e10cSrcweir 
1907*cdf0e10cSrcweir         case BIFF12_ID_PTDEFINITION:
1908*cdf0e10cSrcweir         {
1909*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "created-version" );
1910*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags-1", "PTDEFINITION-FLAGS1" );
1911*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags-2", "PTDEFINITION-FLAGS2" );
1912*cdf0e10cSrcweir             sal_uInt32 nFlags3 = dumpHex< sal_uInt32 >( "flags-3", "PTDEFINITION-FLAGS3" );
1913*cdf0e10cSrcweir             sal_uInt32 nFlags4 = dumpHex< sal_uInt32 >( "flags-4", "PTDEFINITION-FLAGS4" );
1914*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "datafield-axis", "PTDEFINITION-DATAFIELD-AXIS" );
1915*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "page-wrap" );
1916*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "refreshed-version" );
1917*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "min-refresh-version" );
1918*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "datafield-position", "PTDEFINITION-DATAFIELD-POS" );
1919*cdf0e10cSrcweir             dumpDec< sal_Int16 >( "autoformat-id" );
1920*cdf0e10cSrcweir             dumpUnused( 2 );
1921*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "next-chart-id" );
1922*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "cache-id" );
1923*cdf0e10cSrcweir             dumpString( "name" );
1924*cdf0e10cSrcweir             if( nFlags3 & 0x00080000 ) dumpString( "data-caption" );
1925*cdf0e10cSrcweir             if( nFlags3 & 0x00100000 ) dumpString( "grand-total-caption" );
1926*cdf0e10cSrcweir             if( (nFlags4 & 0x00000040) == 0 ) dumpString( "error-caption" );
1927*cdf0e10cSrcweir             if( (nFlags4 & 0x00000080) == 0 ) dumpString( "missing-caption" );
1928*cdf0e10cSrcweir             if( nFlags3 & 0x00200000 ) dumpString( "page-field-style" );
1929*cdf0e10cSrcweir             if( nFlags3 & 0x00400000 ) dumpString( "pivot-table-style" );
1930*cdf0e10cSrcweir             if( nFlags3 & 0x00800000 ) dumpString( "vacated-style" );
1931*cdf0e10cSrcweir             if( nFlags3 & 0x40000000 ) dumpString( "tag" );
1932*cdf0e10cSrcweir             if( nFlags4 & 0x00000800 ) dumpString( "col-header-caption" );
1933*cdf0e10cSrcweir             if( nFlags4 & 0x00000400 ) dumpString( "row-header-caption" );
1934*cdf0e10cSrcweir         }
1935*cdf0e10cSrcweir         break;
1936*cdf0e10cSrcweir 
1937*cdf0e10cSrcweir         case BIFF12_ID_PTFIELD:
1938*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags-1", "PTFIELD-FLAGS1" );
1939*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "num-fmt" );
1940*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags-2", "PTFIELD-FLAGS2" );
1941*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "autoshow-items" );
1942*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "autoshow-datafield-idx" );
1943*cdf0e10cSrcweir         break;
1944*cdf0e10cSrcweir 
1945*cdf0e10cSrcweir         case BIFF12_ID_PTFILTER:
1946*cdf0e10cSrcweir         {
1947*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "field" );
1948*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "member-prop-field" );
1949*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "type", "PTFILTER-TYPE" );
1950*cdf0e10cSrcweir             dumpUnused( 4 );
1951*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "unique-id" );
1952*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "measure-data-field" );
1953*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "measure-data-hierarchy" );
1954*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFILTER-FLAGS" );
1955*cdf0e10cSrcweir             if( nFlags & 0x0001 ) dumpString( "name" );
1956*cdf0e10cSrcweir             if( nFlags & 0x0002 ) dumpString( "description" );
1957*cdf0e10cSrcweir             if( nFlags & 0x0004 ) dumpString( "str-value1" );
1958*cdf0e10cSrcweir             if( nFlags & 0x0008 ) dumpString( "str-value2" );
1959*cdf0e10cSrcweir         }
1960*cdf0e10cSrcweir         break;
1961*cdf0e10cSrcweir 
1962*cdf0e10cSrcweir         case BIFF12_ID_PTFITEM:
1963*cdf0e10cSrcweir         {
1964*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "type", "PTFITEM-TYPE" );
1965*cdf0e10cSrcweir             sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
1966*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "cache-idx" );
1967*cdf0e10cSrcweir             if( nFlags & 0x0010 ) dumpString( "display-name" );
1968*cdf0e10cSrcweir         }
1969*cdf0e10cSrcweir         break;
1970*cdf0e10cSrcweir 
1971*cdf0e10cSrcweir         case BIFF12_ID_PTLOCATION:
1972*cdf0e10cSrcweir             dumpRange( "location" );
1973*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "first-header-row" );
1974*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "first-data-row" );
1975*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "first-data-col" );
1976*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "page-row-count" );
1977*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "page-col-count" );
1978*cdf0e10cSrcweir         break;
1979*cdf0e10cSrcweir 
1980*cdf0e10cSrcweir         case BIFF12_ID_PTPAGEFIELD:
1981*cdf0e10cSrcweir         {
1982*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "field" );
1983*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "cache-item", "PTPAGEFIELD-ITEM" );
1984*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "olap-hierarchy" );
1985*cdf0e10cSrcweir             sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PTPAGEFIELD-FLAGS" );
1986*cdf0e10cSrcweir             if( nFlags & 0x01 ) dumpString( "unique-name" );
1987*cdf0e10cSrcweir             if( nFlags & 0x02 ) dumpString( "olap-caption" );
1988*cdf0e10cSrcweir         }
1989*cdf0e10cSrcweir         break;
1990*cdf0e10cSrcweir 
1991*cdf0e10cSrcweir         case BIFF12_ID_PTREFERENCE:
1992*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "field", "PT-FIELDINDEX" );
1993*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "item-count" );
1994*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags-1", "PTREFERENCE-FLAGS1" );
1995*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags-2", "PTREFERENCE-FLAGS2" );
1996*cdf0e10cSrcweir         break;
1997*cdf0e10cSrcweir 
1998*cdf0e10cSrcweir         case BIFF12_ID_PTROWFIELDS:
1999*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
2000*cdf0e10cSrcweir             mxOut->resetItemIndex();
2001*cdf0e10cSrcweir             while( mxStrm->getRemaining() >= 4 )
2002*cdf0e10cSrcweir                 dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
2003*cdf0e10cSrcweir         break;
2004*cdf0e10cSrcweir 
2005*cdf0e10cSrcweir         case BIFF12_ID_QUERYTABLE:
2006*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "QUERYTABLE-FLAGS" );
2007*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "autoformat-id" );
2008*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "connection-id" );
2009*cdf0e10cSrcweir             dumpString( "defined-name" );
2010*cdf0e10cSrcweir         break;
2011*cdf0e10cSrcweir 
2012*cdf0e10cSrcweir         case BIFF12_ID_ROW:
2013*cdf0e10cSrcweir             dumpRowIndex();
2014*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "custom-xf-id" );
2015*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
2016*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "ROW-FLAGS1" );
2017*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "ROW-FLAGS2" );
2018*cdf0e10cSrcweir             mxOut->resetItemIndex();
2019*cdf0e10cSrcweir             for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); !mxStrm->isEof() && (nSpan < nSpanCount); ++nSpan )
2020*cdf0e10cSrcweir                 dumpRowRange( "#row-spans" );
2021*cdf0e10cSrcweir         break;
2022*cdf0e10cSrcweir 
2023*cdf0e10cSrcweir         case BIFF12_ID_ROWBREAKS:
2024*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "count" );
2025*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "manual-count" );
2026*cdf0e10cSrcweir         break;
2027*cdf0e10cSrcweir 
2028*cdf0e10cSrcweir         case BIFF12_ID_SCENARIO:
2029*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "cell-count" );
2030*cdf0e10cSrcweir             // two longs instead of flag field
2031*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "locked", "BOOLEAN" );
2032*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "hidden", "BOOLEAN" );
2033*cdf0e10cSrcweir             dumpString( "name" );
2034*cdf0e10cSrcweir             dumpString( "comment" );
2035*cdf0e10cSrcweir             dumpString( "user" );
2036*cdf0e10cSrcweir         break;
2037*cdf0e10cSrcweir 
2038*cdf0e10cSrcweir         case BIFF12_ID_SCENARIOS:
2039*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "selected" );
2040*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "shown" );
2041*cdf0e10cSrcweir             dumpRangeList( "result-cells" );
2042*cdf0e10cSrcweir         break;
2043*cdf0e10cSrcweir 
2044*cdf0e10cSrcweir         case BIFF12_ID_SELECTION:
2045*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "pane", "PANE-ID" );
2046*cdf0e10cSrcweir             dumpAddress( "active-cell" );
2047*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "active-cell-id" );
2048*cdf0e10cSrcweir             dumpRangeList( "selection" );
2049*cdf0e10cSrcweir         break;
2050*cdf0e10cSrcweir 
2051*cdf0e10cSrcweir         case BIFF12_ID_SHAREDFMLA:
2052*cdf0e10cSrcweir             dumpRange( "formula-range" );
2053*cdf0e10cSrcweir             mxFmlaObj->dumpCellFormula();
2054*cdf0e10cSrcweir         break;
2055*cdf0e10cSrcweir 
2056*cdf0e10cSrcweir         case BIFF12_ID_SHEET:
2057*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-state", "SHEET-STATE" );
2058*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-id" );
2059*cdf0e10cSrcweir             dumpString( "rel-id" );
2060*cdf0e10cSrcweir             dumpString( "sheet-name" );
2061*cdf0e10cSrcweir         break;
2062*cdf0e10cSrcweir 
2063*cdf0e10cSrcweir         case BIFF12_ID_SHEETFORMATPR:
2064*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "default-col-width", "CONV-COLWIDTH" );
2065*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "base-col-width" );
2066*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "default-row-height", "CONV-TWIP-TO-PT" );
2067*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "SHEETFORMATPR-FLAGS" );
2068*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "max-row-outline" );
2069*cdf0e10cSrcweir             dumpDec< sal_uInt8 >( "max-col-outline" );
2070*cdf0e10cSrcweir         break;
2071*cdf0e10cSrcweir 
2072*cdf0e10cSrcweir         case BIFF12_ID_SHEETPR:
2073*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags1", "SHEETPR-FLAGS1" );
2074*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags2", "SHEETPR-FLAGS2" );
2075*cdf0e10cSrcweir             dumpColor( "tab-color" );
2076*cdf0e10cSrcweir             dumpAddress( "window-anchor" );
2077*cdf0e10cSrcweir             dumpString( "codename" );
2078*cdf0e10cSrcweir         break;
2079*cdf0e10cSrcweir 
2080*cdf0e10cSrcweir         case BIFF12_ID_SHEETPROTECTION:
2081*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "password-hash" );
2082*cdf0e10cSrcweir             // no flags field for all these boolean flags?!?
2083*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-locked", "BOOLEAN" );
2084*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "objects-locked", "BOOLEAN" );
2085*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "scenarios-locked", "BOOLEAN" );
2086*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "format-cells-locked", "BOOLEAN" );
2087*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "format-columns-locked", "BOOLEAN" );
2088*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "format-rows-locked", "BOOLEAN" );
2089*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "insert-columns-locked", "BOOLEAN" );
2090*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "insert-rows-locked", "BOOLEAN" );
2091*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "insert-hyperlinks-locked", "BOOLEAN" );
2092*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "delete-columns-locked", "BOOLEAN" );
2093*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "delete-rows-locked", "BOOLEAN" );
2094*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "select-locked-cells-locked", "BOOLEAN" );
2095*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sort-locked", "BOOLEAN" );
2096*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "autofilter-locked", "BOOLEAN" );
2097*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "pivot-tables-locked", "BOOLEAN" );
2098*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "select-unlocked-cells-locked", "BOOLEAN" );
2099*cdf0e10cSrcweir         break;
2100*cdf0e10cSrcweir 
2101*cdf0e10cSrcweir         case BIFF12_ID_SHEETVIEW:
2102*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "SHEETVIEW-FLAGS" );
2103*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "view-type", "SHEETVIEW-TYPE" );
2104*cdf0e10cSrcweir             dumpAddress( "top-left" );
2105*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "gridcolor-id", "PALETTE-COLORS" );
2106*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "zoom-scale", "CONV-PERCENT" );
2107*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "zoom-scale-normal", "CONV-PERCENT" );
2108*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "zoom-scale-sheet-layout", "CONV-PERCENT" );
2109*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "zoom-scale-page-layout", "CONV-PERCENT" );
2110*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "workbookview-id" );
2111*cdf0e10cSrcweir         break;
2112*cdf0e10cSrcweir 
2113*cdf0e10cSrcweir         case BIFF12_ID_SI:
2114*cdf0e10cSrcweir             dumpString( "string", true );
2115*cdf0e10cSrcweir         break;
2116*cdf0e10cSrcweir 
2117*cdf0e10cSrcweir         case BIFF12_ID_SST:
2118*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "string-cell-count" );
2119*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sst-size" );
2120*cdf0e10cSrcweir         break;
2121*cdf0e10cSrcweir 
2122*cdf0e10cSrcweir         case BIFF12_ID_TABLE:
2123*cdf0e10cSrcweir             dumpRange();
2124*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "type", "TABLE-TYPE" );
2125*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "id" );
2126*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "header-rows" );
2127*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "totals-rows" );
2128*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "TABLE-FLAGS" );
2129*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "headerrow-dxf-id" );
2130*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "data-dxf-id" );
2131*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "totalsrow-dxf-id" );
2132*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "table-border-dxf-id" );
2133*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "headerrow-border-dxf-id" );
2134*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "totalsrow-border-dxf-id" );
2135*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "connection-id" );
2136*cdf0e10cSrcweir             dumpString( "name" );
2137*cdf0e10cSrcweir             dumpString( "display-name" );
2138*cdf0e10cSrcweir             dumpString( "comment" );
2139*cdf0e10cSrcweir             dumpString( "headerrow-cell-style" );
2140*cdf0e10cSrcweir             dumpString( "data-cell-style" );
2141*cdf0e10cSrcweir             dumpString( "totalsrow-cell-style" );
2142*cdf0e10cSrcweir         break;
2143*cdf0e10cSrcweir 
2144*cdf0e10cSrcweir         case BIFF12_ID_TABLEPART:
2145*cdf0e10cSrcweir             dumpString( "rel-id" );
2146*cdf0e10cSrcweir         break;
2147*cdf0e10cSrcweir 
2148*cdf0e10cSrcweir         case BIFF12_ID_TABLESTYLEINFO:
2149*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "flags", "TABLESTYLEINFO-FLAGS" );
2150*cdf0e10cSrcweir             dumpString( "style-name" );
2151*cdf0e10cSrcweir         break;
2152*cdf0e10cSrcweir 
2153*cdf0e10cSrcweir         case BIFF12_ID_TOP10FILTER:
2154*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "TOP10FILTER-FLAGS" );
2155*cdf0e10cSrcweir             dumpDec< double >( "value" );
2156*cdf0e10cSrcweir             dumpDec< double >( "cell-value" );
2157*cdf0e10cSrcweir         break;
2158*cdf0e10cSrcweir 
2159*cdf0e10cSrcweir         case BIFF12_ID_VOLTYPEMAIN:
2160*cdf0e10cSrcweir             dumpString( "first" );
2161*cdf0e10cSrcweir         break;
2162*cdf0e10cSrcweir 
2163*cdf0e10cSrcweir         case BIFF12_ID_VOLTYPESTP:
2164*cdf0e10cSrcweir             dumpString( "topic-value" );
2165*cdf0e10cSrcweir         break;
2166*cdf0e10cSrcweir 
2167*cdf0e10cSrcweir         case BIFF12_ID_VOLTYPETR:
2168*cdf0e10cSrcweir             dumpAddress( "ref" );
2169*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "sheet-id" );
2170*cdf0e10cSrcweir         break;
2171*cdf0e10cSrcweir 
2172*cdf0e10cSrcweir         case BIFF12_ID_WEBPR:
2173*cdf0e10cSrcweir         {
2174*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "WEBPR-FLAGS" );
2175*cdf0e10cSrcweir             sal_uInt8 nStrFlags = dumpHex< sal_uInt8 >( "string-flags", "WEBPR-STRINGFLAGS" );
2176*cdf0e10cSrcweir             if( nStrFlags & 0x04 ) dumpString( "url" );
2177*cdf0e10cSrcweir             if( nStrFlags & 0x01 ) dumpString( "post-method" );
2178*cdf0e10cSrcweir             if( nStrFlags & 0x02 ) dumpString( "edit-page" );
2179*cdf0e10cSrcweir         }
2180*cdf0e10cSrcweir         break;
2181*cdf0e10cSrcweir 
2182*cdf0e10cSrcweir         case BIFF12_ID_WORKBOOKPR:
2183*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "flags", "WORKBBOKPR-FLAGS" );
2184*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "default-theme-version" );
2185*cdf0e10cSrcweir             dumpString( "codename" );
2186*cdf0e10cSrcweir         break;
2187*cdf0e10cSrcweir 
2188*cdf0e10cSrcweir         case BIFF12_ID_WORKBOOKVIEW:
2189*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "x-window" );
2190*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "y-window" );
2191*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "win-width" );
2192*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "win-height" );
2193*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "tabbar-ratio" );
2194*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "first-sheet" );
2195*cdf0e10cSrcweir             dumpDec< sal_Int32 >( "active-sheet" );
2196*cdf0e10cSrcweir             dumpHex< sal_uInt8 >( "flags", "WORKBOOKVIEW-FLAGS" );
2197*cdf0e10cSrcweir         break;
2198*cdf0e10cSrcweir 
2199*cdf0e10cSrcweir         case BIFF12_ID_XF:
2200*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "parent-xf-id" );
2201*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "numfmt-id" );
2202*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
2203*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "fill-id" );
2204*cdf0e10cSrcweir             dumpDec< sal_uInt16 >( "border-id" );
2205*cdf0e10cSrcweir             dumpHex< sal_uInt32 >( "alignment", "XF-ALIGNMENT" );
2206*cdf0e10cSrcweir             dumpHex< sal_uInt16 >( "used-flags", "XF-USEDFLAGS" );
2207*cdf0e10cSrcweir         break;
2208*cdf0e10cSrcweir     }
2209*cdf0e10cSrcweir }
2210*cdf0e10cSrcweir 
2211*cdf0e10cSrcweir void RecordStreamObject::dumpGradientHead()
2212*cdf0e10cSrcweir {
2213*cdf0e10cSrcweir     dumpDec< sal_Int32 >( "gradient-type", "FILL-GRADIENTTYPE" );
2214*cdf0e10cSrcweir     dumpDec< double >( "linear-angle" );
2215*cdf0e10cSrcweir     dumpDec< double >( "pos-left" );
2216*cdf0e10cSrcweir     dumpDec< double >( "pos-right" );
2217*cdf0e10cSrcweir     dumpDec< double >( "pos-top" );
2218*cdf0e10cSrcweir     dumpDec< double >( "pos-bottom" );
2219*cdf0e10cSrcweir }
2220*cdf0e10cSrcweir 
2221*cdf0e10cSrcweir void RecordStreamObject::dumpCellHeader( bool bWithColumn )
2222*cdf0e10cSrcweir {
2223*cdf0e10cSrcweir     if( bWithColumn ) dumpColIndex();
2224*cdf0e10cSrcweir     dumpHex< sal_uInt32 >( "xf-id", "CELL-XFID" );
2225*cdf0e10cSrcweir }
2226*cdf0e10cSrcweir 
2227*cdf0e10cSrcweir // ============================================================================
2228*cdf0e10cSrcweir 
2229*cdf0e10cSrcweir RootStorageObject::RootStorageObject( const DumperBase& rParent )
2230*cdf0e10cSrcweir {
2231*cdf0e10cSrcweir     StorageObjectBase::construct( rParent );
2232*cdf0e10cSrcweir }
2233*cdf0e10cSrcweir 
2234*cdf0e10cSrcweir void RootStorageObject::implDumpStream( const Reference< XInputStream >& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
2235*cdf0e10cSrcweir {
2236*cdf0e10cSrcweir     OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName );
2237*cdf0e10cSrcweir     if(
2238*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) ||
2239*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlsm" ) ||
2240*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlsx" ) ||
2241*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) ||
2242*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) )
2243*cdf0e10cSrcweir     {
2244*cdf0e10cSrcweir         Dumper( getContext(), rxStrm, rSysFileName ).dump();
2245*cdf0e10cSrcweir     }
2246*cdf0e10cSrcweir     else if(
2247*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xla" ) ||
2248*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlc" ) ||
2249*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlm" ) ||
2250*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xls" ) ||
2251*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) ||
2252*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) )
2253*cdf0e10cSrcweir     {
2254*cdf0e10cSrcweir         ::oox::dump::biff::Dumper( getContext(), rxStrm, rSysFileName ).dump();
2255*cdf0e10cSrcweir     }
2256*cdf0e10cSrcweir     else if(
2257*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "pptx" ) ||
2258*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "potx" ) )
2259*cdf0e10cSrcweir     {
2260*cdf0e10cSrcweir         ::oox::dump::pptx::Dumper( getContext(), rxStrm, rSysFileName ).dump();
2261*cdf0e10cSrcweir     }
2262*cdf0e10cSrcweir     else if(
2263*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
2264*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "vml" ) ||
2265*cdf0e10cSrcweir         aExt.equalsIgnoreAsciiCaseAscii( "rels" ) )
2266*cdf0e10cSrcweir     {
2267*cdf0e10cSrcweir         XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
2268*cdf0e10cSrcweir     }
2269*cdf0e10cSrcweir     else if( aExt.equalsIgnoreAsciiCaseAscii( "bin" ) )
2270*cdf0e10cSrcweir     {
2271*cdf0e10cSrcweir         if( rStrgPath.equalsAscii( "xl" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
2272*cdf0e10cSrcweir         {
2273*cdf0e10cSrcweir             StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) );
2274*cdf0e10cSrcweir             VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
2275*cdf0e10cSrcweir         }
2276*cdf0e10cSrcweir         else if( rStrgPath.equalsAscii( "xl/embeddings" ) )
2277*cdf0e10cSrcweir         {
2278*cdf0e10cSrcweir             StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, false ) );
2279*cdf0e10cSrcweir             OleStorageObject( *this, xStrg, rSysFileName ).dump();
2280*cdf0e10cSrcweir         }
2281*cdf0e10cSrcweir         else if(
2282*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl" ) ||
2283*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/chartsheets" ) ||
2284*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/dialogsheets" ) ||
2285*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/externalLinks" ) ||
2286*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/macrosheets" ) ||
2287*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/pivotCache" ) ||
2288*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/pivotTables" ) ||
2289*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/queryTables" ) ||
2290*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/tables" ) ||
2291*cdf0e10cSrcweir             rStrgPath.equalsAscii( "xl/worksheets" ) )
2292*cdf0e10cSrcweir         {
2293*cdf0e10cSrcweir             RecordStreamObject( *this, rxStrm, rSysFileName ).dump();
2294*cdf0e10cSrcweir         }
2295*cdf0e10cSrcweir         else if( rStrgPath.equalsAscii( "xl/activeX" ) )
2296*cdf0e10cSrcweir         {
2297*cdf0e10cSrcweir             StorageRef xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm, true ) );
2298*cdf0e10cSrcweir             ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
2299*cdf0e10cSrcweir         }
2300*cdf0e10cSrcweir         else
2301*cdf0e10cSrcweir         {
2302*cdf0e10cSrcweir             BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
2303*cdf0e10cSrcweir         }
2304*cdf0e10cSrcweir     }
2305*cdf0e10cSrcweir }
2306*cdf0e10cSrcweir 
2307*cdf0e10cSrcweir // ============================================================================
2308*cdf0e10cSrcweir 
2309*cdf0e10cSrcweir #define DUMP_XLSB_CONFIG_ENVVAR "OOO_XLSBDUMPER"
2310*cdf0e10cSrcweir 
2311*cdf0e10cSrcweir Dumper::Dumper( const FilterBase& rFilter )
2312*cdf0e10cSrcweir {
2313*cdf0e10cSrcweir     ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rFilter ) );
2314*cdf0e10cSrcweir     DumperBase::construct( xCfg );
2315*cdf0e10cSrcweir }
2316*cdf0e10cSrcweir 
2317*cdf0e10cSrcweir Dumper::Dumper( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
2318*cdf0e10cSrcweir {
2319*cdf0e10cSrcweir     if( rxContext.is() && rxInStrm.is() )
2320*cdf0e10cSrcweir     {
2321*cdf0e10cSrcweir         StorageRef xStrg( new ZipStorage( getContext(), rxInStrm ) );
2322*cdf0e10cSrcweir         MediaDescriptor aMediaDesc;
2323*cdf0e10cSrcweir         ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName, aMediaDesc ) );
2324*cdf0e10cSrcweir         DumperBase::construct( xCfg );
2325*cdf0e10cSrcweir     }
2326*cdf0e10cSrcweir }
2327*cdf0e10cSrcweir 
2328*cdf0e10cSrcweir void Dumper::implDump()
2329*cdf0e10cSrcweir {
2330*cdf0e10cSrcweir     RootStorageObject( *this ).dump();
2331*cdf0e10cSrcweir }
2332*cdf0e10cSrcweir 
2333*cdf0e10cSrcweir // ============================================================================
2334*cdf0e10cSrcweir 
2335*cdf0e10cSrcweir } // namespace xlsb
2336*cdf0e10cSrcweir } // namespace dump
2337*cdf0e10cSrcweir } // namespace oox
2338*cdf0e10cSrcweir 
2339*cdf0e10cSrcweir #endif
2340