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