ooo-build r15268 - trunk/patches/test



Author: noelpwer
Date: Sun Feb  1 10:09:03 2009
New Revision: 15268
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15268&view=rev

Log:
changes from 30/01/09


Modified:
   trunk/patches/test/word-read-custom-toolbar-filter.diff

Modified: trunk/patches/test/word-read-custom-toolbar-filter.diff
==============================================================================
--- trunk/patches/test/word-read-custom-toolbar-filter.diff	(original)
+++ trunk/patches/test/word-read-custom-toolbar-filter.diff	Sun Feb  1 10:09:03 2009
@@ -14,7 +14,7 @@
  
  # --- Tagets -------------------------------------------------------
 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
-index a7f122b..d1a582c 100644
+index a7f122b..1013a3b 100644
 --- sw/source/filter/ww8/ww8par.cxx
 +++ sw/source/filter/ww8/ww8par.cxx
 @@ -142,11 +142,12 @@
@@ -31,7 +31,7 @@
  
  #define MM_250 1417             // WW-Default fuer Hor. Seitenraender: 2.5 cm
  #define MM_200 1134             // WW-Default fuer u.Seitenrand: 2.0 cm
-@@ -4173,7 +4174,37 @@ ULONG SwWW8ImplReader::SetSubStreams(SvStorageStreamRef &rTableStream,
+@@ -4173,7 +4174,39 @@ ULONG SwWW8ImplReader::SetSubStreams(SvStorageStreamRef &rTableStream,
              rTableStream = pStg->OpenSotStream( String::CreateFromAscii(
                  pWwFib->fWhichTblStm ? SL::a1Table : SL::a0Table),
                  STREAM_STD_READ);
@@ -50,6 +50,7 @@
 +                    fDump << aByte;
 +                }
 +
++                fDump.flush();
 +                rTableStream->Seek( nCur );  // restore stream pointer
  
 +// attempt to read where the offset to the Customizations is (
@@ -60,7 +61,8 @@
 +                    OSL_TRACE(" tgc255 has offset 0x%x with length 0x%x", pWwFib->fcCmds, pWwFib->lcbCmds );
 +                    Tcg aTCG;
 +                    rTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
-+                    aTCG.Read( rTableStream );
++                    if (!aTCG.Read( rTableStream ) )
++                        OSL_TRACE("** Read of Customization data failed!!!! ");
 +                    rTableStream->Seek( nCur ); // return to previous position
 +                    aTCG.Print( stderr );
 +                }
@@ -70,8 +72,8 @@
              pTableStream->SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
  
 --- /dev/null	2008-04-22 00:28:44.000000000 +0100
-+++ sw/source/filter/ww8/ww8toolbar.hxx	2009-01-29 17:40:04.000000000 +0000
-@@ -0,0 +1,489 @@
++++ sw/source/filter/ww8/ww8toolbar.hxx	2009-02-01 10:05:39.000000000 +0000
+@@ -0,0 +1,555 @@
 +#ifndef _WW8TOOLBAR_HXX
 +#define _WW8TOOLBAR_HXX
 +
@@ -81,14 +83,35 @@
 +#include <memory>
 +#include <vector>
 +
++class TBCHeader;
++
 +class TBBase
 +{
++friend class Indent;
++    static int nIndent; // num spaces to indent before printing 
++protected:
++    void indent_printf(FILE* fp, const char* format, ... );
 +public:
++    TBBase(){}
 +    virtual ~TBBase(){}
 +    virtual bool Read(SotStorageStream *pS) = 0;
 +    virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
 +};
 +
