1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xlsbdumper.cxx,v $
10 * $Revision: 1.4.20.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/dump/xlsbdumper.hxx"
32 #include <com/sun/star/io/XTextInputStream.hpp>
33 #include "oox/dump/biffdumper.hxx"
34 #include "oox/dump/oledumper.hxx"
35 #include "oox/dump/pptxdumper.hxx"
36 #include "oox/helper/olestorage.hxx"
37 #include "oox/helper/zipstorage.hxx"
38 #include "oox/core/filterbase.hxx"
39 #include "oox/xls/biffhelper.hxx"
40 #include "oox/xls/formulabase.hxx"
41 #include "oox/xls/richstring.hxx"
43 #if OOX_INCLUDE_DUMPER
45 using ::rtl::OUString
;
46 using ::rtl::OUStringBuffer
;
47 using ::com::sun::star::uno::Reference
;
48 using ::com::sun::star::util::DateTime
;
49 using ::com::sun::star::lang::XMultiServiceFactory
;
50 using ::com::sun::star::io::XInputStream
;
51 using ::comphelper::MediaDescriptor
;
52 using ::oox::core::FilterBase
;
54 using namespace ::oox::xls
;
60 // ============================================================================
64 const sal_uInt8 OOBIN_STRINGFLAG_FONTS
= 0x01;
65 const sal_uInt8 OOBIN_STRINGFLAG_PHONETICS
= 0x02;
67 const sal_uInt8 OOBIN_TOK_ARRAY_DOUBLE
= 0;
68 const sal_uInt8 OOBIN_TOK_ARRAY_STRING
= 1;
69 const sal_uInt8 OOBIN_TOK_ARRAY_BOOL
= 2;
70 const sal_uInt8 OOBIN_TOK_ARRAY_ERROR
= 4;
72 const sal_uInt16 OOBIN_OLEOBJECT_LINKED
= 0x0001;
76 // ============================================================================
78 RecordObjectBase::RecordObjectBase()
82 RecordObjectBase::~RecordObjectBase()
86 void RecordObjectBase::construct( const ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
)
88 mxStrm
.reset( new RecordInputStream( getRecordDataSequence() ) );
89 SequenceRecordObjectBase::construct( rParent
, rxStrm
, rSysFileName
, mxStrm
, "RECORD-NAMES", "SIMPLE-RECORDS" );
90 if( SequenceRecordObjectBase::implIsValid() )
91 mxErrCodes
= cfg().getNameList( "ERRORCODES" );
94 void RecordObjectBase::construct( const RecordObjectBase
& rParent
)
99 bool RecordObjectBase::implReadRecordHeader( BinaryInputStream
& rBaseStrm
, sal_Int64
& ornRecId
, sal_Int64
& ornRecSize
)
101 sal_Int32 nRecId
= 0, nRecSize
= 0;
102 bool bValid
= readCompressedInt( rBaseStrm
, nRecId
) && (nRecId
>= 0) && readCompressedInt( rBaseStrm
, nRecSize
) && (nRecSize
>= 0);
104 ornRecSize
= nRecSize
;
108 OUString
RecordObjectBase::getErrorName( sal_uInt8 nErrCode
) const
110 return cfg().getName( mxErrCodes
, nErrCode
);
113 // ------------------------------------------------------------------------
115 void RecordObjectBase::readAddress( Address
& orAddress
)
117 in() >> orAddress
.mnRow
>> orAddress
.mnCol
;
120 void RecordObjectBase::readRange( Range
& orRange
)
122 in() >> orRange
.maFirst
.mnRow
>> orRange
.maLast
.mnRow
>> orRange
.maFirst
.mnCol
>> orRange
.maLast
.mnCol
;
125 void RecordObjectBase::readRangeList( RangeList
& orRanges
)
131 orRanges
.resize( getLimitedValue
< size_t, sal_Int32
>( nCount
, 0, SAL_MAX_UINT16
) );
132 for( RangeList::iterator aIt
= orRanges
.begin(), aEnd
= orRanges
.end(); !in().isEof() && (aIt
!= aEnd
); ++aIt
)
139 // ----------------------------------------------------------------------------
141 void RecordObjectBase::writeBooleanItem( const String
& rName
, sal_uInt8 nBool
)
143 writeDecItem( rName
, nBool
, "BOOLEAN" );
146 void RecordObjectBase::writeErrorCodeItem( const String
& rName
, sal_uInt8 nErrCode
)
148 writeHexItem( rName
, nErrCode
, mxErrCodes
);
151 void RecordObjectBase::writeFontPortions( const FontPortionModelList
& rPortions
)
153 if( !rPortions
.empty() )
155 writeDecItem( "font-count", static_cast< sal_uInt32
>( rPortions
.size() ) );
156 IndentGuard
aIndGuard( out() );
157 TableGuard
aTabGuard( out(), 14 );
158 for( FontPortionModelList::const_iterator aIt
= rPortions
.begin(), aEnd
= rPortions
.end(); aIt
!= aEnd
; ++aIt
)
160 MultiItemsGuard
aMultiGuard( out() );
161 writeDecItem( "char-pos", aIt
->mnPos
);
162 writeDecItem( "font-id", aIt
->mnFontId
, "FONTNAMES" );
167 void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList
& rPortions
)
169 if( !rPortions
.empty() )
171 writeDecItem( "portion-count", static_cast< sal_uInt32
>( rPortions
.size() ) );
172 IndentGuard
aIndGuard( out() );
173 TableGuard
aTabGuard( out(), 14, 21 );
174 for( PhoneticPortionModelList::const_iterator aIt
= rPortions
.begin(), aEnd
= rPortions
.end(); aIt
!= aEnd
; ++aIt
)
176 MultiItemsGuard
aMultiGuard( out() );
177 writeDecItem( "char-pos", aIt
->mnPos
);
178 writeDecItem( "base-text-start", aIt
->mnBasePos
);
179 writeDecItem( "base-text-length", aIt
->mnBaseLen
);
184 // ----------------------------------------------------------------------------
186 sal_uInt8
RecordObjectBase::dumpBoolean( const String
& rName
)
190 writeBooleanItem( rName( "boolean" ), nBool
);
194 sal_uInt8
RecordObjectBase::dumpErrorCode( const String
& rName
)
198 writeErrorCodeItem( rName( "error-code" ), nErrCode
);
202 OUString
RecordObjectBase::dumpString( const String
& rName
, bool bRich
, bool b32BitLen
)
204 sal_uInt8 nFlags
= bRich
? dumpHex
< sal_uInt8
>( "flags", "STRING-FLAGS" ) : 0;
206 OUString aString
= mxStrm
->readString( b32BitLen
);
207 writeStringItem( rName( "text" ), aString
);
209 // --- formatting ---
210 if( getFlag( nFlags
, OOBIN_STRINGFLAG_FONTS
) )
212 IndentGuard
aIndGuard( out() );
213 FontPortionModelList aPortions
;
214 aPortions
.importPortions( *mxStrm
);
215 writeFontPortions( aPortions
);
218 // --- phonetic text ---
219 if( getFlag( nFlags
, OOBIN_STRINGFLAG_PHONETICS
) )
221 IndentGuard
aIndGuard( out() );
222 dumpString( "phonetic-text" );
223 PhoneticPortionModelList aPortions
;
224 aPortions
.importPortions( *mxStrm
);
225 writePhoneticPortions( aPortions
);
226 dumpDec
< sal_uInt16
>( "font-id", "FONTNAMES" );
227 dumpHex
< sal_uInt16
>( "flags", "PHONETIC-FLAGS" );
233 void RecordObjectBase::dumpColor( const String
& rName
)
235 MultiItemsGuard
aMultiGuard( out() );
236 writeEmptyItem( rName( "color" ) );
237 switch( extractValue
< sal_uInt8
>( dumpDec
< sal_uInt8
>( "flags", "COLOR-FLAGS" ), 1, 7 ) )
239 case 0: dumpUnused( 1 ); break;
240 case 1: dumpDec
< sal_uInt8
>( "index", "PALETTE-COLORS" ); break;
241 case 2: dumpUnused( 1 ); break;
242 case 3: dumpDec
< sal_uInt8
>( "theme-id" ); break;
243 default: dumpUnknown( 1 );
245 dumpDec
< sal_Int16
>( "tint", "CONV-TINT" );
249 DateTime
RecordObjectBase::dumpPivotDateTime( const String
& rName
)
252 aDateTime
.Year
= in().readuInt16();
253 aDateTime
.Month
= in().readuInt16();
254 aDateTime
.Day
= in().readuInt8();
255 aDateTime
.Hours
= in().readuInt8();
256 aDateTime
.Minutes
= in().readuInt8();
257 aDateTime
.Seconds
= in().readuInt8();
258 writeDateTimeItem( rName
, aDateTime
);
262 sal_Int32
RecordObjectBase::dumpColIndex( const String
& rName
)
266 writeColIndexItem( rName( "col-idx" ), nCol
);
270 sal_Int32
RecordObjectBase::dumpRowIndex( const String
& rName
)
274 writeRowIndexItem( rName( "row-idx" ), nRow
);
278 sal_Int32
RecordObjectBase::dumpColRange( const String
& rName
)
280 sal_Int32 nCol1
, nCol2
;
281 in() >> nCol1
>> nCol2
;
282 writeColRangeItem( rName( "col-range" ), nCol1
, nCol2
);
283 return nCol2
- nCol1
+ 1;
286 sal_Int32
RecordObjectBase::dumpRowRange( const String
& rName
)
288 sal_Int32 nRow1
, nRow2
;
289 in() >> nRow1
>> nRow2
;
290 writeRowRangeItem( rName( "row-range" ), nRow1
, nRow2
);
291 return nRow2
- nRow1
+ 1;
294 Address
RecordObjectBase::dumpAddress( const String
& rName
)
298 writeAddressItem( rName( "addr" ), aPos
);
302 Range
RecordObjectBase::dumpRange( const String
& rName
)
306 writeRangeItem( rName( "range" ), aRange
);
310 void RecordObjectBase::dumpRangeList( const String
& rName
)
313 readRangeList( aRanges
);
314 writeRangeListItem( rName( "range-list" ), aRanges
);
317 // private --------------------------------------------------------------------
319 bool RecordObjectBase::readCompressedInt( BinaryInputStream
& rStrm
, sal_Int32
& ornValue
)
324 ornValue
= nByte
& 0x7F;
325 if( (nByte
& 0x80) != 0 )
328 ornValue
|= sal_Int32( nByte
& 0x7F ) << 7;
329 if( (nByte
& 0x80) != 0 )
332 ornValue
|= sal_Int32( nByte
& 0x7F ) << 14;
333 if( (nByte
& 0x80) != 0 )
336 ornValue
|= sal_Int32( nByte
& 0x7F ) << 21;
340 return !rStrm
.isEof();
343 // ============================================================================
345 FormulaObject::FormulaObject( const RecordObjectBase
& rParent
) :
348 RecordObjectBase::construct( rParent
);
352 FormulaObject::~FormulaObject()
356 void FormulaObject::dumpCellFormula( const String
& rName
)
358 dumpFormula( rName
, false );
361 void FormulaObject::dumpNameFormula( const String
& rName
)
363 dumpFormula( rName
, true );
366 void FormulaObject::implDump()
369 MultiItemsGuard
aMultiGuard( out() );
370 writeEmptyItem( maName
);
371 writeDecItem( "formula-size", mnSize
);
373 if( mnSize
< 0 ) return;
375 BinaryInputStream
& rStrm
= in();
376 sal_Int64 nStartPos
= rStrm
.tell();
377 sal_Int64 nEndPos
= ::std::min
< sal_Int64
>( nStartPos
+ mnSize
, rStrm
.getLength() );
379 bool bValid
= mxTokens
.get();
380 mxStack
.reset( new FormulaStack
);
382 IndentGuard
aIndGuard( out() );
384 TableGuard
aTabGuard( out(), 8, 18 );
385 while( bValid
&& (rStrm
.tell() < nEndPos
) )
387 MultiItemsGuard
aMultiGuard( out() );
388 writeHexItem( EMPTY_STRING
, static_cast< sal_uInt16
>( rStrm
.tell() - nStartPos
) );
389 sal_uInt8 nTokenId
= dumpHex
< sal_uInt8
>( EMPTY_STRING
, mxTokens
);
390 bValid
= mxTokens
->hasName( nTokenId
);
393 sal_uInt8 nTokClass
= nTokenId
& BIFF_TOKCLASS_MASK
;
394 sal_uInt8 nBaseId
= nTokenId
& BIFF_TOKID_MASK
;
395 if( nTokClass
== BIFF_TOKCLASS_NONE
)
399 case BIFF_TOKID_EXP
: dumpExpToken( "EXP" ); break;
400 case BIFF_TOKID_ADD
: dumpBinaryOpToken( "+" ); break;
401 case BIFF_TOKID_SUB
: dumpBinaryOpToken( "-" ); break;
402 case BIFF_TOKID_MUL
: dumpBinaryOpToken( "*" ); break;
403 case BIFF_TOKID_DIV
: dumpBinaryOpToken( "/" ); break;
404 case BIFF_TOKID_POWER
: dumpBinaryOpToken( "^" ); break;
405 case BIFF_TOKID_CONCAT
: dumpBinaryOpToken( "&" ); break;
406 case BIFF_TOKID_LT
: dumpBinaryOpToken( "<" ); break;
407 case BIFF_TOKID_LE
: dumpBinaryOpToken( "<=" ); break;
408 case BIFF_TOKID_EQ
: dumpBinaryOpToken( "=" ); break;
409 case BIFF_TOKID_GE
: dumpBinaryOpToken( ">=" ); break;
410 case BIFF_TOKID_GT
: dumpBinaryOpToken( "<" ); break;
411 case BIFF_TOKID_NE
: dumpBinaryOpToken( "<>" ); break;
412 case BIFF_TOKID_ISECT
: dumpBinaryOpToken( " " ); break;
413 case BIFF_TOKID_LIST
: dumpBinaryOpToken( "," ); break;
414 case BIFF_TOKID_RANGE
: dumpBinaryOpToken( ":" ); break;
415 case BIFF_TOKID_UPLUS
: dumpUnaryOpToken( "+", "" ); break;
416 case BIFF_TOKID_UMINUS
: dumpUnaryOpToken( "-", "" ); break;
417 case BIFF_TOKID_PERCENT
: dumpUnaryOpToken( "", "%" ); break;
418 case BIFF_TOKID_PAREN
: dumpUnaryOpToken( "(", ")" ); break;
419 case BIFF_TOKID_MISSARG
: dumpMissArgToken(); break;
420 case BIFF_TOKID_STR
: dumpStringToken(); break;
421 case BIFF_TOKID_NLR
: bValid
= dumpTableToken(); break;
422 case BIFF_TOKID_ATTR
: bValid
= dumpAttrToken(); break;
423 case BIFF_TOKID_ERR
: dumpErrorToken(); break;
424 case BIFF_TOKID_BOOL
: dumpBoolToken(); break;
425 case BIFF_TOKID_INT
: dumpIntToken(); break;
426 case BIFF_TOKID_NUM
: dumpDoubleToken(); break;
427 default: bValid
= false;
432 OUString aTokClass
= cfg().getName( mxClasses
, nTokClass
);
435 case BIFF_TOKID_ARRAY
: dumpArrayToken( aTokClass
); break;
436 case BIFF_TOKID_FUNC
: dumpFuncToken( aTokClass
); break;
437 case BIFF_TOKID_FUNCVAR
: dumpFuncVarToken( aTokClass
); break;
438 case BIFF_TOKID_NAME
: dumpNameToken( aTokClass
); break;
439 case BIFF_TOKID_REF
: dumpRefToken( aTokClass
, false ); break;
440 case BIFF_TOKID_AREA
: dumpAreaToken( aTokClass
, false ); break;
441 case BIFF_TOKID_MEMAREA
: dumpMemAreaToken( aTokClass
, true ); break;
442 case BIFF_TOKID_MEMERR
: dumpMemAreaToken( aTokClass
, false ); break;
443 case BIFF_TOKID_MEMNOMEM
: dumpMemAreaToken( aTokClass
, false ); break;
444 case BIFF_TOKID_MEMFUNC
: dumpMemFuncToken( aTokClass
); break;
445 case BIFF_TOKID_REFERR
: dumpRefErrToken( aTokClass
, false ); break;
446 case BIFF_TOKID_AREAERR
: dumpRefErrToken( aTokClass
, true ); break;
447 case BIFF_TOKID_REFN
: dumpRefToken( aTokClass
, true ); break;
448 case BIFF_TOKID_AREAN
: dumpAreaToken( aTokClass
, true ); break;
449 case BIFF_TOKID_MEMAREAN
: dumpMemFuncToken( aTokClass
); break;
450 case BIFF_TOKID_MEMNOMEMN
: dumpMemFuncToken( aTokClass
); break;
451 case BIFF_TOKID_NAMEX
: dumpNameXToken( aTokClass
); break;
452 case BIFF_TOKID_REF3D
: dumpRef3dToken( aTokClass
, mbNameMode
); break;
453 case BIFF_TOKID_AREA3D
: dumpArea3dToken( aTokClass
, mbNameMode
); break;
454 case BIFF_TOKID_REFERR3D
: dumpRefErr3dToken( aTokClass
, false ); break;
455 case BIFF_TOKID_AREAERR3D
: dumpRefErr3dToken( aTokClass
, true ); break;
456 default: bValid
= false;
463 if( nEndPos
== rStrm
.tell() )
468 writeInfoItem( "formula", mxStack
->getFormulaString() );
469 writeInfoItem( "classes", mxStack
->getClassesString() );
474 dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32
>( nEndPos
- rStrm
.tell() ), false );
475 sal_Int32 nAddDataSize
= dumpDec
< sal_Int32
>( "add-data-size" );
476 dumpBinary( "add-data", nAddDataSize
, false );
482 void FormulaObject::dumpFormula( const String
& rName
, bool bNameMode
)
484 maName
= rName( "formula" );
486 mbNameMode
= bNameMode
;
490 // private --------------------------------------------------------------------
492 void FormulaObject::constructFmlaObj()
494 if( RecordObjectBase::implIsValid() )
496 mxFuncProv
.reset( new FunctionProvider( FILTER_OOX
, BIFF_UNKNOWN
, true ) );
498 Config
& rCfg
= cfg();
499 mxClasses
= rCfg
.getNameList( "TOKENCLASSES" );
500 mxRelFlags
= rCfg
.getNameList( "REFRELFLAGS" );
501 mxAttrTypes
= rCfg
.getNameList( "ATTRTYPES" );
502 mxSpTypes
= rCfg
.getNameList( "ATTRSPACETYPES" );
504 // create classified token names
505 mxTokens
= rCfg
.createNameList
< ConstList
>( "TOKENS" );
506 mxTokens
->includeList( rCfg
.getNameList( "BASETOKENS" ) );
508 NameListRef xClassTokens
= rCfg
.getNameList( "CLASSTOKENS" );
509 if( mxClasses
.get() && xClassTokens
.get() )
510 for( NameListBase::const_iterator aCIt
= mxClasses
->begin(), aCEnd
= mxClasses
->end(); aCIt
!= aCEnd
; ++aCIt
)
511 for( NameListBase::const_iterator aTIt
= xClassTokens
->begin(), aTEnd
= xClassTokens
->end(); aTIt
!= aTEnd
; ++aTIt
)
512 mxTokens
->setName( aCIt
->first
| aTIt
->first
, aTIt
->second
+ aCIt
->second
);
515 mnRowCount
= 1024 * 1024;
519 // ----------------------------------------------------------------------------
523 OUString
lclCreateName( const OUString
& rRef
, sal_Int32 nNameId
)
525 OUStringBuffer
aName( rRef
);
526 StringHelper::appendIndexedText( aName
, CREATE_OUSTRING( "NAME" ), nNameId
);
527 return aName
.makeStringAndClear();
532 // ----------------------------------------------------------------------------
534 TokenAddress
FormulaObject::createTokenAddress( sal_Int32 nCol
, sal_Int32 nRow
, bool bRelC
, bool bRelR
, bool bNameMode
) const
538 if( bRelC
&& bNameMode
&& (nCol
>= mnColCount
/ 2) ) aPos
.mnCol
-= mnColCount
;
539 aPos
.mbRelCol
= bRelC
;
541 if( bRelR
&& bNameMode
&& (nRow
>= mnRowCount
/ 2) ) aPos
.mnRow
-= mnRowCount
;
542 aPos
.mbRelRow
= bRelR
;
546 OUString
FormulaObject::createRef( const OUString
& rData
) const
548 return maRefPrefix
+ rData
;
551 OUString
FormulaObject::createName( sal_Int32 nNameId
) const
553 return lclCreateName( maRefPrefix
, nNameId
);
556 OUString
FormulaObject::createPlaceHolder( size_t nIdx
) const
559 StringHelper::appendDec( aStr
, static_cast< sal_uInt32
>( nIdx
) );
560 StringHelper::enclose( aStr
, OOX_DUMP_PLACEHOLDER
);
561 return aStr
.makeStringAndClear();
564 OUString
FormulaObject::createPlaceHolder() const
566 return createPlaceHolder( maAddData
.size() );
569 OUString
FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId
, const FunctionInfo
** oppFuncInfo
)
571 ItemGuard
aItemGuard( out(), "func-id" );
572 writeHexItem( EMPTY_STRING
, nFuncId
, "FUNCID" );
573 OUStringBuffer aBuffer
;
574 const FunctionInfo
* pFuncInfo
= mxFuncProv
->getFuncInfoFromOobFuncId( nFuncId
);
576 aBuffer
.append( pFuncInfo
->maOoxFuncName
);
579 bool bCmd
= getFlag( nFuncId
, BIFF_TOK_FUNCVAR_CMD
);
580 aBuffer
.appendAscii( bCmd
? "CMD" : "FUNC" );
581 StringHelper::appendIndex( aBuffer
, nFuncId
& BIFF_TOK_FUNCVAR_FUNCIDMASK
);
583 OUString aFuncName
= aBuffer
.makeStringAndClear();
585 out().writeChar( OOX_DUMP_STRQUOTE
);
586 out().writeString( aFuncName
);
587 out().writeChar( OOX_DUMP_STRQUOTE
);
588 if( oppFuncInfo
) *oppFuncInfo
= pFuncInfo
;
592 sal_Int32
FormulaObject::dumpTokenCol( const String
& rName
, bool& rbRelC
, bool& rbRelR
)
594 sal_uInt16 nCol
= dumpHex
< sal_uInt16
>( rName
, mxRelFlags
);
595 rbRelC
= getFlag( nCol
, OOBIN_TOK_REF_COLREL
);
596 rbRelR
= getFlag( nCol
, OOBIN_TOK_REF_ROWREL
);
597 nCol
&= OOBIN_TOK_REF_COLMASK
;
601 sal_Int32
FormulaObject::dumpTokenRow( const String
& rName
)
603 return dumpDec
< sal_Int32
>( rName
);
606 TokenAddress
FormulaObject::dumpTokenAddress( bool bNameMode
)
610 sal_Int32 nRow
= dumpTokenRow( "row" );
611 sal_Int32 nCol
= dumpTokenCol( "col", bRelC
, bRelR
);
612 return createTokenAddress( nCol
, nRow
, bRelC
, bRelR
, bNameMode
);
615 TokenRange
FormulaObject::dumpTokenRange( bool bNameMode
)
621 sal_Int32 nRow1
= dumpTokenRow( "row1" );
622 sal_Int32 nRow2
= dumpTokenRow( "row2" );
623 sal_Int32 nCol1
= dumpTokenCol( "col1", bRelC1
, bRelR1
);
624 sal_Int32 nCol2
= dumpTokenCol( "col2", bRelC2
, bRelR2
);
626 aRange
.maFirst
= createTokenAddress( nCol1
, nRow1
, bRelC1
, bRelR1
, bNameMode
);
627 aRange
.maLast
= createTokenAddress( nCol2
, nRow2
, bRelC2
, bRelR2
, bNameMode
);
631 sal_Int16
FormulaObject::readTokenRefId()
633 return dumpDec
< sal_Int16
>( "ref-id" );
636 OUString
FormulaObject::dumpTokenRefId()
638 OUStringBuffer
aRef( CREATE_OUSTRING( "REF" ) );
639 StringHelper::appendIndex( aRef
, readTokenRefId() );
640 aRef
.append( OOX_DUMP_TABSEP
);
641 return aRef
.makeStringAndClear();
644 void FormulaObject::dumpIntToken()
646 dumpDec
< sal_uInt16
>( "value" );
647 mxStack
->pushOperand( out().getLastItemValue() );
650 void FormulaObject::dumpDoubleToken()
652 dumpDec
< double >( "value" );
653 mxStack
->pushOperand( out().getLastItemValue() );
656 void FormulaObject::dumpStringToken()
658 OUStringBuffer
aBuffer( dumpString( "value", false, false ) );
659 StringHelper::enclose( aBuffer
, OOX_DUMP_FMLASTRQUOTE
);
660 mxStack
->pushOperand( aBuffer
.makeStringAndClear() );
663 void FormulaObject::dumpBoolToken()
665 dumpBoolean( "value" );
666 mxStack
->pushOperand( out().getLastItemValue() );
669 void FormulaObject::dumpErrorToken()
671 dumpErrorCode( "value" );
672 mxStack
->pushOperand( out().getLastItemValue() );
675 void FormulaObject::dumpMissArgToken()
677 mxStack
->pushOperand( OUString( OOX_DUMP_EMPTYVALUE
) );
680 void FormulaObject::dumpArrayToken( const OUString
& rTokClass
)
683 mxStack
->pushOperand( createPlaceHolder(), rTokClass
);
684 maAddData
.push_back( ADDDATA_ARRAY
);
687 void FormulaObject::dumpNameToken( const OUString
& rTokClass
)
689 sal_Int32 nNameId
= dumpDec
< sal_Int32
>( "name-id" );
690 mxStack
->pushOperand( createName( nNameId
), rTokClass
);
693 void FormulaObject::dumpNameXToken( const OUString
& rTokClass
)
695 OUString aRef
= dumpTokenRefId();
696 sal_Int32 nNameId
= dumpDec
< sal_Int32
>( "name-id" );
697 mxStack
->pushOperand( lclCreateName( aRef
, nNameId
), rTokClass
);
700 void FormulaObject::dumpRefToken( const OUString
& rTokClass
, bool bNameMode
)
702 TokenAddress aPos
= dumpTokenAddress( bNameMode
);
703 writeTokenAddressItem( "addr", aPos
, bNameMode
);
704 mxStack
->pushOperand( createRef( out().getLastItemValue() ), rTokClass
);
707 void FormulaObject::dumpAreaToken( const OUString
& rTokClass
, bool bNameMode
)
709 TokenRange aRange
= dumpTokenRange( bNameMode
);
710 writeTokenRangeItem( "range", aRange
, bNameMode
);
711 mxStack
->pushOperand( createRef( out().getLastItemValue() ), rTokClass
);
714 void FormulaObject::dumpRefErrToken( const OUString
& rTokClass
, bool bArea
)
716 dumpUnused( 4 * (bArea
? 2 : 1) );
717 mxStack
->pushOperand( createRef( getErrorName( BIFF_ERR_REF
) ), rTokClass
);
720 void FormulaObject::dumpRef3dToken( const OUString
& rTokClass
, bool bNameMode
)
722 OUString aRef
= dumpTokenRefId();
723 TokenAddress aPos
= dumpTokenAddress( bNameMode
);
724 writeTokenAddress3dItem( "addr", aRef
, aPos
, bNameMode
);
725 mxStack
->pushOperand( out().getLastItemValue(), rTokClass
);
728 void FormulaObject::dumpArea3dToken( const OUString
& rTokClass
, bool bNameMode
)
730 OUString aRef
= dumpTokenRefId();
731 TokenRange aRange
= dumpTokenRange( bNameMode
);
732 writeTokenRange3dItem( "range", aRef
, aRange
, bNameMode
);
733 mxStack
->pushOperand( out().getLastItemValue(), rTokClass
);
736 void FormulaObject::dumpRefErr3dToken( const OUString
& rTokClass
, bool bArea
)
738 OUString aRef
= dumpTokenRefId();
739 dumpUnused( 4 * (bArea
? 2 : 1) );
740 mxStack
->pushOperand( aRef
+ getErrorName( BIFF_ERR_REF
), rTokClass
);
743 void FormulaObject::dumpMemFuncToken( const OUString
& /*rTokClass*/ )
745 dumpDec
< sal_uInt16
>( "size" );
748 void FormulaObject::dumpMemAreaToken( const OUString
& rTokClass
, bool bAddData
)
751 dumpMemFuncToken( rTokClass
);
753 maAddData
.push_back( ADDDATA_MEMAREA
);
756 void FormulaObject::dumpExpToken( const String
& rName
)
759 dumpRowIndex( "base-row" );
760 OUStringBuffer
aOp( rName
);
761 StringHelper::appendIndex( aOp
, createPlaceHolder() + out().getLastItemValue() );
762 mxStack
->pushOperand( aOp
.makeStringAndClear() );
763 maAddData
.push_back( ADDDATA_EXP
);
766 void FormulaObject::dumpUnaryOpToken( const String
& rLOp
, const String
& rROp
)
768 mxStack
->pushUnaryOp( rLOp
, rROp
);
771 void FormulaObject::dumpBinaryOpToken( const String
& rOp
)
773 mxStack
->pushBinaryOp( rOp
);
776 void FormulaObject::dumpFuncToken( const OUString
& rTokClass
)
780 const FunctionInfo
* pFuncInfo
= 0;
781 OUString aFuncName
= writeFuncIdItem( nFuncId
, &pFuncInfo
);
782 if( pFuncInfo
&& (pFuncInfo
->mnMinParamCount
== pFuncInfo
->mnMaxParamCount
) )
783 mxStack
->pushFuncOp( aFuncName
, rTokClass
, pFuncInfo
->mnMinParamCount
);
788 void FormulaObject::dumpFuncVarToken( const OUString
& rTokClass
)
790 sal_uInt8 nParamCount
;
792 in() >> nParamCount
>> nFuncId
;
793 bool bCmd
= getFlag( nFuncId
, BIFF_TOK_FUNCVAR_CMD
);
795 writeHexItem( "param-count", nParamCount
, "PARAMCOUNT-CMD" );
797 writeDecItem( "param-count", nParamCount
);
798 OUString aFuncName
= writeFuncIdItem( nFuncId
);
799 if( bCmd
&& getFlag( nParamCount
, BIFF_TOK_FUNCVAR_CMDPROMPT
) )
801 aFuncName
+= OUString( OOX_DUMP_CMDPROMPT
);
802 nParamCount
&= BIFF_TOK_FUNCVAR_COUNTMASK
;
804 mxStack
->pushFuncOp( aFuncName
, rTokClass
, nParamCount
);
807 bool FormulaObject::dumpTableToken()
809 Output
& rOut
= out();
811 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "TABLEFLAGS" );
812 sal_uInt16 nTabId
= dumpDec
< sal_uInt16
>( "table-id" );
815 sal_uInt16 nCol1
, nCol2
;
816 in() >> nCol1
>> nCol2
;
817 ItemGuard
aItem( rOut
, "cols" );
818 rOut
.writeDec( nCol1
);
821 rOut
.writeChar( OOX_DUMP_RANGESEP
);
822 rOut
.writeDec( nCol2
);
825 OUStringBuffer aColRange
;
826 StringHelper::appendIndex( aColRange
, rOut
.getLastItemValue() );
827 OUStringBuffer aParams
;
829 if( getFlag( nFlags
, OOBIN_TOK_TABLE_ALL
) && ++nParams
)
830 StringHelper::appendToken( aParams
, CREATE_OUSTRING( "[#All]" ) );
831 if( getFlag( nFlags
, OOBIN_TOK_TABLE_HEADERS
) && ++nParams
)
832 StringHelper::appendToken( aParams
, CREATE_OUSTRING( "[#Headers]" ) );
833 if( getFlag( nFlags
, OOBIN_TOK_TABLE_DATA
) && ++nParams
)
834 StringHelper::appendToken( aParams
, CREATE_OUSTRING( "[#Data]" ) );
835 if( getFlag( nFlags
, OOBIN_TOK_TABLE_TOTALS
) && ++nParams
)
836 StringHelper::appendToken( aParams
, CREATE_OUSTRING( "[#Totals]" ) );
837 if( getFlag( nFlags
, OOBIN_TOK_TABLE_THISROW
) && ++nParams
)
838 StringHelper::appendToken( aParams
, CREATE_OUSTRING( "[#This Row]" ) );
839 if( (getFlag( nFlags
, OOBIN_TOK_TABLE_COLUMN
) || getFlag( nFlags
, OOBIN_TOK_TABLE_COLRANGE
)) && ++nParams
)
840 StringHelper::appendToken( aParams
, aColRange
.makeStringAndClear() );
842 StringHelper::appendIndexedText( aOp
, CREATE_OUSTRING( "TABLE" ), nTabId
);
844 StringHelper::appendIndex( aOp
, aParams
.makeStringAndClear() );
845 else if( nParams
== 1 )
846 aOp
.append( aParams
.makeStringAndClear() );
847 mxStack
->pushOperand( aOp
.makeStringAndClear() );
851 bool FormulaObject::dumpAttrToken()
854 sal_uInt8 nType
= dumpHex
< sal_uInt8
>( "type", mxAttrTypes
);
857 case OOBIN_TOK_ATTR_VOLATILE
:
860 case OOBIN_TOK_ATTR_IF
:
861 dumpDec
< sal_uInt16
>( "skip" );
863 case OOBIN_TOK_ATTR_CHOOSE
:
865 sal_uInt16 nCount
= dumpDec
< sal_uInt16
>( "choices" );
866 out().resetItemIndex();
867 for( sal_uInt16 nIdx
= 0; nIdx
< nCount
; ++nIdx
)
868 dumpDec
< sal_uInt16
>( "#skip" );
869 dumpDec
< sal_uInt16
>( "skip-err" );
872 case OOBIN_TOK_ATTR_SKIP
:
873 dumpDec
< sal_uInt16
>( "skip" );
875 case OOBIN_TOK_ATTR_SUM
:
877 mxStack
->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS
), 1 );
879 case OOBIN_TOK_ATTR_ASSIGN
:
882 case OOBIN_TOK_ATTR_SPACE
:
883 case OOBIN_TOK_ATTR_SPACE
| BIFF_TOK_ATTR_VOLATILE
:
884 dumpDec
< sal_uInt8
>( "char-type", mxSpTypes
);
885 dumpDec
< sal_uInt8
>( "char-count" );
887 case OOBIN_TOK_ATTR_IFERROR
:
888 dumpDec
< sal_uInt16
>( "skip" );
896 void FormulaObject::dumpAddTokenData()
898 Output
& rOut
= out();
899 rOut
.resetItemIndex();
900 BinaryInputStream
& rStrm
= in();
901 sal_Int32 nAddDataSize
= (in().getLength() - in().tell() >= 4) ? dumpDec
< sal_Int32
>( "add-data-size" ) : 0;
902 sal_Int64 nEndPos
= ::std::min
< sal_Int64
>( rStrm
.tell() + nAddDataSize
, rStrm
.getLength() );
903 for( AddDataTypeVec::const_iterator aIt
= maAddData
.begin(), aEnd
= maAddData
.end(); (aIt
!= aEnd
) && !rStrm
.isEof() && (rStrm
.tell() < nEndPos
); ++aIt
)
905 AddDataType eType
= *aIt
;
908 ItemGuard
aItem( rOut
, "#add-data" );
911 case ADDDATA_EXP
: rOut
.writeAscii( "tExp" ); break;
912 case ADDDATA_ARRAY
: rOut
.writeAscii( "tArray" ); break;
913 case ADDDATA_MEMAREA
: rOut
.writeAscii( "tMemArea" ); break;
917 size_t nIdx
= aIt
- maAddData
.begin();
918 IndentGuard
aIndGuard( rOut
);
921 case ADDDATA_EXP
: dumpAddDataExp( nIdx
); break;
922 case ADDDATA_ARRAY
: dumpAddDataArray( nIdx
); break;
923 case ADDDATA_MEMAREA
: dumpAddDataMemArea( nIdx
); break;
929 void FormulaObject::dumpAddDataExp( size_t nIdx
)
931 dumpColIndex( "base-col" );
932 mxStack
->replaceOnTop( createPlaceHolder( nIdx
), out().getLastItemValue() );
935 void FormulaObject::dumpAddDataArray( size_t nIdx
)
937 sal_Int32 nCols
, nRows
;
938 dumpaddDataArrayHeader( nCols
, nRows
);
941 TableGuard
aTabGuard( out(), 17 );
942 for( sal_Int32 nRow
= 0; nRow
< nRows
; ++nRow
)
944 OUStringBuffer aArrayLine
;
945 for( sal_Int32 nCol
= 0; nCol
< nCols
; ++nCol
)
946 StringHelper::appendToken( aArrayLine
, dumpaddDataArrayValue(), OOX_DUMP_LISTSEP
);
947 StringHelper::appendToken( aOp
, aArrayLine
.makeStringAndClear(), OOX_DUMP_ARRAYSEP
);
949 StringHelper::enclose( aOp
, '{', '}' );
950 mxStack
->replaceOnTop( createPlaceHolder( nIdx
), aOp
.makeStringAndClear() );
953 void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
958 void FormulaObject::dumpaddDataArrayHeader( sal_Int32
& rnCols
, sal_Int32
& rnRows
)
960 Output
& rOut
= out();
961 MultiItemsGuard
aMultiGuard( rOut
);
962 rnRows
= dumpDec
< sal_Int32
>( "height" );
963 rnCols
= dumpDec
< sal_Int32
>( "width" );
964 ItemGuard
aItem( rOut
, "size" );
965 rOut
.writeDec( rnCols
);
966 rOut
.writeChar( 'x' );
967 rOut
.writeDec( rnRows
);
969 rOut
.writeDec( rnCols
* rnRows
);
972 OUString
FormulaObject::dumpaddDataArrayValue()
974 Output
& rOut
= out();
975 MultiItemsGuard
aMultiGuard( rOut
);
976 OUStringBuffer aValue
;
977 switch( dumpDec
< sal_uInt8
>( "type", "ARRAYVALUE-TYPE" ) )
979 case OOBIN_TOK_ARRAY_DOUBLE
:
980 dumpDec
< double >( "value" );
981 aValue
.append( rOut
.getLastItemValue() );
983 case OOBIN_TOK_ARRAY_STRING
:
984 aValue
.append( dumpString( "value", false, false ) );
985 StringHelper::enclose( aValue
, OOX_DUMP_STRQUOTE
);
987 case OOBIN_TOK_ARRAY_BOOL
:
988 dumpBoolean( "value" );
989 aValue
.append( rOut
.getLastItemValue() );
991 case OOBIN_TOK_ARRAY_ERROR
:
992 dumpErrorCode( "value" );
993 aValue
.append( rOut
.getLastItemValue() );
997 return aValue
.makeStringAndClear();
1000 // ============================================================================
1002 RecordStreamObject::RecordStreamObject( ObjectBase
& rParent
, const BinaryInputStreamRef
& rxStrm
, const OUString
& rSysFileName
)
1004 RecordObjectBase::construct( rParent
, rxStrm
, rSysFileName
);
1005 if( RecordObjectBase::implIsValid() )
1006 mxFmlaObj
.reset( new FormulaObject( *this ) );
1009 bool RecordStreamObject::implIsValid() const
1011 return isValid( mxFmlaObj
) && RecordObjectBase::implIsValid();
1014 void RecordStreamObject::implDumpRecordBody()
1016 switch( getRecId() )
1018 case OOBIN_ID_ARRAY
:
1019 dumpRange( "array-range" );
1020 dumpHex
< sal_uInt8
>( "flags", "ARRAY-FLAGS" );
1021 mxFmlaObj
->dumpCellFormula();
1024 case OOBIN_ID_BINARYINDEXBLOCK
:
1025 dumpRowRange( "row-range" );
1029 case OOBIN_ID_BINARYINDEXROWS
:
1031 sal_uInt32 nUsedRows
= dumpBin
< sal_uInt32
>( "used-rows" );
1032 dumpDec
< sal_Int64
>( "stream-offset" );
1033 for( ; nUsedRows
> 0; nUsedRows
>>= 1 )
1034 if( (nUsedRows
& 1) != 0 )
1035 dumpBin
< sal_uInt16
>( "used-columns" );
1039 case OOBIN_ID_BORDER
:
1040 dumpHex
< sal_uInt8
>( "flags", "BORDER-FLAGS" );
1041 dumpDec
< sal_uInt16
>( "top-style", "BORDERSTYLES" );
1042 dumpColor( "top-color" );
1043 dumpDec
< sal_uInt16
>( "bottom-style", "BORDERSTYLES" );
1044 dumpColor( "bottom-color" );
1045 dumpDec
< sal_uInt16
>( "left-style", "BORDERSTYLES" );
1046 dumpColor( "left-color" );
1047 dumpDec
< sal_uInt16
>( "right-style", "BORDERSTYLES" );
1048 dumpColor( "right-color" );
1049 dumpDec
< sal_uInt16
>( "diag-style", "BORDERSTYLES" );
1050 dumpColor( "diag-color" );
1054 dumpDec
< sal_Int32
>( "id" );
1055 dumpDec
< sal_Int32
>( "min" );
1056 dumpDec
< sal_Int32
>( "max" );
1057 dumpDec
< sal_Int32
>( "manual-break", "BOOLEAN" );
1058 dumpDec
< sal_Int32
>( "pivot-break", "BOOLEAN" );
1061 case OOBIN_ID_CALCPR
:
1062 dumpDec
< sal_Int32
>( "calc-id" );
1063 dumpDec
< sal_Int32
>( "calc-mode", "CALCPR-CALCMODE" );
1064 dumpDec
< sal_Int32
>( "iteration-count" );
1065 dumpDec
< double >( "iteration-delta" );
1066 dumpDec
< sal_Int32
>( "processor-count" );
1067 dumpHex
< sal_uInt16
>( "flags", "CALCPR-FLAGS" );
1070 case OOBIN_ID_CELL_BLANK
:
1071 dumpCellHeader( true );
1074 case OOBIN_ID_CELL_BOOL
:
1075 dumpCellHeader( true );
1079 case OOBIN_ID_CELL_DOUBLE
:
1080 dumpCellHeader( true );
1081 dumpDec
< double >( "value" );
1084 case OOBIN_ID_CELL_ERROR
:
1085 dumpCellHeader( true );
1089 case OOBIN_ID_CELL_RK
:
1090 dumpCellHeader( true );
1094 case OOBIN_ID_CELL_RSTRING
:
1095 dumpCellHeader( true );
1096 dumpString( "value", true );
1099 case OOBIN_ID_CELL_SI
:
1100 dumpCellHeader( true );
1101 dumpDec
< sal_Int32
>( "string-id" );
1104 case OOBIN_ID_CELL_STRING
:
1105 dumpCellHeader( true );
1106 dumpString( "value" );
1109 case OOBIN_ID_CELLSTYLE
:
1110 dumpDec
< sal_Int32
>( "xf-id" );
1111 dumpHex
< sal_uInt16
>( "flags", "CELLSTYLE-FLAGS" );
1112 dumpDec
< sal_uInt8
>( "builtin-id", "CELLSTYLE-BUILTIN" );
1113 dumpDec
< sal_uInt8
>( "outline-level" );
1114 dumpString( "name" );
1117 case OOBIN_ID_CFCOLOR
:
1121 case OOBIN_ID_CFRULE
:
1123 // type/subtype/operator is a mess...
1124 dumpDec
< sal_Int32
>( "type", "CFRULE-TYPE" );
1125 sal_Int32 nSubType
= dumpDec
< sal_Int32
>( "sub-type", "CFRULE-SUBTYPE" );
1126 dumpDec
< sal_Int32
>( "dxf-id" );
1127 dumpDec
< sal_Int32
>( "priority" );
1130 case 0: dumpDec
< sal_Int32
>( "operator", "CFRULE-CELL-OPERATOR" ); break;
1131 case 5: dumpDec
< sal_Int32
>( "rank" ); break;
1132 case 8: dumpDec
< sal_Int32
>( "operator", "CFRULE-TEXT-OPERATOR" ); break;
1133 case 15: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1134 case 16: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1135 case 17: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1136 case 18: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1137 case 19: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1138 case 20: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1139 case 21: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1140 case 22: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1141 case 23: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1142 case 24: dumpDec
< sal_Int32
>( "operator", "CFRULE-TIME-OPERATOR" ); break;
1143 case 25: dumpDec
< sal_Int32
>( "std-dev" ); break;
1144 case 26: dumpDec
< sal_Int32
>( "std-dev" ); break;
1145 case 29: dumpDec
< sal_Int32
>( "std-dev" ); break;
1146 case 30: dumpDec
< sal_Int32
>( "std-dev" ); break;
1147 default: dumpDec
< sal_Int32
>( "operator", "CFRULE-OTHER-OPERATOR" );
1150 dumpHex
< sal_uInt16
>( "flags", "CFRULE-FLAGS" );
1151 // for no obvious reason the formula sizes occur twice
1152 dumpDec
< sal_Int32
>( "formula1-size" );
1153 dumpDec
< sal_Int32
>( "formula2-size" );
1154 dumpDec
< sal_Int32
>( "formula3-size" );
1155 dumpString( "text" );
1156 if( in().getLength() - in().tell() >= 8 )
1157 mxFmlaObj
->dumpNameFormula( "formula1" );
1158 if( in().getLength() - in().tell() >= 8 )
1159 mxFmlaObj
->dumpNameFormula( "formula2" );
1160 if( in().getLength() - in().tell() >= 8 )
1161 mxFmlaObj
->dumpNameFormula( "formula3" );
1165 case OOBIN_ID_CHARTPAGESETUP
:
1166 dumpDec
< sal_Int32
>( "paper-size", "PAGESETUP-PAPERSIZE" );
1167 dumpDec
< sal_Int32
>( "horizontal-res", "PAGESETUP-DPI" );
1168 dumpDec
< sal_Int32
>( "vertical-res", "PAGESETUP-DPI" );
1169 dumpDec
< sal_Int32
>( "copies" );
1170 dumpDec
< sal_uInt16
>( "first-page" );
1171 dumpHex
< sal_uInt16
>( "flags", "CHARTPAGESETUP-FLAGS" );
1172 dumpString( "printer-settings-rel-id" );
1175 case OOBIN_ID_CHARTPROTECTION
:
1176 dumpHex
< sal_uInt16
>( "password-hash" );
1177 // no flags field for the boolean flags?!?
1178 dumpDec
< sal_Int32
>( "content-locked", "BOOLEAN" );
1179 dumpDec
< sal_Int32
>( "objects-locked", "BOOLEAN" );
1182 case OOBIN_ID_CHARTSHEETPR
:
1183 dumpHex
< sal_uInt16
>( "flags", "CHARTSHEETPR-FLAGS" );
1184 dumpColor( "tab-color" );
1185 dumpString( "codename" );
1188 case OOBIN_ID_CHARTSHEETVIEW
:
1189 dumpHex
< sal_uInt16
>( "flags", "CHARTSHEETVIEW-FLAGS" );
1190 dumpDec
< sal_Int32
>( "zoom-scale", "CONV-PERCENT" );
1191 dumpDec
< sal_Int32
>( "workbookview-id" );
1196 dumpDec
< sal_Int32
>( "col-width", "CONV-COLWIDTH" );
1197 dumpDec
< sal_Int32
>( "custom-xf-id" );
1198 dumpHex
< sal_uInt16
>( "flags", "COL-FLAGS" );
1201 case OOBIN_ID_COLBREAKS
:
1202 dumpDec
< sal_Int32
>( "count" );
1203 dumpDec
< sal_Int32
>( "manual-count" );
1206 case OOBIN_ID_COLOR
:
1210 case OOBIN_ID_COMMENT
:
1211 dumpDec
< sal_Int32
>( "author-id" );
1216 case OOBIN_ID_COMMENTAUTHOR
:
1217 dumpString( "author" );
1220 case OOBIN_ID_COMMENTTEXT
:
1221 dumpString( "text", true );
1224 case OOBIN_ID_CONDFORMATTING
:
1225 dumpDec
< sal_Int32
>( "cfrule-count" );
1226 dumpDec
< sal_Int32
>( "pivot-table", "BOOLEAN" );
1230 case OOBIN_ID_CONTROL
:
1231 dumpDec
< sal_Int32
>( "shape-id" );
1232 dumpString( "rel-id" );
1233 dumpString( "name" );
1236 case OOBIN_ID_DATATABLE
:
1237 dumpRange( "table-range" );
1238 dumpAddress( "ref1" );
1239 dumpAddress( "ref2" );
1240 dumpHex
< sal_uInt8
>( "flags", "DATATABLE-FLAGS" );
1243 case OOBIN_ID_DATAVALIDATION
:
1244 dumpHex
< sal_uInt32
>( "flags", "DATAVALIDATION-FLAGS" );
1246 dumpString( "error-title" );
1247 dumpString( "error-message" );
1248 dumpString( "input-title" );
1249 dumpString( "input-message" );
1250 mxFmlaObj
->dumpNameFormula( "formula1" );
1251 mxFmlaObj
->dumpNameFormula( "formula2" );
1254 case OOBIN_ID_DATAVALIDATIONS
:
1255 dumpHex
< sal_uInt16
>( "flags", "DATAVALIDATIONS-FLAGS" );
1256 dumpDec
< sal_Int32
>( "input-x" );
1257 dumpDec
< sal_Int32
>( "input-y" );
1259 dumpDec
< sal_Int32
>( "count" );
1262 case OOBIN_ID_DDEITEMVALUES
:
1263 dumpDec
< sal_Int32
>( "rows" );
1264 dumpDec
< sal_Int32
>( "columns" );
1267 case OOBIN_ID_DDEITEM_STRING
:
1268 dumpString( "value" );
1271 case OOBIN_ID_DEFINEDNAME
:
1272 dumpHex
< sal_uInt32
>( "flags", "DEFINEDNAME-FLAGS" );
1273 dumpChar( "accelerator", RTL_TEXTENCODING_ISO_8859_1
);
1274 dumpDec
< sal_Int32
>( "sheet-id", "DEFINEDNAME-SHEETID" );
1275 dumpString( "name" );
1276 mxFmlaObj
->dumpNameFormula();
1277 dumpString( "comment" );
1278 if( in().getLength() - in().tell() >= 4 ) dumpString( "menu-text" );
1279 if( in().getLength() - in().tell() >= 4 ) dumpString( "description-text" );
1280 if( in().getLength() - in().tell() >= 4 ) dumpString( "help-text" );
1281 if( in().getLength() - in().tell() >= 4 ) dumpString( "statusbar-text" );
1284 case OOBIN_ID_DIMENSION
:
1285 dumpRange( "used-range" );
1288 case OOBIN_ID_DRAWING
:
1289 dumpString( "rel-id" );
1293 dumpHex
< sal_uInt32
>( "flags", "DXF-FLAGS" );
1294 for( sal_uInt16 nIndex
= 0, nCount
= dumpDec
< sal_uInt16
>( "subrec-count" ); !in().isEof() && (nIndex
< nCount
); ++nIndex
)
1296 out().startMultiItems();
1297 sal_Int64 nStartPos
= in().tell();
1298 writeEmptyItem( "SUBREC" );
1299 sal_uInt16 nSubRecId
= dumpDec
< sal_uInt16
>( "id", "DXF-SUBREC" );
1300 sal_uInt16 nSubRecSize
= dumpDec
< sal_uInt16
>( "size" );
1301 sal_Int64 nEndPos
= nStartPos
+ nSubRecSize
;
1302 out().endMultiItems();
1303 IndentGuard
aIndGuard( out() );
1307 dumpDec
< sal_uInt8
>( "pattern", "FILLPATTERNS" );
1314 dumpDec
< sal_Int32
>( "gradient-type", "FILL-GRADIENTTYPE" );
1315 dumpDec
< double >( "linear-angle" );
1316 dumpDec
< double >( "pos-left" );
1317 dumpDec
< double >( "pos-right" );
1318 dumpDec
< double >( "pos-top" );
1319 dumpDec
< double >( "pos-bottom" );
1322 dumpDec
< sal_uInt16
>( "index" );
1323 dumpDec
< double >( "stop-position" );
1324 dumpColor( "stop-color" );
1336 dumpColor( "color" );
1337 dumpDec
< sal_uInt16
>( "style", "BORDERSTYLES" );
1341 dumpBoolean( "value" );
1344 dumpDec
< sal_uInt8
>( "alignment", "XF-HORALIGN" );
1347 dumpDec
< sal_uInt8
>( "alignment", "XF-VERALIGN" );
1350 dumpDec
< sal_uInt8
>( "rotation", "TEXTROTATION" );
1353 dumpDec
< sal_uInt16
>( "indent" );
1356 dumpDec
< sal_uInt8
>( "text-dir", "XF-TEXTDIRECTION" );
1361 dumpBoolean( "value" );
1364 dumpString( "name", false, false );
1367 dumpDec
< sal_uInt16
>( "weight", "FONT-WEIGHT" );
1370 dumpDec
< sal_uInt16
>( "underline", "FONT-UNDERLINE" );
1373 dumpDec
< sal_uInt16
>( "escapement", "FONT-ESCAPEMENT" );
1381 dumpBoolean( "value" );
1384 dumpDec
< sal_uInt8
>( "charset", "CHARSET" );
1387 dumpDec
< sal_uInt8
>( "family", "FONT-FAMILY" );
1390 dumpDec
< sal_Int32
>( "height", "CONV-TWIP-TO-PT" );
1393 dumpDec
< sal_uInt8
>( "scheme", "FONT-SCHEME" );
1396 dumpString( "numfmt", false, false );
1399 dumpDec
< sal_uInt16
>( "numfmt-id" );
1402 dumpDec
< sal_uInt16
>( "relative-indent" );
1406 dumpBoolean( "value" );
1409 dumpRemainingTo( nEndPos
);
1413 case OOBIN_ID_EXTCELL_BOOL
:
1418 case OOBIN_ID_EXTCELL_DOUBLE
:
1420 dumpDec
< double >( "value" );
1423 case OOBIN_ID_EXTCELL_ERROR
:
1428 case OOBIN_ID_EXTCELL_STRING
:
1430 dumpString( "value" );
1433 case OOBIN_ID_EXTERNALBOOK
:
1434 switch( dumpDec
< sal_uInt16
>( "type", "EXTERNALBOOK-TYPE" ) )
1437 dumpString( "rel-id" );
1438 dumpDec
< sal_Int32
>( "unused" );
1441 dumpString( "dde-service" );
1442 dumpString( "dde-topic" );
1445 dumpString( "rel-id" );
1446 dumpString( "prog-id" );
1451 case OOBIN_ID_EXTERNALNAME
:
1452 dumpString( "name" );
1455 case OOBIN_ID_EXTERNALNAMEFLAGS
:
1456 dumpHex
< sal_uInt16
>( "flags", "EXTERNALNAMEFLAGS-FLAGS" );
1457 dumpDec
< sal_Int32
>( "sheet-id" );
1458 dumpBoolean( "is-dde-ole" );
1461 case OOBIN_ID_EXTERNALREF
:
1462 dumpString( "rel-id" );
1465 case OOBIN_ID_EXTERNALSHEETS
:
1467 sal_Int32 nCount
= dumpDec
< sal_Int32
>( "ref-count" );
1468 TableGuard
aTabGuard( out(), 13, 17, 24 );
1469 out().resetItemIndex();
1470 for( sal_Int32 nRefId
= 0; !in().isEof() && (nRefId
< nCount
); ++nRefId
)
1472 MultiItemsGuard
aMultiGuard( out() );
1473 writeEmptyItem( "#ref" );
1474 dumpDec
< sal_Int32
>( "extref-id" );
1475 dumpDec
< sal_Int32
>( "first-sheet", "EXTERNALSHEETS-ID" );
1476 dumpDec
< sal_Int32
>( "last-sheet", "EXTERNALSHEETS-ID" );
1481 case OOBIN_ID_EXTROW
:
1485 case OOBIN_ID_EXTSHEETDATA
:
1486 dumpDec
< sal_Int32
>( "sheet-id" );
1487 dumpHex
< sal_uInt8
>( "flags", "EXTSHEETDATA-FLAGS" );
1490 case OOBIN_ID_EXTSHEETNAMES
:
1491 out().resetItemIndex();
1492 for( sal_Int32 nSheet
= 0, nCount
= dumpDec
< sal_Int32
>( "sheet-count" ); !in().isEof() && (nSheet
< nCount
); ++nSheet
)
1493 dumpString( "#sheet-name" );
1496 case OOBIN_ID_FILESHARING
:
1497 dumpBool
< sal_uInt16
>( "recommend-read-only" );
1498 dumpHex
< sal_uInt16
>( "password-hash" );
1499 dumpString( "password-creator" );
1503 dumpDec
< sal_Int32
>( "fill-pattern", "FILLPATTERNS" );
1504 dumpColor( "fg-color" );
1505 dumpColor( "bg-color" );
1506 dumpDec
< sal_Int32
>( "gradient-type", "FILL-GRADIENTTYPE" );
1507 dumpDec
< double >( "linear-angle" );
1508 dumpDec
< double >( "pos-left" );
1509 dumpDec
< double >( "pos-right" );
1510 dumpDec
< double >( "pos-top" );
1511 dumpDec
< double >( "pos-bottom" );
1512 out().resetItemIndex();
1513 for( sal_Int32 nStop
= 0, nStopCount
= dumpDec
< sal_Int32
>( "stop-count" ); (nStop
< nStopCount
) && !in().isEof(); ++nStop
)
1515 writeEmptyItem( "#stop" );
1516 IndentGuard
aIndGuard( out() );
1517 dumpColor( "stop-color" );
1518 dumpDec
< double >( "stop-position" );
1522 case OOBIN_ID_FILEVERSION
:
1523 dumpGuid( "codename" );
1524 dumpString( "app-name" );
1525 dumpString( "last-edited" );
1526 dumpString( "lowest-edited" );
1527 dumpString( "build-version" );
1531 dumpDec
< sal_uInt16
>( "height", "CONV-TWIP-TO-PT" );
1532 dumpHex
< sal_uInt16
>( "flags", "FONT-FLAGS" );
1533 dumpDec
< sal_uInt16
>( "weight", "FONT-WEIGHT" );
1534 dumpDec
< sal_uInt16
>( "escapement", "FONT-ESCAPEMENT" );
1535 dumpDec
< sal_uInt8
>( "underline", "FONT-UNDERLINE" );
1536 dumpDec
< sal_uInt8
>( "family", "FONT-FAMILY" );
1537 dumpDec
< sal_uInt8
>( "charset", "CHARSET" );
1540 dumpDec
< sal_uInt8
>( "scheme", "FONT-SCHEME" );
1541 dumpString( "name" );
1544 case OOBIN_ID_FORMULA_BOOL
:
1545 dumpCellHeader( true );
1547 dumpHex
< sal_uInt16
>( "flags", "FORMULA-FLAGS" );
1548 mxFmlaObj
->dumpCellFormula();
1551 case OOBIN_ID_FORMULA_DOUBLE
:
1552 dumpCellHeader( true );
1553 dumpDec
< double >( "value" );
1554 dumpHex
< sal_uInt16
>( "flags", "FORMULA-FLAGS" );
1555 mxFmlaObj
->dumpCellFormula();
1558 case OOBIN_ID_FORMULA_ERROR
:
1559 dumpCellHeader( true );
1561 dumpHex
< sal_uInt16
>( "flags", "FORMULA-FLAGS" );
1562 mxFmlaObj
->dumpCellFormula();
1565 case OOBIN_ID_FORMULA_STRING
:
1566 dumpCellHeader( true );
1567 dumpString( "value" );
1568 dumpHex
< sal_uInt16
>( "flags", "FORMULA-FLAGS" );
1569 mxFmlaObj
->dumpCellFormula();
1572 case OOBIN_ID_FUNCTIONGROUP
:
1573 dumpString( "name" );
1576 case OOBIN_ID_HEADERFOOTER
:
1577 dumpHex
< sal_uInt16
>( "flags", "HEADERFOOTER-FLAGS" );
1578 dumpString( "odd-header" );
1579 dumpString( "odd-footer" );
1580 dumpString( "even-header" );
1581 dumpString( "even-footer" );
1582 dumpString( "first-header" );
1583 dumpString( "first-footer" );
1586 case OOBIN_ID_HYPERLINK
:
1588 dumpString( "rel-id" );
1589 dumpString( "location" );
1590 dumpString( "tooltip" );
1591 dumpString( "display" );
1594 case OOBIN_ID_INPUTCELLS
:
1595 dumpAddress( "pos" );
1597 dumpDec
< sal_uInt16
>( "numfmt-id" );
1598 dumpString( "value" );
1601 case OOBIN_ID_LEGACYDRAWING
:
1602 dumpString( "rel-id" );
1605 case OOBIN_ID_MERGECELL
:
1609 case OOBIN_ID_MULTCELL_BLANK
:
1610 dumpCellHeader( false );
1613 case OOBIN_ID_MULTCELL_BOOL
:
1614 dumpCellHeader( false );
1618 case OOBIN_ID_MULTCELL_DOUBLE
:
1619 dumpCellHeader( false );
1620 dumpDec
< double >( "value" );
1623 case OOBIN_ID_MULTCELL_ERROR
:
1624 dumpCellHeader( false );
1628 case OOBIN_ID_MULTCELL_RK
:
1629 dumpCellHeader( false );
1633 case OOBIN_ID_MULTCELL_RSTRING
:
1634 dumpCellHeader( false );
1635 dumpString( "value", true );
1638 case OOBIN_ID_MULTCELL_SI
:
1639 dumpCellHeader( false );
1640 dumpDec
< sal_Int32
>( "string-id" );
1643 case OOBIN_ID_MULTCELL_STRING
:
1644 dumpCellHeader( false );
1645 dumpString( "value" );
1648 case OOBIN_ID_NUMFMT
:
1649 dumpDec
< sal_uInt16
>( "numfmt-id" );
1650 dumpString( "format" );
1653 case OOBIN_ID_OLEOBJECT
:
1655 dumpDec
< sal_Int32
>( "aspect", "OLEOBJECT-ASPECT" );
1656 dumpDec
< sal_Int32
>( "update", "OLEOBJECT-UPDATE" );
1657 dumpDec
< sal_Int32
>( "shape-id" );
1658 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "OLEOBJECT-FLAGS" );
1659 dumpString( "prog-id" );
1660 if( getFlag( nFlags
, OOBIN_OLEOBJECT_LINKED
) )
1661 mxFmlaObj
->dumpNameFormula( "link" );
1663 dumpString( "rel-id" );
1667 case OOBIN_ID_PAGEMARGINS
:
1668 dumpDec
< double >( "left-margin" );
1669 dumpDec
< double >( "right-margin" );
1670 dumpDec
< double >( "top-margin" );
1671 dumpDec
< double >( "bottom-margin" );
1672 dumpDec
< double >( "header-margin" );
1673 dumpDec
< double >( "footer-margin" );
1676 case OOBIN_ID_PAGESETUP
:
1677 dumpDec
< sal_Int32
>( "paper-size", "PAGESETUP-PAPERSIZE" );
1678 dumpDec
< sal_Int32
>( "scaling", "CONV-PERCENT" );
1679 dumpDec
< sal_Int32
>( "horizontal-res", "PAGESETUP-DPI" );
1680 dumpDec
< sal_Int32
>( "vertical-res", "PAGESETUP-DPI" );
1681 dumpDec
< sal_Int32
>( "copies" );
1682 dumpDec
< sal_Int32
>( "first-page" );
1683 dumpDec
< sal_Int32
>( "scale-to-width", "PAGESETUP-SCALETOPAGES" );
1684 dumpDec
< sal_Int32
>( "scale-to-height", "PAGESETUP-SCALETOPAGES" );
1685 dumpHex
< sal_uInt16
>( "flags", "PAGESETUP-FLAGS" );
1686 dumpString( "printer-settings-rel-id" );
1690 dumpDec
< double >( "x-split-pos" );
1691 dumpDec
< double >( "y-split-pos" );
1692 dumpAddress( "second-top-left" );
1693 dumpDec
< sal_Int32
>( "active-pane", "PANE-ID" );
1694 dumpHex
< sal_uInt8
>( "flags", "PANE-FLAGS" );
1697 case OOBIN_ID_PCDEFINITION
:
1699 dumpDec
< sal_uInt8
>( "refreshed-version" );
1700 dumpDec
< sal_uInt8
>( "min-refresh-version" );
1701 dumpDec
< sal_uInt8
>( "created-version" );
1702 dumpHex
< sal_uInt8
>( "flags-1", "PCDEFINITION-FLAGS1" );
1703 dumpDec
< sal_Int32
>( "missing-items-limit", "PCDEFINITION-MISSINGITEMS" );
1704 dumpDec
< double >( "refreshed-date" );
1705 sal_uInt8 nFlags2
= dumpHex
< sal_uInt8
>( "flags-2", "PCDEFINITION-FLAGS2" );
1706 dumpDec
< sal_Int32
>( "record-count" );
1707 if( nFlags2
& 0x01 ) dumpString( "refreshed-by" );
1708 if( nFlags2
& 0x02 ) dumpString( "rel-id" );
1712 case OOBIN_ID_PCDFIELD
:
1714 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "PCDFIELD-FLAGS" );
1715 dumpDec
< sal_Int32
>( "numfmt-id" );
1716 dumpDec
< sal_Int16
>( "sql-datatype" );
1717 dumpDec
< sal_Int32
>( "hierarchy" );
1718 dumpDec
< sal_Int32
>( "hierarchy-level" );
1719 sal_Int32 nMappingCount
= dumpDec
< sal_Int32
>( "property-mapping-count" );
1720 dumpString( "name" );
1721 if( nFlags
& 0x0008 ) dumpString( "caption" );
1722 if( nFlags
& 0x0100 ) mxFmlaObj
->dumpNameFormula( "formula" );
1723 if( nMappingCount
> 0 )
1725 sal_Int32 nBytes
= dumpDec
< sal_Int32
>( "property-mapping-size" );
1726 dumpArray( "property-mapping-indexes", nBytes
);
1728 if( nFlags
& 0x0200 ) dumpString( "property-name" );
1732 case OOBIN_ID_PCDFIELDGROUP
:
1733 dumpDec
< sal_Int32
>( "parent-field" );
1734 dumpDec
< sal_Int32
>( "base-field" );
1737 case OOBIN_ID_PCDFRANGEPR
:
1738 dumpDec
< sal_uInt8
>( "group-by", "PCDFRANGEPR-GROUPBY" );
1739 dumpHex
< sal_uInt8
>( "flags", "PCDFRANGEPR-FLAGS" );
1740 dumpDec
< double >( "start-value" );
1741 dumpDec
< double >( "end-value" );
1742 dumpDec
< double >( "interval" );
1745 case OOBIN_ID_PCDFSHAREDITEMS
:
1747 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "PCDFSHAREDITEMS-FLAGS" );
1748 dumpDec
< sal_Int32
>( "count" );
1749 if( nFlags
& 0x0100 ) dumpDec
< double >( "min-value" );
1750 if( nFlags
& 0x0100 ) dumpDec
< double >( "max-value" );
1754 case OOBIN_ID_PCDSHEETSOURCE
:
1756 sal_uInt8 nIsDefName
= dumpBoolean( "is-def-name" );
1757 dumpBoolean( "is-builtin-def-name" );
1758 sal_uInt8 nFlags
= dumpHex
< sal_uInt8
>( "flags", "PCDWORKSHEETSOURCE-FLAGS" );
1759 if( nFlags
& 0x02 ) dumpString( "sheet-name" );
1760 if( nFlags
& 0x01 ) dumpString( "rel-id" );
1761 if( nIsDefName
== 0 ) dumpRange(); else dumpString( "def-name" );
1765 case OOBIN_ID_PCDSOURCE
:
1766 dumpDec
< sal_Int32
>( "source-type", "PCDSOURCE-TYPE" );
1767 dumpDec
< sal_Int32
>( "connection-id" );
1770 case OOBIN_ID_PCITEM_ARRAY
:
1772 sal_uInt16 nType
= dumpDec
< sal_uInt16
>( "type", "PCITEM_ARRAY-TYPE" );
1773 sal_Int32 nCount
= dumpDec
< sal_Int32
>( "count" );
1774 out().resetItemIndex();
1775 for( sal_Int32 nIdx
= 0; nIdx
< nCount
; ++nIdx
)
1779 case 1: dumpDec
< double >( "#value" ); break;
1780 case 2: dumpString( "#value" ); break;
1781 case 16: dumpErrorCode( "#value" ); break;
1782 case 32: dumpPivotDateTime( "#value" ); break;
1783 default: nIdx
= nCount
;
1789 case OOBIN_ID_PCITEM_BOOL
:
1790 dumpBoolean( "value" );
1793 case OOBIN_ID_PCITEM_DATE
:
1794 dumpPivotDateTime( "value" );
1797 case OOBIN_ID_PCITEM_DOUBLE
:
1798 dumpDec
< double >( "value" );
1799 // TODO: server formatting
1802 case OOBIN_ID_PCITEM_ERROR
:
1803 dumpErrorCode( "value" );
1804 // TODO: server formatting
1807 case OOBIN_ID_PCITEM_INDEX
:
1808 dumpDec
< sal_Int32
>( "index" );
1811 case OOBIN_ID_PCITEM_MISSING
:
1812 // TODO: server formatting
1816 case OOBIN_ID_PCITEM_STRING
:
1817 dumpString( "value" );
1818 // TODO: server formatting
1821 case OOBIN_ID_PCITEMA_BOOL
:
1822 dumpBoolean( "value" );
1823 // TODO: additional info
1826 case OOBIN_ID_PCITEMA_DATE
:
1827 dumpPivotDateTime( "value" );
1828 // TODO: additional info
1831 case OOBIN_ID_PCITEMA_DOUBLE
:
1832 dumpDec
< double >( "value" );
1833 // TODO: additional info
1836 case OOBIN_ID_PCITEMA_ERROR
:
1837 dumpErrorCode( "value" );
1838 // TODO: additional info
1841 case OOBIN_ID_PCITEMA_MISSING
:
1842 // TODO: additional info
1845 case OOBIN_ID_PCITEMA_STRING
:
1846 dumpString( "value" );
1847 // TODO: additional info
1850 case OOBIN_ID_PHONETICPR
:
1851 dumpDec
< sal_uInt16
>( "font-id", "FONTNAMES" );
1852 dumpDec
< sal_Int32
>( "type", "PHONETICPR-TYPE" );
1853 dumpDec
< sal_Int32
>( "alignment", "PHONETICPR-ALIGNMENT" );
1856 case OOBIN_ID_PICTURE
:
1857 dumpString( "rel-id" );
1860 case OOBIN_ID_PIVOTAREA
:
1861 dumpDec
< sal_Int32
>( "field" );
1862 dumpDec
< sal_uInt8
>( "type", "PIVOTAREA-TYPE" );
1863 dumpHex
< sal_uInt8
>( "flags-1", "PIVOTAREA-FLAGS1" );
1864 dumpHex
< sal_uInt16
>( "flags-2", "PIVOTAREA-FLAGS2" );
1867 case OOBIN_ID_PIVOTCACHE
:
1868 dumpDec
< sal_Int32
>( "cache-id" );
1869 dumpString( "rel-id" );
1872 case OOBIN_ID_PTCOLFIELDS
:
1873 dumpDec
< sal_Int32
>( "count" );
1874 out().resetItemIndex();
1875 while( in().getRemaining() >= 4 )
1876 dumpDec
< sal_Int32
>( "#field", "PT-FIELDINDEX" );
1879 case OOBIN_ID_PTDATAFIELD
:
1880 dumpDec
< sal_Int32
>( "field" );
1881 dumpDec
< sal_Int32
>( "subtotal", "PTDATAFIELD-SUBTOTAL" );
1882 dumpDec
< sal_Int32
>( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
1883 dumpDec
< sal_Int32
>( "base-field" );
1884 dumpDec
< sal_Int32
>( "base-item", "PTDATAFIELD-BASEITEM" );
1885 dumpDec
< sal_Int32
>( "number-format" );
1886 if( dumpBool
< sal_uInt8
>( "has-name" ) )
1887 dumpString( "name" );
1890 case OOBIN_ID_PTDEFINITION
:
1892 dumpDec
< sal_uInt8
>( "created-version" );
1893 dumpHex
< sal_uInt8
>( "flags-1", "PTDEFINITION-FLAGS1" );
1894 dumpHex
< sal_uInt16
>( "flags-2", "PTDEFINITION-FLAGS2" );
1895 sal_uInt32 nFlags3
= dumpHex
< sal_uInt32
>( "flags-3", "PTDEFINITION-FLAGS3" );
1896 sal_uInt32 nFlags4
= dumpHex
< sal_uInt32
>( "flags-4", "PTDEFINITION-FLAGS4" );
1897 dumpDec
< sal_uInt8
>( "datafield-axis", "PTDEFINITION-DATAFIELD-AXIS" );
1898 dumpDec
< sal_uInt8
>( "page-wrap" );
1899 dumpDec
< sal_uInt8
>( "refreshed-version" );
1900 dumpDec
< sal_uInt8
>( "min-refresh-version" );
1901 dumpDec
< sal_Int32
>( "datafield-position", "PTDEFINITION-DATAFIELD-POS" );
1902 dumpDec
< sal_Int16
>( "autoformat-id" );
1904 dumpDec
< sal_Int32
>( "next-chart-id" );
1905 dumpDec
< sal_Int32
>( "cache-id" );
1906 dumpString( "name" );
1907 if( nFlags3
& 0x00080000 ) dumpString( "data-caption" );
1908 if( nFlags3
& 0x00100000 ) dumpString( "grand-total-caption" );
1909 if( (nFlags4
& 0x00000040) == 0 ) dumpString( "error-caption" );
1910 if( (nFlags4
& 0x00000080) == 0 ) dumpString( "missing-caption" );
1911 if( nFlags3
& 0x00200000 ) dumpString( "page-field-style" );
1912 if( nFlags3
& 0x00400000 ) dumpString( "pivot-table-style" );
1913 if( nFlags3
& 0x00800000 ) dumpString( "vacated-style" );
1914 if( nFlags3
& 0x40000000 ) dumpString( "tag" );
1915 if( nFlags4
& 0x00000800 ) dumpString( "col-header-caption" );
1916 if( nFlags4
& 0x00000400 ) dumpString( "row-header-caption" );
1920 case OOBIN_ID_PTFIELD
:
1921 dumpHex
< sal_uInt32
>( "flags-1", "PTFIELD-FLAGS1" );
1922 dumpDec
< sal_Int32
>( "num-fmt" );
1923 dumpHex
< sal_uInt32
>( "flags-2", "PTFIELD-FLAGS2" );
1924 dumpDec
< sal_Int32
>( "autoshow-items" );
1925 dumpDec
< sal_Int32
>( "autoshow-datafield-idx" );
1928 case OOBIN_ID_PTFILTER
:
1930 dumpDec
< sal_Int32
>( "field" );
1931 dumpDec
< sal_Int32
>( "member-prop-field" );
1932 dumpDec
< sal_Int32
>( "type", "PTFILTER-TYPE" );
1934 dumpDec
< sal_Int32
>( "unique-id" );
1935 dumpDec
< sal_Int32
>( "measure-data-field" );
1936 dumpDec
< sal_Int32
>( "measure-data-hierarchy" );
1937 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "PTFILTER-FLAGS" );
1938 if( nFlags
& 0x0001 ) dumpString( "name" );
1939 if( nFlags
& 0x0002 ) dumpString( "description" );
1940 if( nFlags
& 0x0004 ) dumpString( "str-value1" );
1941 if( nFlags
& 0x0008 ) dumpString( "str-value2" );
1945 case OOBIN_ID_PTFITEM
:
1947 dumpDec
< sal_uInt8
>( "type", "PTFITEM-TYPE" );
1948 sal_uInt16 nFlags
= dumpHex
< sal_uInt16
>( "flags", "PTFITEM-FLAGS" );
1949 dumpDec
< sal_Int32
>( "cache-idx" );
1950 if( nFlags
& 0x0010 ) dumpString( "display-name" );
1954 case OOBIN_ID_PTLOCATION
:
1955 dumpRange( "location" );
1956 dumpDec
< sal_Int32
>( "first-header-row" );
1957 dumpDec
< sal_Int32
>( "first-data-row" );
1958 dumpDec
< sal_Int32
>( "first-data-col" );
1959 dumpDec
< sal_Int32
>( "page-row-count" );
1960 dumpDec
< sal_Int32
>( "page-col-count" );
1963 case OOBIN_ID_PTPAGEFIELD
:
1965 dumpDec
< sal_Int32
>( "field" );
1966 dumpDec
< sal_Int32
>( "cache-item", "PTPAGEFIELD-ITEM" );
1967 dumpDec
< sal_Int32
>( "olap-hierarchy" );
1968 sal_uInt8 nFlags
= dumpHex
< sal_uInt8
>( "flags", "PTPAGEFIELD-FLAGS" );
1969 if( nFlags
& 0x01 ) dumpString( "unique-name" );
1970 if( nFlags
& 0x02 ) dumpString( "olap-caption" );
1974 case OOBIN_ID_PTREFERENCE
:
1975 dumpDec
< sal_Int32
>( "field", "PT-FIELDINDEX" );
1976 dumpDec
< sal_Int32
>( "item-count" );
1977 dumpHex
< sal_uInt16
>( "flags-1", "PTREFERENCE-FLAGS1" );
1978 dumpHex
< sal_uInt8
>( "flags-2", "PTREFERENCE-FLAGS2" );
1981 case OOBIN_ID_PTROWFIELDS
:
1982 dumpDec
< sal_Int32
>( "count" );
1983 out().resetItemIndex();
1984 while( in().getRemaining() >= 4 )
1985 dumpDec
< sal_Int32
>( "#field", "PT-FIELDINDEX" );
1990 dumpDec
< sal_Int32
>( "custom-xf-id" );
1991 dumpDec
< sal_uInt16
>( "height", "CONV-TWIP-TO-PT" );
1992 dumpHex
< sal_uInt16
>( "flags", "ROW-FLAGS1" );
1993 dumpHex
< sal_uInt8
>( "flags", "ROW-FLAGS2" );
1994 out().resetItemIndex();
1995 for( sal_Int32 nSpan
= 0, nSpanCount
= dumpDec
< sal_Int32
>( "row-spans-count" ); !in().isEof() && (nSpan
< nSpanCount
); ++nSpan
)
1996 dumpRowRange( "#row-spans" );
1999 case OOBIN_ID_ROWBREAKS
:
2000 dumpDec
< sal_Int32
>( "count" );
2001 dumpDec
< sal_Int32
>( "manual-count" );
2004 case OOBIN_ID_SCENARIO
:
2005 dumpDec
< sal_uInt16
>( "cell-count" );
2006 // two longs instead of flag field
2007 dumpDec
< sal_Int32
>( "locked", "BOOLEAN" );
2008 dumpDec
< sal_Int32
>( "hidden", "BOOLEAN" );
2009 dumpString( "name" );
2010 dumpString( "comment" );
2011 dumpString( "user" );
2014 case OOBIN_ID_SCENARIOS
:
2015 dumpDec
< sal_uInt16
>( "selected" );
2016 dumpDec
< sal_uInt16
>( "shown" );
2017 dumpRangeList( "result-cells" );
2020 case OOBIN_ID_SELECTION
:
2021 dumpDec
< sal_Int32
>( "pane", "PANE-ID" );
2022 dumpAddress( "active-cell" );
2023 dumpDec
< sal_Int32
>( "active-cell-id" );
2024 dumpRangeList( "selection" );
2027 case OOBIN_ID_SHAREDFMLA
:
2028 dumpRange( "formula-range" );
2029 mxFmlaObj
->dumpCellFormula();
2032 case OOBIN_ID_SHEET
:
2033 dumpDec
< sal_Int32
>( "sheet-state", "SHEET-STATE" );
2034 dumpDec
< sal_Int32
>( "sheet-id" );
2035 dumpString( "rel-id" );
2036 dumpString( "sheet-name" );
2039 case OOBIN_ID_SHEETFORMATPR
:
2040 dumpDec
< sal_Int32
>( "default-col-width", "CONV-COLWIDTH" );
2041 dumpDec
< sal_uInt16
>( "base-col-width" );
2042 dumpDec
< sal_uInt16
>( "default-row-height", "CONV-TWIP-TO-PT" );
2043 dumpHex
< sal_uInt16
>( "flags", "SHEETFORMATPR-FLAGS" );
2044 dumpDec
< sal_uInt8
>( "max-row-outline" );
2045 dumpDec
< sal_uInt8
>( "max-col-outline" );
2048 case OOBIN_ID_SHEETPR
:
2049 dumpHex
< sal_uInt16
>( "flags1", "SHEETPR-FLAGS1" );
2050 dumpHex
< sal_uInt8
>( "flags2", "SHEETPR-FLAGS2" );
2051 dumpColor( "tab-color" );
2052 dumpAddress( "window-anchor" );
2053 dumpString( "codename" );
2056 case OOBIN_ID_SHEETPROTECTION
:
2057 dumpHex
< sal_uInt16
>( "password-hash" );
2058 // no flags field for all these boolean flags?!?
2059 dumpDec
< sal_Int32
>( "sheet-locked", "BOOLEAN" );
2060 dumpDec
< sal_Int32
>( "objects-locked", "BOOLEAN" );
2061 dumpDec
< sal_Int32
>( "scenarios-locked", "BOOLEAN" );
2062 dumpDec
< sal_Int32
>( "format-cells-locked", "BOOLEAN" );
2063 dumpDec
< sal_Int32
>( "format-columns-locked", "BOOLEAN" );
2064 dumpDec
< sal_Int32
>( "format-rows-locked", "BOOLEAN" );
2065 dumpDec
< sal_Int32
>( "insert-columns-locked", "BOOLEAN" );
2066 dumpDec
< sal_Int32
>( "insert-rows-locked", "BOOLEAN" );
2067 dumpDec
< sal_Int32
>( "insert-hyperlinks-locked", "BOOLEAN" );
2068 dumpDec
< sal_Int32
>( "delete-columns-locked", "BOOLEAN" );
2069 dumpDec
< sal_Int32
>( "delete-rows-locked", "BOOLEAN" );
2070 dumpDec
< sal_Int32
>( "select-locked-cells-locked", "BOOLEAN" );
2071 dumpDec
< sal_Int32
>( "sort-locked", "BOOLEAN" );
2072 dumpDec
< sal_Int32
>( "autofilter-locked", "BOOLEAN" );
2073 dumpDec
< sal_Int32
>( "pivot-tables-locked", "BOOLEAN" );
2074 dumpDec
< sal_Int32
>( "select-unlocked-cells-locked", "BOOLEAN" );
2077 case OOBIN_ID_SHEETVIEW
:
2078 dumpHex
< sal_uInt16
>( "flags", "SHEETVIEW-FLAGS" );
2079 dumpDec
< sal_Int32
>( "view-type", "SHEETVIEW-TYPE" );
2080 dumpAddress( "top-left" );
2081 dumpDec
< sal_Int32
>( "gridcolor-id", "PALETTE-COLORS" );
2082 dumpDec
< sal_uInt16
>( "zoom-scale", "CONV-PERCENT" );
2083 dumpDec
< sal_uInt16
>( "zoom-scale-normal", "CONV-PERCENT" );
2084 dumpDec
< sal_uInt16
>( "zoom-scale-sheet-layout", "CONV-PERCENT" );
2085 dumpDec
< sal_uInt16
>( "zoom-scale-page-layout", "CONV-PERCENT" );
2086 dumpDec
< sal_Int32
>( "workbookview-id" );
2090 dumpString( "string", true );
2094 dumpDec
< sal_Int32
>( "string-cell-count" );
2095 dumpDec
< sal_Int32
>( "sst-size" );
2098 case OOBIN_ID_TABLE
:
2100 dumpDec
< sal_Int32
>( "type", "TABLE-TYPE" );
2101 dumpDec
< sal_Int32
>( "id" );
2102 dumpDec
< sal_Int32
>( "header-rows" );
2103 dumpDec
< sal_Int32
>( "totals-rows" );
2104 dumpHex
< sal_uInt32
>( "flags", "TABLE-FLAGS" );
2105 dumpDec
< sal_Int32
>( "headerrow-dxf-id" );
2106 dumpDec
< sal_Int32
>( "data-dxf-id" );
2107 dumpDec
< sal_Int32
>( "totalsrow-dxf-id" );
2108 dumpDec
< sal_Int32
>( "table-border-dxf-id" );
2109 dumpDec
< sal_Int32
>( "headerrow-border-dxf-id" );
2110 dumpDec
< sal_Int32
>( "totalsrow-border-dxf-id" );
2111 dumpDec
< sal_Int32
>( "connection-id" );
2112 dumpString( "name" );
2113 dumpString( "display-name" );
2114 dumpString( "comment" );
2115 dumpString( "headerrow-cell-style" );
2116 dumpString( "data-cell-style" );
2117 dumpString( "totalsrow-cell-style" );
2120 case OOBIN_ID_TABLEPART
:
2121 dumpString( "rel-id" );
2124 case OOBIN_ID_TABLESTYLEINFO
:
2125 dumpHex
< sal_uInt16
>( "flags", "TABLESTYLEINFO-FLAGS" );
2126 dumpString( "style-name" );
2129 case OOBIN_ID_TOP10FILTER
:
2130 dumpHex
< sal_uInt8
>( "flags", "TOP10FILTER-FLAGS" );
2131 dumpDec
< double >( "value" );
2132 dumpDec
< double >( "cell-value" );
2135 case OOBIN_ID_VOLTYPEMAIN
:
2136 dumpString( "first" );
2139 case OOBIN_ID_VOLTYPESTP
:
2140 dumpString( "topic-value" );
2143 case OOBIN_ID_VOLTYPETR
:
2144 dumpAddress( "ref" );
2145 dumpDec
< sal_Int32
>( "sheet-id" );
2148 case OOBIN_ID_WORKBOOKPR
:
2149 dumpHex
< sal_uInt32
>( "flags", "WORKBBOKPR-FLAGS" );
2150 dumpDec
< sal_Int32
>( "default-theme-version" );
2151 dumpString( "codename" );
2154 case OOBIN_ID_WORKBOOKVIEW
:
2155 dumpDec
< sal_Int32
>( "x-window" );
2156 dumpDec
< sal_Int32
>( "y-window" );
2157 dumpDec
< sal_Int32
>( "win-width" );
2158 dumpDec
< sal_Int32
>( "win-height" );
2159 dumpDec
< sal_Int32
>( "tabbar-ratio" );
2160 dumpDec
< sal_Int32
>( "first-sheet" );
2161 dumpDec
< sal_Int32
>( "active-sheet" );
2162 dumpHex
< sal_uInt8
>( "flags", "WORKBOOKVIEW-FLAGS" );
2166 dumpDec
< sal_uInt16
>( "parent-xf-id" );
2167 dumpDec
< sal_uInt16
>( "numfmt-id" );
2168 dumpDec
< sal_uInt16
>( "font-id", "FONTNAMES" );
2169 dumpDec
< sal_uInt16
>( "fill-id" );
2170 dumpDec
< sal_uInt16
>( "border-id" );
2171 dumpHex
< sal_uInt32
>( "alignment", "XF-ALIGNMENT" );
2172 dumpHex
< sal_uInt16
>( "used-flags", "XF-USEDFLAGS" );
2177 void RecordStreamObject::dumpCellHeader( bool bWithColumn
)
2179 if( bWithColumn
) dumpColIndex();
2180 dumpHex
< sal_uInt32
>( "xf-id", "CELL-XFID" );
2183 // ============================================================================
2185 RootStorageObject::RootStorageObject( const DumperBase
& rParent
)
2187 StorageObjectBase::construct( rParent
);
2190 void RootStorageObject::implDumpStream( const BinaryInputStreamRef
& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
2192 OUString aExt
= InputOutputHelper::getFileNameExtension( rStrmName
);
2193 Reference
< XInputStream
> xInStrm
= InputOutputHelper::getXInputStream( *rxStrm
);
2195 aExt
.equalsIgnoreAsciiCaseAscii( "xlsb" ) ||
2196 aExt
.equalsIgnoreAsciiCaseAscii( "xlsm" ) ||
2197 aExt
.equalsIgnoreAsciiCaseAscii( "xlsx" ) ||
2198 aExt
.equalsIgnoreAsciiCaseAscii( "xltm" ) ||
2199 aExt
.equalsIgnoreAsciiCaseAscii( "xltx" ) )
2201 Dumper( getFactory(), xInStrm
, rSysFileName
).dump();
2204 aExt
.equalsIgnoreAsciiCaseAscii( "xla" ) ||
2205 aExt
.equalsIgnoreAsciiCaseAscii( "xlc" ) ||
2206 aExt
.equalsIgnoreAsciiCaseAscii( "xlm" ) ||
2207 aExt
.equalsIgnoreAsciiCaseAscii( "xls" ) ||
2208 aExt
.equalsIgnoreAsciiCaseAscii( "xlt" ) ||
2209 aExt
.equalsIgnoreAsciiCaseAscii( "xlw" ) )
2211 ::oox::dump::biff::Dumper( getFactory(), xInStrm
, rSysFileName
).dump();
2214 aExt
.equalsIgnoreAsciiCaseAscii( "pptx" ) ||
2215 aExt
.equalsIgnoreAsciiCaseAscii( "potx" ) )
2217 ::oox::dump::pptx::Dumper( getFactory(), xInStrm
, rSysFileName
).dump();
2220 aExt
.equalsIgnoreAsciiCaseAscii( "xml" ) ||
2221 aExt
.equalsIgnoreAsciiCaseAscii( "vml" ) ||
2222 aExt
.equalsIgnoreAsciiCaseAscii( "rels" ) )
2224 XmlStreamObject( *this, rxStrm
, rSysFileName
).dump();
2226 else if( aExt
.equalsIgnoreAsciiCaseAscii( "bin" ) )
2228 if( rStrgPath
.equalsAscii( "xl" ) && rStrmName
.equalsAscii( "vbaProject.bin" ) )
2230 StorageRef
xStrg( new OleStorage( getFactory(), xInStrm
, false ) );
2231 VbaProjectStorageObject( *this, xStrg
, rSysFileName
).dump();
2233 else if( rStrgPath
.equalsAscii( "xl/embeddings" ) )
2235 StorageRef
xStrg( new OleStorage( getFactory(), xInStrm
, false ) );
2236 OleStorageObject( *this, xStrg
, rSysFileName
).dump();
2239 rStrgPath
.equalsAscii( "xl" ) ||
2240 rStrgPath
.equalsAscii( "xl/chartsheets" ) ||
2241 rStrgPath
.equalsAscii( "xl/dialogsheets" ) ||
2242 rStrgPath
.equalsAscii( "xl/externalLinks" ) ||
2243 rStrgPath
.equalsAscii( "xl/macrosheets" ) ||
2244 rStrgPath
.equalsAscii( "xl/pivotCache" ) ||
2245 rStrgPath
.equalsAscii( "xl/pivotTables" ) ||
2246 rStrgPath
.equalsAscii( "xl/tables" ) ||
2247 rStrgPath
.equalsAscii( "xl/worksheets" ) )
2249 RecordStreamObject( *this, rxStrm
, rSysFileName
).dump();
2251 else if( rStrgPath
.equalsAscii( "xl/activeX" ) )
2253 OcxGuidControlObject( *this, rxStrm
, rSysFileName
).dump();
2257 BinaryStreamObject( *this, rxStrm
, rSysFileName
).dump();
2262 // ============================================================================
2264 #define DUMP_XLSB_CONFIG_ENVVAR "OOO_XLSBDUMPER"
2266 Dumper::Dumper( const FilterBase
& rFilter
)
2268 ConfigRef
xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR
, rFilter
) );
2269 DumperBase::construct( xCfg
);
2272 Dumper::Dumper( const Reference
< XMultiServiceFactory
>& rxFactory
, const Reference
< XInputStream
>& rxInStrm
, const OUString
& rSysFileName
)
2274 if( rxFactory
.is() && rxInStrm
.is() )
2276 StorageRef
xStrg( new ZipStorage( rxFactory
, rxInStrm
) );
2277 MediaDescriptor aMediaDesc
;
2278 ConfigRef
xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR
, rxFactory
, xStrg
, rSysFileName
, aMediaDesc
) );
2279 DumperBase::construct( xCfg
);
2283 void Dumper::implDump()
2285 RootStorageObject( *this ).dump();
2288 // ============================================================================