1 diff --git svx/inc/svx/mstoolbar.hxx svx/inc/svx/mstoolbar.hxx
5 +++ svx/inc/svx/mstoolbar.hxx
7 +#ifndef _MSTOOLBAR_HXX
8 +#define _MSTOOLBAR_HXX
9 +#include "svx/svxdllapi.h"
10 +#include <tools/string.hxx>
11 +#include <sot/storage.hxx>
15 +#include <boost/shared_ptr.hpp>
16 +#include <com/sun/star/frame/XModel.hpp>
17 +#include <com/sun/star/container/XIndexContainer.hpp>
18 +#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
19 +#include <com/sun/star/graphic/XGraphic.hpp>
20 +#include <com/sun/star/beans/XPropertySet.hpp>
21 +#include <vcl/bitmap.hxx>
23 +namespace css = ::com::sun::star;
28 +class MSOCommandConvertor
31 + virtual ~MSOCommandConvertor() {}
32 + virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
33 + virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
37 +class SVX_DLLPUBLIC CustomToolBarImportHelper
39 + struct iconcontrolitem
41 + rtl::OUString sCommand;
42 + css::uno::Reference< css::graphic::XGraphic > image;
44 + std::vector< iconcontrolitem > iconcommands;
45 + std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
46 + css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
47 + css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
50 + CustomToolBarImportHelper( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
52 + void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
53 + css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
54 + css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
57 + static css::uno::Any createCommandFromMacro( const rtl::OUString& sCmd );
59 + void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const rtl::OUString& sString );
61 + rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
62 + rtl::OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
65 +class SVX_DLLPUBLIC TBBase
68 + static int nIndent; // num spaces to indent before printing
70 + void indent_printf(FILE* fp, const char* format, ... );
71 + sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
73 + TBBase() : nOffSet( 0 ) {}
75 + rtl::OUString readUnicodeString( SvStream* pS, sal_Int32 nChars );
77 + virtual bool Read(SvStream *pS) = 0;
78 + virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
84 + Indent( bool binit = false )
89 + TBBase::nIndent = TBBase::nIndent + 2;
91 + ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
92 + void init() { TBBase::nIndent = 0; }
96 +class SVX_DLLPUBLIC WString : public TBBase
98 + rtl::OUString sString;
103 + bool Read(SvStream *pS);
104 + rtl::OUString getString(){ return sString; }
107 +class SVX_DLLPUBLIC TBCExtraInfo : public TBBase
109 + WString wstrHelpFile;
110 + sal_Int32 idHelpContext;
112 + WString wstrOnAction;
117 + TBCExtraInfo(const TBCExtraInfo&);
118 + TBCExtraInfo& operator = ( const TBCExtraInfo&);
122 + bool Read(SvStream *pS);
123 + void Print( FILE* );
124 + rtl::OUString getOnAction();
127 +class SVX_DLLPUBLIC TBCGeneralInfo : public TBBase
130 + WString customText;
131 + WString descriptionText;
133 + TBCExtraInfo extraInfo;
137 + ~TBCGeneralInfo() {}
138 + bool Read(SvStream *pS);
139 + void Print( FILE* );
140 + bool ImportToolBarControlData( std::vector< css::beans::PropertyValue >& );
143 +class SVX_DLLPUBLIC TBCBitMap : public TBBase
145 +friend class TBCBSpecific; // #FIXME hacky access, need to fix
152 + bool Read(SvStream *pS);
153 + void Print( FILE* );
154 + Bitmap& getBitMap();
157 +class SVX_DLLPUBLIC TBCMenuSpecific : public TBBase
160 + boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
163 + ~TBCMenuSpecific(){}
164 + bool Read(SvStream *pS);
165 + void Print( FILE* );
168 +class SVX_DLLPUBLIC TBCCDData : public TBBase
170 + sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
171 + std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
172 + sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
173 + 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.
174 + 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.
175 + 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.
176 + WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
181 + bool Read(SvStream *pS);
182 + void Print( FILE* );
185 +class TBCComboDropdownSpecific : public TBBase
187 + boost::shared_ptr< TBCCDData > data;
189 + TBCComboDropdownSpecific( const TBCHeader& header );
190 + TBCComboDropdownSpecific(){}
191 + bool Read(SvStream *pS);
192 + void Print( FILE* );
195 +class TBCBSpecific : public TBBase
198 + boost::shared_ptr< TBCBitMap > icon; // optional
199 + boost::shared_ptr< TBCBitMap > iconMask; // optional
200 + boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
201 + boost::shared_ptr< WString > wstrAcc; // optional
206 + bool Read(SvStream *pS);
207 + void Print( FILE* );
208 + // #TODO just add a getGraphic member here
209 + TBCBitMap* getIcon();
210 + TBCBitMap* getIconMask();
211 + sal_uInt16* getBtnFace() { return iBtnFace.get(); }
214 +/* TBCHeader.tct controlSpecificInfo type
216 +0x01 (Button control) TBCBSpecific
217 +0x10 (ExpandingGrid control) TBCBSpecific
218 +0x0A (Popup control) TBCMenuSpecific
219 +0x0C (ButtonPopup control) TBCMenuSpecific
220 +0x0D (SplitButtonPopup control) TBCMenuSpecific
221 +0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
222 +0x02 (Edit control) TBCComboDropdow nSpecific
223 +0x04 (ComboBox control) TBCComboDropdow nSpecific
224 +0x14 (GraphicCombo control) TBCComboDropdow nSpecific
225 +0x03 (DropDown control) TBCComboDropdow nSpecific
226 +0x06 (SplitDropDown control) TBCComboDropdow nSpecific
227 +0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
228 +0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
229 +0x0F (Label control) controlSpecificInfo MUST NOT exist
230 +0x12 (Grid control) controlSpecificInfo MUST NOT exist
231 +0x13 (Gauge control) controlSpecificInfo MUST NOT exist
232 +0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
235 +class SVX_DLLPUBLIC TBCHeader : public TBBase
237 + sal_Int8 bSignature;
239 + sal_uInt8 bFlagsTCR;
243 + sal_uInt8 bPriority;
244 + boost::shared_ptr< sal_uInt16 > width; //optional
245 + boost::shared_ptr< sal_uInt16 > height; //optional
250 + sal_uInt8 getTct() const { return tct; }
251 + sal_uInt16 getTcID() const { return tcid; }
252 + bool isVisible() { return !( bFlagsTCR & 0x1 ); }
253 + bool Read(SvStream *pS);
254 + void Print( FILE* );
255 + sal_uInt32 getTbct() { return tbct; };
258 +class SVX_DLLPUBLIC TBCData : public TBBase
261 + TBCGeneralInfo controlGeneralInfo;
262 + boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
263 + TBCData(const TBCData&);
264 + TBCData& operator = ( const TBCData&);
266 + TBCData( const TBCHeader& Header );
268 + bool Read(SvStream *pS);
269 + void Print( FILE* );
270 + bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
274 diff --git svx/prj/d.lst svx/prj/d.lst
275 index e32ec30..385a905 100644
278 @@ -655,5 +655,6 @@ mkdir: %_DEST%\inc%_EXT%\svx\sdr\table
279 ..\inc\svx\selectioncontroller.hxx %_DEST%\inc%_EXT%\svx\selectioncontroller.hxx
280 ..\inc\svx\helperhittest3d.hxx %_DEST%\inc%_EXT%\svx\helperhittest3d.hxx
281 ..\inc\svx\optimprove.hxx %_DEST%\inc%_EXT%\svx\optimprove.hxx
282 +..\inc\svx\mstoolbar.hxx %_DEST%\inc%_EXT%\svx\mstoolbar.hxx
284 ..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
285 diff --git svx/source/msfilter/makefile.mk svx/source/msfilter/makefile.mk
286 index 8db71d1..768bc0e 100644
287 --- svx/source/msfilter/makefile.mk
288 +++ svx/source/msfilter/makefile.mk
289 @@ -54,7 +54,8 @@ SLOFILES=\
290 $(SLO)$/msocximex.obj \
291 $(SLO)$/msashape3d.obj \
292 $(SLO)$/mscodec.obj \
293 - $(SLO)$/msfiltertracer.obj
294 + $(SLO)$/msfiltertracer.obj\
295 + $(SLO)$/mstoolbar.obj\
298 $(SLO)$/eschesdo.obj \
299 @@ -65,7 +66,8 @@ EXCEPTIONSFILES= \
300 $(SLO)$/msocximex.obj \
301 $(SLO)$/msoleexp.obj \
302 $(SLO)$/svxmsbas.obj \
303 - $(SLO)$/msfiltertracer.obj
304 + $(SLO)$/msfiltertracer.obj\
305 + $(SLO)$/mstoolbar.obj\
309 diff --git svx/source/msfilter/mstoolbar.cxx svx/source/msfilter/mstoolbar.cxx
311 index 0000000..cb1c4bf
313 +++ svx/source/msfilter/mstoolbar.cxx
315 +#include <svx/mstoolbar.hxx>
316 +#include <rtl/ustrbuf.hxx>
318 +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
319 +#include <com/sun/star/ui/XImageManager.hpp>
320 +#include <com/sun/star/ui/ItemType.hpp>
322 +#include <vcl/graph.hxx>
323 +#include <vcl/bitmapex.hxx>
326 +int TBBase::nIndent = 0;
328 +using namespace com::sun::star;
329 +void CustomToolBarImportHelper::applyIcons()
331 + for ( std::vector< iconcontrolitem >::iterator it = iconcommands.begin(); it != iconcommands.end(); ++it )
333 + uno::Sequence< rtl::OUString > commands(1);
334 + commands[ 0 ] = it->sCommand;
335 + uno::Sequence< uno::Reference< graphic::XGraphic > > images(1);
336 + images[ 0 ] = it->image;
338 + uno::Reference< ui::XImageManager > xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
339 + // 1 seems to work best for MSO images, otherwise they don't get displayed ( I guess the default size
340 + // in ooo is different )
341 + xImageManager->insertImages( 1, commands, images );
345 +void CustomToolBarImportHelper::addIcon( const uno::Reference< graphic::XGraphic >& xImage, const rtl::OUString& sString )
347 + iconcontrolitem item;
348 + item.sCommand = sString;
349 + item.image = xImage;
350 + iconcommands.push_back( item );
353 +CustomToolBarImportHelper::CustomToolBarImportHelper( const uno::Reference< frame::XModel >& rxModel, const css::uno::Reference< css::ui::XUIConfigurationManager>& rxAppCfgMgr )
355 + m_xCfgSupp.set( rxModel, uno::UNO_QUERY_THROW );
356 + m_xAppCfgMgr.set( rxAppCfgMgr, uno::UNO_QUERY_THROW );
359 +uno::Reference< ui::XUIConfigurationManager >
360 +CustomToolBarImportHelper::getCfgManager()
362 + return m_xCfgSupp->getUIConfigurationManager();
365 +uno::Reference< ui::XUIConfigurationManager >
366 +CustomToolBarImportHelper::getAppCfgManager()
368 + return m_xAppCfgMgr;
372 +CustomToolBarImportHelper::createCommandFromMacro( const rtl::OUString& sCmd )
374 +//"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
375 + static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:Standard.");
376 + static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
377 + // create script url
378 + rtl::OUString scriptURL = part1 + sCmd + part2;
379 + return uno::makeAny( scriptURL );
382 +rtl::OUString CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd )
384 + rtl::OUString result;
385 + if ( pMSOCmdConvertor.get() )
386 + result = pMSOCmdConvertor->MSOCommandToOOCommand( msoCmd );
390 +rtl::OUString CustomToolBarImportHelper::MSOTCIDToOOCommand( sal_Int16 msoTCID )
392 + rtl::OUString result;
393 + if ( pMSOCmdConvertor.get() )
394 + result = pMSOCmdConvertor->MSOTCIDToOOCommand( msoTCID );
399 +TBBase::indent_printf( FILE* fp, const char* format, ... )
402 + va_start ( ap, format );
404 + // indent nIndent spaces
405 + for ( int i=0; i<nIndent; ++i)
407 + // append the rest of the message
408 + vfprintf( fp, format, ap );
412 +rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Int32 nChars )
414 + rtl::OUStringBuffer buf(40);
415 + for ( sal_Int32 index = 0; index < nChars; ++index )
419 + sal_Unicode uni = static_cast< sal_Unicode >( ch );
420 + buf.append( &uni, 1 );
422 + return buf.makeStringAndClear();
425 +TBCHeader::TBCHeader() : bSignature( 0x3 )
428 +,tct(0x1) // default to Button
435 +TBCHeader::~TBCHeader()
439 +bool TBCHeader::Read( SvStream* pS )
441 + OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() );
442 + nOffSet = pS->Tell();
443 + *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority;
444 + // bit 4 ( from lsb )
445 + if ( bFlagsTCR & 0x10 )
447 + width.reset( new sal_uInt16 );
448 + height.reset( new sal_uInt16 );
449 + *pS >> *width >> *height;
454 +void TBCHeader::Print( FILE* fp )
457 + indent_printf(fp,"[ 0x%x ] TBCHeader -- dump\n", nOffSet );
458 + indent_printf(fp," bSignature 0x%xn", bSignature );
459 + indent_printf(fp," bVersion 0x%x\n", bVersion );
460 + indent_printf(fp," bFlagsTCR 0x%x\n", bFlagsTCR );
461 + indent_printf(fp," tct 0x%x\n", tct );
462 + indent_printf(fp," tcid 0x%x\n", tcid );
463 + indent_printf(fp," tbct 0x%x\n", static_cast< unsigned int >( tbct ));
464 + indent_printf(fp," bPriority 0x%x\n", bPriority );
466 + indent_printf(fp," width 0x%d(0x%x)\n", *width, *width);
467 + if ( height.get() )
468 + indent_printf(fp," height 0x%d(0x%x)\n", *height, *height);
471 +TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header )
475 +bool TBCData::Read(SvStream *pS)
477 + OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() );
478 + nOffSet = pS->Tell();
479 + if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ )
481 + switch ( rHeader.getTct() )
483 + case 0x01: // (Button control)
484 + case 0x10: // (ExpandingGrid control)
485 + controlSpecificInfo.reset( new TBCBSpecific() );
487 + case 0x0A: // (Popup control)
488 + case 0x0C: // (ButtonPopup control)
489 + case 0x0D: // (SplitButtonPopup control)
490 + case 0x0E: // (SplitButtonMRUPopup control)
491 + controlSpecificInfo.reset( new TBCMenuSpecific() );
493 + case 0x02: // (Edit control)
494 + case 0x04: // (ComboBox control)
495 + case 0x14: // (GraphicCombo control)
496 + case 0x03: // (DropDown control)
497 + case 0x06: // (SplitDropDown control)
498 + case 0x09: // (GraphicDropDown control)
499 + controlSpecificInfo.reset( new TBCComboDropdownSpecific( rHeader ) );
504 + if ( controlSpecificInfo.get() )
505 + return controlSpecificInfo->Read( pS );
508 + OSL_TRACE("#FIXME I need to be able to handle different controlSpecificInfo types.");
512 +bool TBCData::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& /*toolbarcontainer*/, CustomToolBarImportHelper& helper, std::vector< css::beans::PropertyValue >& props )
514 + controlGeneralInfo.ImportToolBarControlData( props );
515 + beans::PropertyValue aProp;
516 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Visible") ) ;
517 + aProp.Value = uno::makeAny( rHeader.isVisible() ); // where is the visible attribute stored
519 + if ( rHeader.getTct() == 0x01
520 + || rHeader.getTct() == 0x10 )
522 + TBCBSpecific* pSpecificInfo = dynamic_cast< TBCBSpecific* >( controlSpecificInfo.get() );
523 + if ( pSpecificInfo )
525 + // if we have a icon then lets set it for the command ( but I
526 + // have a nasty suspicion the toolbar actually needs to be set
527 + // up ( and added ) before you can asssign an image :-/
528 + rtl::OUString sCommand;
529 + for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it )
531 + if ( it->Name.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") ) ) )
532 + it->Value >>= sCommand;
534 + if ( TBCBitMap* pIcon = pSpecificInfo->getIcon() )
537 + BitmapEx aBitEx( pIcon->getBitMap() );
538 + if ( pSpecificInfo->getIconMask() )
539 + // according to the spec:
540 + // "the iconMask is white in all the areas in which the icon is
541 + // displayed as transparent and is black in all other areas."
542 + aBitEx = BitmapEx( aBitEx.GetBitmap(), pSpecificInfo->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE ) ) );
544 + Graphic aGraphic( aBitEx );
545 + helper.addIcon( aGraphic.GetXGraphic(), sCommand );
547 + else if ( pSpecificInfo->getBtnFace() )
550 + rtl::OUString sBuiltInCmd = helper.MSOTCIDToOOCommand( *pSpecificInfo->getBtnFace() );
551 + if ( sBuiltInCmd.getLength() )
553 + uno::Sequence< rtl::OUString> sCmds(1);
554 + sCmds[ 0 ] = sBuiltInCmd;
555 + uno::Reference< ui::XImageManager > xImageManager( helper.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
556 + // 0 = default image size
557 + uno::Sequence< uno::Reference< graphic::XGraphic > > sImages = xImageManager->getImages( 0, sCmds );
558 + if ( sImages.getLength() && sImages[0].is() )
559 + helper.addIcon( sImages[0], sCommand );
564 + return true; // just ignore
567 +void TBCData::Print( FILE* fp )
570 + indent_printf(fp,"[ 0x%x ] TBCData -- dump\n", nOffSet );
571 + indent_printf(fp," dumping controlGeneralInfo( TBCGeneralInfo )\n");
572 + controlGeneralInfo.Print( fp );
573 + if ( rHeader.getTct() == 1 )
575 + indent_printf(fp," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
576 + controlSpecificInfo->Print( fp );
581 +WString::Read( SvStream *pS )
583 + OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() );
584 + nOffSet = pS->Tell();
585 + sal_Int8 nChars = 0;
587 + sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
591 +TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
596 +TBCExtraInfo::Read( SvStream *pS )
598 + OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() );
599 + nOffSet = pS->Tell();
600 + if( !wstrHelpFile.Read( pS ) )
603 + *pS >> idHelpContext;
605 + if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) )
608 + *pS >> tbcu >> tbmg;
613 +TBCExtraInfo::Print( FILE* fp )
616 + indent_printf( fp, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet );
617 + indent_printf( fp, " wstrHelpFile %s\n",
618 + rtl::OUStringToOString( wstrHelpFile.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
619 + indent_printf( fp, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext ) );
620 + indent_printf( fp, " wstrTag %s\n",
621 + rtl::OUStringToOString( wstrTag.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
622 + indent_printf( fp, " wstrOnAction %s\n",
623 + rtl::OUStringToOString( wstrOnAction.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
624 + indent_printf( fp, " wstrParam %s\n",
625 + rtl::OUStringToOString( wstrParam.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
626 + indent_printf( fp, " tbcu 0x%x\n", tbcu );
627 + indent_printf( fp, " tbmg 0x%x\n", tbmg );
632 +TBCExtraInfo::getOnAction()
634 + return wstrOnAction.getString();
637 +TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
641 +bool TBCGeneralInfo::Read( SvStream *pS )
643 + OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() );
644 + nOffSet = pS->Tell();
647 + if ( ( bFlags & 0x1 ) && !customText.Read( pS ) )
649 + if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) || !tooltip.Read( pS ) ) )
651 + if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) )
657 +TBCGeneralInfo::Print( FILE* fp )
660 + indent_printf( fp, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet );
661 + indent_printf( fp, " bFlags 0x%x\n", bFlags );
662 + indent_printf( fp, " customText %s\n",
663 + rtl::OUStringToOString( customText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
664 + indent_printf( fp, " description %s\n",
665 + rtl::OUStringToOString( descriptionText.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
666 + indent_printf( fp, " tooltip %s\n",
667 + rtl::OUStringToOString( tooltip.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
668 + if ( bFlags & 0x4 )
669 + extraInfo.Print( fp );
673 +TBCGeneralInfo::ImportToolBarControlData( std::vector< beans::PropertyValue >& sControlData )
675 + if ( ( bFlags & 0x5 ) )
677 + beans::PropertyValue aProp;
678 + // probably access to the header would be a better test than seeing if there is an action, e.g.
679 + // if ( rHeader.getTct() == 0x01 && rHeader.getTcID() == 0x01 ) // not defined, probably this is a command
680 + if ( extraInfo.getOnAction().getLength() )
682 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
683 + aProp.Value = CustomToolBarImportHelper::createCommandFromMacro( extraInfo.getOnAction() );
684 + sControlData.push_back( aProp );
687 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Label") );
688 + aProp.Value = uno::makeAny( customText.getString() );
689 + sControlData.push_back( aProp );
691 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Type") );
692 + aProp.Value = uno::makeAny( ui::ItemType::DEFAULT );
693 + sControlData.push_back( aProp );
695 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HelpURL") );
696 + aProp.Value = uno::makeAny( CustomToolBarImportHelper::createCommandFromMacro( tooltip.getString() ) );
697 + sControlData.push_back( aProp );
699 + // #TODO find out what is the property for tooltip?
700 + sControlData.push_back( aProp );
702 +aToolbarItem(0).Name = "CommandURL" wstrOnAction
703 +aToolbarItem(0).Value = Command
704 +aToolbarItem(1).Name = "Label" customText
705 +aToolbarItem(1).Value = Label
706 +aToolbarItem(2).Name = "Type"
707 +aToolbarItem(2).Value = 0
708 +aToolbarItem(3).Name = "Visible"
709 +aToolbarItem(3).Value = true
715 +TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
720 +TBCMenuSpecific::Read( SvStream *pS)
722 + OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() );
723 + nOffSet = pS->Tell();
727 + name.reset( new WString() );
728 + return name->Read( pS );
734 +TBCMenuSpecific::Print( FILE* fp )
737 + indent_printf( fp, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet );
738 + indent_printf( fp, " tbid 0x%x\n", static_cast< unsigned int >( tbid ) );
740 + indent_printf( fp, " name %s", rtl::OUStringToOString( name->getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
744 +TBCBSpecific::TBCBSpecific() : bFlags( 0 )
748 +bool TBCBSpecific::Read( SvStream *pS)
750 + OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() );
751 + nOffSet = pS->Tell();
754 + // bFlags determines what we read next
756 + // bFlags.fCustomBitmap = 1 ( 0x8 ) set
757 + if ( bFlags & 0x8 )
759 + icon.reset( new TBCBitMap() );
760 + iconMask.reset( new TBCBitMap() );
761 + if ( !icon->Read( pS ) || !iconMask->Read( pS ) )
764 + // if bFlags.fCustomBtnFace = 1 ( 0x10 )
765 + if ( bFlags & 0x10 )
767 + iBtnFace.reset( new sal_uInt16 );
768 + *pS >> *iBtnFace.get();
770 + // if bFlags.fAccelerator equals 1 ( 0x04 )
771 + if ( bFlags & 0x04 )
773 + wstrAcc.reset( new WString() );
774 + return wstrAcc->Read( pS );
780 +void TBCBSpecific::Print( FILE* fp )
783 + indent_printf( fp, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet );
784 + indent_printf( fp, " bFlags 0x%x\n", bFlags );
785 + bool bResult = ( icon.get() != NULL );
786 + indent_printf( fp, " icon present? %s\n", bResult ? "true" : "false" );
790 + indent_printf( fp, " icon: \n");
791 + icon->Print( fp ); // will dump size
793 + bResult = ( iconMask.get() != NULL );
794 + indent_printf( fp, " icon mask present? %s\n", bResult ? "true" : "false" );
798 + indent_printf( fp, " icon mask: \n");
799 + iconMask->Print( fp ); // will dump size
801 + if ( iBtnFace.get() )
803 + indent_printf( fp, " iBtnFace 0x%x\n", *(iBtnFace.get()) );
805 + bResult = ( wstrAcc.get() != NULL );
806 + indent_printf( fp, " option string present? %s ->%s<-\n", bResult ? "true" : "false", bResult ? rtl::OUStringToOString( wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() : "N/A" );
810 +TBCBSpecific::getIcon()
816 +TBCBSpecific::getIconMask()
818 + return iconMask.get();
821 +TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header )
823 + if ( header.getTcID() == 0x01 )
824 + data.reset( new TBCCDData() );
827 +bool TBCComboDropdownSpecific::Read( SvStream *pS)
829 + nOffSet = pS->Tell();
831 + return data->Read( pS );
835 +void TBCComboDropdownSpecific::Print( FILE* fp)
838 + indent_printf(fp,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet );
842 + indent_printf(fp," no data " );
845 +TBCCDData::TBCCDData() : cwstrItems( 0 )
852 +TBCCDData::~TBCCDData()
856 +bool TBCCDData::Read( SvStream *pS)
858 + nOffSet = pS->Tell();
862 + for( sal_Int32 index=0; index < cwstrItems; ++index )
865 + if ( !aString.Read( pS ) )
867 + wstrList.push_back( aString );
870 + *pS >> cwstrMRU >> iSel >> cLines >> dxWidth;
872 + return wstrEdit.Read( pS );
875 +void TBCCDData::Print( FILE* fp)
878 + indent_printf(fp,"[ 0x%x ] TBCCDData -- dump\n", nOffSet );
879 + indent_printf(fp," cwstrItems items in wstrList 0x%d\n", cwstrItems);
880 + for ( sal_Int32 index=0; index < cwstrItems; ++index )
883 + indent_printf(fp, " wstrList[%d] %s", static_cast< int >( index ), rtl::OUStringToOString( wstrList[index].getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
885 + indent_printf(fp," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU);
886 + indent_printf(fp," iSel index of selected item 0x%d item\n", iSel);
887 + indent_printf(fp," cLines num of suggested lines to display 0x%d", cLines);
888 + indent_printf(fp," dxWidth width in pixels 0x%d", dxWidth);
889 + indent_printf(fp," wstrEdit %s", rtl::OUStringToOString( wstrEdit.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
892 +TBCBitMap::TBCBitMap() : cbDIB( 0 ), size( 0 )
896 +TBCBitMap::~TBCBitMap()
900 +// #FIXME Const-ness
902 +TBCBitMap::getBitMap()
907 +bool TBCBitMap::Read( SvStream* pS)
909 + OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() );
910 + nOffSet = pS->Tell();
912 + // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
913 + return mBitMap.Read( *pS, FALSE, TRUE );
916 +void TBCBitMap::Print( FILE* fp )
919 + indent_printf(fp, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet );
920 + indent_printf(fp, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB ) );
922 diff --git sw/source/filter/ww8/makefile.mk sw/source/filter/ww8/makefile.mk
923 index 68f641d..324d18d 100644
924 --- sw/source/filter/ww8/makefile.mk
925 +++ sw/source/filter/ww8/makefile.mk
926 @@ -69,7 +69,8 @@ EXCEPTIONSFILES = \
927 $(SLO)$/writerwordglue.obj \
928 $(SLO)$/ww8scan.obj \
929 $(SLO)$/WW8TableInfo.obj \
930 - $(SLO)$/WW8FFData.obj
931 + $(SLO)$/WW8FFData.obj \
932 + $(SLO)$/ww8toolbar.obj \
936 @@ -96,7 +97,9 @@ SLOFILES = \
937 $(SLO)$/writerhelper.obj \
938 $(SLO)$/writerwordglue.obj \
939 $(SLO)$/WW8TableInfo.obj \
940 - $(SLO)$/WW8FFData.obj
941 + $(SLO)$/WW8FFData.obj \
942 + $(SLO)$/ww8toolbar.obj \
946 # --- Tagets -------------------------------------------------------
947 diff --git sw/source/filter/ww8/ww8par.cxx sw/source/filter/ww8/ww8par.cxx
948 index e1c2fe5..290ffda 100644
949 --- sw/source/filter/ww8/ww8par.cxx
950 +++ sw/source/filter/ww8/ww8par.cxx
952 #include <svtools/itemiter.hxx> //SfxItemIter
956 +#include "ww8toolbar.hxx"
959 #include <dbgoutsw.hxx>
960 @@ -3988,6 +3988,21 @@ ULONG SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos)
961 eMode |= nsRedlineMode_t::REDLINE_SHOW_DELETE;
962 if (pStg && !pGloss) /*meaningless for a glossary, cmc*/
964 + // Read custom toolbars
965 + if ( pWwFib->lcbCmds )
967 + // there is a tgc255 structure
968 + long nCur = pTableStream->Tell();
970 + pTableStream->Seek( pWwFib->fcCmds ); // point at tgc record
971 + if (!aTCG.Read( pTableStream ) )
972 + OSL_TRACE("** Read of Customization data failed!!!! ");
973 + pTableStream->Seek( nCur ); // return to previous position, is that necessary?
975 + aTCG.Print( stderr );
977 + aTCG.ImportCustomToolBar( mpDocShell->GetModel() );
979 const SvtFilterOptions* pVBAFlags = SvtFilterOptions::Get();
980 maTracer.EnterEnvironment(sw::log::eMacros);
981 SvxImportMSVBasic aVBasic(*mpDocShell, *pStg,
982 diff --git sw/source/filter/ww8/ww8toolbar.cxx sw/source/filter/ww8/ww8toolbar.cxx
984 index 0000000..ac10d7a
986 +++ sw/source/filter/ww8/ww8toolbar.cxx
988 +#include "ww8toolbar.hxx"
989 +#include <rtl/ustrbuf.hxx>
991 +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
992 +#include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
993 +#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
994 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
995 +#include <com/sun/star/ui/XImageManager.hpp>
996 +#include <com/sun/star/ui/ItemType.hpp>
998 +#include <comphelper/processfactory.hxx>
999 +#include <vcl/graph.hxx>
1001 +using namespace com::sun::star;
1003 +typedef std::map< sal_Int16, rtl::OUString > IdToString;
1005 +class MSOWordCommandConvertor : public MSOCommandConvertor
1007 + IdToString msoToOOcmd;
1008 + IdToString tcidToOOcmd;
1010 + MSOWordCommandConvertor();
1011 + virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
1012 + virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
1015 +MSOWordCommandConvertor::MSOWordCommandConvertor()
1017 + // mso command id to ooo command string
1018 + // #FIXME and *HUNDREDS* of id's to added here
1019 + msoToOOcmd[ 0x20b ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc") );
1020 + msoToOOcmd[ 0x50 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Open") );
1022 + // mso tcid to ooo command string
1023 + // #FIXME and *HUNDREDS* of id's to added here
1024 + tcidToOOcmd[ 0x9d9 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Print") );
1027 +rtl::OUString MSOWordCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
1029 + rtl::OUString sResult;
1030 + IdToString::iterator it = msoToOOcmd.find( key );
1031 + if ( it != msoToOOcmd.end() )
1032 + sResult = it->second;
1036 +rtl::OUString MSOWordCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
1038 + rtl::OUString sResult;
1039 + IdToString::iterator it = tcidToOOcmd.find( key );
1040 + if ( it != tcidToOOcmd.end() )
1041 + sResult = it->second;
1046 +CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
1058 +CTBWrapper::~CTBWrapper()
1062 +bool CTBWrapper::Read( SvStream* pS )
1064 + OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() );
1065 + nOffSet = pS->Tell();
1066 + Tcg255SubStruct::Read( pS );
1067 + *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
1068 + *pS >> cbTBD >> cCust >> cbDTBC;
1071 + // cbDTBC is the size in bytes of the TBC array
1072 + // but the size of a TBC element is dynamic ( and this relates to TBDelta's
1073 + // which we don't read right now )
1074 + //pS->SeekRel( cbDTBC );
1075 + int nStart = pS->Tell();
1077 + int bytesRead = 0;
1078 + int bytesToRead = cbDTBC - bytesRead;
1079 + // cbDTBC specifies the size ( in bytes ) taken by an array ( of unspecified size )
1080 + // of TBC records ( TBC records have dynamic length, so we need to check our position
1081 + // after each read )
1085 + if ( !aTBC.Read( pS ) )
1087 + rtbdc.push_back( aTBC );
1088 + bytesToRead = cbDTBC - ( pS->Tell() - nStart );
1089 + } while ( bytesToRead > 0 );
1093 + for ( sal_Int32 index = 0; index < cCust; ++index )
1095 + Customization aCust;
1096 + if ( !aCust.Read( pS ) )
1098 + rCustomizations.push_back( aCust );
1104 +void CTBWrapper::Print( FILE* fp )
1107 + indent_printf(fp,"[ 0x%x ] CTBWrapper - dump\n", nOffSet );
1108 + bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
1110 + indent_printf(fp," sanity check ( first 8 bytes conform )\n");
1113 + indent_printf(fp," reserved1(0x%x)\n",ch);
1114 + indent_printf(fp," reserved2(0x%x)\n",reserved2);
1115 + indent_printf(fp," reserved3(0x%x)\n",reserved3);
1116 + indent_printf(fp," reserved4(0x%x)\n",reserved4);
1117 + indent_printf(fp," reserved5(0x%x)\n",reserved5);
1118 + indent_printf(fp,"Quiting dump");
1121 + indent_printf(fp," size of TBDelta structures 0x%x\n", cbTBD );
1122 + indent_printf(fp," cCust: no. of cCust structures 0x%x\n",cCust);
1123 + indent_printf(fp," cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
1125 + sal_Int32 index = 0;
1127 + for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it, ++index )
1129 + indent_printf(fp," Dumping rtbdc[%d]\n", static_cast< int >( index ));
1136 + for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it, ++index )
1138 + indent_printf(fp," Dumping custimization [%d]\n", static_cast< int >( index ));
1144 +bool CTBWrapper::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
1147 + for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
1149 + uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
1150 + uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ), uno::UNO_QUERY_THROW );
1151 + CustomToolBarImportHelper helper( rxModel, xAppCfgSupp->getUIConfigurationManager( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ) ) ) );
1152 + helper.setMSOCommandMap( new MSOWordCommandConvertor() );
1153 + if ( !(*it).ImportCustomToolBar( helper ) )
1159 +Customization::Customization() : tbidForTBD( 0 )
1165 +Customization::~Customization()
1169 +bool Customization::Read( SvStream *pS)
1171 + OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() );
1172 + nOffSet = pS->Tell();
1173 + *pS >> tbidForTBD >> reserved1 >> ctbds;
1174 + if ( tbidForTBD && ctbds )
1177 + for ( sal_Int32 index = 0; index < ctbds; ++index )
1179 + if (!aTBDelta.Read( pS ) )
1181 + customizationDataTBDelta.push_back( aTBDelta );
1186 + customizationDataCTB.reset( new CTB() );
1187 + if ( !customizationDataCTB->Read( pS ) )
1193 +void Customization::Print( FILE* fp )
1196 + indent_printf( fp,"[ 0x%x ] Customization -- dump \n", nOffSet );
1197 + indent_printf( fp," tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
1198 + indent_printf( fp," reserved1 0x%x \n", reserved1);
1199 + indent_printf( fp," ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
1200 + if ( !tbidForTBD && !ctbds )
1201 + customizationDataCTB->Print( fp );
1204 + std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin();
1205 + for ( sal_Int32 index = 0; index < ctbds; ++it,++index )
1211 +bool Customization::ImportCustomToolBar( CustomToolBarImportHelper& helper )
1213 + if ( !customizationDataCTB.get() )
1215 + return customizationDataCTB->ImportCustomToolBar( helper );
1218 +TBDelta::TBDelta() : doprfatendFlags(0)
1227 +bool TBDelta::Read(SvStream *pS)
1229 + OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() );
1230 + nOffSet = pS->Tell();
1231 + *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
1232 + *pS >> CiTBDE >> cbTBC;
1236 +void TBDelta::Print( FILE* fp )
1238 + // Like most of the debug output, it's raw and little ( no )
1239 + // interpretation of the data is output ( e.g. flag values etc. )
1240 + indent_printf( fp, "[ 0x%x ] TBDelta -- dump\n", nOffSet );
1241 + indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
1243 + indent_printf( fp, " ibts 0x%x\n",ibts );
1244 + indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
1245 + indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
1246 + indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
1247 + indent_printf( fp, " CiTBDE 0x%x\n",CiTBDE );
1248 + indent_printf( fp, " cbTBC 0x%x\n", cbTBC );
1251 +CTB::CTB() : cbTBData( 0 )
1263 +bool CTB::Read( SvStream *pS)
1265 + OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() );
1266 + nOffSet = pS->Tell();
1267 + if ( !name.Read( pS ) )
1270 + // sal_Int32 nTBSize = cbTBData - sizeof(rVisualData) - 12;
1271 + if ( !tb.Read( pS ) )
1273 + pS->Read( &rVisualData, sizeof( rVisualData ) );
1275 + *pS >> iWCTBl >> reserved >> unused >> cCtls;
1279 + for ( sal_Int32 index = 0; index < cCtls; ++index )
1282 + if ( !aTBC.Read( pS ) )
1284 + rTBC.push_back( aTBC );
1291 +CTB::Print( FILE* fp )
1294 + indent_printf(fp, "[ 0x%x ] CTB - dump\n", nOffSet );
1295 + indent_printf(fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
1296 + indent_printf(fp, " cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields. %x\n", static_cast< unsigned int >( cbTBData ) );
1299 + 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 ) );
1302 + for ( sal_Int32 index = 0; index < cCtls; ++index )
1305 + indent_printf(fp, " dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
1306 + rTBC[ index ].Print( fp );
1311 +bool CTB::ImportCustomToolBar( CustomToolBarImportHelper& helper )
1313 + static rtl::OUString sToolbarPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" ) );
1315 + // Create default setting
1316 + uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
1317 + uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
1318 + uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
1320 + // set UI name for toolbar
1321 + xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UIName") ), uno::makeAny( name.getString() ) );
1323 + rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
1325 + for ( std::vector< TBC >::iterator it = rTBC.begin(); it != rTBC.end(); ++it )
1327 + // createToolBar item for control
1328 + if ( !it->ImportToolBarControl( xIndexContainer, helper ) )
1332 + OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
1334 + helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
1335 + helper.applyIcons();
1337 + uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
1338 + xPersistence->store();
1340 + xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
1341 + xPersistence->store();
1346 +TB::TB() : bSignature( 0 )
1356 +bool TB::Read( SvStream* pS )
1358 + OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() );
1359 + nOffSet = pS->Tell();
1360 + *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags;
1361 + return name.Read( pS );
1364 +void TB::Print( FILE* fp )
1367 + indent_printf( fp, "[ 0x%x ] TB -- dump\n", nOffSet );
1368 + 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 );
1369 + indent_printf( fp, " name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
1381 +bool TBC::Read( SvStream *pS )
1383 + OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() );
1384 + nOffSet = pS->Tell();
1385 + if ( !tbch.Read( pS ) )
1387 + if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
1389 + cid.reset( new sal_uInt32 );
1392 + // MUST exist if tbch.tct is not equal to 0x16
1393 + if ( tbch.getTct() != 0x16 )
1395 + tbcd.reset( new TBCData( tbch ) );
1396 + if ( !tbcd->Read( pS ) )
1402 +void TBC::Print( FILE* fp )
1405 + indent_printf(fp,"[ 0x%x ] TBC -- dump\n", nOffSet );
1406 + indent_printf(fp," dumping header ( TBCHeader )\n");
1409 + indent_printf(fp," cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
1412 + indent_printf(fp," dumping toolbar data TBCData \n");
1418 +TBC::ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper )
1420 + // cmtFci 0x1 Command based on a built-in command. See CidFci.
1421 + // cmtMacro 0x2 Macro command. See CidMacro.
1422 + // cmtAllocated 0x3 Allocated command. See CidAllocated.
1423 + // cmtNil 0x7 No command. See Cid.
1424 + bool bBuiltin = false;
1425 + sal_uInt16 cmdId = 0;
1428 + sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
1430 + sal_uInt8 cmt = ( arg2 & 0x7 );
1431 + arg2 = ( arg2 >> 3 );
1436 + OSL_TRACE("cmt is cmtFci builtin command 0x%x", arg2);
1441 + OSL_TRACE("cmt is cmtMacro macro 0x%x", arg2);
1444 + OSL_TRACE("cmt is cmtAllocated [???] 0x%x", arg2);
1447 + OSL_TRACE("cmt is cmNill no-phing 0x%x", arg2);
1450 + OSL_TRACE("illegal 0x%x", cmt);
1457 + std::vector< css::beans::PropertyValue > props;
1460 + rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
1461 + if ( sCommand.getLength() > 0 )
1463 + beans::PropertyValue aProp;
1465 + aProp.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CommandURL") );
1466 + aProp.Value <<= sCommand;
1467 + props.push_back( aProp );
1471 + if ( ! tbcd->ImportToolBarControl( toolbarcontainer, helper, props ) )
1475 + uno::Sequence< beans::PropertyValue > sProps( props.size() );
1476 + beans::PropertyValue* pProp = sProps.getArray();
1478 + for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
1481 + toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
1487 +Xst::Read( SvStream* pS )
1489 + OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() );
1490 + nOffSet = pS->Tell();
1491 + sal_Int16 nChars = 0;
1493 + sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) );
1498 +Xst::Print( FILE* fp )
1501 + indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
1502 + indent_printf( fp, " %s", rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
1505 +Tcg::Tcg() : nTcgVer( 255 )
1509 +bool Tcg::Read(SvStream *pS)
1511 + OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() );
1512 + nOffSet = pS->Tell();
1514 + if ( nTcgVer != (sal_Int8)255 )
1516 + tcg.reset( new Tcg255() );
1517 + return tcg->Read( pS );
1520 +void Tcg::Print( FILE* fp )
1523 + indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
1524 + indent_printf(fp," nTcgVer %d\n", nTcgVer);
1528 +bool Tcg::ImportCustomToolBar( const uno::Reference< frame::XModel >& rxModel )
1530 + return tcg->ImportCustomToolBar( rxModel );
1539 + std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
1540 + for ( ; it != rgtcgData.end(); ++it )
1544 +bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream *pS )
1546 + Tcg255SubStruct* pSubStruct = NULL;
1551 + pSubStruct = new PlfMcd( false ); // don't read the id
1556 + pSubStruct = new PlfAcd( false );
1562 + pSubStruct = new PlfKme( false );
1567 + pSubStruct = new TcgSttbf( false );
1572 + pSubStruct = new MacroNames( false );
1577 + pSubStruct = new CTBWrapper( false );
1581 + OSL_TRACE("Unknown id 0x%x",nId);
1584 + pSubStruct->ch = nId;
1585 + if ( !pSubStruct->Read( pS ) )
1587 + rgtcgData.push_back( pSubStruct );
1591 +bool Tcg255::ImportCustomToolBar( const uno::Reference< css::frame::XModel >& rxModel )
1593 + // Find the CTBWrapper
1594 + for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
1596 + if ( (*it)->id() == 0x12 )
1598 + // not so great, shouldn't really have to do a horror casting
1599 + CTBWrapper* pCTBWrapper = dynamic_cast< CTBWrapper* > ( *it );
1600 + if ( pCTBWrapper )
1602 + if ( !pCTBWrapper->ImportCustomToolBar( rxModel ) )
1611 +bool Tcg255::Read(SvStream *pS)
1613 + OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() );
1614 + nOffSet = pS->Tell();
1615 + sal_uInt8 nId = 0; //
1617 + while ( nId != 0x40 )
1619 + if ( !processSubStruct( nId, pS ) )
1627 +void Tcg255::Print( FILE* fp)
1630 + indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
1631 + indent_printf(fp, " contains %d sub records\n", rgtcgData.size() );
1632 + std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
1633 + std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end();
1635 + for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
1638 + indent_printf(fp, " [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
1644 +Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
1648 +bool Tcg255SubStruct::Read(SvStream *pS)
1650 + OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() );
1651 + nOffSet = pS->Tell();
1657 +PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), rgmcd( NULL )
1666 +bool PlfMcd::Read(SvStream *pS)
1668 + OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() );
1669 + nOffSet = pS->Tell();
1670 + Tcg255SubStruct::Read( pS );
1674 + rgmcd = new MCD[ iMac ];
1675 + for ( sal_Int32 index = 0; index < iMac; ++index )
1677 + if ( !rgmcd[ index ].Read( pS ) )
1684 +void PlfMcd::Print( FILE* fp )
1687 + indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
1688 + indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
1689 + for ( sal_Int32 count=0; count < iMac; ++count )
1692 + indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
1693 + rgmcd[ count ].Print( fp );
1698 +PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
1711 +bool PlfAcd::Read( SvStream *pS)
1713 + OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() );
1714 + nOffSet = pS->Tell();
1715 + Tcg255SubStruct::Read( pS );
1719 + rgacd = new Acd[ iMac ];
1720 + for ( sal_Int32 index = 0; index < iMac; ++index )
1722 + if ( !rgacd[ index ].Read( pS ) )
1728 +void PlfAcd::Print( FILE* fp )
1731 + indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
1732 + indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
1733 + for ( sal_Int32 count=0; count < iMac; ++count )
1736 + indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
1737 + rgacd[ count ].Print( fp );
1742 +PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
1754 +bool PlfKme::Read(SvStream *pS)
1756 + OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() );
1757 + nOffSet = pS->Tell();
1758 + Tcg255SubStruct::Read( pS );
1762 + rgkme = new Kme[ iMac ];
1763 + for( sal_Int32 index=0; index<iMac; ++index )
1765 + if ( !rgkme[ index ].Read( pS ) )
1772 +void PlfKme::Print( FILE* fp )
1775 + indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
1776 + indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
1777 + for ( sal_Int32 count=0; count < iMac; ++count )
1780 + indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
1781 + rgkme[ count ].Print( fp );
1786 +TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
1790 +bool TcgSttbf::Read( SvStream *pS)
1792 + OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() );
1793 + nOffSet = pS->Tell();
1794 + Tcg255SubStruct::Read( pS );
1795 + return sttbf.Read( pS );
1798 +void TcgSttbf::Print( FILE* fp )
1801 + indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
1802 + sttbf.Print( fp );
1805 +TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
1812 +TcgSttbfCore::~TcgSttbfCore()
1815 + delete[] dataItems;
1818 +bool TcgSttbfCore::Read( SvStream* pS )
1820 + OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() );
1821 + nOffSet = pS->Tell();
1822 + *pS >> fExtend >> cData >> cbExtra;
1825 + dataItems = new SBBItem[ cData ];
1826 + for ( sal_Int32 index = 0; index < cData; ++index )
1828 + *pS >> dataItems[ index ].cchData;
1829 + dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData );
1830 + *pS >> dataItems[ index ].extraData;
1836 +void TcgSttbfCore::Print( FILE* fp )
1839 + indent_printf( fp, "[ 0x%x ] TcgSttbfCore - dump\n");
1840 + indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
1841 + indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
1842 + indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
1846 + for ( sal_Int32 index = 0; index < cData; ++index )
1847 + 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 );
1851 +MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
1857 +MacroNames::~MacroNames()
1863 +bool MacroNames::Read( SvStream *pS)
1865 + OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() );
1866 + nOffSet = pS->Tell();
1867 + Tcg255SubStruct::Read( pS );
1871 + rgNames = new MacroName[ iMac ];
1872 + for ( sal_Int32 index = 0; index < iMac; ++index )
1874 + if ( !rgNames[ index ].Read( pS ) )
1881 +void MacroNames::Print( FILE* fp )
1884 + indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
1885 + indent_printf(fp, " contains %d MacroName records\n", iMac );
1886 + for ( sal_Int32 count=0; count < iMac; ++count )
1889 + indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
1890 + rgNames[ count ].Print( fp );
1895 +MacroName::MacroName():ibst(0)
1900 +bool MacroName::Read(SvStream *pS)
1902 + OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() );
1903 + nOffSet = pS->Tell();
1905 + return xstz.Read( pS );
1908 +void MacroName::Print( FILE* fp )
1911 + indent_printf( fp, "[ 0x%x ] MacroName - dump");
1912 + indent_printf( fp," index - 0x%x has associated following record\n", ibst );
1918 +Xstz::Xstz():chTerm(0)
1923 +Xstz::Read(SvStream *pS)
1925 + OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() );
1926 + nOffSet = pS->Tell();
1927 + if ( !xst.Read( pS ) )
1930 + if ( chTerm != 0 ) // should be an assert
1935 +void Xstz::Print( FILE* fp )
1938 + indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
1939 + indent_printf(fp," Xst\n");
1941 + indent_printf(fp," chterm 0x%x ( should be zero )\n", chTerm);
1944 +Kme::Kme() : reserved1(0)
1958 +Kme::Read(SvStream *pS)
1960 + OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() );
1961 + nOffSet = pS->Tell();
1962 + *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> param;
1966 +void Kme::Print( FILE* fp )
1970 + indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
1971 + indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
1972 + indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
1973 + indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
1974 + indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
1975 + indent_printf( fp, " kt 0x%x \n", kt );
1976 + indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
1979 +Acd::Acd() : ibst( 0 )
1980 +, fciBasedOnABC( 0 )
1984 +bool Acd::Read(SvStream *pS)
1986 + OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() );
1987 + nOffSet = pS->Tell();
1988 + *pS >> ibst >> fciBasedOnABC;
1992 +void Acd::Print( FILE* fp )
1995 + indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
1996 + // #TODO flesh out interpretation of these values
1997 + indent_printf( fp," ibst 0x%x\n", ibst);
1998 + indent_printf( fp," fciBaseObABC 0x%x\n", fciBasedOnABC);
2001 +MCD::MCD() : reserved1(0x56)
2005 +,reserved3( 0xFFFF )
2013 +bool MCD::Read(SvStream *pS)
2015 + OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() );
2016 + nOffSet = pS->Tell();
2017 + *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
2018 + *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
2022 +void MCD::Print( FILE* fp )
2025 + indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
2026 + indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
2027 + indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
2028 + indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
2029 + indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
2031 + indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
2032 + indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
2033 + indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
2034 + indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
2035 + indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
2038 diff --git sw/source/filter/ww8/ww8toolbar.hxx sw/source/filter/ww8/ww8toolbar.hxx
2039 new file mode 100644
2040 index 0000000..188213c
2042 +++ sw/source/filter/ww8/ww8toolbar.hxx
2044 +#ifndef _WW8TOOLBAR_HXX
2045 +#define _WW8TOOLBAR_HXX
2047 +#include <svx/mstoolbar.hxx>
2049 +namespace css = ::com::sun::star;
2051 +class Xst : public TBBase
2053 + rtl::OUString sString;
2056 + bool Read(SvStream *pS);
2057 + rtl::OUString getString() { return sString; }
2058 + void Print( FILE* fp );
2061 +class TBC : public TBBase
2064 + boost::shared_ptr< sal_uInt32 > cid; // optional
2065 + boost::shared_ptr<TBCData> tbcd;
2069 + bool Read(SvStream *pS);
2070 + void Print( FILE* );
2071 + bool ImportToolBarControl( const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
2074 +class TB : public TBBase
2076 + sal_Int8 bSignature; //Signed integer that specifies the toolbar signature number. MUST be 0x02.
2077 + sal_Int8 bVersion; //Signed integer that specifies the toolbar version number. MUST be 0x01.
2078 + sal_Int16 cCL; //Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
2079 + sal_Int32 ltbid; //Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
2080 + sal_uInt32 ltbtr; //Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
2081 + sal_uInt16 cRowsDefault; //Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
2082 + sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
2083 + WString name; //Structure of type WString that specifies the toolbar name.
2085 + TB& operator = ( const TB&);
2089 + bool Read(SvStream *pS);
2090 + void Print( FILE* );
2093 +class CTB : public TBBase
2096 + sal_Int32 cbTBData;
2098 + sal_uInt8 rVisualData[ 100 ];
2100 + sal_uInt16 reserved;
2101 + sal_uInt16 unused;
2103 + std::vector< TBC > rTBC;
2106 + CTB& operator = ( const CTB&);
2110 + bool Read(SvStream *pS);
2111 + void Print( FILE* fp );
2112 + bool ImportCustomToolBar( CustomToolBarImportHelper& );
2115 +class TBDelta : public TBBase
2117 + sal_uInt8 doprfatendFlags;
2119 + sal_Int32 cidNext;
2122 + sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
2127 + bool Read(SvStream *pS);
2128 + void Print( FILE* );
2131 +class Tcg255SubStruct : public TBBase
2133 +friend class Tcg255;
2135 + Tcg255SubStruct(const Tcg255SubStruct&);
2136 + Tcg255SubStruct& operator = ( const Tcg255SubStruct&);
2140 + Tcg255SubStruct( bool bReadId );
2141 + ~Tcg255SubStruct(){}
2142 + virtual sal_uInt8 id() const { return ch; }
2143 + bool Read(SvStream *pS);
2146 +class Customization : public TBBase
2148 + sal_Int32 tbidForTBD;
2149 + sal_uInt16 reserved1;
2152 + boost::shared_ptr< CTB > customizationDataCTB;
2153 + std::vector< TBDelta > customizationDataTBDelta;
2158 + bool Read(SvStream *pS);
2159 + bool ImportCustomToolBar( CustomToolBarImportHelper& );
2160 + void Print( FILE* );
2163 +class CTBWrapper : public Tcg255SubStruct
2165 + // reserved1 is the ch field of Tcg255SubStruct
2166 + sal_uInt16 reserved2;
2167 + sal_uInt8 reserved3;
2168 + sal_uInt16 reserved4;
2169 + sal_uInt16 reserved5;
2176 + std::vector< TBC > rtbdc; // array of TBC's - we don't read these yet
2177 + std::vector< Customization > rCustomizations; // array of Customizations
2179 + CTBWrapper(const CTBWrapper&);
2180 + CTBWrapper& operator = ( const CTBWrapper&);
2182 + CTBWrapper( bool bReadId = true );
2184 + bool Read(SvStream *pS);
2185 + bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
2186 + void Print( FILE* );
2189 +class MCD : public TBBase
2191 + sal_Int8 reserved1; // A signed integer that MUST be 0x56.
2192 + sal_uInt8 reserved2; // MUST be 0.
2193 + sal_uInt16 ibst; // Unsigned integer that specifies the name of the macro. Macro name is specified by MacroName.xstz of the MacroName entry in the MacroNames such that MacroName.ibst equals ibst. MacroNames MUST contain such an entry.
2194 + sal_uInt16 ibstName; // An unsigned integer that specifies the index into the Command String Table (TcgSttbf.sttbf) where the macro‘s name and arguments are specified.
2195 + sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
2196 + sal_uInt32 reserved4; //MUST be ignored.
2197 + sal_uInt32 reserved5; //MUST be 0.
2198 + sal_uInt32 reserved6; //MUST be ignored.
2199 + sal_uInt32 reserved7; //MUST be ignored
2202 + MCD& operator = ( const MCD&);
2206 + bool Read(SvStream *pS);
2207 + void Print( FILE* );
2210 +class PlfMcd : public Tcg255SubStruct
2213 + MCD* rgmcd; // array of MCD's
2214 + PlfMcd(const PlfMcd&);
2215 + PlfMcd& operator = ( const PlfMcd&);
2217 + PlfMcd( bool bReadId = true );
2219 + bool Read(SvStream *pS);
2220 + void Print( FILE* );
2223 +class Acd : public TBBase
2226 + sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
2228 + Acd& operator = ( const Acd&);
2232 + bool Read(SvStream *pS);
2233 + void Print( FILE* );
2236 +class PlfAcd: public Tcg255SubStruct
2240 + PlfAcd(const PlfAcd&);
2241 + PlfAcd& operator = ( const PlfAcd&);
2243 + PlfAcd( bool bReadId = true );
2245 + bool Read(SvStream *pS);
2246 + void Print(FILE*);
2249 +class Kme : public TBBase
2251 + sal_Int16 reserved1; //MUST be zero.
2252 + sal_Int16 reserved2; //MUST be zero.
2253 + sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
2254 + sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
2255 + sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
2256 + sal_uInt32 param; //The meaning of this field depends on the value of kt
2259 + Kme& operator = ( const Kme&);
2263 + bool Read(SvStream *pS);
2264 + void Print( FILE* );
2267 +class PlfKme : public Tcg255SubStruct
2271 + PlfKme(const PlfKme&);
2272 + PlfKme& operator = ( const PlfKme&);
2274 + PlfKme( bool bReadId = true );
2276 + bool Read(SvStream *pS);
2277 + void Print( FILE* );
2280 +class TcgSttbfCore : public TBBase
2284 + sal_uInt16 cchData;
2285 + rtl::OUString data;
2286 + sal_uInt16 extraData;
2287 + SBBItem() : cchData(0), extraData(0){}
2289 + sal_uInt16 fExtend;
2291 + sal_uInt16 cbExtra;
2292 + SBBItem* dataItems;
2293 + TcgSttbfCore(const TcgSttbfCore&);
2294 + TcgSttbfCore& operator = ( const TcgSttbfCore&);
2298 + bool Read(SvStream *pS);
2299 + void Print( FILE* fp );
2302 +class TcgSttbf : public Tcg255SubStruct
2304 + TcgSttbfCore sttbf;
2305 + TcgSttbf(const TcgSttbf&);
2306 + TcgSttbf& operator = ( const TcgSttbf&);
2308 + TcgSttbf( bool bReadId = true );
2310 + bool Read(SvStream *pS);
2311 + void Print( FILE* fp );
2314 +class Xstz : public TBBase
2316 + Xst xst; //An Xst specifying the string with its pre-pended length.
2317 + sal_uInt16 chTerm;
2319 + Xstz(const Xstz&);
2320 + Xstz& operator = ( const Xstz&);
2324 + bool Read(SvStream *pS);
2325 + void Print( FILE* fp );
2328 +class MacroName : public TBBase
2330 + sal_uInt16 ibst; //An unsigned integer that specifies the index of the current entry in the macro name table. MUST NOT be the same as the index of any other entry.
2332 + MacroName(const MacroName&);
2333 + MacroName& operator = ( const MacroName&);
2337 + bool Read(SvStream *pS);
2338 + void Print( FILE* );
2341 +class MacroNames : public Tcg255SubStruct
2343 + sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
2344 + MacroName* rgNames;
2346 + MacroNames(const MacroNames&);
2347 + MacroNames& operator = ( const MacroNames&);
2349 + MacroNames( bool bReadId = true );
2351 + bool Read(SvStream *pS);
2352 + void Print( FILE* );
2355 +class Tcg255 : public TBBase
2357 + std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
2358 + Tcg255(const Tcg255&);
2359 + Tcg255& operator = ( const Tcg255&);
2360 + bool processSubStruct( sal_uInt8 nId, SvStream* );
2364 + bool Read(SvStream *pS);
2365 + void Print( FILE* );
2366 + bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
2369 +class Tcg: public TBBase
2372 + std::auto_ptr< Tcg255 > tcg;
2374 + Tcg& operator = ( const Tcg&);
2378 + bool Read(SvStream *pS);
2379 + bool ImportCustomToolBar( const css::uno::Reference< css::frame::XModel >& rxModel );
2380 + void Print( FILE* );
2384 Index: vcl/inc/vcl/bitmap.hxx
2385 ===================================================================
2386 --- vcl/inc/vcl/bitmap.hxx (revision 267686)
2387 +++ vcl/inc/vcl/bitmap.hxx (working copy)
2389 SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp );
2390 SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap );
2392 - SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset );
2393 + SAL_DLLPRIVATE static BOOL ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bMSOFormat=FALSE );
2394 SAL_DLLPRIVATE static BOOL ImplReadDIBFileHeader( SvStream& rIStm, ULONG& rOffset );
2395 - SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown );
2396 + SAL_DLLPRIVATE static BOOL ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, BOOL bMSOFormat = FALSE );
2397 SAL_DLLPRIVATE static BOOL ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, BOOL bQuad );
2398 SAL_DLLPRIVATE static BOOL ImplReadDIBBits( SvStream& rIStm, DIBInfoHeader& rHeader, BitmapWriteAccess& rAcc, sal_Bool bTopDown );
2399 SAL_DLLPRIVATE BOOL ImplWriteDIB( SvStream& rOStm, BitmapReadAccess& rAcc, BOOL bCompressed ) const;
2404 - BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE );
2405 + BOOL Read( SvStream& rIStm, BOOL bFileHeader = TRUE, BOOL bMSOFormat = FALSE );
2406 BOOL Write( SvStream& rOStm, BOOL bCompressed = TRUE, BOOL bFileHeader = TRUE ) const;
2408 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Bitmap& rBitmap );
2409 --- vcl/source/gdi/bitmap2.cxx.old 2009-04-06 21:35:20.000000000 +0200
2410 +++ vcl/source/gdi/bitmap2.cxx 2009-04-06 21:35:39.000000000 +0200
2413 #define DIBCOREHEADERSIZE ( 12UL )
2414 #define DIBINFOHEADERSIZE ( sizeof( DIBInfoHeader ) )
2415 +#define BITMAPINFOHEADER 0x28
2417 #define SETPIXEL4( pBuf, nX, cChar )( (pBuf)[ (nX) >> 1 ] |= ( (nX) & 1 ) ? ( cChar ): (cChar) << 4 );
2419 // ----------------------
2420 @@ -132,7 +134,7 @@ SvStream& operator<<( SvStream& rOStm, c
2422 // ------------------------------------------------------------------
2424 -BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader )
2425 +BOOL Bitmap::Read( SvStream& rIStm, BOOL bFileHeader, BOOL bIsMSOFormat )
2427 const USHORT nOldFormat = rIStm.GetNumberFormatInt();
2428 const ULONG nOldPos = rIStm.Tell();
2429 @@ -147,7 +149,7 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL
2430 bRet = ImplReadDIB( rIStm, *this, nOffset );
2433 - bRet = ImplReadDIB( rIStm, *this, nOffset );
2434 + bRet = ImplReadDIB( rIStm, *this, nOffset, bIsMSOFormat );
2438 @@ -164,14 +166,14 @@ BOOL Bitmap::Read( SvStream& rIStm, BOOL
2440 // ------------------------------------------------------------------
2442 -BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset )
2443 +BOOL Bitmap::ImplReadDIB( SvStream& rIStm, Bitmap& rBmp, ULONG nOffset, BOOL bIsMSOFormat )
2445 DIBInfoHeader aHeader;
2446 const ULONG nStmPos = rIStm.Tell();
2448 sal_Bool bTopDown = sal_False;
2450 - if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
2451 + if( ImplReadDIBInfoHeader( rIStm, aHeader, bTopDown, bIsMSOFormat ) && aHeader.nWidth && aHeader.nHeight && aHeader.nBitCount )
2453 const USHORT nBitCount( discretizeBitcount(aHeader.nBitCount) );
2455 @@ -302,21 +304,37 @@ BOOL Bitmap::ImplReadDIBFileHeader( SvSt
2457 // ------------------------------------------------------------------
2459 -BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown )
2460 +BOOL Bitmap::ImplReadDIBInfoHeader( SvStream& rIStm, DIBInfoHeader& rHeader, sal_Bool& bTopDown, sal_Bool bIsMSOFormat )
2462 // BITMAPINFOHEADER or BITMAPCOREHEADER
2463 rIStm >> rHeader.nSize;
2466 + sal_Int16 nTmp16 = 0;
2467 + sal_uInt8 nTmp8 = 0;
2468 if ( rHeader.nSize == DIBCOREHEADERSIZE )
2472 rIStm >> nTmp16; rHeader.nWidth = nTmp16;
2473 rIStm >> nTmp16; rHeader.nHeight = nTmp16;
2474 rIStm >> rHeader.nPlanes;
2475 rIStm >> rHeader.nBitCount;
2477 + else if ( bIsMSOFormat && ( rHeader.nSize == BITMAPINFOHEADER ) )
2479 + rIStm >> nTmp16; rHeader.nWidth = nTmp16;
2480 + rIStm >> nTmp16; rHeader.nHeight = nTmp16;
2481 + rIStm >> nTmp8; rHeader.nPlanes = nTmp8;
2482 + rIStm >> nTmp8; rHeader.nBitCount = nTmp8;
2483 + rIStm >> nTmp16; rHeader.nSizeImage = nTmp16;
2484 + rIStm >> nTmp16; rHeader.nCompression = nTmp16;
2485 + if ( !rHeader.nSizeImage ) // uncompressed?
2486 + rHeader.nSizeImage = ((rHeader.nWidth * rHeader.nBitCount + 31) & ~31) / 8 * rHeader.nHeight;
2487 + rIStm >> rHeader.nXPelsPerMeter;
2488 + rIStm >> rHeader.nYPelsPerMeter;
2489 + rIStm >> rHeader.nColsUsed;
2490 + rIStm >> rHeader.nColsImportant;