++class Indent
++{
++public:
++    Indent( bool binit = false ) 
++    { 
++        if ( binit )
++            init();
++        else
++            TBBase::nIndent = TBBase::nIndent + 2; 
++    }
++    ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
++    void init() { TBBase::nIndent = 0; }
++};
++
 +class Xst : public TBBase
 +{
 +    rtl::OUString sString;
@@ -150,7 +173,7 @@
 +
 +class TBCBitMap : public TBBase
 +{
-+friend class TBCSpecific; // #FIXME hacky access, need to fix
++friend class TBCBSpecific; // #FIXME hacky access, need to fix
 +    sal_Int32 cbDIB;
 +//    BITMapInfoHeader biHeader;  // lets cheat and not read the bit map stuff right now
 +    sal_uInt8* pRestOfIt;
@@ -163,7 +186,51 @@
 +    void Print( FILE* );
 +};
 +
-+class TBCSpecific :  public TBBase
++class TBCMenuSpecific : public TBBase
++{
++    sal_Int32 tbid;
++    std::auto_ptr< WString > name; //exist only if tbid equals 0x00000001
++    TBCMenuSpecific(const TBCMenuSpecific&);
++    TBCMenuSpecific& operator = ( const TBCMenuSpecific&);
++public:
++    TBCMenuSpecific();
++    ~TBCMenuSpecific(){}
++    bool Read(SotStorageStream *pS);
++    void Print( FILE* );
++};
++
++class TBCCDData : public TBBase
++{
++    sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
++    WString* wstrList;  // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
++    sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
++    sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
++    sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items. 
++    sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
++    WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
++
++    TBCCDData(const TBCCDData&);
++    TBCCDData& operator = ( const TBCCDData&);
++public:
++    TBCCDData();
++    ~TBCCDData();
++    bool Read(SotStorageStream *pS);
++    void Print( FILE* );
++};
++
++class TBCComboDropdownSpecific : public TBBase
++{
++    std::auto_ptr< TBCCDData > data;
++    TBCComboDropdownSpecific(const TBCComboDropdownSpecific&);
++    TBCComboDropdownSpecific& operator = ( const TBCComboDropdownSpecific&);
++public:
++    TBCComboDropdownSpecific( const TBCHeader& header );
++    TBCComboDropdownSpecific(){}
++    bool Read(SotStorageStream *pS);
++    void Print( FILE* );
++};
++
++class TBCBSpecific :  public TBBase
 +{
 +    sal_uInt8 bFlags;
 +    std::auto_ptr< TBCBitMap > icon; // optional
@@ -171,11 +238,11 @@
 +    std::auto_ptr< sal_uInt16 > iBtnFace; // optional
 +    std::auto_ptr< WString > wstrAcc; // optional
 +   
-+    TBCSpecific(const TBCSpecific&);
-+    TBCSpecific& operator = ( const TBCSpecific&);
++    TBCBSpecific(const TBCBSpecific&);
++    TBCBSpecific& operator = ( const TBCBSpecific&);
 +public:
-+    TBCSpecific();
-+    ~TBCSpecific(){}
++    TBCBSpecific();
++    ~TBCBSpecific(){}
 +    bool Read(SotStorageStream *pS);
 +    void Print( FILE* );
 +};
@@ -201,12 +268,12 @@
 +0x16 (ActiveX control)             controlSpecificInfo MUST NOT exist
 +
 +*/
-+class TBCHeader;
++
 +class TBCData : public TBBase
 +{
 +    const TBCHeader& rHeader;
 +    TBCGeneralInfo controlGeneralInfo;
-+    TBCSpecific controlSpecificInfo; // can be one of TBCSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct ( initially lets just implement TBCSpecific 
++    std::auto_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct 
 +    TBCData(const TBCData&);
 +    TBCData& operator = ( const TBCData&);
 +public:
@@ -218,8 +285,6 @@
 +
 +class TBCHeader : public TBBase
 +{
-+friend class TBC;
-+friend class TBCData;
 +    sal_Int8 bSignature; 
 +    sal_Int8 bVersion; 
 +    sal_uInt8 bFlagsTCR; 
@@ -235,6 +300,8 @@
 +public:
 +    TBCHeader();
 +    ~TBCHeader();
++    sal_uInt8 getTct() const { return tct; }
++    sal_uInt16 getTcID() const { return tcid; }
 +    bool Read(SotStorageStream *pS);
 +    void Print( FILE* );
 +};
@@ -276,7 +343,7 @@
 +{
 +    Xst name;
 +    sal_Int32 cbTBData;
-+    TB tb; // array of toolbar data ( currently not read )
++    TB tb;
 +    sal_uInt8 rVisualData[ 100 ];
 +    sal_Int32 iWCTBl;
 +    sal_uInt16 reserved;
@@ -293,7 +360,7 @@
 +    void Print( FILE* fp );
 +};
 +
-+class TBDelta : TBBase
++class TBDelta : public TBBase
 +{
 +    sal_uInt8 doprfatendFlags;
 +    sal_uInt8 ibts;
@@ -308,6 +375,7 @@
 +    TBDelta();
 +    ~TBDelta(){}
 +    bool Read(SotStorageStream *pS);
++    void Print( FILE* );
 +};
 +
 +class Tcg255SubStruct : public TBBase
@@ -562,10 +630,31 @@
 +
 +#endif
 --- /dev/null	2008-04-22 00:28:44.000000000 +0100
-+++ sw/source/filter/ww8/ww8toolbar.cxx	2009-01-29 18:02:16.000000000 +0000
-@@ -0,0 +1,978 @@
++++ sw/source/filter/ww8/ww8toolbar.cxx	2009-02-01 10:05:39.000000000 +0000
+@@ -0,0 +1,1220 @@
 +#include "ww8toolbar.hxx"
 +#include <rtl/ustrbuf.hxx>
++#include <stdarg.h>
++
++int TBBase::nIndent = 0;
++
++#define INDENT_INIT Indent a(true);
++
++#define INDENT Indent a;
++
++void
++TBBase::indent_printf( FILE* fp, const char* format, ... )
++{
++   va_list ap;
++   va_start ( ap, format );
++
++   // indent nIndent spaces
++   for ( int i=0; i<nIndent; ++i)
++      fprintf(fp," ");
++   // append the rest of the message
++   vfprintf( fp, format, ap );
++   va_end( ap );
++}
 +
 +rtl::OUString readUnicodeString( SotStorageStream* pS, sal_Int32 nChars )
 +{
@@ -603,6 +692,7 @@
 +
 +bool CTBWrapper::Read( SotStorageStream* pS )
 +{
++    OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
 +    *pS >> cbTBD >> cCust >> cbDTBC;
@@ -627,29 +717,31 @@
 +
 +void CTBWrapper::Print( FILE* fp )
 +{
-+    fprintf(fp,"CTBWrapper - dump\n");
++    INDENT;
++    indent_printf(fp,"CTBWrapper - dump\n");
 +    bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
 +    if ( bRes )
-+        fprintf(fp,"  sanity check ( first 8 bytes conform )\n");
++        indent_printf(fp,"  sanity check ( first 8 bytes conform )\n");
 +    else 
 +    {
-+        fprintf(fp,"    reserved1(0x%x)\n",ch);
-+        fprintf(fp,"    reserved2(0x%x)\n",reserved2);
-+        fprintf(fp,"    reserved3(0x%x)\n",reserved3);
-+        fprintf(fp,"    reserved4(0x%x)\n",reserved4);
-+        fprintf(fp,"    reserved5(0x%x)\n",reserved5);
-+        fprintf(fp,"Quiting dump");
++        indent_printf(fp,"    reserved1(0x%x)\n",ch);
++        indent_printf(fp,"    reserved2(0x%x)\n",reserved2);
++        indent_printf(fp,"    reserved3(0x%x)\n",reserved3);
++        indent_printf(fp,"    reserved4(0x%x)\n",reserved4);
++        indent_printf(fp,"    reserved5(0x%x)\n",reserved5);
++        indent_printf(fp,"Quiting dump");
 +        return;
 +    }
-+    fprintf(fp,"  cbTBD: no. of TBDelta structures ( skipped if present ) 0x%x\n", cbTBD );
-+    fprintf(fp,"  cCust: no. of cCust structures 0x%x\n",cCust);
-+    fprintf(fp,"  cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
-+    fprintf(fp,"  .... skipping rtbdc\n");
++    indent_printf(fp,"  cbTBD: no. of TBDelta structures ( skipped if present ) 0x%x\n", cbTBD );
++    indent_printf(fp,"  cCust: no. of cCust structures 0x%x\n",cCust);
++    indent_printf(fp,"  cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
++    indent_printf(fp,"  .... skipping rtbdc\n");
 +    if ( rCustomizations )
 +    {
 +        for ( sal_Int32 index = 0; index < cCust; ++index )
 +        {
-+            fprintf(fp,"  Dumping custimization [%d]\n", static_cast< int >( index ));
++            indent_printf(fp,"  Dumping custimization [%d]\n", static_cast< int >( index ));
++            INDENT;
 +            rCustomizations[ index ].Print(fp);
 +        }
 +    }
@@ -666,18 +758,24 @@
 +{
 +    if ( customizationDataCTB )
 +        delete customizationDataCTB;
-+/* we don't read TBDelta structures yet
 +    if ( customizationDataTBDelta )
 +        delete [] customizationDataTBDelta;
-+*/
 +}
 +
 +bool Customization::Read( SotStorageStream *pS)
 +{
++    OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> tbidForTBD >> reserved1 >> ctbds;
-+    if ( tbidForTBD ) //TBDelta - which we don't read yet
-+        return false;
-+    if ( !ctbds ) // should be 0 for CTB 
++    if ( tbidForTBD && ctbds )
++    {
++        customizationDataTBDelta = new TBDelta[ ctbds ];
++        for ( sal_Int32 index = 0; index < ctbds; ++index )
++        {
++            if (!customizationDataTBDelta[ index ].Read( pS ) )
++                return false;
++        }
++    }
++    else
 +    {
 +        customizationDataCTB = new CTB();
 +        if ( !customizationDataCTB->Read( pS ) )
@@ -688,15 +786,18 @@
 +
 +void Customization::Print( FILE* fp )
 +{
-+    fprintf( fp,"Customization -- dump \n");
-+    fprintf( fp,"  tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
-+    fprintf( fp,"  reserved1 0x%x \n", reserved1);
-+    fprintf( fp,"  ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
++    INDENT;
++    indent_printf( fp,"Customization -- dump \n");
++    indent_printf( fp,"  tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
++    indent_printf( fp,"  reserved1 0x%x \n", reserved1);
++    indent_printf( fp,"  ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
 +    if ( !tbidForTBD && !ctbds )
 +        customizationDataCTB->Print( fp );
 +    else
-+        fprintf( fp,"  quiting... we don't handle TBDelta's yet\n" );
-+    
++    {
++        for ( sal_Int32 index = 0; index < ctbds; ++index )
++            customizationDataTBDelta[ index ].Print( fp );
++    }
 +    
 +}
 +
@@ -711,12 +812,29 @@
 +
 +bool TBDelta::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
 +    pS->Read( CiTBDE, sizeof( CiTBDE ) );
 +    *pS >> cbTBC;
 +    return true;
 +}
 +
++void TBDelta::Print( FILE* fp )
++{
++    // Like most of the debug output, it's raw and little ( no )
++    // interpretation of the data is output ( e.g. flag values etc. )
++    indent_printf( fp, "TBDelta -- dump\n" );
++    indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
++    
++    indent_printf( fp, " ibts 0x%x\n",ibts );
++    indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
++    indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
++    indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
++    indent_printf( fp, " CiTBDE[0] 0x%x\n",CiTBDE[0] );
++    indent_printf( fp, " CiTBDE[1] 0x%x\n",CiTBDE[1] );
++    indent_printf( fp, " cbTCB 0x%x\n", cbTBC );
++}
++
 +CTB::CTB() : cbTBData( 0 )
 +,iWCTBl( 0 )
 +,reserved( 0 )
@@ -734,6 +852,7 @@
 +
 +bool CTB::Read( SotStorageStream *pS)
 +{
++    OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
 +    if ( !name.Read( pS ) )
 +        return false;
 +    *pS >> cbTBData;
@@ -759,18 +878,19 @@
 +void
 +CTB::Print( FILE* fp )
 +{
-+    fprintf(fp, "CTB - dump\n");
-+    fprintf(fp, "  name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf(fp, "  cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields.  %x\n", static_cast< unsigned int >( cbTBData ) );
++    INDENT;
++    indent_printf(fp, "CTB - dump\n");
++    indent_printf(fp, "  name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++    indent_printf(fp, "  cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields.  %x\n", static_cast< unsigned int >( cbTBData ) );
 +    
 +    tb.Print(fp);
-+    fprintf(fp, "  iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
++    indent_printf(fp, "  iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
 +    if ( cCtls )
 +    {
 +        for ( sal_Int32 index = 0; index < cCtls; ++index )
 +        {
 +        
-+            fprintf(fp, "  dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
++            indent_printf(fp, "  dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
 +            rTBC[ index ].Print( fp );
 +        }
 +    }
@@ -788,15 +908,17 @@
 +
 +bool TB::Read( SotStorageStream* pS )
 +{
++    OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
 +    return name.Read( pS );
 +}
 +
 +void TB::Print( FILE* fp )
 +{
-+    fprintf( fp, "TB -- dump\n");
-+    fprintf( fp, "  bSignature (0x%x), bVersion(0x%x), cCL(0x%x), ltbid(0x%x), cRowsDefault (0x%x), ltbtr(0x%x), bFlags(0x%x)\n", bSignature, bVersion, cCL, static_cast< unsigned int >( ltbid ), static_cast< unsigned int >( ltbtr ), cRowsDefault, bFlags );
-+    fprintf( fp, "  name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++    INDENT;
++    indent_printf( fp, "TB -- dump\n");
++    indent_printf( fp, "  bSignature (0x%x), bVersion(0x%x), cCL(0x%x), ltbid(0x%x), cRowsDefault (0x%x), ltbtr(0x%x), bFlags(0x%x)\n", bSignature, bVersion, cCL, static_cast< unsigned int >( ltbid ), static_cast< unsigned int >( ltbtr ), cRowsDefault, bFlags );
++    indent_printf( fp, "  name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
 +
 +}
 +
@@ -812,15 +934,16 @@
 +
 +bool TBC::Read( SotStorageStream *pS )
 +{
++    OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
 +    if ( !tbch.Read( pS ) )
 +        return false;
-+    if ( tbch.tcid != 0x1 && tbch.tcid != 0x1051 )
++    if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
 +    {
 +        cid = new sal_uInt32;
 +        *pS >> *cid;
 +    }
 +    // MUST exist if tbch.tct is not equal to 0x16
-+    if ( tbch.tct != 0x16 )
++    if ( tbch.getTct() != 0x16 )
 +    {
 +        tbcd.reset(  new TBCData( tbch ) );
 +        if ( !tbcd->Read( pS ) )
@@ -831,14 +954,15 @@
 +
 +void TBC::Print( FILE* fp )
 +{
-+    fprintf(fp,"TCB -- dump\n");
-+    fprintf(fp,"  dumping header ( TBCHeader )\n");
++    INDENT;
++    indent_printf(fp,"TCB -- dump\n");
++    indent_printf(fp,"  dumping header ( TBCHeader )\n");
 +    tbch.Print( fp );
 +    if ( cid )
-+        fprintf(fp,"  cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
++        indent_printf(fp,"  cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
 +    if ( tbcd.get() )
 +    {
-+        fprintf(fp,"  dumping toolbar data TBCData \n");
++        indent_printf(fp,"  dumping toolbar data TBCData \n");
 +        tbcd->Print(fp);
 +    }
 +}
@@ -865,6 +989,7 @@
 +
 +bool TBCHeader::Read( SotStorageStream* pS )
 +{
++    OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
 +    //  bit 4 ( from lsb ) 
 +    if ( bFlagsTCR & 0x10 )
@@ -878,21 +1003,52 @@
 +
 +void TBCHeader::Print( FILE* fp )
 +{
-+    fprintf(fp,"TBCHeader -- dump\n");
-+    fprintf(fp,"  bSignature 0x%x\n  bVersion 0x%x\n  bFlagsTCR 0x%x\n", bSignature, bVersion, bFlagsTCR );
-+    fprintf(fp,"  tct 0x%x\n  tcid 0x%x\n  tbct 0x%x\n  bPriority 0x%x\n", tct, tcid, static_cast< unsigned int >( tbct ), bPriority );
++    INDENT;
++    indent_printf(fp,"TBCHeader -- dump\n");
++    indent_printf(fp,"  bSignature 0x%xn", bSignature );
++    indent_printf(fp,"  bVersion 0x%x\n", bVersion );
++    indent_printf(fp,"  bFlagsTCR 0x%x\n", bFlagsTCR );
++    indent_printf(fp,"  tct 0x%x\n", tct );
++    indent_printf(fp,"  tcid 0x%x\n", tcid );
++    indent_printf(fp,"  tbct 0x%x\n", static_cast< unsigned int >( tbct ));
++    indent_printf(fp,"  bPriority 0x%x\n", bPriority );
 +    if ( width )
-+        fprintf(fp,"  width 0x%d(0x%x)\n", *width, *width);
++        indent_printf(fp,"  width 0x%d(0x%x)\n", *width, *width);
 +    if ( height )
-+        fprintf(fp,"  height 0x%d(0x%x)\n", *height, *height);
++        indent_printf(fp,"  height 0x%d(0x%x)\n", *height, *height);
 +}
 +
 +bool TBCData::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
 +    if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
 +        return false;
-+    if ( rHeader.tct == 1 )
-+        return controlSpecificInfo.Read( pS );
++    switch ( rHeader.getTct() )
++    {
++        case 0x01: // (Button control)
++        case 0x10: // (ExpandingGrid control)
++            controlSpecificInfo.reset( new TBCBSpecific() );
++            break;
++        case 0x0A: // (Popup control)
++        case 0x0C: // (ButtonPopup control)
++        case 0x0D: // (SplitButtonPopup control)
++        case 0x0E: // (SplitButtonMRUPopup control)
++            controlSpecificInfo.reset( new TBCMenuSpecific() );
++            break;
++        case 0x02: // (Edit control)
++        case 0x04: // (ComboBox control)
++        case 0x14: // (GraphicCombo control)
++        case 0x03: // (DropDown control)
++        case 0x06: // (SplitDropDown control)
++        case 0x09: // (GraphicDropDown control)
++            controlSpecificInfo.reset( new TBCComboDropdownSpecific( rHeader ) );
++            break;
++        default:
++            break;
++    }
++    if ( controlSpecificInfo.get() )
++        return controlSpecificInfo->Read( pS );
++    return true;
 +
 +    OSL_TRACE("#FIXME I need to be able to handle different controlSpecificInfo types.");
 +    return false;
@@ -900,19 +1056,21 @@
 +
 +void TBCData::Print( FILE* fp )
 +{
-+    fprintf(fp,"TBCData -- dump\n");
-+    fprintf(fp,"  dumping controlGeneralInfo( TBCGeneralInfo )\n");
++    INDENT;
++    indent_printf(fp,"TBCData -- dump\n");
++    indent_printf(fp,"  dumping controlGeneralInfo( TBCGeneralInfo )\n");
 +    controlGeneralInfo.Print( fp );
-+    if ( rHeader.tct == 1 )
++    if ( rHeader.getTct() == 1 )
 +    {
-+        fprintf(fp,"  dumping controlSpecificInfo( TBCSpecificInfo )\n");
-+        controlSpecificInfo.Print( fp );
++        indent_printf(fp,"  dumping controlSpecificInfo( TBCBSpecificInfo )\n");
++        controlSpecificInfo->Print( fp );
 +    }
 +}
 +
 +bool
 +WString::Read( SotStorageStream *pS )
 +{
++    OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
 +    sal_Int8 nChars = 0;
 +    *pS >> nChars;
 +    sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars  ) );
@@ -922,6 +1080,7 @@
 +bool 
 +Xst::Read( SotStorageStream* pS )
 +{
++    OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() );
 +    sal_Int16 nChars = 0;
 +    *pS >> nChars;
 +    sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars  ) );
@@ -931,8 +1090,9 @@
 +void
 +Xst::Print( FILE* fp )
 +{
-+    fprintf( fp, "Xst -- dump\n");
-+    fprintf( fp, " %s",  rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
++    INDENT;
++    indent_printf( fp, "Xst -- dump\n");
++    indent_printf( fp, " %s",  rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
 +}
 +TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
 +{
@@ -941,6 +1101,7 @@
 +bool
 +TBCExtraInfo::Read( SotStorageStream *pS )
 +{
++    OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
 +    if( !wstrHelpFile.Read( pS )  )
 +        return false;
 +
@@ -956,18 +1117,19 @@
 +void
 +TBCExtraInfo::Print( FILE* fp )
 +{
-+    fprintf( fp, "TBCExtraInfo -- dump\n");
-+    fprintf( fp, "  wstrHelpFile %s\n", 
++    INDENT;
++    indent_printf( fp, "TBCExtraInfo -- dump\n");
++    indent_printf( fp, "  wstrHelpFile %s\n", 
 +        rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
-+    fprintf( fp, "  wstrTag %s\n", 
++    indent_printf( fp, "  idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
++    indent_printf( fp, "  wstrTag %s\n", 
 +        rtl::OUStringToOString( wstrTag.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  wstrOnAction %s\n", 
++    indent_printf( fp, "  wstrOnAction %s\n", 
 +        rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  wstrParam %s\n", 
++    indent_printf( fp, "  wstrParam %s\n", 
 +        rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  tbcu 0x%x\n", tbcu );
-+    fprintf( fp, "  tbmg 0x%x\n", tbmg );
++    indent_printf( fp, "  tbcu 0x%x\n", tbcu );
++    indent_printf( fp, "  tbmg 0x%x\n", tbmg );
 +    
 +}
 +
@@ -977,9 +1139,14 @@
 +
 +bool TBCGeneralInfo::Read( SotStorageStream *pS )
 +{
++    OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> bFlags;
-+    if ( !customText.Read( pS ) || !descriptionText.Read( pS ) || !tooltip.Read( pS )
-+    || !extraInfo.Read( pS ) )
++
++    if ( ( bFlags & 0x1 ) && !customText.Read( pS ) )
++        return false;
++    if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) ||  !tooltip.Read( pS ) ) )
++        return false;
++    if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) )
 +        return false;
 +    return true;
 +}
@@ -987,23 +1154,53 @@
 +void 
 +TBCGeneralInfo::Print( FILE* fp )
 +{
-+    fprintf( fp, "TBCGeneralInfo -- dump\n");
-+    fprintf( fp, "  bFlags 0x%x\n", bFlags );
-+    fprintf( fp, "  customText %s\n", 
++    INDENT;
++    indent_printf( fp, "TBCGeneralInfo -- dump\n");
++    indent_printf( fp, "  bFlags 0x%x\n", bFlags );
++    indent_printf( fp, "  customText %s\n", 
 +        rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  description %s\n", 
++    indent_printf( fp, "  description %s\n", 
 +        rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+    fprintf( fp, "  tooltip %s\n", 
++    indent_printf( fp, "  tooltip %s\n", 
 +        rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
 +    extraInfo.Print( fp );
 +}
 +
-+TBCSpecific::TBCSpecific() : bFlags( 0 )
++TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
++{
++}
++
++bool
++TBCMenuSpecific::Read( SotStorageStream *pS)
 +{
++    OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
++    *pS >> tbid;
++    if ( tbid == 1 ) 
++    {
++        name.reset( new WString() );
++        return name->Read( pS );
++    }
++    return true;
++}
++
++void 
++TBCMenuSpecific::Print( FILE* fp )
++{
++    INDENT;
++    indent_printf( fp, "TBCMenuSpecific -- dump\n");
++    indent_printf( fp, "  tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
++    if ( tbid == 1 )
++        indent_printf( fp, "  name %s", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++
 +}
 +
-+bool TBCSpecific::Read( SotStorageStream *pS)
++TBCBSpecific::TBCBSpecific() : bFlags( 0 )
 +{
++}
++
++bool TBCBSpecific::Read( SotStorageStream *pS)
++{
++    OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> bFlags;
 +
 +    // bFlags determines what we read next
@@ -1032,22 +1229,104 @@
 +}
 +
 +
-+void TBCSpecific::Print( FILE* fp )
++void TBCBSpecific::Print( FILE* fp )
 +{
-+    fprintf( fp, "TBCSpecific -- dump\n");
-+    fprintf( fp, "  bFlags 0x%x\n", bFlags );
++    INDENT;
++    indent_printf( fp, "TBCBSpecific -- dump\n");
++    indent_printf( fp, "  bFlags 0x%x\n", bFlags );
 +    bool bResult = ( icon.get() != NULL );
-+    fprintf( fp, "  icon present? %s\n", bResult ? "true" : "false" );
++    indent_printf( fp, "  icon present? %s\n", bResult ? "true" : "false" );
 +    if ( bResult )
++    {
++        INDENT;
++        indent_printf( fp, "  icon: \n");
 +        icon->Print( fp ); // will dump size
++    }
 +    bResult = ( iconMask.get() != NULL );
-+    fprintf( fp, "  icon mask present? %s\n", bResult ? "true" : "false" );
++    indent_printf( fp, "  icon mask present? %s\n", bResult ? "true" : "false" );
 +    if ( bResult )
++    {
++        INDENT;
++        indent_printf( fp, "  icon mask: \n");
 +        iconMask->Print( fp ); // will dump size
++    }
 +    if ( iBtnFace.get() )
-+        fprintf( fp, "  iBtnFace 0x%x\n", *(iBtnFace.get()) );
++    {
++        indent_printf( fp, "  iBtnFace 0x%x\n", *(iBtnFace.get()) );
++    }
 +    bResult = ( wstrAcc.get() != NULL );
-+    fprintf( fp, "  option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
++    indent_printf( fp, "  option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
++}
++
++TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header ) 
++{
++    if ( header.getTcID() == 0x01 )
++        data.reset( new TBCCDData() );
++}
++
++bool TBCComboDropdownSpecific::Read( SotStorageStream *pS)
++{
++    if ( data.get() )
++        return data->Read( pS );
++    return true;
++}
++
++void TBCComboDropdownSpecific::Print( FILE* fp)
++{
++    INDENT;
++    indent_printf(fp,"TBCComboDropdownSpecific -- dump" );
++    if ( data.get() )
++        data->Print( fp );
++    else
++        indent_printf(fp," no data " );
++}
++
++TBCCDData::TBCCDData() : cwstrItems( 0 )
++,wstrList( NULL ) 
++,iSel( 0 )
++,cLines( 0 )
++,dxWidth( 0 )
++{
++}
++
++TBCCDData::~TBCCDData()
++{
++    if ( wstrList )
++        delete[] wstrList;
++}
++
++bool TBCCDData::Read( SotStorageStream *pS)
++{
++    *pS >> cwstrItems;
++    if ( cwstrItems )
++    {
++        wstrList = new WString[ cwstrItems ];
++        for( sal_Int32 index=0; index < cwstrItems; ++index )
++        {
++            if ( !wstrList[ index ].Read( pS ) )
++                return false;
++        } 
++    }
++    *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
++
++    return wstrEdit.Read( pS );
++}
++
++void TBCCDData::Print( FILE* fp)
++{
++    INDENT;
++    indent_printf(fp,"TBCCDData -- dump\n");
++    indent_printf(fp,"  cwstrItems items in wstrList 0x%d\n", cwstrItems);
++    for ( sal_Int32 index=0; index < cwstrItems; ++index )
++    {
++        INDENT;
++        indent_printf(fp, "  wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++    }
++    indent_printf(fp,"  cwstrMRU num most recently used string 0x%d item\n", cwstrMRU);
++    indent_printf(fp,"  iSel index of selected item 0x%d item\n", iSel);
++    indent_printf(fp,"  cLines num of suggested lines to display 0x%d", cLines);
++    indent_printf(fp,"  dxWidth width in pixels 0x%d", dxWidth);
++    indent_printf(fp,"  wstrEdit %s", rtl::OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
 +}
 +
 +TBCBitMap::TBCBitMap() : cbDIB( 0 ), pRestOfIt( NULL )
@@ -1062,19 +1341,21 @@
 +
 +bool TBCBitMap::Read( SotStorageStream* pS)
 +{
++    OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> cbDIB;
 +    // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
 +    // slurp the rest of the structure as a blob ( we'll get to it later )
 +
 +    pRestOfIt = new sal_uInt8[ cbDIB - 10 ];
-+    pS->Read( pRestOfIt, sizeof( pRestOfIt ) );
++    pS->Read( pRestOfIt, cbDIB - 10 );
 +    return true;
 +}
 +
 +void TBCBitMap::Print( FILE* fp )
 +{
-+    fprintf(fp, "TBCBitMap -- dump\n");
-+    fprintf(fp, "  TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
++    INDENT;
++    indent_printf(fp, "TBCBitMap -- dump\n");
++    indent_printf(fp, "  TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
 +}
 +
 +Tcg::Tcg() : nTcgVer( 255 )
@@ -1083,6 +1364,7 @@
 +
 +bool Tcg::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> nTcgVer;
 +    if ( nTcgVer != (sal_Int8)255 )
 +        return false;
@@ -1092,8 +1374,9 @@
 +
 +void Tcg::Print( FILE* fp )
 +{
-+    fprintf(fp, "Tcg - dump %d\n", nTcgVer);
-+    fprintf(fp,"  nTcgVer %d\n", nTcgVer);
++    INDENT_INIT;
++    indent_printf(fp, "Tcg - dump %d\n", nTcgVer);
++    indent_printf(fp,"  nTcgVer %d\n", nTcgVer);
 +    tcg->Print( fp );
 +}
 +
@@ -1157,6 +1440,7 @@
 +
 +bool Tcg255::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
 +    sal_uInt8 nId = 0; // 
 +    *pS >> nId;
 +    while (  nId != 0x40  )
@@ -1171,14 +1455,16 @@
 +
 +void Tcg255::Print( FILE* fp)
 +{
-+    fprintf(fp, "Tcg255 - dump\n");
-+    fprintf(fp, "  contains %d sub records\n", rgtcgData.size() );
++    INDENT;
++    indent_printf(fp, "Tcg255 - dump\n");
++    indent_printf(fp, "  contains %d sub records\n", rgtcgData.size() );
 +    std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin(); 
 +    std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end(); 
 +    
 +    for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
 +    {
-+        fprintf(fp, "[%d] \n", static_cast< unsigned int >( count ) );
++        INDENT;
++        indent_printf(fp, "  [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
 +        (*it)->Print(fp);
 +    }
 +}
@@ -1190,6 +1476,7 @@
 +
 +bool Tcg255SubStruct::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
 +    if ( mbReadId )
 +        *pS >> ch;
 +    return true;
@@ -1206,6 +1493,7 @@
 +
 +bool PlfMcd::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    *pS >> iMac;
 +    if ( iMac )
@@ -1222,11 +1510,13 @@
 +
 +void PlfMcd::Print( FILE* fp )
 +{
-+    fprintf(fp, "PlfMcd ( Tcg255SubStruct ) - dump\n");
-+    fprintf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
++    INDENT;
++    indent_printf(fp, "PlfMcd ( Tcg255SubStruct ) - dump\n");
++    indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
 +    for ( sal_Int32 count=0; count < iMac; ++count )
 +    {
-+        fprintf(fp, "[%d] MCD\n", static_cast< int >( count ) );
++        INDENT;
++        indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
 +        rgmcd[ count ].Print( fp );
 +    }
 +    
@@ -1247,6 +1537,7 @@
 +
 +bool PlfAcd::Read( SotStorageStream *pS)
 +{
++    OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    *pS >> iMac;
 +    if ( iMac )
@@ -1262,11 +1553,13 @@
 +}
 +void PlfAcd::Print( FILE* fp )
 +{
-+    fprintf(fp, "PlfAcd ( Tcg255SubStruct ) - dump\n");
-+    fprintf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
++    INDENT;
++    indent_printf(fp, "PlfAcd ( Tcg255SubStruct ) - dump\n");
++    indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
 +    for ( sal_Int32 count=0; count < iMac; ++count )
 +    {
-+        fprintf(fp, "[%d] ACD\n", static_cast< int >( count ) );
++        INDENT;
++        indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
 +        rgacd[ count ].Print( fp );
 +    }
 +    
@@ -1286,6 +1579,7 @@
 +
 +bool PlfKme::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    *pS >> iMac;
 +    if ( iMac )
@@ -1302,11 +1596,13 @@
 + 
 +void PlfKme::Print( FILE* fp )
 +{
-+    fprintf(fp, "PlfKme ( Tcg255SubStruct ) - dump\n");
-+    fprintf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
++    INDENT;
++    indent_printf(fp, "PlfKme ( Tcg255SubStruct ) - dump\n");
++    indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
 +    for ( sal_Int32 count=0; count < iMac; ++count )
 +    {
-+        fprintf(fp, "[%d] Kme\n", static_cast< int >( count ) );
++        INDENT;
++        indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
 +        rgkme[ count ].Print( fp );
 +    }
 +    
@@ -1318,13 +1614,15 @@
 +
 +bool TcgSttbf::Read( SotStorageStream *pS) 
 +{
++    OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    return sttbf.Read( pS );
 +}
 +
 +void TcgSttbf::Print( FILE* fp )
 +{
-+    fprintf(fp,"TcgSttbf - dump\n");
++    INDENT;
++    indent_printf(fp,"TcgSttbf - dump\n");
 +    sttbf.Print( fp );
 +}
 +
@@ -1343,6 +1641,7 @@
 +
 +bool TcgSttbfCore::Read( SotStorageStream* pS )
 +{
++    OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> fExtend >> cData >> cbExtra;
 +    if ( cData )
 +    {
@@ -1359,15 +1658,16 @@
 +
 +void TcgSttbfCore::Print( FILE* fp )
 +{
-+    fprintf( fp, "TcgSttbfCore - dump\n");
-+    fprintf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
-+    fprintf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
-+    fprintf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
++    INDENT;
++    indent_printf( fp, "TcgSttbfCore - dump\n");
++    indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
++    indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
++    indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
 +    
 +    if ( cData )
 +    {
 +        for ( sal_Int32 index = 0; index < cData; ++index )
-+            fprintf(fp,"   string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
++            indent_printf(fp,"   string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
 +    }
 +
 +}
@@ -1385,12 +1685,13 @@
 +
 +bool MacroNames::Read( SotStorageStream *pS)
 +{
++    OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
 +    Tcg255SubStruct::Read( pS );
 +    *pS >> iMac;
 +    if ( iMac )
 +    {
 +        rgNames = new MacroName[ iMac ]; 
-+        for ( sal_Int32 index = 0; index < 0; ++index )
++        for ( sal_Int32 index = 0; index < iMac; ++index )
 +        {
 +            if ( !rgNames[ index ].Read( pS ) )
 +                return false;
@@ -1401,11 +1702,13 @@
 +
 +void MacroNames::Print( FILE* fp )
 +{
-+    fprintf(fp, "MacroNames ( Tcg255SubStruct ) - dump\n");
-+    fprintf(fp, " contains %d MacroName records\n", iMac );
++    INDENT;
++    indent_printf(fp, "MacroNames ( Tcg255SubStruct ) - dump\n");
++    indent_printf(fp, " contains %d MacroName records\n", iMac );
 +    for ( sal_Int32 count=0; count < iMac; ++count )
 +    {
-+        fprintf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
++        INDENT;
++        indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
 +        rgNames[ count ].Print( fp );
 +    }
 +    
@@ -1418,14 +1721,16 @@
 +
 +bool MacroName::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> ibst;
 +    return xstz.Read( pS );
 +}
 +
 +void MacroName::Print( FILE* fp )
 +{
-+    fprintf( fp, "MacroName - dump");
-+    fprintf( fp,"  index - 0x%x has associated following record\n", ibst );
++    INDENT;
++    indent_printf( fp, "MacroName - dump");
++    indent_printf( fp,"  index - 0x%x has associated following record\n", ibst );
 +    xstz.Print( fp );
 +}
 +
@@ -1438,6 +1743,7 @@
 +bool 
 +Xstz::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
 +    if ( !xst.Read( pS ) )
 +        return false;
 +    *pS >> chTerm;
@@ -1448,10 +1754,11 @@
 +
 +void Xstz::Print( FILE* fp )
 +{
-+    fprintf(fp,"Xstz -- dump\n");
-+    fprintf(fp,"  Xst\n");
++    INDENT;
++    indent_printf(fp,"Xstz -- dump\n");
++    indent_printf(fp,"  Xst\n");
 +    xst.Print( fp ); 
-+    fprintf(fp,"  chterm 0x%x ( should be zero )\n", chTerm);
++    indent_printf(fp,"  chterm 0x%x ( should be zero )\n", chTerm);
 +}
 +
 +Kme::Kme() : reserved1(0)
@@ -1470,20 +1777,22 @@
 +bool
 +Kme::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
 +    return true;
 +}
 +
 +void Kme::Print( FILE* fp )
 +{
++    INDENT;
 +    
-+   fprintf( fp, "Kme - dump\n");
-+   fprintf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
-+   fprintf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+   fprintf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
-+   fprintf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
-+   fprintf( fp, " kt 0x%x \n", kt );
-+   fprintf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
++   indent_printf( fp, "Kme - dump\n");
++   indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
++   indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
++   indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
++   indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
++   indent_printf( fp, " kt 0x%x \n", kt );
++   indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
 +}
 +
 +Acd::Acd() : ibst( 0 )
@@ -1493,16 +1802,18 @@
 +
 +bool Acd::Read(SotStorageStream *pS)
 +{
++    OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> ibst >> fciBasedOnABC;
 +    return true;
 +}
 +
 +void Acd::Print( FILE* fp )
 +{
-+    fprintf( fp,"ACD - dump\n");
++    INDENT;
++    indent_printf( fp,"ACD - dump\n");
 +    // #TODO flesh out interpretation of these values
-+    fprintf( fp,"  ibst 0x%x\n", ibst);
-+    fprintf( fp,"  fciBaseObABC 0x%x\n", fciBasedOnABC);
++    indent_printf( fp,"  ibst 0x%x\n", ibst);
++    indent_printf( fp,"  fciBaseObABC 0x%x\n", fciBasedOnABC);
 +}
 +
 +MCD::MCD() :  reserved1(0x56)
@@ -1519,26 +1830,25 @@
 +
 +bool  MCD::Read(SotStorageStream *pS)
 +{
-+    
-+    OSL_TRACE("*** MCD before read 0x%x", pS->Tell());
++    OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
 +    *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
 +    *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
-+    OSL_TRACE("*** MCD after read 0x%x", pS->Tell());
 +    return true;
 +}
 +
 +void MCD::Print( FILE* fp )
 +{
-+   fprintf( fp, "MCD - dump\n");
-+   fprintf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
-+   fprintf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
-+   fprintf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
-+   fprintf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
-+
-+   fprintf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
-+   fprintf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
-+   fprintf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
-+   fprintf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
-+   fprintf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
++    INDENT;
++    indent_printf( fp, "MCD - dump\n");
++    indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
++    indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
++    indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
++    indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
++
++    indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
++    indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
++    indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
++    indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
++    indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
 +}
 +



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]