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