summaryrefslogtreecommitdiff
path: root/oox/source/dump
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/dump')
-rw-r--r--oox/source/dump/biffdumper.cxx4554
-rw-r--r--oox/source/dump/biffdumper.ini2378
-rw-r--r--oox/source/dump/dffdumper.cxx324
-rw-r--r--oox/source/dump/dffdumper.ini650
-rw-r--r--oox/source/dump/dumperbase.cxx3217
-rw-r--r--oox/source/dump/dumperbase.ini395
-rw-r--r--oox/source/dump/makefile.mk53
-rw-r--r--oox/source/dump/oledumper.cxx2364
-rw-r--r--oox/source/dump/oledumper.ini887
-rw-r--r--oox/source/dump/pptxdumper.cxx150
-rw-r--r--oox/source/dump/pptxdumper.ini18
-rw-r--r--oox/source/dump/xlsbdumper.cxx2340
-rw-r--r--oox/source/dump/xlsbdumper.ini1186
13 files changed, 18516 insertions, 0 deletions
diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx
new file mode 100644
index 000000000000..546ad186e7ab
--- /dev/null
+++ b/oox/source/dump/biffdumper.cxx
@@ -0,0 +1,4554 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/biffdumper.hxx"
+
+#include <osl/thread.h>
+#include <rtl/tencinfo.h>
+#include "oox/core/filterbase.hxx"
+#include "oox/dump/oledumper.hxx"
+#include "oox/ole/olestorage.hxx"
+#include "oox/xls/biffdetector.hxx"
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/formulabase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace biff {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::oox::xls;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+namespace {
+
+// constants ------------------------------------------------------------------
+
+const sal_uInt16 BIFF_FONTFLAG_BOLD = 0x0001;
+const sal_uInt16 BIFF_FONTFLAG_ITALIC = 0x0002;
+
+const sal_uInt16 BIFF_OBJTYPE_GROUP = 0;
+const sal_uInt16 BIFF_OBJTYPE_LINE = 1;
+const sal_uInt16 BIFF_OBJTYPE_RECTANGLE = 2;
+const sal_uInt16 BIFF_OBJTYPE_OVAL = 3;
+const sal_uInt16 BIFF_OBJTYPE_ARC = 4;
+const sal_uInt16 BIFF_OBJTYPE_CHART = 5;
+const sal_uInt16 BIFF_OBJTYPE_TEXT = 6;
+const sal_uInt16 BIFF_OBJTYPE_BUTTON = 7;
+const sal_uInt16 BIFF_OBJTYPE_PICTURE = 8;
+const sal_uInt16 BIFF_OBJTYPE_POLYGON = 9;
+const sal_uInt16 BIFF_OBJTYPE_CHECKBOX = 11;
+const sal_uInt16 BIFF_OBJTYPE_OPTIONBUTTON = 12;
+const sal_uInt16 BIFF_OBJTYPE_EDIT = 13;
+const sal_uInt16 BIFF_OBJTYPE_LABEL = 14;
+const sal_uInt16 BIFF_OBJTYPE_DIALOG = 15;
+const sal_uInt16 BIFF_OBJTYPE_SPIN = 16;
+const sal_uInt16 BIFF_OBJTYPE_SCROLLBAR = 17;
+const sal_uInt16 BIFF_OBJTYPE_LISTBOX = 18;
+const sal_uInt16 BIFF_OBJTYPE_GROUPBOX = 19;
+const sal_uInt16 BIFF_OBJTYPE_DROPDOWN = 20;
+const sal_uInt16 BIFF_OBJTYPE_NOTE = 25;
+const sal_uInt16 BIFF_OBJTYPE_DRAWING = 30;
+
+const sal_uInt16 BIFF_OBJFLAGS_CONTROL = 0x0010; /// Form control.
+const sal_uInt16 BIFF_OBJFLAGS_CTLSSTREAM = 0x0020; /// Data in Ctls stream.
+
+const sal_uInt16 BIFF_STYLE_BUILTIN = 0x8000;
+
+const sal_uInt16 BIFF_PT_NOSTRING = 0xFFFF;
+
+// ----------------------------------------------------------------------------
+
+void lclDumpDffClientPos( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm, const String& rName, sal_uInt16 nSubScale )
+{
+ MultiItemsGuard aMultiGuard( rxOut );
+ TableGuard aTabGuard( rxOut, 17 );
+ {
+ sal_uInt16 nPos = rxStrm->readuInt16();
+ ItemGuard aItem( rxOut, rName );
+ rxOut->writeDec( nPos );
+ }
+ {
+ sal_uInt16 nSubUnits = rxStrm->readuInt16();
+ ItemGuard aItem( rxOut, "sub-units" );
+ rxOut->writeDec( nSubUnits );
+ rxOut->writeChar( '/' );
+ rxOut->writeDec( nSubScale );
+ }
+}
+
+void lclDumpDffClientRect( const OutputRef& rxOut, const BinaryInputStreamRef& rxStrm )
+{
+ lclDumpDffClientPos( rxOut, rxStrm, "start-col", 1024 );
+ lclDumpDffClientPos( rxOut, rxStrm, "start-row", 256 );
+ lclDumpDffClientPos( rxOut, rxStrm, "end-col", 1024 );
+ lclDumpDffClientPos( rxOut, rxStrm, "end-row", 256 );
+}
+
+} // namespace
+
+// ============================================================================
+// ============================================================================
+
+BiffDffStreamObject::BiffDffStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
+{
+ DffStreamObject::construct( rParent, rxStrm );
+}
+
+void BiffDffStreamObject::implDumpClientAnchor()
+{
+ dumpHex< sal_uInt16 >( "flags", "DFF-CLIENTANCHOR-FLAGS" );
+ lclDumpDffClientRect( mxOut, mxStrm );
+}
+
+// ============================================================================
+
+BiffCtlsStreamObject::BiffCtlsStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
+{
+ InputObjectBase::construct( rParent, rxStrm );
+ mnStartPos = mnLength = 0;
+}
+
+void BiffCtlsStreamObject::dumpControl( sal_uInt32 nStartPos, sal_uInt32 nLength )
+{
+ mnStartPos = nStartPos;
+ mnLength = nLength;
+ dump();
+ mnStartPos = mnLength = 0;
+}
+
+void BiffCtlsStreamObject::implDump()
+{
+ if( mnLength > 0 )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "CTLS-START" );
+ {
+ IndentGuard aIndGuard( mxOut );
+ mxStrm->seek( mnStartPos );
+ RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, mnLength ) );
+ FormControlStreamObject( *this, xRelStrm ).dump();
+ }
+ writeEmptyItem( "CTLS-END" );
+ mxOut->emptyLine();
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+BiffConfig::BiffConfig( const Config& rParent, BiffType eBiff ) :
+ meBiff( eBiff )
+{
+ Config::construct( rParent );
+}
+
+bool BiffConfig::implIsValid() const
+{
+ return (meBiff != BIFF_UNKNOWN) && Config::implIsValid();
+}
+
+NameListRef BiffConfig::implGetNameList( const OUString& rKey ) const
+{
+ NameListRef xList = Config::implGetNameList( rKey );
+ if( !xList )
+ {
+ OUString aBaseKey = rKey + CREATE_OUSTRING( "-BIFF" );
+ switch( meBiff )
+ {
+ // fall-through intended!
+ case BIFF8: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '8' ) ) );
+ case BIFF5: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '5' ) ) );
+ case BIFF4: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '4' ) ) );
+ case BIFF3: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '3' ) ) );
+ case BIFF2: if( !xList ) xList = Config::implGetNameList( aBaseKey + OUString( sal_Unicode( '2' ) ) );
+ case BIFF_UNKNOWN: break;
+ }
+ }
+ return xList;
+}
+
+// ============================================================================
+
+BiffSharedData::BiffSharedData( BiffType eBiff ) :
+ meBiff( eBiff ),
+ meTextEnc( osl_getThreadTextEncoding() )
+{
+}
+
+void BiffSharedData::initializePerSheet()
+{
+ maFontEncs.clear();
+ maXfFontIds.clear();
+ meTextEnc = osl_getThreadTextEncoding();
+}
+
+void BiffSharedData::setTextEncoding( rtl_TextEncoding eTextEnc )
+{
+ if( eTextEnc != RTL_TEXTENCODING_DONTKNOW )
+ meTextEnc = eTextEnc;
+}
+
+sal_uInt16 BiffSharedData::getFontCount() const
+{
+ return static_cast< sal_uInt16 >( maFontEncs.size() );
+}
+
+rtl_TextEncoding BiffSharedData::getFontEncoding( sal_uInt16 nFontId ) const
+{
+ return (nFontId < getFontCount()) ? maFontEncs[ nFontId ] : meTextEnc;
+}
+
+void BiffSharedData::appendFontEncoding( rtl_TextEncoding eFontEnc )
+{
+ maFontEncs.push_back( (eFontEnc == RTL_TEXTENCODING_DONTKNOW) ? meTextEnc : eFontEnc );
+ if( maFontEncs.size() == 4 )
+ maFontEncs.push_back( meTextEnc );
+}
+
+sal_uInt16 BiffSharedData::getXfCount() const
+{
+ return static_cast< sal_uInt16 >( maXfFontIds.size() );
+}
+
+rtl_TextEncoding BiffSharedData::getXfEncoding( sal_uInt16 nXfId ) const
+{
+ sal_uInt16 nFontId = (nXfId < getXfCount()) ? maXfFontIds[ nXfId ] : 0;
+ return getFontEncoding( nFontId );
+}
+
+void BiffSharedData::appendXfFontId( sal_uInt16 nFontId )
+{
+ maXfFontIds.push_back( nFontId );
+}
+
+bool BiffSharedData::implIsValid() const
+{
+ return meBiff != BIFF_UNKNOWN;
+}
+
+// ============================================================================
+
+BiffObjectBase::~BiffObjectBase()
+{
+}
+
+void BiffObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
+{
+ if( rParent.isValid() && rxStrm.get() && (eBiff != BIFF_UNKNOWN) )
+ {
+ mxBiffData.reset( new BiffSharedData( eBiff ) );
+ mxBiffStrm.reset( new BiffInputStream( *rxStrm ) );
+ RecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
+ if( RecordObjectBase::implIsValid() )
+ {
+ reconstructConfig( ConfigRef( new BiffConfig( cfg(), eBiff ) ) );
+ mxDffObj.reset( new BiffDffStreamObject( *this, mxBiffStrm ) );
+ if( StorageBase* pRootStrg = cfg().getRootStorage().get() )
+ {
+ BinaryInputStreamRef xCtlsStrm( new BinaryXInputStream( pRootStrg->openInputStream( CREATE_OUSTRING( "Ctls" ) ), true ) );
+ mxCtlsObj.reset( new BiffCtlsStreamObject( *this, xCtlsStrm ) );
+ }
+ const Config& rCfg = cfg();
+ mxErrCodes = rCfg.getNameList( "ERRORCODES" );
+ mxConstType = rCfg.getNameList( "CONSTVALUE-TYPE" );
+ mxResultType = rCfg.getNameList( "FORMULA-RESULTTYPE" );
+ mnLastRecId = BIFF_ID_UNKNOWN;
+ mbMergeContRec = rCfg.getBoolOption( "merge-continue-record", true );
+ }
+ }
+}
+
+void BiffObjectBase::construct( const BiffObjectBase& rParent )
+{
+ *this = rParent;
+}
+
+bool BiffObjectBase::implIsValid() const
+{
+ return isValid( mxBiffData ) && mxBiffStrm.get() && isValid( mxDffObj ) && InputObjectBase::implIsValid();
+}
+
+bool BiffObjectBase::implStartRecord( BinaryInputStream&, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+ // previous record
+ mnLastRecId = mxBiffStrm->getRecId();
+ switch( mnLastRecId )
+ {
+ case BIFF_ID_CHBEGIN:
+ mxOut->incIndent();
+ break;
+ }
+
+ // start next record
+ bool bValid = mxBiffStrm->startNextRecord();
+ ornRecPos = mxBiffStrm->tellBase() - 4;
+ ornRecId = mxBiffStrm->getRecId();
+
+ // special CONTINUE handling
+ mxBiffStrm->resetRecord( mbMergeContRec );
+ if( mbMergeContRec ) switch( mxBiffStrm->getRecId() )
+ {
+ case BIFF_ID_OBJ:
+ case BIFF_ID_TXO:
+ case BIFF_ID_EOF:
+ case BIFF_ID_CONT:
+ mxBiffStrm->resetRecord( false );
+ break;
+ case BIFF_ID_MSODRAWINGGROUP:
+ case BIFF_ID_CHESCHERFORMAT:
+ mxBiffStrm->resetRecord( true, mxBiffStrm->getRecId() );
+ break;
+ }
+
+ // record specific settings
+ switch( mxBiffStrm->getRecId() )
+ {
+ case BIFF2_ID_BOF:
+ case BIFF3_ID_BOF:
+ case BIFF4_ID_BOF:
+ case BIFF5_ID_BOF:
+ case BIFF_ID_INTERFACEHDR:
+ mxBiffStrm->enableDecoder( false );
+ break;
+ case BIFF_ID_CHEND:
+ mxOut->decIndent();
+ break;
+ }
+
+ ornRecSize = mxBiffStrm->getLength();
+ return bValid;
+}
+
+OUString BiffObjectBase::getErrorName( sal_uInt8 nErrCode ) const
+{
+ return cfg().getName( mxErrCodes, nErrCode );
+}
+
+// ----------------------------------------------------------------------------
+
+sal_Int32 BiffObjectBase::readCol( bool bCol16Bit )
+{
+ return bCol16Bit ? mxBiffStrm->readuInt16() : mxBiffStrm->readuInt8();
+}
+
+sal_Int32 BiffObjectBase::readRow( bool bRow32Bit )
+{
+ return bRow32Bit ? mxBiffStrm->readInt32() : mxBiffStrm->readuInt16();
+}
+
+void BiffObjectBase::readAddress( Address& orAddress, bool bCol16Bit, bool bRow32Bit )
+{
+ orAddress.mnRow = readRow( bRow32Bit );
+ orAddress.mnCol = readCol( bCol16Bit );
+}
+
+void BiffObjectBase::readRange( Range& orRange, bool bCol16Bit, bool bRow32Bit )
+{
+ orRange.maFirst.mnRow = readRow( bRow32Bit );
+ orRange.maLast.mnRow = readRow( bRow32Bit );
+ orRange.maFirst.mnCol = readCol( bCol16Bit );
+ orRange.maLast.mnCol = readCol( bCol16Bit );
+}
+
+void BiffObjectBase::readRangeList( RangeList& orRanges, bool bCol16Bit, bool bRow32Bit )
+{
+ sal_uInt16 nCount;
+ *mxBiffStrm >> nCount;
+ orRanges.resize( nCount );
+ for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxBiffStrm->isEof() && (aIt != aEnd); ++aIt )
+ readRange( *aIt, bCol16Bit, bRow32Bit );
+}
+
+// ----------------------------------------------------------------------------
+
+void BiffObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
+{
+ writeDecItem( rName, nBool, "BOOLEAN" );
+}
+
+void BiffObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
+{
+ writeHexItem( rName, nErrCode, mxErrCodes );
+}
+
+void BiffObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
+{
+ if( !rPortions.empty() )
+ {
+ writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
+ TableGuard aTabGuard( mxOut, 14 );
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeDecItem( "char-pos", aIt->mnPos );
+ writeDecItem( "font-idx", aIt->mnFontId, "FONTNAMES" );
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+OUString BiffObjectBase::dumpByteString( const String& rName, BiffStringFlags nFlags, rtl_TextEncoding eDefaultTextEnc )
+{
+ OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_EXTRAFONTS) ) ), "BiffObjectBase::dumpByteString - unknown flag" );
+ bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
+
+ OString aString = mxBiffStrm->readByteString( !b8BitLength, true );
+ FontPortionModelList aPortions;
+ if( getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
+ aPortions.importPortions( *mxBiffStrm, false );
+
+ // create string portions
+ OUStringBuffer aBuffer;
+ sal_Int32 nStrLen = aString.getLength();
+ if( nStrLen > 0 )
+ {
+ // add leading and trailing string position to ease the following loop
+ if( aPortions.empty() || (aPortions.front().mnPos > 0) )
+ aPortions.insert( aPortions.begin(), FontPortionModel( 0, -1 ) );
+ if( aPortions.back().mnPos < nStrLen )
+ aPortions.push_back( FontPortionModel( nStrLen, -1 ) );
+
+ // use global text encoding, if nothing special is specified
+ if( eDefaultTextEnc == RTL_TEXTENCODING_DONTKNOW )
+ eDefaultTextEnc = getBiffData().getTextEncoding();
+
+ // create all string portions according to the font id vector
+ for( FontPortionModelList::const_iterator aIt = aPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ {
+ sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
+ if( nPortionLen > 0 )
+ {
+ // convert byte string to unicode string, using current font encoding
+ rtl_TextEncoding eTextEnc = mxBiffData->getFontEncoding( static_cast< sal_uInt16 >( aIt->mnFontId ) );
+ if( eTextEnc == RTL_TEXTENCODING_DONTKNOW )
+ eTextEnc = eDefaultTextEnc;
+ aBuffer.append( OStringToOUString( aString.copy( aIt->mnPos, nPortionLen ), eTextEnc ) );
+ }
+ }
+ }
+
+ OUString aUniStr = aBuffer.makeStringAndClear();
+ writeStringItem( rName( "text" ), aUniStr );
+ return aUniStr;
+}
+
+OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFlags )
+{
+ OSL_ENSURE( !getFlag( nFlags, static_cast< BiffStringFlags >( ~(BIFF_STR_8BITLENGTH | BIFF_STR_SMARTFLAGS) ) ), "BiffObjectBase::dumpUniString - unknown flag" );
+ bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
+
+ // --- string header ---
+ sal_uInt16 nChars = b8BitLength ? mxBiffStrm->readuInt8() : mxBiffStrm->readuInt16();
+ sal_uInt8 nFlagField = 0;
+ if( (nChars > 0) || !getFlag( nFlags, BIFF_STR_SMARTFLAGS ) )
+ *mxBiffStrm >> nFlagField;
+ bool b16Bit = getFlag( nFlagField, BIFF_STRF_16BIT );
+ bool bFonts = getFlag( nFlagField, BIFF_STRF_RICH );
+ bool bPhonetic = getFlag( nFlagField, BIFF_STRF_PHONETIC );
+ sal_uInt16 nFontCount = bFonts ? mxBiffStrm->readuInt16() : 0;
+ sal_uInt32 nPhoneticSize = bPhonetic ? mxBiffStrm->readuInt32() : 0;
+
+ // --- character array ---
+ OUString aString = mxBiffStrm->readUniStringChars( nChars, b16Bit, true );
+ writeStringItem( rName( "text" ), aString );
+
+ // --- formatting ---
+ // #122185# bRich flag may be set, but format runs may be missing
+ if( nFontCount > 0 )
+ {
+ IndentGuard aIndGuard( mxOut );
+ FontPortionModelList aPortions;
+ aPortions.importPortions( *mxBiffStrm, nFontCount, BIFF_FONTPORTION_16BIT );
+ writeFontPortions( aPortions );
+ }
+
+ // --- phonetic information ---
+ // #122185# bPhonetic flag may be set, but phonetic data may be missing
+ if( nPhoneticSize > 0 )
+ {
+ sal_Int64 nStrmPos = mxBiffStrm->tell();
+ IndentGuard aIndGuard( mxOut );
+ writeEmptyItem( "phonetic-data" );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "size" );
+ dumpDec< sal_uInt16 >( "font-idx", "FONTNAMES" );
+ dumpHex< sal_uInt16 >( "flags", "PHONETICPR-FLAGS" );
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "portion-count" );
+ sal_uInt16 nLen = dumpDec< sal_uInt16 >( "text-len" );
+ dumpUnicodeArray( "text", mxBiffStrm->readuInt16() );
+ if( nLen == 0 ) dumpUnused( 2 );
+ for( sal_uInt16 nPortion = 0; !mxBiffStrm->isEof() && (nPortion < nCount); ++nPortion )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ dumpDec< sal_uInt16 >( "first-portion-char" );
+ dumpDec< sal_uInt16 >( "first-main-char" );
+ dumpDec< sal_uInt16 >( "main-char-count" );
+ }
+ dumpRemainingTo( nStrmPos + nPhoneticSize );
+ }
+
+ return aString;
+}
+
+OUString BiffObjectBase::dumpString( const String& rName, BiffStringFlags nByteFlags, BiffStringFlags nUniFlags, rtl_TextEncoding eDefaultTextEnc )
+{
+ return (getBiff() == BIFF8) ? dumpUniString( rName, nUniFlags ) : dumpByteString( rName, nByteFlags, eDefaultTextEnc );
+}
+
+OUString BiffObjectBase::dumpSegmentedUniString( const String& rName )
+{
+ sal_Int32 nLength = mxBiffStrm->readInt32();
+ OUStringBuffer aBuffer;
+ while( !mxBiffStrm->isEof() && (aBuffer.getLength() < nLength) )
+ aBuffer.append( mxBiffStrm->readUniString() );
+ OUString aString = aBuffer.makeStringAndClear();
+ writeStringItem( rName, aString );
+ return aString;
+}
+
+void BiffObjectBase::dumpSegmentedUniStringArray( const String& rName )
+{
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "count" ); !mxBiffStrm->isEof() && (nIndex < nCount); ++nIndex )
+ dumpSegmentedUniString( "#entry" );
+}
+
+sal_uInt8 BiffObjectBase::dumpBoolean( const String& rName )
+{
+ sal_uInt8 nBool;
+ *mxBiffStrm >> nBool;
+ writeBooleanItem( rName( "boolean" ), nBool );
+ return nBool;
+}
+
+sal_uInt8 BiffObjectBase::dumpErrorCode( const String& rName )
+{
+ sal_uInt8 nErrCode;
+ *mxBiffStrm >> nErrCode;
+ writeErrorCodeItem( rName( "error-code" ), nErrCode );
+ return nErrCode;
+}
+
+rtl_TextEncoding BiffObjectBase::dumpCodePage( const String& rName )
+{
+ sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( rName( "codepage" ), "CODEPAGES" );
+ return BiffHelper::calcTextEncodingFromCodePage( nCodePage );
+}
+
+void BiffObjectBase::dumpFormulaResult( const String& rName )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ sal_uInt8 pnResult[ 8 ];
+ mxBiffStrm->readMemory( pnResult, 8 );
+ writeArrayItem( rName( "result" ), pnResult, 8 );
+ if( (pnResult[ 6 ] == 0xFF) && (pnResult[ 7 ] == 0xFF) )
+ {
+ sal_uInt8 nType = pnResult[ 0 ];
+ sal_uInt8 nData = pnResult[ 2 ];
+ writeHexItem( "type", nType, mxResultType );
+ switch( nType )
+ {
+ case 1: writeBooleanItem( "value", nData ); break;
+ case 2: writeErrorCodeItem( "value", nData ); break;
+ }
+ }
+ else
+ {
+ double* pfValue = reinterpret_cast< double* >( pnResult );
+ ByteOrderConverter::convertLittleEndian( *pfValue );
+ writeDecItem( "value", *pfValue );
+ }
+}
+
+sal_Int32 BiffObjectBase::dumpColIndex( const String& rName, bool bCol16Bit )
+{
+ sal_Int32 nCol = readCol( bCol16Bit );
+ writeColIndexItem( rName( "col-idx" ), nCol );
+ return nCol;
+}
+
+sal_Int32 BiffObjectBase::dumpRowIndex( const String& rName, bool bRow32Bit )
+{
+ sal_Int32 nRow = readRow( bRow32Bit );
+ writeRowIndexItem( rName( "row-idx" ), nRow );
+ return nRow;
+}
+
+sal_Int32 BiffObjectBase::dumpColRange( const String& rName, bool bCol16Bit )
+{
+ sal_Int32 nCol1 = readCol( bCol16Bit );
+ sal_Int32 nCol2 = readCol( bCol16Bit );
+ writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
+ return nCol2 - nCol1 + 1;
+}
+
+sal_Int32 BiffObjectBase::dumpRowRange( const String& rName, bool bRow32Bit )
+{
+ sal_Int32 nRow1 = readRow( bRow32Bit );
+ sal_Int32 nRow2 = readRow( bRow32Bit );
+ writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
+ return nRow2 - nRow1 + 1;
+}
+
+Address BiffObjectBase::dumpAddress( const String& rName, bool bCol16Bit, bool bRow32Bit )
+{
+ Address aPos;
+ readAddress( aPos, bCol16Bit, bRow32Bit );
+ writeAddressItem( rName( "addr" ), aPos );
+ return aPos;
+}
+
+Range BiffObjectBase::dumpRange( const String& rName, bool bCol16Bit, bool bRow32Bit )
+{
+ Range aRange;
+ readRange( aRange, bCol16Bit, bRow32Bit );
+ writeRangeItem( rName( "range" ), aRange );
+ return aRange;
+}
+
+void BiffObjectBase::dumpRangeList( const String& rName, bool bCol16Bit, bool bRow32Bit )
+{
+ RangeList aRanges;
+ readRangeList( aRanges, bCol16Bit, bRow32Bit );
+ writeRangeListItem( rName( "range-list" ), aRanges );
+}
+
+void BiffObjectBase::dumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ rnCols = dumpDec< sal_uInt8 >( "width" );
+ rnRows = dumpDec< sal_uInt16 >( "height" );
+ switch( getBiff() )
+ {
+ case BIFF2:
+ case BIFF3:
+ case BIFF4:
+ case BIFF5: if( rnCols == 0 ) rnCols = 256; break;
+ case BIFF8: ++rnCols; ++rnRows; break;
+ case BIFF_UNKNOWN: break;
+ }
+ ItemGuard aItem( mxOut, "size" );
+ mxOut->writeDec( rnCols );
+ mxOut->writeChar( 'x' );
+ mxOut->writeDec( rnRows );
+ aItem.cont();
+ mxOut->writeDec( rnCols * rnRows );
+}
+
+OUString BiffObjectBase::dumpConstValue( sal_Unicode cStrQuote )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ OUStringBuffer aValue;
+ switch( dumpDec< sal_uInt8 >( "type", mxConstType ) )
+ {
+ case BIFF_DATATYPE_EMPTY:
+ dumpUnused( 8 );
+ aValue.append( OOX_DUMP_EMPTYVALUE );
+ break;
+ case BIFF_DATATYPE_DOUBLE:
+ dumpDec< double >( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ break;
+ case BIFF_DATATYPE_STRING:
+ aValue.append( dumpString( "value", BIFF_STR_8BITLENGTH ) );
+ StringHelper::enclose( aValue, cStrQuote );
+ break;
+ case BIFF_DATATYPE_BOOL:
+ dumpBoolean( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ dumpUnused( 7 );
+ break;
+ case BIFF_DATATYPE_ERROR:
+ dumpErrorCode( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ dumpUnused( 7 );
+ break;
+ }
+ return aValue.makeStringAndClear();
+}
+
+sal_uInt16 BiffObjectBase::dumpRepeatedRecId()
+{
+ return dumpHex< sal_uInt16 >( "repeated-rec-id", getRecNames() );
+}
+
+void BiffObjectBase::dumpFrHeader( bool bWithFlags, bool bWithRange )
+{
+ dumpHex< sal_uInt16 >( "fr-rec-id", getRecNames() );
+ sal_Int16 nFlags = bWithFlags ? dumpHex< sal_uInt16 >( "fr-flags", "FR-FLAGS" ) : 0x0001;
+ if( bWithRange )
+ {
+ if( getFlag< sal_uInt16 >( nFlags, 0x0001 ) )
+ dumpRange( "fr-range" );
+ else
+ dumpUnused( 8 );
+ }
+}
+
+void BiffObjectBase::dumpDffClientRect()
+{
+ lclDumpDffClientRect( mxOut, mxStrm );
+}
+
+void BiffObjectBase::dumpEmbeddedDff()
+{
+ mxOut->decIndent();
+ writeEmptyItem( "EMBEDDED-DFF-START" );
+ mxOut->incIndent();
+ mxDffObj->dump();
+ mxOut->emptyLine();
+ mxOut->decIndent();
+ writeEmptyItem( "EMBEDDED-DFF-END" );
+ mxOut->incIndent();
+}
+
+void BiffObjectBase::dumpControl()
+{
+ sal_uInt32 nStartPos = dumpHex< sal_uInt32 >( "ctls-stream-pos", "CONV-DEC" );
+ sal_uInt32 nLength = dumpHex< sal_uInt32 >( "ctls-stream-length", "CONV-DEC" );
+ if( isValid( mxCtlsObj ) )
+ mxCtlsObj->dumpControl( nStartPos, nLength );
+}
+
+// ============================================================================
+// ============================================================================
+
+FormulaObject::FormulaObject( const BiffObjectBase& rParent ) :
+ mnSize( 0 )
+{
+ BiffObjectBase::construct( rParent );
+ constructFmlaObj();
+}
+
+FormulaObject::~FormulaObject()
+{
+}
+
+sal_uInt16 FormulaObject::readFormulaSize()
+{
+ return (getBiff() == BIFF2) ? getBiffStream().readuInt8() : getBiffStream().readuInt16();
+}
+
+sal_uInt16 FormulaObject::dumpFormulaSize( const String& rName )
+{
+ sal_uInt16 nSize = readFormulaSize();
+ writeDecItem( rName( "formula-size" ), nSize );
+ return nSize;
+}
+
+void FormulaObject::dumpCellFormula( const String& rName, sal_uInt16 nSize )
+{
+ dumpFormula( rName, nSize, false );
+}
+
+void FormulaObject::dumpCellFormula( const String& rName )
+{
+ dumpFormula( rName, false );
+}
+
+void FormulaObject::dumpNameFormula( const String& rName, sal_uInt16 nSize )
+{
+ dumpFormula( rName, nSize, true );
+}
+
+void FormulaObject::dumpNameFormula( const String& rName )
+{
+ dumpFormula( rName, true );
+}
+
+void FormulaObject::implDump()
+{
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( maName );
+ writeDecItem( "formula-size", mnSize );
+ }
+ if( mnSize == 0 ) return;
+
+ sal_Int64 nStartPos = mxStrm->tell();
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() );
+
+ bool bValid = mxTokens.get();
+ mxStack.reset( new FormulaStack );
+ maAddData.clear();
+ IndentGuard aIndGuard( mxOut );
+ {
+ TableGuard aTabGuard( mxOut, 8, 18 );
+ while( bValid && !mxStrm->isEof() && (mxStrm->tell() < nEndPos) )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
+ sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
+ bValid = mxTokens->hasName( nTokenId );
+ if( bValid )
+ {
+ sal_uInt8 nTokClass = nTokenId & BIFF_TOKCLASS_MASK;
+ sal_uInt8 nBaseId = nTokenId & BIFF_TOKID_MASK;
+ if( nTokClass == BIFF_TOKCLASS_NONE )
+ {
+ switch( nBaseId )
+ {
+ case BIFF_TOKID_EXP: dumpExpToken( "EXP" ); break;
+ case BIFF_TOKID_TBL: dumpExpToken( "TBL" ); break;
+ case BIFF_TOKID_ADD: dumpBinaryOpToken( "+" ); break;
+ case BIFF_TOKID_SUB: dumpBinaryOpToken( "-" ); break;
+ case BIFF_TOKID_MUL: dumpBinaryOpToken( "*" ); break;
+ case BIFF_TOKID_DIV: dumpBinaryOpToken( "/" ); break;
+ case BIFF_TOKID_POWER: dumpBinaryOpToken( "^" ); break;
+ case BIFF_TOKID_CONCAT: dumpBinaryOpToken( "&" ); break;
+ case BIFF_TOKID_LT: dumpBinaryOpToken( "<" ); break;
+ case BIFF_TOKID_LE: dumpBinaryOpToken( "<=" ); break;
+ case BIFF_TOKID_EQ: dumpBinaryOpToken( "=" ); break;
+ case BIFF_TOKID_GE: dumpBinaryOpToken( ">=" ); break;
+ case BIFF_TOKID_GT: dumpBinaryOpToken( "<" ); break;
+ case BIFF_TOKID_NE: dumpBinaryOpToken( "<>" ); break;
+ case BIFF_TOKID_ISECT: dumpBinaryOpToken( " " ); break;
+ case BIFF_TOKID_LIST: dumpBinaryOpToken( "," ); break;
+ case BIFF_TOKID_RANGE: dumpBinaryOpToken( ":" ); break;
+ case BIFF_TOKID_UPLUS: dumpUnaryOpToken( "+", "" ); break;
+ case BIFF_TOKID_UMINUS: dumpUnaryOpToken( "-", "" ); break;
+ case BIFF_TOKID_PERCENT: dumpUnaryOpToken( "", "%" ); break;
+ case BIFF_TOKID_PAREN: dumpUnaryOpToken( "(", ")" ); break;
+ case BIFF_TOKID_MISSARG: dumpMissArgToken(); break;
+ case BIFF_TOKID_STR: dumpStringToken(); break;
+ case BIFF_TOKID_NLR: bValid = dumpNlrToken(); break;
+ case BIFF_TOKID_ATTR: bValid = dumpAttrToken(); break;
+ case BIFF_TOKID_SHEET: dumpSheetToken(); break;
+ case BIFF_TOKID_ENDSHEET: dumpEndSheetToken(); break;
+ case BIFF_TOKID_ERR: dumpErrorToken(); break;
+ case BIFF_TOKID_BOOL: dumpBoolToken(); break;
+ case BIFF_TOKID_INT: dumpIntToken(); break;
+ case BIFF_TOKID_NUM: dumpDoubleToken(); break;
+ default: bValid = false;
+ }
+ }
+ else
+ {
+ OUString aTokClass = cfg().getName( mxClasses, nTokClass );
+ switch( nBaseId )
+ {
+ case BIFF_TOKID_ARRAY: dumpArrayToken( aTokClass ); break;
+ case BIFF_TOKID_FUNC: dumpFuncToken( aTokClass ); break;
+ case BIFF_TOKID_FUNCVAR: dumpFuncVarToken( aTokClass ); break;
+ case BIFF_TOKID_NAME: dumpNameToken( aTokClass ); break;
+ case BIFF_TOKID_REF: dumpRefToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREA: dumpAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMAREA: dumpMemAreaToken( aTokClass, true ); break;
+ case BIFF_TOKID_MEMERR: dumpMemAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMNOMEM: dumpMemAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMFUNC: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_REFERR: dumpRefErrToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREAERR: dumpRefErrToken( aTokClass, true ); break;
+ case BIFF_TOKID_REFN: dumpRefToken( aTokClass, true ); break;
+ case BIFF_TOKID_AREAN: dumpAreaToken( aTokClass, true ); break;
+ case BIFF_TOKID_MEMAREAN: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_MEMNOMEMN: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_FUNCCE: dumpCmdToken( aTokClass ); break;
+ case BIFF_TOKID_NAMEX: dumpNameXToken( aTokClass ); break;
+ case BIFF_TOKID_REF3D: dumpRef3dToken( aTokClass, mbNameMode ); break;
+ case BIFF_TOKID_AREA3D: dumpArea3dToken( aTokClass, mbNameMode ); break;
+ case BIFF_TOKID_REFERR3D: dumpRefErr3dToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREAERR3D: dumpRefErr3dToken( aTokClass, true ); break;
+ default: bValid = false;
+ }
+ }
+ }
+ }
+ }
+ bValid = nEndPos == mxStrm->tell();
+ if( bValid )
+ {
+ dumpAddTokenData();
+ writeInfoItem( "formula", mxStack->getFormulaString() );
+ writeInfoItem( "classes", mxStack->getClassesString() );
+ }
+ else
+ dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), nEndPos - mxStrm->tell(), false );
+
+ mnSize = 0;
+}
+
+void FormulaObject::dumpFormula( const String& rName, sal_uInt16 nSize, bool bNameMode )
+{
+ maName = rName( "formula" );
+ mnSize = nSize;
+ mbNameMode = bNameMode;
+ dump();
+ mnSize = 0;
+}
+
+void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
+{
+ dumpFormula( rName, readFormulaSize(), bNameMode );
+}
+
+// private --------------------------------------------------------------------
+
+void FormulaObject::constructFmlaObj()
+{
+ if( BiffObjectBase::implIsValid() )
+ {
+ mxFuncProv.reset( new FunctionProvider( FILTER_BIFF, getBiff(), true ) );
+
+ Config& rCfg = cfg();
+ mxClasses = rCfg.getNameList( "TOKENCLASSES" );
+ mxRelFlags = rCfg.getNameList( "REFRELFLAGS" );
+ mxNlrTypes = rCfg.getNameList( "NLRTYPES" );
+ mxAttrTypes = rCfg.getNameList( "ATTRTYPES" );
+ mxSpTypes = rCfg.getNameList( "ATTRSPACETYPES" );
+
+ // create classified token names
+ mxTokens = rCfg.createNameList< ConstList >( "TOKENS" );
+ mxTokens->includeList( rCfg.getNameList( "BASETOKENS" ) );
+
+ NameListRef xClassTokens = rCfg.getNameList( "CLASSTOKENS" );
+ if( mxClasses.get() && xClassTokens.get() )
+ for( NameListBase::const_iterator aCIt = mxClasses->begin(), aCEnd = mxClasses->end(); aCIt != aCEnd; ++aCIt )
+ for( NameListBase::const_iterator aTIt = xClassTokens->begin(), aTEnd = xClassTokens->end(); aTIt != aTEnd; ++aTIt )
+ mxTokens->setName( aCIt->first | aTIt->first, aTIt->second + aCIt->second );
+
+ mnColCount = 256;
+ mnRowCount = (getBiff() == BIFF8) ? 65536 : 16384;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+namespace {
+
+OUString lclCreateName( const OUString& rRef, sal_uInt16 nNameIdx )
+{
+ OUStringBuffer aName( rRef );
+ StringHelper::appendIndexedText( aName, CREATE_OUSTRING( "NAME" ), nNameIdx );
+ return aName.makeStringAndClear();
+}
+
+OUString lclCreateNlr( const OUString& rData, bool bRel = true )
+{
+ OUStringBuffer aNlr;
+ if( !bRel ) aNlr.append( OOX_DUMP_ADDRABS );
+ StringHelper::appendIndexedText( aNlr, CREATE_OUSTRING( "NLR" ), rData );
+ return aNlr.makeStringAndClear();
+}
+
+OUString lclCreateNlr( const TokenAddress& rPos )
+{
+ OUStringBuffer aAddr;
+ StringHelper::appendAddrCol( aAddr, rPos.mnCol, true );
+ StringHelper::appendAddrRow( aAddr, rPos.mnRow, true );
+ return lclCreateNlr( aAddr.makeStringAndClear(), rPos.mbRelRow );
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+TokenAddress FormulaObject::createTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const
+{
+ TokenAddress aPos;
+ aPos.mnCol = nCol;
+ if( bRelC && bNameMode && (nCol >= mnColCount / 2) ) aPos.mnCol -= mnColCount;
+ aPos.mbRelCol = bRelC;
+ aPos.mnRow = nRow;
+ if( bRelR && bNameMode && (nRow >= mnRowCount / 2) ) aPos.mnRow -= mnRowCount;
+ aPos.mbRelRow = bRelR;
+ return aPos;
+}
+
+OUString FormulaObject::createRef( const OUString& rData ) const
+{
+ return maRefPrefix + rData;
+}
+
+OUString FormulaObject::createName( sal_uInt16 nNameIdx ) const
+{
+ return lclCreateName( maRefPrefix, nNameIdx );
+}
+
+OUString FormulaObject::createPlaceHolder( size_t nIdx ) const
+{
+ OUStringBuffer aStr;
+ StringHelper::appendDec( aStr, static_cast< sal_uInt32 >( nIdx ) );
+ StringHelper::enclose( aStr, OOX_DUMP_PLACEHOLDER );
+ return aStr.makeStringAndClear();
+}
+
+OUString FormulaObject::createPlaceHolder() const
+{
+ return createPlaceHolder( maAddData.size() );
+}
+
+sal_uInt16 FormulaObject::readFuncId()
+{
+ return (getBiff() >= BIFF4) ? mxStrm->readuInt16() : mxStrm->readuInt8();
+}
+
+OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
+{
+ ItemGuard aItemGuard( mxOut, "func-id" );
+ writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
+ OUStringBuffer aBuffer;
+ const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiffFuncId( nFuncId );
+ if( pFuncInfo )
+ aBuffer.append( pFuncInfo->maOoxFuncName );
+ else
+ {
+ bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
+ aBuffer.appendAscii( bCmd ? "CMD" : "FUNC" );
+ StringHelper::appendIndex( aBuffer, nFuncId & BIFF_TOK_FUNCVAR_FUNCIDMASK );
+ }
+ OUString aFuncName = aBuffer.makeStringAndClear();
+ aItemGuard.cont();
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeString( aFuncName );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
+ return aFuncName;
+}
+
+sal_uInt16 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
+{
+ sal_uInt16 nCol = 0;
+ if( getBiff() == BIFF8 )
+ {
+ nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
+ rbRelC = getFlag( nCol, BIFF_TOK_REF_COLREL );
+ rbRelR = getFlag( nCol, BIFF_TOK_REF_ROWREL );
+ nCol &= BIFF_TOK_REF_COLMASK;
+ }
+ else
+ nCol = dumpDec< sal_uInt8 >( rName );
+ return nCol;
+}
+
+sal_uInt16 FormulaObject::dumpTokenRow( const String& rName, bool& rbRelC, bool& rbRelR )
+{
+ sal_uInt16 nRow = 0;
+ if( getBiff() == BIFF8 )
+ nRow = dumpDec< sal_uInt16 >( rName );
+ else
+ {
+ nRow = dumpHex< sal_uInt16 >( rName, mxRelFlags );
+ rbRelC = getFlag( nRow, BIFF_TOK_REF_COLREL );
+ rbRelR = getFlag( nRow, BIFF_TOK_REF_ROWREL );
+ nRow &= BIFF_TOK_REF_ROWMASK;
+ }
+ return nRow;
+}
+
+TokenAddress FormulaObject::dumpTokenAddress( bool bNameMode )
+{
+ bool bRelC = false;
+ bool bRelR = false;
+ sal_uInt16 nRow = dumpTokenRow( "row", bRelC, bRelR );
+ sal_uInt16 nCol = dumpTokenCol( "col", bRelC, bRelR );
+ return createTokenAddress( nCol, nRow, bRelC, bRelR, bNameMode );
+}
+
+TokenRange FormulaObject::dumpTokenRange( bool bNameMode )
+{
+ bool bRelC1 = false;
+ bool bRelR1 = false;
+ bool bRelC2 = false;
+ bool bRelR2 = false;
+ sal_uInt16 nRow1 = dumpTokenRow( "row1", bRelC1, bRelR1 );
+ sal_uInt16 nRow2 = dumpTokenRow( "row2", bRelC2, bRelR2 );
+ sal_uInt16 nCol1 = dumpTokenCol( "col1", bRelC1, bRelR1 );
+ sal_uInt16 nCol2 = dumpTokenCol( "col2", bRelC2, bRelR2 );
+ TokenRange aRange;
+ aRange.maFirst = createTokenAddress( nCol1, nRow1, bRelC1, bRelR1, bNameMode );
+ aRange.maLast = createTokenAddress( nCol2, nRow2, bRelC2, bRelR2, bNameMode );
+ return aRange;
+}
+
+sal_Int16 FormulaObject::readTokenRefIdx()
+{
+ sal_Int16 nRefIdx = dumpDec< sal_Int16 >( "ref-idx" );
+ switch( getBiff() )
+ {
+ case BIFF2: dumpUnused( 1 ); break;
+ case BIFF3: dumpUnused( 2 ); break;
+ case BIFF4: dumpUnused( 2 ); break;
+ case BIFF5: dumpUnused( 8 ); break;
+ case BIFF8: break;
+ case BIFF_UNKNOWN: break;
+ }
+ return nRefIdx;
+}
+
+OUString FormulaObject::dumpTokenRefIdx()
+{
+ OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
+ StringHelper::appendIndex( aRef, readTokenRefIdx() );
+ aRef.append( OOX_DUMP_TABSEP );
+ return aRef.makeStringAndClear();
+}
+
+OUString FormulaObject::dumpTokenRefTabIdxs()
+{
+ sal_Int16 nRefIdx = readTokenRefIdx();
+ OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
+ StringHelper::appendIndex( aRef, nRefIdx );
+ if( getBiff() == BIFF5 )
+ {
+ dumpDec< sal_Int16 >( "tab1" );
+ sal_Int16 nTab2 = dumpDec< sal_Int16 >( "tab2" );
+ if( (nRefIdx > 0) && (nTab2 > 0) && (nRefIdx != nTab2) )
+ {
+ aRef.append( OOX_DUMP_RANGESEP );
+ aRef.appendAscii( "REF" );
+ StringHelper::appendIndex( aRef, nTab2 );
+ }
+ }
+ aRef.append( OOX_DUMP_TABSEP );
+ return aRef.makeStringAndClear();
+}
+
+void FormulaObject::dumpIntToken()
+{
+ dumpDec< sal_uInt16 >( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpDoubleToken()
+{
+ dumpDec< double >( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpStringToken()
+{
+ OUStringBuffer aValue;
+ aValue.append( dumpString( "value", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH ) );
+ StringHelper::enclose( aValue, OOX_DUMP_FMLASTRQUOTE );
+ mxStack->pushOperand( aValue.makeStringAndClear() );
+}
+
+void FormulaObject::dumpBoolToken()
+{
+ dumpBoolean( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpErrorToken()
+{
+ dumpErrorCode( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpMissArgToken()
+{
+ mxStack->pushOperand( OUString( OOX_DUMP_EMPTYVALUE ) );
+}
+
+void FormulaObject::dumpArrayToken( const OUString& rTokClass )
+{
+ dumpUnused( (getBiff() == BIFF2) ? 6 : 7 );
+ mxStack->pushOperand( createPlaceHolder(), rTokClass );
+ maAddData.push_back( ADDDATA_ARRAY );
+}
+
+void FormulaObject::dumpNameToken( const OUString& rTokClass )
+{
+ sal_uInt16 nNameIdx = dumpDec< sal_uInt16 >( "name-idx" );
+ switch( getBiff() )
+ {
+ case BIFF2: dumpUnused( 5 ); break;
+ case BIFF3:
+ case BIFF4: dumpUnused( 8 ); break;
+ case BIFF5: dumpUnused( 12 ); break;
+ case BIFF8: dumpUnused( 2 ); break;
+ case BIFF_UNKNOWN: break;
+ }
+ mxStack->pushOperand( createName( nNameIdx ), rTokClass );
+}
+
+void FormulaObject::dumpNameXToken( const OUString& rTokClass )
+{
+ OUString aRef = dumpTokenRefIdx();
+ sal_uInt16 nNameIdx = dumpDec< sal_uInt16 >( "name-idx" );
+ dumpUnused( (getBiff() == BIFF8) ? 2 : 12 );
+ mxStack->pushOperand( lclCreateName( aRef, nNameIdx ), rTokClass );
+}
+
+void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
+{
+ TokenAddress aPos = dumpTokenAddress( bNameMode );
+ writeTokenAddressItem( "addr", aPos, bNameMode );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
+}
+
+void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
+{
+ TokenRange aRange = dumpTokenRange( bNameMode );
+ writeTokenRangeItem( "range", aRange, bNameMode );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
+}
+
+void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
+{
+ dumpUnused( ((getBiff() == BIFF8) ? 4 : 3) * (bArea ? 2 : 1) );
+ mxStack->pushOperand( createRef( getErrorName( BIFF_ERR_REF ) ), rTokClass );
+}
+
+void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
+{
+ OUString aRef = dumpTokenRefTabIdxs();
+ TokenAddress aPos = dumpTokenAddress( bNameMode );
+ writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+}
+
+void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
+{
+ OUString aRef = dumpTokenRefTabIdxs();
+ TokenRange aRange = dumpTokenRange( bNameMode );
+ writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+}
+
+void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
+{
+ OUString aRef = dumpTokenRefTabIdxs();
+ dumpUnused( ((getBiff() == BIFF8) ? 4 : 3) * (bArea ? 2 : 1) );
+ mxStack->pushOperand( aRef + getErrorName( BIFF_ERR_REF ), rTokClass );
+}
+
+void FormulaObject::dumpMemFuncToken( const OUString& /*rTokClass*/ )
+{
+ dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "size" );
+}
+
+void FormulaObject::dumpMemAreaToken( const OUString& rTokClass, bool bAddData )
+{
+ dumpUnused( (getBiff() == BIFF2) ? 3 : 4 );
+ dumpMemFuncToken( rTokClass );
+ if( bAddData )
+ maAddData.push_back( ADDDATA_MEMAREA );
+}
+
+void FormulaObject::dumpExpToken( const String& rName )
+{
+ Address aPos;
+ aPos.mnRow = dumpDec< sal_uInt16 >( "row" );
+ aPos.mnCol = dumpDec< sal_uInt16, sal_uInt8 >( getBiff() != BIFF2, "col" );
+ writeAddressItem( "base-addr", aPos );
+ OUStringBuffer aOp( rName );
+ StringHelper::appendIndex( aOp, mxOut->getLastItemValue() );
+ mxStack->pushOperand( aOp.makeStringAndClear() );
+}
+
+void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
+{
+ mxStack->pushUnaryOp( rLOp, rROp );
+}
+
+void FormulaObject::dumpBinaryOpToken( const String& rOp )
+{
+ mxStack->pushBinaryOp( rOp );
+}
+
+void FormulaObject::dumpFuncToken( const OUString& rTokClass )
+{
+ sal_uInt16 nFuncId = readFuncId();
+ const FunctionInfo* pFuncInfo = 0;
+ OUString aFuncName = writeFuncIdItem( nFuncId, &pFuncInfo );
+ if( pFuncInfo && (pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount) )
+ mxStack->pushFuncOp( aFuncName, rTokClass, pFuncInfo->mnMinParamCount );
+ else
+ mxStack->setError();
+}
+
+void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
+{
+ sal_uInt8 nParamCount;
+ *mxStrm >> nParamCount;
+ sal_uInt16 nFuncId = readFuncId();
+ bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
+ if( bCmd )
+ writeHexItem( "param-count", nParamCount, "PARAMCOUNT-CMD" );
+ else
+ writeDecItem( "param-count", nParamCount );
+ OUString aFuncName = writeFuncIdItem( nFuncId );
+ if( bCmd && getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
+ {
+ aFuncName += OUString( OOX_DUMP_CMDPROMPT );
+ nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
+ }
+ mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
+}
+
+void FormulaObject::dumpCmdToken( const OUString& rTokClass )
+{
+ sal_uInt8 nParamCount = dumpDec< sal_uInt8 >( "param-count", "PARAMCOUNT-CMD" );
+ sal_uInt16 nCmdId = readFuncId() | BIFF_TOK_FUNCVAR_CMD;
+ OUString aFuncName = writeFuncIdItem( nCmdId );
+ if( getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
+ {
+ aFuncName += OUString( OOX_DUMP_CMDPROMPT );
+ nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
+ }
+ mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
+}
+
+void FormulaObject::dumpSheetToken()
+{
+ dumpUnused( (getBiff() == BIFF2) ? 4 : 6 );
+ maRefPrefix = dumpTokenRefIdx();
+}
+
+void FormulaObject::dumpEndSheetToken()
+{
+ dumpUnused( (getBiff() == BIFF2) ? 3 : 4 );
+ maRefPrefix = OUString();
+}
+
+bool FormulaObject::dumpAttrToken()
+{
+ bool bValid = true;
+ bool bBiff2 = getBiff() == BIFF2;
+ sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxAttrTypes );
+ switch( nType )
+ {
+ case BIFF_TOK_ATTR_VOLATILE:
+ dumpUnused( bBiff2 ? 1 : 2 );
+ break;
+ case BIFF_TOK_ATTR_IF:
+ dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip" );
+ break;
+ case BIFF_TOK_ATTR_CHOOSE:
+ {
+ sal_uInt16 nCount = dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "choices" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
+ dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "#skip" );
+ dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip-err" );
+ }
+ break;
+ case 0: // in array formulas and defined names, the skip-bit may be 0
+ case BIFF_TOK_ATTR_SKIP:
+ dumpDec< sal_uInt16, sal_uInt8 >( !bBiff2, "skip" );
+ break;
+ case BIFF_TOK_ATTR_SUM:
+ dumpUnused( bBiff2 ? 1 : 2 );
+ mxStack->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS ), 1 );
+ break;
+ case BIFF_TOK_ATTR_ASSIGN:
+ dumpUnused( bBiff2 ? 1 : 2 );
+ break;
+ case BIFF_TOK_ATTR_SPACE:
+ case BIFF_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
+ switch( getBiff() )
+ {
+ case BIFF2:
+ bValid = false;
+ break;
+ case BIFF3:
+ dumpDec< sal_uInt16 >( "leading-spaces" );
+ break;
+ case BIFF4:
+ case BIFF5:
+ case BIFF8:
+ dumpDec< sal_uInt8 >( "char-type", mxSpTypes );
+ dumpDec< sal_uInt8 >( "char-count" );
+ break;
+ case BIFF_UNKNOWN: break;
+ }
+ break;
+ default:
+ bValid = false;
+ }
+ return bValid;
+}
+
+bool FormulaObject::dumpNlrToken()
+{
+ const OUString aRefClass = cfg().getName( mxClasses, BIFF_TOKCLASS_REF );
+ const OUString aValClass = cfg().getName( mxClasses, BIFF_TOKCLASS_VAL );
+
+ bool bValid = true;
+ sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxNlrTypes );
+ switch( nType )
+ {
+ case BIFF_TOK_NLR_ERR: dumpNlrErrToken(); break;
+ case BIFF_TOK_NLR_ROWR: dumpNlrColRowToken( aRefClass, false ); break;
+ case BIFF_TOK_NLR_COLR: dumpNlrColRowToken( aRefClass, false ); break;
+ case BIFF_TOK_NLR_ROWV: dumpNlrColRowToken( aValClass, false ); break;
+ case BIFF_TOK_NLR_COLV: dumpNlrColRowToken( aValClass, false ); break;
+ case BIFF_TOK_NLR_RANGE: dumpNlrRangeToken( aRefClass, false ); break;
+ case BIFF_TOK_NLR_SRANGE: dumpNlrRangeToken( aRefClass, true ); break;
+ case BIFF_TOK_NLR_SROWR: dumpNlrColRowToken( aRefClass, true ); break;
+ case BIFF_TOK_NLR_SCOLR: dumpNlrColRowToken( aRefClass, true ); break;
+ case BIFF_TOK_NLR_SROWV: dumpNlrColRowToken( aValClass, true ); break;
+ case BIFF_TOK_NLR_SCOLV: dumpNlrColRowToken( aValClass, true ); break;
+ case BIFF_TOK_NLR_RANGEERR: dumpNlrRangeErrToken(); break;
+ default: bValid = false;
+ }
+ return bValid;
+}
+
+void FormulaObject::dumpNlrErrToken()
+{
+ dumpDec< sal_uInt32 >( "delname-idx" );
+ mxStack->pushOperand( lclCreateNlr( getErrorName( BIFF_ERR_NAME ) ) );
+}
+
+void FormulaObject::dumpNlrColRowToken( const OUString& rTokClass, bool bAddData )
+{
+ if( bAddData )
+ {
+ dumpUnused( 4 );
+ mxStack->pushOperand( createPlaceHolder(), rTokClass );
+ maAddData.push_back( ADDDATA_NLR );
+ }
+ else
+ {
+ TokenAddress aPos = dumpTokenAddress( false );
+ writeInfoItem( "addr", lclCreateNlr( aPos ) );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+ }
+}
+
+void FormulaObject::dumpNlrRangeToken( const OUString& rTokClass, bool bAddData )
+{
+ if( bAddData )
+ {
+ dumpUnused( 4 );
+ mxStack->pushOperand( createPlaceHolder(), rTokClass );
+ maAddData.push_back( ADDDATA_NLR );
+ }
+ else
+ {
+ TokenAddress aPos = dumpTokenAddress( false );
+ writeInfoItem( "addr", lclCreateNlr( aPos ) );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+ }
+ dumpUnknown( 1 );
+ dumpRange( "target-range" );
+}
+
+void FormulaObject::dumpNlrRangeErrToken()
+{
+ dumpDec< sal_uInt32 >( "delname-idx" );
+ dumpUnused( 9 );
+ mxStack->pushOperand( lclCreateNlr( getErrorName( BIFF_ERR_NAME ) ) );
+}
+
+void FormulaObject::dumpAddTokenData()
+{
+ mxOut->resetItemIndex();
+ for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); aIt != aEnd; ++aIt )
+ {
+ AddDataType eType = *aIt;
+
+ {
+ ItemGuard aItem( mxOut, "#add-data" );
+ switch( eType )
+ {
+ case ADDDATA_NLR: mxOut->writeAscii( "tNlr" ); break;
+ case ADDDATA_ARRAY: mxOut->writeAscii( "tArray" ); break;
+ case ADDDATA_MEMAREA: mxOut->writeAscii( "tMemArea" ); break;
+ }
+ }
+
+ size_t nIdx = aIt - maAddData.begin();
+ IndentGuard aIndGuard( mxOut );
+ switch( eType )
+ {
+ case ADDDATA_NLR: dumpAddDataNlr( nIdx ); break;
+ case ADDDATA_ARRAY: dumpAddDataArray( nIdx ); break;
+ case ADDDATA_MEMAREA: dumpAddDataMemArea( nIdx ); break;
+ }
+ }
+}
+
+void FormulaObject::dumpAddDataNlr( size_t nIdx )
+{
+ sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "NLRADDFLAGS" );
+ sal_uInt32 nCount = nFlags & BIFF_TOK_NLR_ADDMASK;
+ OUStringBuffer aBuffer;
+ for( sal_uInt32 nPos = 0; nPos < nCount; ++nPos )
+ {
+ Address aPos;
+ readAddress( aPos );
+ OUStringBuffer aAddr;
+ StringHelper::appendAddress( aAddr, aPos );
+ StringHelper::appendToken( aBuffer, aAddr.makeStringAndClear(), OOX_DUMP_LISTSEP );
+ }
+ OUString aAddrList = aBuffer.makeStringAndClear();
+ writeInfoItem( "stacked-positions", aAddrList );
+ mxStack->replaceOnTop( createPlaceHolder( nIdx ), lclCreateNlr( aAddrList ) );
+}
+
+void FormulaObject::dumpAddDataArray( size_t nIdx )
+{
+ sal_uInt32 nCols, nRows;
+ dumpConstArrayHeader( nCols, nRows );
+
+ OUStringBuffer aOp;
+ TableGuard aTabGuard( mxOut, 17 );
+ for( sal_uInt32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ OUStringBuffer aArrayLine;
+ for( sal_uInt32 nCol = 0; nCol < nCols; ++nCol )
+ StringHelper::appendToken( aArrayLine, dumpConstValue( OOX_DUMP_FMLASTRQUOTE ), OOX_DUMP_LISTSEP );
+ StringHelper::appendToken( aOp, aArrayLine.makeStringAndClear(), OOX_DUMP_ARRAYSEP );
+ }
+ StringHelper::enclose( aOp, '{', '}' );
+ mxStack->replaceOnTop( createPlaceHolder( nIdx ), aOp.makeStringAndClear() );
+}
+
+void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
+{
+ dumpRangeList( EMPTY_STRING, getBiff() == BIFF8 );
+}
+
+// ============================================================================
+// ============================================================================
+
+RecordStreamObject::~RecordStreamObject()
+{
+}
+
+void RecordStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const OUString& rSysFileName )
+{
+ BiffObjectBase::construct( rParent, rxStrm, eBiff, rSysFileName );
+ if( BiffObjectBase::implIsValid() )
+ mxFmlaObj.reset( new FormulaObject( *this ) );
+}
+
+bool RecordStreamObject::implIsValid() const
+{
+ return isValid( mxFmlaObj ) && BiffObjectBase::implIsValid();
+}
+
+// ============================================================================
+
+WorkbookStreamObject::WorkbookStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ if( rxStrm.get() )
+ {
+ BiffType eBiff = BiffDetector::detectStreamBiffVersion( *rxStrm );
+ RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
+ if( RecordStreamObject::implIsValid() )
+ {
+ Config& rCfg = cfg();
+ mxColors = rCfg.getNameList( "COLORS" );
+ mxBorderStyles = rCfg.getNameList( "BORDERSTYLES" );
+ mxFillPatterns = rCfg.getNameList( "FILLPATTERNS" );
+ mnPTRowFields = 0;
+ mnPTColFields = 0;
+ mnPTRowColItemsIdx = 0;
+ mbHasDff = false;
+ initializePerSheet();
+ }
+ }
+}
+
+WorkbookStreamObject::~WorkbookStreamObject()
+{
+ if( WorkbookStreamObject::implIsValid() )
+ {
+ Config& rCfg = cfg();
+ rCfg.eraseNameList( "FONTNAMES" );
+ rCfg.eraseNameList( "FORMATS" );
+ }
+}
+
+void WorkbookStreamObject::implDumpRecordBody()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ sal_uInt16 nRecId = rStrm.getRecId();
+ sal_Int64 nRecSize = rStrm.getLength();
+ BiffType eBiff = getBiff();
+
+ switch( nRecId )
+ {
+ case BIFF2_ID_ARRAY:
+ case BIFF3_ID_ARRAY:
+ dumpRange( "array-range", false );
+ dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "ARRAY-FLAGS" );
+ if( eBiff >= BIFF5 ) dumpUnused( 4 );
+ getFormulaDumper().dumpCellFormula();
+ break;
+
+ case BIFF2_ID_BLANK:
+ case BIFF3_ID_BLANK:
+ dumpCellHeader( nRecId == BIFF2_ID_BLANK );
+ break;
+
+ case BIFF2_ID_BOF:
+ case BIFF3_ID_BOF:
+ case BIFF4_ID_BOF:
+ case BIFF5_ID_BOF:
+ dumpHex< sal_uInt16 >( "bof-type", "BOF-BIFFTYPE" );
+ dumpHex< sal_uInt16 >( "sheet-type", "BOF-SHEETTYPE" );
+ if( nRecSize >= 6 ) dumpDec< sal_uInt16 >( "build-id" );
+ if( nRecSize >= 8 ) dumpDec< sal_uInt16 >( "build-year" );
+ if( nRecSize >= 12 ) dumpHex< sal_uInt32 >( "history-flags", "BOF-HISTORY-FLAGS" );
+ if( nRecSize >= 16 ) dumpHex< sal_uInt32 >( "lowest-version", "BOF-LOWESTVERSION-FLAGS" );
+ if( (eBiff == BIFF4) && (getLastRecId() != BIFF_ID_OBJ) )
+ initializePerSheet();
+ break;
+
+ case BIFF_ID_BOOKEXT:
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt32 >( "rec-size" );
+ dumpHex< sal_uInt32 >( "flags-1", "BOOKEXT-FLAGS1" );
+ if( rStrm.getRemaining() > 0 ) dumpHex< sal_uInt8 >( "flags-2", "BOOKEXT-FLAGS2" );
+ if( rStrm.getRemaining() > 0 ) dumpHex< sal_uInt8 >( "flags-3", "BOOKEXT-FLAGS3" );
+ break;
+
+ case BIFF2_ID_BOOLERR:
+ case BIFF3_ID_BOOLERR:
+ dumpCellHeader( nRecId == BIFF2_ID_BOOLERR );
+ dumpBoolErr();
+ break;
+
+ case BIFF_ID_CFHEADER:
+ dumpDec< sal_uInt16 >( "rule-count" );
+ dumpHex< sal_uInt16 >( "flags", "CFHEADER-FLAGS" );
+ dumpRange( "bounding-range" );
+ dumpRangeList();
+ break;
+
+ case BIFF_ID_CFRULE:
+ {
+ dumpDec< sal_uInt8 >( "type", "CFRULE-TYPE" );
+ dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
+ sal_uInt16 nFmla1Size = dumpDec< sal_uInt16 >( "formula1-size" );
+ sal_uInt16 nFmla2Size = dumpDec< sal_uInt16 >( "formula2-size" );
+ dumpCfRuleProp();
+ if( nFmla1Size > 0 ) getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
+ if( nFmla2Size > 0 ) getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
+ }
+ break;
+
+ case BIFF_ID_CFRULE12:
+ {
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt8 >( "type", "CFRULE12-TYPE" );
+ dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
+ sal_uInt16 nFmla1Size = dumpDec< sal_uInt16 >( "formula1-size" );
+ sal_uInt16 nFmla2Size = dumpDec< sal_uInt16 >( "formula2-size" );
+ dumpDxf12Prop();
+ if( nFmla1Size > 0 ) getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
+ if( nFmla2Size > 0 ) getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
+ getFormulaDumper().dumpNameFormula( "active-formula" );
+ dumpHex< sal_uInt8 >( "flags", "CFRULE12-FLAGS" );
+ dumpDec< sal_uInt16 >( "priority" );
+ dumpCfRule12Param( dumpDec< sal_uInt16 >( "sub-type", "CFRULE12-SUBTYPE" ) );
+ }
+ break;
+
+ case BIFF_ID_CFRULEEXT:
+ dumpFrHeader( true, true );
+ dumpBool< sal_uInt32 >( "cfrule12-follows" );
+ dumpDec< sal_uInt16 >( "cfheader-id" );
+ if( rStrm.getRemaining() >= 25 )
+ {
+ dumpDec< sal_uInt16 >( "cfrule-idx" );
+ dumpDec< sal_uInt8 >( "operator", "CFRULE-OPERATOR" );
+ sal_uInt8 nSubType = dumpDec< sal_uInt8 >( "sub-type", "CFRULE12-SUBTYPE" );
+ dumpDec< sal_uInt16 >( "priority" );
+ dumpHex< sal_uInt8 >( "flags", "CFRULEEXT-FLAGS" );
+ if( dumpBoolean( "has-dxf-data" ) ) dumpDxf12Prop();
+ dumpCfRule12Param( nSubType );
+ }
+ break;
+
+ case BIFF_ID_CH3DDATAFORMAT:
+ dumpDec< sal_uInt8 >( "base", "CH3DDATAFORMAT-BASE" );
+ dumpDec< sal_uInt8 >( "top", "CH3DDATAFORMAT-TOP" );
+ break;
+
+ case BIFF_ID_CHAREAFORMAT:
+ dumpColorABGR( "fg-color" );
+ dumpColorABGR( "bg-color" );
+ dumpPatternIdx();
+ dumpHex< sal_uInt16 >( "flags", "CHAREAFORMAT-FLAGS" );
+ if( eBiff == BIFF8 ) dumpColorIdx( "fg-color-idx" );
+ if( eBiff == BIFF8 ) dumpColorIdx( "bg-color-idx" );
+ break;
+
+ case BIFF_ID_CHAXESSET:
+ dumpDec< sal_uInt16 >( "axesset-id", "CHAXESSET-ID" );
+ dumpRect< sal_Int32 >( "inner-plotarea-pos", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
+ break;
+
+ case BIFF_ID_CHAXIS:
+ dumpDec< sal_uInt16 >( "axis-type", "CHAXIS-TYPE" );
+ if( eBiff <= BIFF4 )
+ dumpRect< sal_Int32 >( "position", "CONV-TWIP-TO-CM" );
+ else
+ dumpUnused( 16 );
+ break;
+
+ case BIFF_ID_CHBAR:
+ dumpDec< sal_Int16 >( "overlap", "CONV-PERCENT-NEG" );
+ dumpDec< sal_Int16 >( "gap", "CONV-PERCENT" );
+ dumpHex< sal_uInt16 >( "flags", "CHBAR-FLAGS" );
+ break;
+
+ case BIFF_ID_CHCHART:
+ dumpRect< sal_Int32 >( "chart-frame", "CONV-PT1616-TO-CM", FORMATTYPE_FIX );
+ break;
+
+ case BIFF_ID_CHCHART3D:
+ dumpDec< sal_uInt16 >( "rotation-angle", "CONV-DEG" );
+ dumpDec< sal_Int16 >( "elevation-angle", "CONV-DEG" );
+ dumpDec< sal_uInt16 >( "eye-distance" );
+ dumpDec< sal_uInt16 >( "relative-height", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "relative-depth", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "depth-gap", "CONV-PERCENT" );
+ dumpHex< sal_uInt16 >( "flags", "CHCHART3D-FLAGS" );
+ break;
+
+ case BIFF_ID_CHDATAFORMAT:
+ dumpDec< sal_Int16 >( "point-idx", "CHDATAFORMAT-POINTIDX" );
+ dumpDec< sal_Int16 >( "series-idx" );
+ if( eBiff >= BIFF5 ) dumpDec< sal_Int16 >( "format-idx", "CHDATAFORMAT-FORMATIDX" );
+ if( eBiff >= BIFF5 ) dumpHex< sal_uInt16 >( "flags", "CHDATAFORMAT-FLAGS" );
+ break;
+
+ case BIFF_ID_CHDATERANGE:
+ dumpDec< sal_uInt16 >( "minimum-date" );
+ dumpDec< sal_uInt16 >( "maximum-date" );
+ dumpDec< sal_uInt16 >( "major-unit-value" );
+ dumpDec< sal_uInt16 >( "major-unit", "CHDATERANGE-UNIT" );
+ dumpDec< sal_uInt16 >( "minor-unit-value" );
+ dumpDec< sal_uInt16 >( "minor-unit", "CHDATERANGE-UNIT" );
+ dumpDec< sal_uInt16 >( "base-unit", "CHDATERANGE-UNIT" );
+ dumpDec< sal_uInt16 >( "axis-crossing-date" );
+ dumpHex< sal_uInt16 >( "flags", "CHDATERANGE-FLAGS" );
+ break;
+
+ case BIFF_ID_CHECKCOMPAT:
+ dumpFrHeader( true, true );
+ dumpBool< sal_uInt32 >( "check-compatibility" );
+ break;
+
+ case BIFF_ID_CHESCHERFORMAT:
+ dumpEmbeddedDff();
+ break;
+
+ case BIFF_ID_CHFRAME:
+ dumpDec< sal_uInt16 >( "format", "CHFRAME-FORMAT" );
+ dumpHex< sal_uInt16 >( "flags", "CHFRAME-FLAGS" );
+ break;
+
+ case BIFF_ID_CHFRAMEPOS:
+ dumpDec< sal_uInt16 >( "tl-mode", "CHFRAMEPOS-POSMODE" );
+ dumpDec< sal_uInt16 >( "br-mode", "CHFRAMEPOS-POSMODE" );
+ dumpRectWithGaps< sal_Int16 >( "position", 2 );
+ break;
+
+ case BIFF_ID_CHFRBLOCKBEGIN:
+ dumpFrHeader( true, false );
+ dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" );
+ dumpDec< sal_uInt16 >( "context" );
+ dumpDec< sal_uInt16 >( "value-1" );
+ dumpDec< sal_uInt16 >( "value-2" );
+ break;
+
+ case BIFF_ID_CHFRBLOCKEND:
+ dumpFrHeader( true, false );
+ dumpDec< sal_uInt16 >( "type", "CHFRBLOCK-TYPE" );
+ if( rStrm.getRemaining() >= 6 )
+ dumpUnused( 6 );
+ break;
+
+ case BIFF_ID_CHFRCATEGORYPROPS:
+ dumpFrHeader( true, false );
+ dumpDec< sal_uInt16 >( "label-offset", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "alignment", "CHFRCATEGORYPROPS-ALIGN" );
+ dumpHex< sal_uInt16 >( "flags", "CHFRCATEGORYPROPS-FLAGS" );
+ break;
+
+ case BIFF_ID_CHFREXTPROPS:
+ {
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt32 >( "data-size" );
+ dumpDec< sal_uInt8 >( "version" );
+ dumpUnused( 1 );
+ dumpDec< sal_uInt16 >( "parent", "CHFREXTPROPS-PARENT" );
+ dumpChFrExtProps();
+ dumpUnused( 4 );
+ }
+ break;
+
+ case BIFF_ID_CHFRINFO:
+ {
+ dumpFrHeader( true, false );
+ dumpDec< sal_uInt8 >( "creator", "CHFRINFO-APPVERSION" );
+ dumpDec< sal_uInt8 >( "writer", "CHFRINFO-APPVERSION" );
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "rec-range-count" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
+ dumpHexPair< sal_uInt16 >( "#rec-range", '-' );
+ }
+ break;
+
+ case BIFF_ID_CHFRLABELPROPS:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt16 >( "flags", "CHFRLABELPROPS-FLAGS" );
+ dumpUniString( "separator", BIFF_STR_SMARTFLAGS );
+ break;
+
+ case BIFF_ID_CHFRLAYOUT:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt32 >( "checksum" );
+ dumpHex< sal_uInt16 >( "flags", "CHFRLAYOUT-FLAGS" );
+ dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" );
+ dumpRect< double >( "position" );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_CHFRPLOTAREALAYOUT:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt32 >( "checksum" );
+ dumpHex< sal_uInt16 >( "flags", "CHFRPLOTAREALAYOUT-FLAGS" );
+ dumpRect< sal_Int16 >( "position" );
+ dumpDec< sal_uInt16 >( "mode-x", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-y", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-w", "CHFRLAYOUT-MODE" );
+ dumpDec< sal_uInt16 >( "mode-h", "CHFRLAYOUT-MODE" );
+ dumpRect< double >( "position" );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_CHFRSHAPEPROPS:
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt16 >( "context" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt32 >( "checksum" );
+ dumpDec< sal_uInt32 >( "xml-size" );
+ break;
+
+ case BIFF_ID_CHFRTEXTPROPS:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt32 >( "checksum" );
+ dumpDec< sal_uInt32 >( "xml-size" );
+ break;
+
+ case BIFF_ID_CHFRUNITPROPS:
+ dumpFrHeader( true, false );
+ dumpDec< sal_Int16 >( "preset", "CHFRUNITPROPS-PRESET" );
+ dumpDec< double >( "unit" );
+ dumpHex< sal_uInt16 >( "flags", "CHFRUNITPROPS-FLAGS" );
+ break;
+
+ case BIFF_ID_CHFRWRAPPER:
+ dumpFrHeader( true, false );
+ break;
+
+ case BIFF_ID_CHLABELRANGE:
+ dumpDec< sal_uInt16 >( "axis-crossing" );
+ dumpDec< sal_uInt16 >( "label-frequency" );
+ dumpDec< sal_uInt16 >( "tick-frequency" );
+ dumpHex< sal_uInt16 >( "flags", "CHLABELRANGE-FLAGS" );
+ break;
+
+ case BIFF_ID_CHLEGEND:
+ dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
+ dumpDec< sal_uInt8 >( "docked-pos", "CHLEGEND-DOCKPOS" );
+ dumpDec< sal_uInt8 >( "spacing", "CHLEGEND-SPACING" );
+ dumpHex< sal_uInt16 >( "flags", "CHLEGEND-FLAGS" );
+ break;
+
+ case BIFF_ID_CHLINEFORMAT:
+ dumpColorABGR();
+ dumpDec< sal_uInt16 >( "line-type", "CHLINEFORMAT-LINETYPE" );
+ dumpDec< sal_Int16 >( "line-weight", "CHLINEFORMAT-LINEWEIGHT" );
+ dumpHex< sal_uInt16 >( "flags", "CHLINEFORMAT-FLAGS" );
+ if( eBiff == BIFF8 ) dumpColorIdx();
+ break;
+
+ case BIFF_ID_CHMARKERFORMAT:
+ dumpColorABGR( "border-color" );
+ dumpColorABGR( "fill-color" );
+ dumpDec< sal_uInt16 >( "marker-type", "CHMARKERFORMAT-TYPE" );
+ dumpHex< sal_uInt16 >( "flags", "CHMARKERFORMAT-FLAGS" );
+ if( eBiff == BIFF8 ) dumpColorIdx( "border-color-idx" );
+ if( eBiff == BIFF8 ) dumpColorIdx( "fill-color-idx" );
+ if( eBiff == BIFF8 ) dumpDec< sal_Int32 >( "marker-size", "CONV-TWIP-TO-PT" );
+ break;
+
+ case BIFF_ID_CHOBJECTLINK:
+ dumpDec< sal_uInt16 >( "link-target", "CHOBJECTLINK-TARGET" );
+ dumpDec< sal_Int16 >( "series-idx" );
+ dumpDec< sal_Int16 >( "point-idx", "CHOBJECTLINK-POINT" );
+ break;
+
+ case BIFF_ID_CHPICFORMAT:
+ dumpDec< sal_uInt16 >( "bitmap-mode", "CHPICFORMAT-BITMAP-MODE" );
+ dumpDec< sal_uInt16 >( "image-format", "CHPICFORMAT-IMAGE-FORMAT" );
+ dumpHex< sal_uInt16 >( "flags", "CHPICFORMAT-FLAGS" );
+ dumpDec< double >( "scaling-factor" );
+ break;
+
+ case BIFF_ID_CHPIE:
+ dumpDec< sal_uInt16 >( "angle", "CONV-DEG" );
+ if( eBiff >= BIFF5 ) dumpDec< sal_uInt16 >( "hole-size" );
+ if( eBiff >= BIFF8 ) dumpHex< sal_uInt16 >( "flags", "CHPIE-FLAGS" );
+ break;
+
+ case BIFF_ID_CHPIVOTFLAGS:
+ dumpRepeatedRecId();
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "CHPIVOTFLAGS-FLAGS" );
+ break;
+
+ case BIFF8_ID_CHPIVOTREF:
+ dumpRepeatedRecId();
+ dumpUnused( 4 );
+ dumpUniString( "ref", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_CHPLOTGROWTH:
+ dumpFix< sal_Int32 >( "horizontal-growth" );
+ dumpFix< sal_Int32 >( "vertical-growth" );
+ break;
+
+ case BIFF_ID_CHPROPERTIES:
+ dumpHex< sal_uInt16 >( "flags", "CHPROPERTIES-FLAGS" );
+ dumpDec< sal_uInt8 >( "empty-cells", "CHPROPERTIES-EMPTYCELLS" );
+ break;
+
+ case BIFF_ID_CHSCATTER:
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubble-size", "CONV-PERCENT" );
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "size-type", "CHSCATTER-SIZETYPE" );
+ if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags", "CHSCATTER-FLAGS" );
+ break;
+
+ case BIFF_ID_CHSERERRORBAR:
+ dumpDec< sal_uInt8 >( "type", "CHSERERRORBAR-TYPE" );
+ dumpDec< sal_uInt8 >( "source", "CHSERERRORBAR-SOURCE" );
+ dumpBool< sal_uInt8 >( "draw-t-shape" );
+ dumpBool< sal_uInt8 >( "draw-line" );
+ dumpDec< double >( "value" );
+ dumpDec< sal_uInt16 >( "custom-count" );
+ break;
+
+ case BIFF_ID_CHSERIES:
+ dumpDec< sal_uInt16 >( "categories-type", "CHSERIES-TYPE" );
+ dumpDec< sal_uInt16 >( "values-type", "CHSERIES-TYPE" );
+ dumpDec< sal_uInt16 >( "categories-count" );
+ dumpDec< sal_uInt16 >( "values-count" );
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubbles-type", "CHSERIES-TYPE" );
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "bubbles-count" );
+ break;
+
+ case BIFF_ID_CHSERTRENDLINE:
+ switch( dumpDec< sal_uInt8 >( "type", "CHSERTRENDLINE-TYPE" ) )
+ {
+ case 0: dumpDec< sal_uInt8 >( "order" ); break;
+ case 4: dumpDec< sal_uInt8 >( "average-period" ); break;
+ default: dumpUnused( 1 );
+ }
+ dumpDec< double >( "intercept" );
+ dumpBool< sal_uInt8 >( "show-equation" );
+ dumpBool< sal_uInt8 >( "show-r-sqrare" );
+ dumpDec< double >( "forecast-forward" );
+ dumpDec< double >( "forecast-backward" );
+ break;
+
+ case BIFF_ID_CHSOURCELINK:
+ dumpDec< sal_uInt8 >( "link-target", "CHSOURCELINK-TARGET" );
+ dumpDec< sal_uInt8 >( "link-type", "CHSOURCELINK-TYPE" );
+ dumpHex< sal_uInt16 >( "flags", "CHSOURCELINK-FLAGS" );
+ dumpFormatIdx();
+ getFormulaDumper().dumpNameFormula();
+ break;
+
+ case BIFF_ID_CHSTRING:
+ dumpDec< sal_uInt16 >( "text-type", "CHSTRING-TYPE" );
+ dumpString( "text", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_CHTEXT:
+ dumpDec< sal_uInt8 >( "horizontal-align", "CHTEXT-HORALIGN" );
+ dumpDec< sal_uInt8 >( "vertical-align", "CHTEXT-VERALIGN" );
+ dumpDec< sal_uInt16 >( "fill-mode", "CHTEXT-FILLMODE" );
+ dumpColorABGR();
+ dumpRect< sal_Int32 >( "position", (eBiff <= BIFF4) ? "CONV-TWIP-TO-CM" : "" );
+ dumpHex< sal_uInt16 >( "flags-1", "CHTEXT-FLAGS1" );
+ if( eBiff == BIFF8 ) dumpColorIdx();
+ if( eBiff == BIFF8 ) dumpHex< sal_uInt16 >( "flags-2", "CHTEXT-FLAGS2" );
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "rotation", "TEXTROTATION" );
+ break;
+
+ case BIFF_ID_CHTICK:
+ dumpDec< sal_uInt8 >( "major-ticks", "CHTICK-TYPE" );
+ dumpDec< sal_uInt8 >( "minor-ticks", "CHTICK-TYPE" );
+ dumpDec< sal_uInt8 >( "label-position", "CHTICK-LABELPOS" );
+ dumpDec< sal_uInt8 >( "fill-mode", "CHTEXT-FILLMODE" );
+ dumpColorABGR( "label-color" );
+ dumpUnused( 16 );
+ dumpHex< sal_uInt16 >( "flags", "CHTICK-FLAGS" );
+ if( eBiff == BIFF8 ) dumpColorIdx( "label-color-idx" );
+ if( eBiff == BIFF8 ) dumpDec< sal_uInt16 >( "label-rotation", "TEXTROTATION" );
+ break;
+
+ case BIFF_ID_CHTYPEGROUP:
+ dumpUnused( 16 );
+ dumpHex< sal_uInt16 >( "flags", "CHTYPEGROUP-FLAGS" );
+ if( eBiff >= BIFF5 ) dumpDec< sal_uInt16 >( "group-idx" );
+ break;
+
+ case BIFF_ID_CHVALUERANGE:
+ dumpDec< double >( "minimum" );
+ dumpDec< double >( "maximum" );
+ dumpDec< double >( "major-inc" );
+ dumpDec< double >( "minor-inc" );
+ dumpDec< double >( "axis-crossing" );
+ dumpHex< sal_uInt16 >( "flags", "CHVALUERANGE-FLAGS" );
+ break;
+
+ case BIFF_ID_CODENAME:
+ dumpUniString( "codename" );
+ break;
+
+ case BIFF_ID_CODEPAGE:
+ getBiffData().setTextEncoding( dumpCodePage() );
+ mbHasCodePage = true;
+ break;
+
+ case BIFF_ID_COLINFO:
+ dumpColRange();
+ dumpDec< sal_uInt16 >( "col-width", "CONV-COLWIDTH" );
+ dumpXfIdx( "xf-idx" );
+ dumpHex< sal_uInt16 >( "flags", "COLINFO-FLAGS" );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_COLUMNDEFAULT:
+ mxOut->resetItemIndex();
+ for( sal_Int32 nCol = 0, nCount = dumpColRange(); nCol < nCount; ++nCol )
+ dumpXfIdx( "#xf-idx", true );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_COLWIDTH:
+ dumpColRange( EMPTY_STRING, false );
+ dumpDec< sal_uInt16 >( "col-width", "CONV-COLWIDTH" );
+ break;
+
+ case BIFF_ID_COMPRESSPICS:
+ dumpFrHeader( true, true );
+ dumpBool< sal_uInt32 >( "recommend-compress-pics" );
+ break;
+
+ case BIFF_ID_CONNECTION:
+ {
+ dumpFrHeader( true, false );
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ sal_uInt16 nFlags1 = dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
+ dumpDec< sal_uInt16 >( "param-count" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "querytable-flags", "QUERYTABLESETTINGS-FLAGS" );
+ switch( nType )
+ {
+ case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break;
+ case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break;
+ case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break;
+ default: dumpUnused( 2 );
+ }
+ dumpDec< sal_uInt8 >( "edited-version" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
+ dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
+ dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
+ dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
+ dumpUnused( 1 );
+ dumpSegmentedUniString( "source-file" );
+ dumpSegmentedUniString( "source-conn-file" );
+ dumpSegmentedUniString( "name" );
+ dumpSegmentedUniString( "description" );
+ dumpSegmentedUniString( "sso-id" );
+ if( nFlags1 & 0x0004 ) dumpSegmentedUniString( "table-names" );
+ if( nFlags1 & 0x0010 )
+ {
+ break; // TODO: parameter array structure
+ }
+ bool bEscape = false;
+ switch( nType )
+ {
+ case 1:
+ dumpSegmentedUniString( "connection-string" );
+ break;
+ case 4:
+ dumpSegmentedUniStringArray( "urls" );
+ dumpSegmentedUniStringArray( "post-method" );
+ break;
+ case 5:
+ bEscape = true;
+ break;
+ case 6:
+ bEscape = true;
+ break;
+ }
+ if( bEscape )
+ break;
+ dumpSegmentedUniStringArray( "sql-command" );
+ dumpSegmentedUniStringArray( "orig-sql-command" );
+ dumpSegmentedUniStringArray( "webquery-dialog-url" );
+ switch( dumpDec< sal_uInt8 >( "linked-object-type", "CONNECTION-LINKEDOBJECTTYPE" ) )
+ {
+ case 1: dumpSegmentedUniString( "defined-name" ); break;
+ case 2: dumpHex< sal_uInt16 >( "cache-id" ); break;
+ }
+ }
+ break;
+
+ case BIFF_ID_CONT:
+ if( (eBiff == BIFF8) && (getLastRecId() == BIFF_ID_OBJ) )
+ dumpEmbeddedDff();
+ break;
+
+ case BIFF_ID_COORDLIST:
+ {
+ mxOut->resetItemIndex();
+ TableGuard aTabGuard( mxOut, 12, 10 );
+ while( rStrm.getRemaining() >= 4 )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#point" );
+ dumpDec< sal_uInt16 >( "x" );
+ dumpDec< sal_uInt16 >( "y" );
+ }
+ }
+ break;
+
+ case BIFF_ID_COUNTRY:
+ dumpDec< sal_uInt16 >( "ui-country", "COUNTRY" );
+ dumpDec< sal_uInt16 >( "sys-country", "COUNTRY" );
+ break;
+
+ case BIFF_ID_CRN:
+ {
+ sal_Int32 nCol2 = dumpColIndex( "last-col-idx", false );
+ sal_Int32 nCol1 = dumpColIndex( "first-col-idx", false );
+ sal_Int32 nRow = dumpRowIndex( "row-idx" );
+ TableGuard aTabGuard( mxOut, 14, 17 );
+ for( Address aPos( nCol1, nRow ); !rStrm.isEof() && (aPos.mnCol <= nCol2); ++aPos.mnCol )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeAddressItem( "pos", aPos );
+ dumpConstValue();
+ }
+ }
+ break;
+
+ case BIFF_ID_DCONBINAME:
+ dumpDec< sal_uInt8 >( "builtin-id", "DEFINEDNAME-BUILTINID" );
+ dumpUnused( 3 );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
+ break;
+
+ case BIFF_ID_DCONNAME:
+ dumpString( "source-name", BIFF_STR_8BITLENGTH );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
+ break;
+
+ case BIFF_ID_DCONREF:
+ dumpRange( "source-range", false );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
+ break;
+
+ case BIFF2_ID_DATATABLE:
+ dumpRange( "table-range", false );
+ dumpBoolean( "recalc-always" );
+ dumpBoolean( "row-table" );
+ dumpAddress( "ref1" );
+ break;
+
+ case BIFF3_ID_DATATABLE:
+ dumpRange( "table-range", false );
+ dumpHex< sal_uInt16 >( "flags", "DATATABLE-FLAGS" );
+ dumpAddress( "ref1" );
+ dumpAddress( "ref2" );
+ break;
+
+ case BIFF2_ID_DATATABLE2:
+ dumpRange( "table-range", false );
+ dumpBoolean( "recalc-always" );
+ dumpUnused( 1 );
+ dumpAddress( "ref1" );
+ dumpAddress( "ref2" );
+ break;
+
+ case BIFF_ID_DATAVALIDATION:
+ {
+ dumpHex< sal_uInt32 >( "flags", "DATAVALIDATION-FLAGS" );
+ dumpUniString( "input-title" );
+ dumpUniString( "error-title" );
+ dumpUniString( "input-message" );
+ dumpUniString( "error-message" );
+ sal_uInt16 nFmla1Size = getFormulaDumper().dumpFormulaSize( "formula1-size" );
+ dumpUnused( 2 );
+ if( nFmla1Size > 0 )
+ getFormulaDumper().dumpNameFormula( "formula1", nFmla1Size );
+ sal_uInt16 nFmla2Size = getFormulaDumper().dumpFormulaSize( "formula2-size" );
+ dumpUnused( 2 );
+ if( nFmla2Size > 0 )
+ getFormulaDumper().dumpNameFormula( "formula2", nFmla2Size );
+ dumpRangeList();
+ }
+ break;
+
+ case BIFF_ID_DATAVALIDATIONS:
+ dumpHex< sal_uInt16 >( "flags", "DATAVALIDATIONS-FLAGS" );
+ dumpDec< sal_Int32 >( "input-box-pos-x" );
+ dumpDec< sal_Int32 >( "input-box-pos-y" );
+ dumpDec< sal_Int32 >( "dropdown-object-id" );
+ dumpDec< sal_Int32 >( "dval-entry-count" );
+ break;
+
+ case BIFF_ID_DBCELL:
+ dumpDec< sal_uInt32 >( "reverse-offset-to-row" );
+ mxOut->resetItemIndex();
+ while( rStrm.getRemaining() >= 2 )
+ dumpDec< sal_uInt16 >( "#cell-offset" );
+ break;
+
+ case BIFF_ID_DBQUERY:
+ if( eBiff == BIFF8 )
+ {
+ if( (getLastRecId() != BIFF_ID_PCITEM_STRING) && (getLastRecId() != BIFF_ID_DBQUERY) )
+ {
+ dumpHex< sal_uInt16 >( "flags", "DBQUERY-FLAGS" );
+ dumpDec< sal_uInt16 >( "sql-param-count" );
+ dumpDec< sal_uInt16 >( "command-count" );
+ dumpDec< sal_uInt16 >( "post-method-count" );
+ dumpDec< sal_uInt16 >( "server-sql-count" );
+ dumpDec< sal_uInt16 >( "odbc-connection-count" );
+ }
+ }
+ break;
+
+ case BIFF2_ID_DEFINEDNAME:
+ case BIFF3_ID_DEFINEDNAME:
+ {
+ rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
+ dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "DEFINEDNAME-FLAGS" );
+ if( eBiff == BIFF2 ) dumpDec< sal_uInt8 >( "macro-type", "DEFINEDNAME-MACROTYPE-BIFF2" );
+ dumpChar( "accelerator", eTextEnc );
+ sal_uInt8 nNameLen = dumpDec< sal_uInt8 >( "name-len" );
+ sal_uInt16 nFmlaSize = getFormulaDumper().dumpFormulaSize();
+ if( eBiff >= BIFF5 )
+ {
+ bool bBiff8 = eBiff == BIFF8;
+ if( bBiff8 ) dumpUnused( 2 ); else dumpDec< sal_uInt16 >( "externsheet-idx", "DEFINEDNAME-SHEETIDX" );
+ dumpDec< sal_uInt16 >( "sheet-idx", "DEFINEDNAME-SHEETIDX" );
+ sal_uInt8 nMenuLen = dumpDec< sal_uInt8 >( "menu-text-len" );
+ sal_uInt8 nDescrLen = dumpDec< sal_uInt8 >( "description-text-len" );
+ sal_uInt8 nHelpLen = dumpDec< sal_uInt8 >( "help-text-len" );
+ sal_uInt8 nStatusLen = dumpDec< sal_uInt8 >( "statusbar-text-len" );
+ writeStringItem( "name", bBiff8 ? rStrm.readUniStringBody( nNameLen, true ) : rStrm.readCharArrayUC( nNameLen, eTextEnc, true ) );
+ getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
+ if( nMenuLen > 0 ) writeStringItem( "menu-text", bBiff8 ? rStrm.readUniStringBody( nMenuLen, true ) : rStrm.readCharArrayUC( nMenuLen, eTextEnc, true ) );
+ if( nDescrLen > 0 ) writeStringItem( "description-text", bBiff8 ? rStrm.readUniStringBody( nDescrLen, true ) : rStrm.readCharArrayUC( nDescrLen, eTextEnc, true ) );
+ if( nHelpLen > 0 ) writeStringItem( "help-text", bBiff8 ? rStrm.readUniStringBody( nHelpLen, true ) : rStrm.readCharArrayUC( nHelpLen, eTextEnc, true ) );
+ if( nStatusLen > 0 ) writeStringItem( "statusbar-text", bBiff8 ? rStrm.readUniStringBody( nStatusLen, true ) : rStrm.readCharArrayUC( nStatusLen, eTextEnc, true ) );
+ }
+ else
+ {
+ writeStringItem( "name", rStrm.readCharArrayUC( nNameLen, eTextEnc, true ) );
+ getFormulaDumper().dumpNameFormula( EMPTY_STRING, nFmlaSize );
+ if( eBiff == BIFF2 ) getFormulaDumper().dumpFormulaSize();
+ }
+ }
+ break;
+
+ case BIFF3_ID_DEFROWHEIGHT:
+ dumpHex< sal_uInt16 >( "flags", "DEFROWHEIGHT-FLAGS" );
+ dumpDec< sal_uInt16 >( "row-height", "CONV-TWIP-TO-PT" );
+ break;
+
+ case BIFF2_ID_DIMENSION:
+ case BIFF3_ID_DIMENSION:
+ dumpRange( "used-area", true, (nRecId == BIFF3_ID_DIMENSION) && (eBiff == BIFF8) );
+ if( nRecId == BIFF3_ID_DIMENSION ) dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_DXF:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt16 >( "flags", "DXF-FLAGS" );
+ dumpDxfProp();
+ break;
+
+ case BIFF_ID_EXTERNALBOOK:
+ {
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "sheet-count" );
+ if( rStrm.getRemaining() == 2 )
+ dumpHex< sal_uInt16 >( "special-key", "EXTERNALBOOK-KEY" );
+ else
+ {
+ dumpString( "workbook-url" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nSheet = 0; !rStrm.isEof() && (nSheet < nCount); ++nSheet )
+ dumpString( "#sheet-name" );
+ }
+ }
+ break;
+
+ case BIFF2_ID_EXTERNALNAME:
+ case BIFF3_ID_EXTERNALNAME:
+ {
+ sal_uInt16 nFlags = (eBiff >= BIFF3) ? dumpHex< sal_uInt16 >( "flags", "EXTERNALNAME-FLAGS" ) : 0;
+ if( eBiff >= BIFF5 )
+ {
+ if( getFlag< sal_uInt16 >( nFlags, 0x0010 ) )
+ {
+ dumpHex< sal_uInt32 >( "storage-id" );
+ }
+ else
+ {
+ dumpDec< sal_uInt16 >( "externsheet-idx" );
+ dumpUnused( 2 );
+ }
+ }
+ OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
+ if( (aName.getLength() > 0) && (aName[ 0 ] == 1) && (rStrm.getRemaining() >= 2) )
+ getFormulaDumper().dumpNameFormula();
+ }
+ break;
+
+ case BIFF_ID_EXTERNSHEET:
+ if( eBiff == BIFF8 )
+ {
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "ref-count" );
+ TableGuard aTabGuard( mxOut, 10, 17, 24 );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nCount); ++nRefId )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#ref" );
+ dumpDec< sal_uInt16 >( "extbook-idx" );
+ dumpDec< sal_Int16 >( "first-sheet", "EXTERNSHEET-IDX" );
+ dumpDec< sal_Int16 >( "last-sheet", "EXTERNSHEET-IDX" );
+ }
+ }
+ else
+ {
+ OStringBuffer aUrl( rStrm.readByteString( false, true ) );
+ if( (aUrl.getLength() > 0) && (aUrl[ 0 ] == '\x03') )
+ aUrl.append( static_cast< sal_Char >( rStrm.readuInt8() ) );
+ writeStringItem( "encoded-url", OStringToOUString( aUrl.makeStringAndClear(), getBiffData().getTextEncoding() ) );
+ }
+ break;
+
+ case BIFF_ID_FILEPASS:
+ {
+ rStrm.enableDecoder( false );
+ if( eBiff == BIFF8 )
+ {
+ switch( dumpDec< sal_uInt16 >( "type", "FILEPASS-TYPE" ) )
+ {
+ case 0:
+ dumpHex< sal_uInt16 >( "key" );
+ dumpHex< sal_uInt16 >( "verifier" );
+ break;
+ case 1:
+ {
+ sal_uInt16 nMajor = dumpDec< sal_uInt16 >( "major-version", "FILEPASS-MAJOR" );
+ dumpDec< sal_uInt16 >( "minor-version" );
+ switch( nMajor )
+ {
+ case 1:
+ dumpArray( "salt", 16 );
+ dumpArray( "verifier", 16 );
+ dumpArray( "verifier-hash", 16 );
+ break;
+ }
+ }
+ break;
+ }
+ }
+ else
+ {
+ dumpHex< sal_uInt16 >( "key" );
+ dumpHex< sal_uInt16 >( "verifier" );
+ }
+ rStrm.seekToStart();
+ BiffDecoderRef xDecoder = BiffCodecHelper::implReadFilePass( rStrm, eBiff );
+ if( xDecoder.get() )
+ cfg().requestEncryptionData( *xDecoder );
+ setBinaryOnlyMode( !xDecoder || !xDecoder->isValid() );
+ }
+ break;
+
+ case BIFF_ID_FILESHARING:
+ dumpBool< sal_uInt16 >( "recommend-read-only" );
+ dumpHex< sal_uInt16 >( "password-hash" );
+ dumpString( "password-creator", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
+ break;
+
+ case BIFF_ID_FILTERCOLUMN:
+ {
+ dumpDec< sal_uInt16 >( "column-index" );
+ dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
+ sal_uInt8 nStrLen1 = dumpFilterColumnOperator( "operator-1" );
+ sal_uInt8 nStrLen2 = dumpFilterColumnOperator( "operator-2" );
+ bool bBiff8 = eBiff == BIFF8;
+ rtl_TextEncoding eTextEnc = getBiffData().getTextEncoding();
+ if( nStrLen1 > 0 ) writeStringItem( "string-1", bBiff8 ? rStrm.readUniStringBody( nStrLen1, true ) : rStrm.readCharArrayUC( nStrLen1, eTextEnc, true ) );
+ if( nStrLen2 > 0 ) writeStringItem( "string-2", bBiff8 ? rStrm.readUniStringBody( nStrLen2, true ) : rStrm.readCharArrayUC( nStrLen2, eTextEnc, true ) );
+ }
+ break;
+
+ case BIFF2_ID_FONT:
+ case BIFF3_ID_FONT:
+ dumpFontRec();
+ break;
+
+ case BIFF_ID_FORCEFULLCALC:
+ dumpFrHeader( true, true );
+ dumpBool< sal_Int32 >( "recalc-all-formulas" );
+ break;
+
+ case BIFF2_ID_FORMAT:
+ case BIFF4_ID_FORMAT:
+ dumpFormatRec();
+ break;
+
+ case BIFF2_ID_FORMULA:
+ case BIFF3_ID_FORMULA:
+ case BIFF4_ID_FORMULA:
+ dumpCellHeader( eBiff == BIFF2 );
+ dumpFormulaResult();
+ dumpHex< sal_uInt16, sal_uInt8 >( eBiff != BIFF2, "flags", "FORMULA-FLAGS" );
+ if( eBiff >= BIFF5 ) dumpUnused( 4 );
+ getFormulaDumper().dumpCellFormula();
+ break;
+
+ case BIFF_ID_FOOTER:
+ if( rStrm.getRemaining() > 0 )
+ dumpString( "footer", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_GUTS:
+ dumpDec< sal_uInt16 >( "row-outlines-width" );
+ dumpDec< sal_uInt16 >( "column-outlines-height" );
+ dumpDec< sal_uInt16 >( "row-levels", "GUTS-LEVELS" );
+ dumpDec< sal_uInt16 >( "column-levels", "GUTS-LEVELS" );
+ break;
+
+ case BIFF_ID_HEADER:
+ if( rStrm.getRemaining() > 0 )
+ dumpString( "header", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_HEADERFOOTER:
+ {
+ dumpFrHeader( true, true );
+ dumpGuid( "view-guid" );
+ dumpHex< sal_uInt16 >( "flags", "HEADERFOOTER-FLAGS" );
+ sal_uInt16 nEvenHLen = dumpDec< sal_uInt16 >( "even-h-len" );
+ sal_uInt16 nEvenFLen = dumpDec< sal_uInt16 >( "even-f-len" );
+ sal_uInt16 nFirstHLen = dumpDec< sal_uInt16 >( "first-h-len" );
+ sal_uInt16 nFirstFLen = dumpDec< sal_uInt16 >( "first-f-len" );
+ if( nEvenHLen > 0 ) dumpUniString( "even-h" );
+ if( nEvenFLen > 0 ) dumpUniString( "even-f" );
+ if( nFirstHLen > 0 ) dumpUniString( "first-h" );
+ if( nFirstFLen > 0 ) dumpUniString( "first-f" );
+ }
+ break;
+
+ case BIFF_ID_HYPERLINK:
+ dumpRange();
+ if( cfg().getStringOption( dumpGuid( "guid" ), OUString() ).equalsAscii( "StdHlink" ) )
+ StdHlinkObject( *this ).dump();
+ break;
+
+ case BIFF3_ID_IMGDATA:
+ case BIFF8_ID_IMGDATA:
+ {
+ sal_uInt16 nFormat = dumpDec< sal_uInt16 >( "image-format", "IMGDATA-FORMAT" );
+ dumpDec< sal_uInt16 >( "environment", "IMGDATA-ENV" );
+ dumpDec< sal_uInt32 >( "data-size" );
+ if( nFormat == 9 )
+ {
+ writeEmptyItem( "bitmap-header" );
+ IndentGuard aIndGuard( mxOut );
+ if( dumpDec< sal_uInt32 >( "header-size" ) == 12 )
+ {
+ dumpDec< sal_Int16 >( "width" );
+ dumpDec< sal_Int16 >( "height" );
+ dumpDec< sal_Int16 >( "planes" );
+ dumpDec< sal_Int16 >( "bit-count" );
+ }
+ }
+ }
+ break;
+
+ case BIFF2_ID_INDEX:
+ case BIFF3_ID_INDEX:
+ if( eBiff <= BIFF4 )
+ dumpHex< sal_uInt32 >( "first-defname-pos", "CONV-DEC" );
+ else
+ dumpUnused( 4 );
+ dumpRowIndex( "first-row-with-cell", eBiff == BIFF8 );
+ dumpRowIndex( "first-free-row", eBiff == BIFF8 );
+ if( nRecId == BIFF3_ID_INDEX ) dumpHex< sal_uInt32 >( (eBiff <= BIFF4) ? "first-xf-pos" : "defcolwidth-pos", "CONV-DEC" );
+ mxOut->resetItemIndex();
+ while( rStrm.getRemaining() >= 4 )
+ dumpHex< sal_uInt32 >( "#first-row-pos-of-block", "CONV-DEC" );
+ break;
+
+ case BIFF2_ID_INTEGER:
+ dumpCellHeader( true );
+ dumpDec< sal_uInt16 >( "value" );
+ break;
+
+ case BIFF2_ID_LABEL:
+ case BIFF3_ID_LABEL:
+ {
+ bool bBiff2 = nRecId == BIFF2_ID_LABEL;
+ sal_uInt16 nXfIdx = dumpCellHeader( bBiff2 );
+ rtl_TextEncoding eOldTextEnc = getBiffData().getTextEncoding();
+ getBiffData().setTextEncoding( getBiffData().getXfEncoding( nXfIdx ) );
+ dumpString( "value", bBiff2 ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT );
+ getBiffData().setTextEncoding( eOldTextEnc );
+ }
+ break;
+
+ case BIFF_ID_LABELRANGES:
+ dumpRangeList( "row-ranges" );
+ dumpRangeList( "col-ranges" );
+ break;
+
+ case BIFF_ID_LABELSST:
+ dumpCellHeader();
+ dumpDec< sal_Int32 >( "sst-idx" );
+ break;
+
+ case BIFF_ID_MSODRAWING:
+ case BIFF_ID_MSODRAWINGGROUP:
+ case BIFF_ID_MSODRAWINGSEL:
+ dumpEmbeddedDff();
+ mbHasDff = true;
+ break;
+
+ case BIFF_ID_MTHREADSETTINGS:
+ dumpFrHeader( true, true );
+ dumpBool< sal_Int32 >( "multi-thread-enabled" );
+ dumpBool< sal_Int32 >( "manual-thread-count" );
+ dumpDec< sal_Int32 >( "thread-count" );
+ break;
+
+ case BIFF_ID_MULTBLANK:
+ {
+ Address aPos = dumpAddress();
+ {
+ TableGuard aTabGuard( mxOut, 12 );
+ for( ; rStrm.getRemaining() >= 4; ++aPos.mnCol )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeAddressItem( "pos", aPos );
+ dumpXfIdx();
+ }
+ }
+ dumpColIndex( "last-col-idx" );
+ }
+ break;
+
+ case BIFF_ID_MULTRK:
+ {
+ Address aPos = dumpAddress();
+ {
+ TableGuard aTabGuard( mxOut, 12, 12 );
+ for( ; rStrm.getRemaining() >= 8; ++aPos.mnCol )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeAddressItem( "pos", aPos );
+ dumpXfIdx();
+ dumpRk( "value" );
+ }
+ }
+ dumpColIndex( "last-col-idx" );
+ }
+ break;
+
+ case BIFF_ID_NOTE:
+ dumpAddress( "anchor-cell" );
+ if( eBiff == BIFF8 )
+ {
+ dumpHex< sal_uInt16 >( "flags", "NOTE-FLAGS" );
+ dumpDec< sal_uInt16 >( "obj-id" );
+ }
+ else
+ {
+ sal_uInt16 nTextLen = ::std::min( dumpDec< sal_uInt16 >( "text-len" ), static_cast< sal_uInt16 >( rStrm.getRemaining() ) );
+ writeStringItem( "note-text", rStrm.readCharArrayUC( nTextLen, getBiffData().getTextEncoding(), true ) );
+ }
+ break;
+
+ case BIFF2_ID_NUMBER:
+ case BIFF3_ID_NUMBER:
+ dumpCellHeader( nRecId == BIFF2_ID_NUMBER );
+ dumpDec< double >( "value" );
+ break;
+
+ case BIFF_ID_OBJ:
+ dumpObjRec();
+ break;
+
+ case BIFF_ID_OLESIZE:
+ dumpUnused( 2 );
+ dumpRange( "visible-range", false );
+ break;
+
+ case BIFF_ID_PAGELAYOUTVIEW:
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt16 >( "scaling", "CONV-PERCENT" );
+ dumpHex< sal_uInt16 >( "flags", "PAGELAYOUTVIEW-FLAGS" );
+ break;
+
+ case BIFF_ID_PAGESETUP:
+ dumpDec< sal_uInt16 >( "paper-size", "PAGESETUP-PAPERSIZE" );
+ dumpDec< sal_uInt16 >( "scaling", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "first-page" );
+ dumpDec< sal_uInt16 >( "scale-to-width", "PAGESETUP-SCALETOPAGES" );
+ dumpDec< sal_uInt16 >( "scale-to-height", "PAGESETUP-SCALETOPAGES" );
+ dumpHex< sal_uInt16 >( "flags", "PAGESETUP-FLAGS" );
+ if( eBiff >= BIFF5 )
+ {
+ dumpDec< sal_uInt16 >( "horizontal-res", "PAGESETUP-DPI" );
+ dumpDec< sal_uInt16 >( "vertical-res", "PAGESETUP-DPI" );
+ dumpDec< double >( "header-margin", "CONV-INCH-TO-CM" );
+ dumpDec< double >( "footer-margin", "CONV-INCH-TO-CM" );
+ dumpDec< sal_uInt16 >( "copies" );
+ }
+ break;
+
+ case BIFF_ID_PANE:
+ dumpDec< sal_uInt16 >( "x-pos", "CONV-TWIP-TO-CM" );
+ dumpDec< sal_uInt16 >( "y-pos", "CONV-TWIP-TO-CM" );
+ dumpAddress( "first-visible-cell" );
+ dumpDec< sal_uInt8 >( "active-pane", "PANE-ID" );
+ break;
+
+ case BIFF_ID_PCITEM_STRING:
+ dumpString( "value" );
+ break;
+
+ case BIFF_ID_PHONETICPR:
+ dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
+ dumpHex< sal_uInt16 >( "flags", "PHONETICPR-FLAGS" );
+ dumpRangeList( "show-phonetic" );
+ break;
+
+ case BIFF_ID_PROJEXTSHEET:
+ dumpDec< sal_uInt8 >( "sheet-type", "PROJEXTSHEET-TYPE" );
+ dumpUnused( 1 );
+ dumpByteString( "sheet-link", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_PTDATAFIELD:
+ dumpDec< sal_Int16 >( "field" );
+ dumpDec< sal_uInt16 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
+ dumpDec< sal_uInt16 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
+ dumpDec< sal_Int16 >( "base-field" );
+ dumpDec< sal_Int16 >( "base-item", "PTDATAFIELD-BASEITEM" );
+ dumpFormatIdx();
+ dumpPivotString( "name" );
+ break;
+
+ case BIFF_ID_PTDEFINITION:
+ {
+ dumpRange( "output-range" );
+ dumpRowIndex( "first-header-row-idx" );
+ dumpAddress( "first-data-pos" );
+ dumpDec< sal_uInt16 >( "cache-idx" );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "default-data-axis", "PTFIELD-AXISTYPE" );
+ dumpDec< sal_Int16 >( "default-data-pos", "PTDEFINITION-DATAFIELD-POS" );
+ dumpDec< sal_uInt16 >( "field-count" );
+ mnPTRowFields = dumpDec< sal_uInt16 >( "row-field-count" );
+ mnPTColFields = dumpDec< sal_uInt16 >( "column-field-count" );
+ dumpDec< sal_uInt16 >( "page-field-count" );
+ dumpDec< sal_uInt16 >( "data-field-count" );
+ dumpDec< sal_uInt16 >( "data-row-count" );
+ dumpDec< sal_uInt16 >( "data-column-count" );
+ dumpHex< sal_uInt16 >( "flags", "PTDEFINITION-FLAGS" );
+ dumpDec< sal_uInt16 >( "auto-format-idx" );
+ sal_uInt16 nTabNameLen = dumpDec< sal_uInt16 >( "table-name-len" );
+ sal_uInt16 nDataNameLen = dumpDec< sal_uInt16 >( "data-name-len" );
+ dumpPivotString( "table-name", nTabNameLen );
+ dumpPivotString( "data-name", nDataNameLen );
+ mnPTRowColItemsIdx = 0;
+ }
+ break;
+
+ case BIFF_ID_PTDEFINITION2:
+ {
+ dumpDec< sal_uInt16 >( "format-rec-count" );
+ sal_uInt16 nErrCaptLen = dumpDec< sal_uInt16 >( "error-caption-len" );
+ sal_uInt16 nMissCaptLen = dumpDec< sal_uInt16 >( "missing-caption-len" );
+ sal_uInt16 nTagLen = dumpDec< sal_uInt16 >( "tag-len" );
+ dumpDec< sal_uInt16 >( "select-rec-count" );
+ dumpDec< sal_uInt16 >( "page-rows" );
+ dumpDec< sal_uInt16 >( "page-cols" );
+ dumpHex< sal_uInt32 >( "flags", "PTDEFINITION2-FLAGS" );
+ sal_uInt16 nPageStyleLen = dumpDec< sal_uInt16 >( "page-field-style-len" );
+ sal_uInt16 nTabStyleLen = dumpDec< sal_uInt16 >( "pivot-table-style-len" );
+ sal_uInt16 nVacStyleLen = dumpDec< sal_uInt16 >( "vacated-style-len" );
+ dumpPivotString( "error-caption", nErrCaptLen );
+ dumpPivotString( "missing-caption", nMissCaptLen );
+ dumpPivotString( "tag", nTagLen );
+ dumpPivotString( "page-field-style", nPageStyleLen );
+ dumpPivotString( "pivot-table-style", nTabStyleLen );
+ dumpPivotString( "vacated-style", nVacStyleLen );
+ }
+ break;
+
+ case BIFF_ID_PTFIELD:
+ dumpDec< sal_uInt16 >( "axis-type", "PTFIELD-AXISTYPE" );
+ dumpDec< sal_uInt16 >( "subtotal-count" );
+ dumpHex< sal_uInt16 >( "subtotals", "PTFIELD-SUBTOTALS" );
+ dumpDec< sal_uInt16 >( "item-count" );
+ dumpPivotString( "field-name" );
+ break;
+
+ case BIFF_ID_PTFIELD2:
+ dumpHex< sal_uInt32 >( "flags", "PTFIELD2-FLAGS" );
+ dumpDec< sal_Int16 >( "autosort-basefield-idx" );
+ dumpDec< sal_Int16 >( "autoshow-basefield-idx" );
+ dumpFormatIdx();
+ if( rStrm.getRemaining() >= 2 )
+ {
+ sal_uInt16 nFuncNameLen = dumpDec< sal_uInt16 >( "subtotal-func-name-len" );
+ dumpUnused( 8 );
+ dumpPivotString( "subtotal-func-name", nFuncNameLen );
+ }
+ break;
+
+ case BIFF_ID_PTFITEM:
+ dumpDec< sal_uInt16 >( "item-type", "PTFITEM-ITEMTYPE" );
+ dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
+ dumpDec< sal_Int16 >( "cache-idx", "PTFITEM-CACHEIDX" );
+ dumpPivotString( "item-name" );
+ break;
+
+ case BIFF_ID_PTPAGEFIELDS:
+ {
+ mxOut->resetItemIndex();
+ TableGuard aTabGuard( mxOut, 17, 17, 17 );
+ while( rStrm.getRemaining() >= 6 )
+ {
+ writeEmptyItem( "#page-field" );
+ MultiItemsGuard aMultiGuard( mxOut );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int16 >( "base-field" );
+ dumpDec< sal_Int16 >( "item", "PTPAGEFIELDS-ITEM" );
+ dumpDec< sal_uInt16 >( "dropdown-obj-id" );
+ }
+ }
+ break;
+
+ case BIFF_ID_PTROWCOLFIELDS:
+ mxOut->resetItemIndex();
+ for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
+ dumpDec< sal_Int16 >( "#field-idx" );
+ break;
+
+ case BIFF_ID_PTROWCOLITEMS:
+ if( mnPTRowColItemsIdx < 2 )
+ {
+ sal_uInt16 nCount = (mnPTRowColItemsIdx == 0) ? mnPTRowFields : mnPTColFields;
+ sal_Int64 nLineSize = 8 + 2 * nCount;
+ mxOut->resetItemIndex();
+ while( rStrm.getRemaining() >= nLineSize )
+ {
+ writeEmptyItem( "#line-data" );
+ IndentGuard aIndGuard( mxOut );
+ MultiItemsGuard aMultiGuard( mxOut );
+ dumpDec< sal_uInt16 >( "ident-count" );
+ dumpDec< sal_uInt16 >( "item-type", "PTROWCOLITEMS-ITEMTYPE" );
+ dumpDec< sal_uInt16 >( "used-count" );
+ dumpHex< sal_uInt16 >( "flags", "PTROWCOLITEMS-FLAGS" );
+ OUStringBuffer aItemList;
+ for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
+ StringHelper::appendToken( aItemList, mxStrm->readInt16() );
+ writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
+ }
+ ++mnPTRowColItemsIdx;
+ }
+ break;
+
+ case BIFF_ID_QUERYTABLE:
+ dumpHex< sal_uInt16 >( "flags", "QUERYTABLE-FLAGS" );
+ dumpDec< sal_uInt16 >( "autoformat-id" );
+ dumpHex< sal_uInt16 >( "autoformat-flags", "QUERYTABLE-AUTOFORMAT-FLAGS" );
+ dumpUnused( 4 );
+ dumpUniString( "defined-name" );
+ dumpUnused( 2 );
+ break;
+
+ case BIFF_ID_QUERYTABLEREFRESH:
+ {
+ dumpFrHeader( true, false );
+ bool bPivot = dumpBool< sal_uInt16 >( "pivot-table" );
+ dumpHex< sal_uInt16 >( "flags", "QUERYTABLEREFRESH-FLAGS" );
+ dumpHex< sal_uInt32 >( bPivot ? "pivottable-flags" : "querytable-flags", bPivot ? "QUERYTABLEREFRESH-PTFLAGS" : "QUERYTABLEREFRESH-QTFLAGS" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpUnused( 2 );
+ dumpUniString( "table-name" );
+ dumpUnused( 2 );
+ }
+ break;
+
+ case BIFF_ID_QUERYTABLESETTINGS:
+ {
+ dumpFrHeader( true, false );
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ dumpHex< sal_uInt16 >( "flags-1", "QUERYTABLESETTINGS-FLAGS" );
+ switch( nType )
+ {
+ case 4: dumpHex< sal_uInt16 >( "html-flags", "QUERYTABLESETTINGS-HTML-FLAGS" ); break;
+ case 5: dumpHex< sal_uInt16 >( "oledb-flags", "QUERYTABLESETTINGS-OLEDB-FLAGS" ); break;
+ case 7: dumpHex< sal_uInt16 >( "ado-flags", "QUERYTABLESETTINGS-ADO-FLAGS" ); break;
+ default: dumpUnused( 2 );
+ }
+ dumpHex< sal_uInt16 >( "ext-flags", "QUERYTABLESETTINGS-EXT-FLAGS" );
+ dumpDec< sal_uInt8 >( "edited-version" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpUnused( 3 );
+ dumpDec< sal_uInt16 >( "oledb-count" );
+ dumpDec< sal_uInt16 >( "future-data-size" );
+ dumpDec< sal_uInt16 >( "refresh-interval", "QUERYTABLESETTINGS-INTERVAL" );
+ dumpDec< sal_uInt16 >( "html-format", "QUERYTABLESETTINGS-HTMLFORMAT" );
+ }
+ break;
+
+ case BIFF_ID_QUERYTABLESTRING:
+ dumpFrHeader( true, false );
+ dumpUniString( "connection-string" );
+ break;
+
+ case BIFF_ID_RECALCID:
+ dumpFrHeader( true, false );
+ dumpDec< sal_uInt32 >( "recalc-engine-id" );
+ break;
+
+ case BIFF_ID_RK:
+ dumpCellHeader();
+ dumpRk( "value" );
+ break;
+
+ case BIFF2_ID_ROW:
+ {
+ dumpRowIndex();
+ dumpColIndex( "first-used-col-idx" );
+ dumpColIndex( "first-free-col-idx" );
+ dumpHex< sal_uInt16 >( "height", "ROW-HEIGHT" );
+ dumpUnused( 2 );
+ bool bHasDefXf = dumpBool< sal_uInt8 >( "custom-format" );
+ dumpDec< sal_uInt16 >( "cell-offset" );
+ if( bHasDefXf ) dumpXfIdx( "custom-format", true );
+ if( bHasDefXf ) dumpXfIdx( "custom-xf-idx", false );
+ }
+ break;
+
+ case BIFF3_ID_ROW:
+ dumpRowIndex();
+ dumpColIndex( "first-used-col-idx" );
+ dumpColIndex( "first-free-col-idx" );
+ dumpHex< sal_uInt16 >( "height", "ROW-HEIGHT" );
+ dumpUnused( (eBiff <= BIFF4) ? 2 : 4 );
+ if( eBiff <= BIFF4 ) dumpDec< sal_uInt16 >( "cell-offset" );
+ dumpHex< sal_uInt32 >( "flags", "ROW-FLAGS" );
+ break;
+
+ case BIFF_ID_RSTRING:
+ {
+ sal_uInt16 nXfIdx = dumpCellHeader();
+ rtl_TextEncoding eOldTextEnc = getBiffData().getTextEncoding();
+ getBiffData().setTextEncoding( getBiffData().getXfEncoding( nXfIdx ) );
+ dumpString( "value" );
+ getBiffData().setTextEncoding( eOldTextEnc );
+ FontPortionModelList aPortions;
+ aPortions.importPortions( rStrm, eBiff == BIFF8 );
+ writeFontPortions( aPortions );
+ }
+ break;
+
+ case BIFF_ID_SCENARIO:
+ {
+ sal_uInt16 nCellCount = dumpDec< sal_uInt16 >( "cell-count" );
+ // two bytes instead of flag field
+ dumpBoolean( "locked" );
+ dumpBoolean( "hidden" );
+ sal_uInt16 nNameLen = dumpDec< sal_uInt8 >( "name-len" );
+ sal_uInt16 nCommentLen = dumpDec< sal_uInt8 >( "comment-len" );
+ sal_uInt16 nUserLen = dumpDec< sal_uInt8 >( "user-len" );
+ writeStringItem( "name", rStrm.readUniStringBody( nNameLen, true ) );
+ if( nUserLen > 0 ) dumpUniString( "user" ); // repeated string length
+ if( nCommentLen > 0 ) dumpUniString( "comment" ); // repeated string length
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
+ dumpAddress( "#pos" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nCell = 0; !rStrm.isEof() && (nCell < nCellCount); ++nCell )
+ dumpString( "#value" );
+ dumpUnused( 2 * nCellCount );
+ }
+ break;
+
+ case BIFF_ID_SCENARIOS:
+ dumpDec< sal_uInt16 >( "count" );
+ dumpDec< sal_uInt16 >( "selected" );
+ dumpDec< sal_uInt16 >( "shown" );
+ dumpRangeList( "result-cells" );
+ break;
+
+ case BIFF_ID_SCL:
+ {
+ sal_uInt16 nNum = dumpDec< sal_uInt16 >( "numerator" );
+ sal_uInt16 nDen = dumpDec< sal_uInt16 >( "denominator" );
+ if( nDen > 0 ) writeDecItem( "current-zoom", static_cast< sal_uInt16 >( nNum * 100 / nDen ), "CONV-PERCENT" );
+ }
+ break;
+
+ case BIFF_ID_SCREENTIP:
+ dumpFrHeader( false, true );
+ dumpNullUnicodeArray( "tooltip" );
+ break;
+
+ case BIFF_ID_SELECTION:
+ dumpDec< sal_uInt8 >( "pane", "PANE-ID" );
+ dumpAddress( "active-cell" );
+ dumpDec< sal_uInt16 >( "list-idx" );
+ dumpRangeList( "selection", false );
+ break;
+
+ case BIFF_ID_SHAREDFEATHEAD:
+ {
+ dumpFrHeader( true, true );
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "feature-type", "SHAREDFEATHEAD-TYPE" );
+ dumpUnused( 1 );
+ if( dumpBool< sal_Int32 >( "has-data" ) ) switch( nType )
+ {
+ case 2:
+ dumpHex< sal_uInt32 >( "allowed-flags", "SHAREDFEATHEAD-PROT-FLAGS" );
+ break;
+ }
+ }
+ break;
+
+ case BIFF_ID_SHAREDFMLA:
+ dumpRange( "formula-range", false );
+ dumpUnused( 1 );
+ dumpDec< sal_uInt8 >( "cell-count" );
+ getFormulaDumper().dumpCellFormula();
+ break;
+
+ case BIFF_ID_SHEET:
+ if( eBiff >= BIFF5 )
+ {
+ rStrm.enableDecoder( false );
+ dumpHex< sal_uInt32 >( "sheet-stream-pos", "CONV-DEC" );
+ rStrm.enableDecoder( true );
+ dumpDec< sal_uInt8 >( "sheet-state", "SHEET-STATE" );
+ dumpDec< sal_uInt8 >( "sheet-type", "SHEET-TYPE" );
+ }
+ dumpString( "sheet-name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_SHEETEXT:
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt32 >( "rec-size" );
+ dumpDec< sal_uInt32 >( "flags-1", "SHEETEXT-FLAGS1" );
+ if( rStrm.getRemaining() >= 20 )
+ {
+ dumpDec< sal_uInt32 >( "flags-2", "SHEETEXT-FLAGS2" );
+ dumpExtCfColor( "tab-color" );
+ }
+ break;
+
+ case BIFF_ID_SHEETHEADER:
+ dumpHex< sal_uInt32 >( "substream-size", "CONV-DEC" );
+ dumpByteString( "sheet-name", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_SST:
+ dumpDec< sal_uInt32 >( "string-cell-count" );
+ dumpDec< sal_uInt32 >( "sst-size" );
+ mxOut->resetItemIndex();
+ while( !rStrm.isEof() && (rStrm.getRemaining() >= 3) )
+ dumpUniString( "#entry" );
+ break;
+
+ case BIFF2_ID_STRING:
+ case BIFF3_ID_STRING:
+ dumpString( "result", ((nRecId == BIFF2_ID_STRING) && (eBiff <= BIFF4)) ? BIFF_STR_8BITLENGTH : BIFF_STR_DEFAULT );
+ break;
+
+ case BIFF_ID_STYLE:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "STYLE-FLAGS" );
+ if( getFlag( nFlags, BIFF_STYLE_BUILTIN ) )
+ {
+ dumpDec< sal_Int8 >( "builtin-idx", "STYLE-BUILTIN" );
+ dumpDec< sal_Int8 >( "outline-level" );
+ }
+ else
+ dumpString( "style-name", BIFF_STR_8BITLENGTH );
+ }
+ break;
+
+ case BIFF_ID_STYLEEXT:
+ dumpFrHeader( true, true );
+ dumpHex< sal_uInt8 >( "flags", "STYLEEXT-FLAGS" );
+ dumpDec< sal_uInt8 >( "category", "STYLEEXT-CATEGORY" );
+ dumpDec< sal_Int8 >( "builtin-idx", "STYLEEXT-BUILTIN" );
+ dumpDec< sal_Int8 >( "outline-level" );
+ dumpUnicodeArray( "style-name", rStrm.readuInt16() );
+ dumpDxfProp();
+ break;
+
+ case BIFF_ID_TABLESTYLES:
+ {
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt32 >( "table-style-count" );
+ sal_uInt16 nDefTableLen, nDefPivotLen;
+ rStrm >> nDefTableLen >> nDefPivotLen;
+ dumpUnicodeArray( "def-table-style", nDefTableLen );
+ dumpUnicodeArray( "def-pivot-style", nDefPivotLen );
+ }
+ break;
+
+ case BIFF_ID_THEME:
+ dumpFrHeader( true, true );
+ dumpDec< sal_uInt32 >( "theme-version", "THEME-VERSION" );
+ break;
+
+ case BIFF_ID_TXO:
+ dumpHex< sal_uInt16 >( "flags", "TXO-FLAGS" );
+ dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+ dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
+ dumpUnicode( "accelerator" );
+ dumpUnicode( "fareast-accelerator" );
+ dumpDec< sal_uInt16 >( "text-len" );
+ dumpDec< sal_uInt16 >( "format-run-size" );
+ dumpUnused( 4 );
+ break;
+
+ case BIFF_ID_WINDOW1:
+ dumpDec< sal_uInt16 >( "window-x", "CONV-TWIP-TO-CM" );
+ dumpDec< sal_uInt16 >( "window-y", "CONV-TWIP-TO-CM" );
+ dumpDec< sal_uInt16 >( "window-width", "CONV-TWIP-TO-CM" );
+ dumpDec< sal_uInt16 >( "window-height", "CONV-TWIP-TO-CM" );
+ if( eBiff <= BIFF4 )
+ {
+ dumpBool< sal_uInt8 >( "hidden" );
+ }
+ else
+ {
+ dumpHex< sal_uInt16 >( "flags", "WINDOW1-FLAGS" );
+ dumpDec< sal_uInt16 >( "active-tab" );
+ dumpDec< sal_uInt16 >( "first-visible-tab" );
+ dumpDec< sal_uInt16 >( "selected-tabs" );
+ dumpDec< sal_uInt16 >( "tabbar-ratio", "WINDOW1-TABBARRATIO" );
+ }
+ break;
+
+ case BIFF2_ID_WINDOW2:
+ dumpBool< sal_uInt8 >( "show-formulas" );
+ dumpBool< sal_uInt8 >( "show-gridlines" );
+ dumpBool< sal_uInt8 >( "show-headings" );
+ dumpBool< sal_uInt8 >( "frozen-panes" );
+ dumpBool< sal_uInt8 >( "show-zeros" );
+ dumpAddress( "first-visible-cell" );
+ dumpBool< sal_uInt8 >( "auto-grid-color" );
+ dumpColorABGR( "grid-color" );
+ break;
+
+ case BIFF3_ID_WINDOW2:
+ dumpHex< sal_uInt16 >( "flags", "WINDOW2-FLAGS" );
+ dumpAddress( "first-visible-cell" );
+ if( eBiff == BIFF8 )
+ {
+ dumpColorIdx( "grid-color-idx" );
+ dumpUnused( 2 );
+ if( rStrm.getRemaining() >= 8 )
+ {
+ dumpDec< sal_uInt16 >( "pagebreak-zoom", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "normal-zoom", "CONV-PERCENT" );
+ dumpUnused( 4 );
+ }
+ }
+ else
+ dumpColorABGR( "grid-color" );
+ break;
+
+ case BIFF_ID_WRITEACCESS:
+ dumpString( "user-name", BIFF_STR_8BITLENGTH );
+ break;
+
+ case BIFF_ID_XCT:
+ dumpDec< sal_uInt16 >( "crn-count" );
+ if( eBiff == BIFF8 ) dumpDec< sal_Int16 >( "sheet-idx" );
+ break;
+
+ case BIFF2_ID_XF:
+ case BIFF3_ID_XF:
+ case BIFF4_ID_XF:
+ case BIFF5_ID_XF:
+ dumpXfRec();
+ break;
+
+ case BIFF_ID_XFCRC:
+ dumpFrHeader( true, true );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "xf-count" );
+ dumpHex< sal_uInt32 >( "xf-checksum" );
+ break;
+
+ case BIFF_ID_XFEXT:
+ dumpFrHeader( true, true );
+ dumpUnused( 2 );
+ dumpXfIdx( "xf-idx" );
+ dumpUnused( 2 );
+ dumpXfExtProp();
+ break;
+ }
+}
+
+void WorkbookStreamObject::initializePerSheet()
+{
+ getBiffData().initializePerSheet();
+ mxFontNames = cfg().createNameList< ConstList >( "FONTNAMES" );
+ mxFontNames->setName( 0, createFontName( CREATE_OUSTRING( "Arial" ), 200, false, false ) );
+ mxFormats = cfg().createNameList< ConstList >( "FORMATS" );
+ mxFormats->includeList( cfg().getNameList( "BUILTIN-FORMATS" ) );
+ mnFormatIdx = 0;
+ mbHasCodePage = false;
+}
+
+OUString WorkbookStreamObject::createFontName( const OUString& rName, sal_uInt16 nHeight, bool bBold, bool bItalic ) const
+{
+ OUStringBuffer aName( rName );
+ StringHelper::enclose( aName, OOX_DUMP_STRQUOTE );
+ StringHelper::appendToken( aName, cfg().getName( "CONV-TWIP-TO-PT", nHeight ), ',' );
+ if( bBold )
+ StringHelper::appendToken( aName, CREATE_OUSTRING( "bold" ), ',' );
+ if( bItalic )
+ StringHelper::appendToken( aName, CREATE_OUSTRING( "italic" ), ',' );
+ return aName.makeStringAndClear();
+}
+
+sal_uInt16 WorkbookStreamObject::dumpPatternIdx( const String& rName, bool b16Bit )
+{
+ return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "fill-pattern" ), mxFillPatterns );
+}
+
+sal_uInt16 WorkbookStreamObject::dumpColorIdx( const String& rName, bool b16Bit )
+{
+ return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "color-idx" ), mxColors );
+}
+
+sal_uInt16 WorkbookStreamObject::dumpFontIdx( const String& rName, bool b16Bit )
+{
+ return dumpDec< sal_uInt16, sal_uInt8 >( b16Bit, rName( "font-idx" ), mxFontNames );
+}
+
+sal_uInt16 WorkbookStreamObject::dumpFormatIdx( const String& rName )
+{
+ return dumpDec< sal_uInt16, sal_uInt8 >( getBiff() >= BIFF5, rName( "fmt-idx" ), mxFormats );
+}
+
+sal_uInt16 WorkbookStreamObject::dumpXfIdx( const String& rName, bool bBiff2Style )
+{
+ String aName = rName( "xf-idx" );
+ sal_uInt16 nXfIdx = 0;
+ if( bBiff2Style )
+ {
+ dumpHex< sal_uInt8 >( aName, "CELL-XFINDEX" );
+ dumpHex< sal_uInt8 >( "fmt-font-idx", "CELL-XFFORMAT" );
+ dumpHex< sal_uInt8 >( "style", "CELL-XFSTYLE" );
+ }
+ else
+ nXfIdx = dumpDec< sal_uInt16 >( aName );
+ return nXfIdx;
+}
+
+void WorkbookStreamObject::dumpExtColorValue( sal_uInt32 nColorType )
+{
+ switch( nColorType )
+ {
+ case 0: dumpUnused( 4 ); break;
+ case 1: dumpDec< sal_uInt32 >( "color-idx", mxColors ); break;
+ case 2: dumpColorABGR(); break;
+ case 3: dumpDec< sal_uInt32 >( "theme-id" ); break;
+ case 4: dumpUnused( 4 ); break;
+ default: dumpUnknown( 4 );
+ }
+}
+
+void WorkbookStreamObject::dumpExtColor( const String& rName )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( rName( "color" ) );
+ switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "EXTCOLOR-FLAGS" ), 1, 7 ) )
+ {
+ case 0: dumpUnused( 1 ); break;
+ case 1: dumpColorIdx( "color-idx", false ); break;
+ case 2: dumpUnused( 1 ); break;
+ case 3: dumpDec< sal_uInt8 >( "theme-id" ); break;
+ case 4: dumpUnused( 1 ); break;
+ default: dumpUnknown( 1 );
+ }
+ dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
+ dumpColorABGR();
+}
+
+void WorkbookStreamObject::dumpExtCfColor( const String& rName )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( rName( "color" ) );
+ dumpExtColorValue( dumpExtColorType< sal_uInt32 >() );
+ dumpDec< double >( "tint", "CONV-FLOAT-TO-PERC" );
+}
+
+void WorkbookStreamObject::dumpExtGradientHead()
+{
+ dumpDec< sal_Int32 >( "gradient-type", "EXTGRADIENT-TYPE" );
+ dumpDec< double >( "linear-angle" );
+ dumpDec< double >( "pos-left" );
+ dumpDec< double >( "pos-right" );
+ dumpDec< double >( "pos-top" );
+ dumpDec< double >( "pos-bottom" );
+}
+
+sal_uInt8 WorkbookStreamObject::dumpFilterColumnOperator( const String& rName )
+{
+ sal_uInt8 nStrLen = 0;
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "FILTERCOLUMN-DATATYPE" );
+ dumpDec< sal_uInt8 >( "operator", "FILTERCOLUMN-OPERATOR" );
+ switch( nType )
+ {
+ case 2:
+ dumpRk( "value" );
+ dumpUnused( 4 );
+ break;
+ case 4:
+ dumpDec< double >( "value" );
+ break;
+ case 6:
+ dumpUnused( 4 );
+ nStrLen = dumpDec< sal_uInt8 >( "length" );
+ dumpBoolean( "simple" );
+ dumpUnused( 2 );
+ break;
+ case 8:
+ dumpBoolErr();
+ dumpUnused( 6 );
+ break;
+ default:
+ dumpUnused( 8 );
+ }
+ return nStrLen;
+}
+
+OUString WorkbookStreamObject::dumpPivotString( const String& rName, sal_uInt16 nStrLen )
+{
+ OUString aString;
+ if( nStrLen != BIFF_PT_NOSTRING )
+ {
+ aString = (getBiff() == BIFF8) ?
+ getBiffStream().readUniStringBody( nStrLen ) :
+ getBiffStream().readCharArrayUC( nStrLen, getBiffData().getTextEncoding() );
+ writeStringItem( rName, aString );
+ }
+ return aString;
+}
+
+OUString WorkbookStreamObject::dumpPivotString( const String& rName )
+{
+ sal_uInt16 nStrLen = dumpDec< sal_uInt16 >( "string-len", "PIVOT-NAMELEN" );
+ return dumpPivotString( rName, nStrLen );
+}
+
+sal_uInt16 WorkbookStreamObject::dumpCellHeader( bool bBiff2Style )
+{
+ dumpAddress();
+ return dumpXfIdx( EMPTY_STRING, bBiff2Style );
+}
+
+void WorkbookStreamObject::dumpBoolErr()
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ sal_uInt8 nValue = dumpHex< sal_uInt8 >( "value" );
+ bool bErrCode = dumpBool< sal_uInt8 >( "is-error-code" );
+ if( bErrCode )
+ writeErrorCodeItem( "error-code", nValue );
+ else
+ writeBooleanItem( "boolean", nValue );
+}
+
+void WorkbookStreamObject::dumpCfRuleProp()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ sal_uInt32 nFlags1 = dumpHex< sal_uInt32 >( "flags-1", "CFRULE-FLAGS1" );
+ sal_uInt16 nFlags2 = dumpHex< sal_uInt16 >( "flags-2", "CFRULE-FLAGS2" );
+ if( getFlag< sal_uInt32 >( nFlags1, 0x02000000 ) )
+ {
+ writeEmptyItem( "numfmt-block" );
+ IndentGuard aIndGuard( mxOut );
+ if( getFlag< sal_uInt16 >( nFlags2, 0x0001 ) )
+ {
+ dumpDec< sal_uInt16 >( "size" );
+ dumpUniString( "numfmt" );
+ }
+ else
+ {
+ dumpUnused( 1 );
+ dumpDec< sal_uInt8 >( "fmt-idx", mxFormats );
+ }
+ }
+ if( getFlag< sal_uInt32 >( nFlags1, 0x04000000 ) )
+ {
+ writeEmptyItem( "font-block" );
+ IndentGuard aIndGuard( mxOut );
+ sal_Int64 nRecPos = rStrm.tell();
+ dumpUniString( "name", BIFF_STR_8BITLENGTH );
+ dumpUnused( static_cast< sal_Int32 >( nRecPos + 64 - rStrm.tell() ) );
+ dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
+ dumpHex< sal_uInt32 >( "flags", "CFRULE-FONTFLAGS" );
+ dumpDec< sal_Int16 >( "weight", "CFRULE-FONTWEIGHT" );
+ dumpDec< sal_Int16 >( "escapement", "CFRULE-FONTESCAPEMENT" );
+ dumpDec< sal_Int8 >( "underline", "CFRULE-FONTUNDERLINE" );
+ dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
+ dumpDec< sal_uInt8 >( "charset", "CHARSET" );
+ dumpUnused( 1 );
+ dumpDec< sal_Int32 >( "color", "CFRULE-FONTCOLOR" );
+ dumpUnused( 4 );
+ dumpHex< sal_uInt32 >( "used-flags", "CFRULE-FONTUSEDFLAGS" );
+ dumpDec< sal_uInt32 >( "escapement-used", "CFRULE-FONTUSED" );
+ dumpDec< sal_uInt32 >( "underline-used", "CFRULE-FONTUSED" );
+ dumpDec< sal_uInt32 >( "weight-used", "CFRULE-FONTUSED" );
+ dumpUnused( 4 );
+ dumpDec< sal_Int32 >( "first-char" );
+ dumpDec< sal_Int32 >( "char-count" );
+ dumpDec< sal_uInt16 >( "font-idx" );
+ }
+ if( getFlag< sal_uInt32 >( nFlags1, 0x08000000 ) )
+ {
+ writeEmptyItem( "alignment-block" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt8 >( "alignent", "CFRULE-ALIGNMENT" );
+ dumpHex< sal_uInt8 >( "rotation", "TEXTROTATION" );
+ dumpHex< sal_uInt16 >( "indent", "CFRULE-INDENT" );
+ dumpDec< sal_Int32 >( "relative-indent" );
+ }
+ if( getFlag< sal_uInt32 >( nFlags1, 0x10000000 ) )
+ {
+ writeEmptyItem( "border-block" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt16 >( "border-style", "XF-BORDERSTYLE" );
+ dumpHex< sal_uInt16 >( "border-color1", "XF-BORDERCOLOR1" );
+ dumpHex< sal_uInt32 >( "border-color2", "CFRULE-BORDERCOLOR2" );
+ }
+ if( getFlag< sal_uInt32 >( nFlags1, 0x20000000 ) )
+ {
+ writeEmptyItem( "pattern-block" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt32 >( "pattern", "CFRULE-FILLBLOCK" );
+ }
+ if( getFlag< sal_uInt32 >( nFlags1, 0x40000000 ) )
+ {
+ writeEmptyItem( "protection-block" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt16 >( "flags", "CFRULE-PROTECTION-FLAGS" );
+ }
+}
+
+void WorkbookStreamObject::dumpXfExtProp()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
+ {
+ mxOut->startMultiItems();
+ sal_Int64 nStartPos = rStrm.tell();
+ writeEmptyItem( "SUBREC" );
+ sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "XFEXT-SUBREC" );
+ sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
+ sal_Int64 nEndPos = nStartPos + nSubRecSize;
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
+ switch( nSubRecId )
+ {
+ case 4: case 5: case 7: case 8: case 9: case 10: case 11: case 13:
+ {
+ sal_uInt16 nColorType = dumpExtColorType< sal_uInt16 >();
+ dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
+ dumpExtColorValue( nColorType );
+ dumpUnused( 8 );
+ }
+ break;
+ case 6:
+ dumpExtGradientHead();
+ mxOut->resetItemIndex();
+ for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
+ {
+ writeEmptyItem( "#stop" );
+ IndentGuard aIndGuard2( mxOut );
+ sal_uInt16 nColorType = dumpExtColorType< sal_uInt16 >();
+ dumpExtColorValue( nColorType );
+ dumpDec< double >( "stop-pos" );
+ dumpDec< double >( "tint", "CONV-FLOAT-TO-PERC" );
+ }
+ break;
+ case 14:
+ dumpDec< sal_Int8 >( "font-scheme", "EXTFONT-SCHEME" );
+ break;
+ case 15:
+ dumpDec< sal_uInt16 >( "indent" );
+ break;
+ }
+ dumpRemainingTo( nEndPos );
+ }
+}
+
+void WorkbookStreamObject::dumpDxfProp()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ dumpUnused( 2 );
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !rStrm.isEof() && (nIndex < nCount); ++nIndex )
+ {
+ mxOut->startMultiItems();
+ sal_Int64 nStartPos = rStrm.tell();
+ writeEmptyItem( "SUBREC" );
+ sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
+ sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
+ sal_Int64 nEndPos = nStartPos + nSubRecSize;
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
+ switch( nSubRecId )
+ {
+ case 0:
+ dumpDec< sal_uInt8 >( "pattern", mxFillPatterns );
+ break;
+ case 1: case 2: case 5:
+ dumpExtColor();
+ break;
+ case 3:
+ dumpExtGradientHead();
+ break;
+ case 4:
+ dumpDec< sal_uInt16 >( "index" );
+ dumpDec< double >( "stop-position" );
+ dumpExtColor( "stop-color" );
+ break;
+ case 6: case 7: case 8: case 9: case 10: case 11: case 12:
+ dumpExtColor( "color" );
+ dumpDec< sal_uInt16 >( "style", mxBorderStyles );
+ break;
+ case 13: case 14:
+ dumpBoolean( "value" );
+ break;
+ case 15:
+ dumpDec< sal_uInt8 >( "alignment", "XF-HORALIGN" );
+ break;
+ case 16:
+ dumpDec< sal_uInt8 >( "alignment", "XF-VERALIGN" );
+ break;
+ case 17:
+ dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
+ break;
+ case 18:
+ dumpDec< sal_uInt16 >( "indent" );
+ break;
+ case 19:
+ dumpDec< sal_uInt8 >( "text-dir", "XF-TEXTDIRECTION" );
+ break;
+ case 20: case 21: case 22: case 23:
+ dumpBoolean( "value" );
+ break;
+ case 24:
+ dumpUnicodeArray( "name", rStrm.readuInt16() );
+ break;
+ case 25:
+ dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
+ break;
+ case 26:
+ dumpDec< sal_uInt16 >( "underline", "FONT-UNDERLINE" );
+ break;
+ case 27:
+ dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
+ break;
+ case 28: case 29: case 30: case 31: case 32: case 33:
+ dumpBoolean( "value" );
+ break;
+ case 34:
+ dumpDec< sal_uInt8 >( "charset", "CHARSET" );
+ break;
+ case 35:
+ dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
+ break;
+ case 36:
+ dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
+ break;
+ case 37:
+ dumpDec< sal_uInt8 >( "scheme", "EXTFONT-SCHEME" );
+ break;
+ case 38:
+ dumpUnicodeArray( "numfmt", rStrm.readuInt16() );
+ break;
+ case 41:
+ dumpDec< sal_uInt16 >( "fmt-idx", mxFormats );
+ break;
+ case 42:
+ dumpDec< sal_Int16 >( "relative-indent" );
+ break;
+ case 43: case 44:
+ dumpBoolean( "value" );
+ break;
+ }
+ dumpRemainingTo( nEndPos );
+ }
+}
+
+void WorkbookStreamObject::dumpDxf12Prop()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ writeEmptyItem( "dxf-data" );
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt32 nSize = dumpDec< sal_uInt32 >( "dxf-size" );
+ if( nSize == 0 )
+ {
+ dumpUnused( 2 );
+ }
+ else
+ {
+ sal_Int64 nEndPos = rStrm.tell() + nSize;
+ dumpCfRuleProp();
+ if( rStrm.tell() + 8 <= nEndPos )
+ {
+ dumpUnused( 6 );
+ dumpXfExtProp();
+ }
+ dumpRemainingTo( nEndPos );
+ }
+}
+
+void WorkbookStreamObject::dumpCfRule12Param( sal_uInt16 nSubType )
+{
+ sal_uInt8 nSize = dumpDec< sal_uInt8 >( "params-size" );
+ sal_Int64 nEndPos = getBiffStream().tell() + nSize;
+ {
+ writeEmptyItem( "params" );
+ IndentGuard aIndGuard( mxOut );
+ switch( nSubType )
+ {
+ case 5:
+ dumpHex< sal_uInt8 >( "flags", "CFRULE12-TOP10-FLAGS" );
+ dumpDec< sal_uInt16 >( "rank" );
+ dumpUnused( 13 );
+ break;
+ case 8:
+ dumpDec< sal_uInt16 >( "operator", "CFRULE12-TEXT-OPERATOR" );
+ dumpUnused( 14 );
+ break;
+ case 15: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 24:
+ dumpDec< sal_uInt16 >( "operator", "CFRULE12-DATE-OPERATOR" );
+ dumpUnused( 14 );
+ break;
+ case 25: case 26: case 29: case 30:
+ dumpDec< sal_uInt16 >( "std-dev" );
+ dumpUnused( 14 );
+ break;
+ default:
+ dumpUnused( 16 );
+ }
+ }
+ dumpRemainingTo( nEndPos );
+}
+
+void WorkbookStreamObject::dumpFontRec()
+{
+ sal_uInt16 nFontId = getBiffData().getFontCount();
+ mxOut->resetItemIndex( nFontId );
+ writeEmptyItem( "#font" );
+ sal_uInt16 nHeight = dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
+ bool bBold = getFlag( nFlags, BIFF_FONTFLAG_BOLD );
+ bool bItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
+ rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
+ if( getBiff() >= BIFF3 )
+ dumpColorIdx();
+ if( getBiff() >= BIFF5 )
+ {
+ bBold = dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" ) > 450;
+ dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
+ dumpDec< sal_uInt8 >( "underline", "FONT-UNDERLINE" );
+ dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
+ sal_uInt8 nCharSet = dumpDec< sal_uInt8 >( "charset", "CHARSET" );
+ eFontEnc = rtl_getTextEncodingFromWindowsCharset( nCharSet );
+ dumpUnused( 1 );
+ }
+ OUString aName = dumpString( "name", BIFF_STR_8BITLENGTH, BIFF_STR_8BITLENGTH );
+
+ // append font data to vector
+ mxFontNames->setName( nFontId, createFontName( aName, nHeight, bBold, bItalic ) );
+
+ // store font encoding
+ getBiffData().appendFontEncoding( eFontEnc );
+
+ // set font encoding as default text encoding in case of missing CODEPAGE record
+ if( !mbHasCodePage && (nFontId == 0) )
+ getBiffData().setTextEncoding( eFontEnc );
+}
+
+void WorkbookStreamObject::dumpFormatRec()
+{
+ sal_uInt16 nFormatIdx = 0;
+ switch( getBiff() )
+ {
+ case BIFF2:
+ case BIFF3:
+ nFormatIdx = mnFormatIdx++;
+ mxOut->resetItemIndex( nFormatIdx );
+ writeEmptyItem( "#fmt" );
+ break;
+ case BIFF4:
+ nFormatIdx = mnFormatIdx++;
+ mxOut->resetItemIndex( nFormatIdx );
+ writeEmptyItem( "#fmt" );
+ dumpUnused( 2 );
+ break;
+ case BIFF5:
+ case BIFF8:
+ getBiffStream() >> nFormatIdx;
+ mxOut->resetItemIndex( nFormatIdx );
+ writeEmptyItem( "#fmt" );
+ writeDecItem( "fmt-idx", nFormatIdx );
+ break;
+ case BIFF_UNKNOWN: break;
+ }
+ OUString aFormat = dumpString( "format", BIFF_STR_8BITLENGTH );
+ mxFormats->setName( nFormatIdx, aFormat );
+}
+
+void WorkbookStreamObject::dumpXfRec()
+{
+ sal_uInt16 nXfId = getBiffData().getXfCount();
+ mxOut->resetItemIndex( nXfId );
+ writeEmptyItem( "#xf" );
+ sal_uInt16 nFontId = dumpFontIdx( EMPTY_STRING, getBiff() >= BIFF5 );
+ switch( getBiff() )
+ {
+ case BIFF2:
+ dumpUnused( 1 );
+ dumpHex< sal_uInt8 >( "type-flags", "XF-TYPEFLAGS" );
+ dumpHex< sal_uInt8 >( "style-flags", "XF-STYLEFLAGS" );
+ break;
+ case BIFF3:
+ dumpFormatIdx();
+ dumpHex< sal_uInt8 >( "type-flags", "XF-TYPEFLAGS" );
+ dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
+ dumpHex< sal_uInt16 >( "alignment", "XF-ALIGNMENT" );
+ dumpHex< sal_uInt16 >( "fill-style", "XF-FILL" );
+ dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
+ break;
+ case BIFF4:
+ dumpFormatIdx();
+ dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
+ dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
+ dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
+ dumpHex< sal_uInt16 >( "fill-style", "XF-FILL" );
+ dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
+ break;
+ case BIFF5:
+ dumpFormatIdx();
+ dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
+ dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
+ dumpHex< sal_uInt8 >( "orientation", "XF-ORIENTATTRIBS" );
+ dumpHex< sal_uInt32 >( "fill-style", "XF-FILL" );
+ dumpHex< sal_uInt32 >( "border-style", "XF-BORDER" );
+ break;
+ case BIFF8:
+ dumpFormatIdx();
+ dumpHex< sal_uInt16 >( "type-flags", "XF-TYPEFLAGS" );
+ dumpHex< sal_uInt8 >( "alignment", "XF-ALIGNMENT" );
+ dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
+ dumpHex< sal_uInt8 >( "text-flags", "XF-TEXTFLAGS" );
+ dumpHex< sal_uInt8 >( "used-attributes", "XF-USEDATTRIBS-FLAGS" );
+ dumpHex< sal_uInt16 >( "border-style", "XF-BORDERSTYLE" );
+ dumpHex< sal_uInt16 >( "border-color1", "XF-BORDERCOLOR1" );
+ dumpHex< sal_uInt32 >( "border-color2", "XF-BORDERCOLOR2" );
+ dumpHex< sal_uInt16 >( "fill-color", "XF-FILLCOLOR" );
+ break;
+ case BIFF_UNKNOWN: break;
+ }
+ getBiffData().appendXfFontId( nFontId );
+}
+
+void WorkbookStreamObject::dumpObjRec()
+{
+ switch( getBiff() )
+ {
+ case BIFF3:
+ dumpObjRecBiff3();
+ break;
+ case BIFF4:
+ dumpObjRecBiff4();
+ break;
+ case BIFF5:
+ dumpObjRecBiff5();
+ break;
+ case BIFF8:
+ // #i61786# OBJ records without DFF stream are in BIFF5 format
+ if( mbHasDff ) dumpObjRecBiff8(); else dumpObjRecBiff5();
+ break;
+ default:;
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecBiff3()
+{
+ dumpDec< sal_uInt32 >( "obj-count" );
+ sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
+ dumpDec< sal_uInt16 >( "obj-id" );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
+ dumpDffClientRect();
+ sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+ dumpUnused( 2 );
+ sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
+ switch( nObjType )
+ {
+ case BIFF_OBJTYPE_GROUP:
+ dumpUnused( 4 );
+ dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+ dumpUnused( 16 );
+ dumpObjRecString( "macro", nMacroSize, true );
+ break;
+ case BIFF_OBJTYPE_LINE:
+ dumpObjRecLineData();
+ dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
+ dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
+ dumpUnused( 1 );
+ dumpObjRecString( "macro", nMacroSize, true );
+ break;
+ case BIFF_OBJTYPE_RECTANGLE:
+ case BIFF_OBJTYPE_OVAL:
+ dumpObjRecRectData();
+ dumpObjRecString( "macro", nMacroSize, true );
+ break;
+ case BIFF_OBJTYPE_ARC:
+ dumpObjRecFillData();
+ dumpObjRecLineData();
+ dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+ dumpUnused( 1 );
+ dumpObjRecString( "macro", nMacroSize, true );
+ break;
+ case BIFF_OBJTYPE_CHART:
+ dumpObjRecRectData();
+ dumpUnused( 18 );
+ dumpObjRecString( "macro", nMacroSize, true );
+ break;
+ case BIFF_OBJTYPE_TEXT:
+ case BIFF_OBJTYPE_BUTTON:
+ dumpObjRecRectData();
+ dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
+ dumpObjRecString( "macro", nMacroSize, true );
+ dumpObjRecString( "text", nTextLen, false );
+ dumpObjRecTextFmt( nFormatSize );
+ break;
+ case BIFF_OBJTYPE_PICTURE:
+ dumpObjRecRectData();
+ dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+ dumpUnused( 4 );
+ nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+ dumpObjRecString( "macro", nMacroSize, true );
+ dumpObjRecPictFmla( nLinkSize );
+ break;
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecBiff4()
+{
+ dumpDec< sal_uInt32 >( "obj-count" );
+ sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
+ dumpDec< sal_uInt16 >( "obj-id" );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
+ dumpDffClientRect();
+ sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+ dumpUnused( 2 );
+ sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
+ switch( nObjType )
+ {
+ case BIFF_OBJTYPE_GROUP:
+ dumpUnused( 4 );
+ dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+ dumpUnused( 16 );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_LINE:
+ dumpObjRecLineData();
+ dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
+ dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
+ dumpUnused( 1 );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_RECTANGLE:
+ case BIFF_OBJTYPE_OVAL:
+ dumpObjRecRectData();
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_ARC:
+ dumpObjRecFillData();
+ dumpObjRecLineData();
+ dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+ dumpUnused( 1 );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_CHART:
+ dumpObjRecRectData();
+ dumpUnused( 18 );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_TEXT:
+ case BIFF_OBJTYPE_BUTTON:
+ dumpObjRecRectData();
+ dumpObjRecTextDataBiff3( nTextLen, nFormatSize );
+ dumpObjRecFmla( "macro", nMacroSize );
+ dumpObjRecString( "text", nTextLen, false );
+ dumpObjRecTextFmt( nFormatSize );
+ break;
+ case BIFF_OBJTYPE_PICTURE:
+ dumpObjRecRectData();
+ dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+ dumpUnused( 4 );
+ nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+ dumpObjRecFmla( "macro", nMacroSize );
+ dumpObjRecPictFmla( nLinkSize );
+ break;
+ case BIFF_OBJTYPE_POLYGON:
+ dumpObjRecRectData();
+ dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
+ dumpUnused( 10 );
+ dumpDec< sal_uInt16 >( "point-count" );
+ dumpUnused( 8 );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecBiff5()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ dumpDec< sal_uInt32 >( "obj-count" );
+ sal_uInt16 nObjType = dumpDec< sal_uInt16 >( "obj-type", "OBJ-TYPE" );
+ dumpDec< sal_uInt16 >( "obj-id" );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-FLAGS" );
+ dumpDffClientRect();
+ sal_uInt16 nMacroSize = dumpDec< sal_uInt16 >( "macro-size" );
+ dumpUnused( 2 );
+ sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "name-len" );
+ dumpUnused( 2 );
+ sal_uInt16 nTextLen = 0, nFormatSize = 0, nLinkSize = 0;
+ switch( nObjType )
+ {
+ case BIFF_OBJTYPE_GROUP:
+ dumpUnused( 4 );
+ dumpDec< sal_uInt16 >( "next-ungrouped-id" );
+ dumpUnused( 16 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_LINE:
+ dumpObjRecLineData();
+ dumpHex< sal_uInt16 >( "line-end", "OBJ-LINEENDS" );
+ dumpDec< sal_uInt8 >( "line-direction", "OBJ-LINEDIR" );
+ dumpUnused( 1 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_RECTANGLE:
+ case BIFF_OBJTYPE_OVAL:
+ dumpObjRecRectData();
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_ARC:
+ dumpObjRecFillData();
+ dumpObjRecLineData();
+ dumpDec< sal_uInt8 >( "quadrant", "OBJ-ARC-QUADRANT" );
+ dumpUnused( 1 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_CHART:
+ dumpObjRecRectData();
+ dumpHex< sal_uInt16 >( "chart-flags", "OBJ-CHART-FLAGS" );
+ dumpUnused( 16 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_TEXT:
+ case BIFF_OBJTYPE_BUTTON:
+ case BIFF_OBJTYPE_LABEL:
+ case BIFF_OBJTYPE_DIALOG:
+ dumpObjRecRectData();
+ dumpObjRecTextDataBiff5( nTextLen, nFormatSize, nLinkSize );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ dumpObjRecString( "text", nTextLen, false );
+ dumpObjRecFmla( "text-link", nLinkSize );
+ dumpObjRecTextFmt( nFormatSize );
+ break;
+ case BIFF_OBJTYPE_PICTURE:
+ dumpObjRecRectData();
+ dumpDec< sal_Int16 >( "image-format", "IMGDATA-FORMAT" );
+ dumpUnused( 4 );
+ nLinkSize = dumpDec< sal_uInt16 >( "pic-link-size" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-PICTURE-FLAGS" );
+ dumpUnused( 4 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ dumpObjRecPictFmla( nLinkSize );
+ if( rStrm.getRemaining() >= 4 )
+ dumpHex< sal_uInt32 >( "ole-storage-id" );
+ break;
+ case BIFF_OBJTYPE_POLYGON:
+ dumpObjRecRectData();
+ dumpHex< sal_uInt16 >( "flags", "OBJ-POLYGON-FLAGS" );
+ dumpUnused( 10 );
+ dumpDec< sal_uInt16 >( "point-count" );
+ dumpUnused( 8 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", nMacroSize );
+ break;
+ case BIFF_OBJTYPE_CHECKBOX:
+ dumpObjRecRectData();
+ dumpUnused( 10 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpUnused( 20 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ dumpObjRecCblsData();
+ break;
+ case BIFF_OBJTYPE_OPTIONBUTTON:
+ dumpObjRecRectData();
+ dumpUnused( 10 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpUnused( 32 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ dumpObjRecCblsData();
+ dumpObjRecRboData();
+ break;
+ case BIFF_OBJTYPE_EDIT:
+ dumpObjRecRectData();
+ dumpUnused( 10 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpUnused( 14 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ dumpObjRecEdoData();
+ break;
+ case BIFF_OBJTYPE_SPIN:
+ case BIFF_OBJTYPE_SCROLLBAR:
+ dumpObjRecRectData();
+ dumpObjRecSbsData();
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ break;
+ case BIFF_OBJTYPE_LISTBOX:
+ dumpObjRecRectData();
+ dumpObjRecSbsData();
+ dumpUnused( 18 );
+ dumpFontIdx( "font-idx" );
+ dumpUnused( 4 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ dumpObjRecLbsData();
+ break;
+ case BIFF_OBJTYPE_GROUPBOX:
+ dumpObjRecRectData();
+ dumpUnused( 10 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpUnused( 26 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ dumpObjRecGboData();
+ break;
+ case BIFF_OBJTYPE_DROPDOWN:
+ dumpObjRecRectData();
+ dumpObjRecSbsData();
+ dumpUnused( 18 );
+ dumpFontIdx( "font-idx" );
+ dumpUnused( 14 );
+ dumpDec< sal_uInt16 >( "bounding-left" );
+ dumpDec< sal_uInt16 >( "bounding-top" );
+ dumpDec< sal_uInt16 >( "bounding-right" );
+ dumpDec< sal_uInt16 >( "bounding-bottom" );
+ dumpUnused( 4 );
+ dumpObjRecString( "obj-name", nNameLen, true );
+ dumpObjRecFmla( "macro", dumpDec< sal_uInt16 >( "macro-size" ) );
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ dumpObjRecLbsData();
+ dumpDec< sal_uInt16 >( "type", "OBJ-DROPDOWN-TYPE" );
+ dumpDec< sal_uInt16 >( "line-count" );
+ dumpDec< sal_uInt16 >( "min-list-width" );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ break;
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecBiff8()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ NameListRef xRecNames = cfg().getNameList( "OBJ-RECNAMES" );
+ sal_uInt16 nObjType = 0xFFFF;
+ bool bControl = false;
+ bool bCtlsStrm = false;
+ bool bLoop = true;
+ while( bLoop && (rStrm.getRemaining() >= 4) )
+ {
+ mxOut->emptyLine();
+ sal_uInt16 nSubRecId, nSubRecSize;
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "OBJREC" );
+ writeHexItem( "pos", static_cast< sal_uInt32 >( rStrm.tell() ) );
+ rStrm >> nSubRecId >> nSubRecSize;
+ writeHexItem( "size", nSubRecSize );
+ writeHexItem( "id", nSubRecId, xRecNames );
+ }
+
+ sal_Int64 nSubRecStart = rStrm.tell();
+ // sometimes the last subrecord has an invalid length
+ sal_Int64 nRealRecSize = ::std::min< sal_Int64 >( nSubRecSize, rStrm.getRemaining() );
+ sal_Int64 nSubRecEnd = nSubRecStart + nRealRecSize;
+
+ IndentGuard aIndGuard( mxOut );
+ switch( nSubRecId )
+ {
+ case BIFF_ID_OBJMACRO:
+ dumpObjRecFmlaRaw();
+ break;
+ case BIFF_ID_OBJCF:
+ dumpDec< sal_Int16 >( "clipboard-format", "IMGDATA-FORMAT" );
+ break;
+ case BIFF_ID_OBJFLAGS:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OBJFLAGS-FLAGS" );
+ bControl = getFlag( nFlags, BIFF_OBJFLAGS_CONTROL );
+ bCtlsStrm = getFlag( nFlags, BIFF_OBJFLAGS_CTLSSTREAM );
+ }
+ break;
+ case BIFF_ID_OBJPICTFMLA:
+ {
+ dumpObjRecPictFmla( dumpDec< sal_uInt16 >( "pic-link-size" ) );
+ if( rStrm.tell() + 4 <= nSubRecEnd )
+ {
+ if( bControl && bCtlsStrm )
+ dumpControl();
+ else
+ dumpHex< sal_uInt32 >( "ole-storage-id" );
+ }
+ if( bControl && (rStrm.tell() + 8 <= nSubRecEnd) )
+ {
+ sal_uInt32 nKeySize = dumpDec< sal_uInt32 >( "licence-key-size" );
+ if( nKeySize > 0 )
+ {
+ IndentGuard aIndGuard2( mxOut );
+ sal_Int64 nKeyEnd = rStrm.tell() + nKeySize;
+ dumpArray( "licence-key", static_cast< sal_Int32 >( nKeySize ) );
+ rStrm.seek( nKeyEnd );
+ }
+ dumpObjRecFmla( "cell-link", dumpDec< sal_uInt16 >( "cell-link-size" ) );
+ dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
+ }
+ }
+ break;
+ case BIFF_ID_OBJCBLS:
+ dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
+ dumpUnused( 4 );
+ dumpUnicode( "accelerator" );
+ dumpUnicode( "fareast-accelerator" );
+ dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
+ break;
+ case BIFF_ID_OBJRBO:
+ dumpUnused( 4 );
+ dumpBool< sal_uInt16 >( "first-in-group" );
+ break;
+ case BIFF_ID_OBJSBS:
+ dumpObjRecSbsData();
+ break;
+ case BIFF_ID_OBJGBODATA:
+ dumpObjRecGboData();
+ break;
+ case BIFF_ID_OBJEDODATA:
+ dumpObjRecEdoData();
+ break;
+ case BIFF_ID_OBJRBODATA:
+ dumpObjRecRboData();
+ break;
+ case BIFF_ID_OBJCBLSDATA:
+ dumpObjRecCblsData();
+ break;
+ case BIFF_ID_OBJLBSDATA:
+ dumpObjRecLbsData();
+ if( nObjType == BIFF_OBJTYPE_DROPDOWN )
+ {
+ dumpHex< sal_uInt16 >( "dropdown-flags", "OBJ-DROPDOWN-FLAGS" );
+ dumpDec< sal_uInt16 >( "line-count" );
+ dumpDec< sal_uInt16 >( "min-list-width" );
+ dumpObjRecString( "text", dumpDec< sal_uInt16 >( "text-len" ), false );
+ }
+ break;
+ case BIFF_ID_OBJCBLSFMLA:
+ case BIFF_ID_OBJSBSFMLA:
+ dumpObjRecFmlaRaw();
+ break;
+ case BIFF_ID_OBJCMO:
+ nObjType = dumpDec< sal_uInt16 >( "type", "OBJ-TYPE" );
+ dumpDec< sal_uInt16 >( "id" );
+ dumpHex< sal_uInt16 >( "flags", "OBJCMO-FLAGS" );
+ dumpUnused( 12 );
+ break;
+ }
+ // remaining undumped data
+ if( !rStrm.isEof() && (rStrm.tell() == nSubRecStart) )
+ dumpRawBinary( nRealRecSize, false );
+ else
+ dumpRemainingTo( nSubRecEnd );
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecLineData()
+{
+ dumpColorIdx( "line-color-idx", false );
+ dumpDec< sal_uInt8 >( "line-type", "OBJ-LINETYPE" );
+ dumpDec< sal_uInt8 >( "line-weight", "OBJ-LINEWEIGHT" );
+ dumpHex< sal_uInt8 >( "line-flags", "OBJ-AUTO-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecFillData()
+{
+ dumpColorIdx( "back-color-idx", false );
+ dumpColorIdx( "patt-color-idx", false );
+ dumpPatternIdx( EMPTY_STRING, false );
+ dumpHex< sal_uInt8 >( "area-flags", "OBJ-AUTO-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecRectData()
+{
+ dumpObjRecFillData();
+ dumpObjRecLineData();
+ dumpHex< sal_uInt16 >( "frame-style", "OBJ-FRAMESTYLE-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecTextDataBiff3( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize )
+{
+ ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
+ dumpUnused( 2 );
+ ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
+ dumpFontIdx( "default-font-idx" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+ dumpUnused( 8 );
+}
+
+void WorkbookStreamObject::dumpObjRecTextDataBiff5( sal_uInt16& ornTextLen, sal_uInt16& ornFormatSize, sal_uInt16& ornLinkSize )
+{
+ ornTextLen = dumpDec< sal_uInt16 >( "text-len" );
+ dumpUnused( 2 );
+ ornFormatSize = dumpDec< sal_uInt16 >( "format-run-size" );
+ dumpFontIdx( "default-font-idx" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "flags", "OBJ-TEXT-FLAGS" );
+ dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
+ dumpUnused( 2 );
+ ornLinkSize = dumpDec< sal_uInt16 >( "link-size" );
+ dumpUnused( 2 );
+ dumpHex< sal_uInt16 >( "button-flags", "OBJ-BUTTON-FLAGS" );
+ dumpUnicode( "accelerator" );
+ dumpUnicode( "fareast-accelerator" );
+}
+
+void WorkbookStreamObject::dumpObjRecSbsData()
+{
+ dumpUnused( 4 );
+ dumpDec< sal_uInt16 >( "value" );
+ dumpDec< sal_uInt16 >( "min" );
+ dumpDec< sal_uInt16 >( "max" );
+ dumpDec< sal_uInt16 >( "step" );
+ dumpDec< sal_uInt16 >( "page-step" );
+ dumpBool< sal_uInt16 >( "horizontal" );
+ dumpDec< sal_uInt16 >( "thumb-width" );
+ dumpHex< sal_uInt16 >( "scrollbar-flags", "OBJ-SCROLLBAR-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecGboData()
+{
+ dumpUnicode( "accelerator" );
+ dumpUnicode( "fareast-accelerator" );
+ dumpHex< sal_uInt16 >( "groupbox-flags", "OBJ-GROUPBOX-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecEdoData()
+{
+ dumpDec< sal_uInt16 >( "type", "OBJ-EDIT-TYPE" );
+ dumpBool< sal_uInt16 >( "multiline" );
+ dumpBool< sal_uInt16 >( "scrollbar" );
+ dumpDec< sal_uInt16 >( "listbox-obj-id" );
+}
+
+void WorkbookStreamObject::dumpObjRecRboData()
+{
+ dumpDec< sal_uInt16 >( "next-in-group" );
+ dumpBool< sal_uInt16 >( "first-in-group" );
+}
+
+void WorkbookStreamObject::dumpObjRecCblsData()
+{
+ dumpDec< sal_uInt16 >( "state", "OBJ-CHECKBOX-STATE" );
+ dumpUnicode( "accelerator" );
+ dumpUnicode( "fareast-accelerator" );
+ dumpHex< sal_uInt16 >( "checkbox-flags", "OBJ-CHECKBOX-FLAGS" );
+}
+
+void WorkbookStreamObject::dumpObjRecLbsData()
+{
+ dumpObjRecFmla( "source-range", dumpDec< sal_uInt16 >( "source-range-size" ) );
+ dumpDec< sal_uInt16 >( "entry-count" );
+ dumpDec< sal_uInt16 >( "selected-entry" );
+ dumpHex< sal_uInt16 >( "listbox-flags", "OBJ-LISTBOX-FLAGS" );
+ dumpDec< sal_uInt16 >( "edit-obj-id" );
+}
+
+void WorkbookStreamObject::dumpObjRecPadding()
+{
+ if( getBiffStream().tell() & 1 )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt8 >( "padding" );
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecString( const String& rName, sal_uInt16 nTextLen, bool bRepeatLen )
+{
+ if( nTextLen > 0 )
+ {
+ if( bRepeatLen )
+ dumpByteString( rName, BIFF_STR_8BITLENGTH );
+ else
+ writeStringItem( rName, getBiffStream().readCharArrayUC( nTextLen, getBiffData().getTextEncoding() ) );
+ dumpObjRecPadding();
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecTextFmt( sal_uInt16 nFormatSize )
+{
+ FontPortionModelList aPortions;
+ aPortions.importPortions( getBiffStream(), nFormatSize / 8, BIFF_FONTPORTION_OBJ );
+ writeFontPortions( aPortions );
+}
+
+void WorkbookStreamObject::dumpObjRecFmlaRaw()
+{
+ sal_uInt16 nFmlaSize = dumpDec< sal_uInt16 >( "fmla-size" );
+ dumpUnused( 4 );
+ getFormulaDumper().dumpNameFormula( "fmla", nFmlaSize );
+ dumpObjRecPadding();
+}
+
+void WorkbookStreamObject::dumpObjRecFmla( const String& rName, sal_uInt16 nFmlaSize )
+{
+ BiffInputStream& rStrm = getBiffStream();
+ if( nFmlaSize > 0 )
+ {
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
+ dumpObjRecFmlaRaw();
+ if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
+ writeEmptyItem( OOX_DUMP_ERRASCII( "fmla-size" ) );
+ dumpRemainingTo( nStrmEnd );
+ }
+}
+
+void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize )
+{
+ BiffInputStream& rStrm = getBiffStream();
+ if( nFmlaSize > 0 )
+ {
+ writeEmptyItem( "pic-link" );
+ IndentGuard aIndGuard( mxOut );
+ sal_Int64 nStrmEnd = rStrm.tell() + nFmlaSize;
+ if( (getBiff() == BIFF3) && (nStrmEnd & 1) ) ++nStrmEnd; // BIFF3 size without padding
+ dumpObjRecFmlaRaw();
+ if( rStrm.tell() + 2 <= nStrmEnd )
+ {
+ dumpString( "class-name", BIFF_STR_DEFAULT, BIFF_STR_SMARTFLAGS );
+ dumpObjRecPadding();
+ }
+ if( rStrm.isEof() || (rStrm.tell() != nStrmEnd) )
+ writeEmptyItem( OOX_DUMP_ERRASCII( "pic-link-size" ) );
+ dumpRemainingTo( nStrmEnd );
+ }
+}
+
+void WorkbookStreamObject::dumpChFrExtProps()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ bool bValid = true;
+ while( bValid && (rStrm.getRemaining() > 4) )
+ {
+ ChFrExtPropInfo aInfo = dumpChFrExtPropHeader();
+ IndentGuard aIndGuard( mxOut );
+ switch( aInfo.first )
+ {
+ case 0: // start
+ case 1: // end
+ break;
+ case 2: // bool
+ dumpBoolean( "value" );
+ dumpUnused( 1 );
+ break;
+ case 3: // double
+ dumpUnused( 4 );
+ dumpDec< double >( "value", aInfo.second );
+ break;
+ case 4: // int32
+ dumpDec< sal_Int32 >( "value", aInfo.second );
+ break;
+ case 5: // string
+ dumpUnicodeArray( "value", rStrm.readInt32() );
+ break;
+ case 6: // uint16
+ dumpDec< sal_uInt16 >( "value", aInfo.second );
+ break;
+ case 7: // blob
+ dumpBinary( "value", rStrm.readuInt32() );
+ break;
+ default:
+ bValid = false;
+ }
+ }
+}
+
+WorkbookStreamObject::ChFrExtPropInfo WorkbookStreamObject::dumpChFrExtPropHeader()
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ ChFrExtPropInfo aInfo;
+ aInfo.first = dumpDec< sal_uInt8 >( "datatype", "CHFREXTPROPS-TYPE" );
+ dumpUnused( 1 );
+ sal_uInt16 nTag = dumpDec< sal_uInt16 >( "tag", "CHFREXTPROPS-TAG" );
+ aInfo.second = cfg().getName( "CHFREXTPROPS-TAG-NAMELIST", nTag );
+ return aInfo;
+}
+
+// ============================================================================
+
+PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const ::rtl::OUString& rSysFileName )
+{
+ RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
+}
+
+void PivotCacheStreamObject::implDumpRecordBody()
+{
+ BiffInputStream& rStrm = getBiffStream();
+ sal_uInt16 nRecId = rStrm.getRecId();
+
+ switch( nRecId )
+ {
+ case BIFF_ID_PCDEFINITION:
+ dumpDec< sal_Int32 >( "source-records" );
+ dumpHex< sal_uInt16 >( "cache-id" );
+ dumpHex< sal_uInt16 >( "flags", "PCDEFINITION-FLAGS" );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "sourcedata-field-count" );
+ dumpDec< sal_uInt16 >( "cache-field-count" );
+ dumpDec< sal_uInt16 >( "report-record-count" );
+ dumpDec< sal_uInt16 >( "database-type", "PCDSOURCE-TYPE" );
+ dumpString( "user-name" );
+ break;
+
+ case BIFF_ID_PCDEFINITION2:
+ dumpDec< double >( "refreshed-date" );
+ dumpDec< sal_Int32 >( "formula-count" );
+ break;
+
+ case BIFF_ID_PCDFDISCRETEPR:
+ mxOut->resetItemIndex();
+ while( !rStrm.isEof() && (rStrm.getRemaining() >= 2) )
+ dumpDec< sal_uInt16 >( "#item-index" );
+ break;
+
+ case BIFF_ID_PCDFIELD:
+ dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
+ dumpDec< sal_uInt16 >( "group-parent-field" );
+ dumpDec< sal_uInt16 >( "group-base-field" );
+ dumpDec< sal_uInt16 >( "unique-items" );
+ dumpDec< sal_uInt16 >( "group-items" );
+ dumpDec< sal_uInt16 >( "base-items" );
+ dumpDec< sal_uInt16 >( "shared-items" );
+ if( rStrm.getRemaining() >= 3 )
+ dumpString( "item-name" );
+ break;
+
+ case BIFF_ID_PCITEM_DATE:
+ {
+ DateTime aDateTime;
+ aDateTime.Year = mxStrm->readuInt16();
+ aDateTime.Month = mxStrm->readuInt16();
+ aDateTime.Day = mxStrm->readuInt8();
+ aDateTime.Hours = mxStrm->readuInt8();
+ aDateTime.Minutes = mxStrm->readuInt8();
+ aDateTime.Seconds = mxStrm->readuInt8();
+ writeDateTimeItem( "value", aDateTime );
+ }
+ break;
+
+ case BIFF_ID_PCITEM_STRING:
+ dumpString( "value" );
+ break;
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+RootStorageObject::RootStorageObject( const DumperBase& rParent )
+{
+ OleStorageObject::construct( rParent );
+ addPreferredStream( "Book" );
+ addPreferredStream( "Workbook" );
+}
+
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAscii( "Book" ) || rStrmName.equalsAscii( "Workbook" )) )
+ WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
+ else if( rStrgPath.equalsAscii( "_SX_DB" ) )
+ PivotCacheStreamObject( *this, rxStrm, BIFF5, rSysFileName ).dump();
+ else if( rStrgPath.equalsAscii( "_SX_DB_CUR" ) )
+ PivotCacheStreamObject( *this, rxStrm, BIFF8, rSysFileName ).dump();
+ else
+ OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void RootStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+ if( rStrgPath.equalsAscii( "_VBA_PROJECT_CUR" ) )
+ VbaProjectStorageObject( *this, rxStrg, rSysPath ).dump();
+ else if( rStrgPath.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( "MBD" ) ) )
+ VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
+ else
+ OleStorageObject::implDumpStorage( rxStrg, rStrgPath, rSysPath );
+}
+
+void RootStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+#define DUMP_BIFF_CONFIG_ENVVAR "OOO_BIFFDUMPER"
+
+Dumper::Dumper( const FilterBase& rFilter )
+{
+ ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rFilter ) );
+ DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+ if( rxFactory.is() && rxInStrm.is() )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( rxFactory, rxInStrm, true ) );
+ MediaDescriptor aMediaDesc;
+ ConfigRef xCfg( new Config( DUMP_BIFF_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
+ DumperBase::construct( xCfg );
+ }
+}
+
+void Dumper::implDump()
+{
+ RootStorageObject( *this ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+} // namespace biff
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini
new file mode 100644
index 000000000000..2e25ff81c890
--- /dev/null
+++ b/oox/source/dump/biffdumper.ini
@@ -0,0 +1,2378 @@
+
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+include-config-file=dffdumper.ini
+include-config-file=oledumper.ini
+
+# Enable entire dumper. This option does not affect the option 'enable-import'.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping. Disabling this option allows to dump a file
+# without loading it. This option is independent from the 'enable-dumper'
+# option.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
+# enable-import=1
+
+# BIFF record settings -------------------------------------------------------
+
+# Merge CONTINUE records with leading record (default=on).
+# 0=off - show CONTINUE records separately (hex dump)
+# 1=on - show contents of leading record together with following CONTINUE
+merge-continue-record=1
+
+# name lists =================================================================
+
+# common ---------------------------------------------------------------------
+
+unitconverter=CONV-PERCENT-NEG,-1,%
+unitconverter=CONV-COLWIDTH,/256,chars
+unitconverter=CONV-TINT,/327.67,%
+
+shortlist=BIFF,0,biff2,biff3,biff4,biff5,biff8
+
+constlist=ERRORCODES
+ 0x00=#NULL!
+ 0x07=#DIV/0!
+ 0x0F=#VALUE!
+ 0x17=#REF!
+ 0x1D=#NAME?
+ 0x24=#NUM!
+ 0x2A=#N/A
+end
+
+shortlist=WINDOWS-PALETTE-0,0,black,white,red,green,blue,yellow,magenta,cyan
+shortlist=WINDOWS-PALETTE-8,8,black,white,red,green,blue,yellow,magenta,cyan
+shortlist=WINDOWS-PALETTE-16,16,dark-red,dark-green,dark-blue,dark-yellow,dark-magenta,dark-cyan,light-grey,dark-grey
+
+multilist=WINDOWS-SYSCOLORS-BIFF2
+ 24=sys-window-text,sys-window-bg
+ 0x7FFF=sys-window-text
+end
+
+multilist=WINDOWS-SYSCOLORS-BIFF5
+ 64=sys-window-text,sys-window-bg,,sys-button-face
+ 77=sys-window-text-chart,sys-window-bg-chart,auto-border-chart,sys-tooltip-bg,sys-tooltip-text
+ 0x7FFF=sys-window-text
+end
+
+constlist=COLORS-BIFF2
+ include=WINDOWS-PALETTE-0
+ include=WINDOWS-SYSCOLORS-BIFF2
+end
+
+constlist=COLORS-BIFF3
+ include=WINDOWS-PALETTE-0
+ include=WINDOWS-PALETTE-8
+ include=WINDOWS-PALETTE-16
+ include=WINDOWS-SYSCOLORS-BIFF2
+end
+
+multilist=COLORS-BIFF5
+ include=WINDOWS-PALETTE-0
+ include=WINDOWS-PALETTE-8
+ include=WINDOWS-PALETTE-16
+ 24=0x8080FF,0x802060,0xFFFFC0,0xA0E0E0,0x600080,0xFF8080,0x0080C0,0xC0C0FF
+ 32=0x000080,0xFF00FF,0xFFFF00,0x00FFFF,0x800080,0x800000,0x008080,0x0000FF
+ 40=0x00CFFF,0x69FFFF,0xE0FFE0,0xFFFF80,0xA6CAF0,0xDD9CB3,0xB38FEE,0xE3E3E3
+ 48=0x2A6FF9,0x3FB8CD,0x488436,0x958C41,0x8E5E42,0xA0627A,0x624FAC,0x969696
+ 56=0x1D2FBE,0x286676,0x004500,0x453E01,0x6A2813,0x85396A,0x4A3285,0x424242
+ include=WINDOWS-SYSCOLORS-BIFF5
+end
+
+multilist=COLORS-BIFF8
+ include=WINDOWS-PALETTE-0
+ include=WINDOWS-PALETTE-8
+ include=WINDOWS-PALETTE-16
+ 24=0x9999FF,0x993366,0xFFFFCC,0xCCFFFF,0x660066,0xFF8080,0x0066CC,0xCCCCFF
+ 32=0x000080,0xFF00FF,0xFFFF00,0x00FFFF,0x800080,0x800000,0x008080,0x0000FF
+ 40=0x00CCFF,0xCCFFFF,0xCCFFCC,0xFFFF99,0x99CCFF,0xFF99CC,0xCC99FF,0xFFCC99
+ 48=0x3366FF,0x33CCCC,0x99CC00,0xFFCC00,0xFF9900,0xFF6600,0x666699,0x969696
+ 56=0x003366,0x339966,0x003300,0x333300,0x993300,0x993366,0x333399,0x333333
+ include=WINDOWS-SYSCOLORS-BIFF5
+end
+
+shortlist=BORDERSTYLES-BIFF3,0,none,thin,medium,dash,dot,thick,double,hair
+
+multilist=BORDERSTYLES-BIFF8
+ include=BORDERSTYLES-BIFF3
+ 8=medium-dash,thin-dash-dot,medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
+end
+
+multilist=FILLPATTERNS-BIFF3
+ 0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
+ 5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
+ 10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
+ 15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
+end
+
+shortlist=TEXTORIENTATION,0,horizontal,stacked,90°-ccw,90°-cw
+
+constlist=TEXTROTATION-BIFF8
+ default=
+ 255=stacked
+end
+
+multilist=BUILTIN-FORMATS
+ quote-names=1
+ 0=General,0,0.00,'#,##0','#,##0.00'
+ 5='"$"#,##0_);\("$"#,##0\)','"$"#,##0_);[Red]\("$"#,##0\)','"$"#,##0.00_);\("$"#,##0.00\)','"$"#,##0.00_);[Red]\("$"#,##0.00\)',0%
+ 10=0.00%,0.00E+00,# ?/?,# ??/??,M/D/YYYY
+ 15=D-MMM-YY,D-MMM,MMM-YY,h:mm AM/PM,h:mm:ss AM/PM
+ 20=h:mm,h:mm:ss,M/D/YYYY h:mm,General,General
+ 25=General,General,M/D/YYYY,M/D/YYYY,M/D/YYYY
+ 30=M/D/YYYY,M/D/YYYY,h:mm:ss,h:mm:ss,h:mm:ss
+ 35=h:mm:ss,M/D/YYYY,'#,##0_);(#,##0)','#,##0_);[Red](#,##0)','#,##0.00_);(#,##0.00)'
+ 40='#,##0.00_);[Red](#,##0.00)'
+ 41='_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)'
+ 42='_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)'
+ 43='_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)'
+ 44='_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)'
+ 45=mm:ss,[h]:mm:ss,mm:ss.0,##0.0E+0,@
+ 50=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY
+ 55=M/D/YYYY,M/D/YYYY,M/D/YYYY,M/D/YYYY,0
+ 60=0.00,'#,##0','#,##0.00','$#,##0_);($#,##0)','$#,##0_);[Red]($#,##0)'
+ 65='$#,##0.00_);($#,##0.00)','$#,##0.00_);[Red]($#,##0.00)',0%,0.00%,# ?/?
+ 70=# ??/??,M/D/YYYY,M/D/YYYY,D-MMM-YY,D-MMM
+ 75=MMM-YY,h:mm,h:mm:ss,M/D/YYYY h:mm,mm:ss
+ 80=[h]:mm:ss,mm:ss.0
+end
+
+constlist=CONSTVALUE-TYPE
+ 0=empty
+ 1=number
+ 2=string
+ 4=boolean
+ 16=error
+end
+
+constlist=PIVOT-NAMELEN
+ default=
+ 0xFFFF=name-in-cache
+end
+
+flagslist=FR-FLAGS
+ 0x0001=has-ref
+ 0x0002=alert-unsupported
+end
+
+shortlist=EXTCOLOR-TYPE,0,auto,indexed,rgb,theme,n/a
+
+combilist=EXTCOLOR-FLAGS
+ 0x01=rgb-valid
+ 0xFE=uint8,dec,type,EXTCOLOR-TYPE
+end
+
+shortlist=EXTGRADIENT-TYPE,0,linear,path
+
+shortlist=EXTFONT-SCHEME,-1,n/a,none,major,minor
+
+# DFF ------------------------------------------------------------------------
+
+flagslist=DFF-CLIENTANCHOR-FLAGS
+ 0x0001=pos-locked
+ 0x0002=size-locked
+end
+
+# formulas -------------------------------------------------------------------
+
+multilist=BASETOKENS-BIFF2
+ 0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
+ 0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
+ 0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
+ 0x18=,tAttr,tSheet,tEndSheet,tErr,tBool,tInt,tNum
+end
+
+constlist=BASETOKENS-BIFF5
+ include=BASETOKENS-BIFF2
+ exclude=0x1A,0x1B
+end
+
+constlist=BASETOKENS-BIFF8
+ include=BASETOKENS-BIFF5
+ 0x18=tNlr
+end
+
+constlist=TOKENCLASSES
+ 0x20=R
+ 0x40=V
+ 0x60=A
+end
+
+multilist=CLASSTOKENS-BIFF2
+ 0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
+ 0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
+ 0x18=tFuncCE
+end
+
+constlist=CLASSTOKENS-BIFF4
+ include=CLASSTOKENS-BIFF2
+ exclude=0x18
+end
+
+multilist=CLASSTOKENS-BIFF5
+ include=CLASSTOKENS-BIFF4
+ 0x19=tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
+end
+
+combilist=FUNCID
+ 0x7FFF=uint16,dec,func-id
+ 0x8000=command
+end
+
+combilist=PARAMCOUNT-CMD
+ 0x7F=uint8,dec,count
+ 0x80=prompt
+end
+
+combilist=REFRELFLAGS
+ 0x3FFF=uint16,dec,value
+ 0x4000=col-rel
+ 0x8000=row-rel
+end
+
+multilist=NLRTYPES
+ 0x00=,tNlrErr,tNlrRowR,tNlrColR,,,tNlrRowV,tNlrColV
+ 0x08=,,tNlrRange,tNlrSRange,tNlrSRowR,tNlrSColR,tNlrSRowV,tNlrSColV
+ 0x10=tNlrRangeErr,,,,,,,
+ 0x18=,,,,,tNlrSxName,,
+end
+
+combilist=NLRADDFLAGS
+ 0x3FFFFFFF=uint32,dec,count
+ 0x80000000=rel
+end
+
+flagslist=ATTRTYPES
+ 0x00=skip
+ 0x01=volatile
+ 0x02=if
+ 0x04=choose
+ 0x08=skip
+ 0x10=sum
+ 0x20=assign
+ 0x40=space
+end
+
+shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
+
+# record names ---------------------------------------------------------------
+
+multilist=RECORD-NAMES-BIFF2
+ # worksheet records
+ 0x0000=DIMENSION,BLANK,INTEGER,NUMBER,LABEL,BOOLERR,FORMULA,STRING
+ 0x0008=ROW,BOF,EOF,INDEX,CALCCOUNT,CALCMODE,PRECISION,REFMODE
+ 0x0010=DELTA,ITERATION,PROTECT,PASSWORD,HEADER,FOOTER,EXTERNCOUNT,EXTERNSHEET
+ 0x0018=DEFINEDNAME,WINDOWPROTECT,VERTICALPAGEBREAKS,HORIZONTALPAGEBREAKS,NOTE,SELECTION,FORMAT,BUILTINFMTCOUNT
+ 0x0020=COLUMNDEFAULT,ARRAY,DATEMODE,EXTERNALNAME,COLWIDTH,DEFAULTROWHEIGHT,LEFTMARGIN,RIGHTMARGIN
+ 0x0028=TOPMARGIN,BOTTOMMARGIN,PRINTHEADERS,PRINTGRIDLINES,,,,FILEPASS
+ 0x0030=,FONT,FONT2,PRINTSIZE,,INFOOPTS,DATATABLE,DATATABLE2
+ 0x0038=WNDESK,,BEGINPREF,ENDPREF,CONTINUE,WINDOW1,WINDOW2,
+ 0x0040=BACKUP,PANE,CODEPAGE,XF,IXFE,EFONT,SHOWSCROLL,SHOWFORMULA
+ 0x0048=STATUSBAR,SHORTMENUS,DDEENABLED,AUTODEC,MENUKEY,PLS|ZOOM,MENUUND,MOVESEL
+ 0x0050=DCON,DCONREF,DCONNAME,,,DEFCOLWIDTH,,
+ # worksheet records new in BIFF3, but supported in BIFF2 streams
+ 0x0200=DIMENSION,BLANK,,NUMBER,LABEL,BOOLERR,,
+ 0x0208=,,,INDEX,,,,
+ 0x027E=RK
+ # BIFF5 style BOF
+ 0x0809=BOF
+ # chart records
+ 0x1000=,CHUNITS,CHCHART,CHSERIES,CHSOURCELINK,,CHDATAFORMAT,CHLINEFORMAT
+ 0x1008=,CHMARKERFORMAT,CHAREAFORMAT,CHPIEFORMAT,CHATTACHEDLABEL,CHSTRING,,
+ 0x1010=,,,,CHTYPEGROUP,CHLEGEND,CHSERIESLIST,CHBAR
+ 0x1018=CHLINE,CHPIE,CHAREA,CHSCATTER,CHCHARTLINE,CHAXIS,CHTICK,CHVALUERANGE
+ 0x1020=CHLABELRANGE,CHAXISLINE,CHFORMATLINK,,CHDEFAULTTEXT,CHTEXT,CHFONT,CHOBJECTLINK
+ 0x1028=,,,,,CHARROW,,CHARROWHEAD
+ 0x1030=,,CHFRAME,CHBEGIN,CHEND,CHPLOTFRAME,CHCHARTSIZE,CHRELPOSITION
+ 0x1038=CHARROWRELPOS,,CHCHART3D,,,,,
+end
+
+multilist=RECORD-NAMES-BIFF3
+ include=RECORD-NAMES-BIFF2
+ # worksheet records
+ exclude=0x0006,0x0008,0x0009,0x000B,0x0018,0x0020,0x0023,0x0024,0x0025,0x0031,0x0036,0x0037,0x003E,0x0043,0x0044,0x0045
+ 0x0050=,,,,,,BUILTINFMTCOUNT,
+ 0x0058=TOOLBAR,XCT,CRN,FILESHARING,WRITEACCESS,OBJ,UNCALCED,SAFERECALC
+ 0x0060=TEMPLATE,INTL,,OBJECTPROTECT,,,,
+ 0x0068=,,,,,,,
+ 0x0070=,,,,,,,
+ 0x0078=,,,,,COLINFO,,IMGDATA
+ 0x0080=GUTS,SHEETPR,GRIDSET,HCENTER,VCENTER,,WRITEPROT,ADDIN
+ 0x0088=EDG,PUB,NOTEOFF,LH,COUNTRY,HIDEOBJ,,
+ 0x0090=SORT,SUB,PALETTE,,LHRECORD,LHNGRAPH,,
+ 0x0200=,,,,,,FORMULA,STRING
+ 0x0208=ROW,BOF,,,,,,
+ 0x0218=DEFINEDNAME
+ 0x0221=ARRAY
+ 0x0223=EXTERNALNAME
+ 0x0225=DEFAULTROWHEIGHT
+ 0x0231=FONT
+ 0x0236=DATATABLE
+ 0x023E=WINDOW2
+ 0x0243=XF
+ 0x0293=STYLE
+ # chart records
+ 0x103C=CHPICFORMAT
+end
+
+multilist=RECORD-NAMES-BIFF4
+ include=RECORD-NAMES-BIFF3
+ # worksheet/workbook records
+ exclude=0x0206,0x0209,0x001E,0x0243
+ 0x0085=SHEET
+ 0x0088=,,,,,,SHEETSOFFSET,SHEETHEADER
+ 0x0090=,,,,,SOUND,SYNC
+ 0x0098=LPR,STANDARDWIDTH,FNGROUPNAME,,FNGROUPCOUNT,,,
+ 0x00A0=SCL,PAGESETUP,FNPROTO,PROJEXTSHEET,,,,
+ 0x00A8=DRAGDROP,COORDLIST,,GCW,,,,
+ 0x0406=FORMULA
+ 0x0409=BOF
+ 0x041E=FORMAT
+ 0x0443=XF
+ # chart records
+ 0x1038=,,,CHMULTILINK,,CHDROPBAR,CHRADARLINE,CHSURFACE
+end
+
+multilist=RECORD-NAMES-BIFF5
+ include=RECORD-NAMES-BIFF4
+ # worksheet/workbook records
+ exclude=0x0409,0x0218,0x0223,0x0231,0x0443
+ 0x0006=FORMULA
+ 0x0018=DEFINEDNAME
+ 0x0023=EXTERNALNAME
+ 0x0031=FONT
+ 0x0098=,,,FILTERMODE,,AUTOFILTER,FILTERCOLUMN,
+ 0x00A8=,,,,,,SCENARIOS,SCENARIO
+ 0x00B0=PTDEFINITION,PTFIELD,PTFITEM,,PTROWCOLFIELDS,PTROWCOLITEMS,PTPAGEFIELDS,
+ 0x00B8=DOCROUTE,RECIPNAME,,,,MULTRK,MULTBLANK,TOOLBARHDR
+ 0x00C0=TOOLBAREND,MMS,ADDMENU,DELMENU,,PTDATAFIELD,PCDEFINITION,PCDFIELD
+ 0x00C8=PCITEM_INDEXLIST,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR,PCITEM_INTEGER,PCITEM_STRING,PCITEM_DATE,PCITEM_MISSING
+ 0x00D0=SXTBL,SXTBRGITEM,SXTBPG,VBAPROJECT,,PIVOTCACHE,RSTRING,DBCELL
+ 0x00D8=PCDFRANGEPR,PCDFDISCRETEPR,BOOKBOOL,REVERT,DBORPARAMQUERY,SCENPROTECT,OLESIZE,UDDESC
+ 0x00E0=XF,INTERFACEHDR,INTERFACEEND,PCDSOURCE,,,,
+ 0x0206=FORMULA
+ 0x04BC=SHAREDFMLA
+ # chart records
+ exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B
+ 0x1040=CHRADARAREA,CHAXESSET,,CHLEGENDENTRY,CHPROPERTIES,CHSERGROUP,CHUSEDAXESSETS,
+ 0x1048=CHPIVOTREF,,CHSERPARENT,CHSERTRENDLINE,,,CHFORMAT,CHFRAMEPOS
+ 0x1050=CHFORMATRUNS,CHSOURCELINK,,,,,,
+ 0x1058=,,,CHSERERRORBAR,,CHSERIESFORMAT,,
+end
+
+multilist=RECORD-NAMES-BIFF8
+ include=RECORD-NAMES-BIFF5
+ # worksheet/workbook records
+ 0x00E0=,,,,,CELLMERGING,,
+ 0x00E8=,IMGDATA,,MSODRAWINGGROUP,MSODRAWING,MSODRAWINGSELECTION,,PHONETICPR
+ 0x00F0=,PTDEFINITION2,,,,,,
+ 0x00F8=,PCDFORMULAFIELD,,,SST,LABELSST,,EXTSST
+ 0x0100=PTFIELD2,,,PCDFIELDINDEX,,,,
+ 0x0120=,,PCDEFINITION2,,,,,
+ 0x0130=,,,,,,,CHTRINSERT
+ 0x0138=CHTRINFO,,,CHTRCELLCONTENT,,TABID,,
+ 0x0140=CHTRMOVERANGE,,,,,,,
+ 0x0148=,,,,,CHTRINSERTTAB,,
+ 0x0158=,,,,,,,LABELRANGES
+ 0x0160=USESELFS,DSF,XL5MODIFY,,,,,
+ 0x0190=,,,,,,CHTRHEADER,
+ 0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QUERYTABLE,EXTERNALBOOK,PROT4REV
+ 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL
+ 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,VBAPROJECTEMPTY,DATAVALIDATION,
+ 0x01C0=XL9FILE,RECALCID,INTCACHEDDATA,,,,,
+ # future records
+ 0x0800=SCREENTIP,,QUERYTABLEREFRESH,QUERYTABLESETTINGS,QUERYTABLESTRING,,,
+ 0x0850=CHFRINFO,CHFRWRAPPER,CHFRBLOCKBEGIN,CHFRBLOCKEND,,,CHFRCATEGORYPROPS,CHFRUNITPROPS
+ 0x0858=CHPIVOTREF,CHPIVOTFLAGS,,,,,,
+ 0x0860=,,SHEETEXT,BOOKEXT,,,,SHAREDFEATHEAD
+ 0x0868=,,,CHFRLABELPROPS,,,,
+ 0x0870=,,,,,,CONNECTION,
+ 0x0878=,,CFRULE12,CFRULEEXT,XFCRC,XFEXT,FILTERCOLUMN12,CONTINUE12
+ 0x0888=,,,PAGELAYOUTVIEW,CHECKCOMPAT,DXF,TABLESTYLES,
+ 0x0890=,,STYLEEXT,,,,THEME,
+ 0x0898=,,MTHREADSETTINGS,COMPRESSPICS,HEADERFOOTER,CHFRLAYOUT,CHFREXTPROPS,CHFREXTPROPSCONT
+ 0x08A0=,,,FORCEFULLCALC,CHFRSHAPEPROPS,CHFRTEXTPROPS,,CHFRPLOTAREALAYOUT
+ # chart records
+ 0x1058=,,,,,,,CH3DDATAFORMAT
+ 0x1060=CHFONTBASE,CHPIEEXT,CHDATERANGE,CHDATATABLE,CHPLOTGROWTH,CHSERINDEX,CHESCHERFORMAT,CHPIEEXTSETT
+end
+
+# simple records -------------------------------------------------------------
+
+constlist=SIMPLE-RECORDS-BIFF2
+ 0x000C=uint16,dec,max-iterations
+ 0x000D=int16,dec,calc-mode,CALCMODE
+ 0x000E=uint16,bool,calc-precise
+ 0x000F=uint16,dec,ref-mode,REFMODE
+ 0x0010=double,dec,epsilon
+ 0x0011=uint16,bool,iterate-recursive
+ 0x0012=uint16,bool,contents-protected
+ 0x0013=uint16,hex,password-hash
+ 0x0016=uint16,dec,externsheets
+ 0x0019=uint16,bool,window-protected
+ 0x001F=uint16,dec,builtin-fmt-count
+ 0x0022=uint16,dec,null-date,DATEMODE
+ 0x0025=uint16,hex,rowheight-flags,DEFROWHEIGHT-FLAGS
+ 0x0026=double,dec,left-margin,CONV-INCH-TO-CM
+ 0x0027=double,dec,right-margin,CONV-INCH-TO-CM
+ 0x0028=double,dec,top-margin,CONV-INCH-TO-CM
+ 0x0029=double,dec,bottom-margin,CONV-INCH-TO-CM
+ 0x002A=uint16,bool,print-sheet-headers
+ 0x002B=uint16,bool,print-gridlines
+ 0x0040=uint16,bool,backup-on-save
+ 0x0044=uint16,dec,xf-idx
+ 0x0045=uint16,dec,font-color-idx,COLORS
+ 0x0055=uint16,dec,base-col-width
+ 0x100B=uint16,dec,extrusion,CONV-PERCENT
+ 0x100C=uint16,hex,flags,CHATTACHEDLABEL-FLAGS
+ 0x1018=uint16,hex,flags,CHLINE-FLAGS
+ 0x101A=uint16,hex,flags,CHAREA-FLAGS
+ 0x101C=uint16,dec,line-type,CHCHARTLINE-TYPE
+ 0x1021=uint16,dec,axisline-id,CHAXISLINE-ID
+ 0x1024=uint16,dec,text-idx
+ 0x1026=uint16,dec,font-idx,FONTNAMES
+ 0x1045=uint16,dec,group-idx
+ 0x1046=uint16,dec,used-axessets
+ 0x104A=uint16,dec,series-idx
+ 0x104E=uint16,dec,fmt-idx,FORMATS
+end
+
+constlist=SIMPLE-RECORDS-BIFF3
+ include=SIMPLE-RECORDS-BIFF2
+ 0x0056=uint16,dec,builtin-fmt-count
+ 0x005E=uint16,unused
+ 0x005F=uint16,bool,recalc-on-save
+ 0x0063=uint16,bool,objects-protected
+ 0x0081=uint16,hex,flags,SHEETPR-FLAGS
+ 0x0082=uint16,bool,print-gridlines-changed
+ 0x0083=uint16,bool,horizontal-centered
+ 0x0084=uint16,bool,vertical-centered
+ 0x008D=uint16,dec,object-mode,HIDEOBJ
+end
+
+constlist=SIMPLE-RECORDS-BIFF4
+ include=SIMPLE-RECORDS-BIFF3
+ 0x008E=uint32,hex,stream-pos,CONV-DEC
+ 0x0099=uint16,dec,default-col-width,CONV-COLWIDTH
+ 0x009C=uint16,dec,func-group-count
+ 0x103D=uint16,dec,bar-dist
+ 0x103E=uint16,hex,flags,CHRADAR-FLAGS
+ 0x103F=uint16,hex,flags,CHSURFACE-FLAGS
+end
+
+constlist=SIMPLE-RECORDS-BIFF5
+ include=SIMPLE-RECORDS-BIFF4
+ 0x009D=uint16,dec,column-count
+ 0x00C9=double,dec,value
+ 0x00CA=uint16,bool,value
+ 0x00CB=uint16,hex,error-code,ERRORCODES
+ 0x00CC=int16,dec,value
+ 0x00D5=uint16,hex,cache-id
+ 0x00D8=uint16,hex,flags,PCDFRANGEPR-FLAGS
+ 0x00DA=uint16,bool,strip-cached-values
+ 0x00DD=uint16,bool,scenarios-protected
+ 0x00E3=uint16,dec,source-type,PCDSOURCE-TYPE
+ 0x1040=uint16,hex,flags,CHRADAR-FLAGS
+ 0x105D=uint16,hex,flags,CHSERIESFORMAT-FLAGS
+end
+
+constlist=SIMPLE-RECORDS-BIFF8
+ include=SIMPLE-RECORDS-BIFF5
+ 0x00E1=uint16,dec,codepage,CODEPAGES
+ 0x0160=uint16,bool,use-nat-lang-refs
+ 0x0161=uint16,bool,double-stream
+ 0x01AF=uint16,bool,revlog-protected
+ 0x01B7=uint16,bool,refresh-all
+ 0x01BB=uint16,dec,sql-data-type,PCDFSQLTYPE-DATATYPE
+ 0x01BC=uint16,hex,password-hash
+ 0x1065=uint16,dec,series-idx
+end
+
+# ARRAY ----------------------------------------------------------------------
+
+flagslist=ARRAY-FLAGS-BIFF2
+ 0x0001=recalc-always
+end
+
+flagslist=ARRAY-FLAGS-BIFF3
+ include=ARRAY-FLAGS-BIFF2
+ 0x0002=recalc-onload
+end
+
+# BOF ------------------------------------------------------------------------
+
+constlist=BOF-BIFFTYPE
+ 0x0000=from-id
+ 0x0007=biff2
+ 0x0200=biff2
+ 0x0300=biff3
+ 0x0400=biff4
+ 0x0500=biff5
+ 0x0600=biff8
+end
+
+constlist=BOF-SHEETTYPE
+ 0x0005=globals
+ 0x0006=vb-module
+ 0x0010=sheet
+ 0x0020=chart
+ 0x0040=macro
+ 0x0100=workspace
+end
+
+shortlist=BOF-EXCELVERSION,0,excel-97,excel-2000,excel-2002,excel-2003,excel-2007,,excel-2010
+shortlist=BOF-LOWESTVERSION-BIFF,6,biff8
+
+combilist=BOF-HISTORY-FLAGS
+ ignore=0x000000C0
+ 0x00000001=windows
+ 0x00000002=risc
+ 0x00000004=beta
+ 0x00000008=win-any
+ 0x00000010=mac-any
+ 0x00000020=beta-any
+ 0x00000100=risc-any
+ 0x00000200=out-of-mem
+ 0x00000400=out-of-mem-renderer
+ 0x00002000=font-limit-255
+ 0x0003C000=uint8,dec,max-version-saved,BOF-EXCELVERSION
+end
+
+combilist=BOF-LOWESTVERSION-FLAGS
+ 0x000000FF=uint8,dec,biff-version,BOF-LOWESTVERSION-BIFF
+ 0x00000F00=uint8,dec,version-saved,BOF-EXCELVERSION
+end
+
+# BOOKEXT --------------------------------------------------------------------
+
+combilist=BOOKEXT-FLAGS1
+ 0x00000001=no-auto-recover
+ 0x00000002=hide-pivot-list
+ 0x00000004=filter-privacy
+ 0x00000008=embed-smarttags
+ 0x00000030=uint8,dec,display-smarttags,BOOKEXT-DISPLAY-SMARTTAGS
+ 0x00000040=saved-on-recovery
+ 0x00000080=minimal-save
+ 0x00000100=opened-on-recovery
+ 0x00000200=opened-in-save-mode
+end
+
+shortlist=BOOKEXT-DISPLAY-SMARTTAGS,0,button-and-indicator,button,nothing
+
+flagslist=BOOKEXT-FLAGS2
+ 0x01=warn-smart-doc-manifest
+ 0x02=show-inc-annotations
+end
+
+flagslist=BOOKEXT-FLAGS3
+ 0x02=!all-published!selected-items-published
+ 0x04=show-pivot-chart-filter
+end
+
+# CALCMODE -------------------------------------------------------------------
+
+shortlist=CALCMODE,-1,automatic-no-table,manual,automatic
+
+# CFHEADER -------------------------------------------------------------------
+
+combilist=CFHEADER-FLAGS
+ 0x0001=complex
+ 0xFFFE=uint16,dec,id
+end
+
+# CFRULE ---------------------------------------------------------------------
+
+shortlist=CFRULE-TYPE,1,value,formula
+shortlist=CFRULE-OPERATOR,0,none,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+
+flagslist=CFRULE-FLAGS1
+ ignore=0x00200000
+ 0x00000001=!hor-align-used
+ 0x00000002=!vert-align-used
+ 0x00000004=!text-wrap-used
+ 0x00000008=!rotation-used
+ 0x00000010=!justify-lastline-used
+ 0x00000020=!indent-used
+ 0x00000040=!shrinktofit-used
+ 0x00000080=!cell-merged-used
+ 0x00000100=!cell-locked-used
+ 0x00000200=!cell-hidden-used
+ 0x00000400=!left-border-used
+ 0x00000800=!right-border-used
+ 0x00001000=!top-border-used
+ 0x00002000=!bottom-border-used
+ 0x00004000=!tl-to-br-used
+ 0x00008000=!bl-to-tr-used
+ 0x00010000=!fill-pattern-used
+ 0x00020000=!fg-color-idx-used
+ 0x00040000=!bg-color-idx-used
+ 0x00080000=!fmt-idx-used
+ 0x00100000=!def-font-used
+ 0x02000000=numfmt-block
+ 0x04000000=font-block
+ 0x08000000=alignment-block
+ 0x10000000=border-block
+ 0x20000000=pattern-block
+ 0x40000000=protection-block
+ 0x80000000=!text-dir-used
+end
+
+flagslist=CFRULE-FLAGS2
+ ignore=0x0002
+ 0x0001=!numfmt-id!numfmt-string
+ 0x0004=outline-border
+ 0x8000=use-text-dir
+end
+
+combilist=CFRULE-ALIGNMENT
+ 0x07=uint8,dec,hor-align,XF-HORALIGN
+ 0x08=text-wrap
+ 0x70=uint8,dec,ver-align,XF-VERALIGN
+ 0x80=justify-lastline
+end
+
+combilist=CFRULE-INDENT
+ 0x000F=uint8,dec,indent
+ 0x0010=shrink-to-fit
+ 0x0020=cell-merged
+ 0x00C0=uint8,dec,text-dir,XF-TEXTDIRECTION
+end
+
+flagslist=CFRULE-FONTFLAGS
+ 0x00000002=italic
+ 0x00000008=outline
+ 0x00000010=shadow
+ 0x00000020=condense
+ 0x00000040=extend
+ 0x00000080=strikeout
+end
+
+constlist=CFRULE-FONTWEIGHT
+ include=FONT-WEIGHT
+ -1=unused
+end
+
+constlist=CFRULE-FONTESCAPEMENT
+ include=FONT-ESCAPEMENT
+ -1=unused
+end
+
+constlist=CFRULE-FONTUNDERLINE
+ include=FONT-UNDERLINE
+ -1=unused
+end
+
+constlist=CFRULE-FONTCOLOR
+ include=COLORS-BIFF8
+ -1=unused
+end
+
+flagslist=CFRULE-FONTUSEDFLAGS
+ ignore=0xFFFFFF00
+ 0x00000002=!italic-used
+ 0x00000008=!outline-used
+ 0x00000010=!shadow-used
+ 0x00000020=!condense-used
+ 0x00000040=!extend-used
+ 0x00000080=!strikeout-used
+end
+
+constlist=CFRULE-FONTUSED
+ 0=used
+ 1=not-used
+end
+
+combilist=CFRULE-BORDERCOLOR2
+ 0x0000007F=uint8,dec,top-color,COLORS
+ 0x00003F80=uint8,dec,bottom-color,COLORS
+ 0x001FC000=uint8,dec,diag-color,COLORS
+ 0x01E00000=uint8,dec,diag-style,BORDERSTYLES
+end
+
+combilist=CFRULE-FILLBLOCK
+ 0x0000FC00=uint8,dec,fill-pattern,FILLPATTERNS
+ 0x007F0000=uint8,dec,fg-color-idx,COLORS
+ 0x3F800000=uint8,dec,bg-color-idx,COLORS
+end
+
+flagslist=CFRULE-PROTECTION-FLAGS
+ 0x0001=locked
+ 0x0002=formula-hidden
+end
+
+# CFRULE12 -------------------------------------------------------------------
+
+shortlist=CFRULE12-TYPE,1,cell-is,expression,color-scale,data-bar,top-ten,icon-set
+
+flagslist=CFRULE12-FLAGS
+ 0x0002=stop-if-true
+end
+
+multilist=CFRULE12-SUBTYPE
+ 0=cell-is,expression,color-scale,data-bar,icon-set,top-ten,,unique-values,contains-text,contains-blanks
+ 10=not-contains-blanks,contains-errors,not-contains-errors,,,today,tomorrow,yesterday,last-7-days,last-month
+ 20=next-month,this-week,next-week,last-week,this-month,above-average,below-average,duplicate-values,,equal-above-average
+ 30=equal-below-average
+end
+
+flagslist=CFRULE12-TOP10-FLAGS
+ 0x01=!bottom!top
+ 0x02=percent
+end
+
+shortlist=CFRULE12-TEXT-OPERATOR,0,contains,not-contains,begins-with,ends-with
+shortlist=CFRULE12-DATE-OPERATOR,0,today,yesterday,last-7-days,this-week,last-week,last-month,tomorrow,next-week,next-month,this-month
+
+# CFRULEEXT ------------------------------------------------------------------
+
+flagslist=CFRULEEXT-FLAGS
+ 0x0001=active
+ 0x0002=stop-if-true
+end
+
+# CH3DDATAFORMAT -------------------------------------------------------------
+
+shortlist=CH3DDATAFORMAT-BASE,0,rectangular,circular
+shortlist=CH3DDATAFORMAT-TOP,0,straight,sharp,trunc
+
+# CHAREA ---------------------------------------------------------------------
+
+flagslist=CHAREA-FLAGS
+ 0x0001=stacked
+ 0x0002=percent
+ 0x0004=shadow
+end
+
+# CHAREAFORMAT ---------------------------------------------------------------
+
+flagslist=CHAREAFORMAT-FLAGS
+ 0x0001=auto
+ 0x0002=swap-negative
+end
+
+# CHATTACHEDLABEL ------------------------------------------------------------
+
+flagslist=CHATTACHEDLABEL-FLAGS
+ 0x0001=show-value
+ 0x0002=show-percent
+ 0x0004=show-categ-percent
+ 0x0008=smoothed
+ 0x0010=show-categ
+ 0x0020=show-bubble
+end
+
+# CHAXESSET ------------------------------------------------------------------
+
+shortlist=CHAXESSET-ID,0,primary,secondary
+
+# CHAXIS ---------------------------------------------------------------------
+
+shortlist=CHAXIS-TYPE,0,x-axis,y-axis,z-axis
+
+# CHAXISLINE -----------------------------------------------------------------
+
+shortlist=CHAXISLINE-ID,0,axisline,major-grid,minor-grid,wall
+
+# CHBAR ----------------------------------------------------------------------
+
+flagslist=CHBAR-FLAGS
+ 0x0001=horizontal
+ 0x0002=stacked
+ 0x0004=percent
+ 0x0008=shadow
+end
+
+# CHCHART3D ------------------------------------------------------------------
+
+flagslist=CHCHART3D-FLAGS
+ ignore=0x0010
+ 0x0001=real3d
+ 0x0002=clustered
+ 0x0004=auto-height
+ 0x0020=2d-plotarea
+end
+
+# CHTYPEGROUP ----------------------------------------------------------------
+
+flagslist=CHTYPEGROUP-FLAGS
+ 0x0001=varied-colors
+end
+
+# CHCHARTLINE ----------------------------------------------------------------
+
+shortlist=CHCHARTLINE-TYPE,0,drop-line,hi-lo-line,series-connector
+
+# CHDATAFORMAT ---------------------------------------------------------------
+
+constlist=CHDATAFORMAT-POINTIDX
+ default=
+ -1=all-points
+end
+
+constlist=CHDATAFORMAT-FORMATIDX
+ default=
+ -3=axesset-global
+end
+
+flagslist=CHDATAFORMAT-FLAGS
+ 0x0001=excel4-colors
+end
+
+# CHDATERANGE ----------------------------------------------------------------
+
+shortlist=CHDATERANGE-UNIT,0,days,months,years
+
+flagslist=CHDATERANGE-FLAGS
+ 0x0001=auto-minimum
+ 0x0002=auto-maximum
+ 0x0004=auto-major
+ 0x0008=auto-minor
+ 0x0010=date-axis
+ 0x0020=auto-base
+ 0x0040=auto-axis-cross
+ 0x0080=auto-date
+end
+
+# CHFRAME --------------------------------------------------------------------
+
+shortlist=CHFRAME-FORMAT,0,standard,,,,shadow
+
+flagslist=CHFRAME-FLAGS
+ 0x0001=auto-size
+ 0x0002=auto-pos
+end
+
+# CHFRAMEPOS -----------------------------------------------------------------
+
+shortlist=CHFRAMEPOS-POSMODE,0,rel-points,abssize-points,parent-dependent,offset-plotarea-size,,chartsize
+
+# CHFRBLOCKBEGIN, CHFRBLOCKEND -----------------------------------------------
+
+shortlist=CHFRBLOCK-TYPE,0,axes-set,,text,,axis,type-group,data-table,frame,,legend,legend-exception,,series,chart,data-format,drop-bar
+
+# CHFRCATEGORYPROPS ----------------------------------------------------------
+
+shortlist=CHFRCATEGORYPROPS-ALIGN,1,top-left,center,bottom-right
+
+flagslist=CHFRCATEGORYPROPS-FLAGS
+ ignore=0xFFFE
+ 0x0001=auto-label-frequency
+end
+
+# CHFREXTPROPS ---------------------------------------------------------------
+
+constlist=CHFREXTPROPS-PARENT
+ 0x0001=log-scaling
+ 0x0002=style
+ 0x0004=category-scaling
+ 0x0005=chart-props
+ 0x000F=legend
+ 0x0013=marker
+ 0x0016=plot-area
+ 0x0019=chart-title
+ 0x0037=3d-props
+end
+
+constlist=CHFREXTPROPS-TYPE
+ 0=start
+ 1=end
+ 2=bool
+ 3=double
+ 4=int32
+ 5=string
+ 6=uint16
+ 7=blob
+end
+
+constlist=CHFREXTPROPS-TAG
+ 0x0000=log-base
+ 0x0003=style
+ 0x001E=chart-formatting
+ 0x0020=text-formatting
+ 0x0022=symbol-type
+ 0x002E=no-multi-level
+ 0x002F=overlay
+ 0x0033=theme-override
+ 0x0034=color-mapping-override
+ 0x0035=backwall-thickness
+ 0x0036=floor-thickness
+ 0x004D=perspective
+ 0x004E=rotation-x
+ 0x004F=rotation-y
+ 0x0050=right-angled-axes-off
+ 0x0052=tick-mark-skip
+ 0x0051=tick-label-skip
+ 0x0053=major-unit
+ 0x0054=minor-unit
+ 0x0055=max
+ 0x0056=min
+ 0x0059=side-wall
+ 0x005B=show-data-labels-over-max
+ 0x005C=tick-label-pos
+ 0x005E=pie-combination
+ 0x005F=basetime-unit
+ 0x0064=format-code
+ 0x0065=height-percent
+ 0x0066=display-blanks-as
+ 0x006A=major-unit-type
+ 0x006B=minor-unit-type
+ 0x0076=edit-language
+end
+
+constlist=CHFREXTPROPS-TAG-NAMELIST
+ default=
+ 0x0022=CHFREXTPROPS-SYMBOLTYPE
+ 0x0035=CONV-PERCENT
+ 0x0036=CONV-PERCENT
+ 0x004E=CONV-DEG
+ 0x004F=CONV-DEG
+ 0x005C=CHFREXTPROPS-TICKLABELPOS
+ 0x005F=CHFREXTPROPS-TIMEUNIT
+ 0x0065=CONV-PERCENT
+ 0x0066=CHFREXTPROPS-DISPBLANKSAS
+ 0x006A=CHFREXTPROPS-TIMEUNIT
+ 0x006B=CHFREXTPROPS-TIMEUNIT
+end
+
+shortlist=CHFREXTPROPS-DISPBLANKSAS,0x0067,gap,,spanned
+shortlist=CHFREXTPROPS-SYMBOLTYPE,0x0023,none,diamond,square,triangle,x,star,dot,dash,circle,plus
+shortlist=CHFREXTPROPS-TICKLABELPOS,0x005D,center
+shortlist=CHFREXTPROPS-TIMEUNIT,0x0060,days,months,years
+
+# CHFRINFO -------------------------------------------------------------------
+
+shortlist=CHFRINFO-APPVERSION,9,excel-2000,excel-xp-2003,,excel-2007
+
+# CHFRLABELPROPS -------------------------------------------------------------
+
+flagslist=CHFRLABELPROPS-FLAGS
+ 0x0001=show-series
+ 0x0002=show-categ
+ 0x0004=show-value
+ 0x0008=show-percent
+ 0x0010=show-bubble
+end
+
+# CHFRLAYOUT -----------------------------------------------------------------
+
+combilist=CHFRLAYOUT-FLAGS
+ 0x001E=uint8,dec,legend-pos,CHFRLAYOUT-LEGENDPOS
+end
+
+shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left
+
+shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde
+
+# CHFRPLOTAREALAYOUT ---------------------------------------------------------
+
+flagslist=CHFRPLOTAREALAYOUT-FLAGS
+ 0x0001=!outer!inner
+end
+
+shortlist=CHFRLAYOUT-LEGENDPOS,0,bottom,top-right,top,right,left
+
+shortlist=CHFRLAYOUT-MODE,0,auto,factor,egde
+
+# CHFRUNITPROPS --------------------------------------------------------------
+
+shortlist=CHFRUNITPROPS-PRESET,-1,manual,none,hundred,thousand,10000,100000,million,10-million,100-million,billion,trillion
+
+flagslist=CHFRUNITPROPS-FLAGS
+ 0x0002=show-unit
+end
+
+# CHLABELRANGE ---------------------------------------------------------------
+
+flagslist=CHLABELRANGE-FLAGS
+ 0x0001=cross-between-categ
+ 0x0002=maximum-axis-cross
+ 0x0004=reverse-order
+end
+
+# CHLEGEND -------------------------------------------------------------------
+
+shortlist=CHLEGEND-DOCKPOS,0,bottom,top-right,top,right,left,,,manual
+shortlist=CHLEGEND-SPACING,0,close,medium,open
+
+flagslist=CHLEGEND-FLAGS
+ 0x0001=docked
+ 0x0002=auto-series
+ 0x0004=auto-pos-x
+ 0x0008=auto-pos-y
+ 0x0010=stacked
+ 0x0020=data-table
+end
+
+# CHLINE ---------------------------------------------------------------------
+
+flagslist=CHLINE-FLAGS
+ 0x0001=stacked
+ 0x0002=percent
+ 0x0004=shadow
+end
+
+# CHLINEFORMAT ---------------------------------------------------------------
+
+shortlist=CHLINEFORMAT-LINETYPE,0,solid,dash,dot,dash-dot,dash-dot-dot,none,25%-pattern,50%-pattern,75%-pattern
+shortlist=CHLINEFORMAT-LINEWEIGHT,-1,hair,thin,medium,thick
+
+flagslist=CHLINEFORMAT-FLAGS
+ 0x0001=auto
+ 0x0004=axis-enabled
+ 0x0008=system-color
+end
+
+# CHMARKERFORMAT -------------------------------------------------------------
+
+shortlist=CHMARKERFORMAT-TYPE,0,none,square,diamond,triangle,cross,star,dow-jones,std-dev,circle,plus
+
+flagslist=CHMARKERFORMAT-FLAGS
+ 0x0001=auto
+ 0x0010=no-fill
+ 0x0020=no-border
+end
+
+# CHOBJECTLINK ---------------------------------------------------------------
+
+shortlist=CHOBJECTLINK-TARGET,0,none,title,y-axis,x-axis,datapoint,legend,none,z-axis,,,,,axis-unit
+
+constlist=CHOBJECTLINK-POINT
+ default=
+ -2=unknown
+ -1=all-points
+end
+
+# CHPICFORMAT ----------------------------------------------------------------
+
+shortlist=CHPICFORMAT-BITMAP-MODE,1,stretched,stacked,stacked-scaled
+
+constlist=CHPICFORMAT-IMAGE-FORMAT
+ 2=wmf
+ 9=bmp
+ 19=?emf
+end
+
+shortlist=CHPICFORMAT-ENV,1,windows,apple
+
+combilist=CHPICFORMAT-FLAGS
+ 0x00FF=uint16,dec,environment,CHPICFORMAT-ENV
+ 0x0100=format-only
+ 0x0200=top-bottom
+ 0x0400=front-back
+ 0x0800=left-right
+end
+
+# CHPIE ----------------------------------------------------------------------
+
+flagslist=CHPIE-FLAGS
+ 0x0001=shadow
+ 0x0002=connectors
+end
+
+# CHPIVOTFLAGS ---------------------------------------------------------------
+
+flagslist=CHPIVOTFLAGS-FLAGS
+ 0x0001=hide-field-captions
+end
+
+# CHRADAR, CHRADARAREA -------------------------------------------------------
+
+flagslist=CHRADAR-FLAGS
+ 0x0001=axis-labels
+ 0x0002=shadow
+end
+
+# CHPROPERTIES ---------------------------------------------------------------
+
+shortlist=CHPROPERTIES-EMPTYCELLS,0,do-not-plot,as-zero,interpolated
+
+flagslist=CHPROPERTIES-FLAGS
+ 0x0001=manual-series
+ 0x0002=plot-visible-only
+ 0x0004=fixed-size
+ 0x0008=manual-plotarea
+ 0x0010=apply-plotarea-pos
+end
+
+# CHSCATTER ------------------------------------------------------------------
+
+shortlist=CHSCATTER-SIZETYPE,0,none,area,width
+
+flagslist=CHSCATTER-FLAGS
+ 0x0001=bubbles
+ 0x0002=show-negative
+ 0x0004=shadow
+end
+
+# CHSERERRORBAR --------------------------------------------------------------
+
+shortlist=CHSERERRORBAR-TYPE,1,x-plus,x-minus,y-plus,y-minus
+shortlist=CHSERERRORBAR-SOURCE,1,percent,fixed,std-deviation,custom,std-error
+
+# CHSERIES -------------------------------------------------------------------
+
+shortlist=CHSERIES-TYPE,0,date,numeric,sequence,text
+
+# CHSERIESFORMAT -------------------------------------------------------------
+
+flagslist=CHSERIESFORMAT-FLAGS
+ 0x0001=spline
+ 0x0002=bubbles-3d
+ 0x0004=shadow
+end
+
+# CHSERTRENDLINE -------------------------------------------------------------
+
+shortlist=CHSERTRENDLINE-TYPE,0,poynomial,exponential,logarithmic,power,moving-average
+
+# CHSOURCELINK ---------------------------------------------------------------
+
+shortlist=CHSOURCELINK-TARGET,0,title,values,category,bubbles
+shortlist=CHSOURCELINK-TYPE,0,default,constant,sheet-link
+
+flagslist=CHSOURCELINK-FLAGS
+ 0x0001=custom-numfmt
+end
+
+# CHSTRING -------------------------------------------------------------------
+
+shortlist=CHSTRING-TYPE,0,text,category-default,value-default,x-prefix,x-postfix,y-prefix,y-postfix,comment
+
+# CHSURFACE ------------------------------------------------------------------
+
+flagslist=CHSURFACE-FLAGS
+ 0x0001=filled
+ 0x0002=shadow
+end
+
+# CHTEXT ---------------------------------------------------------------------
+
+shortlist=CHTEXT-HORALIGN,1,left,center,right,block,distribute
+shortlist=CHTEXT-VERALIGN,1,top,center,bottom,block,distribute
+shortlist=CHTEXT-FILLMODE,1,transparent,opaque
+
+flagslist=CHTEXT-FLAGS1-BIFF2
+ 0x0001=auto-color
+ 0x0002=show-symbol
+ 0x0004=show-value
+ 0x0008=vertical
+ 0x0010=auto-text
+ 0x0020=default-format
+ 0x0040=deleted
+ 0x0080=auto-fill
+end
+
+combilist=CHTEXT-FLAGS1-BIFF3
+ include=CHTEXT-FLAGS1-BIFF2
+ 0x0700=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=CHTEXT-FLAGS1-BIFF5
+ include=CHTEXT-FLAGS1-BIFF3
+ 0x0800=show-categ-percent
+ 0x1000=show-percent
+end
+
+combilist=CHTEXT-FLAGS1-BIFF8
+ include=CHTEXT-FLAGS1-BIFF5
+ 0x2000=show-bubble-size
+ 0x4000=show-categ
+end
+
+combilist=CHTEXT-FLAGS2
+ ignore=0x3FF0
+ 0x000F=uint8,dec,placement,CHTEXT-PLACEMENT
+ 0xC000=uint8,dec,text-dir,XF-TEXTDIRECTION
+end
+
+shortlist=CHTEXT-PLACEMENT,0,context,outside,inside,center,axis,above,below,left,right,auto,manual
+
+# CHTICK ---------------------------------------------------------------------
+
+shortlist=CHTICK-TYPE,0,none,inside,outside,both
+# TODO: really different label positions in BIFF2-BIFF4?
+shortlist=CHTICK-LABELPOS-BIFF2,0,none,near,below,above
+shortlist=CHTICK-LABELPOS-BIFF5,0,none,below,above,near
+
+flagslist=CHTICK-FLAGS-BIFF2
+ 0x0001=auto-color
+ 0x0002=auto-fill
+end
+
+combilist=CHTICK-FLAGS-BIFF3
+ include=CHTICK-FLAGS-BIFF2
+ 0x001C=uint8,dec,orientation,TEXTORIENTATION
+ 0x0020=auto-rotation
+end
+
+# CHVALUERANGE ---------------------------------------------------------------
+
+flagslist=CHVALUERANGE-FLAGS
+ ignore=0x0100
+ 0x0001=auto-minimum
+ 0x0002=auto-maximum
+ 0x0004=auto-major
+ 0x0008=auto-minor
+ 0x0010=auto-axis-cross
+ 0x0020=logarithmic
+ 0x0040=reverse-order
+ 0x0080=maximum-axis-cross
+end
+
+# COLINFO --------------------------------------------------------------------
+
+combilist=COLINFO-FLAGS
+ 0x0001=hidden
+ 0x0002=custom-width
+ 0x0004=best-fit
+ 0x0008=show-phonetic
+ 0x0700=uint8,dec,outline-level
+ 0x1000=outline-collapsed
+end
+
+# CONNECTION -----------------------------------------------------------------
+
+shortlist=CONNECTION-SOURCETYPE,1,odbc,dao,file,html,ole-db,text,ado,dsp
+
+flagslist=CONNECTION-FLAGS
+ 0x0001=save-password
+ 0x0002=html-tables
+ 0x0004=table-names
+ 0x0008=deleted
+ 0x0010=stand-alone
+ 0x0020=only-use-conn-file
+ 0x0040=background
+ 0x0080=refresh-on-load
+ 0x0100=save-data
+end
+
+shortlist=CONNECTION-RECONNECTTYPE,0,as-required,always,never
+shortlist=CONNECTION-CREDENTIALS,0,integrated,none,stored-sso,prompt
+shortlist=CONNECTION-LINKEDOBJECTTYPE,0,none,query-table,pivot-cache
+
+# DATATABLE ------------------------------------------------------------------
+
+flagslist=DATATABLE-FLAGS-BIFF3
+ 0x0001=recalc-always
+ 0x0002=recalc-on-load
+ 0x0004=row-table
+ 0x0008=table-2d
+end
+
+flagslist=DATATABLE-FLAGS-BIFF8
+ include=DATATABLE-FLAGS-BIFF3
+ 0x0010=ref1-deleted
+ 0x0020=ref2-deleted
+end
+
+# DATAVALIDATION -------------------------------------------------------------
+
+combilist=DATAVALIDATION-FLAGS
+ 0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
+ 0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
+ 0x00000080=string-list
+ 0x00000100=ignore-empty
+ 0x00000200=no-dropdown
+ 0x00040000=show-input-box
+ 0x00080000=show-error-box
+ 0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
+end
+
+shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
+shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
+
+# DATAVALIDATIONS ------------------------------------------------------------
+
+flagslist=DATAVALIDATIONS-FLAGS
+ 0x0001=input-box-visible
+ 0x0002=input-box-at-cell
+ 0x0004=cached
+end
+
+# DATEMODE -------------------------------------------------------------------
+
+shortlist=DATEMODE,0,1899-12-31,1904-01-01
+
+# DBQUERY --------------------------------------------------------------------
+
+combilist=DBQUERY-FLAGS
+ 0x0007=uint8,dec,source-type,CONNECTION-SOURCETYPE
+ 0x0008=odbc-connection
+ 0x0010=sql-query
+ 0x0020=server-sql
+ 0x0040=html-query
+ 0x0080=save-password
+ 0x0100=html-tables
+end
+
+# DEFINEDNAME ----------------------------------------------------------------
+
+flagslist=DEFINEDNAME-FLAGS-BIFF2
+ 0x02=macro
+ 0x04=complex
+end
+
+shortlist=DEFINEDNAME-MACROTYPE-BIFF2,0,none,function,procedure
+
+flagslist=DEFINEDNAME-FLAGS-BIFF3
+ 0x0001=hidden
+ 0x0002=function
+ 0x0004=command
+ 0x0008=macro
+ 0x0010=complex
+ 0x0020=builtin
+end
+
+shortlist=DEFINEDNAME-BUILTINID,0,consolidate-area,auto-open,auto-close,extract,database,criteria,print-area,print-titles,recorder,data-form,auto-activate,auto-deactivate,sheet-title,filterdatabase
+
+combilist=DEFINEDNAME-FLAGS-BIFF4
+ include=DEFINEDNAME-FLAGS-BIFF3
+ 0x0FC0=uint16,dec,func-group,DEFINEDNAME-FUNCGROUP
+end
+
+combilist=DEFINEDNAME-FLAGS-BIFF5
+ include=DEFINEDNAME-FLAGS-BIFF4
+ 0x0004=vba
+ 0x1000=binary
+end
+
+shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
+
+constlist=DEFINEDNAME-SHEETIDX
+ default=
+ 0=global
+end
+
+# DEFROWHEIGHT ---------------------------------------------------------------
+
+combilist=DEFROWHEIGHT-FLAGS-BIFF2
+ 0x7FFF=uint16,dec,row-height,CONV-TWIP-TO-PT
+ 0x8000=unchanged
+end
+
+flagslist=DEFROWHEIGHT-FLAGS-BIFF3
+ 0x0001=custom-height
+ 0x0002=hidden
+ 0x0004=thick-top
+ 0x0008=thick-bottom
+end
+
+# DXF ------------------------------------------------------------------------
+
+flagslist=DXF-FLAGS
+ 0x0001=!swap-fg-bg-color
+ 0x0002=use-internal-borders
+end
+
+multilist=DXF-SUBREC
+ 0=FILL-PATTERN,FILL-FGCOLOR,FILL-BGCOLOR,FILL-GRADIENT,FILL-STOP
+ 5=FONT-COLOR,BORDER-TOP,BORDER-BOTTOM,BORDER-LEFT,BORDER-RIGHT
+ 10=BORDER-DIAGONAL,BORDER-VERTICAL,BORDER-HORIZONTAL,BORDER-DIAGUP,BORDER-DIAGDOWN
+ 15=ALIGN-HORIZONTAL,ALIGN-VERTICAL,ALIGN-ROTATION,ALIGN-INDENT,ALIGN-READINGORDER
+ 20=ALIGN-WRAPTEXT,ALIGN-JUSTLASTLINE,ALIGN-SHRINKTOFIT,ALIGN-MERGED,FONT-NAME
+ 25=FONT-WEIGHT,FONT-UNDERLINE,FONT-ESCAPEMENT,FONT-ITALIC,FONT-STRIKE
+ 30=FONT-OUTLINE,FONT-SHADOW,FONT-CONDENSE,FONT-EXTEND,FONT-CHARSET
+ 35=FONT-PITCHFAMILY,FONT-HEIGHT,FONT-SCHEME,NUMFMT-CODE,
+ 40=,NUMFMT-ID,ALIGN-RELINDENT,PROT-LOCKED,PROT-HIDDEN
+end
+
+# EXTERNALBOOK ---------------------------------------------------------------
+
+constlist=EXTERNALBOOK-KEY
+ 0x0401=self-reference
+ 0x3A01=analysis-addin
+end
+
+# EXTERNALNAME ---------------------------------------------------------------
+
+flagslist=EXTERNALNAME-FLAGS-BIFF3
+ 0x0001=builtin
+ 0x0002=automatic
+ 0x0004=pic-link
+ 0x0008=dde-stddocumentname
+end
+
+combilist=EXTERNALNAME-FLAGS-BIFF5
+ include=EXTERNALNAME-FLAGS-BIFF3
+ 0x0010=ole-link
+ 0x7FE0=uint16,dec,clipboard-format
+ 0x8000=iconified
+end
+
+# EXTERNSHEET ----------------------------------------------------------------
+
+constlist=EXTERNSHEET-IDX-BIFF8
+ default=
+ -1=deleted
+ -2=special
+end
+
+# FILEPASS -------------------------------------------------------------------
+
+shortlist=FILEPASS-TYPE,0,xor,rc4
+shortlist=FILEPASS-MAJOR,1,rc4,crypto-api-2003,crypto-api-2007
+
+# FILTERCOLUMN ---------------------------------------------------------------
+
+combilist=FILTERCOLUMN-FLAGS
+ 0x0001=!and!or
+ 0x0004=op-1-simple
+ 0x0008=op-2-simple
+ 0x0010=top-10
+ 0x0020=!bottom!top
+ 0x0040=percent
+ 0xFF80=uint16,dec,top-10-count
+end
+
+constlist=FILTERCOLUMN-DATATYPE
+ 0=none
+ 2=rk
+ 4=double
+ 6=string
+ 8=boolean
+ 12=blank
+ 14=not-blank
+end
+
+shortlist=FILTERCOLUMN-OPERATOR,0,none,less,equal,less-equal,greater,not-equal,greater-equal
+
+# FONT -----------------------------------------------------------------------
+
+flagslist=FONT-FLAGS
+ 0x0001=bold
+ 0x0002=italic
+ 0x0004=underline
+ 0x0008=strikeout
+ 0x0010=outline
+ 0x0020=shadow
+ 0x0040=condense
+ 0x0080=extend
+end
+
+multilist=FONT-UNDERLINE
+ 0x00=none,single,double
+ 0x21=single-acc,double-acc
+end
+
+shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
+
+# FORMULA --------------------------------------------------------------------
+
+flagslist=FORMULA-FLAGS-BIFF2
+ 0x0001=recalc-always
+end
+
+flagslist=FORMULA-FLAGS-BIFF3
+ include=FORMULA-FLAGS-BIFF2
+ 0x0002=recalc-onload
+end
+
+flagslist=FORMULA-FLAGS-BIFF5
+ include=FORMULA-FLAGS-BIFF3
+ 0x0008=shared-fmla
+end
+
+shortlist=FORMULA-RESULTTYPE,0,string,boolean,error,empty
+
+# GUTS -----------------------------------------------------------------------
+
+shortlist=GUTS-LEVELS,0,none,,1-level,2-levels,3-levels,4-levels,5-levels,6-levels,7-levels
+
+# HEADERFOOTER ---------------------------------------------------------------
+
+flagslist=HEADERFOOTER-FLAGS
+ ignore=0xFFF0
+ 0x0001=has-even-hf
+ 0x0002=has-first-hf
+ 0x0004=scale-with-sheet
+ 0x0008=align-with-margins
+end
+
+# HIDEOBJ --------------------------------------------------------------------
+
+shortlist=HIDEOBJ,0,show,placeholder,hide
+
+# IMGDATA --------------------------------------------------------------------
+
+constlist=IMGDATA-FORMAT
+ -1=none
+ 2=wmf-pict
+ 9=dib
+ 14=native
+end
+
+shortlist=IMGDATA-ENV,1,windows,apple
+
+# NOTE -----------------------------------------------------------------------
+
+flagslist=NOTE-FLAGS-BIFF8
+ 0x0002=visible
+end
+
+# OBJ ------------------------------------------------------------------------
+
+# object types ---
+
+multilist=OBJ-TYPE-BIFF3
+ 0=group,line,rectangle,oval,arc,chart,textbox,button,picture
+end
+
+multilist=OBJ-TYPE-BIFF4
+ include=OBJ-TYPE-BIFF3
+ 9=polygon
+end
+
+multilist=OBJ-TYPE-BIFF5
+ include=OBJ-TYPE-BIFF4
+ 10=,checkbox,optionbutton,edit,label,dialog,spin,scrollbar,listbox,groupbox
+ 20=dropdown
+end
+
+multilist=OBJ-TYPE-BIFF8
+ include=OBJ-TYPE-BIFF5
+ 25=note
+ 30=drawing
+end
+
+# flags and constants ---
+
+flagslist=OBJ-FLAGS-BIFF3
+ 0x0001=selected
+ 0x0002=auto-size
+ 0x0004=auto-move
+ 0x0010=protected
+ 0x0080=grouped
+ 0x0100=hidden
+ 0x0200=visible
+end
+
+flagslist=OBJ-FLAGS-BIFF4
+ include=OBJ-FLAGS-BIFF3
+ 0x0400=printable
+end
+
+flagslist=OBJ-AUTO-FLAGS
+ 0x01=auto
+end
+
+multilist=OBJ-LINETYPE
+ 0=solid,dash,dot,dash-dot,dash-dot-dot,25%-pattern,50%-pattern,75%-pattern
+ 255=none
+end
+
+shortlist=OBJ-LINEWEIGHT,0,hair,thin,medium,thick
+
+shortlist=OBJ-ARROWHEAD-TYPE,0,none,open,filled,double-end-open,double-end-filled
+shortlist=OBJ-ARROWHEAD-WIDTH,0,narrow,medium,wide
+shortlist=OBJ-ARROWHEAD-LENGTH,0,short,medium,long
+
+combilist=OBJ-LINEENDS
+ 0x000F=uint8,dec,arrowhead-type,OBJ-ARROWHEAD-TYPE
+ 0x00F0=uint8,dec,arrowhead-width,OBJ-ARROWHEAD-WIDTH
+ 0x0F00=uint8,dec,arrowhead-length,OBJ-ARROWHEAD-LENGTH
+end
+
+shortlist=OBJ-LINEDIR,0,topleft-to-bottomright,topright-to-bottomleft,bottomright-to-topleft,bottomleft-to-topright
+
+shortlist=OBJ-ARC-QUADRANT,0,upper-right,upper-left,lower-left,lower-right
+
+combilist=OBJ-FRAMESTYLE-FLAGS
+ 0x0001=rounded
+ 0x0002=shadow
+ 0x03FC=uint16,dec,rounded-diameter
+end
+
+shortlist=OBJ-HORALIGN,0,none,left,center,right,justify
+shortlist=OBJ-VERALIGN,0,none,top,center,bottom,justify
+
+combilist=OBJ-TEXT-FLAGS
+ 0x000E=uint16,dec,hor-align,OBJ-HORALIGN
+ 0x0070=uint16,dec,ver-align,OBJ-VERALIGN
+ 0x0080=auto-size
+ 0x0200=text-locked
+ 0x0400=selected
+end
+
+flagslist=OBJ-PICTURE-FLAGS
+ 0x0001=auto-size
+ 0x0002=linked
+ 0x0008=symbol
+end
+
+flagslist=OBJ-POLYGON-FLAGS
+ 0x0100=closed
+end
+
+flagslist=OBJ-CHART-FLAGS-BIFF5
+ 0x0001=linked-to-sheet
+end
+
+flagslist=OBJ-BUTTON-FLAGS-BIFF5
+ 0x0001=default-btn
+ 0x0002=help-btn
+ 0x0004=cancel-btn
+ 0x0008=close-btn
+end
+
+shortlist=OBJ-CHECKBOX-STATE-BIFF5,0,unchecked,checked,tristate
+
+flagslist=OBJ-CHECKBOX-FLAGS-BIFF5
+ 0x0001=flat
+ 0x0002=box-only
+end
+
+shortlist=OBJ-EDIT-TYPE-BIFF5,0,text,integer,double,reference,formula
+
+flagslist=OBJ-SCROLLBAR-FLAGS-BIFF5
+ 0x0001=visible
+ 0x0002=slider-only
+ 0x0004=tracking
+ 0x0008=flat
+end
+
+combilist=OBJ-LISTBOX-FLAGS-BIFF5
+ 0x0004=linked-edit
+ 0x0008=flat
+ 0x0030=uint8,dec,selection-type,OBJ-LISTBOX-SELTYPE-BIFF5
+end
+
+shortlist=OBJ-LISTBOX-SELTYPE-BIFF5,0,single,multi,range
+
+flagslist=OBJ-GROUPBOX-FLAGS-BIFF5
+ 0x0001=flat
+end
+
+combilist=OBJ-DROPDOWN-FLAGS-BIFF5
+ 0x0003=uint8,dec,type,OBJ-DROPDOWN-TYPE-BIFF5
+ 0x0008=filtered
+end
+
+shortlist=OBJ-DROPDOWN-TYPE-BIFF5,0,listbox,combobox,simple,max
+
+multilist=OBJ-RECNAMES-BIFF8
+ 0x0000=OBJEND,,,,OBJMACRO,,OBJGMO,OBJCF
+ 0x0008=OBJFLAGS,OBJPICTFMLA,OBJCBLS,OBJRBO,OBJSBS,OBJNTS,OBJSBSFMLA,OBJGBODATA
+ 0x0010=OBJEDODATA,OBJRBODATA,OBJCBLSDATA,OBJLBSDATA,OBJCBLSFMLA,OBJCMO,,
+end
+
+flagslist=OBJFLAGS-FLAGS
+ 0x0001=manual-size
+ 0x0002=linked
+ 0x0004=update-on-print
+ 0x0008=symbol
+ 0x0010=control
+ 0x0020=ctls-stream
+ 0x0080=camera-pic
+ 0x0100=default-size
+ 0x0200=auto-load
+end
+
+flagslist=OBJCMO-FLAGS
+ 0x0001=locked
+ 0x0004=default-size
+ 0x0008=published
+ 0x0010=printable
+ 0x0080=disabled
+ 0x0100=auxiliary
+ 0x0200=recalc-on-load
+ 0x1000=recalc-always
+ 0x2000=auto-line
+ 0x4000=auto-area
+end
+
+# PAGELAYOUTVIEW -------------------------------------------------------------
+
+flagslist=PAGELAYOUTVIEW-FLAGS
+ ignore=0xFFF8
+ 0x0001=page-layout-view
+ 0x0002=show-ruler
+ 0x0004=hide-margins
+end
+
+# PAGESETUP ------------------------------------------------------------------
+
+multilist=PAGESETUP-PAPERSIZE
+ 0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
+ 10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
+ 20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
+ 30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
+ 40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
+ 50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
+ 60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
+end
+
+constlist=PAGESETUP-SCALETOPAGES
+ default=
+ 0=automatic
+end
+
+flagslist=PAGESETUP-FLAGS-BIFF4
+ 0x0001=print-in-rows
+ 0x0002=portrait
+ 0x0004=uninitialized
+ 0x0008=black-and-white
+end
+
+flagslist=PAGESETUP-FLAGS-BIFF5
+ include=PAGESETUP-FLAGS-BIFF4
+ 0x0010=draft-quality
+ 0x0020=print-notes
+ 0x0040=default-orientation
+ 0x0080=use-first-page
+end
+
+combilist=PAGESETUP-FLAGS-BIFF8
+ include=PAGESETUP-FLAGS-BIFF5
+ 0x0200=print-notes-at-end
+ 0x0C00=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
+end
+
+shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
+
+unitconverter=PAGESETUP-DPI,1,dpi
+
+# PANE -----------------------------------------------------------------------
+
+shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
+
+# PCDEFINITION ---------------------------------------------------------------
+
+flagslist=PCDEFINITION-FLAGS
+ 0x0001=save-data
+ 0x0002=invalid
+ 0x0004=refresh-on-load
+ 0x0008=optimize-memory
+ 0x0010=background-query
+ 0x0020=enable-refresh
+end
+
+# PCDFIELD -------------------------------------------------------------------
+
+flagslist=PCDFIELD-FLAGS
+ 0x0001=has-items
+ 0x0002=has-unshared-items
+ 0x0004=calculated
+ 0x0008=has-parent
+ 0x0010=range-group
+ 0x0020=is-numeric
+ 0x0040=is-integer
+ 0x0080=has-semi-mixed-types
+ 0x0100=has-min-max
+ 0x0200=16bit-indexes
+ 0x0400=has-non-date
+ 0x0800=has-date
+end
+
+# PCDFRANGEPR ----------------------------------------------------------------
+
+combilist=PCDFRANGEPR-FLAGS
+ ignore=0xFFE0
+ 0x0001=auto-start
+ 0x0002=auto-end
+ 0x001C=uint8,dec,group-by,PCDFRANGEPR-GROUPBY
+end
+
+shortlist=PCDFRANGEPR-GROUPBY,0,numeric,seconds,minutes,hours,days,months,quarters,years
+
+# PCDFSQLTYPE ----------------------------------------------------------------
+
+shortlist=PCDFSQLTYPE-DATATYPE,0,unknown,char,numeric,decimal,int32,int16,float,real,double,,,datetime,var-char
+
+# PCDSOURCE ------------------------------------------------------------------
+
+flagslist=PCDSOURCE-TYPE
+ 0x0001=spreadsheet
+ 0x0002=extern
+ 0x0004=consolidation-area
+ 0x0010=scenario
+end
+
+# PHONETICPR -----------------------------------------------------------------
+
+shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
+shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
+
+combilist=PHONETICPR-FLAGS
+ ignore=0xFFF0
+ 0x0003=uint8,dec,type,PHONETICPR-TYPE
+ 0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
+end
+
+# PROJEXTSHEET ---------------------------------------------------------------
+
+shortlist=PROJEXTSHEET-TYPE,0,sheet,macro,chart
+
+# PTDATAFIELD ----------------------------------------------------------------
+
+shortlist=PTDATAFIELD-SUBTOTAL,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p
+shortlist=PTDATAFIELD-SHOWDATAAS,0,normal,diff-from,percent-of,percent-diff-from,running-total-in,percent-of-row,percent-of-column,percent-of-total,index
+
+multilist=PTDATAFIELD-BASEITEM
+ default=
+ 0x7FFB=previous-item,next-item
+end
+
+# PTDEFINITION ---------------------------------------------------------------
+
+flagslist=PTDEFINITION-FLAGS
+ 0x0001=row-grandtotals
+ 0x0002=column-grandtotals
+ 0x0008=auto-format
+ 0x0010=size-auto-format
+ 0x0020=font-auto-format
+ 0x0040=align-auto-format
+ 0x0080=border-auto-format
+ 0x0100=pattern-auto-format
+ 0x0200=number-auto-format
+end
+
+constlist=PTDEFINITION-DATAFIELD-POS
+ default=
+ -1=append
+end
+
+# PTDEFINITION2 --------------------------------------------------------------
+
+combilist=PTDEFINITION2-FLAGS
+ 0x00000001=page-over-then-down
+ 0x000001FE=dec,uint8,page-wrap
+ 0x00010000=enable-wizard
+ 0x00020000=enable-drill
+ 0x00040000=enable-field-props
+ 0x00080000=preserve-formatting
+ 0x00100000=merge-labels
+ 0x00200000=show-error
+ 0x00400000=show-missing
+ 0x00800000=multiple-page-items
+end
+
+# PTFIELD --------------------------------------------------------------------
+
+flagslist=PTFIELD-AXISTYPE
+ 0x0001=row
+ 0x0002=column
+ 0x0004=page
+ 0x0008=data
+end
+
+flagslist=PTFIELD-SUBTOTALS
+ 0x0001=default
+ 0x0002=sum
+ 0x0004=count-all
+ 0x0008=average
+ 0x0010=max
+ 0x0020=min
+ 0x0040=product
+ 0x0080=count-num
+ 0x0100=std-dev
+ 0x0200=std-dev-p
+ 0x0400=variance
+ 0x0800=variance-p
+end
+
+# PTFIELD2 -------------------------------------------------------------------
+
+combilist=PTFIELD2-FLAGS
+ 0x00000001=show-all-items
+ 0x00000002=drag-to-row
+ 0x00000004=drag-to-column
+ 0x00000008=drag-to-page
+ 0x00000010=drag-to-hide
+ 0x00000080=server-based
+ 0x00000200=autosort
+ 0x00000400=ascend-sort
+ 0x00000800=autoshow
+ 0x00001000=autoshow-top
+ 0x00002000=calculated
+ 0x00200000=outline
+ 0x00400000=insert-blank-row
+ 0x00800000=subtotal-top
+ 0xFF000000=uint8,dec,autoshow-item-count
+end
+
+# PTFITEM --------------------------------------------------------------------
+
+multilist=PTFITEM-ITEMTYPE
+ 0=data,default,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal
+ 254=page,none
+end
+
+flagslist=PTFITEM-FLAGS
+ 0x0001=hidden
+ 0x0002=hide-detail
+ 0x0008=calculated
+ 0x0010=missing
+end
+
+constlist=PTFITEM-CACHEIDX
+ default=
+ -1=no-cache-item
+end
+
+# PTPAGEFIELDS ---------------------------------------------------------------
+
+constlist=PTPAGEFIELDS-ITEM
+ default=
+ 0x7FFD=all
+end
+
+# PTROWCOLITEMS --------------------------------------------------------------
+
+shortlist=PTROWCOLITEMS-ITEMTYPE,0,data,default,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal,blank-line
+
+combilist=PTROWCOLITEMS-FLAGS
+ ignore=0xC000
+ 0x0001=field-name
+ 0x01FE=uint16,dec,data-field-idx
+ 0x0200=subtotal
+ 0x0400=blocktotal
+ 0x0800=grandtotal
+ 0x1000=multi-data
+end
+
+# QUERYTABLE -----------------------------------------------------------------
+
+combilist=QUERYTABLE-FLAGS
+ 0x0001=headers
+ 0x0002=row-numbers
+ 0x0004=disable-refresh
+ 0x0008=background
+ 0x0010=first-background
+ 0x0020=refresh-on-load
+ 0x0040=delete-unused
+ 0x0080=fill-formulas
+ 0x0100=adjust-column-width
+ 0x0200=save-data
+ 0x0400=disable-edit
+ 0x2000=overwrite-existing
+end
+
+combilist=QUERYTABLE-AUTOFORMAT-FLAGS
+ 0x0001=apply-num-fmt
+ 0x0002=apply-font
+ 0x0004=apply-alignment
+ 0x0008=apply-border
+ 0x0010=apply-fill
+ 0x0020=apply-protection
+end
+
+# QUERYTABLEREFRESH ----------------------------------------------------------
+
+flagslist=QUERYTABLEREFRESH-FLAGS
+ 0x0001=enable-refresh
+ 0x0002=pivot-cache-invalid
+ 0x0004=olap-pivot-table
+end
+
+flagslist=QUERYTABLEREFRESH-PTFLAGS
+ 0x00000001=disable-draw-drop
+ 0x00000002=hide-totals-annotation
+ 0x00000008=include-empty-rows
+ 0x00000010=include-empty-columns
+end
+
+flagslist=QUERYTABLEREFRESH-QTFLAGS
+ 0x00000001=preserve-formatting
+ 0x00000002=adjust-column-width
+ 0x00000010=ext-data-list
+ 0x00000040=create-table-list
+ 0x00000080=create-dummy-list
+end
+
+# QUERYTABLESETTINGS ---------------------------------------------------------
+
+flagslist=QUERYTABLESETTINGS-FLAGS
+ 0x0001=keep-alive
+ 0x0002=new
+ 0x0004=source-data
+ 0x0008=web-based-prov
+ 0x0010=reinit-list
+ 0x0080=xml
+end
+
+flagslist=QUERYTABLESETTINGS-HTML-FLAGS
+ 0x0001=parse-pre
+ 0x0002=consecutive-delimiters
+ 0x0004=first-row
+ 0x0008=xl97-created
+ 0x0010=text-dates
+ 0x0020=xl2000-refreshed
+end
+
+combilist=QUERYTABLESETTINGS-OLEDB-FLAGS
+ 0x0007=uint8,dec,command-type,QUERYTABLESETTINGS-OLEDB-COMMANDTYPE
+ 0x0008=alt-connection-string
+ 0x0010=no-refresh-cube
+ 0x0020=olap-has-locale
+ 0x0040=server-num-fmt
+ 0x0080=server-fill-color
+ 0x0100=server-font-color
+ 0x0200=server-font-format
+ 0x0400=olap-member-l10n
+end
+
+shortlist=QUERYTABLESETTINGS-OLEDB-COMMANDTYPE,0,none,cube,sql,table,default,list
+
+flagslist=QUERYTABLESETTINGS-ADO-FLAGS
+ 0x0100=ado-refreshable
+end
+
+flagslist=QUERYTABLESETTINGS-EXT-FLAGS
+ 0x0001=text-query
+ 0x0002=table-names
+end
+
+unitconverter=QUERYTABLESETTINGS-INTERVAL,60,sec
+shortlist=QUERYTABLESETTINGS-HTMLFORMAT,1,none,rtf,all
+
+# REFMODE --------------------------------------------------------------------
+
+shortlist=REFMODE,0,R1C1,A1
+
+# ROW ------------------------------------------------------------------------
+
+combilist=ROW-HEIGHT
+ 0x7FFF=uint16,dec,height,CONV-TWIP-TO-PT
+ 0x8000=default-height
+end
+
+combilist=ROW-FLAGS
+ ignore=0x00000100
+ 0x00000007=uint8,dec,outline-level
+ 0x00000010=outline-collapsed
+ 0x00000020=hidden
+ 0x00000040=custom-height
+ 0x00000080=custom-format
+ 0x0FFF0000=uint16,dec,custom-xf-idx
+ 0x10000000=thick-top
+ 0x20000000=thick-bottom
+ 0x40000000=show-phonetic
+end
+
+# SHAREDFEATHEAD -------------------------------------------------------------
+
+shortlist=SHAREDFEATHEAD-TYPE,2,protection,ignored-formula-errors,smarttag,table
+
+flagslist=SHAREDFEATHEAD-PROT-FLAGS
+ 0x00000001=edit-object
+ 0x00000002=edit-scenario
+ 0x00000004=format-cell
+ 0x00000008=format-column
+ 0x00000010=format-row
+ 0x00000020=insert-column
+ 0x00000040=insert-row
+ 0x00000080=insert-hyperlink
+ 0x00000100=delete-column
+ 0x00000200=delete-row
+ 0x00000400=select-locked
+ 0x00000800=sort
+ 0x00001000=use-autofilter
+ 0x00002000=pivottable-report
+ 0x00004000=select-unlocked
+end
+
+# SHEET ----------------------------------------------------------------------
+
+shortlist=SHEET-STATE,0,visible,hidden,very-hidden
+shortlist=SHEET-TYPE,0,worksheet,macrosheet,chartsheet,,,,vb-module
+
+# SHEETEXT -------------------------------------------------------------------
+
+combilist=SHEETEXT-FLAGS1
+ 0x0000007F=uint8,dec,color-idx,SHEETEXT-COLOR
+end
+
+constlist=SHEETEXT-COLOR
+ include=COLORS
+ 0x7F=undefined
+end
+
+combilist=SHEETEXT-FLAGS2
+ include=SHEETEXT-FLAGS1
+ 0x00000080=eval-cond-formats
+ 0x00000100=!published!unpublished
+end
+
+# SHEETPR --------------------------------------------------------------------
+
+shortlist=SHEETPR-WINDOWPOS,0,tiled,horizontal,vertical,cascaded
+
+flagslist=SHEETPR-FLAGS-BIFF3
+ 0x0001=show-autopagebreaks
+ 0x0020=outline-auto-style
+ 0x0040=outline-symbols-below
+ 0x0080=outline-symbols-right
+ 0x0100=fit-to-pages
+ 0x0200=skip-linked-values
+ 0x0400=show-row-outline
+ 0x0800=show-column-outline
+end
+
+flagslist=SHEETPR-FLAGS-BIFF4
+ include=SHEETPR-FLAGS-BIFF3
+ 0x3000=uint8,dec,window-pos,SHEETPR-WINDOWPOS
+ 0x4000=lotus-expr-eval
+ 0x8000=lotus-formula-edit
+end
+
+flagslist=SHEETPR-FLAGS-BIFF5
+ include=SHEETPR-FLAGS-BIFF4
+ exclude=0x0200,0x3000
+ 0x0010=dialog-sheet
+end
+
+# STYLE ----------------------------------------------------------------------
+
+combilist=STYLE-FLAGS
+ 0x0FFF=uint16,dec,xf-idx
+ 0x8000=builtin
+end
+
+shortlist=STYLE-BUILTIN,-1,user-defined,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
+
+# STYLEEXT -------------------------------------------------------------------
+
+flagslist=STYLEEXT-FLAGS
+ 0x01=builtin
+ 0x02=hidden
+ 0x04=custom
+end
+
+shortlist=STYLEEXT-CATEGORY,0,custom,good-bad-neutral,data-model,title-heading,themed,number-format
+
+multilist=STYLEEXT-BUILTIN
+ include=STYLE-BUILTIN
+ 10=note,warning-text,,,,title,heading-1,heading-2,heading-3,heading-4
+ 20=input,output,calculation,check-cell,linked-cell,total,good,bad,neutral,accent1
+ 30=20%-accent1,40%-accent1,60%-accent1,accent2,20%-accent2,40%-accent2,60%-accent2,accent3,20%-accent3,40%-accent3
+ 40=60%-accent3,accent4,20%-accent4,40%-accent4,60%-accent4,accent5,20%-accent5,40%-accent5,60%-accent5,accent6
+ 50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
+end
+
+# THEME ----------------------------------------------------------------------
+
+constlist=THEME-VERSION
+ 0=custom
+ 123820=default
+ 124226=default
+end
+
+# TXO ------------------------------------------------------------------------
+
+combilist=TXO-FLAGS
+ 0x000E=uint16,dec,hor-align,OBJ-HORALIGN
+ 0x0070=uint16,dec,ver-align,OBJ-VERALIGN
+ 0x0200=text-locked
+end
+
+# WINDOW1 --------------------------------------------------------------------
+
+flagslist=WINDOW1-FLAGS
+ 0x0001=hidden
+ 0x0002=minimized
+ 0x0008=show-horizontal-scroll
+ 0x0010=show-vertical-scroll
+ 0x0020=show-tabbar
+end
+
+unitconverter=WINDOW1-TABBARRATIO,/10,%
+
+# WINDOW2 --------------------------------------------------------------------
+
+flagslist=WINDOW2-FLAGS-BIFF3
+ 0x0001=show-formulas
+ 0x0002=show-gridlines
+ 0x0004=show-headings
+ 0x0008=frozen-panes
+ 0x0010=show-zeros
+ 0x0020=default-gridcolor
+ 0x0040=right-to-left
+ 0x0080=show-outline-symbols
+ 0x0100=remove-split-with-freeze
+end
+
+flagslist=WINDOW2-FLAGS-BIFF5
+ include=WINDOW2-FLAGS-BIFF3
+ 0x0200=sheet-selected
+ 0x0400=sheet-active
+end
+
+flagslist=WINDOW2-FLAGS-BIFF8
+ include=WINDOW2-FLAGS-BIFF5
+ 0x0800=pagebreak-mode
+end
+
+# XF -------------------------------------------------------------------------
+
+shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
+shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
+shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
+
+flagslist=XF-PROTECTION-FLAGS
+ 0x01=locked
+ 0x02=formula-hidden
+ 0x04=style-xf
+ 0x08=apostroph-quote
+end
+
+flagslist=XF-USEDATTRIBS-FLAGS
+ 0x04=format
+ 0x08=font
+ 0x10=alignment
+ 0x20=border
+ 0x40=area
+ 0x80=protection
+end
+
+combilist=XF-STYLEFLAGS-BIFF2
+ 0x07=uint8,dec,hor-align,XF-HORALIGN
+ 0x08=left-border
+ 0x10=right-border
+ 0x20=top-border
+ 0x40=bottom-border
+ 0x80=fill
+end
+
+combilist=XF-TYPEFLAGS-BIFF2
+ 0x3F=uint8,dec,fmt-idx,FORMATS
+ 0x40=locked
+ 0x80=formula-hidden
+end
+
+flagslist=XF-TYPEFLAGS-BIFF3
+ include=XF-PROTECTION-FLAGS
+end
+
+combilist=XF-TYPEFLAGS-BIFF4
+ include=XF-TYPEFLAGS-BIFF3
+ 0xFFF0=uint16,dec,parent-xf-idx
+end
+
+combilist=XF-ALIGNMENT-BIFF3
+ 0x0007=uint8,dec,hor-align,XF-HORALIGN
+ 0x0008=text-wrap
+ 0xFFF0=uint16,dec,parent-xf-idx
+end
+
+combilist=XF-ALIGNMENT-BIFF4
+ 0x07=uint8,dec,hor-align,XF-HORALIGN
+ 0x08=text-wrap
+ 0x30=uint8,dec,ver-align,XF-VERALIGN
+ 0xC0=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=XF-ALIGNMENT-BIFF5
+ 0x07=uint8,dec,hor-align,XF-HORALIGN
+ 0x08=text-wrap
+ 0x70=uint8,dec,ver-align,XF-VERALIGN
+ 0x80=justify-lastline
+end
+
+combilist=XF-ORIENTATTRIBS-BIFF5
+ include=XF-USEDATTRIBS-FLAGS
+ 0x03=uint8,dec,orientation,TEXTORIENTATION
+end
+
+combilist=XF-TEXTFLAGS-BIFF8
+ 0x0F=uint8,dec,indent
+ 0x10=shrink-to-fit
+ 0xC0=uint8,dec,text-dir,XF-TEXTDIRECTION
+end
+
+combilist=XF-FILL-BIFF3
+ 0x003F=uint8,dec,fill-pattern,FILLPATTERNS
+ 0x07C0=uint8,dec,fg-color-idx,COLORS
+ 0xF800=uint8,dec,bg-color-idx,COLORS
+end
+
+combilist=XF-BORDER-BIFF3
+ 0x00000007=uint8,dec,top-style,BORDERSTYLES
+ 0x000000F8=uint8,dec,top-color,COLORS
+ 0x00000700=uint8,dec,left-style,BORDERSTYLES
+ 0x0000F800=uint8,dec,left-color,COLORS
+ 0x00070000=uint8,dec,bottom-style,BORDERSTYLES
+ 0x00F80000=uint8,dec,bottom-color,COLORS
+ 0x07000000=uint8,dec,right-style,BORDERSTYLES
+ 0xF8000000=uint8,dec,right-color,COLORS
+end
+
+combilist=XF-FILL-BIFF5
+ 0x0000007F=uint8,dec,fg-color-idx,COLORS
+ 0x00003F80=uint8,dec,bg-color-idx,COLORS
+ 0x003F0000=uint8,dec,fill-pattern,FILLPATTERNS
+ 0x01C00000=uint8,dec,bottom-style,BORDERSTYLES
+ 0xFE000000=uint8,dec,bottom-color,COLORS
+end
+
+combilist=XF-BORDER-BIFF5
+ 0x00000007=uint8,dec,top-style,BORDERSTYLES
+ 0x00000038=uint8,dec,left-style,BORDERSTYLES
+ 0x000001C0=uint8,dec,right-style,BORDERSTYLES
+ 0x0000FE00=uint8,dec,top-color,COLORS
+ 0x007F0000=uint8,dec,left-color,COLORS
+ 0x3F800000=uint8,dec,right-color,COLORS
+end
+
+combilist=XF-BORDERSTYLE-BIFF8
+ 0x000F=uint8,dec,left-style,BORDERSTYLES
+ 0x00F0=uint8,dec,right-style,BORDERSTYLES
+ 0x0F00=uint8,dec,top-style,BORDERSTYLES
+ 0xF000=uint8,dec,bottom-style,BORDERSTYLES
+end
+
+combilist=XF-BORDERCOLOR1-BIFF8
+ 0x007F=uint8,dec,left-color,COLORS
+ 0x3F80=uint8,dec,right-color,COLORS
+ 0x4000=diag-tl-to-br
+ 0x8000=diag-bl-to-tr
+end
+
+combilist=XF-BORDERCOLOR2-BIFF8
+ 0x0000007F=uint8,dec,top-color,COLORS
+ 0x00003F80=uint8,dec,bottom-color,COLORS
+ 0x001FC000=uint8,dec,diag-color,COLORS
+ 0x01E00000=uint8,dec,diag-style,BORDERSTYLES
+ 0xFC000000=uint8,dec,fill-pattern,FILLPATTERNS
+end
+
+combilist=XF-FILLCOLOR-BIFF8
+ 0x007F=uint8,dec,fg-color-idx,COLORS
+ 0x3F80=uint8,dec,bg-color-idx,COLORS
+end
+
+# BIFF2 XF index field -------------------------------------------------------
+
+constlist=XFINDEX-BIFF2
+ default=
+ 63=from-ixfe
+end
+
+combilist=CELL-XFINDEX-BIFF2
+ 0x3F=uint8,dec,xf-idx,XFINDEX-BIFF2
+ 0x40=locked
+ 0x80=formula-hidden
+end
+
+combilist=CELL-XFFORMAT-BIFF2
+ 0x3F=uint8,dec,fmt-idx,FORMATS
+ 0xC0=uint8,dec,font-idx,FONTNAMES
+end
+
+combilist=CELL-XFSTYLE-BIFF2
+ include=XF-STYLEFLAGS-BIFF2
+end
+
+# XFEXT ----------------------------------------------------------------------
+
+multilist=XFEXT-SUBREC
+ 0=,,,,FILL-FGCOLOR
+ 5=FILL-BGCOLOR,FILL-GRADIENT,BORDER-TOP-COLOR,BORDER-BOTTOM-COLOR,BORDER-LEFT-COLOR
+ 10=BORDER-RIGHT-COLOR,BORDER-DIAG-COLOR,,TEXT-COLOR,FONT-SCHEME
+ 15=INDENT
+end
+
+# ============================================================================
diff --git a/oox/source/dump/dffdumper.cxx b/oox/source/dump/dffdumper.cxx
new file mode 100644
index 000000000000..01994865c69d
--- /dev/null
+++ b/oox/source/dump/dffdumper.cxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/dffdumper.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt16 DFF_ID_BSE = 0xF007; /// BLIP store entry.
+const sal_uInt16 DFF_ID_BSTORECONTAINER = 0xF001; /// BLIP store container.
+const sal_uInt16 DFF_ID_CHILDANCHOR = 0xF00F; /// Child anchor (in groups).
+const sal_uInt16 DFF_ID_CLIENTANCHOR = 0xF010; /// Client anchor.
+const sal_uInt16 DFF_ID_DG = 0xF008; /// Drawing.
+const sal_uInt16 DFF_ID_DGG = 0xF006; /// Drawing group.
+const sal_uInt16 DFF_ID_OPT = 0xF00B; /// Property set.
+const sal_uInt16 DFF_ID_OPT2 = 0xF121; /// Secondary property set.
+const sal_uInt16 DFF_ID_OPT3 = 0xF122; /// Ternary property set.
+const sal_uInt16 DFF_ID_SP = 0xF00A; /// Shape.
+const sal_uInt16 DFF_ID_SPGR = 0xF009; /// Shape group.
+const sal_uInt16 DFF_ID_SPLITMENUCOLORS = 0xF11E; /// Current toolbar colors.
+
+const sal_uInt16 DFF_OPT_IDMASK = 0x3FFF;
+const sal_uInt16 DFF_OPT_PICTURE = 0x4000;
+const sal_uInt16 DFF_OPT_COMPLEX = 0x8000;
+const sal_uInt16 DFF_OPT_FLAGSMASK = 0x003F;
+
+} // namespace
+
+// ============================================================================
+
+void DffStreamObject::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, "DFF-RECORD-NAMES" );
+ constructDffObj();
+}
+
+void DffStreamObject::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
+{
+ SequenceRecordObjectBase::construct( rParent, rxStrm, "DFF-RECORD-NAMES" );
+ constructDffObj();
+}
+
+bool DffStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+ sal_uInt16 nRecId;
+ rBaseStrm >> mnInstVer >> nRecId >> mnRealSize;
+ ornRecId = nRecId;
+ ornRecSize = isContainer() ? 0 : mnRealSize;
+ return !rBaseStrm.isEof();
+}
+
+void DffStreamObject::implWriteExtHeader()
+{
+ const sal_Char* pcListName = "DFF-RECORD-INST";
+ switch( getRecId() )
+ {
+ case DFF_ID_BSE: pcListName = "DFFBSE-RECORD-INST"; break; // BLIP type
+ case DFF_ID_BSTORECONTAINER: pcListName = "DFFBSTORECONT-RECORD-INST"; break; // BLIP count
+ case DFF_ID_DG: pcListName = "DFFDG-RECORD-INST"; break; // drawing ID
+ case DFF_ID_OPT: pcListName = "DFFOPT-RECORD-INST"; break; // property count
+ case DFF_ID_SP: pcListName = "DFFSP-RECORD-INST"; break; // shape type
+ case DFF_ID_SPLITMENUCOLORS: pcListName = "DFFSPLITMENUC-RECORD-INST"; break; // number of colors
+ }
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( "instance", mnInstVer, pcListName );
+ if( isContainer() ) writeDecItem( "container-size", mnRealSize );
+}
+
+void DffStreamObject::implDumpRecordBody()
+{
+ switch( getRecId() )
+ {
+ case DFF_ID_BSE:
+ dumpDec< sal_uInt8 >( "win-type", "DFFBSE-TYPE" );
+ dumpDec< sal_uInt8 >( "mac-type", "DFFBSE-TYPE" );
+ dumpGuid( "guid" );
+ dumpDec< sal_uInt16 >( "tag" );
+ dumpDec< sal_uInt32 >( "blip-size" );
+ dumpDec< sal_uInt32 >( "blip-refcount" );
+ dumpDec< sal_uInt32 >( "blip-streampos" );
+ dumpDec< sal_uInt8 >( "blip-usage", "DFFBSE-USAGE" );
+ dumpDec< sal_uInt8 >( "blip-name-len" );
+ dumpUnused( 2 );
+ break;
+
+ case DFF_ID_CHILDANCHOR:
+ dumpDec< sal_uInt32 >( "left" );
+ dumpDec< sal_uInt32 >( "top" );
+ dumpDec< sal_uInt32 >( "right" );
+ dumpDec< sal_uInt32 >( "bottom" );
+ break;
+
+ case DFF_ID_CLIENTANCHOR:
+ implDumpClientAnchor();
+ break;
+
+ case DFF_ID_DG:
+ dumpDec< sal_uInt32 >( "shape-count" );
+ dumpHex< sal_uInt32 >( "max-shape-id", "CONV-DEC" );
+ break;
+
+ case DFF_ID_DGG:
+ {
+ dumpHex< sal_uInt32 >( "max-shape-id", "CONV-DEC" );
+ sal_uInt32 nClusters = dumpDec< sal_uInt32 >( "id-cluster-count" );
+ dumpDec< sal_uInt32 >( "shape-count" );
+ dumpDec< sal_uInt32 >( "drawing-count" );
+ mxOut->resetItemIndex( 1 );
+ TableGuard aTabGuard( mxOut, 15, 16 );
+ for( sal_uInt32 nCluster = 1; !mxStrm->isEof() && (nCluster < nClusters); ++nCluster )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#cluster" );
+ dumpDec< sal_uInt32 >( "drawing-id" );
+ dumpHex< sal_uInt32 >( "next-free-id", "CONV-DEC" );
+ }
+ }
+ break;
+
+ case DFF_ID_OPT:
+ case DFF_ID_OPT2:
+ case DFF_ID_OPT3:
+ dumpDffOpt();
+ break;
+
+ case DFF_ID_SP:
+ dumpHex< sal_uInt32 >( "shape-id", "CONV-DEC" );
+ dumpHex< sal_uInt32 >( "shape-flags", "DFFSP-FLAGS" );
+ break;
+
+ case DFF_ID_SPGR:
+ dumpDec< sal_uInt32 >( "left" );
+ dumpDec< sal_uInt32 >( "top" );
+ dumpDec< sal_uInt32 >( "right" );
+ dumpDec< sal_uInt32 >( "bottom" );
+ break;
+
+ case DFF_ID_SPLITMENUCOLORS:
+ dumpDffSimpleColor( "fill-color" );
+ dumpDffSimpleColor( "line-color" );
+ dumpDffSimpleColor( "shadow-color" );
+ dumpDffSimpleColor( "3d-color" );
+ break;
+ }
+}
+
+void DffStreamObject::implDumpClientAnchor()
+{
+}
+
+void DffStreamObject::constructDffObj()
+{
+ mnInstVer = 0;
+ mnRealSize = 0;
+ if( SequenceRecordObjectBase::implIsValid() )
+ {
+ maSimpleProps.insertFormats( cfg().getNameList( "DFFOPT-SIMPLE-PROPERTIES" ) );
+ maComplexProps.insertFormats( cfg().getNameList( "DFFOPT-COMPLEX-PROPERTIES" ) );
+ }
+}
+
+sal_uInt32 DffStreamObject::dumpDffSimpleColor( const String& rName )
+{
+ return dumpHex< sal_uInt32 >( rName, "DFF-SIMPLE-COLOR" );
+}
+
+sal_uInt32 DffStreamObject::dumpDffColor( const String& rName )
+{
+ return dumpHex< sal_uInt32 >( rName, "DFF-COLOR" );
+}
+
+namespace {
+
+enum PropType { PROPTYPE_BINARY, PROPTYPE_STRING, PROPTYPE_BLIP, PROPTYPE_COLORARRAY };
+
+struct PropInfo
+{
+ OUString maName;
+ PropType meType;
+ sal_uInt16 mnId;
+ sal_uInt32 mnSize;
+ inline explicit PropInfo( const OUString& rName, PropType eType, sal_uInt16 nId, sal_uInt32 nSize ) :
+ maName( rName ), meType( eType ), mnId( nId ), mnSize( nSize ) {}
+};
+
+typedef ::std::vector< PropInfo > PropInfoVector;
+
+} // namespace
+
+void DffStreamObject::dumpDffOpt()
+{
+ sal_uInt16 nPropCount = getInst();
+ PropInfoVector aPropInfos;
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nPropIdx = 0; !mxStrm->isEof() && (nPropIdx < nPropCount); ++nPropIdx )
+ {
+ sal_uInt16 nPropId = dumpDffOptPropHeader();
+ sal_uInt16 nBaseId = nPropId & DFF_OPT_IDMASK;
+ sal_uInt32 nValue = mxStrm->readuInt32();
+
+ IndentGuard aIndent( mxOut );
+ if( getFlag( nPropId, DFF_OPT_COMPLEX ) )
+ {
+ writeHexItem( "complex-size", nValue, "CONV-DEC" );
+ String aName;
+ PropType eType = PROPTYPE_BINARY;
+ ItemFormatMap::const_iterator aIt = maComplexProps.find( nBaseId );
+ if( aIt != maComplexProps.end() )
+ {
+ const ItemFormat& rItemFmt = aIt->second;
+ aName = rItemFmt.maItemName;
+ if( rItemFmt.maListName.equalsAscii( "binary" ) )
+ eType = PROPTYPE_BINARY;
+ else if( rItemFmt.maListName.equalsAscii( "string" ) )
+ eType = PROPTYPE_STRING;
+ else if( rItemFmt.maListName.equalsAscii( "blip" ) )
+ eType = PROPTYPE_BLIP;
+ else if( rItemFmt.maListName.equalsAscii( "colorarray" ) )
+ eType = PROPTYPE_COLORARRAY;
+ }
+ aPropInfos.push_back( PropInfo( aName( "property-data" ), eType, nBaseId, nValue ) );
+ }
+ else
+ {
+ ItemFormatMap::const_iterator aIt = maSimpleProps.find( nBaseId );
+ if( aIt != maSimpleProps.end() )
+ {
+ const ItemFormat& rItemFmt = aIt->second;
+ // flags always at end of block of 64 properties
+ if( (nBaseId & DFF_OPT_FLAGSMASK) == DFF_OPT_FLAGSMASK )
+ {
+ FlagsList* pFlagsList = dynamic_cast< FlagsList* >( cfg().getNameList( rItemFmt.maListName ).get() );
+ sal_Int64 nOldIgnoreFlags = 0;
+ if( pFlagsList )
+ {
+ nOldIgnoreFlags = pFlagsList->getIgnoreFlags();
+ pFlagsList->setIgnoreFlags( nOldIgnoreFlags | 0xFFFF0000 | ~(nValue >> 16) );
+ }
+ writeValueItem( rItemFmt, nValue );
+ if( pFlagsList )
+ pFlagsList->setIgnoreFlags( nOldIgnoreFlags );
+ }
+ else
+ writeValueItem( rItemFmt, nValue );
+ }
+ else
+ writeHexItem( "value", nValue );
+ }
+ }
+
+ mxOut->resetItemIndex();
+ for( PropInfoVector::iterator aIt = aPropInfos.begin(), aEnd = aPropInfos.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
+ {
+ mxOut->startMultiItems();
+ writeEmptyItem( "#complex-data" );
+ writeHexItem( "id", aIt->mnId, "DFFOPT-PROPERTY-NAMES" );
+ mxOut->endMultiItems();
+ IndentGuard aIndent( mxOut );
+ switch( aIt->meType )
+ {
+ case PROPTYPE_BINARY:
+ dumpBinary( aIt->maName, aIt->mnSize );
+ break;
+ case PROPTYPE_STRING:
+ dumpUnicodeArray( aIt->maName, aIt->mnSize / 2, true );
+ break;
+ case PROPTYPE_BLIP:
+ dumpBinary( aIt->maName, aIt->mnSize );
+ break;
+ case PROPTYPE_COLORARRAY:
+ dumpBinary( aIt->maName, aIt->mnSize );
+ break;
+ }
+ }
+}
+
+sal_uInt16 DffStreamObject::dumpDffOptPropHeader()
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 11 );
+ writeEmptyItem( "#prop" );
+ return dumpHex< sal_uInt16 >( "id", "DFFOPT-PROPERTY-ID" );
+}
+
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/dffdumper.ini b/oox/source/dump/dffdumper.ini
new file mode 100644
index 000000000000..5526663e0e15
--- /dev/null
+++ b/oox/source/dump/dffdumper.ini
@@ -0,0 +1,650 @@
+
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# name lists =================================================================
+
+multilist=DFF-RECORD-NAMES
+ 0xF000=DFFDGGCONTAINER,DFFBSTORECONTAINER,DFFDGCONTAINER,DFFSPGRCONTAINER,DFFSPCONTAINER,DFFSOLVERCONTAINER,DFFDGG,DFFBSE
+ 0xF008=DFFDG,DFFSPGR,DFFSP,DFFOPT,DFFTEXTBOX,DFFCLIENTTEXTBOX,DFFANCHOR,DFFCHILDANCHOR
+ 0xF010=DFFCLIENTANCHOR,DFFCLIENTDATA,DFFCONNECTORRULE,DFFALIGNRULE,DFFARCRULE,DFFCLIENTRULE,DFFCLASSID,DFFCALLOUTRULE
+ # 0xF018-0xF117 reserved for pictures
+ 0xF118=DFFREGROUPITEM,DFFSELECTION,DFFCOLORMRU,,,DFFDELETEDPSPL,DFFSPLITMENUCOLORS,DFFOLEOBJECT
+ 0xF120=DFFCOLORSCHEME,DFFOPT2,DFFOPT3
+end
+
+combilist=DFF-RECORD-INST
+ 0x000F=uint8,hex,version,DFF-RECORD-VERSION
+ 0xFFF0=uint16,dec,instance
+end
+
+constlist=DFF-RECORD-VERSION
+ default=
+ 15=container
+end
+
+combilist=DFF-SIMPLE-COLOR
+ 0x000000FF=uint8,dec,red,,filter=0x10000000~0x00000000
+ 0x0000FF00=uint8,dec,green,,filter=0x10000000~0x00000000
+ 0x00FF0000=uint8,dec,blue,,filter=0x10000000~0x00000000
+ 0x000000FF=uint8,dec,scheme-idx,,filter=0x10000000~0x10000000
+ 0x10000000=!rgb!scheme
+ ignore=0x08000000
+end
+
+combilist=DFF-COLOR
+ 0x0000FFFF=uint16,dec,palette-idx,,filter=0xFF000000~0x01000000
+ 0x000000FF=uint8,dec,red,,filter=0xF9000000~0x00000000
+ 0x0000FF00=uint8,dec,green,,filter=0xF9000000~0x00000000
+ 0x00FF0000=uint8,dec,blue,,filter=0xF9000000~0x00000000
+ 0x000000FF=uint8,dec,scheme-idx,,filter=0xFF000000~0x08000000
+ 0x0000FFFF=uint16,dec,system-idx,DFF-SYSTEMCOLOR,filter=0xFF000000~0x10000000
+ 0x00FF0000=uint16,dec,mod-by,,filter=0xFF000000~0x10000000
+ 0x01000000=palette-idx
+ 0x02000000=palette-rgb
+ 0x04000000=system-rgb
+ 0x08000000=scheme-idx
+ 0x10000000=system-idx
+end
+
+combilist=DFF-SYSTEMCOLOR
+ 0x00FF=uint8,dec,color-id,DFF-SYSTEMCOLOR-ID
+ 0x0F00=uint8,dec,mod,DFF-SYSTEMCOLOR-MOD
+ 0x2000=invert-after
+ 0x4000=half-invert-after
+ 0x8000=grey-before
+end
+
+constlist=DFF-SYSTEMCOLOR-ID
+ include=SYSTEMCOLOR
+ 0xF0=shape-fill
+ 0xF1=shape-line-or-fill
+ 0xF2=shape-line
+ 0xF3=shape-shadow
+ 0xF4=current-or-last-used
+ 0xF5=shape-fill-back
+ 0xF6=shape-line-back
+ 0xF7=shape-fill-or-line
+end
+
+shortlist=DFF-SYSTEMCOLOR-MOD,0,none,darken-by,lighten-by,add-grey-by,sub-grey-by,reverse-sub-grey-by,monochrome-by
+
+combilist=DFF-COLORMOD
+ 0x00000300=uint8,dec,type,DFF-COLORMOD-TYPE
+ 0x00FF0000=uint8,dec,level
+ ignore=0x200000FF
+end
+
+shortlist=DFF-COLORMOD-TYPE,0,none,shade,tint
+
+# DFFBSE ---------------------------------------------------------------------
+
+combilist=DFFBSE-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,blip-type,DFFBSE-TYPE
+end
+
+multilist=DFFBSE-TYPE
+ 0=error,unknown,emf,wmf,pict,jpeg,png,dib
+ 17=tiff,cmyk-jpeg
+end
+
+shortlist=DFFBSE-USAGE,0,default,texture
+
+# DFFBSTORECONTAINER ---------------------------------------------------------
+
+combilist=DFFBSTORECONT-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,blip-count
+end
+
+# DFFDG ----------------------------------------------------------------------
+
+combilist=DFFDG-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,drawing-id
+end
+
+# DFFOPT ---------------------------------------------------------------------
+
+combilist=DFFOPT-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,property-count
+end
+
+combilist=DFFOPT-PROPERTY-ID
+ 0x3FFF=uint16,dec,id,DFFOPT-PROPERTY-NAMES
+ 0x4000=picture
+ 0x8000=complex
+end
+
+multilist=DFFOPT-PROPERTY-NAMES
+ # 0x0000-0x003F: transformation
+ 0x0000=transf-left,transf-top,transf-right,transf-bottom,transf-rotation,transf-page
+ 0x003F=transf-flags
+ # 0x0040-0x007F: protection
+ 0x007F=prot-flags
+ # 0x0080-0x00BF: text
+ 0x0080=text-id,text-left,text-top,text-right,text-bottom,text-wrap-mode,text-scale,text-anchor-mode
+ 0x0088=text-flow,text-font-orient,text-next-shape,text-bidi
+ 0x00BF=text-flags
+ # 0x00C0-0x00FF: text geometry
+ 0x00C0=textgeo-unicode-string,textgeo-rtf-string,textgeo-curve-align,textgeo-def-size,textgeo-spacing,textgeo-font,textgeo-css-font
+ 0x00FF=textgeo-flags
+ # 0x0100-0x013F: picture (BLIP)
+ 0x0100=blip-crop-top,blip-crop-bottom,blip-crop-left,blip-crop-right,blip-id,blip-name,blip-opt,blip-transparency-color
+ 0x0108=blip-contrast,blip-brightness,blip-gamma,blip-ole-id,blip-double-cr-mod,blip-fill-cr-mod,blip-line-cr-mod,blip-print-id
+ 0x0110=blip-print-name,blip-print-opt,blip-movie,,,blip-transparency-color-ext,,blip-transparency-color-ext-mod
+ 0x0118,,blip-recolor,blip-recolor,blip-recolor-ext,,blip-recolor-ext-mod
+ 0x013F=blip-flags
+ # 0x0140-0x017F: shape geometry
+ 0x0140=geo-left,geo-top,geo-right,geo-bottom,geo-shape-path,geo-vertices,geo-segment-info,geo-adjust-1
+ 0x0148=geo-adjust-2,geo-adjust-3,geo-adjust-4,geo-adjust-5,geo-adjust-6,geo-adjust-7,geo-adjust-8,
+ 0x0150=,geo-connect-sites,geo-connect-sites-dir,geo-stretch-x,geo-stretch-y,geo-handles,geo-guides,geo-inscribe
+ 0x0158=geo-connect-points
+ 0x017F=geo-flags
+ # 0x0180-0x01BF: fill style
+ 0x0180=fill-type,fill-color,fill-opacity,fill-back-color,fill-back-opacity,fill-cr-mod,fill-blip,fill-blip-name
+ 0x0188=fill-blip-opt,fill-width,fill-height,fill-angle,fill-focus,fill-to-left,fill-to-top,fill-to-right
+ 0x0190=fill-to-bottom,fill-rect-left,fill-rect-top,fill-rect-right,fill-rect-bottom,fill-dz-type,fill-shade-preset,fill-shade-colors
+ 0x0198=fill-origin-x,fill-origin-y,fill-shape-origin-x,fill-shape-origin-y,fill-shade-type,,fill-color-ext,
+ 0x01A0=fill-color-ext-mod,,fill-back-color-ext,,fill-back-color-ext-mod
+ 0x01BF=fill-flags
+ # 0x01C0-0x01FF: line style
+ 0x01C0=line-color,line-opacity,line-back-color,line-cr-mod,line-type,line-fill-blip,line-fill-blip-name,line-fill-blip-opt
+ 0x01C8=line-fill-width,line-fill-height,line-fill-dz-type,line-width,line-miter-limit,line-style,line-dash,line-dash-style
+ 0x01D0=line-start-arrow-head,line-end-arrow-head,line-start-arrow-width,line-start-arrow-length,line-end-arrow-width,line-end-arrow-length,line-join-style,line-end-cap-style
+ 0x01D8=,line-color-ext,,line-color-ext-mod,,line-back-color-ext,,line-back-color-ext-mod
+ 0x01FF=line-flags
+ # 0x0200-0x023F: shadow style
+ 0x0200=shadow-type,shadow-color,shadow-highlight,shadow-cr-mod,shadow-opacity,shadow-offset-x,shadow-offset-y,shadow-2nd-offset-x
+ 0x0208=shadow-2nd-offset-y,,,,,,,
+ 0x0210=shadow-origin-x,shadow-origin-y,shadow-color-ext,,shadow-color-ext-mod,,shadow-highlight-ext,
+ 0x0218=shadow-highlight-ext-mod
+ 0x023F=shadow-flags
+ # 0x0240-0x027F: perspective
+ 0x0240=persp-type,persp-offset-x,persp-offsety,persp-scale-x-to-x,persp-scale-y-to-x,persp-scale-x-to-y,persp-scale-y-to-y,persp-persp-x
+ 0x0248=persp-persp-y,persp-weight,persp-origin-x,persp-origin-y
+ 0x027F=persp-flags
+ # 0x0280-0x02BF: 3d object
+ 0x0280=3dobj-specular-amt,3dobj-diffuse-amt,3dobj-shininess,3dobj-edge-thickness,3dobj-extrude-forward,3dobj-extrude-backward,3dobj-extrude-plane,3dobj-extrusion-color
+ 0x0288=3dobj-cr-mod,3dobj-extrusion-color-ext,,3dobj-extrusion-color-ext-mod
+ 0x02BF=3dobj-flags
+ # 0x02C0-0x02FF: 3d style
+ 0x02C0=3dstyle-y-rotation,3dstyle-x-rotation,3dstyle-rotation-axis-x,3dstyle-rotation-axis-y,3dstyle-rotation-axis-z,3dstyle-rotation,3dstyle-rotation-center-x,3dstyle-rotation-center-y
+ 0x02C8=3dstyle-rotation-center-z,3dstyle-render-mode,3dstyle-tolerance,3dstyle-view-point-x,3dstyle-view-point-y,3dstyle-view-point-z,3dstyle-origin-x,3dstyle-origin-y
+ 0x02D0=3dstyle-skew-angle,3dstyle-skew-amount,3dstyle-ambient-intensity,3dstyle-key-light-x,3dstyle-key-light-y,3dstyle-key-light-z,3dstyle-key-light-intensity,3dstyle-fill-light-x
+ 0x02D8=3dstyle-fill-light-y,3dstyle-fill-light-z,3dstyle-fill-light-intensity
+ 0x02FF=3dstyle-flags
+ # 0x0300-0x033F: shape
+ 0x0300=,shape-master,,shape-connect-style,shape-bw-mod,shape-bw-mode-pure-bw,shape-bw-mode-bw,shape-discuss-anchor-id
+ 0x0308=,shape-dia-layout,shape-dia-node-kind,shape-dia-layout-mru,shape-equation-xml
+ 0x033F=shape-flags
+ # 0x0340-0x037F: callout
+ 0x0340=callout-type,callout-box-distance,callout-angle,callout-drop-type,callout-drop-pos,callout-length
+ 0x037F=callout-flags
+ # 0x0380-0x03BF: group or shape
+ 0x0380=group-name,group-description,group-hyperlink,group-wrap-polygon-vertices,group-wrap-left,group-wrap-top,group-wrap-right,group-wrap-bottom
+ 0x0388=group-regroup-id,,,,,group-tooltip,group-script,group-pos-h
+ 0x0390=group-pos-rel-h,group-pos-v,group-pos-rel-v,group-rel-width-hr,group-align-hr,group-height-hr,group-width-hr,group-script-ext-attr
+ 0x0398=group-script-lang,,group-script-lang-attr,group-border-top-color,group-border-left-color,group-border-bottom-color,group-border-right-color,group-table-props
+ 0x03A0=group-table-row-props,,,,,group-web-bot,,
+ 0x03A8=,group-metro-blob,group-rel-z-order,
+ 0x03BF=group-flags
+ # 0x03C0-0x03FF: relative transformation
+ 0x03C0=reltransf-left,reltransf-top,reltransf-right,reltransf-bottom,reltransf-rotation,reltransf-page
+ 0x03FF=reltransf-flags
+ # 0x0400-0x043F: unknown HTML
+ 0x0400=,,uhtml-line-id,uhtml-fill-id,uhtml-pic-id,uhtml-path-id,uhtml-shadow-id,uhtml-persp-id
+ 0x0408=uhtml-text-path-id,uhtml-formulae-id,uhtml-handles-id,uhtml-callout-id,uhtml-lock-id,uhtml-text-id,uhtml-3d-id
+ 0x043F=uhtml-flags
+ # 0x0500-0x053F: diagram
+ 0x0500=dia-type,dia-style,,,dia-rel-table,dia-scale-x,dia-scale-y,dia-def-fontsize
+ 0x0508=dia-constrain-bounds,dia-base-text-scale
+ 0x053F=dia-flags
+ # 0x0540-0x057F: left line style
+ 0x0540=lline-color,lline-opacity,lline-back-color,lline-cr-mod,lline-type,lline-fill-blip,lline-fill-blip-name,lline-fill-blip-opt
+ 0x0548=lline-fill-width,lline-fill-height,lline-fill-dz-type,lline-width,lline-miter-limit,lline-style,lline-dash,lline-dash-style
+ 0x0550=lline-start-arrow-head,lline-end-arrow-head,lline-start-arrow-width,lline-start-arrow-length,lline-end-arrow-width,lline-end-arrow-length,lline-join-style,lline-end-cap-style
+ 0x0558=,lline-color-ext,,lline-color-ext-mod,,lline-back-color-ext,,lline-back-color-ext-mod
+ 0x057F=lline-flags
+ # 0x0580-0x05BF: top line style
+ 0x0580=tline-color,tline-opacity,tline-back-color,tline-cr-mod,tline-type,tline-fill-blip,tline-fill-blip-name,tline-fill-blip-opt
+ 0x0588=tline-fill-width,tline-fill-height,tline-fill-dz-type,tline-width,tline-miter-limit,tline-style,tline-dash,tline-dash-style
+ 0x0590=tline-start-arrow-head,tline-end-arrow-head,tline-start-arrow-width,tline-start-arrow-length,tline-end-arrow-width,tline-end-arrow-length,tline-join-style,tline-end-cap-style
+ 0x0598=,tline-color-ext,,tline-color-ext-mod,,tline-back-color-ext,,tline-back-color-ext-mod
+ 0x05BF=tline-flags
+ # 0x05C0-0x05FF: right line style
+ 0x05C0=rline-color,rline-opacity,rline-back-color,rline-cr-mod,rline-type,rline-fill-blip,rline-fill-blip-name,rline-fill-blip-opt
+ 0x05C8=rline-fill-width,rline-fill-height,rline-fill-dz-type,rline-width,rline-miter-limit,rline-style,rline-dash,rline-dash-style
+ 0x05D0=rline-start-arrow-head,rline-end-arrow-head,rline-start-arrow-width,rline-start-arrow-length,rline-end-arrow-width,rline-end-arrow-length,rline-join-style,rline-end-cap-style
+ 0x05D8=,rline-color-ext,,rline-color-ext-mod,,rline-back-color-ext,,rline-back-color-ext-mod
+ 0x05FF=rline-flags
+ # 0x0600-0x063F: bottom line style
+ 0x0600=bline-color,bline-opacity,bline-back-color,bline-cr-mod,bline-type,bline-fill-blip,bline-fill-blip-name,bline-fill-blip-opt
+ 0x0608=bline-fill-width,bline-fill-height,bline-fill-dz-type,bline-width,bline-miter-limit,bline-style,bline-dash,bline-dash-style
+ 0x0610=bline-start-arrow-head,bline-end-arrow-head,bline-start-arrow-width,bline-start-arrow-length,bline-end-arrow-width,bline-end-arrow-length,bline-join-style,bline-end-cap-style
+ 0x0618=,bline-color-ext,,bline-color-ext-mod,,bline-back-color-ext,,bline-back-color-ext-mod
+ 0x063F=bline-flags
+ # 0x0680-0x06BF: web component
+ 0x0680=webcomp-html,webcomp-name,webcomp-url
+ 0x06BF=webcomp-flags
+ # 0x0700-0x073F: ink data
+ 0x0700=ink-data
+ 0x073F=ink-flags
+ # 0x0780-0x07BF: signature line
+ 0x0780=,sigline-guid,sigline-provider-guid,sigline-suggested-signer,sigline-suggested-signer-info,sigline-suggested-signer-email,sigline-sign-instruction,sigline-add-xml
+ 0x0788=sigline-provider-url
+ 0x07BF=sigline-flags
+ # 0x07C0-0x07FF: group or shape #2
+ 0x07C0=group2-rel-width,group2-rel-height,group2-rel-pos-x,group2-rel-pos-y,group2-size-rel-h,group2-size-rel-v
+end
+
+constlist=DFFOPT-SIMPLE-PROPERTIES
+ # transformation
+ 0x003F=uint32,hex,flags,DFFOPT-TRANSFORM-FLAGS
+ # protection
+ 0x007F=uint32,hex,flags,DFFOPT-PROTECTION-FLAGS
+ # text
+ 0x00BF=uint32,hex,flags,DFFOPT-TEXT-FLAGS
+ # text geometry
+ 0x00FF=uint32,hex,flags,DFFOPT-TEXTGEO-FLAGS
+ # picture (BLIP)
+ 0x013F=uint32,hex,flags,DFFOPT-BLIP-FLAGS
+ # shape geometry
+ 0x017F=uint32,hex,flags,DFFOPT-GEO-FLAGS
+ # fill style
+ 0x0180=uint32,dec,type,DFFOPT-FILL-TYPE
+ 0x0181=uint32,hex,color,DFF-COLOR
+ 0x0182=int32,fix,opacity,CONV-FLOAT-TO-PERC
+ 0x0183=uint32,hex,color,DFF-COLOR
+ 0x0184=int32,fix,opacity,DFF-OPACITY
+ 0x0185=uint32,hex,color,DFF-COLOR
+ 0x0186=uint32,dec,blip-id
+ 0x0188=uint32,dec,blip-opt,DFFOPT-BLIPOPT
+ 0x0189=int32,dec,width
+ 0x018A=int32,dec,height
+ 0x018B=int32,fix,angle,CONV-DEG
+ 0x018C=int32,dec,focus,CONV-PERCENT
+ 0x018D=int32,fix,size,CONV-FLOAT-TO-PERC
+ 0x018E=int32,fix,size,CONV-FLOAT-TO-PERC
+ 0x018F=int32,fix,size,CONV-FLOAT-TO-PERC
+ 0x0190=int32,fix,size,CONV-FLOAT-TO-PERC
+ 0x0191=int32,fix,size,CONV-EMU-TO-CM
+ 0x0192=int32,fix,size,CONV-EMU-TO-CM
+ 0x0193=int32,fix,size,CONV-EMU-TO-CM
+ 0x0194=int32,fix,size,CONV-EMU-TO-CM
+ 0x0195=uint32,dec,type,DFFOPT-FILL-DZTYPE
+ 0x0196=int32,dec,preset
+ 0x0198=int32,fix,pos,CONV-FLOAT-TO-PERC
+ 0x0199=int32,fix,pos,CONV-FLOAT-TO-PERC
+ 0x019A=int32,fix,pos,CONV-FLOAT-TO-PERC
+ 0x019B=int32,fix,pos,CONV-FLOAT-TO-PERC
+ 0x019C=uint32,hex,type,DFFOPT-FILL-SHADETYPE
+ 0x019E=uint32,hex,color,DFF-COLOR
+ 0x01A0=uint32,hex,color-mod,DFF-COLORMOD
+ 0x01A2=uint32,hex,color,DFF-COLOR
+ 0x01A4=uint32,hex,color-mod,DFF-COLORMOD
+ 0x01BF=uint32,hex,flags,DFFOPT-FILL-FLAGS
+ # line style
+ 0x01C0=uint32,hex,color,DFF-COLOR
+ 0x01C2=uint32,hex,color,DFF-COLOR
+ 0x01FF=uint32,hex,flags,DFFOPT-LINE-FLAGS
+ # shadow style
+ 0x0201=uint32,hex,color,DFF-COLOR
+ 0x023F=uint32,hex,flags,DFFOPT-SHADOW-FLAGS
+ # perspective
+ 0x027F=uint32,hex,flags,DFFOPT-PERSP-FLAGS
+ # 3d object
+ 0x02BF=uint32,hex,flags,DFFOPT-3DOBJ-FLAGS
+ # 3d style
+ 0x02FF=uint32,hex,flags,DFFOPT-3DSTYLE-FLAGS
+ # shape
+ 0x033F=uint32,hex,flags,DFFOPT-SHAPE-FLAGS
+ # callout
+ 0x037F=uint32,hex,flags,DFFOPT-CALLOUT-FLAGS
+ # group or shape
+ 0x03BF=uint32,hex,flags,DFFOPT-GROUP-FLAGS
+ # relative transformation
+ 0x03FF=uint32,hex,flags,DFFOPT-TRANSFORM-FLAGS
+ # unknown HTML
+ 0x043F=uint32,hex,flags,DFFOPT-UHTML-FLAGS
+ # diagram
+ 0x053F=uint32,hex,flags,DFFOPT-DIAGRAM-FLAGS
+ # left line style
+ 0x0540=uint32,hex,color,DFF-COLOR
+ 0x0542=uint32,hex,color,DFF-COLOR
+ 0x057F=uint32,hex,flags,DFFOPT-LINE-FLAGS
+ # top line style
+ 0x0580=uint32,hex,color,DFF-COLOR
+ 0x0582=uint32,hex,color,DFF-COLOR
+ 0x05BF=uint32,hex,flags,DFFOPT-LINE-FLAGS
+ # right line style
+ 0x05C0=uint32,hex,color,DFF-COLOR
+ 0x05C2=uint32,hex,color,DFF-COLOR
+ 0x05FF=uint32,hex,flags,DFFOPT-LINE-FLAGS
+ # bottom line style
+ 0x0600=uint32,hex,color,DFF-COLOR
+ 0x0602=uint32,hex,color,DFF-COLOR
+ 0x063F=uint32,hex,flags,DFFOPT-LINE-FLAGS
+ # web component
+ 0x06BF=uint32,hex,flags,DFFOPT-WEBCOMP-FLAGS
+ # ink data
+ 0x073F=uint32,hex,flags,DFFOPT-INK-FLAGS
+ # signature line
+ 0x07BF=uint32,hex,flags,DFFOPT-SIGLINE-FLAGS
+ # group or shape #2
+end
+
+constlist=DFFOPT-COMPLEX-PROPERTIES
+ 0x0186=uint32,hex,blip,blip
+ 0x0187=uint32,hex,blip-name,string
+ 0x0197=uint32,hex,shade-colors,colorarray
+ 0x0380=uint32,hex,shape-name,string
+end
+
+# common
+
+combilist=DFFOPT-BLIPOPT
+ 0x00000003=uint8,dec,type,DFFOPT-BLIPOPT-TYPE
+ 0x00000004=do-not-save
+ 0x00000008=linked
+end
+
+shortlist=DFFOPT-BLIPOPT-TYPE,0,comment,file,url
+
+# transformation
+
+flagslist=DFFOPT-TRANSFORM-FLAGS
+ 0x0001=:flip-h
+ 0x0002=:flip-v
+end
+
+# protection
+
+flagslist=DFFOPT-PROTECTION-FLAGS
+ 0x0001=:lock-against-grouping
+ 0x0002=:lock-adjust-handles
+ 0x0004=:lock-text
+ 0x0008=:lock-vertices
+ 0x0010=:lock-cropping
+ 0x0020=:lock-against-select
+ 0x0040=:lock-position
+ 0x0080=:lock-aspect-ratio
+ 0x0100=:lock-rotation
+ 0x0200=:lock-against-ungrouping
+end
+
+# text
+
+flagslist=DFFOPT-TEXT-FLAGS
+ 0x0002=:fit-shape-to-text
+ 0x0008=:auto-text-margin
+ 0x0010=:select-text
+ ignore=0x0005
+end
+
+# text geometry
+
+flagslist=DFFOPT-TEXTGEO-FLAGS
+ 0x0001=:strike-through
+ 0x0002=:small-caps
+ 0x0004=:shadow
+ 0x0008=:underline
+ 0x0010=:italic
+ 0x0020=:bold
+ 0x0040=:no-measure-along-path
+ 0x0080=:normalize
+ 0x0100=:best-fit
+ 0x0200=:shrink-to-fit
+ 0x0400=:stretch-to-fit
+ 0x0800=:tightening
+ 0x1000=:kerning
+ 0x2000=:vertical
+ 0x4000=:has-effect
+ 0x8000=:reverse-rows
+end
+
+# picture (BLIP)
+
+flagslist=DFFOPT-BLIP-FLAGS
+ 0x0001=:ole-alive
+ 0x0002=:bi-level-display
+ 0x0004=:grayscale
+ 0x0008=:no-hit-test
+ 0x0010=:loop-anim
+ 0x0020=:rewind-anim
+ 0x0040=:preserve-gray
+end
+
+# shape geometry
+
+flagslist=DFFOPT-GEO-FLAGS
+ 0x0001=:fill-support
+ 0x0002=:fill-shade-shape-support
+ 0x0004=:fontwork-support
+ 0x0008=:line-support
+ 0x0010=:3d-support
+ 0x0020=:shadow-support
+end
+
+# fill style
+
+shortlist=DFFOPT-FILL-TYPE,0,solid,pattern,texture,picture,edge-shade,linear-shade,shape-shade,point-shade,title-shade,background
+
+combilist=DFFOPT-FILL-DZTYPE
+ 0x00000003=uint8,dec,unit,DFFOPT-FILL-DZTYPE-UNIT
+ 0x0000000C=uint8,dec,aspect,DFFOPT-FILL-DZTYPE-ASPECT
+end
+
+shortlist=DFFOPT-FILL-DZTYPE-UNIT,0,unused,emu,pixel,shape-size-rel
+shortlist=DFFOPT-FILL-DZTYPE-ASPECT,0,none,fixed,prefer-largest
+
+flagslist=DFFOPT-FILL-SHADETYPE
+ 0x00000001=none
+ 0x00000002=gamma
+ 0x00000004=sigma-transfer
+ 0x00000008=flat-band
+ 0x00000010=one-color
+end
+
+flagslist=DFFOPT-FILL-FLAGS
+ 0x0001=:no-fill-hit-test
+ 0x0002=:fill-to-rect
+ 0x0004=:fill-rel-to-shape
+ 0x0008=:hit-test-fill
+ 0x0010=:has-fill
+ 0x0020=:shape-anchor
+ 0x0040=:recolor-as-pic
+end
+
+# line style
+
+flagslist=DFFOPT-LINE-FLAGS
+ 0x0001=:draw-dash-for-invisible
+ 0x0002=:fill-rel-to-shape
+ 0x0004=:hit-test-line
+ 0x0008=:has-line
+ 0x0010=:arrowhead-support
+ 0x0020=:inset-pen-support
+ 0x0040=:inset-pen
+ 0x0200=:opaque-back-line
+end
+
+# shadow style
+
+flagslist=DFFOPT-SHADOW-FLAGS
+ 0x0001=:obscured-shadow
+ 0x0002=:has-shadow
+end
+
+# perspective
+
+flagslist=DFFOPT-PERSP-FLAGS
+ 0x0001=:has-perspective
+end
+
+# 3d object
+
+flagslist=DFFOPT-3DOBJ-FLAGS
+ 0x0001=:light-face
+ 0x0002=:extrusion-color
+ 0x0004=:metallic
+ 0x0008=:has-3d
+end
+
+# 3d style
+
+flagslist=DFFOPT-3DSTYLE-FLAGS
+ 0x0001=:fill-color-harsh
+ 0x0002=:key-color-harsh
+ 0x0004=:parallel
+ 0x0008=:rotation-center-auto
+ 0x0010=:constrain-rotation
+end
+
+# shape
+
+flagslist=DFFOPT-SHAPE-FLAGS
+ 0x0001=:background
+ 0x0004=:initiator
+ 0x0008=:lock-shape-type
+ 0x0010=:prefer-rel-resize
+ 0x0020=:ole-iconified
+ 0x0040=:flip-v-override
+ 0x0080=:flip-h-override
+ 0x0100=:policy-barcode
+ 0x0200=:policy-label
+end
+
+# callout
+
+flagslist=DFFOPT-CALLOUT-FLAGS
+ 0x0001=:length-specified
+ 0x0002=:drop-auto
+ 0x0004=:minus-y
+ 0x0008=:minus-x
+ 0x0010=:has-text-border
+ 0x0020=:has-accent-bar
+ 0x0040=:is-callout
+end
+
+# group or shape
+
+flagslist=DFFOPT-GROUP-FLAGS
+ 0x0001=:print
+ 0x0002=:hidden
+ 0x0004=:1d-adjustment
+ 0x0008=:is-button
+ 0x0010=:notify-double-click
+ 0x0020=:behind-doc
+ 0x0040=:wrap-edited
+ 0x0080=:script-anchor
+ 0x0100=:really-hidden
+ 0x0200=:allow-overlap
+ 0x0400=:user-drawn
+ 0x0800=:is-hr
+ 0x1000=:no-shade-hr
+ 0x2000=:standard-hr
+ 0x4000=:is-bullet
+ 0x8000=:layout-in-cell
+end
+
+# unknown HTML
+
+flagslist=DFFOPT-UHTML-FLAGS
+ 0x0002=:fake-master
+ 0x0004=:ole-from-html
+end
+
+# diagram
+
+flagslist=DFFOPT-DIAGRAM-FLAGS
+ 0x0001=:pseudo-inline
+ 0x0002=:do-layout
+ 0x0004=:reverse
+ 0x0008=:do-format
+end
+
+# web component
+
+flagslist=DFFOPT-WEBCOMP-FLAGS
+ 0x0001=:is-web-component
+end
+
+# ink data
+
+flagslist=DFFOPT-INK-FLAGS
+ 0x0001=:render-ink
+ 0x0002=:render-shape
+ 0x0004=:hit-test-ink
+ 0x0008=:ink-annotation
+end
+
+# signature line
+
+flagslist=DFFOPT-SIGLINE-FLAGS
+ 0x0001=:is-signature-line
+ 0x0002=:show-sign-instruction
+ 0x0004=:show-sign-comment
+ 0x0008=:show-sign-date
+end
+
+# group or shape #2
+
+# DFFSP ----------------------------------------------------------------------
+
+combilist=DFFSP-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,shape-type,DFFSP-TYPE
+end
+
+multilist=DFFSP-TYPE
+ 0=not-primitive,rectangle,round-rectangle,ellipse,diamond,isoceles-triangle,right-triangle,parallelogram,trapezoid,hexagon
+ 10=octagon,plus,star,arrow,thick-arrow,home-plate,cube,balloon,seal,arc
+ 20=line,plaque,can,donut,text-simple,text-octagon,text-hexagon,text-curve,text-wave,text-ring
+ 30=text-on-curve,text-on-ring,straight-connector-1,bent-connector-2,bent-connector-3,bent-connector-4,bent-connector-5,curved-connector-2,curved-connector-3,curved-connector-4
+ 40=curved-connector-5,callout-1,callout-2,callout-3,accent-callout-1,accent-callout-2,accent-callout-3,border-callout-1,border-callout-2,border-callout-3
+ 50=accent-border-callout-1,accent-border-callout-2,accent-border-callout-3,ribbon,ribbon-2,chevron,pentagon,no-smoking,seal-8,seal-16
+ 60=seal-32,wedge-rect-callout,wedge-rrect-callout,wedge-ellipse-callout,wave,folded-corner,left-arrow,down-arrow,up-arrow,left-right-arrow
+ 70=up-down-arrow,irregular-seal-1,irregular-seal-2,lightning-bolt,heart,picture-frame,quad-arrow,left-arrow-callout,right-arrow-callout,up-arrow-callout
+ 80=down-arrow-callout,left-right-arrow-callout,up-down-arrow-callout,quad-arrow-callout,bevel,left-bracket,right-bracket,left-brace,right-brace,left-up-arrow
+ 90=bent-up-arrow,bent-arrow,seal-24,striped-right-arrow,notched-right-arrow,block-arc,smiley-face,vertical-scroll,horizontal-scroll,circular-arrow
+ 100=notched-circular-arrow,uturn-arrow,curved-right-arrow,curved-left-arrow,curved-up-arrow,curved-down-arrow,cloud-callout,ellipse-ribbon,ellipse-ribbon-2,flow-chart-process
+ 110=flow-chart-decision,flow-chart-input-output,flow-chart-predefined-process,flow-chart-internal-storage,flow-chart-document,flow-chart-multidocument,flow-chart-terminator,flow-chart-preparation,flow-chart-manual-input,flow-chart-manual-operation
+ 120=flow-chart-connector,flow-chart-punched-card,flow-chart-punched-tape,flow-chart-summing-junction,flow-chart-or,flow-chart-collate,flow-chart-sort,flow-chart-extract,flow-chart-merge,flow-chart-offline-storage
+ 130=flow-chart-online-storage,flow-chart-magnetic-tape,flow-chart-magnetic-disk,flow-chart-magnetic-drum,flow-chart-display,flow-chart-delay,text-plain-text,text-stop,text-triangle,text-triangle-inverted
+ 140=text-chevron,text-chevron-inverted,text-ring-inside,text-ring-outside,text-arch-up-curve,text-arch-down-curve,text-circle-curve,text-button-curve,text-arch-up-pour,text-arch-down-pour
+ 150=text-circle-pour,text-button-pour,text-curve-up,text-curve-down,text-cascade-up,text-cascade-down,text-wave-1,text-wave-2,text-wave-3,text-wave-4
+ 160=text-inflate,text-deflate,text-inflate-bottom,text-deflate-bottom,text-inflate-top,text-deflate-top,text-deflate-inflate,text-deflate-inflate-deflate,text-fade-right,text-fade-left
+ 170=text-fade-up,text-fade-down,text-slant-up,text-slant-down,text-can-up,text-can-down,flow-chart-alternate-process,flow-chart-offpage-connector,callout-90,accent-callout-90
+ 180=border-callout-90,accent-border-callout-90,left-right-up-arrow,sun,moon,bracket-pair,brace-pair,seal-4,double-wave,action-button-blank
+ 190=action-button-home,action-button-help,action-button-information,action-button-forward-next,action-button-back-previous,action-button-end,action-button-beginning,action-button-return,action-button-document,action-button-sound
+ 200=action-button-movie,host-control,text-box
+end
+
+flagslist=DFFSP-FLAGS
+ 0x00000001=group
+ 0x00000002=child
+ 0x00000004=patriarch
+ 0x00000008=deleted
+ 0x00000010=ole
+ 0x00000020=has-master
+ 0x00000040=flip-horizontal
+ 0x00000080=flip-vertical
+ 0x00000100=connector
+ 0x00000200=has-anchor
+ 0x00000400=background
+ 0x00000800=has-shape-type
+end
+
+# DFFSPLITMENUCOLORS ---------------------------------------------------------
+
+combilist=DFFSPLITMENUC-RECORD-INST
+ include=DFF-RECORD-INST
+ 0xFFF0=uint16,dec,color-count
+end
+
+# ============================================================================
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
new file mode 100644
index 000000000000..f7c6c6102b1d
--- /dev/null
+++ b/oox/source/dump/dumperbase.cxx
@@ -0,0 +1,3217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/dumperbase.hxx"
+
+#include <algorithm>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XTextInputStream.hpp>
+#include <com/sun/star/io/XTextOutputStream.hpp>
+#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
+#include <comphelper/docpasswordhelper.hxx>
+#include <osl/file.hxx>
+#include <rtl/math.hxx>
+#include "oox/core/filterbase.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/helper/textinputstream.hxx"
+#include "oox/xls/biffhelper.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::ucb;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
+using ::rtl::OStringToOUString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::rtl::OUStringToOString;
+
+// ============================================================================
+
+namespace {
+
+const sal_Unicode OOX_DUMP_BOM = 0xFEFF;
+const sal_Int32 OOX_DUMP_MAXSTRLEN = 80;
+const sal_Int32 OOX_DUMP_INDENT = 2;
+const sal_Unicode OOX_DUMP_BINDOT = '.';
+const sal_Unicode OOX_DUMP_CFG_LISTSEP = ',';
+const sal_Unicode OOX_DUMP_CFG_QUOTE = '\'';
+const sal_Unicode OOX_DUMP_LF = '\n';
+const sal_Unicode OOX_DUMP_ITEMSEP = '=';
+const sal_Int32 OOX_DUMP_BYTESPERLINE = 16;
+const sal_Int64 OOX_DUMP_MAXARRAY = 16;
+
+} // namespace
+
+// ============================================================================
+// ============================================================================
+
+// file names -----------------------------------------------------------------
+
+OUString InputOutputHelper::convertFileNameToUrl( const OUString& rFileName )
+{
+ OUString aFileUrl;
+ if( ::osl::FileBase::getFileURLFromSystemPath( rFileName, aFileUrl ) == ::osl::FileBase::E_None )
+ return aFileUrl;
+ return OUString();
+}
+
+sal_Int32 InputOutputHelper::getFileNamePos( const OUString& rFileUrl )
+{
+ sal_Int32 nSepPos = rFileUrl.lastIndexOf( '/' );
+ return (nSepPos < 0) ? 0 : (nSepPos + 1);
+}
+
+OUString InputOutputHelper::getFileNameExtension( const OUString& rFileUrl )
+{
+ sal_Int32 nNamePos = getFileNamePos( rFileUrl );
+ sal_Int32 nExtPos = rFileUrl.lastIndexOf( '.' );
+ if( nExtPos >= nNamePos )
+ return rFileUrl.copy( nExtPos + 1 );
+ return OUString();
+}
+
+// input streams --------------------------------------------------------------
+
+Reference< XInputStream > InputOutputHelper::getXInputStream( BinaryInputStream& rStrm )
+{
+ if( BinaryXInputStream* pXStrm = dynamic_cast< BinaryXInputStream* >( &rStrm ) )
+ return pXStrm->getXInputStream();
+ return 0;
+}
+
+Reference< XInputStream > InputOutputHelper::openInputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
+{
+ Reference< XInputStream > xInStrm;
+ if( rxFactory.is() ) try
+ {
+ Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ xInStrm = xFileAccess->openFileRead( rFileName );
+ }
+ catch( Exception& )
+ {
+ }
+ return xInStrm;
+}
+
+Reference< XTextInputStream > InputOutputHelper::openTextInputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rEncoding )
+{
+ Reference< XTextInputStream > xTextInStrm;
+ if( rxFactory.is() && rxInStrm.is() ) try
+ {
+ Reference< XActiveDataSink > xDataSink( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW );
+ xDataSink->setInputStream( rxInStrm );
+ xTextInStrm.set( xDataSink, UNO_QUERY_THROW );
+ xTextInStrm->setEncoding( rEncoding );
+ }
+ catch( Exception& )
+ {
+ }
+ return xTextInStrm;
+}
+
+Reference< XTextInputStream > InputOutputHelper::openTextInputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding )
+{
+ return openTextInputStream( rxFactory, openInputStream( rxFactory, rFileName ), rEncoding );
+}
+
+// output streams -------------------------------------------------------------
+
+Reference< XOutputStream > InputOutputHelper::openOutputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
+{
+ Reference< XOutputStream > xOutStrm;
+ if( rxFactory.is() ) try
+ {
+ Reference< XSimpleFileAccess > xFileAccess( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ xOutStrm = xFileAccess->openFileWrite( rFileName );
+ }
+ catch( Exception& )
+ {
+ }
+ return xOutStrm;
+}
+
+Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const Reference< XOutputStream >& rxOutStrm, const OUString& rEncoding )
+{
+ Reference< XTextOutputStream > xTextOutStrm;
+ if( rxFactory.is() && rxOutStrm.is() ) try
+ {
+ Reference< XActiveDataSource > xDataSource( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW );
+ xDataSource->setOutputStream( rxOutStrm );
+ xTextOutStrm.set( xDataSource, UNO_QUERY_THROW );
+ xTextOutStrm->setEncoding( rEncoding );
+ }
+ catch( Exception& )
+ {
+ }
+ return xTextOutStrm;
+}
+
+Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream(
+ const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName, const OUString& rEncoding )
+{
+ return openTextOutputStream( rxFactory, openOutputStream( rxFactory, rFileName ), rEncoding );
+}
+
+// ============================================================================
+// ============================================================================
+
+ItemFormat::ItemFormat() :
+ meDataType( DATATYPE_VOID ),
+ meFmtType( FORMATTYPE_NONE )
+{
+}
+
+void ItemFormat::set( DataType eDataType, FormatType eFmtType, const OUString& rItemName )
+{
+ meDataType = eDataType;
+ meFmtType = eFmtType;
+ maItemName = rItemName;
+ maListName = OUString();
+}
+
+void ItemFormat::set( DataType eDataType, FormatType eFmtType, const OUString& rItemName, const OUString& rListName )
+{
+ set( eDataType, eFmtType, rItemName );
+ maListName = rListName;
+}
+
+OUStringVector::const_iterator ItemFormat::parse( const OUStringVector& rFormatVec )
+{
+ set( DATATYPE_VOID, FORMATTYPE_NONE, OUString() );
+
+ OUStringVector::const_iterator aIt = rFormatVec.begin(), aEnd = rFormatVec.end();
+ OUString aDataType, aFmtType;
+ if( aIt != aEnd ) aDataType = *aIt++;
+ if( aIt != aEnd ) aFmtType = *aIt++;
+ if( aIt != aEnd ) maItemName = *aIt++;
+ if( aIt != aEnd ) maListName = *aIt++;
+
+ meDataType = StringHelper::convertToDataType( aDataType );
+ meFmtType = StringHelper::convertToFormatType( aFmtType );
+
+ if( meFmtType == FORMATTYPE_NONE )
+ {
+ if( aFmtType.equalsAscii( "unused" ) )
+ set( meDataType, FORMATTYPE_HEX, CREATE_OUSTRING( OOX_DUMP_UNUSED ) );
+ else if( aFmtType.equalsAscii( "unknown" ) )
+ set( meDataType, FORMATTYPE_HEX, CREATE_OUSTRING( OOX_DUMP_UNKNOWN ) );
+ }
+
+ return aIt;
+}
+
+OUStringVector ItemFormat::parse( const OUString& rFormatStr )
+{
+ OUStringVector aFormatVec;
+ StringHelper::convertStringToStringList( aFormatVec, rFormatStr, false );
+ OUStringVector::const_iterator aIt = parse( aFormatVec );
+ return OUStringVector( aIt, const_cast< const OUStringVector& >( aFormatVec ).end() );
+}
+
+// ============================================================================
+// ============================================================================
+
+// append string to string ----------------------------------------------------
+
+void StringHelper::appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount )
+{
+ for( sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex )
+ rStr.append( cChar );
+}
+
+void StringHelper::appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendChar( rStr, cFill, nWidth - rData.getLength() );
+ rStr.append( rData );
+}
+
+// append decimal -------------------------------------------------------------
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( static_cast< sal_Int32 >( nData ) ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( static_cast< sal_Int32 >( nData ) ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( static_cast< sal_Int32 >( nData ) ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( static_cast< sal_Int32 >( nData ) ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( static_cast< sal_Int64 >( nData ) ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( nData ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ /* Values greater than biggest signed 64bit integer will change to
+ negative when converting to sal_Int64. Therefore, the trailing digit
+ will be written separately. */
+ OUStringBuffer aBuffer;
+ if( nData > 9 )
+ aBuffer.append( OUString::valueOf( static_cast< sal_Int64 >( nData / 10 ) ) );
+ aBuffer.append( static_cast< sal_Unicode >( '0' + (nData % 10) ) );
+ appendString( rStr, aBuffer.makeStringAndClear(), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, OUString::valueOf( nData ), nWidth, cFill );
+}
+
+void StringHelper::appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth, sal_Unicode cFill )
+{
+ appendString( rStr, ::rtl::math::doubleToUString( fData, rtl_math_StringFormat_G, 15, '.', true ), nWidth, cFill );
+}
+
+// append hexadecimal ---------------------------------------------------------
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix )
+{
+ static const sal_Unicode spcHexDigits[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
+ if( bPrefix )
+ rStr.appendAscii( "0x" );
+ rStr.append( spcHexDigits[ (nData >> 4) & 0x0F ] ).append( spcHexDigits[ nData & 0x0F ] );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bPrefix );
+ appendHex( rStr, static_cast< sal_uInt8 >( nData ), false );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bPrefix );
+ appendHex( rStr, static_cast< sal_uInt16 >( nData ), false );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt32 >( nData >> 32 ), bPrefix );
+ appendHex( rStr, static_cast< sal_uInt32 >( nData ), false );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix )
+{
+ appendHex( rStr, static_cast< sal_uInt64 >( nData ), bPrefix );
+}
+
+void StringHelper::appendHex( OUStringBuffer& rStr, double fData, bool bPrefix )
+{
+ appendHex( rStr, *reinterpret_cast< const sal_uInt64* >( &fData ), bPrefix );
+}
+
+// append shortened hexadecimal -----------------------------------------------
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix )
+{
+ appendHex( rStr, nData, bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix )
+{
+ appendHex( rStr, nData, bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix )
+{
+ if( nData > SAL_MAX_UINT8 )
+ appendHex( rStr, nData, bPrefix );
+ else
+ appendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix )
+{
+ appendShortHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix )
+{
+ if( nData > SAL_MAX_UINT16 )
+ appendHex( rStr, nData, bPrefix );
+ else
+ appendShortHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix )
+{
+ appendShortHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix )
+{
+ if( nData > SAL_MAX_UINT32 )
+ appendHex( rStr, nData, bPrefix );
+ else
+ appendShortHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix )
+{
+ appendShortHex( rStr, static_cast< sal_uInt64 >( nData ), bPrefix );
+}
+
+void StringHelper::appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix )
+{
+ appendHex( rStr, fData, bPrefix );
+}
+
+// append binary --------------------------------------------------------------
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots )
+{
+ for( sal_uInt8 nMask = 0x80; nMask != 0; (nMask >>= 1) &= 0x7F )
+ {
+ rStr.append( static_cast< sal_Unicode >( (nData & nMask) ? '1' : '0' ) );
+ if( bDots && (nMask == 0x10) )
+ rStr.append( OOX_DUMP_BINDOT );
+ }
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt8 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bDots );
+ if( bDots )
+ rStr.append( OOX_DUMP_BINDOT );
+ appendBin( rStr, static_cast< sal_uInt8 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt16 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bDots );
+ if( bDots )
+ rStr.append( OOX_DUMP_BINDOT );
+ appendBin( rStr, static_cast< sal_uInt16 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt32 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt32 >( nData >> 32 ), bDots );
+ if( bDots )
+ rStr.append( OOX_DUMP_BINDOT );
+ appendBin( rStr, static_cast< sal_uInt32 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots )
+{
+ appendBin( rStr, static_cast< sal_uInt64 >( nData ), bDots );
+}
+
+void StringHelper::appendBin( OUStringBuffer& rStr, double fData, bool bDots )
+{
+ appendBin( rStr, *reinterpret_cast< const sal_uInt64* >( &fData ), bDots );
+}
+
+// append formatted value -----------------------------------------------------
+
+void StringHelper::appendBool( OUStringBuffer& rStr, bool bData )
+{
+ rStr.appendAscii( bData ? "true" : "false" );
+}
+
+// append columns, rows, addresses --------------------------------------------
+
+void StringHelper::appendAddrCol( OUStringBuffer& rStr, sal_Int32 nCol, bool bRel )
+{
+ if( !bRel ) rStr.append( OOX_DUMP_ADDRABS );
+ sal_Int32 nPos = rStr.getLength();
+ for( sal_Int32 nTemp = nCol; nTemp >= 0; (nTemp /= 26) -= 1 )
+ rStr.insert( nPos, static_cast< sal_Unicode >( 'A' + (nTemp % 26) ) );
+}
+
+void StringHelper::appendAddrRow( OUStringBuffer& rStr, sal_Int32 nRow, bool bRel )
+{
+ if( !bRel ) rStr.append( OOX_DUMP_ADDRABS );
+ appendDec( rStr, nRow + 1 );
+}
+
+void StringHelper::appendAddrName( OUStringBuffer& rStr, sal_Unicode cPrefix, sal_Int32 nColRow, bool bRel )
+{
+ rStr.append( cPrefix );
+ if( bRel && (nColRow != 0) )
+ {
+ rStr.append( OOX_DUMP_R1C1OPEN );
+ appendDec( rStr, nColRow );
+ rStr.append( OOX_DUMP_R1C1CLOSE );
+ }
+ else if( !bRel )
+ appendDec( rStr, nColRow + 1 );
+}
+
+void StringHelper::appendAddress( OUStringBuffer& rStr, const Address& rPos )
+{
+ appendAddrCol( rStr, rPos.mnCol, true );
+ appendAddrRow( rStr, rPos.mnRow, true );
+}
+
+void StringHelper::appendRange( OUStringBuffer& rStr, const Range& rRange )
+{
+ appendAddress( rStr, rRange.maFirst );
+ rStr.append( OOX_DUMP_RANGESEP );
+ appendAddress( rStr, rRange.maLast );
+}
+
+void StringHelper::appendRangeList( OUStringBuffer& rStr, const RangeList& rRanges )
+{
+ OUStringBuffer aData;
+ for( RangeList::const_iterator aIt = rRanges.begin(), aEnd = rRanges.end(); aIt != aEnd; ++aIt )
+ {
+ OUStringBuffer aRange;
+ appendRange( aRange, *aIt );
+ appendToken( aData, aRange.makeStringAndClear(), OOX_DUMP_LISTSEP );
+ }
+ rStr.append( aData.makeStringAndClear() );
+}
+
+void StringHelper::appendAddress( OUStringBuffer& rStr, const TokenAddress& rPos, bool bR1C1 )
+{
+ if( bR1C1 && (rPos.mbRelCol || rPos.mbRelRow) )
+ {
+ appendAddrName( rStr, OOX_DUMP_R1C1ROW, rPos.mnRow, rPos.mbRelRow );
+ appendAddrName( rStr, OOX_DUMP_R1C1COL, rPos.mnCol, rPos.mbRelCol );
+ }
+ else
+ {
+ appendAddrCol( rStr, rPos.mnCol, rPos.mbRelCol );
+ appendAddrRow( rStr, rPos.mnRow, rPos.mbRelRow );
+ }
+}
+
+void StringHelper::appendRange( OUStringBuffer& rStr, const TokenRange& rRange, bool bR1C1 )
+{
+ appendAddress( rStr, rRange.maFirst, bR1C1 );
+ rStr.append( OOX_DUMP_RANGESEP );
+ appendAddress( rStr, rRange.maLast, bR1C1 );
+}
+
+// encoded text output --------------------------------------------------------
+
+void StringHelper::appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix )
+{
+ if( cChar > 0x00FF )
+ {
+ if( bPrefix )
+ rStr.appendAscii( "\\u" );
+ appendHex( rStr, static_cast< sal_uInt16 >( cChar ), false );
+ }
+ else
+ {
+ if( bPrefix )
+ rStr.appendAscii( "\\x" );
+ appendHex( rStr, static_cast< sal_uInt8 >( cChar ), false );
+ }
+}
+
+void StringHelper::appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount, bool bPrefix )
+{
+ if( cChar < 0x0020 )
+ {
+ // C-style hex code
+ OUStringBuffer aCode;
+ appendCChar( aCode, cChar, bPrefix );
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ rStr.append( aCode );
+ }
+ else
+ {
+ appendChar( rStr, cChar, nCount );
+ }
+}
+
+void StringHelper::appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix )
+{
+ sal_Int32 nBeg = 0;
+ sal_Int32 nIdx = 0;
+ sal_Int32 nEnd = rData.getLength();
+ while( nIdx < nEnd )
+ {
+ // find next character that needs encoding
+ while( (nIdx < nEnd) && (rData[ nIdx ] >= 0x20) ) ++nIdx;
+ // append portion
+ if( nBeg < nIdx )
+ {
+ if( (nBeg == 0) && (nIdx == nEnd) )
+ rStr.append( rData );
+ else
+ rStr.append( rData.copy( nBeg, nIdx - nBeg ) );
+ }
+ // append characters to be encoded
+ while( (nIdx < nEnd) && (rData[ nIdx ] < 0x20) )
+ {
+ appendCChar( rStr, rData[ nIdx ], bPrefix );
+ ++nIdx;
+ }
+ // adjust limits
+ nBeg = nIdx;
+ }
+}
+
+// token list -----------------------------------------------------------------
+
+void StringHelper::appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep )
+{
+ if( (rStr.getLength() > 0) && (rToken.getLength() > 0) )
+ rStr.append( cSep );
+ rStr.append( rToken );
+}
+
+void StringHelper::appendToken( OUStringBuffer& rStr, sal_Int64 nToken, sal_Unicode cSep )
+{
+ OUStringBuffer aToken;
+ appendDec( aToken, nToken );
+ appendToken( rStr, aToken.makeStringAndClear(), cSep );
+}
+
+void StringHelper::prependToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep )
+{
+ if( (rStr.getLength() > 0) && (rToken.getLength() > 0) )
+ rStr.insert( 0, cSep );
+ rStr.insert( 0, rToken );
+}
+
+void StringHelper::prependToken( OUStringBuffer& rStr, sal_Int64 nToken, sal_Unicode cSep )
+{
+ OUStringBuffer aToken;
+ appendDec( aToken, nToken );
+ prependToken( rStr, aToken.makeStringAndClear(), cSep );
+}
+
+void StringHelper::appendIndex( OUStringBuffer& rStr, const OUString& rIdx )
+{
+ rStr.append( sal_Unicode( '[' ) ).append( rIdx ).append( sal_Unicode( ']' ) );
+}
+
+void StringHelper::appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx )
+{
+ OUStringBuffer aToken;
+ appendDec( aToken, nIdx );
+ appendIndex( rStr, aToken.makeStringAndClear() );
+}
+
+void StringHelper::appendIndexedText( OUStringBuffer& rStr, const OUString& rData, const OUString& rIdx )
+{
+ rStr.append( rData );
+ appendIndex( rStr, rIdx );
+}
+
+void StringHelper::appendIndexedText( OUStringBuffer& rStr, const OUString& rData, sal_Int64 nIdx )
+{
+ rStr.append( rData );
+ appendIndex( rStr, nIdx );
+}
+
+OUString StringHelper::getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep )
+{
+ return trimSpaces( rData.getToken( 0, cSep, rnPos ) );
+}
+
+void StringHelper::enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose )
+{
+ rStr.insert( 0, cOpen ).append( cClose ? cClose : cOpen );
+}
+
+// string conversion ----------------------------------------------------------
+
+namespace {
+
+sal_Int32 lclIndexOf( const OUString& rStr, sal_Unicode cChar, sal_Int32 nStartPos )
+{
+ sal_Int32 nIndex = rStr.indexOf( cChar, nStartPos );
+ return (nIndex < 0) ? rStr.getLength() : nIndex;
+}
+
+OUString lclTrimQuotedStringList( const OUString& rStr )
+{
+ OUStringBuffer aBuffer;
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rStr.getLength();
+ while( nPos < nLen )
+ {
+ if( rStr[ nPos ] == OOX_DUMP_CFG_QUOTE )
+ {
+ // quoted string, skip leading quote character
+ ++nPos;
+ // process quoted text and ambedded literal quote characters
+ OUStringBuffer aToken;
+ do
+ {
+ // seek to next quote character and add text portion to token buffer
+ sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_QUOTE, nPos );
+ aToken.append( rStr.copy( nPos, nEnd - nPos ) );
+ // process literal quotes
+ while( (nEnd + 1 < nLen) && (rStr[ nEnd ] == OOX_DUMP_CFG_QUOTE) && (rStr[ nEnd + 1 ] == OOX_DUMP_CFG_QUOTE) )
+ {
+ aToken.append( OOX_DUMP_CFG_QUOTE );
+ nEnd += 2;
+ }
+ // nEnd is start of possible next text portion
+ nPos = nEnd;
+ }
+ while( (nPos < nLen) && (rStr[ nPos ] != OOX_DUMP_CFG_QUOTE) );
+ // add token, seek to list separator, ignore text following closing quote
+ aBuffer.append( aToken.makeStringAndClear() );
+ nPos = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
+ if( nPos < nLen )
+ aBuffer.append( OOX_DUMP_LF );
+ // set current position behind list separator
+ ++nPos;
+ }
+ else
+ {
+ // find list separator, add token text to buffer
+ sal_Int32 nEnd = lclIndexOf( rStr, OOX_DUMP_CFG_LISTSEP, nPos );
+ aBuffer.append( rStr.copy( nPos, nEnd - nPos ) );
+ if( nEnd < nLen )
+ aBuffer.append( OOX_DUMP_LF );
+ // set current position behind list separator
+ nPos = nEnd + 1;
+ }
+ }
+
+ return aBuffer.makeStringAndClear();
+}
+
+} // namespace
+
+OUString StringHelper::trimSpaces( const OUString& rStr )
+{
+ sal_Int32 nBeg = 0;
+ while( (nBeg < rStr.getLength()) && ((rStr[ nBeg ] == ' ') || (rStr[ nBeg ] == '\t')) )
+ ++nBeg;
+ sal_Int32 nEnd = rStr.getLength();
+ while( (nEnd > nBeg) && ((rStr[ nEnd - 1 ] == ' ') || (rStr[ nEnd - 1 ] == '\t')) )
+ --nEnd;
+ return rStr.copy( nBeg, nEnd - nBeg );
+}
+
+OUString StringHelper::trimTrailingNul( const OUString& rStr )
+{
+ sal_Int32 nLastPos = rStr.getLength() - 1;
+ if( (nLastPos >= 0) && (rStr[ nLastPos ] == 0) )
+ return rStr.copy( 0, nLastPos );
+ return rStr;
+}
+
+OString StringHelper::convertToUtf8( const OUString& rStr )
+{
+ return OUStringToOString( rStr, RTL_TEXTENCODING_UTF8 );
+}
+
+DataType StringHelper::convertToDataType( const OUString& rStr )
+{
+ DataType eType = DATATYPE_VOID;
+ if( rStr.equalsAscii( "int8" ) )
+ eType = DATATYPE_INT8;
+ else if( rStr.equalsAscii( "uint8" ) )
+ eType = DATATYPE_UINT8;
+ else if( rStr.equalsAscii( "int16" ) )
+ eType = DATATYPE_INT16;
+ else if( rStr.equalsAscii( "uint16" ) )
+ eType = DATATYPE_UINT16;
+ else if( rStr.equalsAscii( "int32" ) )
+ eType = DATATYPE_INT32;
+ else if( rStr.equalsAscii( "uint32" ) )
+ eType = DATATYPE_UINT32;
+ else if( rStr.equalsAscii( "int64" ) )
+ eType = DATATYPE_INT64;
+ else if( rStr.equalsAscii( "uint64" ) )
+ eType = DATATYPE_UINT64;
+ else if( rStr.equalsAscii( "float" ) )
+ eType = DATATYPE_FLOAT;
+ else if( rStr.equalsAscii( "double" ) )
+ eType = DATATYPE_DOUBLE;
+ return eType;
+}
+
+FormatType StringHelper::convertToFormatType( const OUString& rStr )
+{
+ FormatType eType = FORMATTYPE_NONE;
+ if( rStr.equalsAscii( "dec" ) )
+ eType = FORMATTYPE_DEC;
+ else if( rStr.equalsAscii( "hex" ) )
+ eType = FORMATTYPE_HEX;
+ else if( rStr.equalsAscii( "shorthex" ) )
+ eType = FORMATTYPE_SHORTHEX;
+ else if( rStr.equalsAscii( "bin" ) )
+ eType = FORMATTYPE_BIN;
+ else if( rStr.equalsAscii( "fix" ) )
+ eType = FORMATTYPE_FIX;
+ else if( rStr.equalsAscii( "bool" ) )
+ eType = FORMATTYPE_BOOL;
+ return eType;
+}
+
+bool StringHelper::convertFromDec( sal_Int64& ornData, const OUString& rData )
+{
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rData.getLength();
+ bool bNeg = false;
+ if( (nLen > 0) && (rData[ 0 ] == '-') )
+ {
+ bNeg = true;
+ ++nPos;
+ }
+ ornData = 0;
+ for( ; nPos < nLen; ++nPos )
+ {
+ sal_Unicode cChar = rData[ nPos ];
+ if( (cChar < '0') || (cChar > '9') )
+ return false;
+ (ornData *= 10) += (cChar - '0');
+ }
+ if( bNeg )
+ ornData *= -1;
+ return true;
+}
+
+bool StringHelper::convertFromHex( sal_Int64& ornData, const OUString& rData )
+{
+ ornData = 0;
+ for( sal_Int32 nPos = 0, nLen = rData.getLength(); nPos < nLen; ++nPos )
+ {
+ sal_Unicode cChar = rData[ nPos ];
+ if( ('0' <= cChar) && (cChar <= '9') )
+ cChar -= '0';
+ else if( ('A' <= cChar) && (cChar <= 'F') )
+ cChar -= ('A' - 10);
+ else if( ('a' <= cChar) && (cChar <= 'f') )
+ cChar -= ('a' - 10);
+ else
+ return false;
+ (ornData <<= 4) += cChar;
+ }
+ return true;
+}
+
+bool StringHelper::convertStringToInt( sal_Int64& ornData, const OUString& rData )
+{
+ if( (rData.getLength() > 2) && (rData[ 0 ] == '0') && ((rData[ 1 ] == 'X') || (rData[ 1 ] == 'x')) )
+ return convertFromHex( ornData, rData.copy( 2 ) );
+ return convertFromDec( ornData, rData );
+}
+
+bool StringHelper::convertStringToDouble( double& orfData, const OUString& rData )
+{
+ rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
+ sal_Int32 nSize = 0;
+ orfData = rtl::math::stringToDouble( rData, '.', '\0', &eStatus, &nSize );
+ return (eStatus == rtl_math_ConversionStatus_Ok) && (nSize == rData.getLength());
+}
+
+bool StringHelper::convertStringToBool( const OUString& rData )
+{
+ if( rData.equalsAscii( "true" ) )
+ return true;
+ if( rData.equalsAscii( "false" ) )
+ return false;
+ sal_Int64 nData;
+ return convertStringToInt( nData, rData ) && (nData != 0);
+}
+
+OUStringPair StringHelper::convertStringToPair( const OUString& rString, sal_Unicode cSep )
+{
+ OUStringPair aPair;
+ if( rString.getLength() > 0 )
+ {
+ sal_Int32 nEqPos = rString.indexOf( cSep );
+ if( nEqPos < 0 )
+ {
+ aPair.first = rString;
+ }
+ else
+ {
+ aPair.first = StringHelper::trimSpaces( rString.copy( 0, nEqPos ) );
+ aPair.second = StringHelper::trimSpaces( rString.copy( nEqPos + 1 ) );
+ }
+ }
+ return aPair;
+}
+
+void StringHelper::convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty )
+{
+ orVec.clear();
+ OUString aUnquotedData = lclTrimQuotedStringList( rData );
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = aUnquotedData.getLength();
+ while( (0 <= nPos) && (nPos < nLen) )
+ {
+ OUString aToken = getToken( aUnquotedData, nPos, OOX_DUMP_LF );
+ if( !bIgnoreEmpty || (aToken.getLength() > 0) )
+ orVec.push_back( aToken );
+ }
+}
+
+void StringHelper::convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty )
+{
+ orVec.clear();
+ OUString aUnquotedData = lclTrimQuotedStringList( rData );
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = aUnquotedData.getLength();
+ sal_Int64 nData;
+ while( (0 <= nPos) && (nPos < nLen) )
+ {
+ bool bOk = convertStringToInt( nData, getToken( aUnquotedData, nPos, OOX_DUMP_LF ) );
+ if( !bIgnoreEmpty || bOk )
+ orVec.push_back( bOk ? nData : 0 );
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+FormulaStack::FormulaStack() :
+ mbError( false )
+{
+}
+
+void FormulaStack::pushOperand( const String& rOp, const OUString& rTokClass )
+{
+ maFmlaStack.push( rOp );
+ maClassStack.push( rTokClass );
+}
+
+void FormulaStack::pushOperand( const String& rOp )
+{
+ pushOperand( rOp, OUString( OOX_DUMP_BASECLASS ) );
+}
+
+void FormulaStack::pushUnaryOp( const String& rLOp, const String& rROp )
+{
+ pushUnaryOp( maFmlaStack, rLOp, rROp );
+ pushUnaryOp( maClassStack, rLOp, rROp );
+}
+
+void FormulaStack::pushBinaryOp( const String& rOp )
+{
+ pushBinaryOp( maFmlaStack, rOp );
+ pushBinaryOp( maClassStack, rOp );
+}
+
+void FormulaStack::pushFuncOp( const String& rFunc, const OUString& rTokClass, sal_uInt8 nParamCount )
+{
+ pushFuncOp( maFmlaStack, rFunc, nParamCount );
+ pushFuncOp( maClassStack, rTokClass, nParamCount );
+}
+
+void FormulaStack::replaceOnTop( const OUString& rOld, const OUString& rNew )
+{
+ if( !maFmlaStack.empty() )
+ {
+ sal_Int32 nPos = maFmlaStack.top().indexOf( rOld );
+ if( nPos >= 0 )
+ maFmlaStack.top() = maFmlaStack.top().copy( 0, nPos ) + rNew + maFmlaStack.top().copy( nPos + rOld.getLength() );
+ }
+}
+
+const OUString& FormulaStack::getString( const StringStack& rStack ) const
+{
+ static const OUString saStackError = OOX_DUMP_ERRSTRING( "stack" );
+ return (mbError || rStack.empty()) ? saStackError : rStack.top();
+}
+
+void FormulaStack::pushUnaryOp( StringStack& rStack, const OUString& rLOp, const OUString& rROp )
+{
+ if( check( !rStack.empty() ) )
+ rStack.top() = rLOp + rStack.top() + rROp;
+}
+
+void FormulaStack::pushBinaryOp( StringStack& rStack, const OUString& rOp )
+{
+ OUString aSecond;
+ if( check( !rStack.empty() ) )
+ {
+ aSecond = rStack.top();
+ rStack.pop();
+ }
+ if( check( !rStack.empty() ) )
+ rStack.top() = rStack.top() + rOp + aSecond;
+}
+
+void FormulaStack::pushFuncOp( StringStack& rStack, const OUString& rOp, sal_uInt8 nParamCount )
+{
+ OUStringBuffer aFunc;
+ for( sal_uInt8 nParam = 0; (nParam < nParamCount) && check( !rStack.empty() ); ++nParam )
+ {
+ StringHelper::prependToken( aFunc, rStack.top(), OOX_DUMP_FUNCSEP );
+ rStack.pop();
+ }
+ StringHelper::enclose( aFunc, '(', ')' );
+ aFunc.insert( 0, rOp );
+ rStack.push( aFunc.makeStringAndClear() );
+}
+
+// ============================================================================
+// ============================================================================
+
+Base::~Base()
+{
+}
+
+// ============================================================================
+// ============================================================================
+
+ConfigItemBase::~ConfigItemBase()
+{
+}
+
+void ConfigItemBase::readConfigBlock( TextInputStream& rStrm )
+{
+ readConfigBlockContents( rStrm );
+}
+
+void ConfigItemBase::implProcessConfigItemStr(
+ TextInputStream& /*rStrm*/, const OUString& /*rKey*/, const OUString& /*rData*/ )
+{
+}
+
+void ConfigItemBase::implProcessConfigItemInt(
+ TextInputStream& /*rStrm*/, sal_Int64 /*nKey*/, const OUString& /*rData*/ )
+{
+}
+
+void ConfigItemBase::readConfigBlockContents( TextInputStream& rStrm )
+{
+ bool bLoop = true;
+ while( bLoop && !rStrm.isEof() )
+ {
+ OUString aKey, aData;
+ switch( readConfigLine( rStrm, aKey, aData ) )
+ {
+ case LINETYPE_DATA:
+ processConfigItem( rStrm, aKey, aData );
+ break;
+ case LINETYPE_END:
+ bLoop = false;
+ break;
+ }
+ }
+}
+
+ConfigItemBase::LineType ConfigItemBase::readConfigLine(
+ TextInputStream& rStrm, OUString& orKey, OUString& orData ) const
+{
+ OUString aLine;
+ while( !rStrm.isEof() && (aLine.getLength() == 0) )
+ {
+ aLine = rStrm.readLine();
+ if( (aLine.getLength() > 0) && (aLine[ 0 ] == OOX_DUMP_BOM) )
+ aLine = aLine.copy( 1 );
+ aLine = StringHelper::trimSpaces( aLine );
+ if( aLine.getLength() > 0 )
+ {
+ // ignore comments (starting with hash or semicolon)
+ sal_Unicode cChar = aLine[ 0 ];
+ if( (cChar == '#') || (cChar == ';') )
+ aLine = OUString();
+ }
+ }
+
+ OUStringPair aPair = StringHelper::convertStringToPair( aLine );
+ orKey = aPair.first;
+ orData = aPair.second;
+ return ((orKey.getLength() > 0) && ((orData.getLength() > 0) || !orKey.equalsAscii( "end" ))) ?
+ LINETYPE_DATA : LINETYPE_END;
+}
+
+ConfigItemBase::LineType ConfigItemBase::readConfigLine( TextInputStream& rStrm ) const
+{
+ OUString aKey, aData;
+ return readConfigLine( rStrm, aKey, aData );
+}
+
+void ConfigItemBase::processConfigItem(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ sal_Int64 nKey;
+ if( StringHelper::convertStringToInt( nKey, rKey ) )
+ implProcessConfigItemInt( rStrm, nKey, rData );
+ else
+ implProcessConfigItemStr( rStrm, rKey, rData );
+}
+
+// ============================================================================
+
+NameListBase::~NameListBase()
+{
+}
+
+void NameListBase::setName( sal_Int64 nKey, const String& rName )
+{
+ implSetName( nKey, rName );
+}
+
+void NameListBase::includeList( const NameListRef& rxList )
+{
+ if( rxList.get() )
+ {
+ for( const_iterator aIt = rxList->begin(), aEnd = rxList->end(); aIt != aEnd; ++aIt )
+ maMap[ aIt->first ] = aIt->second;
+ implIncludeList( *rxList );
+ }
+}
+
+bool NameListBase::implIsValid() const
+{
+ return true;
+}
+
+void NameListBase::implProcessConfigItemStr(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ if( rKey.equalsAscii( "include" ) )
+ include( rData );
+ else if( rKey.equalsAscii( "exclude" ) )
+ exclude( rData );
+ else
+ ConfigItemBase::implProcessConfigItemStr( rStrm, rKey, rData );
+}
+
+void NameListBase::implProcessConfigItemInt(
+ TextInputStream& /*rStrm*/, sal_Int64 nKey, const OUString& rData )
+{
+ implSetName( nKey, rData );
+}
+
+void NameListBase::insertRawName( sal_Int64 nKey, const OUString& rName )
+{
+ maMap[ nKey ] = rName;
+}
+
+const OUString* NameListBase::findRawName( sal_Int64 nKey ) const
+{
+ const_iterator aIt = maMap.find( nKey );
+ return (aIt == end()) ? 0 : &aIt->second;
+}
+
+void NameListBase::include( const OUString& rListKeys )
+{
+ OUStringVector aVec;
+ StringHelper::convertStringToStringList( aVec, rListKeys, true );
+ for( OUStringVector::const_iterator aIt = aVec.begin(), aEnd = aVec.end(); aIt != aEnd; ++aIt )
+ includeList( mrCfgData.getNameList( *aIt ) );
+}
+
+void NameListBase::exclude( const OUString& rKeys )
+{
+ Int64Vector aVec;
+ StringHelper::convertStringToIntList( aVec, rKeys, true );
+ for( Int64Vector::const_iterator aIt = aVec.begin(), aEnd = aVec.end(); aIt != aEnd; ++aIt )
+ maMap.erase( *aIt );
+}
+
+// ============================================================================
+
+void ItemFormatMap::insertFormats( const NameListRef& rxNameList )
+{
+ if( Base::isValid( rxNameList ) )
+ for( NameListBase::const_iterator aIt = rxNameList->begin(), aEnd = rxNameList->end(); aIt != aEnd; ++aIt )
+ (*this)[ aIt->first ].parse( aIt->second );
+}
+
+// ============================================================================
+
+ConstList::ConstList( const SharedConfigData& rCfgData ) :
+ NameListBase( rCfgData ),
+ maDefName( OOX_DUMP_ERR_NONAME ),
+ mbQuoteNames( false )
+{
+}
+
+void ConstList::implProcessConfigItemStr(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ if( rKey.equalsAscii( "default" ) )
+ setDefaultName( rData );
+ else if( rKey.equalsAscii( "quote-names" ) )
+ setQuoteNames( StringHelper::convertStringToBool( rData ) );
+ else
+ NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
+}
+
+void ConstList::implSetName( sal_Int64 nKey, const OUString& rName )
+{
+ insertRawName( nKey, rName );
+}
+
+OUString ConstList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const
+{
+ const OUString* pName = findRawName( nKey );
+ OUString aName = pName ? *pName : maDefName;
+ if( mbQuoteNames )
+ {
+ OUStringBuffer aBuffer( aName );
+ StringHelper::enclose( aBuffer, OOX_DUMP_STRQUOTE );
+ aName = aBuffer.makeStringAndClear();
+ }
+ return aName;
+}
+
+OUString ConstList::implGetNameDbl( const Config& /*rCfg*/, double /*fValue*/ ) const
+{
+ return OUString();
+}
+
+void ConstList::implIncludeList( const NameListBase& rList )
+{
+ if( const ConstList* pConstList = dynamic_cast< const ConstList* >( &rList ) )
+ {
+ maDefName = pConstList->maDefName;
+ mbQuoteNames = pConstList->mbQuoteNames;
+ }
+}
+
+// ============================================================================
+
+MultiList::MultiList( const SharedConfigData& rCfgData ) :
+ ConstList( rCfgData ),
+ mbIgnoreEmpty( true )
+{
+}
+
+void MultiList::setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames )
+{
+ sal_Int64 nKey = nStartKey;
+ for( OUStringVector::const_iterator aIt = rNames.begin(), aEnd = rNames.end(); aIt != aEnd; ++aIt, ++nKey )
+ if( !mbIgnoreEmpty || (aIt->getLength() > 0) )
+ insertRawName( nKey, *aIt );
+}
+
+void MultiList::implProcessConfigItemStr(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ if( rKey.equalsAscii( "ignore-empty" ) )
+ mbIgnoreEmpty = StringHelper::convertStringToBool( rData );
+ else
+ ConstList::implProcessConfigItemStr( rStrm, rKey, rData );
+}
+
+void MultiList::implSetName( sal_Int64 nKey, const OUString& rName )
+{
+ OUStringVector aNames;
+ StringHelper::convertStringToStringList( aNames, rName, false );
+ setNamesFromVec( nKey, aNames );
+}
+
+// ============================================================================
+
+FlagsList::FlagsList( const SharedConfigData& rCfgData ) :
+ NameListBase( rCfgData ),
+ mnIgnore( 0 )
+{
+}
+
+void FlagsList::implProcessConfigItemStr(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ if( rKey.equalsAscii( "ignore" ) )
+ {
+ sal_Int64 nIgnore;
+ if( StringHelper::convertStringToInt( nIgnore, rData ) )
+ setIgnoreFlags( nIgnore );
+ }
+ else
+ {
+ NameListBase::implProcessConfigItemStr( rStrm, rKey, rData );
+ }
+}
+
+void FlagsList::implSetName( sal_Int64 nKey, const OUString& rName )
+{
+ if( (nKey != 0) && ((nKey & (nKey - 1)) == 0) ) // only a single bit set?
+ insertRawName( nKey, rName );
+}
+
+OUString FlagsList::implGetName( const Config& /*rCfg*/, sal_Int64 nKey ) const
+{
+ sal_Int64 nFound = mnIgnore;
+ OUStringBuffer aName;
+ // add known flags
+ for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ {
+ sal_Int64 nMask = aIt->first;
+ setFlag( nFound, nMask );
+ if( !getFlag( mnIgnore, nMask ) )
+ {
+ const OUString& rFlagName = aIt->second;
+ bool bOnOff = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == ':');
+ bool bFlag = getFlag( nKey, nMask );
+ if( bOnOff )
+ {
+ StringHelper::appendToken( aName, rFlagName.copy( 1 ) );
+ aName.appendAscii( bFlag ? ":on" : ":off" );
+ }
+ else
+ {
+ bool bNegated = (rFlagName.getLength() > 0) && (rFlagName[ 0 ] == '!');
+ sal_Int32 nBothSep = bNegated ? rFlagName.indexOf( '!', 1 ) : -1;
+ if( bFlag )
+ {
+ if( !bNegated )
+ StringHelper::appendToken( aName, rFlagName );
+ else if( nBothSep > 0 )
+ StringHelper::appendToken( aName, rFlagName.copy( nBothSep + 1 ) );
+ }
+ else if( bNegated )
+ {
+ if( nBothSep > 0 )
+ StringHelper::appendToken( aName, rFlagName.copy( 1, nBothSep - 1 ) );
+ else
+ StringHelper::appendToken( aName, rFlagName.copy( 1 ) );
+ }
+ }
+ }
+ }
+ // add unknown flags
+ setFlag( nKey, nFound, false );
+ if( nKey != 0 )
+ {
+ OUStringBuffer aUnknown( CREATE_OUSTRING( OOX_DUMP_UNKNOWN ) );
+ aUnknown.append( OOX_DUMP_ITEMSEP );
+ StringHelper::appendShortHex( aUnknown, nKey, true );
+ StringHelper::enclose( aUnknown, '(', ')' );
+ StringHelper::appendToken( aName, aUnknown.makeStringAndClear() );
+ }
+ return aName.makeStringAndClear();
+}
+
+OUString FlagsList::implGetNameDbl( const Config& /*rCfg*/, double /*fValue*/ ) const
+{
+ return OUString();
+}
+
+void FlagsList::implIncludeList( const NameListBase& rList )
+{
+ if( const FlagsList* pFlagsList = dynamic_cast< const FlagsList* >( &rList ) )
+ mnIgnore = pFlagsList->mnIgnore;
+}
+
+// ============================================================================
+
+bool CombiList::ExtItemFormatKey::operator<( const ExtItemFormatKey& rRight ) const
+{
+ return (mnKey < rRight.mnKey) || ((mnKey == rRight.mnKey) && (maFilter < rRight.maFilter));
+}
+
+CombiList::CombiList( const SharedConfigData& rCfgData ) :
+ FlagsList( rCfgData )
+{
+}
+
+void CombiList::implSetName( sal_Int64 nKey, const OUString& rName )
+{
+ if( (nKey & (nKey - 1)) != 0 ) // more than a single bit set?
+ {
+ typedef ::std::set< ExtItemFormatKey > ExtItemFormatKeySet;
+ ::std::set< ExtItemFormatKey > aItemKeys;
+ ExtItemFormat aItemFmt;
+ OUStringVector aRemain = aItemFmt.parse( rName );
+ for( OUStringVector::iterator aIt = aRemain.begin(), aEnd = aRemain.end(); aIt != aEnd; ++aIt )
+ {
+ OUStringPair aPair = StringHelper::convertStringToPair( *aIt );
+ if( aPair.first.equalsAscii( "noshift" ) )
+ {
+ aItemFmt.mbShiftValue = StringHelper::convertStringToBool( aPair.second );
+ }
+ else if( aPair.first.equalsAscii( "filter" ) )
+ {
+ OUStringPair aFilter = StringHelper::convertStringToPair( aPair.second, '~' );
+ ExtItemFormatKey aKey( nKey );
+ if( (aFilter.first.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.first, aFilter.first ) &&
+ (aFilter.second.getLength() > 0) && StringHelper::convertStringToInt( aKey.maFilter.second, aFilter.second ) )
+ {
+ if( aKey.maFilter.first == 0 )
+ aKey.maFilter.second = 0;
+ aItemKeys.insert( aKey );
+ }
+ }
+ }
+ if( aItemKeys.empty() )
+ aItemKeys.insert( ExtItemFormatKey( nKey ) );
+ for( ExtItemFormatKeySet::iterator aIt = aItemKeys.begin(), aEnd = aItemKeys.end(); aIt != aEnd; ++aIt )
+ maFmtMap[ *aIt ] = aItemFmt;
+ }
+ else
+ {
+ FlagsList::implSetName( nKey, rName );
+ }
+}
+
+OUString CombiList::implGetName( const Config& rCfg, sal_Int64 nKey ) const
+{
+ sal_Int64 nFound = 0;
+ OUStringBuffer aName;
+ // add known flag fields
+ for( ExtItemFormatMap::const_iterator aIt = maFmtMap.begin(), aEnd = maFmtMap.end(); aIt != aEnd; ++aIt )
+ {
+ const ExtItemFormatKey& rMapKey = aIt->first;
+ sal_Int64 nMask = rMapKey.mnKey;
+ if( (nMask != 0) && ((nKey & rMapKey.maFilter.first) == rMapKey.maFilter.second) )
+ {
+ const ExtItemFormat& rItemFmt = aIt->second;
+
+ sal_uInt64 nUFlags = static_cast< sal_uInt64 >( nKey );
+ sal_uInt64 nUMask = static_cast< sal_uInt64 >( nMask );
+ if( rItemFmt.mbShiftValue )
+ while( (nUMask & 1) == 0 ) { nUFlags >>= 1; nUMask >>= 1; }
+
+ sal_uInt64 nUValue = nUFlags & nUMask;
+ sal_Int64 nSValue = static_cast< sal_Int64 >( nUValue );
+ if( getFlag< sal_uInt64 >( nUValue, (nUMask + 1) >> 1 ) )
+ setFlag( nSValue, static_cast< sal_Int64 >( ~nUMask ) );
+
+ OUStringBuffer aItem( rItemFmt.maItemName );
+ OUStringBuffer aValue;
+ switch( rItemFmt.meDataType )
+ {
+ case DATATYPE_INT8: StringHelper::appendValue( aValue, static_cast< sal_Int8 >( nSValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_UINT8: StringHelper::appendValue( aValue, static_cast< sal_uInt8 >( nUValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_INT16: StringHelper::appendValue( aValue, static_cast< sal_Int16 >( nSValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_UINT16: StringHelper::appendValue( aValue, static_cast< sal_uInt16 >( nUValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_INT32: StringHelper::appendValue( aValue, static_cast< sal_Int32 >( nSValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_UINT32: StringHelper::appendValue( aValue, static_cast< sal_uInt32 >( nUValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_INT64: StringHelper::appendValue( aValue, nSValue, rItemFmt.meFmtType ); break;
+ case DATATYPE_UINT64: StringHelper::appendValue( aValue, nUValue, rItemFmt.meFmtType ); break;
+ case DATATYPE_FLOAT: StringHelper::appendValue( aValue, static_cast< float >( nSValue ), rItemFmt.meFmtType ); break;
+ case DATATYPE_DOUBLE: StringHelper::appendValue( aValue, static_cast< double >( nSValue ), rItemFmt.meFmtType ); break;
+ default:;
+ }
+ StringHelper::appendToken( aItem, aValue.makeStringAndClear(), OOX_DUMP_ITEMSEP );
+ if( rItemFmt.maListName.getLength() > 0 )
+ {
+ OUString aValueName = rCfg.getName( rItemFmt.maListName, static_cast< sal_Int64 >( nUValue ) );
+ StringHelper::appendToken( aItem, aValueName, OOX_DUMP_ITEMSEP );
+ }
+ StringHelper::enclose( aItem, '(', ')' );
+ StringHelper::appendToken( aName, aItem.makeStringAndClear() );
+ setFlag( nFound, nMask );
+ }
+ }
+ setFlag( nKey, nFound, false );
+ StringHelper::appendToken( aName, FlagsList::implGetName( rCfg, nKey ) );
+ return aName.makeStringAndClear();
+}
+
+void CombiList::implIncludeList( const NameListBase& rList )
+{
+ if( const CombiList* pCombiList = dynamic_cast< const CombiList* >( &rList ) )
+ maFmtMap = pCombiList->maFmtMap;
+ FlagsList::implIncludeList( rList );
+}
+
+// ============================================================================
+
+UnitConverter::UnitConverter( const SharedConfigData& rCfgData ) :
+ NameListBase( rCfgData ),
+ mfFactor( 1.0 )
+{
+}
+
+void UnitConverter::implSetName( sal_Int64 /*nKey*/, const OUString& /*rName*/ )
+{
+ // nothing to do
+}
+
+OUString UnitConverter::implGetName( const Config& rCfg, sal_Int64 nKey ) const
+{
+ return implGetNameDbl( rCfg, static_cast< double >( nKey ) );
+}
+
+OUString UnitConverter::implGetNameDbl( const Config& /*rCfg*/, double fValue ) const
+{
+ OUStringBuffer aValue;
+ StringHelper::appendDec( aValue, mfFactor * fValue );
+ aValue.append( maUnitName );
+ return aValue.makeStringAndClear();
+}
+
+void UnitConverter::implIncludeList( const NameListBase& /*rList*/ )
+{
+}
+
+// ============================================================================
+
+NameListRef NameListWrapper::getNameList( const Config& rCfg ) const
+{
+ return mxList.get() ? mxList : (mxList = rCfg.getNameList( maName ));
+}
+
+// ============================================================================
+// ============================================================================
+
+SharedConfigData::SharedConfigData( const OUString& rFileName,
+ const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg,
+ const OUString& rSysFileName, MediaDescriptor& rMediaDesc ) :
+ mxFactory( rxFactory ),
+ mxRootStrg( rxRootStrg ),
+ maSysFileName( rSysFileName ),
+ mrMediaDesc( rMediaDesc ),
+ mbLoaded( false ),
+ mbPwCancelled( false )
+{
+ OUString aFileUrl = InputOutputHelper::convertFileNameToUrl( rFileName );
+ if( aFileUrl.getLength() > 0 )
+ {
+ sal_Int32 nNamePos = InputOutputHelper::getFileNamePos( aFileUrl );
+ maConfigPath = aFileUrl.copy( 0, nNamePos );
+ mbLoaded = readConfigFile( aFileUrl );
+ }
+}
+
+SharedConfigData::~SharedConfigData()
+{
+}
+
+void SharedConfigData::setOption( const OUString& rKey, const OUString& rData )
+{
+ maConfigData[ rKey ] = rData;
+}
+
+const OUString* SharedConfigData::getOption( const OUString& rKey ) const
+{
+ ConfigDataMap::const_iterator aIt = maConfigData.find( rKey );
+ return (aIt == maConfigData.end()) ? 0 : &aIt->second;
+}
+
+void SharedConfigData::setNameList( const OUString& rListName, const NameListRef& rxList )
+{
+ if( rListName.getLength() > 0 )
+ maNameLists[ rListName ] = rxList;
+}
+
+void SharedConfigData::eraseNameList( const OUString& rListName )
+{
+ maNameLists.erase( rListName );
+}
+
+NameListRef SharedConfigData::getNameList( const OUString& rListName ) const
+{
+ NameListRef xList;
+ NameListMap::const_iterator aIt = maNameLists.find( rListName );
+ if( aIt != maNameLists.end() )
+ xList = aIt->second;
+ return xList;
+}
+
+Sequence< NamedValue > SharedConfigData::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
+{
+ Sequence< NamedValue > aEncryptionData;
+ if( !mbPwCancelled )
+ {
+ ::std::vector< OUString > aDefaultPasswords;
+ aDefaultPasswords.push_back( CREATE_OUSTRING( "VelvetSweatshop" ) );
+ aEncryptionData = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
+ rVerifier, mrMediaDesc, ::comphelper::DocPasswordRequestType_MS, &aDefaultPasswords );
+ mbPwCancelled = !aEncryptionData.hasElements();
+ }
+ return aEncryptionData;
+}
+
+bool SharedConfigData::implIsValid() const
+{
+ return mbLoaded && mxFactory.is() && mxRootStrg.get() && (maSysFileName.getLength() > 0);
+}
+
+void SharedConfigData::implProcessConfigItemStr(
+ TextInputStream& rStrm, const OUString& rKey, const OUString& rData )
+{
+ if( rKey.equalsAscii( "include-config-file" ) )
+ readConfigFile( maConfigPath + rData );
+ else if( rKey.equalsAscii( "constlist" ) )
+ readNameList< ConstList >( rStrm, rData );
+ else if( rKey.equalsAscii( "multilist" ) )
+ readNameList< MultiList >( rStrm, rData );
+ else if( rKey.equalsAscii( "flagslist" ) )
+ readNameList< FlagsList >( rStrm, rData );
+ else if( rKey.equalsAscii( "combilist" ) )
+ readNameList< CombiList >( rStrm, rData );
+ else if( rKey.equalsAscii( "shortlist" ) )
+ createShortList( rData );
+ else if( rKey.equalsAscii( "unitconverter" ) )
+ createUnitConverter( rData );
+ else
+ setOption( rKey, rData );
+}
+
+bool SharedConfigData::readConfigFile( const OUString& rFileUrl )
+{
+ bool bLoaded = maConfigFiles.count( rFileUrl ) > 0;
+ if( !bLoaded )
+ {
+ Reference< XInputStream > xInStrm = InputOutputHelper::openInputStream( mxFactory, rFileUrl );
+ BinaryXInputStream aInStrm( xInStrm, true );
+ TextInputStream aTxtStrm( aInStrm, RTL_TEXTENCODING_UTF8 );
+ if( !aTxtStrm.isEof() )
+ {
+ maConfigFiles.insert( rFileUrl );
+ readConfigBlockContents( aTxtStrm );
+ bLoaded = true;
+ }
+ }
+ return bLoaded;
+}
+
+void SharedConfigData::createShortList( const OUString& rData )
+{
+ OUStringVector aDataVec;
+ StringHelper::convertStringToStringList( aDataVec, rData, false );
+ if( aDataVec.size() >= 3 )
+ {
+ sal_Int64 nStartKey;
+ if( StringHelper::convertStringToInt( nStartKey, aDataVec[ 1 ] ) )
+ {
+ ::boost::shared_ptr< MultiList > xList = createNameList< MultiList >( aDataVec[ 0 ] );
+ if( xList.get() )
+ {
+ aDataVec.erase( aDataVec.begin(), aDataVec.begin() + 2 );
+ xList->setNamesFromVec( nStartKey, aDataVec );
+ }
+ }
+ }
+}
+
+void SharedConfigData::createUnitConverter( const OUString& rData )
+{
+ OUStringVector aDataVec;
+ StringHelper::convertStringToStringList( aDataVec, rData, false );
+ if( aDataVec.size() >= 2 )
+ {
+ OUString aFactor = aDataVec[ 1 ];
+ bool bRecip = (aFactor.getLength() > 0) && (aFactor[ 0 ] == '/');
+ if( bRecip )
+ aFactor = aFactor.copy( 1 );
+ double fFactor;
+ if( StringHelper::convertStringToDouble( fFactor, aFactor ) && (fFactor != 0.0) )
+ {
+ ::boost::shared_ptr< UnitConverter > xList = createNameList< UnitConverter >( aDataVec[ 0 ] );
+ if( xList.get() )
+ {
+ xList->setFactor( bRecip ? (1.0 / fFactor) : fFactor );
+ if( aDataVec.size() >= 3 )
+ xList->setUnitName( aDataVec[ 2 ] );
+ }
+ }
+ }
+}
+
+// ============================================================================
+
+Config::Config( const Config& rParent ) :
+ Base() // c'tor needs to be called explicitly to avoid compiler warning
+{
+ construct( rParent );
+}
+
+Config::Config( const sal_Char* pcEnvVar, const FilterBase& rFilter )
+{
+ construct( pcEnvVar, rFilter );
+}
+
+Config::Config( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
+{
+ construct( pcEnvVar, rxFactory, rxRootStrg, rSysFileName, rMediaDesc );
+}
+
+Config::~Config()
+{
+}
+
+void Config::construct( const Config& rParent )
+{
+ *this = rParent;
+}
+
+void Config::construct( const sal_Char* pcEnvVar, const FilterBase& rFilter )
+{
+ if( rFilter.getFileUrl().getLength() > 0 )
+ construct( pcEnvVar, rFilter.getServiceFactory(), rFilter.getStorage(), rFilter.getFileUrl(), rFilter.getMediaDescriptor() );
+}
+
+void Config::construct( const sal_Char* pcEnvVar, const Reference< XMultiServiceFactory >& rxFactory, const StorageRef& rxRootStrg, const OUString& rSysFileName, MediaDescriptor& rMediaDesc )
+{
+ if( pcEnvVar && rxRootStrg.get() && (rSysFileName.getLength() > 0) )
+ if( const sal_Char* pcFileName = ::getenv( pcEnvVar ) )
+ mxCfgData.reset( new SharedConfigData( OUString::createFromAscii( pcFileName ), rxFactory, rxRootStrg, rSysFileName, rMediaDesc ) );
+}
+
+void Config::setStringOption( const String& rKey, const String& rData )
+{
+ mxCfgData->setOption( rKey, rData );
+}
+
+const OUString& Config::getStringOption( const String& rKey, const OUString& rDefault ) const
+{
+ const OUString* pData = implGetOption( rKey );
+ return pData ? *pData : rDefault;
+}
+
+bool Config::getBoolOption( const String& rKey, bool bDefault ) const
+{
+ const OUString* pData = implGetOption( rKey );
+ return pData ? StringHelper::convertStringToBool( *pData ) : bDefault;
+}
+
+bool Config::isDumperEnabled() const
+{
+ return getBoolOption( "enable-dumper", false );
+}
+
+bool Config::isImportEnabled() const
+{
+ return getBoolOption( "enable-import", true );
+}
+
+void Config::setNameList( const String& rListName, const NameListRef& rxList )
+{
+ mxCfgData->setNameList( rListName, rxList );
+}
+
+void Config::eraseNameList( const String& rListName )
+{
+ mxCfgData->eraseNameList( rListName );
+}
+
+NameListRef Config::getNameList( const String& rListName ) const
+{
+ return implGetNameList( rListName );
+}
+
+Sequence< NamedValue > Config::requestEncryptionData( ::comphelper::IDocPasswordVerifier& rVerifier )
+{
+ return mxCfgData->requestEncryptionData( rVerifier );
+}
+
+bool Config::isPasswordCancelled() const
+{
+ return mxCfgData->isPasswordCancelled();
+}
+
+bool Config::implIsValid() const
+{
+ return isValid( mxCfgData );
+}
+
+const OUString* Config::implGetOption( const OUString& rKey ) const
+{
+ return mxCfgData->getOption( rKey );
+}
+
+NameListRef Config::implGetNameList( const OUString& rListName ) const
+{
+ return mxCfgData->getNameList( rListName );
+}
+
+// ============================================================================
+// ============================================================================
+
+Output::Output( const Reference< XTextOutputStream >& rxStrm )
+{
+ construct( rxStrm );
+}
+
+Output::Output( const Reference< XMultiServiceFactory >& rxFactory, const OUString& rFileName )
+{
+ construct( InputOutputHelper::openTextOutputStream( rxFactory, rFileName, CREATE_OUSTRING( "UTF-8" ) ) );
+}
+
+// ----------------------------------------------------------------------------
+
+void Output::newLine()
+{
+ if( maLine.getLength() > 0 )
+ {
+ mxStrm->writeString( maIndent );
+ maLine.append( sal_Unicode( '\n' ) );
+ mxStrm->writeString( maLine.makeStringAndClear() );
+ mnCol = 0;
+ mnLastItem = 0;
+ }
+}
+
+void Output::emptyLine( size_t nCount )
+{
+ for( size_t nIdx = 0; nIdx < nCount; ++nIdx )
+ mxStrm->writeString( OUString( sal_Unicode( '\n' ) ) );
+}
+
+void Output::incIndent()
+{
+ OUStringBuffer aBuffer( maIndent );
+ StringHelper::appendChar( aBuffer, ' ', OOX_DUMP_INDENT );
+ maIndent = aBuffer.makeStringAndClear();
+}
+
+void Output::decIndent()
+{
+ if( maIndent.getLength() >= OOX_DUMP_INDENT )
+ maIndent = maIndent.copy( OOX_DUMP_INDENT );
+}
+
+void Output::resetIndent()
+{
+ maIndent = OUString();
+}
+
+void Output::startTable( sal_Int32 nW1 )
+{
+ startTable( 1, &nW1 );
+}
+
+void Output::startTable( sal_Int32 nW1, sal_Int32 nW2 )
+{
+ sal_Int32 pnColWidths[ 2 ];
+ pnColWidths[ 0 ] = nW1;
+ pnColWidths[ 1 ] = nW2;
+ startTable( 2, pnColWidths );
+}
+
+void Output::startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3 )
+{
+ sal_Int32 pnColWidths[ 3 ];
+ pnColWidths[ 0 ] = nW1;
+ pnColWidths[ 1 ] = nW2;
+ pnColWidths[ 2 ] = nW3;
+ startTable( 3, pnColWidths );
+}
+
+void Output::startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 )
+{
+ sal_Int32 pnColWidths[ 4 ];
+ pnColWidths[ 0 ] = nW1;
+ pnColWidths[ 1 ] = nW2;
+ pnColWidths[ 2 ] = nW3;
+ pnColWidths[ 3 ] = nW4;
+ startTable( 4, pnColWidths );
+}
+
+void Output::startTable( size_t nColCount, const sal_Int32* pnColWidths )
+{
+ maColPos.clear();
+ maColPos.push_back( 0 );
+ sal_Int32 nColPos = 0;
+ for( size_t nCol = 0; nCol < nColCount; ++nCol )
+ {
+ nColPos = nColPos + pnColWidths[ nCol ];
+ maColPos.push_back( nColPos );
+ }
+}
+
+void Output::tab()
+{
+ tab( mnCol + 1 );
+}
+
+void Output::tab( size_t nCol )
+{
+ mnCol = nCol;
+ if( mnCol < maColPos.size() )
+ {
+ sal_Int32 nColPos = maColPos[ mnCol ];
+ if( maLine.getLength() >= nColPos )
+ maLine.setLength( ::std::max< sal_Int32 >( nColPos - 1, 0 ) );
+ StringHelper::appendChar( maLine, ' ', nColPos - maLine.getLength() );
+ }
+ else
+ {
+ StringHelper::appendChar( maLine, ' ', 2 );
+ }
+}
+
+void Output::endTable()
+{
+ maColPos.clear();
+}
+
+void Output::resetItemIndex( sal_Int64 nIdx )
+{
+ mnItemIdx = nIdx;
+}
+
+void Output::startItem( const String& rItemName )
+{
+ if( mnItemLevel == 0 )
+ {
+ if( (mnMultiLevel > 0) && (maLine.getLength() > 0) )
+ tab();
+ if( rItemName.has() )
+ {
+ writeItemName( rItemName );
+ writeChar( OOX_DUMP_ITEMSEP );
+ }
+ }
+ ++mnItemLevel;
+ mnLastItem = maLine.getLength();
+}
+
+void Output::contItem()
+{
+ if( mnItemLevel > 0 )
+ {
+ if( (maLine.getLength() == 0) || (maLine[ maLine.getLength() - 1 ] != OOX_DUMP_ITEMSEP) )
+ writeChar( OOX_DUMP_ITEMSEP );
+ mnLastItem = maLine.getLength();
+ }
+}
+
+void Output::endItem()
+{
+ if( mnItemLevel > 0 )
+ {
+ maLastItem = OUString( maLine.getStr() + mnLastItem );
+ if( (maLastItem.getLength() == 0) && (mnLastItem > 0) && (maLine[ mnLastItem - 1 ] == OOX_DUMP_ITEMSEP) )
+ maLine.setLength( mnLastItem - 1 );
+ --mnItemLevel;
+ }
+ if( mnItemLevel == 0 )
+ {
+ if( mnMultiLevel == 0 )
+ newLine();
+ }
+ else
+ contItem();
+}
+
+void Output::startMultiItems()
+{
+ ++mnMultiLevel;
+}
+
+void Output::endMultiItems()
+{
+ if( mnMultiLevel > 0 )
+ --mnMultiLevel;
+ if( mnMultiLevel == 0 )
+ newLine();
+}
+
+// ----------------------------------------------------------------------------
+
+void Output::writeChar( sal_Unicode cChar, sal_Int32 nCount )
+{
+ StringHelper::appendEncChar( maLine, cChar, nCount );
+}
+
+void Output::writeAscii( const sal_Char* pcStr )
+{
+ if( pcStr )
+ maLine.appendAscii( pcStr );
+}
+
+void Output::writeString( const OUString& rStr )
+{
+ StringHelper::appendEncString( maLine, rStr );
+}
+
+void Output::writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
+{
+ const sal_uInt8* pnEnd = pnData ? (pnData + nSize) : 0;
+ for( const sal_uInt8* pnByte = pnData; pnByte < pnEnd; ++pnByte )
+ {
+ if( pnByte > pnData )
+ writeChar( cSep );
+ writeHex( *pnByte, false );
+ }
+}
+
+void Output::writeBool( bool bData )
+{
+ StringHelper::appendBool( maLine, bData );
+}
+
+void Output::writeColorABGR( sal_Int32 nColor )
+{
+ writeChar( 'a' );
+ writeDec( static_cast< sal_uInt8 >( nColor >> 24 ) );
+ writeAscii( ",r" );
+ writeDec( static_cast< sal_uInt8 >( nColor ) );
+ writeAscii( ",g" );
+ writeDec( static_cast< sal_uInt8 >( nColor >> 8 ) );
+ writeAscii( ",b" );
+ writeDec( static_cast< sal_uInt8 >( nColor >> 16 ) );
+}
+
+void Output::writeDateTime( const DateTime& rDateTime )
+{
+ writeDec( rDateTime.Year, 4, '0' );
+ writeChar( '-' );
+ writeDec( rDateTime.Month, 2, '0' );
+ writeChar( '-' );
+ writeDec( rDateTime.Day, 2, '0' );
+ writeChar( 'T' );
+ writeDec( rDateTime.Hours, 2, '0' );
+ writeChar( ':' );
+ writeDec( rDateTime.Minutes, 2, '0' );
+ writeChar( ':' );
+ writeDec( rDateTime.Seconds, 2, '0' );
+}
+
+void Output::writeColIndex( sal_Int32 nCol )
+{
+ StringHelper::appendAddrCol( maLine, nCol, true );
+}
+
+void Output::writeRowIndex( sal_Int32 nRow )
+{
+ StringHelper::appendAddrRow( maLine, nRow, true );
+}
+
+void Output::writeColRowRange( sal_Int32 nColRow1, sal_Int32 nColRow2 )
+{
+ writeDec( nColRow1 );
+ writeChar( OOX_DUMP_RANGESEP );
+ writeDec( nColRow2 );
+}
+
+void Output::writeColRange( sal_Int32 nCol1, sal_Int32 nCol2 )
+{
+ writeColIndex( nCol1 );
+ writeChar( OOX_DUMP_RANGESEP );
+ writeColIndex( nCol2 );
+}
+
+void Output::writeRowRange( sal_Int32 nRow1, sal_Int32 nRow2 )
+{
+ writeRowIndex( nRow1 );
+ writeChar( OOX_DUMP_RANGESEP );
+ writeRowIndex( nRow2 );
+}
+
+void Output::writeAddress( const Address& rPos )
+{
+ StringHelper::appendAddress( maLine, rPos );
+}
+
+void Output::writeRange( const Range& rRange )
+{
+ StringHelper::appendRange( maLine, rRange );
+}
+
+void Output::writeRangeList( const RangeList& rRanges )
+{
+ StringHelper::appendRangeList( maLine, rRanges );
+}
+
+// ----------------------------------------------------------------------------
+
+void Output::construct( const Reference< XTextOutputStream >& rxStrm )
+{
+ mxStrm = rxStrm;
+ mnCol = mnItemLevel = mnMultiLevel = 0;
+ mnItemIdx = 0;
+ mnLastItem = 0;
+ if( mxStrm.is() )
+ {
+ writeChar( OOX_DUMP_BOM );
+ newLine();
+ }
+}
+
+bool Output::implIsValid() const
+{
+ return mxStrm.is();
+}
+
+void Output::writeItemName( const String& rItemName )
+{
+ if( rItemName.has() && (rItemName[ 0 ] == '#') )
+ {
+ writeString( rItemName.copy( 1 ) );
+ StringHelper::appendIndex( maLine, mnItemIdx++ );
+ }
+ else
+ writeString( rItemName );
+}
+
+// ============================================================================
+
+StorageIterator::StorageIterator( const StorageRef& rxStrg ) :
+ mxStrg( rxStrg )
+{
+ if( mxStrg.get() )
+ mxStrg->getElementNames( maNames );
+ maIt = maNames.begin();
+}
+
+StorageIterator::~StorageIterator()
+{
+}
+
+size_t StorageIterator::getElementCount() const
+{
+ return maNames.size();
+}
+
+StorageIterator& StorageIterator::operator++()
+{
+ if( maIt != maNames.end() )
+ ++maIt;
+ return *this;
+}
+
+OUString StorageIterator::getName() const
+{
+ OUString aName;
+ if( maIt != maNames.end() )
+ aName = *maIt;
+ return aName;
+}
+
+bool StorageIterator::isStream() const
+{
+ return isValid() && mxStrg->openInputStream( *maIt ).is();
+}
+
+bool StorageIterator::isStorage() const
+{
+ if( !isValid() )
+ return false;
+ StorageRef xStrg = mxStrg->openSubStorage( *maIt, false );
+ return xStrg.get() && xStrg->isStorage();
+}
+
+bool StorageIterator::implIsValid() const
+{
+ return mxStrg.get() && mxStrg->isStorage() && (maIt != maNames.end());
+}
+
+// ============================================================================
+// ============================================================================
+
+ObjectBase::~ObjectBase()
+{
+}
+
+void ObjectBase::construct( const ConfigRef& rxConfig )
+{
+ mxConfig = rxConfig;
+}
+
+void ObjectBase::construct( const ObjectBase& rParent )
+{
+ *this = rParent;
+}
+
+void ObjectBase::dump()
+{
+ if( isValid() )
+ implDump();
+}
+
+bool ObjectBase::implIsValid() const
+{
+ return isValid( mxConfig );
+}
+
+void ObjectBase::implDump()
+{
+}
+
+void ObjectBase::reconstructConfig( const ConfigRef& rxConfig )
+{
+ if( isValid( rxConfig ) )
+ mxConfig = rxConfig;
+}
+
+// ============================================================================
+// ============================================================================
+
+void StorageObjectBase::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
+{
+ ObjectBase::construct( rParent );
+ mxStrg = rxStrg;
+ maSysPath = rSysPath;
+}
+
+void StorageObjectBase::construct( const ObjectBase& rParent )
+{
+ ObjectBase::construct( rParent );
+ if( ObjectBase::implIsValid() )
+ {
+ mxStrg = cfg().getRootStorage();
+ maSysPath = cfg().getSysFileName();
+ }
+}
+
+bool StorageObjectBase::implIsValid() const
+{
+ return mxStrg.get() && (maSysPath.getLength() > 0) && ObjectBase::implIsValid();
+}
+
+void StorageObjectBase::implDump()
+{
+ bool bIsStrg = mxStrg->isStorage();
+ bool bIsRoot = mxStrg->isRootStorage();
+ Reference< XInputStream > xBaseStrm;
+ if( !bIsStrg )
+ xBaseStrm = mxStrg->openInputStream( OUString() );
+
+ OUString aSysOutPath = maSysPath;
+ if( bIsRoot ) try
+ {
+ aSysOutPath += OOX_DUMP_DUMPEXT;
+ Reference< XSimpleFileAccess > xFileAccess( getFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY_THROW );
+ xFileAccess->kill( aSysOutPath );
+ }
+ catch( Exception& )
+ {
+ }
+
+ if( bIsStrg )
+ {
+ extractStorage( mxStrg, OUString(), aSysOutPath );
+ }
+ else if( xBaseStrm.is() )
+ {
+ BinaryInputStreamRef xInStrm( new BinaryXInputStream( xBaseStrm, false ) );
+ xInStrm->seekToStart();
+ implDumpBaseStream( xInStrm, aSysOutPath );
+ }
+}
+
+void StorageObjectBase::implDumpStream( const BinaryInputStreamRef&, const OUString&, const OUString&, const OUString& )
+{
+}
+
+void StorageObjectBase::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+ extractStorage( rxStrg, rStrgPath, rSysPath );
+}
+
+void StorageObjectBase::implDumpBaseStream( const BinaryInputStreamRef&, const OUString& )
+{
+}
+
+void StorageObjectBase::addPreferredStream( const String& rStrmName )
+{
+ if( rStrmName.has() )
+ maPreferred.push_back( PreferredItem( rStrmName, false ) );
+}
+
+void StorageObjectBase::addPreferredStorage( const String& rStrgPath )
+{
+ if( rStrgPath.has() )
+ maPreferred.push_back( PreferredItem( rStrgPath, true ) );
+}
+
+OUString StorageObjectBase::getSysFileName( const OUString& rStrmName, const OUString& rSysOutPath )
+{
+ // encode all characters < 0x20
+ OUStringBuffer aBuffer;
+ StringHelper::appendEncString( aBuffer, rStrmName, false );
+
+ // replace all characters reserved in file system
+ OUString aFileName = aBuffer.makeStringAndClear();
+ static const sal_Unicode spcReserved[] = { '/', '\\', ':', '*', '?', '<', '>', '|' };
+ for( const sal_Unicode* pcChar = spcReserved; pcChar < STATIC_ARRAY_END( spcReserved ); ++pcChar )
+ aFileName = aFileName.replace( *pcChar, '_' );
+
+ // build full path
+ return rSysOutPath + OUString( sal_Unicode( '/' ) ) + aFileName;
+}
+
+void StorageObjectBase::extractStream( StorageBase& rStrg, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ BinaryXInputStream aInStrm( rStrg.openInputStream( rStrmName ), true );
+ if( !aInStrm.isEof() )
+ {
+ BinaryXOutputStream aOutStrm( InputOutputHelper::openOutputStream( getFactory(), rSysFileName ), true );
+ if( !aOutStrm.isEof() )
+ aInStrm.copyToStream( aOutStrm );
+ }
+ BinaryXInputStreamRef xDumpStrm( new BinaryXInputStream( InputOutputHelper::openInputStream( getFactory(), rSysFileName ), true ) );
+ if( !xDumpStrm->isEof() )
+ implDumpStream( xDumpStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void StorageObjectBase::extractStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+ // create directory in file system
+ ::osl::FileBase::RC eRes = ::osl::Directory::create( rSysPath );
+ if( (eRes != ::osl::FileBase::E_None) && (eRes != ::osl::FileBase::E_EXIST) )
+ return;
+
+ // process preferred storages and streams in root storage first
+ if( rStrgPath.getLength() == 0 )
+ for( PreferredItemVector::iterator aIt = maPreferred.begin(), aEnd = maPreferred.end(); aIt != aEnd; ++aIt )
+ extractItem( rxStrg, rStrgPath, aIt->maName, rSysPath, aIt->mbStorage, !aIt->mbStorage );
+
+ // process children of the storage
+ for( StorageIterator aIt( rxStrg ); aIt.isValid(); ++aIt )
+ {
+ // skip processed preferred items
+ OUString aItemName = aIt.getName();
+ bool bFound = false;
+ if( rStrgPath.getLength() == 0 )
+ for( PreferredItemVector::iterator aIIt = maPreferred.begin(), aIEnd = maPreferred.end(); !bFound && (aIIt != aIEnd); ++aIIt )
+ bFound = aIIt->maName == aItemName;
+ if( !bFound )
+ extractItem( rxStrg, rStrgPath, aItemName, rSysPath, aIt.isStorage(), aIt.isStream() );
+ }
+}
+
+void StorageObjectBase::extractItem( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rItemName, const OUString& rSysPath, bool bIsStrg, bool bIsStrm )
+{
+ OUString aSysFileName = getSysFileName( rItemName, rSysPath );
+ if( bIsStrg )
+ {
+ OUStringBuffer aStrgPath( rStrgPath );
+ StringHelper::appendToken( aStrgPath, rItemName, '/' );
+ implDumpStorage( rxStrg->openSubStorage( rItemName, false ), aStrgPath.makeStringAndClear(), aSysFileName );
+ }
+ else if( bIsStrm )
+ {
+ extractStream( *rxStrg, rStrgPath, rItemName, aSysFileName );
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+OutputObjectBase::~OutputObjectBase()
+{
+}
+
+void OutputObjectBase::construct( const ObjectBase& rParent, const OUString& rSysFileName )
+{
+ ObjectBase::construct( rParent );
+ if( ObjectBase::implIsValid() )
+ mxOut.reset( new Output( getFactory(), rSysFileName + OOX_DUMP_DUMPEXT ) );
+}
+
+void OutputObjectBase::construct( const ObjectBase& rParent, const OutputRef& rxOut )
+{
+ ObjectBase::construct( rParent );
+ mxOut = rxOut;
+}
+
+void OutputObjectBase::construct( const OutputObjectBase& rParent )
+{
+ *this = rParent;
+}
+
+bool OutputObjectBase::implIsValid() const
+{
+ return isValid( mxOut ) && ObjectBase::implIsValid();
+}
+
+void OutputObjectBase::writeEmptyItem( const String& rName )
+{
+ ItemGuard aItem( mxOut, rName );
+}
+
+void OutputObjectBase::writeInfoItem( const String& rName, const String& rData )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rData );
+}
+
+void OutputObjectBase::writeCharItem( const String& rName, sal_Unicode cData )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeChar( cData );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+}
+
+void OutputObjectBase::writeStringItem( const String& rName, const OUString& rData )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeAscii( "(len=" );
+ mxOut->writeDec( rData.getLength() );
+ mxOut->writeAscii( ")," );
+ OUStringBuffer aValue( rData.copy( 0, ::std::min( rData.getLength(), OOX_DUMP_MAXSTRLEN ) ) );
+ StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE );
+ mxOut->writeString( aValue.makeStringAndClear() );
+ if( rData.getLength() > OOX_DUMP_MAXSTRLEN )
+ mxOut->writeAscii( ",cut" );
+}
+
+void OutputObjectBase::writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeArray( pnData, nSize, cSep );
+}
+
+void OutputObjectBase::writeBoolItem( const String& rName, bool bData )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeBool( bData );
+}
+
+double OutputObjectBase::writeRkItem( const String& rName, sal_Int32 nRk )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( rName, static_cast< sal_uInt32 >( nRk ), "RK-FLAGS" );
+ double fValue = ::oox::xls::BiffHelper::calcDoubleFromRk( nRk );
+ writeDecItem( "decoded", fValue );
+ return fValue;
+}
+
+void OutputObjectBase::writeColorABGRItem( const String& rName, sal_Int32 nColor )
+{
+ ItemGuard aItem( mxOut, rName );
+ writeHexItem( rName, nColor );
+ mxOut->writeColorABGR( nColor );
+}
+
+void OutputObjectBase::writeDateTimeItem( const String& rName, const DateTime& rDateTime )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDateTime( rDateTime );
+}
+
+void OutputObjectBase::writeGuidItem( const String& rName, const OUString& rGuid )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rGuid );
+ aItem.cont();
+ mxOut->writeString( cfg().getStringOption( rGuid, OUString() ) );
+}
+
+void OutputObjectBase::writeColIndexItem( const String& rName, sal_Int32 nCol )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nCol );
+ aItem.cont();
+ mxOut->writeColIndex( nCol );
+}
+
+void OutputObjectBase::writeRowIndexItem( const String& rName, sal_Int32 nRow )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nRow );
+ aItem.cont();
+ mxOut->writeRowIndex( nRow );
+}
+
+void OutputObjectBase::writeColRangeItem( const String& rName, sal_Int32 nCol1, sal_Int32 nCol2 )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeColRowRange( nCol1, nCol2 );
+ aItem.cont();
+ mxOut->writeColRange( nCol1, nCol2 );
+}
+
+void OutputObjectBase::writeRowRangeItem( const String& rName, sal_Int32 nRow1, sal_Int32 nRow2 )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeColRowRange( nRow1, nRow2 );
+ aItem.cont();
+ mxOut->writeRowRange( nRow1, nRow2 );
+}
+
+void OutputObjectBase::writeAddressItem( const String& rName, const Address& rPos )
+{
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendAddress( mxOut->getLine(), rPos );
+}
+
+void OutputObjectBase::writeRangeItem( const String& rName, const Range& rRange )
+{
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendRange( mxOut->getLine(), rRange );
+}
+
+void OutputObjectBase::writeRangeListItem( const String& rName, const RangeList& rRanges )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( rName );
+ writeDecItem( "count", static_cast< sal_uInt16 >( rRanges.size() ) );
+ ItemGuard aItem( mxOut, "ranges" );
+ StringHelper::appendRangeList( mxOut->getLine(), rRanges );
+}
+
+void OutputObjectBase::writeTokenAddressItem( const String& rName, const TokenAddress& rPos, bool bNameMode )
+{
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendAddress( mxOut->getLine(), rPos, bNameMode );
+}
+
+void OutputObjectBase::writeTokenAddress3dItem( const String& rName, const OUString& rRef, const TokenAddress& rPos, bool bNameMode )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rRef );
+ StringHelper::appendAddress( mxOut->getLine(), rPos, bNameMode );
+}
+
+void OutputObjectBase::writeTokenRangeItem( const String& rName, const TokenRange& rRange, bool bNameMode )
+{
+ ItemGuard aItem( mxOut, rName );
+ StringHelper::appendRange( mxOut->getLine(), rRange, bNameMode );
+}
+
+void OutputObjectBase::writeTokenRange3dItem( const String& rName, const OUString& rRef, const TokenRange& rRange, bool bNameMode )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeString( rRef );
+ StringHelper::appendRange( mxOut->getLine(), rRange, bNameMode );
+}
+
+// ============================================================================
+// ============================================================================
+
+InputObjectBase::~InputObjectBase()
+{
+}
+
+void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ OutputObjectBase::construct( rParent, rSysFileName );
+ mxStrm = rxStrm;
+}
+
+void InputObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OutputRef& rxOut )
+{
+ OutputObjectBase::construct( rParent, rxOut );
+ mxStrm = rxStrm;
+}
+
+void InputObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
+{
+ OutputObjectBase::construct( rParent );
+ mxStrm = rxStrm;
+}
+
+void InputObjectBase::construct( const InputObjectBase& rParent )
+{
+ *this = rParent;
+}
+
+bool InputObjectBase::implIsValid() const
+{
+ return mxStrm.get() && OutputObjectBase::implIsValid();
+}
+
+void InputObjectBase::skipBlock( sal_Int64 nBytes, bool bShowSize )
+{
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() );
+ if( mxStrm->tell() < nEndPos )
+ {
+ if( bShowSize )
+ writeDecItem( "skipped-data-size", static_cast< sal_uInt64 >( nEndPos - mxStrm->tell() ) );
+ mxStrm->seek( nEndPos );
+ }
+}
+
+void InputObjectBase::dumpRawBinary( sal_Int64 nBytes, bool bShowOffset, bool bStream )
+{
+ TableGuard aTabGuard( mxOut,
+ bShowOffset ? 12 : 0,
+ 3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
+ 3 * OOX_DUMP_BYTESPERLINE / 2 + 1,
+ OOX_DUMP_BYTESPERLINE / 2 + 1 );
+
+ sal_Int64 nMaxShowSize = cfg().getIntOption< sal_Int64 >(
+ bStream ? "max-binary-stream-size" : "max-binary-data-size", SAL_MAX_INT64 );
+
+ bool bSeekable = mxStrm->getLength() >= 0;
+ sal_Int64 nEndPos = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nBytes, mxStrm->getLength() ) : 0;
+ sal_Int64 nDumpEnd = bSeekable ? ::std::min< sal_Int64 >( mxStrm->tell() + nMaxShowSize, nEndPos ) : nMaxShowSize;
+ sal_Int64 nPos = bSeekable ? mxStrm->tell() : 0;
+ bool bLoop = true;
+
+ while( bLoop && (nPos < nDumpEnd) )
+ {
+ mxOut->writeHex( static_cast< sal_uInt32 >( nPos ) );
+ mxOut->tab();
+
+ sal_uInt8 pnLineData[ OOX_DUMP_BYTESPERLINE ];
+ sal_Int32 nLineSize = bSeekable ? ::std::min( static_cast< sal_Int32 >( nDumpEnd - mxStrm->tell() ), OOX_DUMP_BYTESPERLINE ) : OOX_DUMP_BYTESPERLINE;
+ sal_Int32 nReadSize = mxStrm->readMemory( pnLineData, nLineSize );
+ bLoop = nReadSize == nLineSize;
+ nPos += nReadSize;
+
+ if( nReadSize > 0 )
+ {
+ const sal_uInt8* pnByte = 0;
+ const sal_uInt8* pnEnd = 0;
+ for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
+ {
+ if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
+ mxOut->writeHex( *pnByte, false );
+ mxOut->writeChar( ' ' );
+ }
+
+ aTabGuard.tab( 3 );
+ for( pnByte = pnLineData, pnEnd = pnLineData + nReadSize; pnByte != pnEnd; ++pnByte )
+ {
+ if( (pnByte - pnLineData) == (OOX_DUMP_BYTESPERLINE / 2) ) mxOut->tab();
+ mxOut->writeChar( static_cast< sal_Unicode >( (*pnByte < 0x20) ? '.' : *pnByte ) );
+ }
+ mxOut->newLine();
+ }
+ }
+
+ // skip undumped data
+ if( bSeekable )
+ skipBlock( nEndPos - mxStrm->tell() );
+}
+
+void InputObjectBase::dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset )
+{
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( rName );
+ writeDecItem( "size", nBytes );
+ }
+ IndentGuard aIndGuard( mxOut );
+ dumpRawBinary( nBytes, bShowOffset );
+}
+
+void InputObjectBase::dumpRemaining( sal_Int64 nBytes )
+{
+ if( nBytes > 0 )
+ {
+ if( cfg().getBoolOption( "show-trailing-unknown", true ) )
+ dumpBinary( "remaining-data", nBytes, false );
+ else
+ skipBlock( nBytes );
+ }
+}
+
+void InputObjectBase::dumpRemainingTo( sal_Int64 nPos )
+{
+ if( mxStrm->isEof() || (mxStrm->tell() > nPos) )
+ writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
+ else
+ dumpRemaining( nPos - mxStrm->tell() );
+ mxStrm->seek( nPos );
+}
+
+void InputObjectBase::dumpRemainingStream()
+{
+ dumpRemainingTo( mxStrm->getLength() );
+}
+
+void InputObjectBase::dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep )
+{
+ sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nBytes );
+ if( nDumpSize > OOX_DUMP_MAXARRAY )
+ {
+ dumpBinary( rName, nBytes, false );
+ }
+ else if( nDumpSize > 1 )
+ {
+ sal_uInt8 pnData[ OOX_DUMP_MAXARRAY ];
+ mxStrm->readMemory( pnData, nDumpSize );
+ writeArrayItem( rName, pnData, nDumpSize, cSep );
+ }
+ else if( nDumpSize == 1 )
+ dumpHex< sal_uInt8 >( rName );
+}
+
+sal_Unicode InputObjectBase::dumpChar( const String& rName, rtl_TextEncoding eTextEnc )
+{
+ sal_uInt8 nChar;
+ *mxStrm >> nChar;
+ OUString aChar = OStringToOUString( OString( static_cast< sal_Char >( nChar ) ), eTextEnc );
+ sal_Unicode cChar = (aChar.getLength() > 0) ? aChar[ 0 ] : 0;
+ writeCharItem( rName( "char" ), cChar );
+ return cChar;
+}
+
+sal_Unicode InputObjectBase::dumpUnicode( const String& rName )
+{
+ sal_uInt16 nChar;
+ *mxStrm >> nChar;
+ sal_Unicode cChar = static_cast< sal_Unicode >( nChar );
+ writeCharItem( rName( "char" ), cChar );
+ return cChar;
+}
+
+OUString InputObjectBase::dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul )
+{
+ sal_Int32 nDumpSize = getLimitedValue< sal_Int32, sal_Int64 >( mxStrm->getLength() - mxStrm->tell(), 0, nLen );
+ OUString aString;
+ if( nDumpSize > 0 )
+ {
+ ::std::vector< sal_Char > aBuffer( static_cast< sal_Size >( nLen ) + 1 );
+ sal_Int32 nCharsRead = mxStrm->readMemory( &aBuffer.front(), nLen );
+ aBuffer[ nCharsRead ] = 0;
+ aString = OStringToOUString( OString( &aBuffer.front() ), eTextEnc );
+ }
+ if( bHideTrailingNul )
+ aString = StringHelper::trimTrailingNul( aString );
+ writeStringItem( rName( "text" ), aString );
+ return aString;
+}
+
+OUString InputObjectBase::dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul )
+{
+ OUStringBuffer aBuffer;
+ for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nLen); ++nIndex )
+ aBuffer.append( static_cast< sal_Unicode >( mxStrm->readuInt16() ) );
+ OUString aString = aBuffer.makeStringAndClear();
+ if( bHideTrailingNul )
+ aString = StringHelper::trimTrailingNul( aString );
+ writeStringItem( rName( "text" ), aString );
+ return aString;
+}
+
+OUString InputObjectBase::dumpNullCharArray( const String& rName, rtl_TextEncoding eTextEnc )
+{
+ OStringBuffer aBuffer;
+ sal_uInt8 nChar;
+ for( *mxStrm >> nChar; !mxStrm->isEof() && (nChar > 0); *mxStrm >> nChar )
+ aBuffer.append( static_cast< sal_Char >( nChar ) );
+ OUString aString = OStringToOUString( aBuffer.makeStringAndClear(), eTextEnc );
+ writeStringItem( rName( "text" ), aString );
+ return aString;
+}
+
+OUString InputObjectBase::dumpNullUnicodeArray( const String& rName )
+{
+ OUStringBuffer aBuffer;
+ sal_uInt16 nChar;
+ for( *mxStrm >> nChar; !mxStrm->isEof() && (nChar > 0); *mxStrm >> nChar )
+ aBuffer.append( static_cast< sal_Unicode >( nChar ) );
+ OUString aString = aBuffer.makeStringAndClear();
+ writeStringItem( rName( "text" ), aString );
+ return aString;
+}
+
+double InputObjectBase::dumpRk( const String& rName )
+{
+ sal_Int32 nRk;
+ *mxStrm >> nRk;
+ return writeRkItem( rName( "rk-value" ), nRk );
+}
+
+sal_Int32 InputObjectBase::dumpColorABGR( const String& rName )
+{
+ sal_Int32 nColor;
+ *mxStrm >> nColor;
+ writeColorABGRItem( rName( "color" ), nColor );
+ return nColor;
+}
+
+DateTime InputObjectBase::dumpFileTime( const String& rName )
+{
+ DateTime aDateTime;
+
+ ItemGuard aItem( mxOut, rName( "file-time" ) );
+ sal_Int64 nFileTime = dumpDec< sal_Int64 >( EMPTY_STRING );
+ // file time is in 10^-7 seconds (100 nanoseconds), convert to 1/100 seconds
+ nFileTime /= 100000;
+ // entire days
+ sal_Int64 nDays = nFileTime / sal_Int64( 360000 * 24 );
+ // number of entire years
+ sal_Int64 nYears = (nDays - (nDays / (4 * 365)) + (nDays / (100 * 365)) - (nDays / (400 * 365))) / 365;
+ // remaining days in the year
+ sal_Int64 nDaysInYear = nDays - (nYears * 365 + nYears / 4 - nYears / 100 + nYears / 400);
+ // the year (file dates start from 1601-01-01)
+ aDateTime.Year = static_cast< sal_uInt16 >( 1601 + nYears );
+ // leap year?
+ bool bLeap = ((aDateTime.Year % 4 == 0) && (aDateTime.Year % 100 != 0)) || (aDateTime.Year % 400 == 0);
+ // static arrays with number of days in month
+ static const sal_Int64 spnDaysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ static const sal_Int64 spnDaysInMonthL[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ const sal_Int64* pnDaysInMonth = bLeap ? spnDaysInMonthL : spnDaysInMonth;
+ // the month
+ aDateTime.Month = 1;
+ while( nDaysInYear >= *pnDaysInMonth )
+ {
+ nDaysInYear -= *pnDaysInMonth++;
+ ++aDateTime.Month;
+ }
+ // the day
+ aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
+ // number of 1/100 seconds in the day
+ sal_Int64 nTimeInDay = nFileTime % sal_Int64( 360000 * 24 );
+ // 1/100 seconds
+ aDateTime.HundredthSeconds = static_cast< sal_uInt16 >( nTimeInDay % 100 );
+ nTimeInDay /= 100;
+ // seconds
+ aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 );
+ nTimeInDay /= 60;
+ // minutes
+ aDateTime.Minutes = static_cast< sal_uInt16 >( nTimeInDay % 60 );
+ nTimeInDay /= 60;
+ // hours
+ aDateTime.Hours = static_cast< sal_uInt16 >( nTimeInDay );
+
+ writeDateTimeItem( EMPTY_STRING, aDateTime );
+ return aDateTime;
+}
+
+OUString InputObjectBase::dumpGuid( const String& rName )
+{
+ OUStringBuffer aBuffer;
+ sal_uInt32 nData32;
+ sal_uInt16 nData16;
+ sal_uInt8 nData8;
+
+ *mxStrm >> nData32;
+ StringHelper::appendHex( aBuffer, nData32, false );
+ aBuffer.append( sal_Unicode( '-' ) );
+ *mxStrm >> nData16;
+ StringHelper::appendHex( aBuffer, nData16, false );
+ aBuffer.append( sal_Unicode( '-' ) );
+ *mxStrm >> nData16;
+ StringHelper::appendHex( aBuffer, nData16, false );
+ aBuffer.append( sal_Unicode( '-' ) );
+ *mxStrm >> nData8;
+ StringHelper::appendHex( aBuffer, nData8, false );
+ *mxStrm >> nData8;
+ StringHelper::appendHex( aBuffer, nData8, false );
+ aBuffer.append( sal_Unicode( '-' ) );
+ for( int nIndex = 0; nIndex < 6; ++nIndex )
+ {
+ *mxStrm >> nData8;
+ StringHelper::appendHex( aBuffer, nData8, false );
+ }
+ StringHelper::enclose( aBuffer, '{', '}' );
+ OUString aGuid = aBuffer.makeStringAndClear();
+ writeGuidItem( rName( "guid" ), aGuid );
+ return aGuid;
+}
+
+void InputObjectBase::dumpItem( const ItemFormat& rItemFmt )
+{
+ switch( rItemFmt.meDataType )
+ {
+ case DATATYPE_VOID: break;
+ case DATATYPE_INT8: dumpValue< sal_Int8 >( rItemFmt ); break;
+ case DATATYPE_UINT8: dumpValue< sal_uInt8 >( rItemFmt ); break;
+ case DATATYPE_INT16: dumpValue< sal_Int16 >( rItemFmt ); break;
+ case DATATYPE_UINT16: dumpValue< sal_uInt16 >( rItemFmt ); break;
+ case DATATYPE_INT32: dumpValue< sal_Int32 >( rItemFmt ); break;
+ case DATATYPE_UINT32: dumpValue< sal_uInt32 >( rItemFmt ); break;
+ case DATATYPE_INT64: dumpValue< sal_Int64 >( rItemFmt ); break;
+ case DATATYPE_UINT64: dumpValue< sal_uInt64 >( rItemFmt ); break;
+ case DATATYPE_FLOAT: dumpValue< float >( rItemFmt ); break;
+ case DATATYPE_DOUBLE: dumpValue< double >( rItemFmt ); break;
+ default:;
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+BinaryStreamObject::BinaryStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+BinaryStreamObject::BinaryStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm )
+{
+ InputObjectBase::construct( rParent, rxStrm );
+}
+
+void BinaryStreamObject::dumpBinaryStream( bool bShowOffset )
+{
+ mxStrm->seekToStart();
+ dumpRawBinary( mxStrm->getLength(), bShowOffset, true );
+ mxOut->emptyLine();
+}
+
+void BinaryStreamObject::implDump()
+{
+ dumpBinaryStream();
+}
+
+// ============================================================================
+
+TextStreamObject::TextStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc, const OUString& rSysFileName )
+{
+ InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+ if( rxStrm.get() )
+ mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) );
+}
+
+TextStreamObject::TextStreamObject( const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, rtl_TextEncoding eTextEnc )
+{
+ InputObjectBase::construct( rParent, rxStrm );
+ if( rxStrm.get() )
+ mxTextStrm.reset( new TextInputStream( *rxStrm, eTextEnc ) );
+}
+
+bool TextStreamObject::implIsValid() const
+{
+ return InputObjectBase::implIsValid() && mxTextStrm.get();
+}
+
+void TextStreamObject::implDump()
+{
+ OUString aLine;
+ sal_uInt32 nLine = 0;
+ while( !mxTextStrm->isEof() )
+ {
+ aLine = mxTextStrm->readLine();
+ if( !mxTextStrm->isEof() )
+ implDumpLine( aLine, ++nLine );
+ }
+ mxOut->emptyLine();
+}
+
+void TextStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 nLine )
+{
+ TableGuard aTabGuard( mxOut, 8 );
+ mxOut->writeDec( nLine, 6 );
+ mxOut->tab();
+ mxOut->writeString( rLine );
+ mxOut->newLine();
+}
+
+// ============================================================================
+
+XmlStreamObject::XmlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
+ TextStreamObject( rParent, rxStrm, RTL_TEXTENCODING_UTF8, rSysFileName )
+{
+}
+
+void XmlStreamObject::implDump()
+{
+ maIncompleteLine = OUString();
+ TextStreamObject::implDump();
+ if( maIncompleteLine.getLength() > 0 )
+ {
+ mxOut->resetIndent();
+ mxOut->writeString( maIncompleteLine );
+ mxOut->emptyLine();
+ writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
+ }
+}
+
+void XmlStreamObject::implDumpLine( const OUString& rLine, sal_uInt32 )
+{
+ // build input line from cached incomplete element and new text data
+ OUStringBuffer aLine;
+ if( maIncompleteLine.getLength() > 0 )
+ aLine.append( maIncompleteLine ).append( sal_Unicode( ' ' ) );
+ aLine.append( rLine );
+ maIncompleteLine = OUString();
+
+ if( aLine.getLength() == 0 )
+ {
+ mxOut->newLine();
+ return;
+ }
+
+ const sal_Unicode* pcPos = aLine.getStr();
+ const sal_Unicode* pcEnd = pcPos + aLine.getLength();
+ while( pcPos < pcEnd )
+ {
+ OUStringBuffer aOutLine;
+ bool bIsStartElement = false;
+ bool bIsComplElement = false;
+ bool bIsEndElement = false;
+
+ /* check for start element at beginning of the line - pcEnd and thus (pcPos+1)
+ are dereferenceable, because OUStringBuffer::getStr is null-terminated. */
+ if( (*pcPos == '<') && (pcPos[ 1 ] != '/') )
+ {
+ const sal_Unicode* pcElementEnd = ::std::find( pcPos, pcEnd, '>' );
+ if( pcElementEnd == pcEnd )
+ {
+ // incomplete start element
+ maIncompleteLine = OUString( pcPos, static_cast< sal_Int32 >( pcEnd - pcPos ) );
+ pcPos = pcEnd;
+ }
+ else
+ {
+ bIsComplElement = (pcPos[ 1 ] == '?') || (pcPos[ 1 ] == '!') || (pcElementEnd[ -1 ] == '/');
+ bIsStartElement = !bIsComplElement;
+ ++pcElementEnd;
+ aOutLine.append( pcPos, static_cast< sal_Int32 >( pcElementEnd - pcPos ) );
+ pcPos = pcElementEnd;
+ }
+ }
+
+ // check for following element text
+ if( !bIsComplElement && (pcPos < pcEnd) )
+ {
+ const sal_Unicode* pcElementStart = ::std::find( pcPos, pcEnd, '<' );
+ // append text between elements
+ if( pcPos < pcElementStart )
+ {
+ OUString aText( pcPos, static_cast< sal_Int32 >( pcElementStart - pcPos ) );
+ if( aText.trim().getLength() > 0 )
+ aOutLine.append( aText );
+ pcPos = pcElementStart;
+ }
+ }
+
+ // check for stand-alone or following end element
+ if( !bIsComplElement && (pcPos < pcEnd) && (pcPos[ 1 ] == '/') )
+ {
+ const sal_Unicode* pcElementEnd = ::std::find( pcPos, pcEnd, '>' );
+ if( pcElementEnd == pcEnd )
+ {
+ // incomplete end element
+ aOutLine.append( pcPos, static_cast< sal_Int32 >( pcEnd - pcPos ) );
+ maIncompleteLine = aOutLine.makeStringAndClear();
+ pcPos = pcEnd;
+ }
+ else
+ {
+ bIsEndElement = true;
+ ++pcElementEnd;
+ aOutLine.append( pcPos, static_cast< sal_Int32 >( pcElementEnd - pcPos ) );
+ pcPos = pcElementEnd;
+ }
+ }
+
+ // flush output line
+ if( maIncompleteLine.getLength() == 0 )
+ {
+ if( !bIsStartElement && bIsEndElement ) mxOut->decIndent();
+ mxOut->writeString( aOutLine.makeStringAndClear() );
+ mxOut->newLine();
+ if( bIsStartElement && !bIsEndElement ) mxOut->incIndent();
+ }
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+void RecordObjectBase::construct( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm, const OUString& rSysFileName,
+ const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
+{
+ InputObjectBase::construct( rParent, rxRecStrm, rSysFileName );
+ constructRecObjBase( rxBaseStrm, rRecNames, rSimpleRecs );
+}
+
+void RecordObjectBase::construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxBaseStrm,
+ const BinaryInputStreamRef& rxRecStrm, const String& rRecNames, const String& rSimpleRecs )
+{
+ InputObjectBase::construct( rParent, rxRecStrm );
+ constructRecObjBase( rxBaseStrm, rRecNames, rSimpleRecs );
+}
+
+bool RecordObjectBase::implIsValid() const
+{
+ return mxBaseStrm.get() && InputObjectBase::implIsValid();
+}
+
+void RecordObjectBase::implDump()
+{
+ NameListRef xRecNames = getRecNames();
+ ItemFormatMap aSimpleRecs( maSimpleRecs.getNameList( cfg() ) );
+
+ while( implStartRecord( *mxBaseStrm, mnRecPos, mnRecId, mnRecSize ) )
+ {
+ // record header
+ mxOut->emptyLine();
+ writeHeader();
+ implWriteExtHeader();
+ IndentGuard aIndGuard( mxOut );
+ sal_Int64 nRecPos = mxStrm->tell();
+
+ // record body
+ if( !mbBinaryOnly && cfg().hasName( xRecNames, mnRecId ) )
+ {
+ ItemFormatMap::const_iterator aIt = aSimpleRecs.find( mnRecId );
+ if( aIt != aSimpleRecs.end() )
+ dumpItem( aIt->second );
+ else
+ implDumpRecordBody();
+ }
+
+ // remaining undumped data
+ if( !mxStrm->isEof() && (mxStrm->tell() == nRecPos) )
+ dumpRawBinary( mnRecSize, false );
+ else
+ dumpRemainingTo( nRecPos + mnRecSize );
+ }
+}
+
+void RecordObjectBase::implWriteExtHeader()
+{
+}
+
+void RecordObjectBase::implDumpRecordBody()
+{
+}
+
+void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseStrm, const String& rRecNames, const String& rSimpleRecs )
+{
+ mxBaseStrm = rxBaseStrm;
+ maRecNames = rRecNames;
+ maSimpleRecs = rSimpleRecs;
+ mnRecPos = mnRecId = mnRecSize = 0;
+ mbBinaryOnly = false;
+ if( InputObjectBase::implIsValid() )
+ mbShowRecPos = cfg().getBoolOption( "show-record-position", true );
+}
+
+void RecordObjectBase::writeHeader()
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "REC" );
+ if( mbShowRecPos && mxBaseStrm->isSeekable() )
+ writeShortHexItem( "pos", mnRecPos, "CONV-DEC" );
+ writeShortHexItem( "size", mnRecSize, "CONV-DEC" );
+ ItemGuard aItem( mxOut, "id" );
+ mxOut->writeShortHex( mnRecId );
+ addNameToItem( mnRecId, "CONV-DEC" );
+ addNameToItem( mnRecId, maRecNames );
+}
+
+// ============================================================================
+
+void SequenceRecordObjectBase::construct( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm, const ::rtl::OUString& rSysFileName,
+ const String& rRecNames, const String& rSimpleRecs )
+{
+ BinaryInputStreamRef xRecStrm( new SequenceInputStream( *mxRecData ) );
+ RecordObjectBase::construct( rParent, rxBaseStrm, rSysFileName, xRecStrm, rRecNames, rSimpleRecs );
+}
+
+void SequenceRecordObjectBase::construct( const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm, const String& rRecNames, const String& rSimpleRecs )
+{
+ BinaryInputStreamRef xRecStrm( new SequenceInputStream( *mxRecData ) );
+ RecordObjectBase::construct( rParent, rxBaseStrm, xRecStrm, rRecNames, rSimpleRecs );
+}
+
+bool SequenceRecordObjectBase::implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+ bool bValid = true;
+ if( rBaseStrm.isSeekable() )
+ {
+ ornRecPos = rBaseStrm.tell();
+ // do not try to overread seekable streams, may cause assertions
+ bValid = ornRecPos < rBaseStrm.getLength();
+ }
+
+ // read the record header
+ if( bValid )
+ bValid = implReadRecordHeader( rBaseStrm, ornRecId, ornRecSize ) && !rBaseStrm.isEof() && (0 <= ornRecSize) && (ornRecSize <= 0x00100000);
+
+ // read record contents into data sequence
+ if( bValid )
+ {
+ sal_Int32 nRecSize = static_cast< sal_Int32 >( ornRecSize );
+ mxRecData->realloc( nRecSize );
+ bValid = (nRecSize == 0) || (rBaseStrm.readData( *mxRecData, nRecSize ) == nRecSize);
+ mxStrm->seekToStart();
+ }
+ return bValid;
+}
+
+// ============================================================================
+// ============================================================================
+
+DumperBase::~DumperBase()
+{
+}
+
+bool DumperBase::isImportEnabled() const
+{
+ return !isValid() || cfg().isImportEnabled();
+}
+
+bool DumperBase::isImportCancelled() const
+{
+ return isValid() && cfg().isPasswordCancelled();
+}
+
+void DumperBase::construct( const ConfigRef& rxConfig )
+{
+ if( isValid( rxConfig ) && rxConfig->isDumperEnabled() )
+ ObjectBase::construct( rxConfig );
+}
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini
new file mode 100644
index 000000000000..28aa59a03b81
--- /dev/null
+++ b/oox/source/dump/dumperbase.ini
@@ -0,0 +1,395 @@
+
+# dumper settings ============================================================
+#
+# Basic concepts
+#
+# - Character encoding of dumper ini files is UTF-8.
+# - Whitespace characters are generally stripped, e.g. at start and end of
+# lines, before/after equal signs, commas, etc.
+# - Comments start with the hash (#) or semicolon (;) character. Leading
+# whitespace characters are ignored.
+#
+# ----------------------------------------------------------------------------
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+# 0=off, 1=on
+enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+# 0=off, 1=on
+enable-import=1
+
+# Maximum size of binary stream dumps (default=infinite).
+max-binary-stream-size=65536
+
+# Maximum size of binary data blocks in content dumps (default=infinite).
+max-binary-data-size=128
+
+# Shows unknown trailing data as binary dump (default=on).
+# 0=off, 1=on
+show-trailing-unknown=1
+
+# Shows the absolute stream position of records in the record header field
+# (default=on).
+# 0=off, 1=on
+show-record-position=0
+
+# name lists =================================================================
+#
+# Syntax descriptions
+#
+# - Optional items are enclosed in brackets [].
+# - Optional items that may be repeated are marked with an ellipsis (...).
+# - Items in a set to choose from are separated by vertical lines (|).
+# - <LISTNAME> denotes the name of a list. List names may consist of any non-
+# whitespace characters.
+# - <value>, <firstvalue>, <bitfield>, <bitmask> etc. denote integer values.
+# Decimal and hexadecimal notation is supported, using C/C++ notation.
+# - <bool> denotes a boolean value. Possible values are 0|1|false|true.
+# - <constname> denotes a literal name for a constant or bit.
+#
+# ----------------------------------------------------------------------------
+#
+# constlist
+#
+# Defines names for a list of specific values.
+#
+# Syntax:
+#
+# constlist = <LISTNAME>
+# default = <constname>
+# include = <LISTNAME>[,<LISTNAME>...]
+# exclude = <value>[,<value>...]
+# quote-names = <bool>
+# <value> = <constname>
+# end
+#
+# - default (optional): Declares <constname> as a default name for values not
+# specified in the name list. <constname> may be the empty string. If not
+# set, the literal string '?err:no-name' (unquoted) is the default name.
+# - include (optional): Includes the specified name list(s) into the own list.
+# - exclude (optional): Removes values from the name lists, useful e.g. after
+# a name list has been included.
+# - quote-names (optional): Specifies whether to return the contained names
+# enclosed in single quote (') characters. Default is false.
+#
+# The order of the declarations is important, later declarations may overwrite
+# names generated from earlier declarations.
+#
+# Example:
+#
+# constlist = EXAMPLE-CONSTLIST
+# 1 = my-value
+# include = OTHER-LIST
+# exclude = 2,3
+# 0x0004 = other-value
+# end
+#
+# - Defines the name 'my-value' for the constant 1.
+# - Includes 'OTHER-LIST' which may overwrite the name of the constant 1.
+# - Excludes the names of constants 2 and 3, which may have been included from
+# the name list 'OTHER-LIST'.
+# - Defines the name 'other-value' for the constant 4, which may overwrite the
+# name of this constant included from the name list 'OTHER-LIST'.
+#
+# ----------------------------------------------------------------------------
+#
+# multilist
+#
+# Defines names for contiguous ranges of values.
+#
+# Syntax:
+#
+# multilist = <LISTNAME>
+# default = <constname>
+# include = <LISTNAME>[,<LISTNAME>...]
+# exclude = <value>[,<value>...]
+# ignore-empty = <bool>
+# <firstvalue> = <constname>[,<constname>...]
+# end
+#
+# - default (optional): See constlist above.
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore-empty (optional): Specifies whether to skip empty names in a list.
+# - True = skips an empty entry, the default name will be generated.
+# - False = creates an empty string for the entry.
+# Default is true (skip empty entries).
+#
+# Examples:
+#
+# multilist = EXAMPLE-MULTILIST
+# 0 = value0,value1,,value3
+# 8 = value8
+# end
+#
+# - Defines the names 'value0' for the constant 0, 'value1' for the constant
+# 1, 'value3' for the constant 3, and 'value8' for the constant 8.
+#
+# multilist = EXAMPLE-MULTILIST-2
+# include = EXAMPLE-MULTILIST
+# ignore-empty = false
+# default = other
+# end
+#
+# - Same as example above (includes EXAMPLE-MULTILIST), but defines the empty
+# string for the constant 2. Other constants (less than 0 or greater than 3
+# and not equal to 8) get the default name 'other'.
+#
+# ----------------------------------------------------------------------------
+#
+# shortlist
+#
+# Defines names for a contiguous range of values. The entire list definition
+# is given in a single text line.
+#
+# Syntax:
+#
+# shortlist = <LISTNAME>,<firstvalue>,<constname>[,<constname>...]
+#
+# Uses default settings of the multi-list (i.e. skips empty entries).
+#
+# ----------------------------------------------------------------------------
+#
+# flagslist
+#
+# Defines names for single bits in a bit field.
+#
+# Syntax:
+#
+# flagslist = <LISTNAME>
+# include = <LISTNAME>[,<LISTNAME>...]
+# exclude = <bitfield>[,<bitfield>...]
+# ignore = <bitfield>
+# <bitmask> = <cname> | !<cname> | :<cname> | !<cname0>!<cname1>
+# end
+#
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore (optional): Specifies bits to be ignored. Bits without an explicit
+# name and not set in this declaration will be shown as unknown. Default is
+# to not ignore a bit.
+# - <bitmask>: The bit to be named. Must be a value with a single bit set.
+# - <cname> - Sets a name for the bit that will be shown if the bit is set.
+# Does not show anything if the bit is cleared.
+# - !<cname> - Sets a name for the bit that will be shown if the bit is
+# cleared. Does not show anything if the bit is set.
+# - :<cname> - Sets a name for the bit that will always be shown together
+# with the actual state of the bit, appended as ':on' or ':off'.
+# - !<cname0>!<cname1> - Sets a name for both the cleared bit (cname0), and
+# for the set bit (cname1).
+#
+# ----------------------------------------------------------------------------
+#
+# combilist
+#
+# Defines names for single bits and for embedded values in a bit field. This
+# is an extension of the flagslist described above.
+#
+# Syntax:
+#
+# combilist = <LISTNAME>
+# include = <LISTNAME>[,<LISTNAME>...]
+# exclude = <bitmask>[,<bitmask>...]
+# ignore = <bitfield>
+# <bitmask> = <cname> | !<cname> | :<cname> | !<cname0>!<cname1>
+# <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>[,options...]]
+# end
+#
+# - include (optional): See constlist above.
+# - exclude (optional): See constlist above.
+# - ignore (optional): See flagslist above.
+# - <bitmask>: See flagslist above.
+# - <bitfield>: The mask of the embedded bitfield. Must be a value with
+# exactly one sequence of at least 2 consecutive bits.
+# - <datatype>: [u]int8 | [u]int16 | [u]int32 | [u]int64 | float | double
+# - <dataformat>: dec | hex | shorthex | bin | fix | bool
+# - <bitfieldname>: The name of the embedded bitfield.
+# - <LISTAME>: Optional name list with names for the values of the embedded
+# bitfield.
+# - options: Additional options for this bitfield:
+# - filter = <filterbitfield>~<filtervalue>: If set, the entire bitfield
+# will only be written, if the complete data item currently dumped
+# contains exactly the value specified in <filtervalue> in the bitfield
+# specified in <filterbitfield>. Otherwise, nothing is written. It is
+# possible to specify multiple filter rules for this bitfield. In that
+# case, the bitfield will be written, if at least one filter rule
+# applies for the current data item.
+# - noshift = <bool>: If set to 'true', the extracted value will be
+# shifted to the right (normalized). If set to 'false', the value will
+# be written unshifted. Default is 'true'.
+#
+# ----------------------------------------------------------------------------
+#
+# unitconverter
+#
+# Converts values and appends a unit name.
+#
+# Syntax:
+#
+# unitconverter = <LISTNAME>,[/]<factor>[,<unitname>]
+#
+# ----------------------------------------------------------------------------
+
+unitconverter=CONV-DEC,1
+unitconverter=CONV-PERCENT,1,%
+unitconverter=CONV-FLOAT-TO-PERC,100,%
+unitconverter=CONV-DEG,1,°
+unitconverter=CONV-HMM-TO-CM,/1000,cm
+unitconverter=CONV-INCH-TO-CM,2.54,cm
+unitconverter=CONV-PT-TO-CM,/28.346457,cm
+unitconverter=CONV-PT1616-TO-CM,/1857713.4,cm
+unitconverter=CONV-TWIP-TO-CM,/566.92913,cm
+unitconverter=CONV-TWIP-TO-PT,/20,pt
+unitconverter=CONV-EMU-TO-CM,/36000,cm
+
+constlist=BOOLEAN
+ 0=FALSE
+ default=TRUE
+end
+
+combilist=RK-FLAGS
+ 0x00000001=div-100
+ 0x00000002=integer
+ 0xFFFFFFFC=int32,hex,value
+end
+
+constlist=CHARSET
+ 0=win-1252-latin-1
+ 1=system-default
+ 2=symbol
+ 77=apple-roman
+ 128=win-932-japanese-shift-jis
+ 129=win-949-korean-hangul
+ 130=win-1361-korean-johab
+ 134=win-936-chinese-simplified-gbk
+ 136=win-950-chinese-traditional-big5
+ 161=win-1253-greek
+ 162=win-1254-turkish
+ 163=win-1258-vietnamese
+ 177=win-1255-hebrew
+ 178=win-1256-arabic
+ 186=win-1257-baltic
+ 204=win-1251-cyrillic
+ 222=win-874-thai
+ 238=win-1250-latin-2-central-european
+ 255=ibm-850-latin-1
+end
+
+combilist=FONT-PITCHFAMILY
+ 0x0F=uint8,dec,pitch,FONT-PITCH
+ 0xF0=uint8,dec,family,FONT-FAMILY
+end
+
+constlist=FONT-WEIGHT
+ 400=normal
+ 700=bold
+end
+
+shortlist=FONT-PITCH,0,unknown,fixed,variable
+shortlist=FONT-FAMILY,0,unknown,roman,swiss,modern,script,decorative
+
+constlist=CODEPAGES
+ 367=ascii
+ 437=ibm-437-us
+ 708=iso-8859-6
+ 720=ibm-720-arabic
+ 737=ibm-737-greek
+ 775=ibm-775-baltic
+ 850=ibm-850-latin-1
+ 852=ibm-852-latin-2-central-european
+ 855=ibm-855-cyrillic
+ 857=ibm-857-turkish
+ 858=ibm-858-multilingual-latin-1-with-euro
+ 860=ibm-860-portuguese
+ 861=ibm-861-icelandic
+ 862=ibm-862-hebrew
+ 863=ibm-863-canadian-french
+ 864=ibm-864-arabic
+ 865=ibm-865-nordic
+ 866=ibm-866-cyrillic-russian
+ 869=ibm-869-greek-modern
+ 874=win-874-thai
+ 932=win-932-japanese-shift-jis
+ 936=win-936-chinese-simplified-gbk
+ 949=win-949-korean-wansung
+ 950=win-950-chinese-traditional-big5
+ 1200=utf-16
+ 1250=win-1250-latin-2-central-european
+ 1251=win-1251-cyrillic
+ 1252=win-1252-latin-1
+ 1253=win-1253-greek
+ 1254=win-1254-turkish
+ 1255=win-1255-hebrew
+ 1256=win-1256-arabic
+ 1257=win-1257-baltic
+ 1258=win-1258-vietnamese
+ 1361=win-1361-korean-johab
+ 10000=apple-roman
+ 10001=apple-japanese
+ 10002=apple-chinese-traditional
+ 10003=apple-korean
+ 10004=apple-arabic
+ 10005=apple-hebrew
+ 10006=apple-greek
+ 10007=apple-cyrillic
+ 10008=apple-chinese-simplified
+ 10010=apple-romanian
+ 10017=apple-ukrainian
+ 10029=apple-central-european-with-euro
+ 10079=apple-icelandic
+ 10081=apple-turkish
+ 10082=apple-croatian
+ 20127=ascii
+ 20866=koi8-r
+ 21866=koi8-u
+ 28591=iso-8859-1
+ 28592=iso-8859-2
+ 28593=iso-8859-3
+ 28594=iso-8859-4
+ 28595=iso-8859-5
+ 28596=iso-8859-6
+ 28597=iso-8859-7
+ 28598=iso-8859-8
+ 28599=iso-8859-9
+ 28605=iso-8859-15
+ 32768=apple-romanian
+ 32769=win-1252-latin-1
+ 50220=iso-2022-jp
+ 50225=iso-2022-kr
+ 51932=euc-jp
+ 51936=euc-cn
+ 51949=euc-kr
+ 65000=utf-7
+ 65001=utf-8
+end
+
+multilist=COUNTRY
+ 1=usa,canada,latin-america,,,,russia
+ 20=egypt
+ 30=greece,netherlands,belgium,france,spain,,hungary,,,italy
+ 40=,switzerland,,austria,uk,denmark,sweden,norway,poland,germany
+ 50=,,mexico,,,brazil
+ 60=,australia,,,new-zealand,,thailand
+ 80=,japan,korea,,vietnam,,china
+ 90=turkey
+ 210=,,,algeria,,,morocco,,libya
+ 350=,portugal,,,iceland,,,,finland
+ 420=czech
+ 880=,,,,,,taiwan
+ 960=,lebanon,jordan,syria,iraq,kuwait,saudi-arabia
+ 970=,uae,israel,,qatar
+ 980=,iran
+end
+
+multilist=SYSTEMCOLOR
+ 0x00=scrollbar,desktop,active-title,inactive-title,menu,window-back,window-frame,menu-text
+ 0x08=window-text,active-title-text,active-border,inactive-border,app-workspace,highlight,highlight-text,button-face
+ 0x10=button-shadow,disabled-text,button-text,inactive-title-text,button-highlight,button-dark-shadow,button-light-shadow,tooltip-text
+ 0x18=tooltip-back,,hot-light,active-title-2,inactive-title-2,menu-highlight,menubar
+end
+
+# ============================================================================
diff --git a/oox/source/dump/makefile.mk b/oox/source/dump/makefile.mk
new file mode 100644
index 000000000000..1e5f615675cc
--- /dev/null
+++ b/oox/source/dump/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=oox
+TARGET=dump
+AUTOSEG=true
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE: $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/biffdumper.obj \
+ $(SLO)$/dffdumper.obj \
+ $(SLO)$/dumperbase.obj \
+ $(SLO)$/oledumper.obj \
+ $(SLO)$/pptxdumper.obj \
+ $(SLO)$/xlsbdumper.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/oox/source/dump/oledumper.cxx b/oox/source/dump/oledumper.cxx
new file mode 100644
index 000000000000..bd2a0e05ecce
--- /dev/null
+++ b/oox/source/dump/oledumper.cxx
@@ -0,0 +1,2364 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/oledumper.hxx"
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <osl/file.hxx>
+#include <osl/thread.h>
+#include <rtl/tencinfo.h>
+#include "oox/core/filterbase.hxx"
+#include "oox/helper/binaryoutputstream.hxx"
+#include "oox/ole/olestorage.hxx"
+#include "oox/ole/vbainputstream.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::uno;
+
+using ::rtl::OString;
+using ::rtl::OStringToOUString;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+// ============================================================================
+
+OUString OleInputObjectBase::dumpAnsiString32( const String& rName )
+{
+ return dumpCharArray( rName, mxStrm->readInt32(), RTL_TEXTENCODING_MS_1252 );
+}
+
+OUString OleInputObjectBase::dumpUniString32( const String& rName )
+{
+ return dumpUnicodeArray( rName, mxStrm->readInt32() );
+}
+
+sal_Int32 OleInputObjectBase::dumpStdClipboardFormat( const String& rName )
+{
+ return dumpDec< sal_Int32 >( rName( "clipboard-format" ), "OLE-STD-CLIPBOARD-FORMAT" );
+}
+
+OUString OleInputObjectBase::dumpAnsiString32OrStdClip( const String& rName )
+{
+ sal_Int32 nLen = mxStrm->readInt32();
+ return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpCharArray( rName, nLen, RTL_TEXTENCODING_MS_1252 );
+}
+
+OUString OleInputObjectBase::dumpUniString32OrStdClip( const String& rName )
+{
+ sal_Int32 nLen = mxStrm->readInt32();
+ return (nLen < 0) ? OUString::valueOf( dumpStdClipboardFormat( rName ) ) : dumpUnicodeArray( rName, nLen );
+}
+
+void OleInputObjectBase::writeOleColorItem( const String& rName, sal_uInt32 nColor )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( rName, nColor, "OLE-COLOR" );
+}
+
+sal_uInt32 OleInputObjectBase::dumpOleColor( const String& rName )
+{
+ sal_uInt32 nOleColor = mxStrm->readuInt32();
+ writeOleColorItem( rName, nOleColor );
+ return nOleColor;
+}
+
+// ============================================================================
+// ============================================================================
+
+StdFontObject::StdFontObject( const InputObjectBase& rParent )
+{
+ construct( rParent );
+}
+
+void StdFontObject::implDump()
+{
+ dumpDec< sal_uInt8 >( "version" );
+ dumpDec< sal_uInt16 >( "charset", "CHARSET" );
+ dumpHex< sal_uInt8 >( "flags", "STDFONT-FLAGS" );
+ dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
+ dumpDec< sal_uInt32 >( "height", "STDFONT-HEIGHT" );
+ dumpCharArray( "name", mxStrm->readuInt8(), RTL_TEXTENCODING_ASCII_US );
+}
+
+// ============================================================================
+
+StdPicObject::StdPicObject( const InputObjectBase& rParent )
+{
+ construct( rParent );
+}
+
+void StdPicObject::implDump()
+{
+ dumpHex< sal_uInt32 >( "identifier", "STDPIC-ID" );
+ sal_uInt32 nSize = dumpHex< sal_uInt32 >( "image-size", "CONV-DEC" );
+ dumpBinary( "image-data", nSize );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 STDHLINK_HASTARGET = 0x00000001; /// Has hyperlink moniker.
+const sal_uInt32 STDHLINK_ABSOLUTE = 0x00000002; /// Absolute path.
+const sal_uInt32 STDHLINK_HASLOCATION = 0x00000008; /// Has target location.
+const sal_uInt32 STDHLINK_HASDISPLAY = 0x00000010; /// Has display string.
+const sal_uInt32 STDHLINK_HASGUID = 0x00000020; /// Has identification GUID.
+const sal_uInt32 STDHLINK_HASTIME = 0x00000040; /// Has creation time.
+const sal_uInt32 STDHLINK_HASFRAME = 0x00000080; /// Has frame.
+const sal_uInt32 STDHLINK_ASSTRING = 0x00000100; /// Hyperlink as simple string.
+
+} // namespace
+
+StdHlinkObject::StdHlinkObject( const InputObjectBase& rParent )
+{
+ construct( rParent );
+}
+
+void StdHlinkObject::implDump()
+{
+ dumpDec< sal_uInt32 >( "stream-version" );
+ sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "flags", "STDHLINK-FLAGS" );
+ if( getFlag( nFlags, STDHLINK_HASDISPLAY ) )
+ dumpHyperlinkString( "display", true );
+ if( getFlag( nFlags, STDHLINK_HASFRAME ) )
+ dumpHyperlinkString( "frame", true );
+ if( getFlag( nFlags, STDHLINK_HASTARGET ) )
+ {
+ if( getFlag( nFlags, STDHLINK_ASSTRING ) )
+ dumpHyperlinkString( "filename", true );
+ else if( !dumpGuidAndMoniker() )
+ return;
+ }
+ if( getFlag( nFlags, STDHLINK_HASLOCATION ) )
+ dumpHyperlinkString( "location", true );
+ if( getFlag( nFlags, STDHLINK_HASGUID ) )
+ dumpGuid( "id-guid" );
+ if( getFlag( nFlags, STDHLINK_HASTIME ) )
+ dumpFileTime( "creation-time" );
+}
+
+OUString StdHlinkObject::dumpHyperlinkString( const String& rName, bool bUnicode )
+{
+ return bUnicode ? dumpUniString32( rName ) : dumpAnsiString32( rName );
+}
+
+bool StdHlinkObject::dumpGuidAndMoniker()
+{
+ bool bValidMoniker = true;
+ OUString aGuid = cfg().getStringOption( dumpGuid( "moniker" ), OUString() );
+ IndentGuard aIndGuard( mxOut );
+ if( aGuid.equalsAscii( "URLMoniker" ) )
+ dumpUrlMoniker();
+ else if( aGuid.equalsAscii( "FileMoniker" ) )
+ dumpFileMoniker();
+ else if( aGuid.equalsAscii( "ItemMoniker" ) )
+ dumpItemMoniker();
+ else if( aGuid.equalsAscii( "AntiMoniker" ) )
+ dumpAntiMoniker();
+ else if( aGuid.equalsAscii( "CompositeMoniker" ) )
+ dumpCompositeMoniker();
+ else
+ bValidMoniker = false;
+ return bValidMoniker;
+}
+
+void StdHlinkObject::dumpUrlMoniker()
+{
+ sal_Int32 nBytes = dumpDec< sal_Int32 >( "url-bytes" );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ dumpNullUnicodeArray( "url" );
+ if( mxStrm->tell() + 24 == nEndPos )
+ {
+ dumpGuid( "implementation-id" );
+ dumpDec< sal_uInt32 >( "version" );
+ dumpHex< sal_uInt32 >( "flags", "STDHLINK-URL-FLAGS" );
+ }
+ dumpRemainingTo( nEndPos );
+}
+
+void StdHlinkObject::dumpFileMoniker()
+{
+ dumpDec< sal_Int16 >( "up-levels" );
+ dumpHyperlinkString( "ansi-filename", false );
+ dumpDec< sal_Int16 >( "server-path-len" );
+ dumpHex< sal_uInt16 >( "version" );
+ dumpUnused( 20 );
+ sal_Int32 nBytes = dumpDec< sal_Int32 >( "total-bytes" );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ if( nBytes > 0 )
+ {
+ sal_Int32 nFileBytes = dumpDec< sal_Int32 >( "uni-filename-bytes" );
+ dumpDec< sal_uInt16 >( "key-value" );
+ dumpUnicodeArray( "unicode-filename", nFileBytes / 2 );
+ }
+ dumpRemainingTo( nEndPos );
+}
+
+void StdHlinkObject::dumpItemMoniker()
+{
+ sal_Int32 nBytes = dumpDec< sal_Int32 >( "delimiter-bytes" );
+ sal_Int64 nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ dumpNullCharArray( "ansi-delimiter", RTL_TEXTENCODING_MS_1252 );
+ if( mxStrm->tell() < nEndPos )
+ dumpUnicodeArray( "unicode-delimiter", (nEndPos - mxStrm->tell()) / 2 );
+ mxStrm->seek( nEndPos );
+
+ nBytes = dumpDec< sal_Int32 >( "item-bytes" );
+ nEndPos = mxStrm->tell() + ::std::max< sal_Int32 >( nBytes, 0 );
+ dumpNullCharArray( "ansi-item", RTL_TEXTENCODING_MS_1252 );
+ if( mxStrm->tell() < nEndPos )
+ dumpUnicodeArray( "unicode-item", (nEndPos - mxStrm->tell()) / 2 );
+ mxStrm->seek( nEndPos );
+}
+
+void StdHlinkObject::dumpAntiMoniker()
+{
+ dumpDec< sal_Int32 >( "count" );
+}
+
+void StdHlinkObject::dumpCompositeMoniker()
+{
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "moniker-count" );
+ for( sal_Int32 nIndex = 0; !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
+ dumpGuidAndMoniker();
+}
+
+// ============================================================================
+// ============================================================================
+
+OleStreamObject::OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ construct( rParent, rxStrm, rSysFileName );
+}
+
+// ============================================================================
+
+OleCompObjObject::OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName ) :
+ OleStreamObject( rParent, rxStrm, rSysFileName )
+{
+}
+
+void OleCompObjObject::implDump()
+{
+ dumpUnused( 4 );
+ dumpDec< sal_uInt32 >( "version" );
+ dumpUnused( 20 );
+ dumpAnsiString32( "ansi-display-name" );
+ dumpAnsiString32OrStdClip( "ansi-clipboard-format" );
+ if( mxStrm->getRemaining() >= 4 )
+ {
+ sal_Int32 nLen = mxStrm->readInt32();
+ if( (0 <= nLen) && (nLen <= 40) )
+ {
+ dumpCharArray( "ansi-unused", nLen, RTL_TEXTENCODING_MS_1252 );
+ if( (mxStrm->getRemaining() >= 4) && (dumpHex< sal_Int32 >( "unicode-marker" ) == 0x71B239F4) )
+ {
+ dumpUniString32( "unicode-display-name" );
+ dumpUniString32OrStdClip( "unicode-clipboard-format" );
+ dumpUniString32( "unicode-unused" );
+ }
+ }
+ else
+ writeDecItem( "length", nLen );
+ }
+ dumpRemainingStream();
+}
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+const sal_Int32 OLEPROP_ID_DICTIONARY = 0;
+const sal_Int32 OLEPROP_ID_CODEPAGE = 1;
+
+const sal_uInt16 OLEPROP_TYPE_INT16 = 2;
+const sal_uInt16 OLEPROP_TYPE_INT32 = 3;
+const sal_uInt16 OLEPROP_TYPE_FLOAT = 4;
+const sal_uInt16 OLEPROP_TYPE_DOUBLE = 5;
+const sal_uInt16 OLEPROP_TYPE_DATE = 7;
+const sal_uInt16 OLEPROP_TYPE_STRING = 8;
+const sal_uInt16 OLEPROP_TYPE_STATUS = 10;
+const sal_uInt16 OLEPROP_TYPE_BOOL = 11;
+const sal_uInt16 OLEPROP_TYPE_VARIANT = 12;
+const sal_uInt16 OLEPROP_TYPE_INT8 = 16;
+const sal_uInt16 OLEPROP_TYPE_UINT8 = 17;
+const sal_uInt16 OLEPROP_TYPE_UINT16 = 18;
+const sal_uInt16 OLEPROP_TYPE_UINT32 = 19;
+const sal_uInt16 OLEPROP_TYPE_INT64 = 20;
+const sal_uInt16 OLEPROP_TYPE_UINT64 = 21;
+const sal_uInt16 OLEPROP_TYPE_STRING8 = 30;
+const sal_uInt16 OLEPROP_TYPE_STRING16 = 31;
+const sal_uInt16 OLEPROP_TYPE_FILETIME = 64;
+const sal_uInt16 OLEPROP_TYPE_BLOB = 65;
+const sal_uInt16 OLEPROP_TYPE_STREAM = 66;
+const sal_uInt16 OLEPROP_TYPE_STORAGE = 67;
+const sal_uInt16 OLEPROP_TYPE_CLIPFMT = 71;
+
+const sal_uInt16 OLEPROP_TYPE_SIMPLE = 0x0000;
+const sal_uInt16 OLEPROP_TYPE_VECTOR = 0x1000;
+const sal_uInt16 OLEPROP_TYPE_ARRAY = 0x2000;
+
+const sal_uInt16 CODEPAGE_UNICODE = 1200;
+
+const sal_uInt32 AX_STRING_COMPRESSED = 0x80000000;
+
+} // namespace
+
+// ============================================================================
+
+OlePropertyStreamObject::OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ construct( rParent, rxStrm, rSysFileName );
+}
+
+void OlePropertyStreamObject::implDump()
+{
+ OUStringVector aGuidVec;
+ ::std::vector< sal_uInt32 > aStartPosVec;
+
+ // dump header
+ writeEmptyItem( "HEADER" );
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt16 >( "byte-order", "OLEPROP-BYTE-ORDER" );
+ dumpDec< sal_uInt16 >( "version" );
+ dumpDec< sal_uInt16 >( "os-minor" );
+ dumpDec< sal_uInt16 >( "os-type", "OLEPROP-OSTYPE" );
+ dumpGuid( "guid" );
+ sal_Int32 nSectCount = dumpDec< sal_Int32 >( "section-count" );
+
+ // dump table of section positions
+ {
+ TableGuard aTabGuard( mxOut, 15, 60 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < nSectCount); ++nSectIdx )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#section" );
+ aGuidVec.push_back( dumpGuid( "guid" ) );
+ aStartPosVec.push_back( dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" ) );
+ }
+ }
+ }
+ mxOut->emptyLine();
+
+ // dump sections
+ for( size_t nSectIdx = 0; !mxStrm->isEof() && (nSectIdx < aStartPosVec.size()); ++nSectIdx )
+ dumpSection( aGuidVec[ nSectIdx ], aStartPosVec[ nSectIdx ] );
+}
+
+void OlePropertyStreamObject::dumpSection( const OUString& rGuid, sal_uInt32 nStartPos )
+{
+ // property ID names
+ mxPropIds = cfg().createNameList< ConstList >( "OLEPROP-IDS" );
+ OUString aGuidName = cfg().getStringOption( rGuid, OUString() );
+ if( aGuidName.equalsAscii( "GlobalDocProp" ) )
+ mxPropIds->includeList( cfg().getNameList( "OLEPROP-GLOBALIDS" ) );
+ else if( aGuidName.equalsAscii( "BuiltinDocProp" ) )
+ mxPropIds->includeList( cfg().getNameList( "OLEPROP-BUILTINIDS" ) );
+ else
+ mxPropIds->includeList( cfg().getNameList( "OLEPROP-BASEIDS" ) );
+
+ // property ID/position map
+ typedef ::std::map< sal_Int32, sal_uInt32 > PropertyPosMap;
+ PropertyPosMap aPropMap;
+
+ // dump section header line
+ writeSectionHeader( rGuid, nStartPos );
+
+ // seek to section
+ IndentGuard aIndGuard( mxOut );
+ if( startElement( nStartPos ) )
+ {
+ // dump section header
+ dumpDec< sal_Int32 >( "size" );
+ sal_Int32 nPropCount = dumpDec< sal_Int32 >( "property-count" );
+
+ // dump table of property positions
+ {
+ TableGuard aTabGuard( mxOut, 15, 25 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nPropIdx = 0; !mxStrm->isEof() && (nPropIdx < nPropCount); ++nPropIdx )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#property" );
+ sal_Int32 nPropId = dumpDec< sal_Int32 >( "id", mxPropIds );
+ sal_uInt32 nPropPos = nStartPos + dumpHex< sal_uInt32 >( "start-pos", "CONV-DEC" );
+ aPropMap[ nPropId ] = nPropPos;
+ }
+ }
+ }
+ mxOut->emptyLine();
+
+ // code page property
+ meTextEnc = RTL_TEXTENCODING_MS_1252;
+ mbIsUnicode = false;
+ PropertyPosMap::iterator aCodePageIt = aPropMap.find( OLEPROP_ID_CODEPAGE );
+ if( aCodePageIt != aPropMap.end() )
+ {
+ dumpCodePageProperty( aCodePageIt->second );
+ aPropMap.erase( aCodePageIt );
+ }
+
+ // dictionary property
+ PropertyPosMap::iterator aDictIt = aPropMap.find( OLEPROP_ID_DICTIONARY );
+ if( aDictIt != aPropMap.end() )
+ {
+ dumpDictionaryProperty( aDictIt->second );
+ aPropMap.erase( aDictIt );
+ }
+
+ // other properties
+ for( PropertyPosMap::const_iterator aIt = aPropMap.begin(), aEnd = aPropMap.end(); aIt != aEnd; ++aIt )
+ dumpProperty( aIt->first, aIt->second );
+
+ // remove the user defined list of property ID names
+ cfg().eraseNameList( "OLEPROP-IDS" );
+}
+
+void OlePropertyStreamObject::dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos )
+{
+ writePropertyHeader( nPropId, nStartPos );
+ IndentGuard aIndGuard( mxOut );
+ if( startElement( nStartPos ) )
+ dumpPropertyContents( nPropId );
+ mxOut->emptyLine();
+}
+
+void OlePropertyStreamObject::dumpCodePageProperty( sal_uInt32 nStartPos )
+{
+ writePropertyHeader( OLEPROP_ID_CODEPAGE, nStartPos );
+ IndentGuard aIndGuard( mxOut );
+ if( startElement( nStartPos ) )
+ {
+ sal_uInt16 nType = dumpPropertyType();
+ if( nType == OLEPROP_TYPE_INT16 )
+ {
+ sal_uInt16 nCodePage = dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" );
+ rtl_TextEncoding nNewTextEnc = rtl_getTextEncodingFromWindowsCodePage( nCodePage );
+ if( nNewTextEnc != RTL_TEXTENCODING_DONTKNOW )
+ meTextEnc = nNewTextEnc;
+ mbIsUnicode = nCodePage == CODEPAGE_UNICODE;
+ }
+ else
+ dumpPropertyContents( OLEPROP_ID_CODEPAGE );
+ }
+ mxOut->emptyLine();
+}
+
+void OlePropertyStreamObject::dumpDictionaryProperty( sal_uInt32 nStartPos )
+{
+ writePropertyHeader( OLEPROP_ID_DICTIONARY, nStartPos );
+ IndentGuard aIndGuard( mxOut );
+ if( startElement( nStartPos ) )
+ {
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
+ for( sal_Int32 nIdx = 0; !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 10, 20 );
+ sal_Int32 nId = dumpDec< sal_Int32 >( "id" );
+ OUString aName = dumpString8( "name" );
+ if( mxPropIds.get() )
+ mxPropIds->setName( nId, aName );
+ }
+ }
+ mxOut->emptyLine();
+}
+
+sal_uInt16 OlePropertyStreamObject::dumpPropertyContents( sal_Int32 nPropId )
+{
+ sal_uInt16 nType = dumpPropertyType();
+ sal_uInt16 nBaseType = static_cast< sal_uInt16 >( nType & 0x0FFF );
+ sal_uInt16 nArrayType = static_cast< sal_uInt16 >( nType & 0xF000 );
+ switch( nArrayType )
+ {
+ case OLEPROP_TYPE_SIMPLE: dumpPropertyValue( nPropId, nBaseType ); break;
+ case OLEPROP_TYPE_VECTOR: dumpPropertyVector( nPropId, nBaseType ); break;
+ case OLEPROP_TYPE_ARRAY: dumpPropertyArray( nPropId, nBaseType ); break;
+ }
+ return nType;
+}
+
+void OlePropertyStreamObject::dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType )
+{
+ switch( nBaseType )
+ {
+ case OLEPROP_TYPE_INT16: dumpDec< sal_Int16 >( "value" ); break;
+ case OLEPROP_TYPE_INT32: dumpDec< sal_Int32 >( "value" ); break;
+ case OLEPROP_TYPE_FLOAT: dumpDec< float >( "value" ); break;
+ case OLEPROP_TYPE_DOUBLE: dumpDec< double >( "value" ); break;
+ case OLEPROP_TYPE_DATE: dumpDec< double >( "date" ); break;
+ case OLEPROP_TYPE_STRING: dumpString8( "value" ); break;
+ case OLEPROP_TYPE_STATUS: dumpHex< sal_Int32 >( "status" ); break;
+ case OLEPROP_TYPE_BOOL: dumpBool< sal_Int16 >( "value" ); break;
+ case OLEPROP_TYPE_VARIANT: dumpPropertyContents( nPropId ); break;
+ case OLEPROP_TYPE_INT8: dumpDec< sal_Int8 >( "value" ); break;
+ case OLEPROP_TYPE_UINT8: dumpDec< sal_uInt8 >( "value" ); break;
+ case OLEPROP_TYPE_UINT16: dumpDec< sal_uInt16 >( "value" ); break;
+ case OLEPROP_TYPE_UINT32: dumpDec< sal_uInt32 >( "value" ); break;
+ case OLEPROP_TYPE_INT64: dumpDec< sal_Int64 >( "value" ); break;
+ case OLEPROP_TYPE_UINT64: dumpDec< sal_uInt64 >( "value" ); break;
+ case OLEPROP_TYPE_STRING8: dumpString8( "value" ); break;
+ case OLEPROP_TYPE_STRING16: dumpString16( "value" ); break;
+ case OLEPROP_TYPE_FILETIME: dumpFileTime( "file-time" ); break;
+ case OLEPROP_TYPE_BLOB: dumpBlob( nPropId, "data" ); break;
+ case OLEPROP_TYPE_STREAM: dumpString8( "stream-name" ); break;
+ case OLEPROP_TYPE_STORAGE: dumpString8( "storage-name" ); break;
+ case OLEPROP_TYPE_CLIPFMT: dumpBlob( nPropId, "clip-data" ); break;
+ }
+}
+
+void OlePropertyStreamObject::dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType )
+{
+ sal_Int32 nElemCount = dumpDec< sal_Int32 >( "element-count" );
+ for( sal_Int32 nElemIdx = 0; !mxStrm->isEof() && (nElemIdx < nElemCount); ++nElemIdx )
+ {
+ mxOut->resetItemIndex( nElemIdx );
+ writeEmptyItem( "#element" );
+ IndentGuard aIndGuard( mxOut );
+ dumpPropertyValue( nPropId, nBaseType );
+ }
+}
+
+void OlePropertyStreamObject::dumpPropertyArray( sal_Int32 /*nPropId*/, sal_uInt16 /*nBaseType*/ )
+{
+ // TODO
+}
+
+sal_uInt16 OlePropertyStreamObject::dumpPropertyType()
+{
+ return static_cast< sal_uInt16 >( dumpHex< sal_Int32 >( "type", "OLEPROP-TYPE" ) & 0xFFFF );
+}
+
+void OlePropertyStreamObject::dumpBlob( sal_Int32 nPropId, const String& rName )
+{
+ sal_Int32 nSize = dumpDec< sal_Int32 >( "data-size" );
+ if( nSize > 0 )
+ {
+ OUString aPropName = mxPropIds->getName( cfg(), nPropId );
+ if( aPropName == CREATE_OUSTRING( "'_PID_HLINKS'" ) )
+ dumpHlinks( nSize );
+ else
+ dumpBinary( rName, nSize );
+ }
+}
+
+OUString OlePropertyStreamObject::dumpString8( const String& rName )
+{
+ sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
+ return mbIsUnicode ? dumpCharArray16( rName, nLen ) : dumpCharArray8( rName, nLen );
+}
+
+OUString OlePropertyStreamObject::dumpCharArray8( const String& rName, sal_Int32 nLen )
+{
+ OUString aData;
+ size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
+ if( nNewLen > 0 )
+ {
+ ::std::vector< sal_Char > aBuffer( nNewLen + 1 );
+ mxStrm->readMemory( &aBuffer.front(), nNewLen );
+ aBuffer[ nNewLen ] = 0;
+ aData = OStringToOUString( OString( &aBuffer.front() ), meTextEnc );
+ }
+ writeStringItem( rName, aData );
+ return aData;
+}
+
+OUString OlePropertyStreamObject::dumpString16( const String& rName )
+{
+ sal_Int32 nLen = dumpDec< sal_Int32 >( "string-len" );
+ return dumpCharArray16( rName, nLen );
+}
+
+OUString OlePropertyStreamObject::dumpCharArray16( const String& rName, sal_Int32 nLen )
+{
+ size_t nNewLen = getLimitedValue< size_t, sal_Int32 >( nLen, 0, 1024 );
+ ::std::vector< sal_Unicode > aBuffer;
+ aBuffer.reserve( nNewLen + 1 );
+ for( size_t nIdx = 0; nIdx < nNewLen; ++nIdx )
+ aBuffer.push_back( static_cast< sal_Unicode >( mxStrm->readuInt16() ) );
+ aBuffer.push_back( 0 );
+ OUString aData( &aBuffer.front() );
+ writeStringItem( rName, aData );
+ if( nNewLen & 1 ) dumpUnused( 2 ); // always padding to 32bit
+ return aData;
+}
+
+bool OlePropertyStreamObject::dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType )
+{
+ writeEmptyItem( rName );
+ IndentGuard aIndGuard( mxOut );
+ return (dumpPropertyContents( -1 ) == nExpectedType) && !mxStrm->isEof();
+}
+
+void OlePropertyStreamObject::dumpHlinks( sal_Int32 nSize )
+{
+ sal_Int64 nEndPos = mxStrm->tell() + nSize;
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "property-count" );
+ bool bValid = true;
+ for( sal_Int32 nHlinkIndex = 0, nHlinkCount = nCount / 6; bValid && !mxStrm->isEof() && (nHlinkIndex < nHlinkCount); ++nHlinkIndex )
+ {
+ writeEmptyItem( "HYPERLINK" );
+ IndentGuard aIndGuard( mxOut );
+ bValid =
+ dumpTypedProperty( "hash", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "app", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "shape-id", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "info", OLEPROP_TYPE_INT32 ) &&
+ dumpTypedProperty( "target", OLEPROP_TYPE_STRING16 ) &&
+ dumpTypedProperty( "location", OLEPROP_TYPE_STRING16 );
+ }
+ dumpRemainingTo( nEndPos );
+}
+
+bool OlePropertyStreamObject::startElement( sal_uInt32 nStartPos )
+{
+ mxStrm->seek( nStartPos );
+ if( mxStrm->isEof() )
+ writeInfoItem( "stream-state", OOX_DUMP_ERR_STREAM );
+ return !mxStrm->isEof();
+}
+
+void OlePropertyStreamObject::writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "SECTION" );
+ writeHexItem( "pos", nStartPos, "CONV-DEC" );
+ writeGuidItem( "guid", rGuid );
+}
+
+void OlePropertyStreamObject::writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "PROPERTY" );
+ writeHexItem( "pos", nStartPos, "CONV-DEC" );
+ writeDecItem( "id", nPropId, mxPropIds );
+}
+
+// ============================================================================
+
+OleStorageObject::OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
+{
+ construct( rParent, rxStrg, rSysPath );
+}
+
+void OleStorageObject::construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath )
+{
+ StorageObjectBase::construct( rParent, rxStrg, rSysPath );
+}
+
+void OleStorageObject::construct( const ObjectBase& rParent )
+{
+ StorageObjectBase::construct( rParent );
+}
+
+void OleStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& /*rStrgPath*/, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( rStrmName.equalsAscii( "\001CompObj" ) )
+ OleCompObjObject( *this, rxStrm, rSysFileName ).dump();
+ else if( rStrmName.equalsAscii( "\005SummaryInformation" ) || rStrmName.equalsAscii( "\005DocumentSummaryInformation" ) )
+ OlePropertyStreamObject( *this, rxStrm, rSysFileName ).dump();
+ else
+ BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+ComCtlObjectBase::ComCtlObjectBase( const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion, bool bCommonPart, bool bComplexPart ) :
+ mnDataId5( nDataId5 ),
+ mnDataId6( nDataId6 ),
+ mnVersion( nVersion ),
+ mbCommonPart( bCommonPart ),
+ mbComplexPart( bComplexPart )
+{
+ construct( rParent );
+}
+
+void ComCtlObjectBase::implDump()
+{
+ sal_uInt32 nCommonSize = 0;
+ dumpComCtlSize() && dumpComCtlData( nCommonSize ) && (!mbCommonPart || dumpComCtlCommon( nCommonSize )) && (!mbComplexPart || dumpComCtlComplex());
+}
+
+void ComCtlObjectBase::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+}
+
+void ComCtlObjectBase::implDumpCommonTrailing()
+{
+}
+
+bool ComCtlObjectBase::dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor, sal_uInt16 nExpMinor )
+{
+ // no idea if all this is correct...
+ sal_uInt32 nId = dumpHex< sal_uInt32 >( "header-id", "COMCTL-HEADER-IDS" );
+ ItemGuard aItem( mxOut, "version" );
+ sal_uInt16 nMinor, nMajor;
+ *mxStrm >> nMinor >> nMajor;
+ mxOut->writeDec( nMajor );
+ mxOut->writeChar( '.' );
+ mxOut->writeDec( nMinor );
+ return !mxStrm->isEof() && (nId == nExpId) && ((nExpMajor == SAL_MAX_UINT16) || (nExpMajor == nMajor)) && ((nExpMinor == SAL_MAX_UINT16) || (nExpMinor == nMinor));
+}
+
+bool ComCtlObjectBase::dumpComCtlSize()
+{
+ if( dumpComCtlHeader( 0x12344321, 0, 8 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlData( sal_uInt32& ornCommonPartSize )
+{
+ if( dumpComCtlHeader( (mnVersion == 5) ? mnDataId5 : mnDataId6, mnVersion ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ if( mbCommonPart )
+ ornCommonPartSize = dumpDec< sal_uInt32 >( "common-part-size" );
+ implDumpProperties();
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlCommon( sal_uInt32 nPartSize )
+{
+ sal_Int64 nEndPos = mxStrm->tell() + nPartSize;
+ if( (nPartSize >= 16) && dumpComCtlHeader( 0xABCDEF01, 5, 0 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpUnknown( 4 );
+ dumpHex< sal_uInt32 >( "common-flags", "COMCTL-COMMON-FLAGS" );
+ implDumpCommonExtra( nEndPos );
+ dumpRemainingTo( nEndPos );
+ implDumpCommonTrailing();
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+bool ComCtlObjectBase::dumpComCtlComplex()
+{
+ if( dumpComCtlHeader( 0xBDECDE1F, 5, 1 ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt32 nFlags = dumpHex< sal_uInt32 >( "comctl-complex-flags", "COMCTL-COMPLEX-FLAGS" );
+ if( !mxStrm->isEof() && (nFlags & 0x01) )
+ {
+ writeEmptyItem( "font" );
+ IndentGuard aIndGuard2( mxOut );
+ OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+ if( aClassName.equalsAscii( "StdFont" ) )
+ StdFontObject( *this ).dump();
+ }
+ if( !mxStrm->isEof() && (nFlags & 0x02) )
+ {
+ writeEmptyItem( "mouse-icon" );
+ IndentGuard aIndGuard2( mxOut );
+ OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+ if( aClassName.equalsAscii( "StdPic" ) )
+ StdPicObject( *this ).dump();
+ }
+ return !mxStrm->isEof();
+ }
+ return false;
+}
+
+// ============================================================================
+
+ComCtlScrollBarObject::ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, SAL_MAX_UINT32, 0x99470A83, nVersion, true, true )
+{
+}
+
+void ComCtlScrollBarObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags", "COMCTL-SCROLLBAR-FLAGS" );
+ dumpDec< sal_Int32 >( "large-change" );
+ dumpDec< sal_Int32 >( "small-change" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int32 >( "value" );
+}
+
+// ============================================================================
+
+ComCtlProgressBarObject::ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E84, 0x97AB8A01, nVersion, true, true )
+{
+}
+
+void ComCtlProgressBarObject::implDumpProperties()
+{
+ dumpDec< float >( "min" );
+ dumpDec< float >( "max" );
+ if( mnVersion == 6 )
+ {
+ dumpBool< sal_uInt16 >( "vertical" );
+ dumpBool< sal_uInt16 >( "smooth-scroll" );
+ }
+}
+
+// ============================================================================
+
+ComCtlSliderObject::ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E86, 0x0A2BAE11, nVersion, true, true )
+{
+}
+
+void ComCtlSliderObject::implDumpProperties()
+{
+ dumpBool< sal_Int32 >( "vertical" );
+ dumpDec< sal_Int32 >( "large-change" );
+ dumpDec< sal_Int32 >( "small-change" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int16 >( "select-range", "COMCTL-SLIDER-SELECTRANGE" );
+ dumpUnused( 2 );
+ dumpDec< sal_Int32 >( "select-start" );
+ dumpDec< sal_Int32 >( "select-length" );
+ dumpDec< sal_Int32 >( "tick-style", "COMCTL-SLIDER-TICKSTYLE" );
+ dumpDec< sal_Int32 >( "tick-frequency" );
+ dumpDec< sal_Int32 >( "value" );
+ if( mnVersion == 6 )
+ dumpBool< sal_Int32 >( "tooltip-below" );
+}
+
+// ============================================================================
+
+ComCtlUpDownObject::ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xFF3626A0, 0xFF3626A0, nVersion, false, false )
+{
+}
+
+void ComCtlUpDownObject::implDumpProperties()
+{
+ dumpUnknown( 16 ); // buddy-property, somehow
+ dumpDec< sal_Int32 >( "buddy-control" );
+ dumpUnknown( 8 );
+ dumpDec< sal_Int32 >( "value" );
+ dumpUnknown( 4 );
+ dumpDec< sal_Int32 >( "increment" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpHex< sal_uInt32 >( "flags-1", "COMCTL-UPDOWN-FLAGS1" );
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-UPDOWN-FLAGS2" );
+ dumpUnknown( 4 );
+}
+
+// ============================================================================
+
+ComCtlImageListObject::ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E80, 0xE6E17E80, nVersion, true, false )
+{
+}
+
+void ComCtlImageListObject::implDumpProperties()
+{
+ dumpDec< sal_uInt16 >( "image-width" );
+ dumpDec< sal_uInt16 >( "image-height" );
+ dumpOleColor( "mask-color" );
+ dumpBool< sal_Int16 >( "use-mask-color" );
+ dumpUnknown( 2 );
+}
+
+void ComCtlImageListObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 4 );
+ dumpOleColor( "back-color" );
+ dumpUnknown( 4 );
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "text-flags", "COMCTL-IMAGELIST-TEXTFLAGS" );
+ if( nFlags & 0x01 ) dumpUniString32( "caption" );
+ if( nFlags & 0x02 ) dumpUniString32( "key" );
+ }
+}
+
+void ComCtlImageListObject::implDumpCommonTrailing()
+{
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "index" );
+ StdPicObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+
+ComCtlTabStripObject::ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E8A, 0xD12A7AC1, nVersion, true, true )
+{
+}
+
+void ComCtlTabStripObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags-1", "COMCTL-TABSTRIP-FLAGS1" );
+ dumpDec< sal_uInt16 >( "tab-fixed-width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_uInt16 >( "tab-fixed-height", "CONV-HMM-TO-CM" );
+ if( mnVersion == 6 )
+ {
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TABSTRIP-FLAGS2" );
+ dumpDec< sal_uInt16 >( "tab-min-width", "CONV-HMM-TO-CM" );
+ dumpUnknown( 2 );
+ dumpHex< sal_uInt32 >( "flags-3", "COMCTL-TABSTRIP-FLAGS3" );
+ }
+}
+
+void ComCtlTabStripObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 12 );
+ dumpUniString32( "image-list" );
+ sal_Int32 nTabCount = dumpDec< sal_Int32 >( "tab-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nTabIndex = 0; (nTabIndex < nTabCount) && !mxStrm->isEof(); ++nTabIndex )
+ {
+ writeEmptyItem( "#tab" );
+ IndentGuard aIndGuard( mxOut );
+ dumpUnknown( 4 );
+ sal_uInt32 nTabFlags = dumpHex< sal_uInt32 >( "tab-flags", "COMCTL-TABSTRIP-TABFLAGS" );
+ if( nTabFlags & 0x01 ) dumpUniString32( "caption" );
+ if( nTabFlags & 0x02 ) dumpUniString32( "key" );
+ if( nTabFlags & 0x04 ) dumpUniString32( "tag" );
+ if( nTabFlags & 0x08 ) dumpUniString32( "tooltip" );
+ dumpDec< sal_uInt16 >( "image-id" );
+ }
+}
+
+// ============================================================================
+
+ComCtlTreeViewObject::ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E8E, 0x6AC13CB1, nVersion, true, true ),
+ mnStringFlags( 0 )
+{
+}
+
+void ComCtlTreeViewObject::implDumpProperties()
+{
+ dumpHex< sal_uInt32 >( "flags", "COMCTL-TREEVIEW-FLAGS" );
+ dumpDec< sal_Int32 >( "indentation", "CONV-HMM-TO-CM" );
+ if( mnVersion == 6 )
+ dumpHex< sal_uInt32 >( "flags-2", "COMCTL-TREEVIEW-FLAGS2" );
+ mnStringFlags = dumpHex< sal_uInt32 >( "string-flags", "COMCTL-TREEVIEW-STRINGFLAGS" );
+}
+
+void ComCtlTreeViewObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpOleColor( "text-color" );
+ dumpOleColor( "back-color" );
+ dumpUnknown( 4 );
+ if( mnStringFlags & 0x02 )
+ dumpUniString32( "image-list" );
+ dumpUniString32( "path-separator" );
+}
+
+// ============================================================================
+
+ComCtlStatusBarObject::ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion ) :
+ ComCtlObjectBase( rParent, 0xE6E17E88, SAL_MAX_UINT32, nVersion, true, true )
+{
+}
+
+void ComCtlStatusBarObject::implDumpProperties()
+{
+ dumpBool< sal_Int32 >( "style-simple-text" );
+ dumpBool< sal_Int16 >( "show-tips" );
+ dumpUnknown( 2 );
+}
+
+void ComCtlStatusBarObject::implDumpCommonExtra( sal_Int64 /*nEndPos*/ )
+{
+ dumpUnknown( 12 );
+ dumpUniString32( "simple-text" );
+ sal_Int32 nPanelCount = dumpDec< sal_Int32 >( "panel-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nPanelIndex = 0; (nPanelIndex < nPanelCount) && !mxStrm->isEof(); ++nPanelIndex )
+ {
+ writeEmptyItem( "#panel" );
+ IndentGuard aIndGuard( mxOut );
+ dumpHex< sal_uInt32 >( "panel-flags", "COMCTL-STATUSBAR-PANELFLAGS" );
+ dumpDec< sal_Int32 >( "current-width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "minimal-width", "CONV-HMM-TO-CM" );
+ sal_uInt32 nTextFlags = dumpHex< sal_uInt32 >( "text-flags", "COMCTL-STATUSBAR-TEXTFLAGS" );
+ if( nTextFlags & 0x01 ) dumpUniString32( "text" );
+ if( nTextFlags & 0x02 ) dumpUniString32( "vis-text" );
+ if( nTextFlags & 0x04 ) dumpUniString32( "key" );
+ if( nTextFlags & 0x08 ) dumpUniString32( "tag" );
+ if( nTextFlags & 0x10 ) dumpUniString32( "tooltip" );
+ }
+}
+
+void ComCtlStatusBarObject::implDumpCommonTrailing()
+{
+ sal_Int32 nImageCount = dumpDec< sal_Int32 >( "image-count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nImageIndex = 0; (nImageIndex < nImageCount) && !mxStrm->isEof(); ++nImageIndex )
+ {
+ writeEmptyItem( "#image" );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_Int32 >( "panel-index" );
+ StdPicObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+void AxPropertyObjectBase::construct( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const String& rPropNameList, bool b64BitPropFlags )
+{
+ OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+void AxPropertyObjectBase::construct( const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const String& rPropNameList, bool b64BitPropFlags )
+{
+ OleInputObjectBase::construct( rParent, rxStrm );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+void AxPropertyObjectBase::construct( const InputObjectBase& rParent,
+ const String& rPropNameList, bool b64BitPropFlags )
+{
+ OleInputObjectBase::construct( rParent );
+ constructAxPropObj( rPropNameList, b64BitPropFlags );
+}
+
+bool AxPropertyObjectBase::implIsValid() const
+{
+ return OleInputObjectBase::implIsValid() && mxStrm->isSeekable();
+}
+
+void AxPropertyObjectBase::implDump()
+{
+ mbValid = true;
+ // header
+ setAlignAnchor();
+ dumpVersion();
+ sal_uInt16 nSize = dumpDec< sal_uInt16 >( "size" );
+ mnPropertiesEnd = mxStrm->tell() + nSize;
+ // property flags
+ maLargeProps.clear();
+ maStreamProps.clear();
+ mnPropFlags = dumpHex< sal_Int64, sal_uInt32 >( mb64BitPropFlags, "properties", mxPropNames );
+ mnCurrProp = 0;
+ // properties
+ dumpShortProperties();
+ dumpLargeProperties();
+ setAlignAnchor();
+ if( ensureValid() )
+ implDumpExtended();
+}
+
+void AxPropertyObjectBase::implDumpShortProperties()
+{
+}
+
+void AxPropertyObjectBase::implDumpExtended()
+{
+}
+
+bool AxPropertyObjectBase::ensureValid( bool bCondition )
+{
+ if( mbValid && (!bCondition || mxStrm->isEof()) )
+ {
+ if( !bCondition )
+ writeInfoItem( "state", OOX_DUMP_ERRASCII( "format-error" ) );
+ mbValid = false;
+ }
+ return mbValid;
+}
+
+void AxPropertyObjectBase::setAlignAnchor()
+{
+ mnPropertiesStart = mxStrm->tell();
+}
+
+bool AxPropertyObjectBase::startNextProperty()
+{
+ if( mnCurrProp == 0 ) mnCurrProp = 1; else mnCurrProp <<= 1;
+ bool bHasProp = getFlag( mnPropFlags, mnCurrProp );
+ setFlag( mnPropFlags, mnCurrProp, false );
+ return ensureValid() && bHasProp;
+}
+
+OUString AxPropertyObjectBase::getPropertyName() const
+{
+ return cfg().getName( mxPropNames, mnCurrProp );
+}
+
+sal_uInt32 AxPropertyObjectBase::dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList )
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt32 >();
+ return dumpHex< sal_uInt32 >( getPropertyName(), pcNameList );
+ }
+ return nDefault;
+}
+
+sal_uInt32 AxPropertyObjectBase::dumpColorProperty( sal_uInt32 nDefault )
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt32 >();
+ return dumpOleColor( getPropertyName() );
+ }
+ return nDefault;
+}
+
+sal_Unicode AxPropertyObjectBase::dumpUnicodeProperty()
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt16 >();
+ return dumpUnicode( getPropertyName() );
+ }
+ return '\0';
+}
+
+void AxPropertyObjectBase::dumpUnknownProperty()
+{
+ if( startNextProperty() )
+ ensureValid( false );
+}
+
+void AxPropertyObjectBase::dumpPosProperty()
+{
+ if( startNextProperty() )
+ maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_POS, getPropertyName(), 8 ) );
+}
+
+void AxPropertyObjectBase::dumpSizeProperty()
+{
+ if( startNextProperty() )
+ maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_SIZE, getPropertyName(), 8 ) );
+}
+
+void AxPropertyObjectBase::dumpGuidProperty( OUString* pValue )
+{
+ if( startNextProperty() )
+ maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_GUID, getPropertyName(), 16, pValue ) );
+}
+
+void AxPropertyObjectBase::dumpStringProperty( OUString* pValue )
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt32 >();
+ sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "AX-STRINGLEN" );
+ maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRING, getPropertyName(), nLen, pValue ) );
+ }
+}
+
+void AxPropertyObjectBase::dumpStringArrayProperty()
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt32 >();
+ sal_uInt32 nLen = dumpHex< sal_uInt32 >( getPropertyName(), "CONV-DEC" );
+ maLargeProps.push_back( LargeProperty( LargeProperty::PROPTYPE_STRINGARRAY, getPropertyName(), nLen ) );
+ }
+}
+
+void AxPropertyObjectBase::dumpStreamProperty()
+{
+ if( startNextProperty() )
+ {
+ alignInput< sal_uInt16 >();
+ sal_uInt16 nData = dumpHex< sal_uInt16 >( getPropertyName() );
+ maStreamProps.push_back( StreamProperty( getPropertyName(), nData ) );
+ }
+}
+
+void AxPropertyObjectBase::dumpEmbeddedFont()
+{
+ if( ensureValid() )
+ {
+ writeEmptyItem( "embedded-fontdata" );
+ IndentGuard aIndGuard( mxOut );
+ AxCFontNewObject( *this ).dump();
+ }
+}
+
+void AxPropertyObjectBase::dumpToPosition( sal_Int64 nPos )
+{
+ dumpRemainingTo( nPos );
+ mbValid = true;
+ ensureValid();
+}
+
+void AxPropertyObjectBase::constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags )
+{
+ if( OleInputObjectBase::implIsValid() )
+ {
+ mxPropNames = cfg().getNameList( rPropNameList );
+ mb64BitPropFlags = b64BitPropFlags;
+ mbValid = true;
+ }
+}
+
+void AxPropertyObjectBase::dumpVersion()
+{
+ ItemGuard aItem( mxOut, "version" );
+ sal_uInt8 nMinor, nMajor;
+ *mxStrm >> nMinor >> nMajor;
+ mxOut->writeDec( nMajor );
+ mxOut->writeChar( '.' );
+ mxOut->writeDec( nMinor );
+}
+
+OUString AxPropertyObjectBase::dumpString( const String& rName, sal_uInt32 nSize, bool bArray )
+{
+ bool bCompressed = getFlag( nSize, AX_STRING_COMPRESSED );
+ sal_uInt32 nBufSize = extractValue< sal_uInt32 >( nSize, 0, 31 );
+ OUString aString = bCompressed ?
+ dumpCharArray( rName, nBufSize, RTL_TEXTENCODING_ISO_8859_1 ) :
+ dumpUnicodeArray( rName, bArray ? nBufSize : (nBufSize / 2) );
+ alignInput< sal_Int32 >();
+ return aString;
+}
+
+void AxPropertyObjectBase::dumpShortProperties()
+{
+ if( ensureValid() )
+ {
+ writeEmptyItem( "short-properties" );
+ IndentGuard aIndGuard( mxOut );
+ implDumpShortProperties();
+ alignInput< sal_uInt32 >();
+ }
+}
+
+void AxPropertyObjectBase::dumpLargeProperties()
+{
+ if( ensureValid( mnPropFlags == 0 ) && !maLargeProps.empty() )
+ {
+ writeEmptyItem( "large-properties" );
+ IndentGuard aIndGuard( mxOut );
+ for( LargePropertyVector::iterator aIt = maLargeProps.begin(), aEnd = maLargeProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
+ {
+ switch( aIt->mePropType )
+ {
+ case LargeProperty::PROPTYPE_POS:
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( aIt->maItemName );
+ dumpDec< sal_Int32 >( "top", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "left", "CONV-HMM-TO-CM" );
+ }
+ break;
+ case LargeProperty::PROPTYPE_SIZE:
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( aIt->maItemName );
+ dumpDec< sal_Int32 >( "width", "CONV-HMM-TO-CM" );
+ dumpDec< sal_Int32 >( "height", "CONV-HMM-TO-CM" );
+ }
+ break;
+ case LargeProperty::PROPTYPE_GUID:
+ {
+ OUString aGuid = dumpGuid( aIt->maItemName );
+ if( aIt->mpItemValue )
+ *aIt->mpItemValue = cfg().getStringOption( aGuid, OUString() );
+ }
+ break;
+ case LargeProperty::PROPTYPE_STRING:
+ {
+ OUString aString = dumpString( aIt->maItemName, aIt->mnDataSize, false );
+ if( aIt->mpItemValue )
+ *aIt->mpItemValue = aString;
+ }
+ break;
+ case LargeProperty::PROPTYPE_STRINGARRAY:
+ {
+ writeEmptyItem( aIt->maItemName );
+ IndentGuard aIndGuard2( mxOut );
+ mxOut->resetItemIndex();
+ sal_Int64 nEndPos = mxStrm->tell() + aIt->mnDataSize;
+ while( mxStrm->tell() < nEndPos )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ sal_uInt32 nDataSize = dumpHex< sal_uInt32 >( "#flags", "AX-ARRAYSTRINGLEN" );
+ dumpString( "string", nDataSize, true );
+ }
+ dumpToPosition( nEndPos );
+ }
+ break;
+ }
+ }
+ }
+ dumpToPosition( mnPropertiesEnd );
+
+ if( ensureValid() && !maStreamProps.empty() )
+ {
+ writeEmptyItem( "stream-properties" );
+ IndentGuard aIndGuard( mxOut );
+ for( StreamPropertyVector::iterator aIt = maStreamProps.begin(), aEnd = maStreamProps.end(); ensureValid() && (aIt != aEnd); ++aIt )
+ {
+ writeEmptyItem( aIt->maItemName );
+ if( ensureValid( aIt->mnData == 0xFFFF ) )
+ {
+ IndentGuard aIndGuard2( mxOut );
+ OUString aClassName = cfg().getStringOption( dumpGuid(), OUString() );
+ if( aClassName.equalsAscii( "StdFont" ) )
+ StdFontObject( *this ).dump();
+ else if( aClassName.equalsAscii( "StdPic" ) )
+ StdPicObject( *this ).dump();
+ else if( aClassName.equalsAscii( "CFontNew" ) )
+ AxCFontNewObject( *this ).dump();
+ else
+ ensureValid( false );
+ }
+ }
+ }
+}
+
+// ============================================================================
+
+AxCFontNewObject::AxCFontNewObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-CFONTNEW-PROPERTIES" );
+}
+
+void AxCFontNewObject::implDumpShortProperties()
+{
+ dumpStringProperty();
+ dumpFlagsProperty( 0, "AX-CFONTNEW-FLAGS" );
+ dumpDecProperty< sal_Int32 >( 160 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_uInt8 >( WINDOWS_CHARSET_DEFAULT, "CHARSET" );
+ dumpDecProperty< sal_uInt8 >( 0, "FONT-PITCHFAMILY" );
+ dumpDecProperty< sal_uInt8 >( 1, "AX-CFONTNEW-ALIGNMENT" );
+ dumpDecProperty< sal_uInt16 >( 400, "FONT-WEIGHT" );
+}
+
+// ============================================================================
+
+AxColumnInfoObject::AxColumnInfoObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-COLUMNINFO-PROPERTIES" );
+}
+
+void AxColumnInfoObject::implDumpShortProperties()
+{
+ dumpDecProperty< sal_Int32 >( -1, "CONV-HMM-TO-CM" );
+}
+
+// ============================================================================
+
+AxCommandButtonObject::AxCommandButtonObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-COMMANDBUTTON-PROPERTIES" );
+}
+
+void AxCommandButtonObject::implDumpShortProperties()
+{
+ dumpColorProperty( 0x80000012 );
+ dumpColorProperty( 0x80000008 );
+ dumpFlagsProperty( 0x0000001B );
+ dumpStringProperty();
+ dumpImagePosProperty();
+ dumpSizeProperty();
+ dumpMousePtrProperty();
+ dumpStreamProperty();
+ dumpUnicodeProperty();
+ dumpBoolProperty();
+ dumpStreamProperty();
+}
+
+void AxCommandButtonObject::implDumpExtended()
+{
+ dumpEmbeddedFont();
+}
+
+// ============================================================================
+
+AxMorphControlObject::AxMorphControlObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-MORPH-PROPERTIES", true );
+}
+
+void AxMorphControlObject::implDumpShortProperties()
+{
+ dumpFlagsProperty( 0x2C80081B );
+ dumpColorProperty( 0x80000005 );
+ dumpColorProperty( 0x80000008 );
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpBorderStyleProperty< sal_uInt8 >( 0 );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SCROLLBARS" );
+ mnCtrlType = dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-CONTROLTYPE" );
+ dumpMousePtrProperty();
+ dumpSizeProperty();
+ dumpUnicodeProperty();
+ dumpDecProperty< sal_uInt32 >( 0, "CONV-HMM-TO-CM" );
+ dumpDecProperty< sal_uInt16 >( 1, "AX-MORPH-BOUNDCOLUMN" );
+ dumpDecProperty< sal_Int16 >( -1, "AX-MORPH-TEXTCOLUMN" );
+ dumpDecProperty< sal_Int16 >( 1, "AX-MORPH-COLUMNCOUNT" );
+ dumpDecProperty< sal_uInt16 >( 8 );
+ mnColInfoCount = dumpDecProperty< sal_uInt16 >( 1 );
+ dumpDecProperty< sal_uInt8 >( 2, "AX-MORPH-MATCHENTRYTYPE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-LISTSTYLE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SHOWDROPDOWNMODE" );
+ dumpUnknownProperty();
+ dumpDecProperty< sal_uInt8 >( 1, "AX-MORPH-DROPDOWNSTYLE" );
+ dumpDecProperty< sal_uInt8 >( 0, "AX-MORPH-SELECTIONTYPE" );
+ dumpStringProperty();
+ dumpStringProperty();
+ dumpImagePosProperty();
+ dumpColorProperty( 0x80000006 );
+ dumpSpecialEffectProperty< sal_uInt32 >( 2 );
+ dumpStreamProperty();
+ dumpStreamProperty();
+ dumpUnicodeProperty();
+ dumpUnknownProperty();
+ dumpBoolProperty();
+ dumpStringProperty();
+}
+
+void AxMorphControlObject::implDumpExtended()
+{
+ dumpEmbeddedFont();
+ dumpColumnInfos();
+}
+
+void AxMorphControlObject::dumpColumnInfos()
+{
+ if( ensureValid() && (mnColInfoCount > 0) && ((mnCtrlType == 2) || (mnCtrlType == 3)) )
+ {
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < mnColInfoCount); ++nIdx )
+ {
+ writeEmptyItem( "#column-info" );
+ IndentGuard aIndGuard( mxOut );
+ AxColumnInfoObject( *this ).dump();
+ }
+ }
+}
+
+// ============================================================================
+
+AxLabelObject::AxLabelObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-LABEL-PROPERTIES" );
+}
+
+void AxLabelObject::implDumpShortProperties()
+{
+ dumpColorProperty( 0x80000012 );
+ dumpColorProperty( 0x8000000F );
+ dumpFlagsProperty( 0x0080001B );
+ dumpStringProperty();
+ dumpImagePosProperty();
+ dumpSizeProperty();
+ dumpMousePtrProperty();
+ dumpColorProperty( 0x80000006 );
+ dumpBorderStyleProperty< sal_uInt16 >( 0 );
+ dumpSpecialEffectProperty< sal_uInt16 >( 0 );
+ dumpStreamProperty();
+ dumpUnicodeProperty();
+ dumpStreamProperty();
+}
+
+void AxLabelObject::implDumpExtended()
+{
+ dumpEmbeddedFont();
+}
+
+// ============================================================================
+
+AxImageObject::AxImageObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-IMAGE-PROPERTIES" );
+}
+
+void AxImageObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ dumpUnknownProperty();
+ dumpBoolProperty();
+ dumpColorProperty( 0x80000006 );
+ dumpColorProperty( 0x8000000F );
+ dumpBorderStyleProperty< sal_uInt8 >( 1 );
+ dumpMousePtrProperty();
+ dumpImageSizeModeProperty();
+ dumpSpecialEffectProperty< sal_uInt8 >( 0 );
+ dumpSizeProperty();
+ dumpStreamProperty();
+ dumpImageAlignProperty();
+ dumpBoolProperty();
+ dumpFlagsProperty( 0x0000001B );
+ dumpStreamProperty();
+}
+
+// ============================================================================
+
+AxScrollBarObject::AxScrollBarObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-SCROLLBAR-PROPERTIES" );
+}
+
+void AxScrollBarObject::implDumpShortProperties()
+{
+ dumpColorProperty( 0x80000012 );
+ dumpColorProperty( 0x8000000F );
+ dumpFlagsProperty( 0x0000001B );
+ dumpSizeProperty();
+ dumpMousePtrProperty();
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 32767 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpHexProperty< sal_uInt32 >( 0 );
+ dumpEnabledProperty();
+ dumpEnabledProperty();
+ dumpDecProperty< sal_Int32 >( 1 );
+ dumpDecProperty< sal_Int32 >( 1 );
+ dumpOrientationProperty();
+ dumpDecProperty< sal_Int16 >( -1, "AX-SCROLLBAR-PROPTHUMB" );
+ dumpDelayProperty();
+ dumpStreamProperty();
+}
+
+// ============================================================================
+
+AxSpinButtonObject::AxSpinButtonObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-SPINBUTTON-PROPERTIES" );
+}
+
+void AxSpinButtonObject::implDumpShortProperties()
+{
+ dumpColorProperty( 0x80000012 );
+ dumpColorProperty( 0x8000000F );
+ dumpFlagsProperty( 0x0000001B );
+ dumpSizeProperty();
+ dumpHexProperty< sal_uInt32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 100 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpEnabledProperty();
+ dumpEnabledProperty();
+ dumpDecProperty< sal_Int32 >( 1 );
+ dumpOrientationProperty();
+ dumpDelayProperty();
+ dumpStreamProperty();
+ dumpMousePtrProperty();
+}
+
+// ============================================================================
+
+AxTabStripObject::AxTabStripObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "AX-TABSTRIP-PROPERTIES" );
+}
+
+void AxTabStripObject::implDumpShortProperties()
+{
+ dumpDecProperty< sal_Int32 >( -1 );
+ dumpColorProperty( 0x8000000F );
+ dumpColorProperty( 0x80000012 );
+ dumpUnknownProperty();
+ dumpSizeProperty();
+ dumpStringArrayProperty();
+ dumpMousePtrProperty();
+ dumpUnknownProperty();
+ dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-ORIENTATION" );
+ dumpDecProperty< sal_uInt32 >( 0, "AX-TABSTRIP-TABSTYLE" );
+ dumpBoolProperty();
+ dumpHmmProperty();
+ dumpHmmProperty();
+ dumpBoolProperty();
+ dumpUnknownProperty();
+ dumpStringArrayProperty();
+ dumpUnknownProperty();
+ dumpStringArrayProperty();
+ dumpFlagsProperty( 0x0000001B );
+ dumpBoolProperty();
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpStringArrayProperty();
+ mnTabFlagCount = dumpDecProperty< sal_Int32 >( 0 );
+ dumpStringArrayProperty();
+ dumpStreamProperty();
+}
+
+void AxTabStripObject::implDumpExtended()
+{
+ dumpEmbeddedFont();
+ if( mnTabFlagCount > 0 )
+ {
+ writeEmptyItem( "tab-flags" );
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnTabFlagCount); ++nIdx )
+ dumpHex< sal_uInt32 >( "#flags", "AX-TABSTRIP-FLAGS" );
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+FormControlStreamObject::FormControlStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, const OUString* pProgId )
+{
+ construct( rParent, rxStrm, rSysFileName );
+ constructFormCtrlStrmObj( pProgId );
+}
+
+FormControlStreamObject::FormControlStreamObject( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString* pProgId )
+{
+ construct( rParent, rxStrm );
+ constructFormCtrlStrmObj( pProgId );
+}
+
+void FormControlStreamObject::implDump()
+{
+ if( mbReadGuid )
+ maProgId = cfg().getStringOption( dumpGuid(), OUString() );
+
+ if( (maProgId.getLength() > 0) && !mxStrm->isEof() )
+ {
+ if( maProgId.equalsAscii( "Forms.CommandButton.1" ) )
+ AxCommandButtonObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.TextBox.1" ) ||
+ maProgId.equalsAscii( "Forms.ListBox.1" ) ||
+ maProgId.equalsAscii( "Forms.ComboBox.1" ) ||
+ maProgId.equalsAscii( "Forms.CheckBox.1" ) ||
+ maProgId.equalsAscii( "Forms.OptionButton.1" ) ||
+ maProgId.equalsAscii( "Forms.ToggleButton.1" ) ||
+ maProgId.equalsAscii( "RefEdit.Ctrl" ) )
+ AxMorphControlObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.Label.1" ) )
+ AxLabelObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.Image.1" ) )
+ AxImageObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.ScrollBar.1" ) )
+ AxScrollBarObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.SpinButton.1" ) )
+ AxSpinButtonObject( *this ).dump();
+ else if( maProgId.equalsAscii( "Forms.TabStrip.1" ) )
+ AxTabStripObject( *this ).dump();
+ else if( maProgId.equalsAscii( "MSComCtl2.FlatScrollBar.2" ) )
+ ComCtlScrollBarObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.ProgCtrl.1" ) )
+ ComCtlProgressBarObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.ProgCtrl.2" ) )
+ ComCtlProgressBarObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.Slider.1" ) )
+ ComCtlSliderObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.Slider.2" ) )
+ ComCtlSliderObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "ComCtl2.UpDown.1" ) )
+ ComCtlUpDownObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComCtl2.UpDown.2" ) )
+ ComCtlUpDownObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.ImageListCtrl.1" ) )
+ ComCtlImageListObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.ImageListCtrl.2" ) )
+ ComCtlImageListObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.TabStrip.1" ) )
+ ComCtlTabStripObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.TabStrip.2" ) )
+ ComCtlTabStripObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.TreeCtrl.1" ) )
+ ComCtlTreeViewObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "MSComctlLib.TreeCtrl.2" ) )
+ ComCtlTreeViewObject( *this, 6 ).dump();
+ else if( maProgId.equalsAscii( "COMCTL.SBarCtrl.1" ) )
+ ComCtlStatusBarObject( *this, 5 ).dump();
+ else if( maProgId.equalsAscii( "StdPic" ) )
+ StdPicObject( *this ).dump();
+ }
+ dumpRemainingStream();
+}
+
+void FormControlStreamObject::constructFormCtrlStrmObj( const OUString* pProgId )
+{
+ mbReadGuid = pProgId == 0;
+ if( pProgId )
+ maProgId = *pProgId;
+}
+
+// ============================================================================
+// ============================================================================
+
+VbaFormClassInfoObject::VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-CLASSINFO-PROPERTIES" );
+}
+
+void VbaFormClassInfoObject::implDumpShortProperties()
+{
+ mrFormData.maClassInfoProgIds.push_back( OUString() );
+ dumpGuidProperty( &mrFormData.maClassInfoProgIds.back() );
+ dumpGuidProperty();
+ dumpUnknownProperty();
+ dumpGuidProperty();
+ dumpFlagsProperty( 0, "VBA-CLASSINFO-FLAGS" );
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpDecProperty< sal_Int32 >( -1 );
+ dumpDecProperty< sal_uInt16 >( 0 );
+ dumpDecProperty< sal_uInt16 >( 0 );
+ dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
+ dumpDecProperty< sal_uInt16 >( 0 );
+ dumpDecProperty< sal_uInt16 >( 0 );
+ dumpDecProperty< sal_uInt16 >( 0, "OLEPROP-TYPE" );
+ dumpDecProperty< sal_Int32 >( -1 );
+ dumpDecProperty< sal_uInt16 >( 0 );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 VBA_FORMSITE_OBJSTREAM = 0x0010;
+
+const sal_uInt16 VBA_FORMSITE_CLASSTABLEINDEX = 0x8000;
+const sal_uInt16 VBA_FORMSITE_CLASSTABLEMASK = 0x7FFF;
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+VbaFormSiteObject::VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-FORMSITE-PROPERTIES" );
+}
+
+void VbaFormSiteObject::implDumpShortProperties()
+{
+ VbaFormSiteInfo aSiteInfo;
+ dumpStringProperty();
+ dumpStringProperty();
+ sal_Int32 nId = dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ sal_uInt32 nFlags = dumpFlagsProperty( 0x00000033, "VBA-FORMSITE-FLAGS" );
+ sal_uInt32 nLength = dumpDecProperty< sal_uInt32 >( 0 );
+ dumpDecProperty< sal_Int16 >( -1 );
+ sal_uInt16 nClassId = dumpHexProperty< sal_uInt16 >( 0x7FFF, "VBA-FORMSITE-CLASSIDCACHE" );
+ dumpPosProperty();
+ dumpDecProperty< sal_uInt16 >( 0 );
+ dumpUnknownProperty();
+ dumpStringProperty();
+ dumpStringProperty();
+ dumpStringProperty();
+ dumpStringProperty();
+
+ sal_uInt16 nIndex = nClassId & VBA_FORMSITE_CLASSTABLEMASK;
+ if( getFlag( nClassId, VBA_FORMSITE_CLASSTABLEINDEX ) )
+ {
+ if( nIndex < mrFormData.maClassInfoProgIds.size() )
+ aSiteInfo.maProgId = mrFormData.maClassInfoProgIds[ nIndex ];
+ }
+ else
+ {
+ if( cfg().hasName( "VBA-FORMSITE-CLASSNAMES", nIndex ) )
+ aSiteInfo.maProgId = cfg().getName( "VBA-FORMSITE-CLASSNAMES", nIndex );
+ }
+ aSiteInfo.mnId = nId;
+ aSiteInfo.mnLength = nLength;
+ aSiteInfo.mbInStream = getFlag( nFlags, VBA_FORMSITE_OBJSTREAM );
+
+ mrFormData.maSiteInfos.push_back( aSiteInfo );
+}
+
+// ============================================================================
+
+VbaFormDesignExtObject::VbaFormDesignExtObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-FORMDESIGNEXT-PROPERTIES" );
+}
+
+void VbaFormDesignExtObject::implDumpShortProperties()
+{
+ dumpFlagsProperty( 0x00015F55, "VBA-FORMDESIGNEXT-FLAGS" );
+ dumpHmmProperty();
+ dumpHmmProperty();
+ dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-CLICKCTRLMODE" );
+ dumpDecProperty< sal_Int8 >( 0, "VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE" );
+}
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt32 AX_FORM_HASDESIGNEXTENDER = 0x00004000;
+const sal_uInt32 AX_FORM_SKIPCLASSTABLE = 0x00008000;
+
+const sal_uInt8 AX_FORM_SITECOUNTTYPE_COUNT = 0x80;
+const sal_uInt8 AX_FORM_SITECOUNTTYPE_MASK = 0x7F;
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+VbaFStreamObject::VbaFStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ AxPropertyObjectBase::construct( rParent, rxStrm, rSysFileName, "VBA-FORM-PROPERTIES" );
+}
+
+void VbaFStreamObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ dumpColorProperty( 0x8000000F );
+ dumpColorProperty( 0x80000012 );
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpUnknownProperty();
+ dumpUnknownProperty();
+ mnFlags = dumpFlagsProperty( 0x00000004, "VBA-FORM-FLAGS" );
+ dumpBorderStyleProperty< sal_uInt8 >( 0 );
+ dumpMousePtrProperty();
+ dumpHexProperty< sal_uInt8 >( 0x0C, "VBA-FORM-SCROLLBARS" );
+ dumpSizeProperty();
+ dumpSizeProperty();
+ dumpPosProperty();
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpUnknownProperty();
+ dumpStreamProperty();
+ dumpDecProperty< sal_uInt8 >( 0, "VBA-FORM-CYCLE" );
+ dumpSpecialEffectProperty< sal_uInt8 >( 0 );
+ dumpColorProperty( 0x80000012 );
+ dumpStringProperty();
+ dumpStreamProperty();
+ dumpStreamProperty();
+ dumpDecProperty< sal_Int32 >( 100, "CONV-PERCENT" );
+ dumpImageAlignProperty();
+ dumpBoolProperty();
+ dumpImageSizeModeProperty();
+ dumpDecProperty< sal_uInt32 >( 0 );
+ dumpDecProperty< sal_uInt32 >( 0 );
+}
+
+void VbaFStreamObject::implDumpExtended()
+{
+ dumpClassInfos();
+ dumpSiteData();
+ dumpDesignExtender();
+ dumpRemainingStream();
+}
+
+void VbaFStreamObject::dumpClassInfos()
+{
+ if( ensureValid() && !getFlag( mnFlags, AX_FORM_SKIPCLASSTABLE ) )
+ {
+ mxOut->emptyLine();
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "class-info-count" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
+ {
+ writeEmptyItem( "#class-info" );
+ IndentGuard aIndGuard( mxOut );
+ VbaFormClassInfoObject( *this, mrFormData ).dump();
+ }
+ }
+}
+
+void VbaFStreamObject::dumpFormSites( sal_uInt32 nCount )
+{
+ mxOut->resetItemIndex();
+ for( sal_uInt32 nIdx = 0; ensureValid() && (nIdx < nCount); ++nIdx )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "#form-site" );
+ IndentGuard aIndGuard( mxOut );
+ VbaFormSiteObject( *this, mrFormData ).dump();
+ }
+}
+
+void VbaFStreamObject::dumpSiteData()
+{
+ if( ensureValid() )
+ {
+ mxOut->emptyLine();
+ setAlignAnchor();
+ sal_uInt32 nSiteCount = dumpDec< sal_uInt32 >( "site-count" );
+ sal_uInt32 nSiteLength = dumpDec< sal_uInt32 >( "site-data-size" );
+ sal_Int64 nEndPos = mxStrm->tell() + nSiteLength;
+ if( ensureValid( nEndPos <= mxStrm->getLength() ) )
+ {
+ mxOut->resetItemIndex();
+ sal_uInt32 nSiteIdx = 0;
+ while( ensureValid() && (nSiteIdx < nSiteCount) )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "#site-info" );
+ IndentGuard aIndGuard( mxOut );
+ dumpDec< sal_uInt8 >( "depth" );
+ sal_uInt8 nTypeCount = dumpHex< sal_uInt8 >( "type-count", "VBA-FORM-SITE-TYPECOUNT" );
+ if( getFlag( nTypeCount, AX_FORM_SITECOUNTTYPE_COUNT ) )
+ {
+ dumpDec< sal_uInt8 >( "repeated-type" );
+ nSiteIdx += (nTypeCount & AX_FORM_SITECOUNTTYPE_MASK);
+ }
+ else
+ {
+ ++nSiteIdx;
+ }
+ }
+ alignInput< sal_uInt32 >();
+ dumpFormSites( nSiteCount );
+ dumpToPosition( nEndPos );
+ }
+ }
+}
+
+void VbaFStreamObject::dumpDesignExtender()
+{
+ if( ensureValid() && getFlag( mnFlags, AX_FORM_HASDESIGNEXTENDER ) )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "design-extender" );
+ IndentGuard aIndGuard( mxOut );
+ VbaFormDesignExtObject( *this ).dump();
+ }
+}
+
+// ============================================================================
+
+VbaOStreamObject::VbaOStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ OleInputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaOStreamObject::implDump()
+{
+ for( VbaFormSiteInfoVector::iterator aIt = mrFormData.maSiteInfos.begin(), aEnd = mrFormData.maSiteInfos.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
+ {
+ if( (aIt->mbInStream) && (aIt->mnLength > 0) )
+ {
+ mxOut->emptyLine();
+ writeDecItem( "control-id", aIt->mnId );
+ writeInfoItem( "prog-id", aIt->maProgId );
+ IndentGuard aIndGuard( mxOut );
+ RelativeInputStreamRef xRelStrm( new RelativeInputStream( *mxStrm, aIt->mnLength ) );
+ FormControlStreamObject( *this, xRelStrm, &aIt->maProgId ).dump();
+ }
+ }
+ dumpRemainingStream();
+}
+
+// ============================================================================
+
+VbaPageObject::VbaPageObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-PAGE-PROPERTIES" );
+}
+
+void VbaPageObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ dumpDecProperty< sal_uInt32 >( 0, "VBA-PAGE-TRANSITIONEFFECT" );
+ dumpDecProperty< sal_uInt32 >( 0, "AX-CONV-MS" );
+}
+
+// ============================================================================
+
+VbaMultiPageObject::VbaMultiPageObject( const InputObjectBase& rParent )
+{
+ AxPropertyObjectBase::construct( rParent, "VBA-MULTIPAGE-PROPERTIES" );
+}
+
+void VbaMultiPageObject::implDumpShortProperties()
+{
+ dumpUnknownProperty();
+ mnPageCount = dumpDecProperty< sal_Int32 >( 0 );
+ dumpDecProperty< sal_Int32 >( 0 );
+ dumpBoolProperty();
+}
+
+void VbaMultiPageObject::implDumpExtended()
+{
+ if( ensureValid() && (mnPageCount > 0) )
+ {
+ writeEmptyItem( "page-ids" );
+ IndentGuard aIndGuard( mxOut );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nIdx = 0; ensureValid() && (nIdx < mnPageCount); ++nIdx )
+ dumpDec< sal_Int32 >( "#id" );
+ }
+}
+
+// ============================================================================
+
+VbaXStreamObject::VbaXStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaFormSharedData& rFormData ) :
+ mrFormData( rFormData )
+{
+ InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaXStreamObject::implDump()
+{
+ for( size_t nIdx = 0, nCount = mrFormData.maSiteInfos.size(); !mxStrm->isEof() && (nIdx < nCount); ++nIdx )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "page" );
+ IndentGuard aIndGuard( mxOut );
+ VbaPageObject( *this ).dump();
+ }
+ if( !mxStrm->isEof() )
+ {
+ mxOut->emptyLine();
+ writeEmptyItem( "multi-page" );
+ IndentGuard aIndGuard( mxOut );
+ VbaMultiPageObject( *this ).dump();
+ }
+ dumpRemainingStream();
+}
+
+// ============================================================================
+
+VbaContainerStorageObject::VbaContainerStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+ OleStorageObject( rParent, rxStrg, rSysPath )
+{
+ addPreferredStream( "f" );
+}
+
+void VbaContainerStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( rStrmName.equalsAscii( "f" ) )
+ VbaFStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ else if( rStrmName.equalsAscii( "o" ) )
+ VbaOStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ else if( rStrmName.equalsAscii( "x" ) )
+ VbaXStreamObject( *this, rxStrm, rSysFileName, maFormData ).dump();
+ else
+ OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void VbaContainerStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+ if( isFormStorage( rStrgPath ) )
+ VbaContainerStorageObject( *this, rxStrg, rSysPath ).dump();
+ else
+ OleStorageObject( *this, rxStrg, rSysPath ).dump();
+}
+
+bool VbaContainerStorageObject::isFormStorage( const OUString& rStrgPath ) const
+{
+ if( (rStrgPath.getLength() >= 3) && (rStrgPath[ 0 ] == 'i') )
+ {
+ OUString aId = rStrgPath.copy( 1 );
+ if( (aId.getLength() == 2) && (aId[ 0 ] == '0') )
+ aId = aId.copy( 1 );
+ sal_Int32 nId = aId.toInt32();
+ if( (nId > 0) && (OUString::valueOf( nId ) == aId) )
+ for( VbaFormSiteInfoVector::const_iterator aIt = maFormData.maSiteInfos.begin(), aEnd = maFormData.maSiteInfos.end(); aIt != aEnd; ++aIt )
+ if( aIt->mnId == nId )
+ return true;
+ }
+ return false;
+}
+
+// ============================================================================
+// ============================================================================
+
+VbaSharedData::VbaSharedData() :
+ meTextEnc( RTL_TEXTENCODING_MS_1252 )
+{
+}
+
+bool VbaSharedData::isModuleStream( const ::rtl::OUString& rStrmName ) const
+{
+ return maStrmOffsets.count( rStrmName ) > 0;
+}
+
+sal_Int32 VbaSharedData::getStreamOffset( const OUString& rStrmName ) const
+{
+ StreamOffsetMap::const_iterator aIt = maStrmOffsets.find( rStrmName );
+ return (aIt == maStrmOffsets.end()) ? 0 : aIt->second;
+}
+
+// ============================================================================
+
+VbaDirStreamObject::VbaDirStreamObject( const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName, VbaSharedData& rVbaData ) :
+ mrVbaData( rVbaData )
+{
+ mxInStrm = rxStrm;
+ if( mxInStrm.get() )
+ {
+ BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxInStrm ) );
+ SequenceRecordObjectBase::construct( rParent, xVbaStrm, rSysFileName, "VBA-DIR-RECORD-NAMES", "VBA-DIR-SIMPLE-RECORDS" );
+ }
+}
+
+bool VbaDirStreamObject::implIsValid() const
+{
+ return mxInStrm.get() && SequenceRecordObjectBase::implIsValid();
+}
+
+bool VbaDirStreamObject::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+ ornRecId = rBaseStrm.readuInt16();
+ ornRecSize = rBaseStrm.readInt32();
+
+ // for no obvious reason, PROJECTVERSION record contains size field of 4, but is 6 bytes long
+ if( ornRecId == 9 )
+ ornRecSize = 6;
+
+ return !rBaseStrm.isEof();
+}
+
+void VbaDirStreamObject::implDumpRecordBody()
+{
+ switch( getRecId() )
+ {
+ case 0x0003:
+ mrVbaData.meTextEnc = rtl_getTextEncodingFromWindowsCodePage( dumpDec< sal_uInt16 >( "codepage", "CODEPAGES" ) );
+ break;
+ case 0x0004:
+ dumpByteString( "name" );
+ break;
+ case 0x0005:
+ dumpByteString( "description" );
+ break;
+ case 0x0006:
+ dumpByteString( "helpfile-path" );
+ break;
+ case 0x0009:
+ dumpDec< sal_uInt32 >( "major" );
+ dumpDec< sal_uInt16 >( "minor" );
+ break;
+ case 0x000C:
+ dumpByteString( "constants" );
+ break;
+ case 0x000D:
+ dumpByteStringWithLength( "lib-id" );
+ dumpUnused( 6 );
+ break;
+ case 0x000E:
+ dumpByteStringWithLength( "lib-id-absolute" );
+ dumpByteStringWithLength( "lib-id-relative" );
+ dumpDec< sal_uInt32 >( "major" );
+ dumpDec< sal_uInt16 >( "minor" );
+ break;
+ case 0x0016:
+ dumpByteString( "name" );
+ break;
+ case 0x0019:
+ dumpByteString( "name" );
+ maCurrStream = OUString();
+ mnCurrOffset = 0;
+ break;
+ case 0x001A:
+ maCurrStream = dumpByteString( "stream-name" );
+ break;
+ case 0x001C:
+ dumpByteString( "description" );
+ break;
+ case 0x002B:
+ if( maCurrStream.getLength() > 0 )
+ mrVbaData.maStrmOffsets[ maCurrStream ] = mnCurrOffset;
+ maCurrStream = OUString();
+ mnCurrOffset = 0;
+ break;
+ case 0x002F:
+ dumpByteStringWithLength( "lib-id-twiddled" );
+ dumpUnused( 6 );
+ break;
+ case 0x0030:
+ dumpByteStringWithLength( "lib-id-extended" );
+ dumpUnused( 6 );
+ dumpGuid( "original-typelib" );
+ dumpDec< sal_uInt32 >( "cookie" );
+ break;
+ case 0x0031:
+ mnCurrOffset = dumpHex< sal_Int32 >( "stream-offset", "CONV-DEC" );
+ break;
+ case 0x0032:
+ dumpUniString( "stream-name" );
+ break;
+ case 0x0033:
+ dumpByteString( "lib-id-original" );
+ break;
+ case 0x003C:
+ dumpUniString( "constants" );
+ break;
+ case 0x003D:
+ dumpByteString( "helpfile-path" );
+ break;
+ case 0x003E:
+ dumpUniString( "name" );
+ break;
+ case 0x0040:
+ dumpUniString( "description" );
+ break;
+ case 0x0047:
+ dumpUniString( "name" );
+ break;
+ case 0x0048:
+ dumpUniString( "description" );
+ break;
+ }
+}
+
+OUString VbaDirStreamObject::dumpByteString( const String& rName )
+{
+ return dumpCharArray( rName, static_cast< sal_Int32 >( getRecSize() ), mrVbaData.meTextEnc );
+}
+
+OUString VbaDirStreamObject::dumpUniString( const String& rName )
+{
+ return dumpUnicodeArray( rName, static_cast< sal_Int32 >( getRecSize() / 2 ) );
+}
+
+OUString VbaDirStreamObject::dumpByteStringWithLength( const String& rName )
+{
+ return dumpCharArray( rName, mxStrm->readInt32(), mrVbaData.meTextEnc );
+}
+
+// ============================================================================
+
+VbaModuleStreamObject::VbaModuleStreamObject(
+ const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName, VbaSharedData& rVbaData, sal_Int32 nStrmOffset ) :
+ mrVbaData( rVbaData ),
+ mnStrmOffset( nStrmOffset )
+{
+ InputObjectBase::construct( rParent, rxStrm, rSysFileName );
+}
+
+void VbaModuleStreamObject::implDump()
+{
+ dumpBinary( "perf-cache", mnStrmOffset );
+ mxOut->emptyLine();
+ writeEmptyItem( "source-code" );
+ IndentGuard aIndGuard( mxOut );
+ BinaryInputStreamRef xVbaStrm( new ::oox::ole::VbaInputStream( *mxStrm ) );
+ TextStreamObject( *this, xVbaStrm, mrVbaData.meTextEnc ).dump();
+}
+
+// ============================================================================
+
+VbaStorageObject::VbaStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
+ OleStorageObject( rParent, rxStrg, rSysPath ),
+ mrVbaData( rVbaData )
+{
+ addPreferredStream( "dir" );
+}
+
+void VbaStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "dir" ) )
+ VbaDirStreamObject( *this, rxStrm, rSysFileName, mrVbaData ).dump();
+ else if( mrVbaData.isModuleStream( rStrmName ) )
+ VbaModuleStreamObject( *this, rxStrm, rSysFileName, mrVbaData, mrVbaData.getStreamOffset( rStrmName ) ).dump();
+ else
+ OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+// ============================================================================
+
+VbaFormStorageObject::VbaFormStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath, VbaSharedData& rVbaData ) :
+ VbaContainerStorageObject( rParent, rxStrg, rSysPath ),
+ mrVbaData( rVbaData )
+{
+}
+
+void VbaFormStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( rStrmName.equalsAscii( "\003VBFrame" ) )
+ TextStreamObject( *this, rxStrm, mrVbaData.meTextEnc, rSysFileName ).dump();
+ else
+ VbaContainerStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+// ============================================================================
+
+VbaProjectStorageObject::VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+ OleStorageObject( rParent, rxStrg, rSysPath )
+{
+ addPreferredStorage( "VBA" );
+}
+
+void VbaProjectStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ if( (rStrgPath.getLength() == 0) && rStrmName.equalsAscii( "PROJECT" ) )
+ TextStreamObject( *this, rxStrm, maVbaData.meTextEnc, rSysFileName ).dump();
+ else
+ OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
+}
+
+void VbaProjectStorageObject::implDumpStorage( const StorageRef& rxStrg, const OUString& rStrgPath, const OUString& rSysPath )
+{
+ if( rStrgPath.equalsAscii( "VBA" ) )
+ VbaStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
+ else
+ VbaFormStorageObject( *this, rxStrg, rSysPath, maVbaData ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+ActiveXStorageObject::ActiveXStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath ) :
+ VbaContainerStorageObject( rParent, rxStrg, rSysPath )
+{
+}
+
+void ActiveXStorageObject::implDumpBaseStream( const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ FormControlStreamObject( *this, rxStrm, rSysFileName ).dump();
+}
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/oledumper.ini b/oox/source/dump/oledumper.ini
new file mode 100644
index 000000000000..c8461d4b28a7
--- /dev/null
+++ b/oox/source/dump/oledumper.ini
@@ -0,0 +1,887 @@
+
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# OLE name lists =============================================================
+
+constlist=OLE-STD-CLIPBOARD-FORMAT
+ 2=bmp
+ 3=wmf
+ 8=dib
+ 14=emf
+end
+
+combilist=OLE-COLOR
+ 0x0000FFFF=uint32,dec,palette-index,,filter=0xFF000000~0x01000000
+ 0x000000FF=uint32,dec,red,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x0000FF00=uint32,dec,green,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x00FF0000=uint32,dec,blue,,filter=0xFF000000~0x00000000,filter=0xFF000000~0x02000000
+ 0x0000FFFF=uint32,dec,system-color,SYSTEMCOLOR,filter=0xFF000000~0x80000000
+ 0xFF000000=uint8,dec,type,OLE-COLORTYPE
+end
+
+constlist=OLE-COLORTYPE
+ 0x00=default
+ 0x01=palette
+ 0x02=rgb
+ 0x80=system-color
+end
+
+multilist=OLE-MOUSEPTR
+ 0=default,arrow,cross,i-beam
+ 6=size-diag-down,size-vert,size-diag-up,size-hor
+ 10=up-arrow,hour-glass,no-drop,app-starting,help,size-all
+ 99=custom
+end
+
+# StdFont --------------------------------------------------------------------
+
+{0BE35203-8F91-11CE-9DE3-00AA004BB851}=StdFont
+
+flagslist=STDFONT-FLAGS
+ 0x01=bold
+ 0x02=italic
+ 0x04=underline
+ 0x08=strikeout
+end
+
+unitconverter=STDFONT-HEIGHT,/10000,pt
+
+# StdPic ---------------------------------------------------------------------
+
+{0BE35204-8F91-11CE-9DE3-00AA004BB851}=StdPic
+
+shortlist=STDPIC-ID,0x0000746C,StdPic
+
+# StdHlink -------------------------------------------------------------------
+
+{79EAC9D0-BAF9-11CE-8C82-00AA004BA90B}=StdHlink
+{79EAC9E0-BAF9-11CE-8C82-00AA004BA90B}=URLMoniker
+{00000303-0000-0000-C000-000000000046}=FileMoniker
+{00000304-0000-0000-C000-000000000046}=ItemMoniker
+{00000305-0000-0000-C000-000000000046}=AntiMoniker
+{00000309-0000-0000-C000-000000000046}=CompositeMoniker
+
+flagslist=STDHLINK-FLAGS
+ 0x00000001=has-target
+ 0x00000002=!relative!absolute
+ 0x00000004=display-specified
+ 0x00000008=has-location
+ 0x00000010=has-display
+ 0x00000020=has-guid
+ 0x00000040=has-creation-time
+ 0x00000080=has-frame
+ 0x00000100=!as-guid!as-string
+ 0x00000200=has-abs-from-rel
+end
+
+flagslist=STDHLINK-URL-FLAGS
+ 0x00000001=allow-relative
+ 0x00000002=wildcard-scheme
+ 0x00000004=implicit-file-scheme
+ 0x00000008=no-fragment
+ 0x00000010=no-canonicalize
+ 0x00000020=canonicalize
+ 0x00000040=dos-path
+ 0x00000080=decode-extra-info
+ 0x00000100=no-decode-extra-info
+ 0x00000200=crack-unknown-schemes
+ 0x00000400=no-crack-unknown-schemes
+ 0x00000800=preprocess-html
+ 0x00001000=no-preprocess-html
+ 0x00002000=registry-settings
+ 0x00004000=no-registry-settings
+ 0x00008000=no-encode-forbidden-chars
+end
+
+# OLE property stream --------------------------------------------------------
+
+{F29F85E0-4FF9-1068-AB91-08002B27B3D9}=GlobalDocProp
+{D5CDD502-2E9C-101B-9397-08002B2CF9AE}=BuiltinDocProp
+{D5CDD505-2E9C-101B-9397-08002B2CF9AE}=CustomDocProp
+
+constlist=OLEPROP-BYTE-ORDER
+ 0xFEFF=big-endian
+ 0xFFFE=little-endian
+end
+
+shortlist=OLEPROP-OSTYPE,0,dos,mac,win32,unix
+
+multilist=OLEPROP-BASEIDS
+ quote-names=1
+ default=
+ 0=dictionary,codepage
+end
+
+multilist=OLEPROP-GLOBALIDS
+ include=OLEPROP-BASEIDS
+ 2=title,subject,author,keywords,comments,template,last-author,rev-number
+ 10=edit-time,last-printed,create-time,last-saved,page-count,word-count,char-count,thumbnail,appname,security
+end
+
+multilist=OLEPROP-BUILTINIDS
+ include=OLEPROP-BASEIDS
+ 2=category,pres-target,byte-count,line-count,para-count,slide-count,note-count,hidden-slide-count
+ 10=clips,scale-crop,heading-pairs,part-titles,manager,company,links-uptodate
+end
+
+multilist=OLEPROP-TYPE-SIMPLE
+ 0=empty,null,int16,int32,float,double,currency,date,string8,dispatch
+ 10=error,bool,variant,unknown,decimal,int8,uint8,uint16,uint32
+ 20=int64,uint64,int,uint,void,hresult,ptr,savearray,c-array,userdef
+ 30=string8,string16,,,,,record,intptr,uintptr
+ 64=time-stamp,blob,stream,storage,stream-obj,storage-obj
+ 70=blob-obj,clip-fmt,guid,vers-stream
+ 0x0FFF=str8-blob
+end
+
+combilist=OLEPROP-TYPE
+ 0x0FFF=int32,dec,base-type,OLEPROP-TYPE-SIMPLE
+ 0x1000=vector
+ 0x2000=array
+ 0x4000=byref
+end
+
+# ComCtl controls ============================================================
+
+constlist=COMCTL-HEADER-IDS
+ 0x0A2BAE11=COMCTL_SLIDER_60
+ 0x12344321=COMCTL_SIZE
+ 0x6AC13CB1=COMCTL_TREEVIEW_60
+ 0x97AB8A01=COMCTL_PROGRESSBAR_60
+ 0x99470A83=COMCTL_SCROLLBAR_60
+ 0xABCDEF01=COMCTL_COMMONDATA
+ 0xBDECDE1F=COMCTL_COMPLEXDATA
+ 0xD12A7AC1=COMCTL_TABSTRIP_60
+ 0xE6E17E80=COMCTL_IMAGELIST_50_60
+ 0xE6E17E84=COMCTL_PROGRESSBAR_50
+ 0xE6E17E86=COMCTL_SLIDER_50
+ 0xE6E17E88=COMCTL_STATUSBAR_50
+ 0xE6E17E8A=COMCTL_TABSTRIP_50
+ 0xE6E17E8E=COMCTL_TREEVIEW_50
+ 0xFF3626A0=COMCTL_UPDOWN_50_60
+end
+
+combilist=COMCTL-COMMON-FLAGS
+ ignore=0xFFFF8000
+ 0x00000001=flat-border
+ 0x00000002=enabled
+ 0x00000004=3d-border
+ 0x000007F8=uint8,dec,mouse-ptr,OLE-MOUSEPTR
+ 0x00000800=ole-drag-auto
+ 0x00002000=ole-drop-manual
+end
+
+flagslist=COMCTL-COMPLEX-FLAGS
+ ignore=0xFFFFFFFC
+ 0x00000001=font
+ 0x00000002=mouse-icon
+end
+
+# flat scrollbar -------------------------------------------------------------
+
+{FE38753A-44A3-11D1-B5B7-0000C09000C4}=MSComCtl2.FlatScrollBar.2
+
+combilist=COMCTL-SCROLLBAR-FLAGS
+ 0x00000003=uint8,dec,appearance,COMCTL-SCROLLBAR-APPEARANCE
+ 0x0000000C=uint8,dec,arrows,COMCTL-SCROLLBAR-ARROWS
+ 0x00000010=!vertical!horizontal
+end
+
+shortlist=COMCTL-SCROLLBAR-APPEARANCE,0,3d,flat,track-3d
+shortlist=COMCTL-SCROLLBAR-ARROWS,0,both,left-up,right-down
+
+# progress bar ---------------------------------------------------------------
+
+{0713E8D2-850A-101B-AFC0-4210102A8DA7}=COMCTL.ProgCtrl.1
+{35053A22-8589-11D1-B16A-00C0F0283628}=MSComctlLib.ProgCtrl.2
+
+# slider ---------------------------------------------------------------------
+
+{373FF7F0-EB8B-11CD-8820-08002B2F4F5A}=COMCTL.Slider.1
+{F08DF954-8592-11D1-B16A-00C0F0283628}=MSComctlLib.Slider.2
+
+constlist=COMCTL-SLIDER-SELECTRANGE
+ 0x00000000=off
+ 0x0000FFFF=on
+end
+
+shortlist=COMCTL-SLIDER-TICKSTYLE,0,bottom-right,top-left,both,no-ticks
+
+# updown ---------------------------------------------------------------------
+
+{026371C0-1B7C-11CF-9D53-00AA003C9CB6}=ComCtl2.UpDown.1
+{603C7E80-87C2-11D1-8BE3-0000F8754DA1}=MSComCtl2.UpDown.2
+
+flagslist=COMCTL-UPDOWN-FLAGS1
+ 0x00000001=!align-left!align-right
+ 0x00000004=!vertical!horizontal
+end
+
+flagslist=COMCTL-UPDOWN-FLAGS2
+ 0x00000004=wrap
+ 0x00000020=ole-drop-manual
+ 0x00000080=enabled
+end
+
+# image list -----------------------------------------------------------------
+
+{58DA8D8F-9D6A-101B-AFC0-4210102A8DA7}=COMCTL.ImageListCtrl.1
+{2C247F23-8591-11D1-B16A-00C0F0283628}=MSComctlLib.ImageListCtrl.2
+
+flagslist=COMCTL-IMAGELIST-TEXTFLAGS
+ 0x01=key
+ 0x02=tag
+end
+
+# tab strip ------------------------------------------------------------------
+
+{9ED94440-E5E8-101B-B9B5-444553540000}=COMCTL.TabStrip.1
+{1EFB6596-857C-11D1-B16A-00C0F0283628}=MSComctlLib.TabStrip.2
+
+combilist=COMCTL-TABSTRIP-FLAGS1
+ ignore=0xFFFFFFE0
+ 0x00000001=multi-row
+ 0x00000002=show-tooltips
+ 0x00000018=uint8,dec,tab-width-style,COMCTL-TABSTRIP-TABWIDTHSTYLE
+end
+
+combilist=COMCTL-TABSTRIP-FLAGS2
+ ignore=0xFFFF0000
+ 0x00000003=uint8,dec,style,COMCTL-TABSTRIP-STYLE
+ 0x00000004=hot-tracking
+ 0x00000008=multi-select
+ 0x00000030=uint8,dec,placement,COMCTL-TABSTRIP-PLACEMENT
+ 0x00000040=separators
+end
+
+flagslist=COMCTL-TABSTRIP-FLAGS3
+ ignore=0xFFFF0000
+ 0x00000001=tabstyle-opposite
+end
+
+shortlist=COMCTL-TABSTRIP-TABWIDTHSTYLE,0,justified,non-justified,fixed
+shortlist=COMCTL-TABSTRIP-STYLE,0,tabs,tab-buttons,flat-buttons
+shortlist=COMCTL-TABSTRIP-PLACEMENT,0,top,bottom,left,right
+
+flagslist=COMCTL-TABSTRIP-TABFLAGS
+ 0x00000001=caption
+ 0x00000002=key
+ 0x00000004=tag
+ 0x00000008=tooltip
+end
+
+# tree view ------------------------------------------------------------------
+
+{0713E8A2-850A-101B-AFC0-4210102A8DA7}=COMCTL.TreeCtrl.1
+{C74190B6-8589-11D1-B16A-00C0F0283628}=MSComctlLib.TreeCtrl.2
+
+combilist=COMCTL-TREEVIEW-FLAGS
+ ignore=0xFFFF0000
+ 0x00000001=!tree-lines!root-lines
+ 0x0000001C=uint8,dec,style,COMCTL-TREEVIEW-STYLE
+ 0x00000020=label-edit
+ 0x00000080=hide-selection
+ 0x00000100=sorted
+end
+
+flagslist=COMCTL-TREEVIEW-STRINGFLAGS
+ ignore=0xFFFFFFF8
+ 0x00000001=separator
+ 0x00000002=image-list
+end
+
+shortlist=COMCTL-TREEVIEW-STYLE,0,text,pic-text,plusminus-text,plusminus-pic-text,treelines-text,treelines-pic-text,treelines-plusminus-text,treelines-plusminus-pic-text
+
+flagslist=COMCTL-TREEVIEW-FLAGS2
+ 0x00000001=checkboxes
+ 0x00000002=full-row-select
+ 0x00000004=hot-tracking
+ 0x00000008=scroll
+ 0x00000010=single-select
+end
+
+# status bar -----------------------------------------------------------------
+
+{6B7E638F-850A-101B-AFC0-4210102A8DA7}=COMCTL.SBarCtrl.1
+
+combilist=COMCTL-STATUSBAR-PANELFLAGS
+ ignore=0xFFFFF000
+ 0x00000007=uint8,dec,style,COMCTL-STATUSBAR-STYLE
+ 0x00000018=uint8,dec,alignment,COMCTL-STATUSBAR-ALIGN
+ 0x00000060=uint8,dec,bevel,COMCTL-STATUSBAR-BEVEL
+ 0x00000080=enabled
+ 0x00000300=uint8,dec,autosize,COMCTL-STATUSBAR-AUTOSIZE
+ 0x00000400=visible
+end
+
+shortlist=COMCTL-STATUSBAR-STYLE,0,text,caps,num,ins,scrl,time,date,kana
+shortlist=COMCTL-STATUSBAR-ALIGN,0,left,center,right
+shortlist=COMCTL-STATUSBAR-BEVEL,0,no-bevel,inset,raised
+shortlist=COMCTL-STATUSBAR-AUTOSIZE,0,no-auto,spring,content
+
+flagslist=COMCTL-STATUSBAR-TEXTFLAGS
+ 0x00000001=text
+ 0x00000002=vis-text
+ 0x00000004=key
+ 0x00000008=tag
+ 0x00000010=tooltip
+end
+
+# other controls =============================================================
+
+# Microsoft Web Browser
+{8856F961-340A-11D0-A96B-00C04FD705A2}=Shell.Explorer.2
+
+# ActiveX name lists =========================================================
+
+combilist=AX-STRINGLEN
+ 0x80000000=!unicode!compressed
+ 0x7FFFFFFF=int32,dec,buffer-size
+end
+
+combilist=AX-ARRAYSTRINGLEN
+ 0x80000000=!unicode!compressed
+ 0x7FFFFFFF=int32,dec,len
+end
+
+combilist=AX-FLAGS
+ 0x00000001=reserved-1
+ 0x00000002=enabled
+ 0x00000004=locked
+ 0x00000008=opaque
+ 0x00000010=reserved-2
+ 0x00000400=column-heads
+ 0x00000800=entire-rows
+ 0x00001000=existing-entries-only
+ 0x00002000=caption-left
+ 0x00004000=editable
+ 0x00078000=uint8,dec,ime-mode,AX-IMEMODE
+ 0x00080000=drag-enabled
+ 0x00100000=enter-as-newline
+ 0x00200000=keep-selection
+ 0x00400000=tab-as-character
+ 0x00800000=word-wrap
+ 0x02000000=borders-suppressed
+ 0x04000000=select-line
+ 0x08000000=single-char-select
+ 0x10000000=auto-size
+ 0x20000000=hide-selection
+ 0x40000000=maxlength-autotab
+ 0x80000000=multi-line
+end
+
+multilist=AX-IMEMODE
+ 0=no-control,on,off,disabled
+ 4=hiragana,fillwidth-katakana,halfwidth-katakana
+ 7=fullwidth-alpha,halfwidth-alpha
+ 9=fullwidth-hangul,halfwidth-hangul
+ 11=fullwidth-hanzi,halfwidth-hanzi
+end
+
+combilist=AX-IMAGEPOS
+ 0x0000FFFF=uint16,dec,image,AX-POS
+ 0xFFFF0000=uint16,dec,label,AX-POS
+end
+
+unitconverter=AX-CONV-MS,1,ms
+
+shortlist=AX-ENABLED,0,disabled,enabled
+shortlist=AX-BORDERSTYLE,0,none,single
+shortlist=AX-SPECIALEFFECT,0,flat,raised,sunken,etched,,,bump
+shortlist=AX-ORIENTATION,-1,auto,vertical,horizontal
+shortlist=AX-POS,0,top-left,top,top-right,left,center,right,bottom-left,bottom,bottom-right
+shortlist=AX-IMAGEALIGN,0,top-left,top-right,center,bottom-left,bottom-right
+shortlist=AX-IMAGESIZEMODE,0,clip,stretch,,stretch-ratio
+
+# CFontNew -------------------------------------------------------------------
+
+{AFC20920-DA4E-11CE-B94300AA006887B4}=CFontNew
+
+flagslist=AX-CFONTNEW-PROPERTIES
+ 0x0001=font-name
+ 0x0002=flags
+ 0x0004=font-size
+ 0x0008=font-offset
+ 0x0010=charset
+ 0x0020=pitch-family
+ 0x0040=alignment
+ 0x0080=font-weight
+end
+
+flagslist=AX-CFONTNEW-FLAGS
+ 0x00000001=bold
+ 0x00000002=italic
+ 0x00000004=underline
+ 0x00000008=strikeout
+ 0x00002000=sunken
+ 0x00002000=sunken
+ 0x40000000=auto-color
+end
+
+shortlist=AX-CFONTNEW-ALIGNMENT,1,left,right,center
+
+# column info ----------------------------------------------------------------
+
+flagslist=AX-COLUMNINFO-PROPERTIES
+ 0x00000001=column-width
+end
+
+# command button -------------------------------------------------------------
+
+{D7053240-CE69-11CD-A777-00DD01143C57}=Forms.CommandButton.1
+
+flagslist=AX-COMMANDBUTTON-PROPERTIES
+ 0x00000001=text-color
+ 0x00000002=fill-color
+ 0x00000004=flags
+ 0x00000008=caption
+ 0x00000010=image-pos
+ 0x00000020=size
+ 0x00000040=mouse-ptr
+ 0x00000080=image
+ 0x00000100=accelerator
+ 0x00000200=no-take-focus
+ 0x00000400=mouse-icon
+end
+
+# toggle button, check box, option button, text box, list box, combo box -----
+
+{8BD21D10-EC42-11CE-9E0D-00AA006002F3}=Forms.TextBox.1
+{8BD21D20-EC42-11CE-9E0D-00AA006002F3}=Forms.ListBox.1
+{8BD21D30-EC42-11CE-9E0D-00AA006002F3}=Forms.ComboBox.1
+{8BD21D40-EC42-11CE-9E0D-00AA006002F3}=Forms.CheckBox.1
+{8BD21D50-EC42-11CE-9E0D-00AA006002F3}=Forms.OptionButton.1
+{8BD21D60-EC42-11CE-9E0D-00AA006002F3}=Forms.ToggleButton.1
+{00024512-0000-0000-C000-000000000046}=RefEdit.Ctrl
+
+flagslist=AX-MORPH-PROPERTIES
+ 0x0000000000000001=flags
+ 0x0000000000000002=fill-color
+ 0x0000000000000004=text-color
+ 0x0000000000000008=max-length
+ 0x0000000000000010=border-style
+ 0x0000000000000020=scrollbars
+ 0x0000000000000040=control-type
+ 0x0000000000000080=mouse-ptr
+ 0x0000000000000100=size
+ 0x0000000000000200=password-char
+ 0x0000000000000400=list-width
+ 0x0000000000000800=bound-column
+ 0x0000000000001000=text-column
+ 0x0000000000002000=column-count
+ 0x0000000000004000=list-rowcount
+ 0x0000000000008000=column-info-count
+ 0x0000000000010000=match-entry-mode
+ 0x0000000000020000=list-style
+ 0x0000000000040000=show-dropdown-mode
+ 0x0000000000100000=dropdown-style
+ 0x0000000000200000=selection-type
+ 0x0000000000400000=value
+ 0x0000000000800000=caption
+ 0x0000000001000000=image-pos
+ 0x0000000002000000=border-color
+ 0x0000000004000000=special-effect
+ 0x0000000008000000=mouse-icon
+ 0x0000000010000000=image
+ 0x0000000020000000=accelerator
+ 0x0000000080000000=reserved
+ 0x0000000100000000=groupname
+end
+
+shortlist=AX-MORPH-SCROLLBARS,0,none,horizontal,vertical,both
+shortlist=AX-MORPH-CONTROLTYPE,1,edit,listbox,combobox,checkbox,optionbutton,togglebutton,dropdown-listbox
+shortlist=AX-MORPH-MATCHENTRYTYPE,0,first-letter,complete,none
+shortlist=AX-MORPH-LISTSTYLE,0,plain,with-buttons
+shortlist=AX-MORPH-SHOWDROPDOWNMODE,0,never,on-focus,always
+shortlist=AX-MORPH-DROPDOWNSTYLE,0,no-symbol,arrow,ellipsis,underline
+shortlist=AX-MORPH-SELECTIONTYPE,0,single,multi,range
+
+constlist=AX-MORPH-BOUNDCOLUMN
+ default=
+ 0=value-is-row-index
+end
+
+constlist=AX-MORPH-TEXTCOLUMN
+ default=
+ -1=first-column-with-width
+ 0=row-numbers
+end
+
+constlist=AX-MORPH-COLUMNCOUNT
+ default=
+ -1=all-columns
+end
+
+# label ----------------------------------------------------------------------
+
+{978C9E23-D4B0-11CE-BF2D-00AA003F40D0}=Forms.Label.1
+
+flagslist=AX-LABEL-PROPERTIES
+ 0x00000001=text-color
+ 0x00000002=fill-color
+ 0x00000004=flags
+ 0x00000008=caption
+ 0x00000010=image-pos
+ 0x00000020=size
+ 0x00000040=mouse-ptr
+ 0x00000080=border-color
+ 0x00000100=border-style
+ 0x00000200=special-effect
+ 0x00000400=image
+ 0x00000800=accelerator
+ 0x00001000=mouse-icon
+end
+
+# image ----------------------------------------------------------------------
+
+{4C599241-6926-101B-9992-00000B65C6F9}=Forms.Image.1
+
+flagslist=AX-IMAGE-PROPERTIES
+ 0x00000004=auto-size
+ 0x00000008=border-color
+ 0x00000010=fill-color
+ 0x00000020=border-style
+ 0x00000040=mouse-ptr
+ 0x00000080=image-size-mode
+ 0x00000100=special-effect
+ 0x00000200=size
+ 0x00000400=image
+ 0x00000800=image-align
+ 0x00001000=image-tiling
+ 0x00002000=flags
+ 0x00004000=mouse-icon
+end
+
+# scroll bar -----------------------------------------------------------------
+
+{DFD181E0-5E2F-11CE-A449-00AA004A803D}=Forms.ScrollBar.1
+
+flagslist=AX-SCROLLBAR-PROPERTIES
+ 0x00000001=arrow-color
+ 0x00000002=fill-color
+ 0x00000004=flags
+ 0x00000008=size
+ 0x00000010=mouse-ptr
+ 0x00000020=min
+ 0x00000040=max
+ 0x00000080=value
+ 0x00000100=unused
+ 0x00000200=prev-enabled
+ 0x00000400=next-enabled
+ 0x00000800=step
+ 0x00001000=page-step
+ 0x00002000=orientation
+ 0x00004000=prop-thumb
+ 0x00008000=delay
+ 0x00010000=mouse-icon
+end
+
+shortlist=AX-SCROLLBAR-PROPTHUMB,-1,proportional,fixed
+
+# spin button ----------------------------------------------------------------
+
+{79176FB0-B7F2-11CE-97EF-00AA006D2776}=Forms.SpinButton.1
+
+flagslist=AX-SPINBUTTON-PROPERTIES
+ 0x00000001=arrow-color
+ 0x00000002=fill-color
+ 0x00000004=flags
+ 0x00000008=size
+ 0x00000010=unused
+ 0x00000020=min
+ 0x00000040=max
+ 0x00000080=value
+ 0x00000100=prev-enabled
+ 0x00000200=next-enabled
+ 0x00000400=step
+ 0x00000800=orientation
+ 0x00001000=delay
+ 0x00002000=mouse-icon
+ 0x00004000=mouse-ptr
+end
+
+# tab strip ------------------------------------------------------------------
+
+{EAE50EB0-4A62-11CE-BED6-00AA00611080}=Forms.TabStrip.1
+
+flagslist=AX-TABSTRIP-PROPERTIES
+ 0x00000001=selected-tab
+ 0x00000002=fill-color
+ 0x00000004=text-color
+ 0x00000010=size
+ 0x00000020=tab-captions
+ 0x00000040=mouse-ptr
+ 0x00000100=tab-orientation
+ 0x00000200=tab-style
+ 0x00000400=multi-row
+ 0x00000800=tab-fixed-width
+ 0x00001000=tab-fixed-height
+ 0x00002000=tooltips
+ 0x00008000=tooltip-strings
+ 0x00020000=tab-names
+ 0x00040000=flags
+ 0x00080000=new-version
+ 0x00100000=tabs-allocated
+ 0x00200000=tags
+ 0x00400000=tab-flag-count
+ 0x00800000=accelerators
+ 0x01000000=mouse-icon
+end
+
+shortlist=AX-TABSTRIP-ORIENTATION,0,top,bottom,left,right
+shortlist=AX-TABSTRIP-TABSTYLE,0,tabs,buttons,none
+
+flagslist=AX-TABSTRIP-FLAGS
+ 0x00000001=visible
+ 0x00000002=enabled
+end
+
+# VBA forms ==================================================================
+
+# form class info ------------------------------------------------------------
+
+flagslist=VBA-CLASSINFO-PROPERTIES
+ 0x00000001=class-id
+ 0x00000002=disp-event
+ 0x00000008=default-prog
+ 0x00000010=class-flags
+ 0x00000020=method-count
+ 0x00000040=dispatch-id-bind
+ 0x00000080=get-bind-index
+ 0x00000100=put-bind-index
+ 0x00000200=bind-type
+ 0x00000400=get-value-index
+ 0x00000800=put-value-index
+ 0x00001000=value-type
+ 0x00002000=dispatch-id-rowset
+ 0x00004000=set-rowset
+end
+
+combilist=VBA-CLASSINFO-FLAGS
+ 0x0000FFFF=uint16,hex,classtable-flags,VBA-CLASSTABLE-CLASSFLAGS
+ 0xFFFF0000=uint16,hex,var-flags,VBA-CLASSTABLE-VARFLAGS
+end
+
+flagslist=VBA-CLASSTABLE-CLASSFLAGS
+ 0x0001=exclusive-value
+ 0x0002=dual-interface
+ 0x0004=no-aggregation
+end
+
+flagslist=VBA-CLASSTABLE-VARFLAGS
+ 0x0001=read-only
+ 0x0002=source
+ 0x0004=bindable
+ 0x0008=request-edit
+ 0x0010=display-bind
+ 0x0020=default-bind
+ 0x0040=hidden
+ 0x0080=restricted
+ 0x0100=default-coll-elem
+ 0x0200=ui-default
+ 0x0400=non-browsable
+ 0x0800=replaceable
+ 0x1000=immediate-bind
+end
+
+# form site ------------------------------------------------------------------
+
+flagslist=VBA-FORMSITE-PROPERTIES
+ 0x00000001=name
+ 0x00000002=tag
+ 0x00000004=id
+ 0x00000008=help-context-id
+ 0x00000010=flags
+ 0x00000020=stream-size
+ 0x00000040=tab-index
+ 0x00000080=class-id-cache-index
+ 0x00000100=pos
+ 0x00000200=group-id
+ 0x00000800=tool-tip
+ 0x00001000=licence-key
+ 0x00002000=control-source
+ 0x00004000=row-source
+end
+
+flagslist=VBA-FORMSITE-FLAGS
+ 0x00000001=tabstop
+ 0x00000002=visible
+ 0x00000004=default
+ 0x00000008=cancel
+ 0x00000010=!storage!obj-stream
+ 0x00000020=auto-size
+ 0x00000100=preserve-height
+ 0x00000200=fit-to-parent
+ 0x00002000=select-child
+ 0x00040000=container
+end
+
+combilist=VBA-FORMSITE-CLASSIDCACHE
+ 0x7FFF=uint16,dec,cache-idx,VBA-FORMSITE-CLASSIDCACHEINDEX,filter=0x8000~0x0000
+ 0x7FFF=uint16,dec,class-table-idx,,filter=0x8000~0x8000
+ 0x8000=!predefined-class-id!class-table-index
+end
+
+constlist=VBA-FORMSITE-CLASSNAMES
+ 7=Forms.Form.1
+ 12=Forms.Image.1
+ 14=Forms.Frame.1
+ 15=Internal.MorphData
+ 16=Forms.SpinButton.1
+ 17=Forms.CommandButton.1
+ 18=Forms.TabStrip.1
+ 21=Forms.Label.1
+ 23=Forms.TextBox.1
+ 24=Forms.ListBox.1
+ 25=Forms.ComboBox.1
+ 26=Forms.CheckBox.1
+ 27=Forms.OptionButton.1
+ 28=Forms.ToggleButton.1
+ 47=Forms.ScrollBar.1
+ 57=Forms.MultiPage.1
+end
+
+constlist=VBA-FORMSITE-CLASSIDCACHEINDEX
+ include=VBA-FORMSITE-CLASSNAMES
+ 0x7FFF=invalid
+end
+
+# form design extender ------------------------------------------------------
+
+flagslist=VBA-FORMDESIGNEXT-PROPERTIES
+ 0x00000001=flags
+ 0x00000002=grid-x
+ 0x00000004=grid-y
+ 0x00000008=click-control-mode
+ 0x00000010=dblclick-control-mode
+end
+
+flagslist=VBA-FORMDESIGNEXT-FLAGS
+ 0x00000001=inherit-design-mode
+ 0x00000002=design-mode
+ 0x00000004=inherit-show-toolbox
+ 0x00000008=show-toolbox
+ 0x00000010=inherit-show-grid
+ 0x00000020=show-grid
+ 0x00000040=inherit-snap-to-grid
+ 0x00000080=snap-to-grid
+ 0x00000100=inherit-grid-x
+ 0x00000200=inherit-grid-y
+ 0x00000400=inherit-click-control-mode
+ 0x00000800=inherit-dblclick-control-mode
+ 0x00001000=inherit-show-invisible
+ 0x00002000=show-invisible
+ 0x00004000=inherit-show-tooltips
+ 0x00008000=show-tooltips
+ 0x00010000=inherit-immediate-layout
+ 0x00020000=immediate-layout
+end
+
+shortlist=VBA-FORMDESIGNEXT-CLICKCTRLMODE,-2,inherit,default,insertion-point,select-then-insert
+shortlist=VBA-FORMDESIGNEXT-DBLCLICKCTRLMODE,-2,inherit,,select-text,edit-code,edit-properties
+
+# form -----------------------------------------------------------------------
+
+{C62A69F0-16DC-11CE-9E98-00AA00574A4F}=Forms.Form.1
+{6E182020-F460-11CE-9BCD-00AA00608E01}=Forms.Frame.1
+
+flagslist=VBA-FORM-PROPERTIES
+ 0x00000002=fill-color
+ 0x00000004=text-color
+ 0x00000008=next-available-id
+ 0x00000040=flags
+ 0x00000080=border-style
+ 0x00000100=mouse-ptr
+ 0x00000200=scrollbars
+ 0x00000400=display-size
+ 0x00000800=logical-size
+ 0x00001000=scroll-pos
+ 0x00002000=group-count
+ 0x00008000=mouse-icon
+ 0x00010000=cycle
+ 0x00020000=special-effect
+ 0x00040000=border-color
+ 0x00080000=caption
+ 0x00100000=font
+ 0x00200000=image
+ 0x00400000=zoom
+ 0x00800000=image-align
+ 0x01000000=image-tiling
+ 0x02000000=image-sizemode
+ 0x04000000=shape-cookie
+ 0x08000000=draw-buffer
+end
+
+flagslist=VBA-FORM-FLAGS
+ 0x00000004=enabled
+ 0x00004000=has-design-extender
+ 0x00008000=!has-class-table!skip-class-table
+end
+
+flagslist=VBA-FORM-SCROLLBARS
+ 0x01=horizontal
+ 0x02=vertical
+ 0x04=keep-horizontal
+ 0x08=keep-vertical
+ 0x10=vertical-left
+end
+
+shortlist=VBA-FORM-CYCLE,0,all-forms,,current-form
+
+combilist=VBA-FORM-SITE-TYPECOUNT
+ 0x7F=uint8,dec,type-count
+ 0x80=!type!count
+end
+
+# page -----------------------------------------------------------------------
+
+flagslist=VBA-PAGE-PROPERTIES
+ 0x00000002=transition-effect
+ 0x00000004=transition-period
+end
+
+shortlist=VBA-PAGE-TRANSITIONEFFECT,0,none,cover-up,cover-right-up,cover-right,cover-right-down,cover-down,cover-left-down,cover-left,cover-left-up,push-up,push-right,push-down,push-left
+
+# multi page -----------------------------------------------------------------
+
+{46E31370-3F7A-11CE-BED6-00AA00611080}=Forms.MultiPage.1
+
+flagslist=VBA-MULTIPAGE-PROPERTIES
+ 0x00000002=page-count
+ 0x00000004=id
+ 0x00000008=enabled
+end
+
+# VBA project name lists =====================================================
+
+multilist=VBA-DIR-RECORD-NAMES
+ 0x0000=,PROJECTSYSKIND,PROJECTLCID,PROJECTCODEPAGE,PROJECTNAME,PROJECTDOCSTRING,PROJECTHELPFILEPATH1,PROJECTHELPCONTEXT
+ 0x0008=PROJECTLIBFLAGS,PROJECTVERSION,,,PROJECTCONSTANTS,REFERENCEREGISTERED,REFERENCEPROJECT,PROJECTMODULES
+ 0x0010=PROJECTEND,,,PROJECTCOOKIE,PROJECTLCIDINVOKE,,REFERENCENAME,
+ 0x0018=,MODULENAME,MODULESTREAMNAME,,MODULEDOCSTRING,,MODULEHELPCONTEXT,
+ 0x0020=,MODULETYPEPROCEDURAL,MODULETYPEDOCUMENT,,,MODULEREADONLY,,
+ 0x0028=MODULEPRIVATE,,,MODULEEND,MODULECOOKIE,,,REFERENCECONTROL
+ 0x0030=REFERENCEEXTENDED,MODULEOFFSET,MODULESTREAMNAMEUNICODE,REFERENCEORIGINAL,,,,
+ 0x0038=,,,,PROJECTCONSTANTSUNICODE,PROJECTHELPFILEPATH2,REFERENCENAMEUNICODE,
+ 0x0040=PROJECTDOCSTRINGUNICODE,,,,,,,MODULENAMEUNICODE
+ 0x0048=MODULEDOCSTRINGUNICODE,,,,,,,
+end
+
+constlist=VBA-DIR-SIMPLE-RECORDS
+ 0x0001=uint32,dec,platform,VBA-DIR-PROJECTSYSKIND-PLATFORM
+ 0x0002=uint32,hex,lang-id
+ 0x0007=uint32,dec,help-context-id
+ 0x0008=uint32,hex,libflags
+ 0x000F=uint16,dec,module-count
+ 0x0013=int16,dec,cookie
+ 0x0014=uint32,hex,lang-id
+ 0x001E=uint32,dec,help-context-id
+ 0x002C=int16,dec,cookie
+end
+
+shortlist=VBA-DIR-PROJECTSYSKIND-PLATFORM,0,16-bit-windows,32-bit-windows,macintosh
+
+# ============================================================================
diff --git a/oox/source/dump/pptxdumper.cxx b/oox/source/dump/pptxdumper.cxx
new file mode 100644
index 000000000000..39e0ccc2be55
--- /dev/null
+++ b/oox/source/dump/pptxdumper.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/pptxdumper.hxx"
+
+#include "oox/dump/biffdumper.hxx"
+#include "oox/dump/oledumper.hxx"
+#include "oox/dump/xlsbdumper.hxx"
+#include "oox/helper/zipstorage.hxx"
+#include "oox/ole/olestorage.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace pptx {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+
+// ============================================================================
+
+RootStorageObject::RootStorageObject( const DumperBase& rParent )
+{
+ StorageObjectBase::construct( rParent );
+}
+
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName );
+ Reference< XInputStream > xInStrm = InputOutputHelper::getXInputStream( *rxStrm );
+ if( aExt.equalsIgnoreAsciiCaseAscii( "pptx" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "potx" ) )
+ {
+ Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsx" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) )
+ {
+ ::oox::dump::xlsb::Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xla" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlc" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xls" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) )
+ {
+ ::oox::dump::biff::Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "vml" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "rels" ) )
+ {
+ XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
+ }
+ else if( aExt.equalsIgnoreAsciiCaseAscii( "bin" ) )
+ {
+ if( rStrgPath.equalsAscii( "ppt" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
+ VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else if( rStrgPath.equalsAscii( "ppt/embeddings" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
+ OleStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else if( rStrgPath.equalsAscii( "ppt/activeX" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) );
+ ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else
+ {
+ BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
+ }
+ }
+}
+
+// ============================================================================
+
+#define DUMP_PPTX_CONFIG_ENVVAR "OOO_PPTXDUMPER"
+
+Dumper::Dumper( const FilterBase& rFilter )
+{
+ ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rFilter ) );
+ DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+ if( rxFactory.is() && rxInStrm.is() )
+ {
+ StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
+ MediaDescriptor aMediaDesc;
+ ConfigRef xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
+ DumperBase::construct( xCfg );
+ }
+}
+
+void Dumper::implDump()
+{
+ RootStorageObject( *this ).dump();
+}
+
+// ============================================================================
+
+} // namespace pptx
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/pptxdumper.ini b/oox/source/dump/pptxdumper.ini
new file mode 100644
index 000000000000..f3c058ecfbf5
--- /dev/null
+++ b/oox/source/dump/pptxdumper.ini
@@ -0,0 +1,18 @@
+
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+
+# Enable entire dumper (default=off). This option does not affect the option
+# 'enable-import'.
+# 0=off, 1=on, missing: setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping (default=on). Disabling this option allows
+# to dump a file without loading it. This option is independent from the
+# 'enable-dumper' option.
+# 0=off, 1=on, missing: setting from dumperbase.ini
+# enable-import=1
+
+# ============================================================================
diff --git a/oox/source/dump/xlsbdumper.cxx b/oox/source/dump/xlsbdumper.cxx
new file mode 100644
index 000000000000..3dc2974420a6
--- /dev/null
+++ b/oox/source/dump/xlsbdumper.cxx
@@ -0,0 +1,2340 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/dump/xlsbdumper.hxx"
+
+#include <com/sun/star/io/XTextInputStream.hpp>
+#include "oox/core/filterbase.hxx"
+#include "oox/dump/biffdumper.hxx"
+#include "oox/dump/oledumper.hxx"
+#include "oox/dump/pptxdumper.hxx"
+#include "oox/helper/zipstorage.hxx"
+#include "oox/ole/olestorage.hxx"
+#include "oox/xls/biffhelper.hxx"
+#include "oox/xls/formulabase.hxx"
+#include "oox/xls/richstring.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace xlsb {
+
+// ============================================================================
+
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::util;
+using namespace ::oox::xls;
+
+using ::comphelper::MediaDescriptor;
+using ::oox::core::FilterBase;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt8 BIFF12_STRINGFLAG_FONTS = 0x01;
+const sal_uInt8 BIFF12_STRINGFLAG_PHONETICS = 0x02;
+
+const sal_uInt16 BIFF12_OLEOBJECT_LINKED = 0x0001;
+
+} // namespace
+
+// ============================================================================
+
+RecordObjectBase::RecordObjectBase()
+{
+}
+
+RecordObjectBase::~RecordObjectBase()
+{
+}
+
+void RecordObjectBase::construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ mxBiffStrm.reset( new SequenceInputStream( getRecordDataSequence() ) );
+ SequenceRecordObjectBase::construct( rParent, rxStrm, rSysFileName, mxBiffStrm, "RECORD-NAMES", "SIMPLE-RECORDS" );
+ if( SequenceRecordObjectBase::implIsValid() )
+ mxErrCodes = cfg().getNameList( "ERRORCODES" );
+}
+
+void RecordObjectBase::construct( const RecordObjectBase& rParent )
+{
+ *this = rParent;
+}
+
+bool RecordObjectBase::implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize )
+{
+ sal_Int32 nRecId = 0, nRecSize = 0;
+ bool bValid = readCompressedInt( rBaseStrm, nRecId ) && (nRecId >= 0) && readCompressedInt( rBaseStrm, nRecSize ) && (nRecSize >= 0);
+ ornRecId = nRecId;
+ ornRecSize = nRecSize;
+ return bValid;
+}
+
+OUString RecordObjectBase::getErrorName( sal_uInt8 nErrCode ) const
+{
+ return cfg().getName( mxErrCodes, nErrCode );
+}
+
+// ------------------------------------------------------------------------
+
+void RecordObjectBase::readAddress( Address& orAddress )
+{
+ *mxStrm >> orAddress.mnRow >> orAddress.mnCol;
+}
+
+void RecordObjectBase::readRange( Range& orRange )
+{
+ *mxStrm >> orRange.maFirst.mnRow >> orRange.maLast.mnRow >> orRange.maFirst.mnCol >> orRange.maLast.mnCol;
+}
+
+void RecordObjectBase::readRangeList( RangeList& orRanges )
+{
+ sal_Int32 nCount;
+ *mxStrm >> nCount;
+ if( nCount >= 0 )
+ {
+ orRanges.resize( getLimitedValue< size_t, sal_Int32 >( nCount, 0, SAL_MAX_UINT16 ) );
+ for( RangeList::iterator aIt = orRanges.begin(), aEnd = orRanges.end(); !mxStrm->isEof() && (aIt != aEnd); ++aIt )
+ readRange( *aIt );
+ }
+ else
+ orRanges.clear();
+}
+
+// ----------------------------------------------------------------------------
+
+void RecordObjectBase::writeBooleanItem( const String& rName, sal_uInt8 nBool )
+{
+ writeDecItem( rName, nBool, "BOOLEAN" );
+}
+
+void RecordObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode )
+{
+ writeHexItem( rName, nErrCode, mxErrCodes );
+}
+
+void RecordObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
+{
+ if( !rPortions.empty() )
+ {
+ writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
+ IndentGuard aIndGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 14 );
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeDecItem( "char-pos", aIt->mnPos );
+ writeDecItem( "font-id", aIt->mnFontId, "FONTNAMES" );
+ }
+ }
+}
+
+void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList& rPortions )
+{
+ if( !rPortions.empty() )
+ {
+ writeDecItem( "portion-count", static_cast< sal_uInt32 >( rPortions.size() ) );
+ IndentGuard aIndGuard( mxOut );
+ TableGuard aTabGuard( mxOut, 14, 21 );
+ for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeDecItem( "char-pos", aIt->mnPos );
+ writeDecItem( "base-text-start", aIt->mnBasePos );
+ writeDecItem( "base-text-length", aIt->mnBaseLen );
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+sal_uInt8 RecordObjectBase::dumpBoolean( const String& rName )
+{
+ sal_uInt8 nBool;
+ *mxStrm >> nBool;
+ writeBooleanItem( rName( "boolean" ), nBool );
+ return nBool;
+}
+
+sal_uInt8 RecordObjectBase::dumpErrorCode( const String& rName )
+{
+ sal_uInt8 nErrCode;
+ *mxStrm >> nErrCode;
+ writeErrorCodeItem( rName( "error-code" ), nErrCode );
+ return nErrCode;
+}
+
+OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32BitLen )
+{
+ sal_uInt8 nFlags = bRich ? dumpHex< sal_uInt8 >( "flags", "STRING-FLAGS" ) : 0;
+
+ OUString aString = BiffHelper::readString( *mxBiffStrm, b32BitLen );
+ writeStringItem( rName( "text" ), aString );
+
+ // --- formatting ---
+ if( getFlag( nFlags, BIFF12_STRINGFLAG_FONTS ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ FontPortionModelList aPortions;
+ aPortions.importPortions( *mxBiffStrm );
+ writeFontPortions( aPortions );
+ }
+
+ // --- phonetic text ---
+ if( getFlag( nFlags, BIFF12_STRINGFLAG_PHONETICS ) )
+ {
+ IndentGuard aIndGuard( mxOut );
+ dumpString( "phonetic-text" );
+ PhoneticPortionModelList aPortions;
+ aPortions.importPortions( *mxBiffStrm );
+ writePhoneticPortions( aPortions );
+ dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
+ dumpHex< sal_uInt16 >( "flags", "PHONETIC-FLAGS" );
+ }
+
+ return aString;
+}
+
+void RecordObjectBase::dumpColor( const String& rName )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( rName( "color" ) );
+ switch( extractValue< sal_uInt8 >( dumpDec< sal_uInt8 >( "flags", "COLOR-FLAGS" ), 1, 7 ) )
+ {
+ case 0: dumpUnused( 1 ); break;
+ case 1: dumpDec< sal_uInt8 >( "index", "PALETTE-COLORS" ); break;
+ case 2: dumpUnused( 1 ); break;
+ case 3: dumpDec< sal_uInt8 >( "theme-id" ); break;
+ default: dumpUnknown( 1 );
+ }
+ dumpDec< sal_Int16 >( "tint", "CONV-TINT" );
+ dumpColorABGR();
+}
+
+DateTime RecordObjectBase::dumpPivotDateTime( const String& rName )
+{
+ DateTime aDateTime;
+ aDateTime.Year = mxStrm->readuInt16();
+ aDateTime.Month = mxStrm->readuInt16();
+ aDateTime.Day = mxStrm->readuInt8();
+ aDateTime.Hours = mxStrm->readuInt8();
+ aDateTime.Minutes = mxStrm->readuInt8();
+ aDateTime.Seconds = mxStrm->readuInt8();
+ writeDateTimeItem( rName, aDateTime );
+ return aDateTime;
+}
+
+sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
+{
+ sal_Int32 nCol;
+ *mxStrm >> nCol;
+ writeColIndexItem( rName( "col-idx" ), nCol );
+ return nCol;
+}
+
+sal_Int32 RecordObjectBase::dumpRowIndex( const String& rName )
+{
+ sal_Int32 nRow;
+ *mxStrm >> nRow;
+ writeRowIndexItem( rName( "row-idx" ), nRow );
+ return nRow;
+}
+
+sal_Int32 RecordObjectBase::dumpColRange( const String& rName )
+{
+ sal_Int32 nCol1, nCol2;
+ *mxStrm >> nCol1 >> nCol2;
+ writeColRangeItem( rName( "col-range" ), nCol1, nCol2 );
+ return nCol2 - nCol1 + 1;
+}
+
+sal_Int32 RecordObjectBase::dumpRowRange( const String& rName )
+{
+ sal_Int32 nRow1, nRow2;
+ *mxStrm >> nRow1 >> nRow2;
+ writeRowRangeItem( rName( "row-range" ), nRow1, nRow2 );
+ return nRow2 - nRow1 + 1;
+}
+
+Address RecordObjectBase::dumpAddress( const String& rName )
+{
+ Address aPos;
+ readAddress( aPos );
+ writeAddressItem( rName( "addr" ), aPos );
+ return aPos;
+}
+
+Range RecordObjectBase::dumpRange( const String& rName )
+{
+ Range aRange;
+ readRange( aRange );
+ writeRangeItem( rName( "range" ), aRange );
+ return aRange;
+}
+
+void RecordObjectBase::dumpRangeList( const String& rName )
+{
+ RangeList aRanges;
+ readRangeList( aRanges );
+ writeRangeListItem( rName( "range-list" ), aRanges );
+}
+
+// private --------------------------------------------------------------------
+
+bool RecordObjectBase::readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue )
+{
+ ornValue = 0;
+ sal_uInt8 nByte;
+ rStrm >> nByte;
+ ornValue = nByte & 0x7F;
+ if( (nByte & 0x80) != 0 )
+ {
+ rStrm >> nByte;
+ ornValue |= sal_Int32( nByte & 0x7F ) << 7;
+ if( (nByte & 0x80) != 0 )
+ {
+ rStrm >> nByte;
+ ornValue |= sal_Int32( nByte & 0x7F ) << 14;
+ if( (nByte & 0x80) != 0 )
+ {
+ rStrm >> nByte;
+ ornValue |= sal_Int32( nByte & 0x7F ) << 21;
+ }
+ }
+ }
+ return !rStrm.isEof();
+}
+
+// ============================================================================
+
+FormulaObject::FormulaObject( const RecordObjectBase& rParent ) :
+ mnSize( 0 )
+{
+ RecordObjectBase::construct( rParent );
+ constructFmlaObj();
+}
+
+FormulaObject::~FormulaObject()
+{
+}
+
+void FormulaObject::dumpCellFormula( const String& rName )
+{
+ dumpFormula( rName, false );
+}
+
+void FormulaObject::dumpNameFormula( const String& rName )
+{
+ dumpFormula( rName, true );
+}
+
+void FormulaObject::implDump()
+{
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( maName );
+ writeDecItem( "formula-size", mnSize );
+ }
+ if( mnSize < 0 ) return;
+
+ sal_Int64 nStartPos = mxStrm->tell();
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( nStartPos + mnSize, mxStrm->getLength() );
+
+ bool bValid = mxTokens.get();
+ mxStack.reset( new FormulaStack );
+ maAddData.clear();
+ IndentGuard aIndGuard( mxOut );
+ {
+ TableGuard aTabGuard( mxOut, 8, 18 );
+ while( bValid && (mxStrm->tell() < nEndPos) )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeHexItem( EMPTY_STRING, static_cast< sal_uInt16 >( mxStrm->tell() - nStartPos ) );
+ sal_uInt8 nTokenId = dumpHex< sal_uInt8 >( EMPTY_STRING, mxTokens );
+ bValid = mxTokens->hasName( nTokenId );
+ if( bValid )
+ {
+ sal_uInt8 nTokClass = nTokenId & BIFF_TOKCLASS_MASK;
+ sal_uInt8 nBaseId = nTokenId & BIFF_TOKID_MASK;
+ if( nTokClass == BIFF_TOKCLASS_NONE )
+ {
+ switch( nBaseId )
+ {
+ case BIFF_TOKID_EXP: dumpExpToken( "EXP" ); break;
+ case BIFF_TOKID_ADD: dumpBinaryOpToken( "+" ); break;
+ case BIFF_TOKID_SUB: dumpBinaryOpToken( "-" ); break;
+ case BIFF_TOKID_MUL: dumpBinaryOpToken( "*" ); break;
+ case BIFF_TOKID_DIV: dumpBinaryOpToken( "/" ); break;
+ case BIFF_TOKID_POWER: dumpBinaryOpToken( "^" ); break;
+ case BIFF_TOKID_CONCAT: dumpBinaryOpToken( "&" ); break;
+ case BIFF_TOKID_LT: dumpBinaryOpToken( "<" ); break;
+ case BIFF_TOKID_LE: dumpBinaryOpToken( "<=" ); break;
+ case BIFF_TOKID_EQ: dumpBinaryOpToken( "=" ); break;
+ case BIFF_TOKID_GE: dumpBinaryOpToken( ">=" ); break;
+ case BIFF_TOKID_GT: dumpBinaryOpToken( "<" ); break;
+ case BIFF_TOKID_NE: dumpBinaryOpToken( "<>" ); break;
+ case BIFF_TOKID_ISECT: dumpBinaryOpToken( " " ); break;
+ case BIFF_TOKID_LIST: dumpBinaryOpToken( "," ); break;
+ case BIFF_TOKID_RANGE: dumpBinaryOpToken( ":" ); break;
+ case BIFF_TOKID_UPLUS: dumpUnaryOpToken( "+", "" ); break;
+ case BIFF_TOKID_UMINUS: dumpUnaryOpToken( "-", "" ); break;
+ case BIFF_TOKID_PERCENT: dumpUnaryOpToken( "", "%" ); break;
+ case BIFF_TOKID_PAREN: dumpUnaryOpToken( "(", ")" ); break;
+ case BIFF_TOKID_MISSARG: dumpMissArgToken(); break;
+ case BIFF_TOKID_STR: dumpStringToken(); break;
+ case BIFF_TOKID_NLR: bValid = dumpTableToken(); break;
+ case BIFF_TOKID_ATTR: bValid = dumpAttrToken(); break;
+ case BIFF_TOKID_ERR: dumpErrorToken(); break;
+ case BIFF_TOKID_BOOL: dumpBoolToken(); break;
+ case BIFF_TOKID_INT: dumpIntToken(); break;
+ case BIFF_TOKID_NUM: dumpDoubleToken(); break;
+ default: bValid = false;
+ }
+ }
+ else
+ {
+ OUString aTokClass = cfg().getName( mxClasses, nTokClass );
+ switch( nBaseId )
+ {
+ case BIFF_TOKID_ARRAY: dumpArrayToken( aTokClass ); break;
+ case BIFF_TOKID_FUNC: dumpFuncToken( aTokClass ); break;
+ case BIFF_TOKID_FUNCVAR: dumpFuncVarToken( aTokClass ); break;
+ case BIFF_TOKID_NAME: dumpNameToken( aTokClass ); break;
+ case BIFF_TOKID_REF: dumpRefToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREA: dumpAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMAREA: dumpMemAreaToken( aTokClass, true ); break;
+ case BIFF_TOKID_MEMERR: dumpMemAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMNOMEM: dumpMemAreaToken( aTokClass, false ); break;
+ case BIFF_TOKID_MEMFUNC: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_REFERR: dumpRefErrToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREAERR: dumpRefErrToken( aTokClass, true ); break;
+ case BIFF_TOKID_REFN: dumpRefToken( aTokClass, true ); break;
+ case BIFF_TOKID_AREAN: dumpAreaToken( aTokClass, true ); break;
+ case BIFF_TOKID_MEMAREAN: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_MEMNOMEMN: dumpMemFuncToken( aTokClass ); break;
+ case BIFF_TOKID_NAMEX: dumpNameXToken( aTokClass ); break;
+ case BIFF_TOKID_REF3D: dumpRef3dToken( aTokClass, mbNameMode ); break;
+ case BIFF_TOKID_AREA3D: dumpArea3dToken( aTokClass, mbNameMode ); break;
+ case BIFF_TOKID_REFERR3D: dumpRefErr3dToken( aTokClass, false ); break;
+ case BIFF_TOKID_AREAERR3D: dumpRefErr3dToken( aTokClass, true ); break;
+ default: bValid = false;
+ }
+ }
+ }
+ }
+ }
+
+ if( nEndPos == mxStrm->tell() )
+ {
+ dumpAddTokenData();
+ if( mnSize > 0 )
+ {
+ writeInfoItem( "formula", mxStack->getFormulaString() );
+ writeInfoItem( "classes", mxStack->getClassesString() );
+ }
+ }
+ else
+ {
+ dumpBinary( OOX_DUMP_ERRASCII( "formula-error" ), static_cast< sal_Int32 >( nEndPos - mxStrm->tell() ), false );
+ sal_Int32 nAddDataSize = dumpDec< sal_Int32 >( "add-data-size" );
+ dumpBinary( "add-data", nAddDataSize, false );
+ }
+
+ mnSize = 0;
+}
+
+void FormulaObject::dumpFormula( const String& rName, bool bNameMode )
+{
+ maName = rName( "formula" );
+ *mxStrm >> mnSize;
+ mbNameMode = bNameMode;
+ dump();
+}
+
+// private --------------------------------------------------------------------
+
+void FormulaObject::constructFmlaObj()
+{
+ if( RecordObjectBase::implIsValid() )
+ {
+ mxFuncProv.reset( new FunctionProvider( FILTER_OOXML, BIFF_UNKNOWN, true ) );
+
+ Config& rCfg = cfg();
+ mxClasses = rCfg.getNameList( "TOKENCLASSES" );
+ mxRelFlags = rCfg.getNameList( "REFRELFLAGS" );
+ mxAttrTypes = rCfg.getNameList( "ATTRTYPES" );
+ mxSpTypes = rCfg.getNameList( "ATTRSPACETYPES" );
+
+ // create classified token names
+ mxTokens = rCfg.createNameList< ConstList >( "TOKENS" );
+ mxTokens->includeList( rCfg.getNameList( "BASETOKENS" ) );
+
+ NameListRef xClassTokens = rCfg.getNameList( "CLASSTOKENS" );
+ if( mxClasses.get() && xClassTokens.get() )
+ for( NameListBase::const_iterator aCIt = mxClasses->begin(), aCEnd = mxClasses->end(); aCIt != aCEnd; ++aCIt )
+ for( NameListBase::const_iterator aTIt = xClassTokens->begin(), aTEnd = xClassTokens->end(); aTIt != aTEnd; ++aTIt )
+ mxTokens->setName( aCIt->first | aTIt->first, aTIt->second + aCIt->second );
+
+ mnColCount = 16384;
+ mnRowCount = 1024 * 1024;
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+namespace {
+
+OUString lclCreateName( const OUString& rRef, sal_Int32 nNameId )
+{
+ OUStringBuffer aName( rRef );
+ StringHelper::appendIndexedText( aName, CREATE_OUSTRING( "NAME" ), nNameId );
+ return aName.makeStringAndClear();
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+TokenAddress FormulaObject::createTokenAddress( sal_Int32 nCol, sal_Int32 nRow, bool bRelC, bool bRelR, bool bNameMode ) const
+{
+ TokenAddress aPos;
+ aPos.mnCol = nCol;
+ if( bRelC && bNameMode && (nCol >= mnColCount / 2) ) aPos.mnCol -= mnColCount;
+ aPos.mbRelCol = bRelC;
+ aPos.mnRow = nRow;
+ if( bRelR && bNameMode && (nRow >= mnRowCount / 2) ) aPos.mnRow -= mnRowCount;
+ aPos.mbRelRow = bRelR;
+ return aPos;
+}
+
+OUString FormulaObject::createRef( const OUString& rData ) const
+{
+ return maRefPrefix + rData;
+}
+
+OUString FormulaObject::createName( sal_Int32 nNameId ) const
+{
+ return lclCreateName( maRefPrefix, nNameId );
+}
+
+OUString FormulaObject::createPlaceHolder( size_t nIdx ) const
+{
+ OUStringBuffer aStr;
+ StringHelper::appendDec( aStr, static_cast< sal_uInt32 >( nIdx ) );
+ StringHelper::enclose( aStr, OOX_DUMP_PLACEHOLDER );
+ return aStr.makeStringAndClear();
+}
+
+OUString FormulaObject::createPlaceHolder() const
+{
+ return createPlaceHolder( maAddData.size() );
+}
+
+OUString FormulaObject::writeFuncIdItem( sal_uInt16 nFuncId, const FunctionInfo** oppFuncInfo )
+{
+ ItemGuard aItem( mxOut, "func-id" );
+ writeHexItem( EMPTY_STRING, nFuncId, "FUNCID" );
+ OUStringBuffer aBuffer;
+ const FunctionInfo* pFuncInfo = mxFuncProv->getFuncInfoFromBiff12FuncId( nFuncId );
+ if( pFuncInfo )
+ aBuffer.append( pFuncInfo->maOoxFuncName );
+ else
+ {
+ bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
+ aBuffer.appendAscii( bCmd ? "CMD" : "FUNC" );
+ StringHelper::appendIndex( aBuffer, nFuncId & BIFF_TOK_FUNCVAR_FUNCIDMASK );
+ }
+ OUString aFuncName = aBuffer.makeStringAndClear();
+ aItem.cont();
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ mxOut->writeString( aFuncName );
+ mxOut->writeChar( OOX_DUMP_STRQUOTE );
+ if( oppFuncInfo ) *oppFuncInfo = pFuncInfo;
+ return aFuncName;
+}
+
+sal_Int32 FormulaObject::dumpTokenCol( const String& rName, bool& rbRelC, bool& rbRelR )
+{
+ sal_uInt16 nCol = dumpHex< sal_uInt16 >( rName, mxRelFlags );
+ rbRelC = getFlag( nCol, BIFF12_TOK_REF_COLREL );
+ rbRelR = getFlag( nCol, BIFF12_TOK_REF_ROWREL );
+ nCol &= BIFF12_TOK_REF_COLMASK;
+ return nCol;
+}
+
+sal_Int32 FormulaObject::dumpTokenRow( const String& rName )
+{
+ return dumpDec< sal_Int32 >( rName );
+}
+
+TokenAddress FormulaObject::dumpTokenAddress( bool bNameMode )
+{
+ bool bRelC = false;
+ bool bRelR = false;
+ sal_Int32 nRow = dumpTokenRow( "row" );
+ sal_Int32 nCol = dumpTokenCol( "col", bRelC, bRelR );
+ return createTokenAddress( nCol, nRow, bRelC, bRelR, bNameMode );
+}
+
+TokenRange FormulaObject::dumpTokenRange( bool bNameMode )
+{
+ bool bRelC1 = false;
+ bool bRelR1 = false;
+ bool bRelC2 = false;
+ bool bRelR2 = false;
+ sal_Int32 nRow1 = dumpTokenRow( "row1" );
+ sal_Int32 nRow2 = dumpTokenRow( "row2" );
+ sal_Int32 nCol1 = dumpTokenCol( "col1", bRelC1, bRelR1 );
+ sal_Int32 nCol2 = dumpTokenCol( "col2", bRelC2, bRelR2 );
+ TokenRange aRange;
+ aRange.maFirst = createTokenAddress( nCol1, nRow1, bRelC1, bRelR1, bNameMode );
+ aRange.maLast = createTokenAddress( nCol2, nRow2, bRelC2, bRelR2, bNameMode );
+ return aRange;
+}
+
+sal_Int16 FormulaObject::readTokenRefId()
+{
+ return dumpDec< sal_Int16 >( "ref-id" );
+}
+
+OUString FormulaObject::dumpTokenRefId()
+{
+ OUStringBuffer aRef( CREATE_OUSTRING( "REF" ) );
+ StringHelper::appendIndex( aRef, readTokenRefId() );
+ aRef.append( OOX_DUMP_TABSEP );
+ return aRef.makeStringAndClear();
+}
+
+void FormulaObject::dumpIntToken()
+{
+ dumpDec< sal_uInt16 >( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpDoubleToken()
+{
+ dumpDec< double >( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpStringToken()
+{
+ OUStringBuffer aBuffer( dumpString( "value", false, false ) );
+ StringHelper::enclose( aBuffer, OOX_DUMP_FMLASTRQUOTE );
+ mxStack->pushOperand( aBuffer.makeStringAndClear() );
+}
+
+void FormulaObject::dumpBoolToken()
+{
+ dumpBoolean( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpErrorToken()
+{
+ dumpErrorCode( "value" );
+ mxStack->pushOperand( mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpMissArgToken()
+{
+ mxStack->pushOperand( OUString( OOX_DUMP_EMPTYVALUE ) );
+}
+
+void FormulaObject::dumpArrayToken( const OUString& rTokClass )
+{
+ dumpUnused( 14 );
+ mxStack->pushOperand( createPlaceHolder(), rTokClass );
+ maAddData.push_back( ADDDATA_ARRAY );
+}
+
+void FormulaObject::dumpNameToken( const OUString& rTokClass )
+{
+ sal_Int32 nNameId = dumpDec< sal_Int32 >( "name-id" );
+ mxStack->pushOperand( createName( nNameId ), rTokClass );
+}
+
+void FormulaObject::dumpNameXToken( const OUString& rTokClass )
+{
+ OUString aRef = dumpTokenRefId();
+ sal_Int32 nNameId = dumpDec< sal_Int32 >( "name-id" );
+ mxStack->pushOperand( lclCreateName( aRef, nNameId ), rTokClass );
+}
+
+void FormulaObject::dumpRefToken( const OUString& rTokClass, bool bNameMode )
+{
+ TokenAddress aPos = dumpTokenAddress( bNameMode );
+ writeTokenAddressItem( "addr", aPos, bNameMode );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
+}
+
+void FormulaObject::dumpAreaToken( const OUString& rTokClass, bool bNameMode )
+{
+ TokenRange aRange = dumpTokenRange( bNameMode );
+ writeTokenRangeItem( "range", aRange, bNameMode );
+ mxStack->pushOperand( createRef( mxOut->getLastItemValue() ), rTokClass );
+}
+
+void FormulaObject::dumpRefErrToken( const OUString& rTokClass, bool bArea )
+{
+ dumpUnused( 4 * (bArea ? 2 : 1) );
+ mxStack->pushOperand( createRef( getErrorName( BIFF_ERR_REF ) ), rTokClass );
+}
+
+void FormulaObject::dumpRef3dToken( const OUString& rTokClass, bool bNameMode )
+{
+ OUString aRef = dumpTokenRefId();
+ TokenAddress aPos = dumpTokenAddress( bNameMode );
+ writeTokenAddress3dItem( "addr", aRef, aPos, bNameMode );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+}
+
+void FormulaObject::dumpArea3dToken( const OUString& rTokClass, bool bNameMode )
+{
+ OUString aRef = dumpTokenRefId();
+ TokenRange aRange = dumpTokenRange( bNameMode );
+ writeTokenRange3dItem( "range", aRef, aRange, bNameMode );
+ mxStack->pushOperand( mxOut->getLastItemValue(), rTokClass );
+}
+
+void FormulaObject::dumpRefErr3dToken( const OUString& rTokClass, bool bArea )
+{
+ OUString aRef = dumpTokenRefId();
+ dumpUnused( 4 * (bArea ? 2 : 1) );
+ mxStack->pushOperand( aRef + getErrorName( BIFF_ERR_REF ), rTokClass );
+}
+
+void FormulaObject::dumpMemFuncToken( const OUString& /*rTokClass*/ )
+{
+ dumpDec< sal_uInt16 >( "size" );
+}
+
+void FormulaObject::dumpMemAreaToken( const OUString& rTokClass, bool bAddData )
+{
+ dumpUnused( 4 );
+ dumpMemFuncToken( rTokClass );
+ if( bAddData )
+ maAddData.push_back( ADDDATA_MEMAREA );
+}
+
+void FormulaObject::dumpExpToken( const String& rName )
+{
+ Address aPos;
+ dumpRowIndex( "base-row" );
+ OUStringBuffer aOp( rName );
+ StringHelper::appendIndex( aOp, createPlaceHolder() + mxOut->getLastItemValue() );
+ mxStack->pushOperand( aOp.makeStringAndClear() );
+ maAddData.push_back( ADDDATA_EXP );
+}
+
+void FormulaObject::dumpUnaryOpToken( const String& rLOp, const String& rROp )
+{
+ mxStack->pushUnaryOp( rLOp, rROp );
+}
+
+void FormulaObject::dumpBinaryOpToken( const String& rOp )
+{
+ mxStack->pushBinaryOp( rOp );
+}
+
+void FormulaObject::dumpFuncToken( const OUString& rTokClass )
+{
+ sal_uInt16 nFuncId;
+ *mxStrm >> nFuncId;
+ const FunctionInfo* pFuncInfo = 0;
+ OUString aFuncName = writeFuncIdItem( nFuncId, &pFuncInfo );
+ if( pFuncInfo && (pFuncInfo->mnMinParamCount == pFuncInfo->mnMaxParamCount) )
+ mxStack->pushFuncOp( aFuncName, rTokClass, pFuncInfo->mnMinParamCount );
+ else
+ mxStack->setError();
+}
+
+void FormulaObject::dumpFuncVarToken( const OUString& rTokClass )
+{
+ sal_uInt8 nParamCount;
+ sal_uInt16 nFuncId;
+ *mxStrm >> nParamCount >> nFuncId;
+ bool bCmd = getFlag( nFuncId, BIFF_TOK_FUNCVAR_CMD );
+ if( bCmd )
+ writeHexItem( "param-count", nParamCount, "PARAMCOUNT-CMD" );
+ else
+ writeDecItem( "param-count", nParamCount );
+ OUString aFuncName = writeFuncIdItem( nFuncId );
+ if( bCmd && getFlag( nParamCount, BIFF_TOK_FUNCVAR_CMDPROMPT ) )
+ {
+ aFuncName += OUString( OOX_DUMP_CMDPROMPT );
+ nParamCount &= BIFF_TOK_FUNCVAR_COUNTMASK;
+ }
+ mxStack->pushFuncOp( aFuncName, rTokClass, nParamCount );
+}
+
+bool FormulaObject::dumpTableToken()
+{
+ dumpUnused( 3 );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "TABLEFLAGS" );
+ sal_uInt16 nTabId = dumpDec< sal_uInt16 >( "table-id" );
+ dumpUnused( 2 );
+ {
+ sal_uInt16 nCol1, nCol2;
+ *mxStrm >> nCol1 >> nCol2;
+ ItemGuard aItem( mxOut, "cols" );
+ mxOut->writeDec( nCol1 );
+ if( nCol1 != nCol2 )
+ {
+ mxOut->writeChar( OOX_DUMP_RANGESEP );
+ mxOut->writeDec( nCol2 );
+ }
+ }
+ OUStringBuffer aColRange;
+ StringHelper::appendIndex( aColRange, mxOut->getLastItemValue() );
+ OUStringBuffer aParams;
+ size_t nParams = 0;
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_ALL ) && ++nParams )
+ StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#All]" ) );
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_HEADERS ) && ++nParams )
+ StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Headers]" ) );
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_DATA ) && ++nParams )
+ StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Data]" ) );
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_TOTALS ) && ++nParams )
+ StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#Totals]" ) );
+ if( getFlag( nFlags, BIFF12_TOK_TABLE_THISROW ) && ++nParams )
+ StringHelper::appendToken( aParams, CREATE_OUSTRING( "[#This Row]" ) );
+ if( (getFlag( nFlags, BIFF12_TOK_TABLE_COLUMN ) || getFlag( nFlags, BIFF12_TOK_TABLE_COLRANGE )) && ++nParams )
+ StringHelper::appendToken( aParams, aColRange.makeStringAndClear() );
+ OUStringBuffer aOp;
+ StringHelper::appendIndexedText( aOp, CREATE_OUSTRING( "TABLE" ), nTabId );
+ if( nParams > 1 )
+ StringHelper::appendIndex( aOp, aParams.makeStringAndClear() );
+ else if( nParams == 1 )
+ aOp.append( aParams.makeStringAndClear() );
+ mxStack->pushOperand( aOp.makeStringAndClear() );
+ return true;
+}
+
+bool FormulaObject::dumpAttrToken()
+{
+ bool bValid = true;
+ sal_uInt8 nType = dumpHex< sal_uInt8 >( "type", mxAttrTypes );
+ switch( nType )
+ {
+ case BIFF_TOK_ATTR_VOLATILE:
+ dumpUnused( 2 );
+ break;
+ case BIFF_TOK_ATTR_IF:
+ dumpDec< sal_uInt16 >( "skip" );
+ break;
+ case BIFF_TOK_ATTR_CHOOSE:
+ {
+ sal_uInt16 nCount = dumpDec< sal_uInt16 >( "choices" );
+ mxOut->resetItemIndex();
+ for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
+ dumpDec< sal_uInt16 >( "#skip" );
+ dumpDec< sal_uInt16 >( "skip-err" );
+ }
+ break;
+ case BIFF_TOK_ATTR_SKIP:
+ dumpDec< sal_uInt16 >( "skip" );
+ break;
+ case BIFF_TOK_ATTR_SUM:
+ dumpUnused( 2 );
+ mxStack->pushFuncOp( CREATE_OUSTRING( "SUM" ), OUString( OOX_DUMP_BASECLASS ), 1 );
+ break;
+ case BIFF_TOK_ATTR_ASSIGN:
+ dumpUnused( 2 );
+ break;
+ case BIFF_TOK_ATTR_SPACE:
+ case BIFF_TOK_ATTR_SPACE | BIFF_TOK_ATTR_VOLATILE:
+ dumpDec< sal_uInt8 >( "char-type", mxSpTypes );
+ dumpDec< sal_uInt8 >( "char-count" );
+ break;
+ case BIFF_TOK_ATTR_IFERROR:
+ dumpDec< sal_uInt16 >( "skip" );
+ break;
+ default:
+ bValid = false;
+ }
+ return bValid;
+}
+
+void FormulaObject::dumpAddTokenData()
+{
+ mxOut->resetItemIndex();
+ sal_Int32 nAddDataSize = (mxStrm->getLength() - mxStrm->tell() >= 4) ? dumpDec< sal_Int32 >( "add-data-size" ) : 0;
+ sal_Int64 nEndPos = ::std::min< sal_Int64 >( mxStrm->tell() + nAddDataSize, mxStrm->getLength() );
+ for( AddDataTypeVec::const_iterator aIt = maAddData.begin(), aEnd = maAddData.end(); (aIt != aEnd) && !mxStrm->isEof() && (mxStrm->tell() < nEndPos); ++aIt )
+ {
+ AddDataType eType = *aIt;
+
+ {
+ ItemGuard aItem( mxOut, "#add-data" );
+ switch( eType )
+ {
+ case ADDDATA_EXP: mxOut->writeAscii( "tExp" ); break;
+ case ADDDATA_ARRAY: mxOut->writeAscii( "tArray" ); break;
+ case ADDDATA_MEMAREA: mxOut->writeAscii( "tMemArea" ); break;
+ }
+ }
+
+ size_t nIdx = aIt - maAddData.begin();
+ IndentGuard aIndGuard( mxOut );
+ switch( eType )
+ {
+ case ADDDATA_EXP: dumpAddDataExp( nIdx ); break;
+ case ADDDATA_ARRAY: dumpAddDataArray( nIdx ); break;
+ case ADDDATA_MEMAREA: dumpAddDataMemArea( nIdx ); break;
+ default:;
+ }
+ }
+}
+
+void FormulaObject::dumpAddDataExp( size_t nIdx )
+{
+ dumpColIndex( "base-col" );
+ mxStack->replaceOnTop( createPlaceHolder( nIdx ), mxOut->getLastItemValue() );
+}
+
+void FormulaObject::dumpAddDataArray( size_t nIdx )
+{
+ sal_Int32 nCols, nRows;
+ dumpaddDataArrayHeader( nCols, nRows );
+
+ OUStringBuffer aOp;
+ TableGuard aTabGuard( mxOut, 17 );
+ for( sal_Int32 nRow = 0; nRow < nRows; ++nRow )
+ {
+ OUStringBuffer aArrayLine;
+ for( sal_Int32 nCol = 0; nCol < nCols; ++nCol )
+ StringHelper::appendToken( aArrayLine, dumpaddDataArrayValue(), OOX_DUMP_LISTSEP );
+ StringHelper::appendToken( aOp, aArrayLine.makeStringAndClear(), OOX_DUMP_ARRAYSEP );
+ }
+ StringHelper::enclose( aOp, '{', '}' );
+ mxStack->replaceOnTop( createPlaceHolder( nIdx ), aOp.makeStringAndClear() );
+}
+
+void FormulaObject::dumpAddDataMemArea( size_t /*nIdx*/ )
+{
+ dumpRangeList();
+}
+
+void FormulaObject::dumpaddDataArrayHeader( sal_Int32& rnCols, sal_Int32& rnRows )
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ rnRows = dumpDec< sal_Int32 >( "height" );
+ rnCols = dumpDec< sal_Int32 >( "width" );
+ ItemGuard aItem( mxOut, "size" );
+ mxOut->writeDec( rnCols );
+ mxOut->writeChar( 'x' );
+ mxOut->writeDec( rnRows );
+ aItem.cont();
+ mxOut->writeDec( rnCols * rnRows );
+}
+
+OUString FormulaObject::dumpaddDataArrayValue()
+{
+ MultiItemsGuard aMultiGuard( mxOut );
+ OUStringBuffer aValue;
+ switch( dumpDec< sal_uInt8 >( "type", "ARRAYVALUE-TYPE" ) )
+ {
+ case BIFF_TOK_ARRAY_DOUBLE:
+ dumpDec< double >( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ break;
+ case BIFF_TOK_ARRAY_STRING:
+ aValue.append( dumpString( "value", false, false ) );
+ StringHelper::enclose( aValue, OOX_DUMP_STRQUOTE );
+ break;
+ case BIFF_TOK_ARRAY_BOOL:
+ dumpBoolean( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ break;
+ case BIFF_TOK_ARRAY_ERROR:
+ dumpErrorCode( "value" );
+ aValue.append( mxOut->getLastItemValue() );
+ dumpUnused( 3 );
+ break;
+ }
+ return aValue.makeStringAndClear();
+}
+
+// ============================================================================
+
+RecordStreamObject::RecordStreamObject( ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName )
+{
+ RecordObjectBase::construct( rParent, rxStrm, rSysFileName );
+ if( RecordObjectBase::implIsValid() )
+ mxFmlaObj.reset( new FormulaObject( *this ) );
+}
+
+bool RecordStreamObject::implIsValid() const
+{
+ return isValid( mxFmlaObj ) && RecordObjectBase::implIsValid();
+}
+
+void RecordStreamObject::implDumpRecordBody()
+{
+ switch( getRecId() )
+ {
+ case BIFF12_ID_ARRAY:
+ dumpRange( "array-range" );
+ dumpHex< sal_uInt8 >( "flags", "ARRAY-FLAGS" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_AUTOFILTER:
+ dumpRange( "filter-range" );
+ break;
+
+ case BIFF12_ID_BINARYINDEXBLOCK:
+ dumpRowRange( "row-range" );
+ dumpUnknown( 12 );
+ break;
+
+ case BIFF12_ID_BINARYINDEXROWS:
+ {
+ sal_uInt32 nUsedRows = dumpBin< sal_uInt32 >( "used-rows" );
+ dumpDec< sal_Int64 >( "stream-offset" );
+ for( ; nUsedRows > 0; nUsedRows >>= 1 )
+ if( (nUsedRows & 1) != 0 )
+ dumpBin< sal_uInt16 >( "used-columns" );
+ }
+ break;
+
+ case BIFF12_ID_BORDER:
+ dumpHex< sal_uInt8 >( "flags", "BORDER-FLAGS" );
+ dumpDec< sal_uInt16 >( "top-style", "BORDERSTYLES" );
+ dumpColor( "top-color" );
+ dumpDec< sal_uInt16 >( "bottom-style", "BORDERSTYLES" );
+ dumpColor( "bottom-color" );
+ dumpDec< sal_uInt16 >( "left-style", "BORDERSTYLES" );
+ dumpColor( "left-color" );
+ dumpDec< sal_uInt16 >( "right-style", "BORDERSTYLES" );
+ dumpColor( "right-color" );
+ dumpDec< sal_uInt16 >( "diag-style", "BORDERSTYLES" );
+ dumpColor( "diag-color" );
+ break;
+
+ case BIFF12_ID_BRK:
+ dumpDec< sal_Int32 >( "id" );
+ dumpDec< sal_Int32 >( "min" );
+ dumpDec< sal_Int32 >( "max" );
+ dumpDec< sal_Int32 >( "manual-break", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "pivot-break", "BOOLEAN" );
+ break;
+
+ case BIFF12_ID_CALCPR:
+ dumpDec< sal_Int32 >( "calc-id" );
+ dumpDec< sal_Int32 >( "calc-mode", "CALCPR-CALCMODE" );
+ dumpDec< sal_Int32 >( "iteration-count" );
+ dumpDec< double >( "iteration-delta" );
+ dumpDec< sal_Int32 >( "processor-count" );
+ dumpHex< sal_uInt16 >( "flags", "CALCPR-FLAGS" );
+ break;
+
+ case BIFF12_ID_CELL_BLANK:
+ dumpCellHeader( true );
+ break;
+
+ case BIFF12_ID_CELL_BOOL:
+ dumpCellHeader( true );
+ dumpBoolean();
+ break;
+
+ case BIFF12_ID_CELL_DOUBLE:
+ dumpCellHeader( true );
+ dumpDec< double >( "value" );
+ break;
+
+ case BIFF12_ID_CELL_ERROR:
+ dumpCellHeader( true );
+ dumpErrorCode();
+ break;
+
+ case BIFF12_ID_CELL_RK:
+ dumpCellHeader( true );
+ dumpRk( "value" );
+ break;
+
+ case BIFF12_ID_CELL_RSTRING:
+ dumpCellHeader( true );
+ dumpString( "value", true );
+ break;
+
+ case BIFF12_ID_CELL_SI:
+ dumpCellHeader( true );
+ dumpDec< sal_Int32 >( "string-id" );
+ break;
+
+ case BIFF12_ID_CELL_STRING:
+ dumpCellHeader( true );
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_CELLSTYLE:
+ dumpDec< sal_Int32 >( "xf-id" );
+ dumpHex< sal_uInt16 >( "flags", "CELLSTYLE-FLAGS" );
+ dumpDec< sal_uInt8 >( "builtin-id", "CELLSTYLE-BUILTIN" );
+ dumpDec< sal_uInt8 >( "outline-level" );
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_CFCOLOR:
+ dumpColor();
+ break;
+
+ case BIFF12_ID_CFRULE:
+ {
+ // type/subtype/operator is a mess...
+ dumpDec< sal_Int32 >( "type", "CFRULE-TYPE" );
+ sal_Int32 nSubType = dumpDec< sal_Int32 >( "sub-type", "CFRULE-SUBTYPE" );
+ dumpDec< sal_Int32 >( "dxf-id" );
+ dumpDec< sal_Int32 >( "priority" );
+ switch( nSubType )
+ {
+ case 0: dumpDec< sal_Int32 >( "operator", "CFRULE-CELL-OPERATOR" ); break;
+ case 5: dumpDec< sal_Int32 >( "rank" ); break;
+ case 8: dumpDec< sal_Int32 >( "operator", "CFRULE-TEXT-OPERATOR" ); break;
+ case 15: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 16: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 17: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 18: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 19: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 20: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 21: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 22: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 23: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 24: dumpDec< sal_Int32 >( "operator", "CFRULE-DATE-OPERATOR" ); break;
+ case 25: dumpDec< sal_Int32 >( "std-dev" ); break;
+ case 26: dumpDec< sal_Int32 >( "std-dev" ); break;
+ case 29: dumpDec< sal_Int32 >( "std-dev" ); break;
+ case 30: dumpDec< sal_Int32 >( "std-dev" ); break;
+ default: dumpDec< sal_Int32 >( "operator", "CFRULE-OTHER-OPERATOR" );
+ }
+ dumpUnknown( 8 );
+ dumpHex< sal_uInt16 >( "flags", "CFRULE-FLAGS" );
+ // for no obvious reason the formula sizes occur twice
+ dumpDec< sal_Int32 >( "formula1-size" );
+ dumpDec< sal_Int32 >( "formula2-size" );
+ dumpDec< sal_Int32 >( "formula3-size" );
+ dumpString( "text" );
+ if( mxStrm->getRemaining() >= 8 )
+ mxFmlaObj->dumpNameFormula( "formula1" );
+ if( mxStrm->getRemaining() >= 8 )
+ mxFmlaObj->dumpNameFormula( "formula2" );
+ if( mxStrm->getRemaining() >= 8 )
+ mxFmlaObj->dumpNameFormula( "formula3" );
+ }
+ break;
+
+ case BIFF12_ID_CHARTPAGESETUP:
+ dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
+ dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
+ dumpDec< sal_Int32 >( "vertical-res", "PAGESETUP-DPI" );
+ dumpDec< sal_Int32 >( "copies" );
+ dumpDec< sal_uInt16 >( "first-page" );
+ dumpHex< sal_uInt16 >( "flags", "CHARTPAGESETUP-FLAGS" );
+ dumpString( "printer-settings-rel-id" );
+ break;
+
+ case BIFF12_ID_CHARTPROTECTION:
+ dumpHex< sal_uInt16 >( "password-hash" );
+ // no flags field for the boolean flags?!?
+ dumpDec< sal_Int32 >( "content-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "objects-locked", "BOOLEAN" );
+ break;
+
+ case BIFF12_ID_CHARTSHEETPR:
+ dumpHex< sal_uInt16 >( "flags", "CHARTSHEETPR-FLAGS" );
+ dumpColor( "tab-color" );
+ dumpString( "codename" );
+ break;
+
+ case BIFF12_ID_CHARTSHEETVIEW:
+ dumpHex< sal_uInt16 >( "flags", "CHARTSHEETVIEW-FLAGS" );
+ dumpDec< sal_Int32 >( "zoom-scale", "CONV-PERCENT" );
+ dumpDec< sal_Int32 >( "workbookview-id" );
+ break;
+
+ case BIFF12_ID_COL:
+ dumpColRange();
+ dumpDec< sal_Int32 >( "col-width", "CONV-COLWIDTH" );
+ dumpDec< sal_Int32 >( "custom-xf-id" );
+ dumpHex< sal_uInt16 >( "flags", "COL-FLAGS" );
+ break;
+
+ case BIFF12_ID_COLBREAKS:
+ dumpDec< sal_Int32 >( "count" );
+ dumpDec< sal_Int32 >( "manual-count" );
+ break;
+
+ case BIFF12_ID_COLOR:
+ dumpColor();
+ break;
+
+ case BIFF12_ID_COMMENT:
+ dumpDec< sal_Int32 >( "author-id" );
+ dumpRange( "ref" );
+ dumpGuid();
+ break;
+
+ case BIFF12_ID_COMMENTAUTHOR:
+ dumpString( "author" );
+ break;
+
+ case BIFF12_ID_COMMENTTEXT:
+ dumpString( "text", true );
+ break;
+
+ case BIFF12_ID_CONDFORMATTING:
+ dumpDec< sal_Int32 >( "cfrule-count" );
+ dumpDec< sal_Int32 >( "pivot-table", "BOOLEAN" );
+ dumpRangeList();
+ break;
+
+ case BIFF12_ID_CONNECTION:
+ {
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt8 >( "save-password", "CONNECTION-SAVEPASSWORD" );
+ dumpUnused( 1 );
+ dumpDec< sal_uInt16 >( "refresh-interval", "CONNECTION-INTERVAL" );
+ dumpHex< sal_uInt16 >( "flags", "CONNECTION-FLAGS" );
+ sal_uInt16 nStrFlags = dumpHex< sal_uInt16 >( "string-flags", "CONNECTION-STRINGFLAGS" );
+ dumpDec< sal_Int32 >( "data-source-type", "CONNECTION-SOURCETYPE" );
+ dumpDec< sal_Int32 >( "reconnect-type", "CONNECTION-RECONNECTTYPE" );
+ dumpDec< sal_Int32 >( "id" );
+ dumpDec< sal_uInt8 >( "credentials", "CONNECTION-CREDENTIALS" );
+ if( nStrFlags & 0x0001 ) dumpString( "source-file" );
+ if( nStrFlags & 0x0002 ) dumpString( "source-conn-file" );
+ if( nStrFlags & 0x0004 ) dumpString( "description" );
+ if( nStrFlags & 0x0008 ) dumpString( "name" );
+ if( nStrFlags & 0x0010 ) dumpString( "sso-id" );
+ }
+ break;
+
+ case BIFF12_ID_CONTROL:
+ dumpDec< sal_Int32 >( "shape-id" );
+ dumpString( "rel-id" );
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_CUSTOMFILTER:
+ {
+ sal_uInt8 nType = dumpDec< sal_uInt8 >( "data-type", "CUSTOMFILTER-DATATYPE" );
+ dumpDec< sal_uInt8 >( "operator", "CUSTOMFILTER-OPERATOR" );
+ switch( nType )
+ {
+ case 4: dumpDec< double >( "value" ); break;
+ case 6: dumpUnused( 8 ); dumpString( "value" ); break;
+ case 8: dumpBoolean( "value" ); dumpUnused( 7 ); break;
+ default: dumpUnused( 8 );
+ }
+ }
+ break;
+
+ case BIFF12_ID_DATATABLE:
+ dumpRange( "table-range" );
+ dumpAddress( "ref1" );
+ dumpAddress( "ref2" );
+ dumpHex< sal_uInt8 >( "flags", "DATATABLE-FLAGS" );
+ break;
+
+ case BIFF12_ID_DATAVALIDATION:
+ dumpHex< sal_uInt32 >( "flags", "DATAVALIDATION-FLAGS" );
+ dumpRangeList();
+ dumpString( "error-title" );
+ dumpString( "error-message" );
+ dumpString( "input-title" );
+ dumpString( "input-message" );
+ mxFmlaObj->dumpNameFormula( "formula1" );
+ mxFmlaObj->dumpNameFormula( "formula2" );
+ break;
+
+ case BIFF12_ID_DATAVALIDATIONS:
+ dumpHex< sal_uInt16 >( "flags", "DATAVALIDATIONS-FLAGS" );
+ dumpDec< sal_Int32 >( "input-x" );
+ dumpDec< sal_Int32 >( "input-y" );
+ dumpUnused( 4 );
+ dumpDec< sal_Int32 >( "count" );
+ break;
+
+ case BIFF12_ID_DDEITEMVALUES:
+ dumpDec< sal_Int32 >( "rows" );
+ dumpDec< sal_Int32 >( "columns" );
+ break;
+
+ case BIFF12_ID_DDEITEM_STRING:
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_DEFINEDNAME:
+ dumpHex< sal_uInt32 >( "flags", "DEFINEDNAME-FLAGS" );
+ dumpChar( "accelerator", RTL_TEXTENCODING_ISO_8859_1 );
+ dumpDec< sal_Int32 >( "sheet-id", "DEFINEDNAME-SHEETID" );
+ dumpString( "name" );
+ mxFmlaObj->dumpNameFormula();
+ dumpString( "comment" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "menu-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "description-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "help-text" );
+ if( mxStrm->getRemaining() >= 4 ) dumpString( "statusbar-text" );
+ break;
+
+ case BIFF12_ID_DIMENSION:
+ dumpRange( "used-range" );
+ break;
+
+ case BIFF12_ID_DISCRETEFILTER:
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_DISCRETEFILTERS:
+ dumpBool< sal_Int32 >( "show-blank" );
+ dumpDec< sal_Int32 >( "calendar-type", "DISCRETEFILTERS-CALTYPE" );
+ break;
+
+ case BIFF12_ID_DRAWING:
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_DXF:
+ dumpHex< sal_uInt32 >( "flags", "DXF-FLAGS" );
+ for( sal_uInt16 nIndex = 0, nCount = dumpDec< sal_uInt16 >( "subrec-count" ); !mxStrm->isEof() && (nIndex < nCount); ++nIndex )
+ {
+ mxOut->startMultiItems();
+ sal_Int64 nStartPos = mxStrm->tell();
+ writeEmptyItem( "SUBREC" );
+ sal_uInt16 nSubRecId = dumpDec< sal_uInt16 >( "id", "DXF-SUBREC" );
+ sal_uInt16 nSubRecSize = dumpDec< sal_uInt16 >( "size" );
+ sal_Int64 nEndPos = nStartPos + nSubRecSize;
+ mxOut->endMultiItems();
+ IndentGuard aIndGuard( mxOut );
+ switch( nSubRecId )
+ {
+ case 0:
+ dumpDec< sal_uInt8 >( "pattern", "FILLPATTERNS" );
+ break;
+ case 1: case 2: case 5:
+ dumpColor();
+ break;
+ case 3:
+ dumpGradientHead();
+ break;
+ case 4:
+ dumpDec< sal_uInt16 >( "index" );
+ dumpDec< double >( "stop-position" );
+ dumpColor( "stop-color" );
+ break;
+ case 6: case 7: case 8: case 9: case 10: case 11: case 12:
+ dumpColor( "color" );
+ dumpDec< sal_uInt16 >( "style", "BORDERSTYLES" );
+ break;
+ case 13: case 14:
+ dumpBoolean( "value" );
+ break;
+ case 15:
+ dumpDec< sal_uInt8 >( "alignment", "XF-HORALIGN" );
+ break;
+ case 16:
+ dumpDec< sal_uInt8 >( "alignment", "XF-VERALIGN" );
+ break;
+ case 17:
+ dumpDec< sal_uInt8 >( "rotation", "TEXTROTATION" );
+ break;
+ case 18:
+ dumpDec< sal_uInt16 >( "indent" );
+ break;
+ case 19:
+ dumpDec< sal_uInt8 >( "text-dir", "XF-TEXTDIRECTION" );
+ break;
+ case 20: case 21: case 22:
+ dumpBoolean( "value" );
+ break;
+ case 24:
+ dumpString( "name", false, false );
+ break;
+ case 25:
+ dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
+ break;
+ case 26:
+ dumpDec< sal_uInt16 >( "underline", "FONT-UNDERLINE" );
+ break;
+ case 27:
+ dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
+ break;
+ case 28: case 29: case 30: case 31: case 32: case 33:
+ dumpBoolean( "value" );
+ break;
+ case 34:
+ dumpDec< sal_uInt8 >( "charset", "CHARSET" );
+ break;
+ case 35:
+ dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
+ break;
+ case 36:
+ dumpDec< sal_Int32 >( "height", "CONV-TWIP-TO-PT" );
+ break;
+ case 37:
+ dumpDec< sal_uInt8 >( "scheme", "FONT-SCHEME" );
+ break;
+ case 38:
+ dumpString( "numfmt", false, false );
+ break;
+ case 41:
+ dumpDec< sal_uInt16 >( "numfmt-id" );
+ break;
+ case 42:
+ dumpDec< sal_Int16 >( "relative-indent" );
+ break;
+ case 43: case 44:
+ dumpBoolean( "value" );
+ break;
+ }
+ dumpRemainingTo( nEndPos );
+ }
+ break;
+
+ case BIFF12_ID_EXTCELL_BOOL:
+ dumpColIndex();
+ dumpBoolean();
+ break;
+
+ case BIFF12_ID_EXTCELL_DOUBLE:
+ dumpColIndex();
+ dumpDec< double >( "value" );
+ break;
+
+ case BIFF12_ID_EXTCELL_ERROR:
+ dumpColIndex();
+ dumpErrorCode();
+ break;
+
+ case BIFF12_ID_EXTCELL_STRING:
+ dumpColIndex();
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_EXTERNALBOOK:
+ switch( dumpDec< sal_uInt16 >( "type", "EXTERNALBOOK-TYPE" ) )
+ {
+ case 0:
+ dumpString( "rel-id" );
+ dumpDec< sal_Int32 >( "unused" );
+ break;
+ case 1:
+ dumpString( "dde-service" );
+ dumpString( "dde-topic" );
+ break;
+ case 2:
+ dumpString( "rel-id" );
+ dumpString( "prog-id" );
+ break;
+ }
+ break;
+
+ case BIFF12_ID_EXTERNALNAME:
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_EXTERNALNAMEFLAGS:
+ dumpHex< sal_uInt16 >( "flags", "EXTERNALNAMEFLAGS-FLAGS" );
+ dumpDec< sal_Int32 >( "sheet-id" );
+ dumpBoolean( "is-dde-ole" );
+ break;
+
+ case BIFF12_ID_EXTERNALREF:
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_EXTERNALSHEETS:
+ {
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "ref-count" );
+ TableGuard aTabGuard( mxOut, 13, 17, 24 );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nRefId = 0; !mxStrm->isEof() && (nRefId < nCount); ++nRefId )
+ {
+ MultiItemsGuard aMultiGuard( mxOut );
+ writeEmptyItem( "#ref" );
+ dumpDec< sal_Int32 >( "extref-id" );
+ dumpDec< sal_Int32 >( "first-sheet", "EXTERNALSHEETS-ID" );
+ dumpDec< sal_Int32 >( "last-sheet", "EXTERNALSHEETS-ID" );
+ }
+ }
+ break;
+
+ case BIFF12_ID_EXTROW:
+ dumpRowIndex();
+ break;
+
+ case BIFF12_ID_EXTSHEETDATA:
+ dumpDec< sal_Int32 >( "sheet-id" );
+ dumpHex< sal_uInt8 >( "flags", "EXTSHEETDATA-FLAGS" );
+ break;
+
+ case BIFF12_ID_EXTSHEETNAMES:
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSheet = 0, nCount = dumpDec< sal_Int32 >( "sheet-count" ); !mxStrm->isEof() && (nSheet < nCount); ++nSheet )
+ dumpString( "#sheet-name" );
+ break;
+
+ case BIFF12_ID_FILESHARING:
+ dumpBool< sal_uInt16 >( "recommend-read-only" );
+ dumpHex< sal_uInt16 >( "password-hash" );
+ dumpString( "password-creator" );
+ break;
+
+ case BIFF12_ID_FILL:
+ dumpDec< sal_Int32 >( "fill-pattern", "FILLPATTERNS" );
+ dumpColor( "fg-color" );
+ dumpColor( "bg-color" );
+ dumpGradientHead();
+ mxOut->resetItemIndex();
+ for( sal_Int32 nStop = 0, nStopCount = dumpDec< sal_Int32 >( "stop-count" ); (nStop < nStopCount) && !mxStrm->isEof(); ++nStop )
+ {
+ writeEmptyItem( "#stop" );
+ IndentGuard aIndGuard( mxOut );
+ dumpColor( "stop-color" );
+ dumpDec< double >( "stop-position" );
+ }
+ break;
+
+ case BIFF12_ID_FILEVERSION:
+ dumpGuid( "codename" );
+ dumpString( "app-name" );
+ dumpString( "last-edited" );
+ dumpString( "lowest-edited" );
+ dumpString( "build-version" );
+ break;
+
+ case BIFF12_ID_FILTERCOLUMN:
+ dumpDec< sal_Int32 >( "column-index" );
+ dumpHex< sal_uInt16 >( "flags", "FILTERCOLUMN-FLAGS" );
+ break;
+
+ case BIFF12_ID_FONT:
+ dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
+ dumpHex< sal_uInt16 >( "flags", "FONT-FLAGS" );
+ dumpDec< sal_uInt16 >( "weight", "FONT-WEIGHT" );
+ dumpDec< sal_uInt16 >( "escapement", "FONT-ESCAPEMENT" );
+ dumpDec< sal_uInt8 >( "underline", "FONT-UNDERLINE" );
+ dumpDec< sal_uInt8 >( "family", "FONT-FAMILY" );
+ dumpDec< sal_uInt8 >( "charset", "CHARSET" );
+ dumpUnused( 1 );
+ dumpColor();
+ dumpDec< sal_uInt8 >( "scheme", "FONT-SCHEME" );
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_FORMULA_BOOL:
+ dumpCellHeader( true );
+ dumpBoolean();
+ dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_FORMULA_DOUBLE:
+ dumpCellHeader( true );
+ dumpDec< double >( "value" );
+ dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_FORMULA_ERROR:
+ dumpCellHeader( true );
+ dumpErrorCode();
+ dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_FORMULA_STRING:
+ dumpCellHeader( true );
+ dumpString( "value" );
+ dumpHex< sal_uInt16 >( "flags", "FORMULA-FLAGS" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_FUNCTIONGROUP:
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_HEADERFOOTER:
+ dumpHex< sal_uInt16 >( "flags", "HEADERFOOTER-FLAGS" );
+ dumpString( "odd-header" );
+ dumpString( "odd-footer" );
+ dumpString( "even-header" );
+ dumpString( "even-footer" );
+ dumpString( "first-header" );
+ dumpString( "first-footer" );
+ break;
+
+ case BIFF12_ID_HYPERLINK:
+ dumpRange();
+ dumpString( "rel-id" );
+ dumpString( "location" );
+ dumpString( "tooltip" );
+ dumpString( "display" );
+ break;
+
+ case BIFF12_ID_INPUTCELLS:
+ dumpAddress( "pos" );
+ dumpUnused( 8 );
+ dumpDec< sal_uInt16 >( "numfmt-id" );
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_LEGACYDRAWING:
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_MERGECELL:
+ dumpRange();
+ break;
+
+ case BIFF12_ID_MULTCELL_BLANK:
+ dumpCellHeader( false );
+ break;
+
+ case BIFF12_ID_MULTCELL_BOOL:
+ dumpCellHeader( false );
+ dumpBoolean();
+ break;
+
+ case BIFF12_ID_MULTCELL_DOUBLE:
+ dumpCellHeader( false );
+ dumpDec< double >( "value" );
+ break;
+
+ case BIFF12_ID_MULTCELL_ERROR:
+ dumpCellHeader( false );
+ dumpErrorCode();
+ break;
+
+ case BIFF12_ID_MULTCELL_RK:
+ dumpCellHeader( false );
+ dumpRk( "value" );
+ break;
+
+ case BIFF12_ID_MULTCELL_RSTRING:
+ dumpCellHeader( false );
+ dumpString( "value", true );
+ break;
+
+ case BIFF12_ID_MULTCELL_SI:
+ dumpCellHeader( false );
+ dumpDec< sal_Int32 >( "string-id" );
+ break;
+
+ case BIFF12_ID_MULTCELL_STRING:
+ dumpCellHeader( false );
+ dumpString( "value" );
+ break;
+
+ case BIFF12_ID_NUMFMT:
+ dumpDec< sal_uInt16 >( "numfmt-id" );
+ dumpString( "format" );
+ break;
+
+ case BIFF12_ID_OLEOBJECT:
+ {
+ dumpDec< sal_Int32 >( "aspect", "OLEOBJECT-ASPECT" );
+ dumpDec< sal_Int32 >( "update", "OLEOBJECT-UPDATE" );
+ dumpDec< sal_Int32 >( "shape-id" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "OLEOBJECT-FLAGS" );
+ dumpString( "prog-id" );
+ if( getFlag( nFlags, BIFF12_OLEOBJECT_LINKED ) )
+ mxFmlaObj->dumpNameFormula( "link" );
+ else
+ dumpString( "rel-id" );
+ }
+ break;
+
+ case BIFF12_ID_OLESIZE:
+ dumpRange( "visible-range" );
+ break;
+
+ case BIFF12_ID_PAGEMARGINS:
+ dumpDec< double >( "left-margin" );
+ dumpDec< double >( "right-margin" );
+ dumpDec< double >( "top-margin" );
+ dumpDec< double >( "bottom-margin" );
+ dumpDec< double >( "header-margin" );
+ dumpDec< double >( "footer-margin" );
+ break;
+
+ case BIFF12_ID_PAGESETUP:
+ dumpDec< sal_Int32 >( "paper-size", "PAGESETUP-PAPERSIZE" );
+ dumpDec< sal_Int32 >( "scaling", "CONV-PERCENT" );
+ dumpDec< sal_Int32 >( "horizontal-res", "PAGESETUP-DPI" );
+ dumpDec< sal_Int32 >( "vertical-res", "PAGESETUP-DPI" );
+ dumpDec< sal_Int32 >( "copies" );
+ dumpDec< sal_Int32 >( "first-page" );
+ dumpDec< sal_Int32 >( "scale-to-width", "PAGESETUP-SCALETOPAGES" );
+ dumpDec< sal_Int32 >( "scale-to-height", "PAGESETUP-SCALETOPAGES" );
+ dumpHex< sal_uInt16 >( "flags", "PAGESETUP-FLAGS" );
+ dumpString( "printer-settings-rel-id" );
+ break;
+
+ case BIFF12_ID_PANE:
+ dumpDec< double >( "x-split-pos" );
+ dumpDec< double >( "y-split-pos" );
+ dumpAddress( "second-top-left" );
+ dumpDec< sal_Int32 >( "active-pane", "PANE-ID" );
+ dumpHex< sal_uInt8 >( "flags", "PANE-FLAGS" );
+ break;
+
+ case BIFF12_ID_PCDEFINITION:
+ {
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt8 >( "created-version" );
+ dumpHex< sal_uInt8 >( "flags-1", "PCDEFINITION-FLAGS1" );
+ dumpDec< sal_Int32 >( "missing-items-limit", "PCDEFINITION-MISSINGITEMS" );
+ dumpDec< double >( "refreshed-date" );
+ sal_uInt8 nFlags2 = dumpHex< sal_uInt8 >( "flags-2", "PCDEFINITION-FLAGS2" );
+ dumpDec< sal_Int32 >( "record-count" );
+ if( nFlags2 & 0x01 ) dumpString( "refreshed-by" );
+ if( nFlags2 & 0x02 ) dumpString( "rel-id" );
+ }
+ break;
+
+ case BIFF12_ID_PCDFIELD:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
+ dumpDec< sal_Int32 >( "numfmt-id" );
+ dumpDec< sal_Int16 >( "sql-datatype" );
+ dumpDec< sal_Int32 >( "hierarchy" );
+ dumpDec< sal_Int32 >( "hierarchy-level" );
+ sal_Int32 nMappingCount = dumpDec< sal_Int32 >( "property-mapping-count" );
+ dumpString( "name" );
+ if( nFlags & 0x0008 ) dumpString( "caption" );
+ if( nFlags & 0x0100 ) mxFmlaObj->dumpNameFormula( "formula" );
+ if( nMappingCount > 0 )
+ {
+ sal_Int32 nBytes = dumpDec< sal_Int32 >( "property-mapping-size" );
+ dumpArray( "property-mapping-indexes", nBytes );
+ }
+ if( nFlags & 0x0200 ) dumpString( "property-name" );
+ }
+ break;
+
+ case BIFF12_ID_PCDFIELDGROUP:
+ dumpDec< sal_Int32 >( "parent-field" );
+ dumpDec< sal_Int32 >( "base-field" );
+ break;
+
+ case BIFF12_ID_PCDFRANGEPR:
+ dumpDec< sal_uInt8 >( "group-by", "PCDFRANGEPR-GROUPBY" );
+ dumpHex< sal_uInt8 >( "flags", "PCDFRANGEPR-FLAGS" );
+ dumpDec< double >( "start-value" );
+ dumpDec< double >( "end-value" );
+ dumpDec< double >( "interval" );
+ break;
+
+ case BIFF12_ID_PCDFSHAREDITEMS:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFSHAREDITEMS-FLAGS" );
+ dumpDec< sal_Int32 >( "count" );
+ if( nFlags & 0x0100 ) dumpDec< double >( "min-value" );
+ if( nFlags & 0x0100 ) dumpDec< double >( "max-value" );
+ }
+ break;
+
+ case BIFF12_ID_PCDSHEETSOURCE:
+ {
+ sal_uInt8 nIsDefName = dumpBoolean( "is-def-name" );
+ dumpBoolean( "is-builtin-def-name" );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PCDWORKSHEETSOURCE-FLAGS" );
+ if( nFlags & 0x02 ) dumpString( "sheet-name" );
+ if( nFlags & 0x01 ) dumpString( "rel-id" );
+ if( nIsDefName == 0 ) dumpRange(); else dumpString( "def-name" );
+ }
+ break;
+
+ case BIFF12_ID_PCDSOURCE:
+ dumpDec< sal_Int32 >( "source-type", "PCDSOURCE-TYPE" );
+ dumpDec< sal_Int32 >( "connection-id" );
+ break;
+
+ case BIFF12_ID_PCITEM_ARRAY:
+ {
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "type", "PCITEM_ARRAY-TYPE" );
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ {
+ switch( nType )
+ {
+ case 1: dumpDec< double >( "#value" ); break;
+ case 2: dumpString( "#value" ); break;
+ case 16: dumpErrorCode( "#value" ); break;
+ case 32: dumpPivotDateTime( "#value" ); break;
+ default: nIdx = nCount;
+ }
+ }
+ }
+ break;
+
+ case BIFF12_ID_PCITEM_BOOL:
+ dumpBoolean( "value" );
+ break;
+
+ case BIFF12_ID_PCITEM_DATE:
+ dumpPivotDateTime( "value" );
+ break;
+
+ case BIFF12_ID_PCITEM_DOUBLE:
+ dumpDec< double >( "value" );
+ // TODO: server formatting
+ break;
+
+ case BIFF12_ID_PCITEM_ERROR:
+ dumpErrorCode( "value" );
+ // TODO: server formatting
+ break;
+
+ case BIFF12_ID_PCITEM_INDEX:
+ dumpDec< sal_Int32 >( "index" );
+ break;
+
+ case BIFF12_ID_PCITEM_MISSING:
+ // TODO: server formatting
+ break;
+
+
+ case BIFF12_ID_PCITEM_STRING:
+ dumpString( "value" );
+ // TODO: server formatting
+ break;
+
+ case BIFF12_ID_PCITEMA_BOOL:
+ dumpBoolean( "value" );
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PCITEMA_DATE:
+ dumpPivotDateTime( "value" );
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PCITEMA_DOUBLE:
+ dumpDec< double >( "value" );
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PCITEMA_ERROR:
+ dumpErrorCode( "value" );
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PCITEMA_MISSING:
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PCITEMA_STRING:
+ dumpString( "value" );
+ // TODO: additional info
+ break;
+
+ case BIFF12_ID_PHONETICPR:
+ dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
+ dumpDec< sal_Int32 >( "type", "PHONETICPR-TYPE" );
+ dumpDec< sal_Int32 >( "alignment", "PHONETICPR-ALIGNMENT" );
+ break;
+
+ case BIFF12_ID_PICTURE:
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_PIVOTAREA:
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_uInt8 >( "type", "PIVOTAREA-TYPE" );
+ dumpHex< sal_uInt8 >( "flags-1", "PIVOTAREA-FLAGS1" );
+ dumpHex< sal_uInt16 >( "flags-2", "PIVOTAREA-FLAGS2" );
+ break;
+
+ case BIFF12_ID_PIVOTCACHE:
+ dumpDec< sal_Int32 >( "cache-id" );
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_PTCOLFIELDS:
+ dumpDec< sal_Int32 >( "count" );
+ mxOut->resetItemIndex();
+ while( mxStrm->getRemaining() >= 4 )
+ dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
+ break;
+
+ case BIFF12_ID_PTDATAFIELD:
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
+ dumpDec< sal_Int32 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
+ dumpDec< sal_Int32 >( "base-field" );
+ dumpDec< sal_Int32 >( "base-item", "PTDATAFIELD-BASEITEM" );
+ dumpDec< sal_Int32 >( "number-format" );
+ if( dumpBool< sal_uInt8 >( "has-name" ) )
+ dumpString( "name" );
+ break;
+
+ case BIFF12_ID_PTDEFINITION:
+ {
+ dumpDec< sal_uInt8 >( "created-version" );
+ dumpHex< sal_uInt8 >( "flags-1", "PTDEFINITION-FLAGS1" );
+ dumpHex< sal_uInt16 >( "flags-2", "PTDEFINITION-FLAGS2" );
+ sal_uInt32 nFlags3 = dumpHex< sal_uInt32 >( "flags-3", "PTDEFINITION-FLAGS3" );
+ sal_uInt32 nFlags4 = dumpHex< sal_uInt32 >( "flags-4", "PTDEFINITION-FLAGS4" );
+ dumpDec< sal_uInt8 >( "datafield-axis", "PTDEFINITION-DATAFIELD-AXIS" );
+ dumpDec< sal_uInt8 >( "page-wrap" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_Int32 >( "datafield-position", "PTDEFINITION-DATAFIELD-POS" );
+ dumpDec< sal_Int16 >( "autoformat-id" );
+ dumpUnused( 2 );
+ dumpDec< sal_Int32 >( "next-chart-id" );
+ dumpDec< sal_Int32 >( "cache-id" );
+ dumpString( "name" );
+ if( nFlags3 & 0x00080000 ) dumpString( "data-caption" );
+ if( nFlags3 & 0x00100000 ) dumpString( "grand-total-caption" );
+ if( (nFlags4 & 0x00000040) == 0 ) dumpString( "error-caption" );
+ if( (nFlags4 & 0x00000080) == 0 ) dumpString( "missing-caption" );
+ if( nFlags3 & 0x00200000 ) dumpString( "page-field-style" );
+ if( nFlags3 & 0x00400000 ) dumpString( "pivot-table-style" );
+ if( nFlags3 & 0x00800000 ) dumpString( "vacated-style" );
+ if( nFlags3 & 0x40000000 ) dumpString( "tag" );
+ if( nFlags4 & 0x00000800 ) dumpString( "col-header-caption" );
+ if( nFlags4 & 0x00000400 ) dumpString( "row-header-caption" );
+ }
+ break;
+
+ case BIFF12_ID_PTFIELD:
+ dumpHex< sal_uInt32 >( "flags-1", "PTFIELD-FLAGS1" );
+ dumpDec< sal_Int32 >( "num-fmt" );
+ dumpHex< sal_uInt32 >( "flags-2", "PTFIELD-FLAGS2" );
+ dumpDec< sal_Int32 >( "autoshow-items" );
+ dumpDec< sal_Int32 >( "autoshow-datafield-idx" );
+ break;
+
+ case BIFF12_ID_PTFILTER:
+ {
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "member-prop-field" );
+ dumpDec< sal_Int32 >( "type", "PTFILTER-TYPE" );
+ dumpUnused( 4 );
+ dumpDec< sal_Int32 >( "unique-id" );
+ dumpDec< sal_Int32 >( "measure-data-field" );
+ dumpDec< sal_Int32 >( "measure-data-hierarchy" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFILTER-FLAGS" );
+ if( nFlags & 0x0001 ) dumpString( "name" );
+ if( nFlags & 0x0002 ) dumpString( "description" );
+ if( nFlags & 0x0004 ) dumpString( "str-value1" );
+ if( nFlags & 0x0008 ) dumpString( "str-value2" );
+ }
+ break;
+
+ case BIFF12_ID_PTFITEM:
+ {
+ dumpDec< sal_uInt8 >( "type", "PTFITEM-TYPE" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
+ dumpDec< sal_Int32 >( "cache-idx" );
+ if( nFlags & 0x0010 ) dumpString( "display-name" );
+ }
+ break;
+
+ case BIFF12_ID_PTLOCATION:
+ dumpRange( "location" );
+ dumpDec< sal_Int32 >( "first-header-row" );
+ dumpDec< sal_Int32 >( "first-data-row" );
+ dumpDec< sal_Int32 >( "first-data-col" );
+ dumpDec< sal_Int32 >( "page-row-count" );
+ dumpDec< sal_Int32 >( "page-col-count" );
+ break;
+
+ case BIFF12_ID_PTPAGEFIELD:
+ {
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "cache-item", "PTPAGEFIELD-ITEM" );
+ dumpDec< sal_Int32 >( "olap-hierarchy" );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PTPAGEFIELD-FLAGS" );
+ if( nFlags & 0x01 ) dumpString( "unique-name" );
+ if( nFlags & 0x02 ) dumpString( "olap-caption" );
+ }
+ break;
+
+ case BIFF12_ID_PTREFERENCE:
+ dumpDec< sal_Int32 >( "field", "PT-FIELDINDEX" );
+ dumpDec< sal_Int32 >( "item-count" );
+ dumpHex< sal_uInt16 >( "flags-1", "PTREFERENCE-FLAGS1" );
+ dumpHex< sal_uInt8 >( "flags-2", "PTREFERENCE-FLAGS2" );
+ break;
+
+ case BIFF12_ID_PTROWFIELDS:
+ dumpDec< sal_Int32 >( "count" );
+ mxOut->resetItemIndex();
+ while( mxStrm->getRemaining() >= 4 )
+ dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
+ break;
+
+ case BIFF12_ID_QUERYTABLE:
+ dumpHex< sal_uInt32 >( "flags", "QUERYTABLE-FLAGS" );
+ dumpDec< sal_uInt16 >( "autoformat-id" );
+ dumpDec< sal_Int32 >( "connection-id" );
+ dumpString( "defined-name" );
+ break;
+
+ case BIFF12_ID_ROW:
+ dumpRowIndex();
+ dumpDec< sal_Int32 >( "custom-xf-id" );
+ dumpDec< sal_uInt16 >( "height", "CONV-TWIP-TO-PT" );
+ dumpHex< sal_uInt16 >( "flags", "ROW-FLAGS1" );
+ dumpHex< sal_uInt8 >( "flags", "ROW-FLAGS2" );
+ mxOut->resetItemIndex();
+ for( sal_Int32 nSpan = 0, nSpanCount = dumpDec< sal_Int32 >( "row-spans-count" ); !mxStrm->isEof() && (nSpan < nSpanCount); ++nSpan )
+ dumpRowRange( "#row-spans" );
+ break;
+
+ case BIFF12_ID_ROWBREAKS:
+ dumpDec< sal_Int32 >( "count" );
+ dumpDec< sal_Int32 >( "manual-count" );
+ break;
+
+ case BIFF12_ID_SCENARIO:
+ dumpDec< sal_uInt16 >( "cell-count" );
+ // two longs instead of flag field
+ dumpDec< sal_Int32 >( "locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "hidden", "BOOLEAN" );
+ dumpString( "name" );
+ dumpString( "comment" );
+ dumpString( "user" );
+ break;
+
+ case BIFF12_ID_SCENARIOS:
+ dumpDec< sal_uInt16 >( "selected" );
+ dumpDec< sal_uInt16 >( "shown" );
+ dumpRangeList( "result-cells" );
+ break;
+
+ case BIFF12_ID_SELECTION:
+ dumpDec< sal_Int32 >( "pane", "PANE-ID" );
+ dumpAddress( "active-cell" );
+ dumpDec< sal_Int32 >( "active-cell-id" );
+ dumpRangeList( "selection" );
+ break;
+
+ case BIFF12_ID_SHAREDFMLA:
+ dumpRange( "formula-range" );
+ mxFmlaObj->dumpCellFormula();
+ break;
+
+ case BIFF12_ID_SHEET:
+ dumpDec< sal_Int32 >( "sheet-state", "SHEET-STATE" );
+ dumpDec< sal_Int32 >( "sheet-id" );
+ dumpString( "rel-id" );
+ dumpString( "sheet-name" );
+ break;
+
+ case BIFF12_ID_SHEETFORMATPR:
+ dumpDec< sal_Int32 >( "default-col-width", "CONV-COLWIDTH" );
+ dumpDec< sal_uInt16 >( "base-col-width" );
+ dumpDec< sal_uInt16 >( "default-row-height", "CONV-TWIP-TO-PT" );
+ dumpHex< sal_uInt16 >( "flags", "SHEETFORMATPR-FLAGS" );
+ dumpDec< sal_uInt8 >( "max-row-outline" );
+ dumpDec< sal_uInt8 >( "max-col-outline" );
+ break;
+
+ case BIFF12_ID_SHEETPR:
+ dumpHex< sal_uInt16 >( "flags1", "SHEETPR-FLAGS1" );
+ dumpHex< sal_uInt8 >( "flags2", "SHEETPR-FLAGS2" );
+ dumpColor( "tab-color" );
+ dumpAddress( "window-anchor" );
+ dumpString( "codename" );
+ break;
+
+ case BIFF12_ID_SHEETPROTECTION:
+ dumpHex< sal_uInt16 >( "password-hash" );
+ // no flags field for all these boolean flags?!?
+ dumpDec< sal_Int32 >( "sheet-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "objects-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "scenarios-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "format-cells-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "format-columns-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "format-rows-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "insert-columns-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "insert-rows-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "insert-hyperlinks-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "delete-columns-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "delete-rows-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "select-locked-cells-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "sort-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "autofilter-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "pivot-tables-locked", "BOOLEAN" );
+ dumpDec< sal_Int32 >( "select-unlocked-cells-locked", "BOOLEAN" );
+ break;
+
+ case BIFF12_ID_SHEETVIEW:
+ dumpHex< sal_uInt16 >( "flags", "SHEETVIEW-FLAGS" );
+ dumpDec< sal_Int32 >( "view-type", "SHEETVIEW-TYPE" );
+ dumpAddress( "top-left" );
+ dumpDec< sal_Int32 >( "gridcolor-id", "PALETTE-COLORS" );
+ dumpDec< sal_uInt16 >( "zoom-scale", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "zoom-scale-normal", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "zoom-scale-sheet-layout", "CONV-PERCENT" );
+ dumpDec< sal_uInt16 >( "zoom-scale-page-layout", "CONV-PERCENT" );
+ dumpDec< sal_Int32 >( "workbookview-id" );
+ break;
+
+ case BIFF12_ID_SI:
+ dumpString( "string", true );
+ break;
+
+ case BIFF12_ID_SST:
+ dumpDec< sal_Int32 >( "string-cell-count" );
+ dumpDec< sal_Int32 >( "sst-size" );
+ break;
+
+ case BIFF12_ID_TABLE:
+ dumpRange();
+ dumpDec< sal_Int32 >( "type", "TABLE-TYPE" );
+ dumpDec< sal_Int32 >( "id" );
+ dumpDec< sal_Int32 >( "header-rows" );
+ dumpDec< sal_Int32 >( "totals-rows" );
+ dumpHex< sal_uInt32 >( "flags", "TABLE-FLAGS" );
+ dumpDec< sal_Int32 >( "headerrow-dxf-id" );
+ dumpDec< sal_Int32 >( "data-dxf-id" );
+ dumpDec< sal_Int32 >( "totalsrow-dxf-id" );
+ dumpDec< sal_Int32 >( "table-border-dxf-id" );
+ dumpDec< sal_Int32 >( "headerrow-border-dxf-id" );
+ dumpDec< sal_Int32 >( "totalsrow-border-dxf-id" );
+ dumpDec< sal_Int32 >( "connection-id" );
+ dumpString( "name" );
+ dumpString( "display-name" );
+ dumpString( "comment" );
+ dumpString( "headerrow-cell-style" );
+ dumpString( "data-cell-style" );
+ dumpString( "totalsrow-cell-style" );
+ break;
+
+ case BIFF12_ID_TABLEPART:
+ dumpString( "rel-id" );
+ break;
+
+ case BIFF12_ID_TABLESTYLEINFO:
+ dumpHex< sal_uInt16 >( "flags", "TABLESTYLEINFO-FLAGS" );
+ dumpString( "style-name" );
+ break;
+
+ case BIFF12_ID_TOP10FILTER:
+ dumpHex< sal_uInt8 >( "flags", "TOP10FILTER-FLAGS" );
+ dumpDec< double >( "value" );
+ dumpDec< double >( "cell-value" );
+ break;
+
+ case BIFF12_ID_VOLTYPEMAIN:
+ dumpString( "first" );
+ break;
+
+ case BIFF12_ID_VOLTYPESTP:
+ dumpString( "topic-value" );
+ break;
+
+ case BIFF12_ID_VOLTYPETR:
+ dumpAddress( "ref" );
+ dumpDec< sal_Int32 >( "sheet-id" );
+ break;
+
+ case BIFF12_ID_WEBPR:
+ {
+ dumpHex< sal_uInt32 >( "flags", "WEBPR-FLAGS" );
+ sal_uInt8 nStrFlags = dumpHex< sal_uInt8 >( "string-flags", "WEBPR-STRINGFLAGS" );
+ if( nStrFlags & 0x04 ) dumpString( "url" );
+ if( nStrFlags & 0x01 ) dumpString( "post-method" );
+ if( nStrFlags & 0x02 ) dumpString( "edit-page" );
+ }
+ break;
+
+ case BIFF12_ID_WORKBOOKPR:
+ dumpHex< sal_uInt32 >( "flags", "WORKBBOKPR-FLAGS" );
+ dumpDec< sal_Int32 >( "default-theme-version" );
+ dumpString( "codename" );
+ break;
+
+ case BIFF12_ID_WORKBOOKVIEW:
+ dumpDec< sal_Int32 >( "x-window" );
+ dumpDec< sal_Int32 >( "y-window" );
+ dumpDec< sal_Int32 >( "win-width" );
+ dumpDec< sal_Int32 >( "win-height" );
+ dumpDec< sal_Int32 >( "tabbar-ratio" );
+ dumpDec< sal_Int32 >( "first-sheet" );
+ dumpDec< sal_Int32 >( "active-sheet" );
+ dumpHex< sal_uInt8 >( "flags", "WORKBOOKVIEW-FLAGS" );
+ break;
+
+ case BIFF12_ID_XF:
+ dumpDec< sal_uInt16 >( "parent-xf-id" );
+ dumpDec< sal_uInt16 >( "numfmt-id" );
+ dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
+ dumpDec< sal_uInt16 >( "fill-id" );
+ dumpDec< sal_uInt16 >( "border-id" );
+ dumpHex< sal_uInt32 >( "alignment", "XF-ALIGNMENT" );
+ dumpHex< sal_uInt16 >( "used-flags", "XF-USEDFLAGS" );
+ break;
+ }
+}
+
+void RecordStreamObject::dumpGradientHead()
+{
+ dumpDec< sal_Int32 >( "gradient-type", "FILL-GRADIENTTYPE" );
+ dumpDec< double >( "linear-angle" );
+ dumpDec< double >( "pos-left" );
+ dumpDec< double >( "pos-right" );
+ dumpDec< double >( "pos-top" );
+ dumpDec< double >( "pos-bottom" );
+}
+
+void RecordStreamObject::dumpCellHeader( bool bWithColumn )
+{
+ if( bWithColumn ) dumpColIndex();
+ dumpHex< sal_uInt32 >( "xf-id", "CELL-XFID" );
+}
+
+// ============================================================================
+
+RootStorageObject::RootStorageObject( const DumperBase& rParent )
+{
+ StorageObjectBase::construct( rParent );
+}
+
+void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, const OUString& rStrgPath, const OUString& rStrmName, const OUString& rSysFileName )
+{
+ OUString aExt = InputOutputHelper::getFileNameExtension( rStrmName );
+ Reference< XInputStream > xInStrm = InputOutputHelper::getXInputStream( *rxStrm );
+ if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsb" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlsx" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xltm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xltx" ) )
+ {
+ Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xla" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlc" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlm" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xls" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlt" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "xlw" ) )
+ {
+ ::oox::dump::biff::Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "pptx" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "potx" ) )
+ {
+ ::oox::dump::pptx::Dumper( getFactory(), xInStrm, rSysFileName ).dump();
+ }
+ else if(
+ aExt.equalsIgnoreAsciiCaseAscii( "xml" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "vml" ) ||
+ aExt.equalsIgnoreAsciiCaseAscii( "rels" ) )
+ {
+ XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
+ }
+ else if( aExt.equalsIgnoreAsciiCaseAscii( "bin" ) )
+ {
+ if( rStrgPath.equalsAscii( "xl" ) && rStrmName.equalsAscii( "vbaProject.bin" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
+ VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else if( rStrgPath.equalsAscii( "xl/embeddings" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, false ) );
+ OleStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else if(
+ rStrgPath.equalsAscii( "xl" ) ||
+ rStrgPath.equalsAscii( "xl/chartsheets" ) ||
+ rStrgPath.equalsAscii( "xl/dialogsheets" ) ||
+ rStrgPath.equalsAscii( "xl/externalLinks" ) ||
+ rStrgPath.equalsAscii( "xl/macrosheets" ) ||
+ rStrgPath.equalsAscii( "xl/pivotCache" ) ||
+ rStrgPath.equalsAscii( "xl/pivotTables" ) ||
+ rStrgPath.equalsAscii( "xl/queryTables" ) ||
+ rStrgPath.equalsAscii( "xl/tables" ) ||
+ rStrgPath.equalsAscii( "xl/worksheets" ) )
+ {
+ RecordStreamObject( *this, rxStrm, rSysFileName ).dump();
+ }
+ else if( rStrgPath.equalsAscii( "xl/activeX" ) )
+ {
+ StorageRef xStrg( new ::oox::ole::OleStorage( getFactory(), xInStrm, true ) );
+ ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
+ }
+ else
+ {
+ BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
+ }
+ }
+}
+
+// ============================================================================
+
+#define DUMP_XLSB_CONFIG_ENVVAR "OOO_XLSBDUMPER"
+
+Dumper::Dumper( const FilterBase& rFilter )
+{
+ ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rFilter ) );
+ DumperBase::construct( xCfg );
+}
+
+Dumper::Dumper( const Reference< XMultiServiceFactory >& rxFactory, const Reference< XInputStream >& rxInStrm, const OUString& rSysFileName )
+{
+ if( rxFactory.is() && rxInStrm.is() )
+ {
+ StorageRef xStrg( new ZipStorage( rxFactory, rxInStrm ) );
+ MediaDescriptor aMediaDesc;
+ ConfigRef xCfg( new Config( DUMP_XLSB_CONFIG_ENVVAR, rxFactory, xStrg, rSysFileName, aMediaDesc ) );
+ DumperBase::construct( xCfg );
+ }
+}
+
+void Dumper::implDump()
+{
+ RootStorageObject( *this ).dump();
+}
+
+// ============================================================================
+
+} // namespace xlsb
+} // namespace dump
+} // namespace oox
+
+#endif
diff --git a/oox/source/dump/xlsbdumper.ini b/oox/source/dump/xlsbdumper.ini
new file mode 100644
index 000000000000..3490111c4ba5
--- /dev/null
+++ b/oox/source/dump/xlsbdumper.ini
@@ -0,0 +1,1186 @@
+
+# dumper settings ============================================================
+
+# Path to additional configuration data, relative to this file.
+include-config-file=dumperbase.ini
+include-config-file=oledumper.ini
+
+# Enable entire dumper. This option does not affect the option 'enable-import'.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
+# enable-dumper=1
+
+# Enable import after dumping. Disabling this option allows to dump a file
+# without loading it. This option is independent from the 'enable-dumper'
+# option.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
+# enable-import=1
+
+# name lists =================================================================
+
+# common ---------------------------------------------------------------------
+
+unitconverter=CONV-TINT,/327.67,%
+unitconverter=CONV-COLWIDTH,/256,chars
+
+constlist=ERRORCODES
+ 0x00=#NULL!
+ 0x07=#DIV/0!
+ 0x0F=#VALUE!
+ 0x17=#REF!
+ 0x1D=#NAME?
+ 0x24=#NUM!
+ 0x2A=#N/A
+end
+
+flagslist=STRING-FLAGS
+ 0x01=rich-string
+ 0x02=phonetic-text
+end
+
+combilist=CELL-XFID
+ 0x00FFFFFF=int32,dec,xf-id
+ 0x01000000=show-phonetic
+end
+
+combilist=PHONETIC-FLAGS
+ ignore=0x0030
+ 0x0003=uint8,dec,type,PHONETICPR-TYPE
+ 0x000C=uint8,dec,alignment,PHONETICPR-ALIGNMENT
+end
+
+shortlist=COLOR-TYPE,0,auto,indexed,rgb,theme
+
+combilist=COLOR-FLAGS
+ 0x01=rgb-valid
+ 0xFE=uint8,dec,type,COLOR-TYPE
+end
+
+multilist=PALETTE-COLORS
+ default=
+ 0=ega-black,ega-white,ega-red,ega-green,ega-blue,ega-yellow,ega-magenta,ega-cyan
+ 64=sys-window-text
+ 65=sys-window-bg
+ 67=sys-button-face
+ 77=sys-window-text-chart
+ 78=sys-window-bg-chart
+ 79=auto-border-chart
+ 80=sys-tooltip-bg
+ 81=sys-tooltip-text
+end
+
+constlist=TEXTROTATION
+ default=
+ 255=stacked
+end
+
+multilist=BORDERSTYLES
+ 0=none,thin,medium,dash,dot
+ 5=thick,double,hair,medium-dash,thin-dash-dot
+ 10=medium-dash-dot,thin-dash-dot-dot,medium-dash-dot-dot,slant-dash-dot
+end
+
+multilist=FILLPATTERNS
+ 0=no-fill,solid-fill,50%-grey,75%-grey,25%-grey
+ 5=hor-stripe,ver-stripe,rev-diag-stripe,diag-stripe,diag-crosshatch
+ 10=thick-diag-crosshatch,thin-hor-stripe,thin-ver-stripe,thin-rev-diag-stripe,thin-diag-stripe
+ 15=thin-hor-crosshatch,thin-diag-crosshatch,12.5%-grey,6.25%-grey
+ 40=gradient
+end
+
+# formulas -------------------------------------------------------------------
+
+flagslist=FORMULA-FLAGS
+ 0x0002=recalc-always
+end
+
+multilist=BASETOKENS
+ 0x00=,tExp,tTbl,tAdd,tSub,tMul,tDiv,tPower
+ 0x08=tConcat,tLT,tLE,tEQ,tGE,tGT,tNE,tIsect
+ 0x10=tList,tRange,tUplus,tUminus,tPercent,tParen,tMissArg,tStr
+ 0x18=tTable,tAttr,,,tErr,tBool,tInt,tNum
+end
+
+constlist=TOKENCLASSES
+ 0x20=R
+ 0x40=V
+ 0x60=A
+end
+
+multilist=CLASSTOKENS
+ 0x00=tArray,tFunc,tFuncVar,tName,tRef,tArea,tMemArea,tMemErr
+ 0x08=tMemNoMem,tMemFunc,tRefErr,tAreaErr,tRefN,tAreaN,tMemAreaN,tMemNoMemN
+ 0x18=,tNameX,tRef3d,tArea3d,tRefErr3d,tAreaErr3d
+end
+
+combilist=FUNCID
+ 0x7FFF=uint16,dec,func-id
+ 0x8000=command
+end
+
+combilist=PARAMCOUNT-CMD
+ 0x7F=uint8,dec,count
+ 0x80=prompt
+end
+
+combilist=REFRELFLAGS
+ 0x3FFF=uint16,dec,value
+ 0x4000=col-rel
+ 0x8000=row-rel
+end
+
+flagslist=TABLEFLAGS
+ 0x0001=single-column
+ 0x0002=column-range
+ 0x0004=#all
+ 0x0008=#headers
+ 0x0010=#data
+ 0x0020=#totals
+ 0x0040=#this-row
+ 0x0080=bracket-spaces
+ 0x0100=sep-spaces
+ 0x0200=single-row
+ 0x0400=single-cell
+end
+
+flagslist=ATTRTYPES
+ 0x01=volatile
+ 0x02=if
+ 0x04=choose
+ 0x08=skip
+ 0x10=sum
+ 0x20=assign
+ 0x40=space
+ 0x80=iferror
+end
+
+shortlist=ATTRSPACETYPES,0,space-before-token,cr-before-token,space-before-open,cr-before-open,space-before-close,cr-before-close,leading-space
+
+shortlist=ARRAYVALUE-TYPE,0,number,string,boolean,,error
+
+# record names ---------------------------------------------------------------
+
+multilist=RECORD-NAMES
+ 0x0000=ROW,CELL_BLANK,CELL_RK,CELL_ERROR,CELL_BOOL,CELL_DOUBLE,CELL_STRING,CELL_SI
+ 0x0008=FORMULA_STRING,FORMULA_DOUBLE,FORMULA_BOOL,FORMULA_ERROR,MULTCELL_BLANK,MULTCELL_RK,MULTCELL_ERROR,MULTCELL_BOOL
+ 0x0010=MULTCELL_DOUBLE,MULTCELL_STRING,MULTCELL_SI,SI,PCITEM_MISSING,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR
+ 0x0018=PCITEM_STRING,PCITEM_DATE,PCITEM_INDEX,PCITEMA_MISSING,PCITEMA_DOUBLE,PCITEMA_BOOL,PCITEMA_ERROR,PCITEMA_STRING
+ 0x0020=PCITEMA_DATE,PCRECORD,PCRECORDDT,FRT,FRT_END,,,DEFINEDNAME
+ 0x0028=BINARYINDEXROWS,,BINARYINDEXBLOCK,FONT,NUMFMT,FILL,BORDER,XF
+ 0x0030=CELLSTYLE,,,,,,,
+ 0x0038=,,,,COL,MULTCELL_RSTRING,CELL_RSTRING,CALCCHAINCELL
+ 0x0040=DATAVALIDATION,,,,,,,
+
+ 0x0080=FILEVERSION,WORKSHEET,WORKSHEET_END,WORKBOOK,WORKBOOK_END,SHEETVIEWS,SHEETVIEWS_END,BOOKVIEWS
+ 0x0088=BOOKVIEWS_END,SHEETVIEW,SHEETVIEW_END,CHARTSHEETVIEWS,CHARTSHEETVIEWS_END,CHARTSHEETVIEW,CHARTSHEETVIEW_END,SHEETS
+ 0x0090=SHEETS_END,SHEETDATA,SHEETDATA_END,SHEETPR,DIMENSION,,,PANE
+ 0x0098=SELECTION,WORKBOOKPR,SMARTTAGPR,FILERECOVERYPR,SHEET,CALCPR,WORKBOOKVIEW,SST
+ 0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,DISCRETEFILTERS,DISCRETEFILTERS_END,DISCRETEFILTER
+ 0x00A8=COLORFILTER,ICONFILTER,TOP10FILTER,DYNAMICFILTER,CUSTOMFILTERS,CUSTOMFILTERS_END,CUSTOMFILTER,AFDATEGROUPITEM
+ 0x00B0=MERGECELL,MERGECELLS,MERGECELLS_END,PCDEFINITION,PCDEFINITION_END,PCDFIELDS,PCDFIELDS_END,PCDFIELD
+ 0x00B8=PCDFIELD_END,PCDSOURCE,PCDSOURCE_END,PCDSHEETSOURCE,PCDSHEETSOURCE_END,PCDFSHAREDITEMS,PCDFSHAREDITEMS_END,PCITEM_ARRAY
+ 0x00C0=PCITEM_ARRAY_END,PCRECORDS,PCRECORDS_END,,,,,
+ 0x00C8=,CONNECTION,CONNECTION_END,,,,,
+
+ 0x00D8=,,,PCDFIELDGROUP,PCDFIELDGROUP_END,PCDFGROUPITEMS,PCDFGROUPITEMS_END,PCDFRANGEPR
+ 0x00E0=PCDFRANGEPR_END,PCDFDISCRETEPR,PCDFDISCRETEPR_END,,,,,
+
+ 0x00F0=,,,,,,,PIVOTAREA
+ 0x00F8=PIVOTAREA_END,PTREFERENCES,PTREFERENCES_END,PTREFERENCE,PTREFERENCE_END,,,
+ 0x0100=,,,,,WEBPR,WEBPR_END,WEBPRTABLES
+ 0x0108=WEBPRTABLES_END,,,,,,,
+ 0x0110=,,,,,BINARYINDEX_END,STYLESHEET,STYLESHEET_END
+ 0x0118=PTDEFINITION,PTFITEM_END,PTFITEM,PTFITEMS,PTFITEMS_END,PTFIELD,PTFIELD_END,PTFIELDS
+ 0x0120=PTFIELDS_END,PTPAGEFIELD,PTPAGEFIELD_END,PTPAGEFIELDS,PTPAGEFIELDS_END,PTDATAFIELD,PTDATAFIELD_END,PTDATAFIELDS
+ 0x0128=PTDATAFIELDS_END,,,,,,,
+ 0x0130=,,,,,PTROWFIELDS,PTROWFIELDS_END,PTCOLFIELDS
+ 0x0138=PTCOLFIELDS_END,PTLOCATION_END,PTLOCATION,PTDEFINITION_END,,,,
+
+ 0x0150=,,,,,,,TABLE
+ 0x0158=TABLE_END,TABLECOLUMNS,TABLECOLUMNS_END,TABLECOLUMN,TABLECOLUMN_END,,,CALCEDCOLUMNFMLA
+ 0x0160=,EXTERNALREFS,EXTERNALREFS_END,EXTERNALREF,,EXTERNALSELF,EXTERNALSAME,EXTSHEETNAMES
+ 0x0168=EXTERNALBOOK,,EXTERNALSHEETS,EXTSHEETDATA,EXTSHEETDATA_END,,EXTROW,EXTCELL_BLANK
+ 0x0170=EXTCELL_DOUBLE,EXTCELL_BOOL,EXTCELL_ERROR,EXTCELL_STRING,,,,
+ 0x0178=,,,,,,PTREFERENCEITEM,PTREFERENCEITEM_END
+ 0x0180=PIVOTCACHES,PIVOTCACHES_END,PIVOTCACHE,PIVOTCACHE_END,,,COLS,COLS_END
+ 0x0188=ROWBREAKS,ROWBREAKS_END,COLBREAKS,COLBREAKS_END,BRK,CUSTOMWORKBOOKVIEW,,
+
+ 0x01A0=,,,,,,CUSTOMSHEETVIEWS,CUSTOMSHEETVIEW
+ 0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,CONNECTIONS,CONNECTIONS_END,
+
+ 0x01B8=,,,,,,,QUERYTABLE
+ 0x01C0=QUERYTABLE_END,QUERYTABLEREFRESH,QUERYTABLEREFRESH_END,,,,,
+ 0x01C8=,,,AUTOSORTSCOPE,AUTOSORTSCOPE_END,CONDFORMATTING,CONDFORMATTING_END,CFRULE
+ 0x01D0=CFRULE_END,ICONSET,ICONSET_END,DATABAR,DATABAR_END,COLORSCALE,COLORSCALE_END,CFVO
+ 0x01D8=,COLORS,COLORS_END,RGBCOLOR,PAGEMARGINS,PRINTOPTIONS,PAGESETUP,HEADERFOOTER
+ 0x01E0=HEADERFOOTER_END,PTCHARTFORMAT,PTCHARTFORMAT_END,PTCHARTFORMATS,PTCHARTFORMATS_END,SHEETFORMATPR,,
+ 0x01E8=,,,,,,HYPERLINK,
+ 0x01F0=,,,,SCENARIOS,SCENARIOS_END,SCENARIO,SCENARIO_END
+ 0x01F8=INPUTCELLS,DXFS,DXFS_END,DXF,TABLESTYLES,TABLESTYLES_END,,
+ 0x0200=,TABLESTYLEINFO,VOLTYPES,VOLTYPES_END,VOLTYPE,VOLTYPE_END,VOLTYPEMAIN,VOLTYPEMAIN_END
+ 0x0208=VOLTYPETP,VOLTYPETP_END,VOLTYPESTP,VOLTYPETR,,VOLTYPE_ERROR,,
+ 0x0210=CALCCHAIN,CALCCHAIN_END,,,,,,SHEETPROTECTION
+ 0x0218=,PHONETICPR,,,,,,
+ 0x0220=,,,,,OLESIZE,DRAWING,LEGACYDRAWING
+
+ 0x0230=,,PICTURE,,CFCOLOR,INDEXEDCOLORS,INDEXEDCOLORS_END,
+ 0x0238=,MRUCOLORS,MRUCOLORS_END,,COLOR,DATAVALIDATIONS,DATAVALIDATIONS_END,
+ 0x0240=,EXTERNALNAME,DDEITEMVALUES,DDEITEMVALUES_END,DDEITEM_DOUBLE,DDEITEM_ERROR,DDEITEM_STRING,DDEITEM_EMPTY
+ 0x0248=DDEITEM_BOOL,EXTERNALNAMEREF,EXTERNALNAMEFLAGS,EXTERNALNAME_END,EXTERNALBOOK_END,,,
+ 0x0250=,,,,,,,PTFILTERS
+ 0x0258=PTFILTERS_END,PTFILTER,PTFILTER_END,FILLS,FILLS_END,,,
+ 0x0260=,,,FONTS,FONTS_END,BORDERS,BORDERS_END,NUMFMTS
+ 0x0268=NUMFMTS_END,CELLXFS,CELLXFS_END,CELLSTYLES,CELLSTYLES_END,,,
+ 0x0270=,,CELLSTYLEXFS,CELLSTYLEXFS_END,COMMENTS,COMMENTS_END,COMMENTAUTHORS,COMMENTAUTHORS_END
+ 0x0278=COMMENTAUTHOR,COMMENTLIST,COMMENTLIST_END,COMMENT,COMMENT_END,COMMENTTEXT,OLEOBJECTS,OLEOBJECT
+ 0x0280=OLEOBJECTS_END,,,CONTROLS,CONTROL,CONTROLS_END,,
+ 0x0288=,,,CHARTSHEETPR,CHARTPAGESETUP,CUSTOMCHARTVIEWS,CUSTOMCHARTVIEWS_END,CUSTOMCHARTVIEW
+ 0x0290=CUSTOMCHARTVIEW_END,,,,TABLEPARTS,TABLEPART,TABLEPARTS_END,SHEETCALCPR
+ 0x0298=FUNCTIONGROUPS,FUNCTIONGROUP,FUNCTIONGROUPS_END,EXTERNALADDIN,,CHARTPROTECTION,,
+end
+
+# simple records -------------------------------------------------------------
+
+constlist=SIMPLE-RECORDS
+ 0x001A=int32,dec,item-index
+ 0x00AC=int32,dec,relation,CUSTOMFILTERS-RELATION
+ 0x00B5=int32,dec,count
+ 0x00C1=int32,dec,count
+ 0x00DD=int32,dec,count
+ 0x00E1=int32,dec,count
+ 0x00F9=int32,dec,count
+ 0x0107=int32,dec,count
+ 0x011B=int32,dec,count
+ 0x011F=int32,dec,count
+ 0x0123=int32,dec,count
+ 0x0159=int32,dec,count
+ 0x017E=int32,dec,item-index
+ 0x01DD=uint16,hex,flags,PRINTOPTIONS-FLAGS
+ 0x01E3=int32,dec,count
+ 0x01F9=int32,dec,count
+ 0x0204=int32,dec,type,VOLTYPE-TYPE
+ 0x020D=uint8,dec,error-code,ERRORCODES
+ 0x0244=double,dec,value
+ 0x0245=uint8,dec,error-code,ERRORCODES
+ 0x0248=uint8,dec,value,BOOLEAN
+ 0x0257=int32,dec,count
+ 0x025B=int32,dec,count
+ 0x0263=int32,dec,count
+ 0x0265=int32,dec,count
+ 0x0267=int32,dec,count
+ 0x0269=int32,dec,count
+ 0x026B=int32,dec,count
+ 0x0272=int32,dec,count
+ 0x0294=int32,dec,count
+ 0x0297=uint8,hex,flags,SHEETCALCPR-FLAGS
+ 0x0298=uint8,dec,builtin-count
+end
+
+# ARRAY ----------------------------------------------------------------------
+
+flagslist=ARRAY-FLAGS
+ 0x01=recalc-always
+end
+
+# BORDER ---------------------------------------------------------------------
+
+flagslist=BORDER-FLAGS
+ 0x01=diag-tl-to-br
+ 0x02=diag-bl-to-tr
+end
+
+# CALCPR ---------------------------------------------------------------------
+
+shortlist=CALCPR-CALCMODE,0,manual,auto,auto-no-tables
+
+flagslist=CALCPR-FLAGS
+ 0x0001=calc-on-load
+ 0x0002=a1
+ 0x0004=iterate
+ 0x0008=full-precision
+ 0x0010=calc-complete
+ 0x0020=calc-on-save
+ 0x0040=concurrent
+ 0x0080=manual-processors
+ 0x0100=force-full-calc
+end
+
+# CELLSTYLE ------------------------------------------------------------------
+
+flagslist=CELLSTYLE-FLAGS
+ 0x0001=builtin
+ 0x0002=hidden
+ 0x0004=custom
+end
+
+multilist=CELLSTYLE-BUILTIN
+ 0=normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
+ 10=note,warning-text,,,,title,heading-1,heading-2,heading-3,heading-4
+ 20=input,output,calculation,check-cell,linked-cell,total,good,bad,neutral,accent1
+ 30=20%-accent1,40%-accent1,60%-accent1,accent2,20%-accent2,40%-accent2,60%-accent2,accent3,20%-accent3,40%-accent3
+ 40=60%-accent3,accent4,20%-accent4,40%-accent4,60%-accent4,accent5,20%-accent5,40%-accent5,60%-accent5,accent6
+ 50=20%-accent6,40%-accent6,60%-accent6,explanatory-text
+end
+
+# CFRULE ---------------------------------------------------------------------
+
+shortlist=CFRULE-TYPE,1,cell-is,expression,color-scale,data-bar,top-ten,icon-set
+
+multilist=CFRULE-SUBTYPE
+ 0=cell-is,expression,color-scale,data-bar,icon-set,top-ten,,unique-values,contains-text,contains-blanks
+ 10=not-contains-blanks,contains-errors,not-contains-errors,,,today,tomorrow,yesterday,last-7-days,last-month
+ 20=next-month,this-week,next-week,last-week,this-month,above-average,below-average,duplicate-values,,equal-above-average
+ 30=equal-below-average
+end
+
+shortlist=CFRULE-CELL-OPERATOR,1,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=CFRULE-TEXT-OPERATOR,0,contains,not-contains,begins-with,ends-with
+shortlist=CFRULE-DATE-OPERATOR,0,today,yesterday,last-7-days,this-week,last-week,last-month,tomorrow,next-week,next-month,this-month
+shortlist=CFRULE-OTHER-OPERATOR,0,none
+
+flagslist=CFRULE-FLAGS
+ 0x0001=table-row
+ 0x0002=stop-if-true
+ 0x0004=above-average
+ 0x0008=bottom
+ 0x0010=percent
+end
+
+# CHARTPAGESETUP ------------------------------------------------------------------
+
+combilist=CHARTPAGESETUP-FLAGS
+ 0x0001=landscape
+ 0x0002=uninitialized
+ 0x0004=black-and-white
+ 0x0008=default-orientation
+ 0x0010=use-first-page
+ 0x0020=draft-quality
+end
+
+# CHARTSHEETPR ---------------------------------------------------------------
+
+flagslist=CHARTSHEETPR-FLAGS
+ 0x0001=published
+end
+
+# CHARTSHEETVIEW -------------------------------------------------------------
+
+flagslist=CHARTSHEETVIEW-FLAGS
+ 0x0001=selected
+ 0x0002=zoom-to-fit
+end
+
+# COL ------------------------------------------------------------------------
+
+combilist=COL-FLAGS
+ 0x0001=hidden
+ 0x0002=custom-width
+ 0x0004=best-fit
+ 0x0008=show-phonetic
+ 0x0700=uint8,dec,outline-level
+ 0x1000=outline-collapsed
+end
+
+# CONNECTION -----------------------------------------------------------------
+
+shortlist=CONNECTION-SAVEPASSWORD,1,on,off
+unitconverter=CONNECTION-INTERVAL,60,sec
+shortlist=CONNECTION-SOURCETYPE,1,odbc,dao,file,html,ole-db,text,ado,dsp
+shortlist=CONNECTION-RECONNECTTYPE,1,as-required,always,never
+shortlist=CONNECTION-CREDENTIALS,0,integrated,none,stored-sso,prompt
+
+flagslist=CONNECTION-FLAGS
+ 0x0001=keep-alive
+ 0x0002=new
+ 0x0004=deleted
+ 0x0008=only-use-conn-file
+ 0x0010=background
+ 0x0020=refresh-on-load
+ 0x0040=save-data
+end
+
+flagslist=CONNECTION-STRINGFLAGS
+ 0x0001=has-source-file
+ 0x0002=has-source-conn-file
+ 0x0004=has-description
+ 0x0008=has-name
+ 0x0010=has-sso-id
+end
+
+# CUSTOMFILTER ---------------------------------------------------------------
+
+constlist=CUSTOMFILTER-DATATYPE
+ 4=double
+ 6=string
+ 8=boolean
+ 12=blank
+ 14=not-blank
+end
+
+shortlist=CUSTOMFILTER-OPERATOR,1,less,equal,less-equal,greater,not-equal,greater-equal
+
+# CUSTOMFILTERS --------------------------------------------------------------
+
+shortlist=CUSTOMFILTERS-RELATION,0,and,or
+
+# DATATABLE ------------------------------------------------------------------
+
+flagslist=DATATABLE-FLAGS
+ 0x01=row-table
+ 0x02=table-2d
+ 0x04=ref1-deleted
+ 0x08=ref2-deleted
+ 0x10=recalc-always
+end
+
+# DATAVALIDATION -------------------------------------------------------------
+
+combilist=DATAVALIDATION-FLAGS
+ 0x0000000F=uint8,dec,type,DATAVALIDATION-TYPE
+ 0x00000070=uint8,dec,error-style,DATAVALIDATION-ERRORSTYLE
+ 0x00000080=string-list
+ 0x00000100=ignore-empty
+ 0x00000200=no-dropdown
+ 0x00040000=show-input-box
+ 0x00080000=show-error-box
+ 0x00F00000=uint8,dec,operator,DATAVALIDATION-OPERATOR
+end
+
+shortlist=DATAVALIDATION-TYPE,0,any,whole,decimal,list,date,time,text-length,custom
+shortlist=DATAVALIDATION-OPERATOR,0,between,not-between,equal,not-equal,greater-than,less-than,greater-equal,less-equal
+shortlist=DATAVALIDATION-ERRORSTYLE,0,error,warning,info
+
+# DATAVALIDATIONS ------------------------------------------------------------
+
+combilist=DATAVALIDATIONS-FLAGS
+ 0x0001=disable-prompts
+end
+
+# DEFINEDNAME ----------------------------------------------------------------
+
+combilist=DEFINEDNAME-FLAGS
+ 0x00000001=hidden
+ 0x00000002=function
+ 0x00000004=vba
+ 0x00000008=macro
+ 0x00000010=complex
+ 0x00000020=built-in
+ 0x00007FC0=int32,dec,func-group,DEFINEDNAME-FUNCGROUP
+ 0x00008000=published
+ 0x00010000=workbook-param
+end
+
+shortlist=DEFINEDNAME-FUNCGROUP,0,none,financial,date-time,math-trig,statistical,lookup-ref,database,text,logical,information,commands,customizing,macro-control,dde-external,user-definded
+
+constlist=DEFINEDNAME-SHEETID
+ default=
+ -1=global
+end
+
+# DISCRETEFILTERS --------------------------------------------------------------------
+
+shortlist=DISCRETEFILTERS-CALTYPE,0,none,gregorian,gregorian-us,japan,taiwan,korea,hijri,thai,hebrew,gregorian-mideast-fr,gregorian-ar,gregorian-xlit-en,gregorian-xlit-fr
+
+# DXF ------------------------------------------------------------------------
+
+flagslist=DXF-FLAGS
+ 0x00008000=border-outline
+end
+
+multilist=DXF-SUBREC
+ 0=FILL-PATTERN,FILL-FGCOLOR,FILL-BGCOLOR,FILL-GRADIENT,FILL-STOP
+ 5=FONT-COLOR,BORDER-TOP,BORDER-BOTTOM,BORDER-LEFT,BORDER-RIGHT
+ 10=BORDER-DIAGONAL,BORDER-VERTICAL,BORDER-HORIZONTAL,BORDER-DIAGUP,BORDER-DIAGDOWN
+ 15=ALIGN-HORIZONTAL,ALIGN-VERTICAL,ALIGN-ROTATION,ALIGN-INDENT,ALIGN-READINGORDER
+ 20=ALIGN-WRAPTEXT,ALIGN-JUSTLASTLINE,ALIGN-SHRINKTOFIT,,FONT-NAME
+ 25=FONT-WEIGHT,FONT-UNDERLINE,FONT-ESCAPEMENT,FONT-ITALIC,FONT-STRIKE
+ 30=FONT-OUTLINE,FONT-SHADOW,FONT-CONDENSE,FONT-EXTEND,FONT-CHARSET
+ 35=FONT-PITCHFAMILY,FONT-HEIGHT,FONT-SCHEME,NUMFMT-CODE,
+ 40=,NUMFMT-ID,ALIGN-RELINDENT,PROT-LOCKED,PROT-HIDDEN
+end
+
+# EXTERNALBOOK ---------------------------------------------------------------
+
+shortlist=EXTERNALBOOK-TYPE,0,book,dde-link,ole-link
+
+# EXTERNALNAMEFLAGS ----------------------------------------------------------
+
+flagslist=EXTERNALNAMEFLAGS-FLAGS
+ 0x0002=automatic
+ 0x0004=pic-link
+ 0x0008=dde-stddocumentname
+ 0x0010=ole-link
+ 0x0020=iconified
+end
+
+# EXTERNALSHEETS -------------------------------------------------------------
+
+constlist=EXTERNALSHEETS-ID
+ default=
+ -1=deleted
+ -2=special
+end
+
+# EXTSHEETDATA ---------------------------------------------------------------
+
+flagslist=EXTSHEETDATA-FLAGS
+ 0x01=refresh-error
+end
+
+# FILL -----------------------------------------------------------------------
+
+shortlist=FILL-GRADIENTTYPE,0,linear,path
+
+# FILTERCOLUMN ---------------------------------------------------------------
+
+flagslist=FILTERCOLUMN-FLAGS
+ 0x0001=hidden-button
+ 0x0002=show-button
+end
+
+# FONT -----------------------------------------------------------------------
+
+flagslist=FONT-FLAGS
+ 0x0001=bold
+ 0x0002=italic
+ 0x0004=underline
+ 0x0008=strikeout
+ 0x0010=outline
+ 0x0020=shadow
+ 0x0040=condense
+ 0x0080=extend
+end
+
+multilist=FONT-UNDERLINE
+ 0x00=none,single,double
+ 0x21=single-acc,double-acc
+end
+
+shortlist=FONT-SCHEME,0,none,major,minor
+shortlist=FONT-ESCAPEMENT,0,none,superscript,subscript
+
+# HEADERFOOTER ---------------------------------------------------------------
+
+flagslist=HEADERFOOTER-FLAGS
+ 0x0001=diff-odd-even
+ 0x0002=diff-dirst
+ 0x0004=scale-with-doc
+ 0x0008=align-with-margins
+end
+
+# OLEOBJECT ------------------------------------------------------------------
+
+shortlist=OLEOBJECT-ASPECT,1,content,,,icon
+shortlist=OLEOBJECT-UPDATE,0,na,automatic,,manual
+
+flagslist=OLEOBJECT-FLAGS
+ 0x0001=linked
+ 0x0002=auto-load
+end
+
+# PAGESETUP ------------------------------------------------------------------
+
+multilist=PAGESETUP-PAPERSIZE
+ 0=undefined,letter,letter-small,tabloid,ledger,legal,statement,executive,a3,a4
+ 10=a4-small,a5,b4,b5,folio,quarto,10x14,11x17,note,envelope-9
+ 20=envelope-10,envelope-11,envelope-12,envelope-14,c,d,e,envelope-dl,envelope-c5,envelope-c3
+ 30=envelope-c4,envelope-c6,envelope-c65,envelope-b4,envelope-b5,envelope-b6,envelope-italy,envelope-monarch,envelope-6-3/4,us-standard-fanfold
+ 40=german-standard-fanfold,german-legal-fanfold,b4,japanese-dbl-postcaed,9x11,10x11,15x11,,
+ 50=envelope-invite,letter-extra,legal-extra,tabloid-extra,a4-extra,letter-transverse,a4-transverse,letter-extra-transverse,super-a-a4,super-b-a3,letter-plus
+ 60=a4-plus,a5-transverse,jis-b5-transverse,a3-extra,a5-extra,b5-extra,a2,a3-transverse,a3-extra-transverse
+end
+
+constlist=PAGESETUP-SCALETOPAGES
+ default=
+ 0=automatic
+end
+
+combilist=PAGESETUP-FLAGS
+ 0x0001=print-in-rows
+ 0x0002=landscape
+ 0x0004=uninitialized
+ 0x0008=black-and-white
+ 0x0010=draft-quality
+ 0x0020=print-notes
+ 0x0040=default-orientation
+ 0x0080=use-first-page
+ 0x0100=print-notes-at-end
+ 0x0600=uint8,dec,print-errors,PAGESETUP-PRINTERRORS
+end
+
+shortlist=PAGESETUP-PRINTERRORS,0,displayed,none,as-dashes,as-na
+
+unitconverter=PAGESETUP-DPI,1,dpi
+
+# PANE -----------------------------------------------------------------------
+
+shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
+
+flagslist=PANE-FLAGS
+ 0x01=frozen
+ 0x02=remove-split-with-freeze
+end
+
+# PCDEFINITION ---------------------------------------------------------------
+
+flagslist=PCDEFINITION-FLAGS1
+ 0x01=save-data
+ 0x02=invalid
+ 0x04=refresh-on-load
+ 0x08=optimize-memory
+ 0x10=enable-refresh
+ 0x20=background-query
+ 0x40=upgrade-on-refresh
+ 0x80=tupel-cache
+end
+
+constlist=PCDEFINITION-MISSINGITEMS
+ default=
+ -1=clear-automatic
+ 0=clear-always
+end
+
+flagslist=PCDEFINITION-FLAGS2
+ 0x01=has-username
+ 0x02=has-rel-id
+ 0x04=support-subquery
+ 0x08=support-drilldown
+end
+
+# PCDFIELD -------------------------------------------------------------------
+
+flagslist=PCDFIELD-FLAGS
+ 0x0001=server-field
+ 0x0002=no-unique-items
+ 0x0004=database-field
+ 0x0008=has-caption
+ 0x0010=member-property-field
+ 0x0100=has-formula
+ 0x0200=has-property-name
+end
+
+# PCDFRANGEPR ----------------------------------------------------------------
+
+shortlist=PCDFRANGEPR-GROUPBY,0,numeric,seconds,minutes,hours,days,months,quarters,years
+
+flagslist=PCDFRANGEPR-FLAGS
+ 0x01=auto-start
+ 0x02=auto-end
+ 0x04=date-group
+end
+
+# PCDFSHAREDITEMS ------------------------------------------------------------
+
+flagslist=PCDFSHAREDITEMS-FLAGS
+ 0x0001=has-semi-mixed-types
+ 0x0002=has-non-date
+ 0x0004=has-date
+ 0x0008=has-string-bool-err
+ 0x0010=has-blank
+ 0x0020=has-mixed-types
+ 0x0040=is-numeric
+ 0x0080=is-integer
+ 0x0100=has-min-max
+ 0x0200=long-text
+end
+
+# PCDSOURCE ------------------------------------------------------------------
+
+shortlist=PCDSOURCE-TYPE,0,worksheet,external,consolidation,scenario
+
+# PCDWORKSHEETSOURCE ---------------------------------------------------------
+
+flagslist=PCDWORKSHEETSOURCE-FLAGS
+ 0x01=has-rel-id
+ 0x02=has-sheet
+end
+
+# PCITEM_ARRAY ---------------------------------------------------------------
+
+constlist=PCITEM_ARRAY-TYPE
+ 0x0001=double
+ 0x0002=string
+ 0x0010=error
+ 0x0020=date
+end
+
+# PHONETICPR -----------------------------------------------------------------
+
+shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
+shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
+
+# PIVOTAREA ------------------------------------------------------------------
+
+shortlist=PIVOTAREA-TYPE,0,none,normal,data,all,origin,button,top-right
+
+flagslist=PIVOTAREA-FLAGS1
+ 0x01=data-only
+ 0x02=label-only
+ 0x04=grand-row
+ 0x08=grand-col
+ 0x10=cache-based
+ 0x20=line-mode
+ 0x40=part
+ 0x80=fuzzy
+end
+
+combilist=PIVOTAREA-FLAGS2
+ 0x0001=row
+ 0x0002=col
+ 0x0004=page
+ 0x0008=data
+ 0x0FF0=uint8,dec,pos-on-axis
+end
+
+# PRINTOPTIONS ---------------------------------------------------------------
+
+flagslist=PRINTOPTIONS-FLAGS
+ 0x0001=horizontal-centered
+ 0x0002=vertical-centered
+ 0x0004=print-headings
+ 0x0008=print-gridlines
+ 0x0010=gridlines-set
+end
+
+# Pivot table globals --------------------------------------------------------
+
+constlist=PT-FIELDINDEX
+ default=
+ -2=data-field
+end
+
+# PTDATAFIELD ----------------------------------------------------------------
+
+shortlist=PTDATAFIELD-SUBTOTAL,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,var,var-p
+shortlist=PTDATAFIELD-SHOWDATAAS,0,normal,difference,percent,percent-diff,run-total,percent-of-row,percent-of-col,percent-of-total,index
+
+constlist=PTDATAFIELD-BASEITEM
+ default=
+ 0x001000FC=previous-item
+ 0x001000FD=next-item
+end
+
+# PTDEFINITION ---------------------------------------------------------------
+
+flagslist=PTDEFINITION-FLAGS1
+ 0x01=show-items
+ 0x02=edit-data
+ 0x04=disable-field-list
+ 0x08=refresh-on-load
+ 0x10=hide-calc-members
+ 0x20=with-hidden-totals
+ 0x40=show-multiple-label
+end
+
+combilist=PTDEFINITION-FLAGS2
+ 0x0001=hide-data-drop-down
+ 0x0010=hide-drill
+ 0x0020=print-drill
+ 0x0040=show-member-prop-tips
+ 0x0080=hide-data-tips
+ 0x7F00=uint8,dec,indent
+ 0x8000=hide-headers
+end
+
+flagslist=PTDEFINITION-FLAGS3
+ ignore=0x00010000
+ 0x00000001=hide-drop-zones
+ 0x00000002=no-asterisk-totals
+ 0x00000004=show-empty-row
+ 0x00000008=show-empty-col
+ 0x00000010=enable-wizard
+ 0x00000020=enable-drill
+ 0x00000040=enable-field-props
+ 0x00000080=preserve-formatting
+ 0x00000100=use-auto-formatting
+ 0x00000200=show-error
+ 0x00000400=show-missing
+ 0x00000800=page-over-then-down
+ 0x00001000=multiple-page-items
+ 0x00002000=row-grand-totals
+ 0x00004000=col-grand-totals
+ 0x00008000=field-print-titles
+ 0x00020000=item-print-titles
+ 0x00040000=merge-item
+ 0x00080000=has-data-caption
+ 0x00100000=has-grand-total-caption
+ 0x00200000=has-page-field-style
+ 0x00400000=has-pivot-table-style
+ 0x00800000=has-vacated-style
+ 0x01000000=apply-num-fmt
+ 0x02000000=apply-font
+ 0x04000000=apply-alignment
+ 0x08000000=apply-border
+ 0x10000000=apply-fill
+ 0x20000000=apply-protection
+ 0x40000000=has-tag
+end
+
+flagslist=PTDEFINITION-FLAGS4
+ 0x00000001=compact
+ 0x00000002=outline
+ 0x00000004=outline-data
+ 0x00000008=compact-data
+ 0x00000010=no-grid-drop-zones
+ 0x00000020=published
+ 0x00000040=!has-error-caption
+ 0x00000080=!has-missing-caption
+ 0x00000100=immersive-off
+ 0x00000200=single-field-filters
+ 0x00000400=has-row-header-caption
+ 0x00000800=has-col-header-caption
+ 0x00001000=field-list-sort-asc
+ 0x00004000=no-custom-list-sort
+end
+
+shortlist=PTDEFINITION-DATAFIELD-AXIS,1,row-axis,col-axis
+
+constlist=PTDEFINITION-DATAFIELD-POS
+ default=
+ -1=append
+end
+
+# PTFIELD --------------------------------------------------------------------
+
+flagslist=PTFIELD-FLAGS1
+ 0x00000001=row
+ 0x00000002=col
+ 0x00000004=page
+ 0x00000008=data
+ 0x00000100=default
+ 0x00000200=sum
+ 0x00000400=count-all
+ 0x00000800=average
+ 0x00001000=max
+ 0x00002000=min
+ 0x00004000=product
+ 0x00008000=count-num
+ 0x00010000=std-dev
+ 0x00020000=std-dev-p
+ 0x00040000=variance
+ 0x00080000=variance-p
+ 0x01000000=drilled-level
+ 0x02000000=hide-dropdown
+ 0x04000000=hidden-level
+ 0x08000000=has-member-prop-caption
+ 0x10000000=compact
+ 0x20000000=has-display-name
+ 0x40000000=has-subtotal-caption
+ 0x80000000=source-ordered
+end
+
+flagslist=PTFIELD-FLAGS2
+ 0x00000001=drag-to-row
+ 0x00000002=drag-to-col
+ 0x00000004=drag-to-page
+ 0x00000008=drag-to-hide
+ 0x00000010=drag-to-data
+ 0x00000020=show-all-items
+ 0x00000040=outline
+ 0x00000080=insert-blank-row
+ 0x00000100=subtotal-top
+ 0x00000200=server-based
+ 0x00000800=insert-page-break
+ 0x00001000=autosort
+ 0x00002000=ascend-sort
+ 0x00004000=autoshow
+ 0x00008000=autoshow-top
+ 0x00010000=hide-new-items
+ 0x00020000=has-value-filter
+ 0x00040000=exclude-new-items
+ 0x00080000=multiple-page-items
+ 0x00100000=simple-data-sort
+ 0x00200000=show-member-prop-report
+ 0x00400000=show-member-prop-tooltip
+ 0x00800000=show-member-prop-caption
+ 0x01000000=items-drilled
+end
+
+# PTFILTER -------------------------------------------------------------------
+
+multilist=PTFILTER-TYPE
+ 0=unknown,count,percent,sum,caption-equal,caption-not-equal,caption-begins-width,caption-not-begins-with,caption-ends-width,caption-not-ends-with
+ 10=caption-contains,caption-not-contains,caption-greater-than,caption-greater-equal,caption-less-than,caption-less-equal,caption-between,caption-not-between,value-equal,value-not-equal
+ 20=value-greater-than,value-greater-equal,value-less-than,value-less-equal,value-between,value-not-between,date-equal,date-older-than,date-newer-than,date-between
+ 30=date-tomorrow,date-today,date-yesterday,date-next-week,date-this-week,date-last-week,date-next-month,date-this-month,date-last-month,date-next-quarter
+ 40=date-this-quarter,date-last-quarter,date-next-year,date-this-year,date-last-year,year-to-date,date-q1,date-q2,date-q3,date-q4
+ 50=date-jan,date-feb,date-mar,date-apr,date-may,date-jun,date-jul,date-aug,date-sep,date-oct
+ 60=date-nov,date-dec,date-not-equal,date-older-equal,date-newer-equal,date-not-between
+end
+
+flagslist=PTFILTER-FLAGS
+ 0x0001=has-name
+ 0x0002=has-description
+ 0x0004=has-str-value1
+ 0x0008=has-str-value2
+end
+
+# PTFITEM --------------------------------------------------------------------
+
+shortlist=PTFITEM-TYPE,0,data,default,sum,count-all,average,max,min,product,count-mumbers,std-dev,std-dev-p,var,var-p,grand-total,blank
+
+flagslist=PTFITEM-FLAGS
+ 0x0001=hidden
+ 0x0002=hide-detail
+ 0x0004=calculated
+ 0x0008=missing
+ 0x0010=has-name
+ 0x0020=drilled-member
+ 0x0040=can-have-children
+ 0x0080=collapsed-member
+ 0x0100=olap-filter-selected
+end
+
+# PTPAGEFIELD ----------------------------------------------------------------
+
+constlist=PTPAGEFIELD-ITEM
+ default=
+ 0x001000FE=mutiple-items
+end
+
+flagslist=PTPAGEFIELD-FLAGS
+ 0x01=has-unique-name
+ 0x02=has-member-caption
+end
+
+# PTREFERENCE ----------------------------------------------------------------
+
+flagslist=PTREFERENCE-FLAGS1
+ 0x0001=data
+ 0x0002=default
+ 0x0004=sum
+ 0x0008=count-all
+ 0x0010=average
+ 0x0020=max
+ 0x0040=min
+ 0x0080=product
+ 0x0100=count-num
+ 0x0200=std-dev
+ 0x0400=std-dev-p
+ 0x0800=variance
+ 0x1000=variance-p
+end
+
+flagslist=PTREFERENCE-FLAGS2
+ 0x01=selected
+end
+
+# QUERYTABLE -----------------------------------------------------------------
+
+combilist=QUERYTABLE-FLAGS
+ 0x00000001=headers
+ 0x00000002=row-numbers
+ 0x00000004=disable-refresh
+ 0x00000008=background
+ 0x00000010=first-background
+ 0x00000020=refresh-on-load
+ 0x000000C0=uint8,dec,grow-shrink,QUERYTABLE-GROWSHRINK
+ 0x00000100=fill-formulas
+ 0x00000200=save-data
+ 0x00000400=disable-edit
+ 0x00000800=preserve-formatting
+ 0x00001000=adjust-column-width
+ 0x00002000=intermediate
+ 0x00004000=apply-num-fmt
+ 0x00008000=apply-font
+ 0x00010000=apply-alignment
+ 0x00020000=apply-border
+ 0x00040000=apply-fill
+ 0x00080000=apply-protection
+end
+
+shortlist=QUERYTABLE-GROWSHRINK,0,insert-clear,insert-delete,overwrite-clear
+
+# ROW ------------------------------------------------------------------------
+
+combilist=ROW-FLAGS1
+ 0x0001=thick-top
+ 0x0002=thick-bottom
+ 0x0700=uint8,dec,outline-level
+ 0x0800=outline-collapsed
+ 0x1000=hidden
+ 0x2000=custom-height
+ 0x4000=custom-format
+end
+
+flagslist=ROW-FLAGS2
+ 0x01=show-phonetic
+end
+
+# SHEET ----------------------------------------------------------------------
+
+shortlist=SHEET-STATE,0,visible,hidden,very-hidden
+
+# SHEETCALCPR ----------------------------------------------------------------
+
+flagslist=SHEETCALCPR-FLAGS
+ 0x01=calc-on-load
+end
+
+# SHEETFORMATPR --------------------------------------------------------------
+
+flagslist=SHEETFORMATPR-FLAGS
+ 0x0001=custom-row-height
+ 0x0002=rows-hidden
+end
+
+# SHEETPR --------------------------------------------------------------------
+
+flagslist=SHEETPR-FLAGS1
+ 0x0001=show-autopagebreaks
+ 0x0008=published
+ 0x0010=dialog-sheet
+ 0x0020=outline-auto-style
+ 0x0040=row-symbols-below
+ 0x0080=column-symbols-right
+ 0x0100=fit-to-pages
+ 0x0400=show-outline-symbols
+ 0x1000=is-row-synched
+ 0x2000=is-col-synched
+ 0x4000=lotus-formula-eval
+ 0x8000=lotus-formula-entry
+end
+
+flagslist=SHEETPR-FLAGS2
+ 0x01=is-filtered
+ 0x02=eval-cond-formats
+end
+
+# SHEETVIEW ------------------------------------------------------------------
+
+flagslist=SHEETVIEW-FLAGS
+ 0x0001=window-protected
+ 0x0002=show-formulas
+ 0x0004=show-gridlines
+ 0x0008=show-headings
+ 0x0010=show-zeros
+ 0x0020=right-to-left
+ 0x0040=selected
+ 0x0080=show-ruler
+ 0x0100=show-outline-symbols
+ 0x0200=default-gridcolor
+ 0x0400=show-whitespace
+end
+
+shortlist=SHEETVIEW-TYPE,0,normal,pagebreak-preview,page-layout
+
+# TABLE ----------------------------------------------------------------------
+
+shortlist=TABLE-TYPE,0,worksheet,,,query-table
+
+flagslist=TABLE-FLAGS
+ 0x00000001=totals-row-shown
+ 0x00000002=published
+ 0x00000004=insert-row
+ 0x00000008=insert-row-shift
+end
+
+# TABLESTYLEINFO -------------------------------------------------------------
+
+flagslist=TABLESTYLEINFO-FLAGS
+ 0x0001=show-first-column
+ 0x0002=show-last-column
+ 0x0004=show-row-stripes
+ 0x0008=show-column-stripes
+ 0x0010=show-row-headers
+ 0x0020=show-column-headers
+end
+
+# TOP10FILTER ----------------------------------------------------------------
+
+flagslist=TOP10FILTER-FLAGS
+ 0x01=!bottom!top
+ 0x02=percent
+ 0x04=applied
+end
+
+# VOLTYPE --------------------------------------------------------------------
+
+shortlist=VOLTYPE-TYPE,0,realtime-data,olap-functions
+
+# WEBPR ----------------------------------------------------------------------
+
+combilist=WEBPR-FLAGS
+ 0x000000FF=uint8,dec,html-format,WEBPR-HTMLFORMAT
+ 0x00000100=xml
+ 0x00000200=source-data
+ 0x00000400=parse-pre
+ 0x00000800=consecutive-delimiters
+ 0x00001000=first-row
+ 0x00002000=xl97-created
+ 0x00004000=text-dates
+ 0x00008000=xl2000-refreshed
+ 0x00010000=html-tables
+end
+
+shortlist=WEBPR-HTMLFORMAT,0,none,rtf,all
+
+flagslist=WEBPR-STRINGFLAGS
+ 0x01=has-post-method
+ 0x02=has-edit-page
+ 0x04=has-url
+end
+
+# WORKBBOKPR -----------------------------------------------------------------
+
+combilist=WORKBBOKPR-FLAGS
+ 0x00000001=date-1904
+ 0x00000004=hide-border-unsel-tables
+ 0x00000008=filter-privacy
+ 0x00000010=prompted-solutions
+ 0x00000020=show-ink-annotation
+ 0x00000040=backup-file
+ 0x00000080=strip-extlink-values
+ 0x00000300=uint8,dec,update-links,WORKBBOKPR-UPDATELINKS
+ 0x00000400=hide-pivot-fieldlist
+ 0x00000800=publish-items
+ 0x00001000=check-compatibility
+ 0x00006000=uint8,dec,show-objects,WORKBBOKPR-SHOWOBJECTS
+ 0x00008000=show-pivotchart-filter
+ 0x00010000=autocompress-pic
+ 0x00020000=refresh-all-links
+end
+
+shortlist=WORKBBOKPR-UPDATELINKS,0,ask-user,never,always
+shortlist=WORKBBOKPR-SHOWOBJECTS,0,show,placeholder,hide
+
+# WORKBOOKVIEW ---------------------------------------------------------------
+
+flagslist=WORKBOOKVIEW-FLAGS
+ 0x01=hidden
+ 0x02=minimized
+ 0x08=show-horizontal-scroll
+ 0x10=show-vertical-scroll
+ 0x20=show-tabbar
+ 0x40=autofilter-date-grouping
+end
+
+# XF -------------------------------------------------------------------------
+
+shortlist=XF-HORALIGN,0,general,left,center,right,fill,block,center-across-sel,distribute
+shortlist=XF-VERALIGN,0,top,center,bottom,justify,distribute
+shortlist=XF-TEXTDIRECTION,0,context,left-to-right,right-to-left
+
+combilist=XF-ALIGNMENT
+ 0x000000FF=uint8,dec,rotation,TEXTROTATION
+ 0x0000FF00=uint8,dec,indent
+ 0x00070000=uint8,dec,hor-align,XF-HORALIGN
+ 0x00380000=uint8,dec,ver-align,XF-VERALIGN
+ 0x00400000=text-wrap
+ 0x00800000=justify-lastline
+ 0x01000000=shrink-to-fit
+ 0x0C000000=uint8,dec,text-dir,XF-TEXTDIRECTION
+ 0x10000000=locked
+ 0x20000000=formula-hidden
+ 0x80000000=quote-prefix
+end
+
+flagslist=XF-USEDFLAGS
+ 0x0001=format
+ 0x0002=font
+ 0x0004=alignment
+ 0x0008=border
+ 0x0010=fill
+ 0x0020=protection
+end
+
+# ============================================================================