ooo-build r15287 - trunk/patches/test
- From: noelpwer svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15287 - trunk/patches/test
- Date: Wed, 4 Feb 2009 18:20:33 +0000 (UTC)
Author: noelpwer
Date: Wed Feb 4 18:20:32 2009
New Revision: 15287
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15287&view=rev
Log:
split out common records in svx
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 Wed Feb 4 18:20:32 2009
@@ -1,3 +1,38 @@
+diff --git svx/prj/d.lst svx/prj/d.lst
+index 71d507e..c056d62 100644
+--- svx/prj/d.lst
++++ svx/prj/d.lst
+@@ -662,5 +662,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table
+ ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx
+ ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx
+ ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx
++..\inc\svx\mstoolbar.hxx %_DEST%\inc%_EXT%\svx\mstoolbar.hxx
+
+ ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
+diff --git svx/source/msfilter/makefile.mk svx/source/msfilter/makefile.mk
+index 8db71d1..768bc0e 100644
+--- svx/source/msfilter/makefile.mk
++++ svx/source/msfilter/makefile.mk
+@@ -54,7 +54,8 @@ SLOFILES=\
+ $(SLO)$/msocximex.obj \
+ $(SLO)$/msashape3d.obj \
+ $(SLO)$/mscodec.obj \
+- $(SLO)$/msfiltertracer.obj
++ $(SLO)$/msfiltertracer.obj\
++ $(SLO)$/mstoolbar.obj\
+
+ EXCEPTIONSFILES= \
+ $(SLO)$/eschesdo.obj \
+@@ -65,7 +66,8 @@ EXCEPTIONSFILES= \
+ $(SLO)$/msocximex.obj \
+ $(SLO)$/msoleexp.obj \
+ $(SLO)$/svxmsbas.obj \
+- $(SLO)$/msfiltertracer.obj
++ $(SLO)$/msfiltertracer.obj\
++ $(SLO)$/mstoolbar.obj\
+
+ .INCLUDE : target.mk
+
diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
index 25cb969..3360d48 100644
--- sw/source/filter/ww8/makefile.mk
@@ -129,55 +164,16 @@
{
// unknown Header
if( rHeader.nSize < DIBINFOHEADERSIZE )
---- /dev/null 2008-04-22 00:28:44.000000000 +0100
-+++ sw/source/filter/ww8/ww8toolbar.hxx 2009-02-04 13:42:05.000000000 +0000
-@@ -0,0 +1,556 @@
+--- /dev/null 2008-12-03 05:56:56.000000000 +0000
++++ sw/source/filter/ww8/ww8toolbar.hxx 2009-02-04 17:47:05.000000000 +0000
+@@ -0,0 +1,340 @@
+#ifndef _WW8TOOLBAR_HXX
+#define _WW8TOOLBAR_HXX
+
-+#include <tools/string.hxx>
-+#include <sot/storage.hxx>
-+#include <ostream>
-+#include <memory>
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+#include <com/sun/star/frame/XModel.hpp>
-+#include <com/sun/star/container/XIndexContainer.hpp>
-+#include <com/sun/star/beans/XPropertySet.hpp>
-+#include <vcl/bitmap.hxx>
++#include <svx/mstoolbar.hxx>
+
+namespace css = ::com::sun::star;
+
-+class TBCHeader;
-+class CustomToolBarImportHelper;
-+class TBBase
-+{
-+friend class Indent;
-+ static int nIndent; // num spaces to indent before printing
-+protected:
-+ void indent_printf(FILE* fp, const char* format, ... );
-+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
-+public:
-+ TBBase() : nOffSet( 0 ) {}
-+ 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;
@@ -188,183 +184,6 @@
+ void Print( FILE* fp );
+};
+
-+class WString : public TBBase
-+{
-+ rtl::OUString sString;
-+
-+public:
-+ WString(){};
-+ ~WString(){};
-+ bool Read(SotStorageStream *pS);
-+ rtl::OUString getString(){ return sString; }
-+};
-+
-+class TBCExtraInfo : public TBBase
-+{
-+ WString wstrHelpFile;
-+ sal_Int32 idHelpContext;
-+ WString wstrTag;
-+ WString wstrOnAction;
-+ WString wstrParam;
-+ sal_Int8 tbcu;
-+ sal_Int8 tbmg;
-+
-+ TBCExtraInfo(const TBCExtraInfo&);
-+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
-+public:
-+ TBCExtraInfo();
-+ ~TBCExtraInfo(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ rtl::OUString getOnAction();
-+};
-+
-+class TBCGeneralInfo : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ WString customText;
-+ WString descriptionText;
-+ WString tooltip;
-+ TBCExtraInfo extraInfo;
-+
-+public:
-+ TBCGeneralInfo();
-+ ~TBCGeneralInfo() {}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
-+};
-+
-+class TBCBitMap : public TBBase
-+{
-+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;
-+ Bitmap mBitMap;
-+ int size;
-+public:
-+ TBCBitMap();
-+ ~TBCBitMap();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ Bitmap& getBitMap();
-+};
-+
-+class TBCMenuSpecific : public TBBase
-+{
-+ sal_Int32 tbid;
-+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
-+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.
-+ std::vector< 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.
-+
-+public:
-+ TBCCDData();
-+ ~TBCCDData();
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCComboDropdownSpecific : public TBBase
-+{
-+ boost::shared_ptr< TBCCDData > data;
-+public:
-+ TBCComboDropdownSpecific( const TBCHeader& header );
-+ TBCComboDropdownSpecific(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+};
-+
-+class TBCBSpecific : public TBBase
-+{
-+ sal_uInt8 bFlags;
-+ boost::shared_ptr< TBCBitMap > icon; // optional
-+ boost::shared_ptr< TBCBitMap > iconMask; // optional
-+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
-+ boost::shared_ptr< WString > wstrAcc; // optional
-+
-+public:
-+ TBCBSpecific();
-+ ~TBCBSpecific(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ TBCBitMap* getIcon();
-+ TBCBitMap* getIconMask();
-+};
-+
-+/* TBCHeader.tct controlSpecificInfo type
-+
-+0x01 (Button control) TBCBSpecific
-+0x10 (ExpandingGrid control) TBCBSpecific
-+0x0A (Popup control) TBCMenuSpecific
-+0x0C (ButtonPopup control) TBCMenuSpecific
-+0x0D (SplitButtonPopup control) TBCMenuSpecific
-+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
-+0x02 (Edit control) TBCComboDropdow nSpecific
-+0x04 (ComboBox control) TBCComboDropdow nSpecific
-+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
-+0x03 (DropDown control) TBCComboDropdow nSpecific
-+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
-+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
-+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
-+0x0F (Label control) controlSpecificInfo MUST NOT exist
-+0x12 (Grid control) controlSpecificInfo MUST NOT exist
-+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
-+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
-+
-+*/
-+class TBCHeader : public TBBase
-+{
-+ sal_Int8 bSignature;
-+ sal_Int8 bVersion;
-+ sal_uInt8 bFlagsTCR;
-+ sal_uInt8 tct;
-+ sal_uInt16 tcid;
-+ sal_uInt32 tbct;
-+ sal_uInt8 bPriority;
-+ boost::shared_ptr< sal_uInt16 > width; //optional
-+ boost::shared_ptr< sal_uInt16 > height; //optional
-+
-+public:
-+ TBCHeader();
-+ ~TBCHeader();
-+ sal_uInt8 getTct() const { return tct; }
-+ sal_uInt16 getTcID() const { return tcid; }
-+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ sal_uInt32 getTbct() { return tbct; };
-+};
-+
-+class TBCData : public TBBase
-+{
-+ TBCHeader rHeader;
-+ TBCGeneralInfo controlGeneralInfo;
-+ boost::shared_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:
-+ TBCData( const TBCHeader& Header );
-+ ~TBCData(){}
-+ bool Read(SotStorageStream *pS);
-+ void Print( FILE* );
-+ bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
-+};
-+
+class TBC : public TBBase
+{
+ TBCHeader tbch;
@@ -688,137 +507,37 @@
+};
+
+#endif
---- /dev/null 2008-04-22 00:28:44.000000000 +0100
-+++ sw/source/filter/ww8/ww8toolbar.cxx 2009-02-04 13:44:25.000000000 +0000
-@@ -0,0 +1,1543 @@
+--- /dev/null 2008-12-03 05:56:56.000000000 +0000
++++ sw/source/filter/ww8/ww8toolbar.cxx 2009-02-04 17:54:21.000000000 +0000
+@@ -0,0 +1,974 @@
+#include "ww8toolbar.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <stdarg.h>
-+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
+#include <com/sun/star/ui/XImageManager.hpp>
-+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/ui/ItemType.hpp>
+#include <fstream>
+#include <vcl/graph.hxx>
-+#include <vcl/bitmapex.hxx>
-+int TBBase::nIndent = 0;
+
+using namespace com::sun::star;
+
-+#define INDENT_INIT Indent a(true);
-+
-+#define INDENT Indent a;
-+
-+class CustomToolBarImportHelper
-+{
-+struct iconcontrolitem
++CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
++,reserved2(0)
++,reserved3(0)
++,reserved4(0)
++,reserved5(0)
++,cbTBD(0)
++,cCust(0)
++,cbDTBC(0)
++,rtbdc(0)
+{
-+ rtl::OUString sCommand;
-+ uno::Reference< graphic::XGraphic > image;
-+};
-+ std::vector< iconcontrolitem > iconcommands;
-+
-+ uno::Reference< ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
-+public:
-+ CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel );
-+
-+ uno::Reference< ui::XUIConfigurationManager > getCfgManager();
-+
-+ static uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
-+
-+ void addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString );
-+ void applyIcons();
-+};
++}
+
-+void CustomToolBarImportHelper::applyIcons()
++CTBWrapper::~CTBWrapper()
+{
-+ for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
-+ {
-+ uno::Sequence< rtl::OUString > commands(1);
-+ commands[ 0 ] = it->sCommand;
-+ uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
-+ images[ 0 ] = it->image;
-+
-+ uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
-+ xImageManager->insertImages( 1, commands, images );
-+ }
+}
+
-+void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
-+{
-+ iconcontrolitem item;
-+ item.sCommand = sString;
-+ item.image = xImage;
-+ iconcommands.push_back( item );
-+}
-+
-+CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel )
-+{
-+ m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
-+}
-+
-+uno::Reference< ui::XUIConfigurationManager >
-+CustomToolBarImportHelper::getCfgManager()
-+{
-+ return m_xCfgSupp->getUIConfigurationManager();
-+}
-+
-+uno::Any
-+CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
-+{
-+//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
-+ static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
-+ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-+ // create script url
-+ rtl::OUString scriptURL = part1 + sCmd + part2;
-+ return uno::makeAny( scriptURL );
-+}
-+
-+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 )
-+{
-+ rtl::OUStringBuffer buf(40);
-+ for ( sal_Int32 index = 0; index < nChars; ++index )
-+ {
-+ sal_uInt16 ch = 0;
-+ *pS >> ch;
-+ sal_Unicode uni = static_cast< sal_Unicode >( ch );
-+ buf.append( &uni, 1 );
-+ }
-+ return buf.makeStringAndClear();
-+}
-+
-+CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,reserved2(0)
-+,reserved3(0)
-+,reserved4(0)
-+,reserved5(0)
-+,cbTBD(0)
-+,cCust(0)
-+,cbDTBC(0)
-+,rtbdc(0)
-+{
-+}
-+
-+CTBWrapper::~CTBWrapper()
-+{
-+}
-+
-+bool CTBWrapper::Read( SotStorageStream* pS )
++bool CTBWrapper::Read( SotStorageStream* pS )
+{
+ OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
@@ -1173,186 +892,43 @@
+bool
+TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
+{
-+ if ( tbcd.get() )
-+ return tbcd->ImportToolBarControl( toolbarcontainer, helper );
-+ return true;
-+
-+}
-+
-+TBCHeader::TBCHeader() : bSignature( 0x3 )
-+,bVersion( 0x01 )
-+,bFlagsTCR( 0 )
-+,tct(0x1) // default to Button
-+,tcid(0)
-+,tbct(0)
-+{
-+}
-+
-+
-+TBCHeader::~TBCHeader()
-+{
-+}
-+
-+bool TBCHeader::Read( SotStorageStream* pS )
-+{
-+ OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
-+ // bit 4 ( from lsb )
-+ if ( bFlagsTCR & 0x10 )
-+ {
-+ width.reset( new sal_uInt16 );
-+ height.reset( new sal_uInt16 );
-+ *pS >> *width >> *height;
-+ }
-+ return true;
-+}
-+
-+void TBCHeader::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
-+ 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.get() )
-+ indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
-+ if ( height.get() )
-+ indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
-+}
-+
-+TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
-+{
-+}
-+
-+bool TBCData::Read(SotStorageStream *pS)
-+{
-+ OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
-+ return false;
-+ 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;
-+}
-+
-+bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
-+{
-+ std::vector< css::beans::PropertyValue > props;
-+ controlGeneralInfo.ImportToolBarControlData( props );
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
-+ aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
-+/*
-+ // Style this specifies whether ICON, TEXT or ICON & TEXT is stored
-+ // 0, 1, 2 respecively for property 'Style'
-+
-+ beans::PropertyValue styleProp;
-+ // ToolBar specific only not much good for interop
-+ styleProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") );
-+
-+ if ( ( rHeader.getTbct() & 0x3 ) == 0x3 )
-+ styleProp.Value <<= sal_Int32( 2 );
-+ else if ( rHeader.getTbct() & 0x2 )
-+ styleProp.Value <<= sal_Int32( 0 );
-+ else
-+ styleProp.Value <<= sal_Int32( 1 );
-+
-+ props.push_back( styleProp );
-+*/
++ // cmtFci 0x1 Command based on a built-in command. See CidFci.
++ // cmtMacro 0x2 Macro command. See CidMacro.
++ // cmtAllocated 0x3 Allocated command. See CidAllocated.
++ // cmtNil 0x7 No command. See Cid.
+
-+ uno::Sequence< beans::PropertyValue > sProps( props.size() );
-+ beans::PropertyValue* pProp = sProps.getArray();
-+
-+
-+ rtl::OUString sCommand;
-+ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
++ if ( cid.get() )
+ {
-+ *pProp = *it;
-+ if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
-+ it->Value >>= sCommand;
-+ }
++ sal_uInt16 arg = ( *( cid.get() ) >> 16 );
++ sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
+
-+ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
++ sal_uInt8 cmt = ( arg2 & 0x7 );
++ arg2 = ( arg2 >> 3 );
+
-+ if ( rHeader.getTct() == 0x01
-+ || rHeader.getTct() == 0x10 )
-+ {
-+ TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
-+ if ( pSpecificInfo )
++ switch ( cmt )
+ {
-+ // if we have a icon then lets set it for the command ( but I
-+ // have a nasty suspicion the toolbar actually needs to be set
-+ // up ( and added ) before you can asssign an image :-/
-+ if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
-+ {
-+ BitmapEx aBitEx( pIcon->getBitMap() );
-+ if ( pSpecificInfo->getIconMask() )
-+ // according to the spec:
-+ // "the iconMask is white in all the areas in which the icon is
-+ // displayed as transparent and is black in all other areas."
-+
-+ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
-+
-+ Graphic aGraphic( aBitEx );
-+ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
-+ }
++ case 1:
++ OSL_TRACE("cmt is cmtFci builtin command");
++ break;
++ case 2:
++ OSL_TRACE("cmt is cmtMacro macro");
++ break;
++ case 3:
++ OSL_TRACE("cmt is cmtAllocated [???]");
++ break;
++ case 7:
++ OSL_TRACE("cmt is cmNill no-phing ");
++ break;
++ default:
++ OSL_TRACE("illegal 0x%x", cmt);
++ break;
+ }
++ OSL_TRACE(" reserved 0x%x", arg2 );
++ OSL_TRACE(" arg 0x%x", arg );
+ }
-+ return true; // just ignore
-+}
-+
-+void TBCData::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
-+ indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
-+ controlGeneralInfo.Print( fp );
-+ if ( rHeader.getTct() == 1 )
-+ {
-+ 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() );
-+ nOffSet = pS->Tell();
-+ sal_Int8 nChars = 0;
-+ *pS >> nChars;
-+ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
++ if ( tbcd.get() )
++ return tbcd->ImportToolBarControl( toolbarcontainer, helper );
+ return true;
+}
+
@@ -1374,863 +950,1383 @@
+ indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
+ indent_printf( fp, " %s", rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
+}
-+TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
++
++Tcg::Tcg() : nTcgVer( 255 )
+{
+}
+
-+bool
-+TBCExtraInfo::Read( SotStorageStream *pS )
++bool Tcg::Read(SotStorageStream *pS)
+{
-+ OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ if( !wstrHelpFile.Read( pS ) )
++ *pS >> nTcgVer;
++ if ( nTcgVer != (sal_Int8)255 )
+ return false;
++ tcg.reset( new Tcg255() );
++ return tcg->Read( pS );
++}
+
-+ *pS >> idHelpContext;
-+
-+ if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
-+ return false;
-+
-+ *pS >> tbcu >> tbmg;
-+ return true;
++void Tcg::Print( FILE* fp )
++{
++ INDENT_INIT;
++ indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
++ indent_printf(fp," nTcgVer %d\n", nTcgVer);
++ tcg->Print( fp );
+}
+
-+void
-+TBCExtraInfo::Print( FILE* fp )
++bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " wstrHelpFile %s\n",
-+ rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ 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() );
-+ indent_printf( fp, " wstrOnAction %s\n",
-+ rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " wstrParam %s\n",
-+ rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tbcu 0x%x\n", tbcu );
-+ indent_printf( fp, " tbmg 0x%x\n", tbmg );
-+
++ return tcg->ImportCustomToolBar( rxModel );
+}
+
-+rtl::OUString
-+TBCExtraInfo::getOnAction()
++Tcg255::Tcg255()
+{
-+ return wstrOnAction.getString();
+}
+
-+TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
++Tcg255::~Tcg255()
+{
++ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
++ for ( ; it != rgtcgData.end(); ++it )
++ delete *it;
+}
+
-+bool TBCGeneralInfo::Read( SotStorageStream *pS )
++bool Tcg255::processSubStruct( sal_uInt8 nId, SotStorageStream *pS )
+{
-+ OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
-+
-+ 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 ) )
++ Tcg255SubStruct* pSubStruct = NULL;
++ switch ( nId )
++ {
++ case 0x1:
++ {
++ pSubStruct = new PlfMcd( false ); // don't read the id
++ break;
++ }
++ case 0x2:
++ {
++ pSubStruct = new PlfAcd( false );
++ break;
++ }
++ case 0x3:
++ case 0x4:
++ {
++ pSubStruct = new PlfKme( false );
++ break;
++ }
++ case 0x10:
++ {
++ pSubStruct = new TcgSttbf( false );
++ break;
++ }
++ case 0x11:
++ {
++ pSubStruct = new MacroNames( false );
++ break;
++ }
++ case 0x12:
++ {
++ pSubStruct = new CTBWrapper( false );
++ break;
++ }
++ default:
++ OSL_TRACE("Unknown id 0x%x",nId);
++ return false;
++ }
++ pSubStruct->ch = nId;
++ if ( !pSubStruct->Read( pS ) )
+ return false;
++ rgtcgData.push_back( pSubStruct );
+ return true;
+}
+
-+void
-+TBCGeneralInfo::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ indent_printf( fp, " customText %s\n",
-+ rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " description %s\n",
-+ rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ indent_printf( fp, " tooltip %s\n",
-+ rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
-+ if ( bFlags & 0x4 )
-+ extraInfo.Print( fp );
-+}
-+
-+bool
-+TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
++bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
+{
-+ if ( ( bFlags & 0x5 ) )
++ // Find the CTBWrapper
++ for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
+ {
-+ beans::PropertyValue aProp;
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
-+ aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
-+ aProp.Value = uno::makeAny( customText.getString() );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
-+ aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
-+ sControlData.push_back( aProp );
-+
-+ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
-+ aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
-+ sControlData.push_back( aProp );
-+
-+ // #TODO find out what is the property for tooltip?
-+ sControlData.push_back( aProp );
-+/*
-+aToolbarItem(0).Name = "CommandURL" wstrOnAction
-+aToolbarItem(0).Value = Command
-+aToolbarItem(1).Name = "Label" customText
-+aToolbarItem(1).Value = Label
-+aToolbarItem(2).Name = "Type"
-+aToolbarItem(2).Value = 0
-+aToolbarItem(3).Name = "Visible"
-+aToolbarItem(3).Value = true
-+*/
++ if ( (*it)->id() == 0x12 )
++ {
++ // not so great, shouldn't really have to do a horror casting
++ CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
++ if ( pCTBWrapper )
++ {
++ if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
++ return false;
++ }
++ }
+ }
+ return true;
+}
+
-+TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
-+{
-+}
+
-+bool
-+TBCMenuSpecific::Read( SotStorageStream *pS)
++bool Tcg255::Read(SotStorageStream *pS)
+{
-+ OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> tbid;
-+ if ( tbid == 1 )
++ sal_uInt8 nId = 0; //
++ *pS >> nId;
++ while ( nId != 0x40 )
+ {
-+ name.reset( new WString() );
-+ return name->Read( pS );
-+ }
++ if ( !processSubStruct( nId, pS ) )
++ return false;
++ *pS >> nId;
++ }
+ return true;
++ // Peek at
+}
+
-+void
-+TBCMenuSpecific::Print( FILE* fp )
++void Tcg255::Print( FILE* fp)
+{
+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
-+ 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() );
-+
++ indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
++ 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 )
++ {
++ INDENT;
++ indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
++ (*it)->Print(fp);
++ }
+}
+
-+TBCBSpecific::TBCBSpecific() : bFlags( 0 )
++
++Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
+{
+}
+
-+bool TBCBSpecific::Read( SotStorageStream *pS)
++bool Tcg255SubStruct::Read(SotStorageStream *pS)
+{
-+ OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> bFlags;
++ if ( mbReadId )
++ *pS >> ch;
++ return true;
++}
+
-+ // bFlags determines what we read next
++PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
++{
++}
++PlfMcd::~PlfMcd()
++{
++ if ( rgmcd )
++ delete[] rgmcd;
++}
+
-+ // bFlags.fCustomBitmap = 1 ( 0x8 ) set
-+ if ( bFlags & 0x8 )
-+ {
-+ icon.reset( new TBCBitMap() );
-+ iconMask.reset( new TBCBitMap() );
-+ if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
-+ return false;
-+ }
-+ // if bFlags.fCustomBtnFace = 1 ( 0x10 )
-+ if ( bFlags & 0x10 )
-+ {
-+ iBtnFace.reset( new sal_uInt16 );
-+ *pS >> *iBtnFace.get();
-+ }
-+ // if bFlags.fAccelerator equals 1 ( 0x04 )
-+ if ( bFlags & 0x04 )
-+ {
-+ wstrAcc.reset( new WString() );
-+ return wstrAcc->Read( pS );
++bool PlfMcd::Read(SotStorageStream *pS)
++{
++ OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ Tcg255SubStruct::Read( pS );
++ *pS >> iMac;
++ if ( iMac )
++ {
++ rgmcd = new MCD[ iMac ];
++ for ( sal_Int32 index = 0; index < iMac; ++index )
++ {
++ if ( !rgmcd[ index ].Read( pS ) )
++ return false;
++ }
+ }
+ return true;
+}
+
-+
-+void TBCBSpecific::Print( FILE* fp )
++void PlfMcd::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
-+ indent_printf( fp, " bFlags 0x%x\n", bFlags );
-+ bool bResult = ( icon.get() != NULL );
-+ indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
-+ if ( bResult )
++ indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
++ indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
++ for ( sal_Int32 count=0; count < iMac; ++count )
+ {
+ INDENT;
-+ indent_printf( fp, " icon: \n");
-+ icon->Print( fp ); // will dump size
-+ }
-+ bResult = ( iconMask.get() != NULL );
-+ 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() )
-+ {
-+ indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
++ indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
++ rgmcd[ count ].Print( fp );
+ }
-+ bResult = ( wstrAcc.get() != NULL );
-+ indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
++
+}
+
-+TBCBitMap*
-+TBCBSpecific::getIcon()
++PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
++,iMac(0)
++,rgacd(NULL)
+{
-+ return icon.get();
+}
+
-+TBCBitMap*
-+TBCBSpecific::getIconMask()
-+{
-+ return iconMask.get();
-+}
+
-+TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
++PlfAcd::~PlfAcd()
+{
-+ if ( header.getTcID() == 0x01 )
-+ data.reset( new TBCCDData() );
++ if ( rgacd )
++ delete[] rgacd;
+}
+
-+bool TBCComboDropdownSpecific::Read( SotStorageStream *pS)
++bool PlfAcd::Read( SotStorageStream *pS)
+{
++ OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ if ( data.get() )
-+ return data->Read( pS );
++ Tcg255SubStruct::Read( pS );
++ *pS >> iMac;
++ if ( iMac )
++ {
++ rgacd = new Acd[ iMac ];
++ for ( sal_Int32 index = 0; index < iMac; ++index )
++ {
++ if ( !rgacd[ index ].Read( pS ) )
++ return false;
++ }
++ }
+ return true;
+}
-+
-+void TBCComboDropdownSpecific::Print( FILE* fp)
++void PlfAcd::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
-+ if ( data.get() )
-+ data->Print( fp );
-+ else
-+ indent_printf(fp," no data " );
++ indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
++ indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
++ for ( sal_Int32 count=0; count < iMac; ++count )
++ {
++ INDENT;
++ indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
++ rgacd[ count ].Print( fp );
++ }
++
+}
+
-+TBCCDData::TBCCDData() : cwstrItems( 0 )
-+,iSel( 0 )
-+,cLines( 0 )
-+,dxWidth( 0 )
++PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
++,iMac( 0 )
++,rgkme( NULL )
+{
+}
+
-+TBCCDData::~TBCCDData()
++PlfKme::~PlfKme()
+{
++ if ( rgkme )
++ delete[] rgkme;
+}
+
-+bool TBCCDData::Read( SotStorageStream *pS)
++bool PlfKme::Read(SotStorageStream *pS)
+{
++ OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> cwstrItems;
-+ if ( cwstrItems )
++ Tcg255SubStruct::Read( pS );
++ *pS >> iMac;
++ if ( iMac )
+ {
-+ for( sal_Int32 index=0; index < cwstrItems; ++index )
++ rgkme = new Kme[ iMac ];
++ for( sal_Int32 index=0; index<iMac; ++index )
+ {
-+ WString aString;
-+ if ( !aString.Read( pS ) )
++ if ( !rgkme[ index ].Read( pS ) )
+ return false;
-+ wstrList.push_back( aString );
-+ }
++ }
+ }
-+ *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
-+
-+ return wstrEdit.Read( pS );
++ return true;
+}
-+
-+void TBCCDData::Print( FILE* fp)
++
++void PlfKme::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
-+ indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems);
-+ for ( sal_Int32 index=0; index < cwstrItems; ++index )
++ indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
++ indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
++ for ( sal_Int32 count=0; count < iMac; ++count )
+ {
+ INDENT;
-+ indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
++ rgkme[ count ].Print( fp );
+ }
-+ 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 ), size( 0 )
++TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
+{
+}
+
-+TBCBitMap::~TBCBitMap()
++bool TcgSttbf::Read( SotStorageStream *pS)
++{
++ OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ Tcg255SubStruct::Read( pS );
++ return sttbf.Read( pS );
++}
++
++void TcgSttbf::Print( FILE* fp )
+{
++ INDENT;
++ indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
++ sttbf.Print( fp );
+}
+
-+// #FIXME Const-ness
-+Bitmap&
-+TBCBitMap::getBitMap()
++TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
++,cData( 0 )
++,cbExtra( 0 )
++,dataItems( NULL )
+{
-+ return mBitMap;
+}
+
-+bool TBCBitMap::Read( SotStorageStream* pS)
++TcgSttbfCore::~TcgSttbfCore()
+{
-+ OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
++ if ( dataItems )
++ delete[] dataItems;
++}
++
++bool TcgSttbfCore::Read( SotStorageStream* pS )
++{
++ OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> cbDIB;
-+ // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
-+ return mBitMap.Read( *pS, FALSE );
++ *pS >> fExtend >> cData >> cbExtra;
++ if ( cData )
++ {
++ dataItems = new SBBItem[ cData ];
++ for ( sal_Int32 index = 0; index < cData; ++index )
++ {
++ *pS >> dataItems[ index ].cchData;
++ dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
++ *pS >> dataItems[ index ].extraData;
++ }
++ }
++ return true;
+}
+
-+void TBCBitMap::Print( FILE* fp )
++void TcgSttbfCore::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
-+ indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
++ indent_printf( fp, "[ 0x%x ] 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 )
++ 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 );
++ }
++
++}
++MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
++,iMac( 0 )
++,rgNames( NULL )
++{
+}
+
-+Tcg::Tcg() : nTcgVer( 255 )
++MacroNames::~MacroNames()
+{
++ if ( rgNames )
++ delete[] rgNames;
+}
+
-+bool Tcg::Read(SotStorageStream *pS)
++bool MacroNames::Read( SotStorageStream *pS)
+{
-+ OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> nTcgVer;
-+ if ( nTcgVer != (sal_Int8)255 )
-+ return false;
-+ tcg.reset( new Tcg255() );
-+ return tcg->Read( pS );
++ Tcg255SubStruct::Read( pS );
++ *pS >> iMac;
++ if ( iMac )
++ {
++ rgNames = new MacroName[ iMac ];
++ for ( sal_Int32 index = 0; index < iMac; ++index )
++ {
++ if ( !rgNames[ index ].Read( pS ) )
++ return false;
++ }
++ }
++ return true;
+}
+
-+void Tcg::Print( FILE* fp )
++void MacroNames::Print( FILE* fp )
+{
-+ INDENT_INIT;
-+ indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
-+ indent_printf(fp," nTcgVer %d\n", nTcgVer);
-+ tcg->Print( fp );
++ INDENT;
++ indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
++ indent_printf(fp, " contains %d MacroName records\n", iMac );
++ for ( sal_Int32 count=0; count < iMac; ++count )
++ {
++ INDENT;
++ indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
++ rgNames[ count ].Print( fp );
++ }
++
+}
+
-+bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
++MacroName::MacroName():ibst(0)
+{
-+ return tcg->ImportCustomToolBar( rxModel );
+}
+
-+Tcg255::Tcg255()
++
++bool MacroName::Read(SotStorageStream *pS)
+{
++ OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ *pS >> ibst;
++ return xstz.Read( pS );
+}
+
-+Tcg255::~Tcg255()
++void MacroName::Print( FILE* fp )
+{
-+ std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
-+ for ( ; it != rgtcgData.end(); ++it )
-+ delete *it;
++ INDENT;
++ indent_printf( fp, "[ 0x%x ] MacroName - dump");
++ indent_printf( fp," index - 0x%x has associated following record\n", ibst );
++ xstz.Print( fp );
+}
+
-+bool Tcg255::processSubStruct( sal_uInt8 nId, SotStorageStream *pS )
++
++
++Xstz::Xstz():chTerm(0)
+{
-+ Tcg255SubStruct* pSubStruct = NULL;
-+ switch ( nId )
-+ {
-+ case 0x1:
-+ {
-+ pSubStruct = new PlfMcd( false ); // don't read the id
-+ break;
-+ }
-+ case 0x2:
-+ {
-+ pSubStruct = new PlfAcd( false );
-+ break;
-+ }
-+ case 0x3:
-+ case 0x4:
-+ {
-+ pSubStruct = new PlfKme( false );
-+ break;
-+ }
-+ case 0x10:
-+ {
-+ pSubStruct = new TcgSttbf( false );
-+ break;
-+ }
-+ case 0x11:
-+ {
-+ pSubStruct = new MacroNames( false );
-+ break;
-+ }
-+ case 0x12:
-+ {
-+ pSubStruct = new CTBWrapper( false );
-+ break;
-+ }
-+ default:
-+ OSL_TRACE("Unknown id 0x%x",nId);
-+ return false;
++}
++
++bool
++Xstz::Read(SotStorageStream *pS)
++{
++ OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ if ( !xst.Read( pS ) )
++ return false;
++ *pS >> chTerm;
++ if ( chTerm != 0 ) // should be an assert
++ return false;
++ return true;
++}
++
++void Xstz::Print( FILE* fp )
++{
++ INDENT;
++ indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
++ indent_printf(fp," Xst\n");
++ xst.Print( fp );
++ indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
++}
++
++Kme::Kme() : reserved1(0)
++,reserved2(0)
++,kcm1(0)
++,kcm2(0)
++,kt(0)
++,param(0)
++{
++}
++
++Kme::~Kme()
++{
++}
++
++bool
++Kme::Read(SotStorageStream *pS)
++{
++ OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
++ return true;
++}
++
++void Kme::Print( FILE* fp )
++{
++ INDENT;
++
++ indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
++ 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 )
++, fciBasedOnABC( 0 )
++{
++}
++
++bool Acd::Read(SotStorageStream *pS)
++{
++ OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ *pS >> ibst >> fciBasedOnABC;
++ return true;
++}
++
++void Acd::Print( FILE* fp )
++{
++ INDENT;
++ indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
++ // #TODO flesh out interpretation of these values
++ indent_printf( fp," ibst 0x%x\n", ibst);
++ indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
++}
++
++MCD::MCD() : reserved1(0x56)
++,reserved2( 0 )
++,ibst( 0 )
++,ibstName( 0 )
++,reserved3( 0xFFFF )
++,reserved4( 0 )
++,reserved5( 0 )
++,reserved6( 0 )
++,reserved7( 0 )
++{
++}
++
++bool MCD::Read(SotStorageStream *pS)
++{
++ OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
++ *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
++ return true;
++}
++
++void MCD::Print( FILE* fp )
++{
++ INDENT;
++ indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
++ 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 ) );
++}
++
+--- /dev/null 2008-12-03 05:56:56.000000000 +0000
++++ svx/inc/svx/mstoolbar.hxx 2009-02-04 18:01:38.000000000 +0000
+@@ -0,0 +1,253 @@
++#ifndef _MSTOOLBAR_HXX
++#define _MSTOOLBAR_HXX
++#include "svx/svxdllapi.h"
++#include <tools/string.hxx>
++#include <sot/storage.hxx>
++#include <ostream>
++#include <memory>
++#include <vector>
++#include <boost/shared_ptr.hpp>
++#include <com/sun/star/frame/XModel.hpp>
++#include <com/sun/star/container/XIndexContainer.hpp>
++#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
++#include <com/sun/star/graphic/XGraphic.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <vcl/bitmap.hxx>
++
++namespace css = ::com::sun::star;
++
++class TBCHeader;
++
++class SVX_DLLPUBLIC CustomToolBarImportHelper
++{
++ struct iconcontrolitem
++ {
++ rtl::OUString sCommand;
++ css::uno::Reference< css::graphic::XGraphic > image;
++ };
++ std::vector< iconcontrolitem > iconcommands;
++
++ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
++public:
++ CustomToolBarImportHelper( const css::uno::Reference< css::frame::XModel >& rxModel );
++
++ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
++
++ static css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
++
++ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
++ void applyIcons();
++};
++
++class SVX_DLLPUBLIC TBBase
++{
++friend class Indent;
++ static int nIndent; // num spaces to indent before printing
++protected:
++ void indent_printf(FILE* fp, const char* format, ... );
++ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
++public:
++ TBBase() : nOffSet( 0 ) {}
++ virtual ~TBBase(){}
++ rtl::OUString readUnicodeString( SotStorageStream* pS, sal_Int32 nChars );
++
++ 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; }
++};
++
++
++#define INDENT_INIT Indent a(true);
++#define INDENT Indent a;
++
++class SVX_DLLPUBLIC WString : public TBBase
++{
++ rtl::OUString sString;
++
++public:
++ WString(){};
++ ~WString(){};
++ bool Read(SotStorageStream *pS);
++ rtl::OUString getString(){ return sString; }
++};
++
++class SVX_DLLPUBLIC TBCExtraInfo : public TBBase
++{
++ WString wstrHelpFile;
++ sal_Int32 idHelpContext;
++ WString wstrTag;
++ WString wstrOnAction;
++ WString wstrParam;
++ sal_Int8 tbcu;
++ sal_Int8 tbmg;
++
++ TBCExtraInfo(const TBCExtraInfo&);
++ TBCExtraInfo& operator = ( const TBCExtraInfo&);
++public:
++ TBCExtraInfo();
++ ~TBCExtraInfo(){}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ rtl::OUString getOnAction();
++};
++
++class SVX_DLLPUBLIC TBCGeneralInfo : public TBBase
++{
++ sal_uInt8 bFlags;
++ WString customText;
++ WString descriptionText;
++ WString tooltip;
++ TBCExtraInfo extraInfo;
++
++public:
++ TBCGeneralInfo();
++ ~TBCGeneralInfo() {}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
++};
++
++class SVX_DLLPUBLIC TBCBitMap : public TBBase
++{
++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;
++ Bitmap mBitMap;
++ int size;
++public:
++ TBCBitMap();
++ ~TBCBitMap();
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ Bitmap& getBitMap();
++};
++
++class SVX_DLLPUBLIC TBCMenuSpecific : public TBBase
++{
++ sal_Int32 tbid;
++ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
++public:
++ TBCMenuSpecific();
++ ~TBCMenuSpecific(){}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++};
++
++class SVX_DLLPUBLIC TBCCDData : public TBBase
++{
++ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
++ std::vector< 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.
++
++public:
++ TBCCDData();
++ ~TBCCDData();
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++};
++
++class TBCComboDropdownSpecific : public TBBase
++{
++ boost::shared_ptr< TBCCDData > data;
++public:
++ TBCComboDropdownSpecific( const TBCHeader& header );
++ TBCComboDropdownSpecific(){}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++};
++
++class TBCBSpecific : public TBBase
++{
++ sal_uInt8 bFlags;
++ boost::shared_ptr< TBCBitMap > icon; // optional
++ boost::shared_ptr< TBCBitMap > iconMask; // optional
++ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
++ boost::shared_ptr< WString > wstrAcc; // optional
++
++public:
++ TBCBSpecific();
++ ~TBCBSpecific(){}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ TBCBitMap* getIcon();
++ TBCBitMap* getIconMask();
++};
++
++/* TBCHeader.tct controlSpecificInfo type
++
++0x01 (Button control) TBCBSpecific
++0x10 (ExpandingGrid control) TBCBSpecific
++0x0A (Popup control) TBCMenuSpecific
++0x0C (ButtonPopup control) TBCMenuSpecific
++0x0D (SplitButtonPopup control) TBCMenuSpecific
++0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
++0x02 (Edit control) TBCComboDropdow nSpecific
++0x04 (ComboBox control) TBCComboDropdow nSpecific
++0x14 (GraphicCombo control) TBCComboDropdow nSpecific
++0x03 (DropDown control) TBCComboDropdow nSpecific
++0x06 (SplitDropDown control) TBCComboDropdow nSpecific
++0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
++0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
++0x0F (Label control) controlSpecificInfo MUST NOT exist
++0x12 (Grid control) controlSpecificInfo MUST NOT exist
++0x13 (Gauge control) controlSpecificInfo MUST NOT exist
++0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
++
++*/
++class SVX_DLLPUBLIC TBCHeader : public TBBase
++{
++ sal_Int8 bSignature;
++ sal_Int8 bVersion;
++ sal_uInt8 bFlagsTCR;
++ sal_uInt8 tct;
++ sal_uInt16 tcid;
++ sal_uInt32 tbct;
++ sal_uInt8 bPriority;
++ boost::shared_ptr< sal_uInt16 > width; //optional
++ boost::shared_ptr< sal_uInt16 > height; //optional
++
++public:
++ TBCHeader();
++ ~TBCHeader();
++ sal_uInt8 getTct() const { return tct; }
++ sal_uInt16 getTcID() const { return tcid; }
++ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ sal_uInt32 getTbct() { return tbct; };
++};
++
++class SVX_DLLPUBLIC TBCData : public TBBase
++{
++ TBCHeader rHeader;
++ TBCGeneralInfo controlGeneralInfo;
++ boost::shared_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:
++ TBCData( const TBCHeader& Header );
++ ~TBCData(){}
++ bool Read(SotStorageStream *pS);
++ void Print( FILE* );
++ bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
++};
++
++#endif
+--- /dev/null 2008-12-03 05:56:56.000000000 +0000
++++ svx/source/msfilter/mstoolbar.cxx 2009-02-04 17:55:03.000000000 +0000
+@@ -0,0 +1,587 @@
++#include <svx/mstoolbar.hxx>
++#include <rtl/ustrbuf.hxx>
++#include <stdarg.h>
++#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
++#include <com/sun/star/ui/XImageManager.hpp>
++#include <com/sun/star/ui/ItemType.hpp>
++#include <fstream>
++#include <vcl/graph.hxx>
++#include <vcl/bitmapex.hxx>
++int TBBase::nIndent = 0;
++
++using namespace com::sun::star;
++
++void CustomToolBarImportHelper::applyIcons()
++{
++ for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
++ {
++ uno::Sequence< rtl::OUString > commands(1);
++ commands[ 0 ] = it->sCommand;
++ uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
++ images[ 0 ] = it->image;
++
++ uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
++ xImageManager->insertImages( 1, commands, images );
+ }
-+ pSubStruct->ch = nId;
-+ if ( !pSubStruct->Read( pS ) )
-+ return false;
-+ rgtcgData.push_back( pSubStruct );
-+ return true;
+}
+
-+bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
++void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
+{
-+ // Find the CTBWrapper
-+ for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
++ iconcontrolitem item;
++ item.sCommand = sString;
++ item.image = xImage;
++ iconcommands.push_back( item );
++}
++
++CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel )
++{
++ m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
++}
++
++uno::Reference< ui::XUIConfigurationManager >
++CustomToolBarImportHelper::getCfgManager()
++{
++ return m_xCfgSupp->getUIConfigurationManager();
++}
++
++uno::Any
++CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
++{
++//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
++ static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
++ static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
++ // create script url
++ rtl::OUString scriptURL = part1 + sCmd + part2;
++ return uno::makeAny( scriptURL );
++}
++
++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 TBBase::readUnicodeString( SotStorageStream* pS, sal_Int32 nChars )
++{
++ rtl::OUStringBuffer buf(40);
++ for ( sal_Int32 index = 0; index < nChars; ++index )
+ {
-+ if ( (*it)->id() == 0x12 )
-+ {
-+ // not so great, shouldn't really have to do a horror casting
-+ CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
-+ if ( pCTBWrapper )
-+ {
-+ if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
-+ return false;
-+ }
-+ }
++ sal_uInt16 ch = 0;
++ *pS >> ch;
++ sal_Unicode uni = static_cast< sal_Unicode >( ch );
++ buf.append( &uni, 1 );
++ }
++ return buf.makeStringAndClear();
++}
++
++TBCHeader::TBCHeader() : bSignature( 0x3 )
++,bVersion( 0x01 )
++,bFlagsTCR( 0 )
++,tct(0x1) // default to Button
++,tcid(0)
++,tbct(0)
++{
++}
++
++
++TBCHeader::~TBCHeader()
++{
++}
++
++bool TBCHeader::Read( SotStorageStream* pS )
++{
++ OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
++ nOffSet = pS->Tell();
++ *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
++ // bit 4 ( from lsb )
++ if ( bFlagsTCR & 0x10 )
++ {
++ width.reset( new sal_uInt16 );
++ height.reset( new sal_uInt16 );
++ *pS >> *width >> *height;
+ }
+ return true;
+}
+
++void TBCHeader::Print( FILE* fp )
++{
++ INDENT;
++ indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
++ 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.get() )
++ indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
++ if ( height.get() )
++ indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
++}
++
++TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
++{
++}
+
-+bool Tcg255::Read(SotStorageStream *pS)
++bool TBCData::Read(SotStorageStream *pS)
+{
-+ OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ sal_uInt8 nId = 0; //
-+ *pS >> nId;
-+ while ( nId != 0x40 )
++ if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
++ return false;
++ switch ( rHeader.getTct() )
+ {
-+ if ( !processSubStruct( nId, pS ) )
-+ return false;
-+ *pS >> nId;
-+ }
++ 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;
-+ // Peek at
++
++ OSL_TRACE("#FIXME I need to be able to handle different controlSpecificInfo types.");
++ return false;
++}
++
++bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
++{
++ std::vector< css::beans::PropertyValue > props;
++ controlGeneralInfo.ImportToolBarControlData( props );
++ beans::PropertyValue aProp;
++ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
++ aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
++/*
++ // Style this specifies whether ICON, TEXT or ICON & TEXT is stored
++ // 0, 1, 2 respecively for property 'Style'
++
++ beans::PropertyValue styleProp;
++ // ToolBar specific only not much good for interop
++ styleProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Style") );
++
++ if ( ( rHeader.getTbct() & 0x3 ) == 0x3 )
++ styleProp.Value <<= sal_Int32( 2 );
++ else if ( rHeader.getTbct() & 0x2 )
++ styleProp.Value <<= sal_Int32( 0 );
++ else
++ styleProp.Value <<= sal_Int32( 1 );
++
++ props.push_back( styleProp );
++*/
++
++ uno::Sequence< beans::PropertyValue > sProps( props.size() );
++ beans::PropertyValue* pProp = sProps.getArray();
++
++
++ rtl::OUString sCommand;
++ for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
++ {
++ *pProp = *it;
++ if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
++ it->Value >>= sCommand;
++ }
++
++ toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
++
++ if ( rHeader.getTct() == 0x01
++ || rHeader.getTct() == 0x10 )
++ {
++ TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
++ if ( pSpecificInfo )
++ {
++ // if we have a icon then lets set it for the command ( but I
++ // have a nasty suspicion the toolbar actually needs to be set
++ // up ( and added ) before you can asssign an image :-/
++ if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
++ {
++ BitmapEx aBitEx( pIcon->getBitMap() );
++ if ( pSpecificInfo->getIconMask() )
++ // according to the spec:
++ // "the iconMask is white in all the areas in which the icon is
++ // displayed as transparent and is black in all other areas."
++
++ aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
++
++ Graphic aGraphic( aBitEx );
++ helper.addIcon( aGraphic.GetXGraphic(), sCommand );
++ }
++ }
++ }
++ return true; // just ignore
+}
+
-+void Tcg255::Print( FILE* fp)
++void TBCData::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
-+ 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 )
++ indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
++ indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
++ controlGeneralInfo.Print( fp );
++ if ( rHeader.getTct() == 1 )
+ {
-+ INDENT;
-+ indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
-+ (*it)->Print(fp);
++ indent_printf(fp," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
++ controlSpecificInfo->Print( fp );
+ }
+}
+
-+
-+Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
-+{
-+}
-+
-+bool Tcg255SubStruct::Read(SotStorageStream *pS)
++bool
++WString::Read( SotStorageStream *pS )
+{
-+ OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ if ( mbReadId )
-+ *pS >> ch;
++ sal_Int8 nChars = 0;
++ *pS >> nChars;
++ sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
+ return true;
+}
+
-+PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
-+{
-+}
-+PlfMcd::~PlfMcd()
++TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
+{
-+ if ( rgmcd )
-+ delete[] rgmcd;
+}
+
-+bool PlfMcd::Read(SotStorageStream *pS)
++bool
++TBCExtraInfo::Read( SotStorageStream *pS )
+{
-+ OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgmcd = new MCD[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgmcd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
-+ return true;
-+}
-+
-+void PlfMcd::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
-+ rgmcd[ count ].Print( fp );
-+ }
-+
-+}
-+
-+PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac(0)
-+,rgacd(NULL)
-+{
-+}
++ if( !wstrHelpFile.Read( pS ) )
++ return false;
+
++ *pS >> idHelpContext;
+
-+PlfAcd::~PlfAcd()
-+{
-+ if ( rgacd )
-+ delete[] rgacd;
-+}
++ if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
++ return false;
+
-+bool PlfAcd::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgacd = new Acd[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgacd[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
++ *pS >> tbcu >> tbmg;
+ return true;
+}
-+void PlfAcd::Print( FILE* fp )
++
++void
++TBCExtraInfo::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
-+ rgacd[ count ].Print( fp );
-+ }
++ indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
++ indent_printf( fp, " wstrHelpFile %s\n",
++ rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ 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() );
++ indent_printf( fp, " wstrOnAction %s\n",
++ rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ indent_printf( fp, " wstrParam %s\n",
++ rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ indent_printf( fp, " tbcu 0x%x\n", tbcu );
++ indent_printf( fp, " tbmg 0x%x\n", tbmg );
+
+}
+
-+PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgkme( NULL )
++rtl::OUString
++TBCExtraInfo::getOnAction()
+{
++ return wstrOnAction.getString();
+}
+
-+PlfKme::~PlfKme()
++TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
+{
-+ if ( rgkme )
-+ delete[] rgkme;
+}
+
-+bool PlfKme::Read(SotStorageStream *pS)
++bool TBCGeneralInfo::Read( SotStorageStream *pS )
+{
-+ OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
-+ {
-+ rgkme = new Kme[ iMac ];
-+ for( sal_Int32 index=0; index<iMac; ++index )
-+ {
-+ if ( !rgkme[ index ].Read( pS ) )
-+ return false;
-+ }
-+ }
++ *pS >> bFlags;
++
++ 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;
+}
-+
-+void PlfKme::Print( FILE* fp )
++
++void
++TBCGeneralInfo::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
-+ indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
-+ {
-+ INDENT;
-+ indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
-+ rgkme[ count ].Print( fp );
-+ }
-+
++ indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
++ indent_printf( fp, " bFlags 0x%x\n", bFlags );
++ indent_printf( fp, " customText %s\n",
++ rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ indent_printf( fp, " description %s\n",
++ rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ indent_printf( fp, " tooltip %s\n",
++ rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
++ if ( bFlags & 0x4 )
++ extraInfo.Print( fp );
+}
+
-+TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
++bool
++TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
+{
-+}
++ if ( ( bFlags & 0x5 ) )
++ {
++ beans::PropertyValue aProp;
++ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
++ aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
++ sControlData.push_back( aProp );
+
-+bool TcgSttbf::Read( SotStorageStream *pS)
-+{
-+ OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ return sttbf.Read( pS );
-+}
++ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
++ aProp.Value = uno::makeAny( customText.getString() );
++ sControlData.push_back( aProp );
+
-+void TcgSttbf::Print( FILE* fp )
-+{
-+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
-+ sttbf.Print( fp );
-+}
++ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
++ aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
++ sControlData.push_back( aProp );
+
-+TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
-+,cData( 0 )
-+,cbExtra( 0 )
-+,dataItems( NULL )
-+{
++ aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
++ aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
++ sControlData.push_back( aProp );
++
++ // #TODO find out what is the property for tooltip?
++ sControlData.push_back( aProp );
++/*
++aToolbarItem(0).Name = "CommandURL" wstrOnAction
++aToolbarItem(0).Value = Command
++aToolbarItem(1).Name = "Label" customText
++aToolbarItem(1).Value = Label
++aToolbarItem(2).Name = "Type"
++aToolbarItem(2).Value = 0
++aToolbarItem(3).Name = "Visible"
++aToolbarItem(3).Value = true
++*/
++ }
++ return true;
+}
+
-+TcgSttbfCore::~TcgSttbfCore()
++TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
+{
-+ if ( dataItems )
-+ delete[] dataItems;
+}
+
-+bool TcgSttbfCore::Read( SotStorageStream* pS )
++bool
++TBCMenuSpecific::Read( SotStorageStream *pS)
+{
-+ OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> fExtend >> cData >> cbExtra;
-+ if ( cData )
-+ {
-+ dataItems = new SBBItem[ cData ];
-+ for ( sal_Int32 index = 0; index < cData; ++index )
-+ {
-+ *pS >> dataItems[ index ].cchData;
-+ dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
-+ *pS >> dataItems[ index ].extraData;
-+ }
++ *pS >> tbid;
++ if ( tbid == 1 )
++ {
++ name.reset( new WString() );
++ return name->Read( pS );
+ }
+ return true;
+}
+
-+void TcgSttbfCore::Print( FILE* fp )
++void
++TBCMenuSpecific::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] 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 )
-+ 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 );
-+ }
++ indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
++ 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() );
+
+}
-+MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
-+,iMac( 0 )
-+,rgNames( NULL )
-+{
-+}
+
-+MacroNames::~MacroNames()
++TBCBSpecific::TBCBSpecific() : bFlags( 0 )
+{
-+ if ( rgNames )
-+ delete[] rgNames;
+}
+
-+bool MacroNames::Read( SotStorageStream *pS)
++bool TBCBSpecific::Read( SotStorageStream *pS)
+{
-+ OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ Tcg255SubStruct::Read( pS );
-+ *pS >> iMac;
-+ if ( iMac )
++ *pS >> bFlags;
++
++ // bFlags determines what we read next
++
++ // bFlags.fCustomBitmap = 1 ( 0x8 ) set
++ if ( bFlags & 0x8 )
+ {
-+ rgNames = new MacroName[ iMac ];
-+ for ( sal_Int32 index = 0; index < iMac; ++index )
-+ {
-+ if ( !rgNames[ index ].Read( pS ) )
-+ return false;
-+ }
++ icon.reset( new TBCBitMap() );
++ iconMask.reset( new TBCBitMap() );
++ if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
++ return false;
++ }
++ // if bFlags.fCustomBtnFace = 1 ( 0x10 )
++ if ( bFlags & 0x10 )
++ {
++ iBtnFace.reset( new sal_uInt16 );
++ *pS >> *iBtnFace.get();
++ }
++ // if bFlags.fAccelerator equals 1 ( 0x04 )
++ if ( bFlags & 0x04 )
++ {
++ wstrAcc.reset( new WString() );
++ return wstrAcc->Read( pS );
+ }
+ return true;
+}
+
-+void MacroNames::Print( FILE* fp )
++
++void TBCBSpecific::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
-+ indent_printf(fp, " contains %d MacroName records\n", iMac );
-+ for ( sal_Int32 count=0; count < iMac; ++count )
++ indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
++ indent_printf( fp, " bFlags 0x%x\n", bFlags );
++ bool bResult = ( icon.get() != NULL );
++ indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
++ if ( bResult )
+ {
+ INDENT;
-+ indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
-+ rgNames[ count ].Print( fp );
++ indent_printf( fp, " icon: \n");
++ icon->Print( fp ); // will dump size
+ }
-+
-+}
-+
-+MacroName::MacroName():ibst(0)
-+{
++ bResult = ( iconMask.get() != NULL );
++ 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() )
++ {
++ indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
++ }
++ bResult = ( wstrAcc.get() != NULL );
++ indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
+}
+
-+
-+bool MacroName::Read(SotStorageStream *pS)
++TBCBitMap*
++TBCBSpecific::getIcon()
+{
-+ OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst;
-+ return xstz.Read( pS );
++ return icon.get();
+}
+
-+void MacroName::Print( FILE* fp )
++TBCBitMap*
++TBCBSpecific::getIconMask()
+{
-+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] MacroName - dump");
-+ indent_printf( fp," index - 0x%x has associated following record\n", ibst );
-+ xstz.Print( fp );
++ return iconMask.get();
+}
+
-+
-+
-+Xstz::Xstz():chTerm(0)
++TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
+{
++ if ( header.getTcID() == 0x01 )
++ data.reset( new TBCCDData() );
+}
+
-+bool
-+Xstz::Read(SotStorageStream *pS)
++bool TBCComboDropdownSpecific::Read( SotStorageStream *pS)
+{
-+ OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ if ( !xst.Read( pS ) )
-+ return false;
-+ *pS >> chTerm;
-+ if ( chTerm != 0 ) // should be an assert
-+ return false;
++ if ( data.get() )
++ return data->Read( pS );
+ return true;
+}
+
-+void Xstz::Print( FILE* fp )
++void TBCComboDropdownSpecific::Print( FILE* fp)
+{
+ INDENT;
-+ indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
-+ indent_printf(fp," Xst\n");
-+ xst.Print( fp );
-+ indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
++ indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
++ if ( data.get() )
++ data->Print( fp );
++ else
++ indent_printf(fp," no data " );
+}
+
-+Kme::Kme() : reserved1(0)
-+,reserved2(0)
-+,kcm1(0)
-+,kcm2(0)
-+,kt(0)
-+,param(0)
++TBCCDData::TBCCDData() : cwstrItems( 0 )
++,iSel( 0 )
++,cLines( 0 )
++,dxWidth( 0 )
+{
+}
+
-+Kme::~Kme()
++TBCCDData::~TBCCDData()
+{
+}
+
-+bool
-+Kme::Read(SotStorageStream *pS)
++bool TBCCDData::Read( SotStorageStream *pS)
+{
-+ OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
-+ return true;
-+}
++ *pS >> cwstrItems;
++ if ( cwstrItems )
++ {
++ for( sal_Int32 index=0; index < cwstrItems; ++index )
++ {
++ WString aString;
++ if ( !aString.Read( pS ) )
++ return false;
++ wstrList.push_back( aString );
++ }
++ }
++ *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
+
-+void Kme::Print( FILE* fp )
-+{
-+ INDENT;
-+
-+ indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
-+ 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 ) );
++ return wstrEdit.Read( pS );
+}
+
-+Acd::Acd() : ibst( 0 )
-+, fciBasedOnABC( 0 )
++void TBCCDData::Print( FILE* fp)
+{
++ INDENT;
++ indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
++ 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() );
+}
+
-+bool Acd::Read(SotStorageStream *pS)
++TBCBitMap::TBCBitMap() : cbDIB( 0 ), pRestOfIt( NULL ), size( 0 )
+{
-+ OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
-+ nOffSet = pS->Tell();
-+ *pS >> ibst >> fciBasedOnABC;
-+ return true;
+}
+
-+void Acd::Print( FILE* fp )
++TBCBitMap::~TBCBitMap()
+{
-+ INDENT;
-+ indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
-+ // #TODO flesh out interpretation of these values
-+ indent_printf( fp," ibst 0x%x\n", ibst);
-+ indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
+}
+
-+MCD::MCD() : reserved1(0x56)
-+,reserved2( 0 )
-+,ibst( 0 )
-+,ibstName( 0 )
-+,reserved3( 0xFFFF )
-+,reserved4( 0 )
-+,reserved5( 0 )
-+,reserved6( 0 )
-+,reserved7( 0 )
++// #FIXME Const-ness
++Bitmap&
++TBCBitMap::getBitMap()
+{
++ return mBitMap;
+}
+
-+bool MCD::Read(SotStorageStream *pS)
++bool TBCBitMap::Read( SotStorageStream* pS)
+{
-+ OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
++ OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
+ nOffSet = pS->Tell();
-+ *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
-+ *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
-+ return true;
++ *pS >> cbDIB;
++ // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
++ return mBitMap.Read( *pS, FALSE );
+}
+
-+void MCD::Print( FILE* fp )
++void TBCBitMap::Print( FILE* fp )
+{
+ INDENT;
-+ indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
-+ 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 ) );
++ indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
++ indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
+}
-+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]