1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #include <filter/msfilter/mstoolbar.hxx>
10 #include <rtl/ustrbuf.hxx>
12 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
13 #include <com/sun/star/ui/XImageManager.hpp>
14 #include <com/sun/star/ui/ItemType.hpp>
15 #include <com/sun/star/ui/ItemStyle.hpp>
16 #include <com/sun/star/frame/XLayoutManager.hpp>
18 #include <vcl/graph.hxx>
19 #include <vcl/bitmapex.hxx>
20 #include <vcl/image.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <basic/basmgr.hxx>
24 #include <filter/msfilter/msvbahelper.hxx>
25 #include <svtools/miscopt.hxx>
26 #include <vcl/svapp.hxx>
27 #include <vcl/window.hxx>
29 using namespace com::sun::star
;
31 int TBBase::nIndent
= 0;
33 void CustomToolBarImportHelper::ScaleImage( uno::Reference
< graphic::XGraphic
>& xGraphic
, long nNewSize
)
35 Graphic
aGraphic( xGraphic
);
36 Size aSize
= aGraphic
.GetSizePixel();
37 if ( aSize
.Height() && ( aSize
.Height() == aSize
.Width() ) )
39 Image
aImage( xGraphic
);
40 if ( aSize
.Height() != nNewSize
)
42 BitmapEx aBitmap
= aImage
.GetBitmapEx();
43 BitmapEx aBitmapex
= BitmapEx::AutoScaleBitmap(aBitmap
, nNewSize
);
44 aImage
= Image( aBitmapex
);
45 xGraphic
= aImage
.GetXGraphic();
50 void CustomToolBarImportHelper::applyIcons()
52 for ( std::vector
< iconcontrolitem
>::iterator it
= iconcommands
.begin(); it
!= iconcommands
.end(); ++it
)
54 uno::Sequence
< OUString
> commands(1);
55 commands
[ 0 ] = it
->sCommand
;
56 uno::Sequence
< uno::Reference
< graphic::XGraphic
> > images(1);
57 images
[ 0 ] = it
->image
;
59 OSL_TRACE("About to applyIcons for command %s, have image ? %s", OUStringToOString( commands
[ 0 ], RTL_TEXTENCODING_UTF8
).getStr(), images
[ 0 ].is() ? "yes" : "no" );
60 uno::Reference
< ui::XImageManager
> xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW
);
61 sal_uInt16 nColor
= ui::ImageType::COLOR_NORMAL
;
63 Window
* topwin
= Application::GetActiveTopWindow();
64 if ( topwin
!= NULL
&& topwin
->GetDisplayBackground().GetColor().IsDark() )
65 nColor
= css::ui::ImageType::COLOR_HIGHCONTRAST
;
67 ScaleImage( images
[ 0 ], 16 );
68 xImageManager
->replaceImages( ui::ImageType::SIZE_DEFAULT
| nColor
, commands
, images
);
69 ScaleImage( images
[ 0 ], 26 );
70 xImageManager
->replaceImages( ui::ImageType::SIZE_LARGE
| nColor
, commands
, images
);
74 void CustomToolBarImportHelper::addIcon( const uno::Reference
< graphic::XGraphic
>& xImage
, const OUString
& sString
)
77 item
.sCommand
= sString
;
79 iconcommands
.push_back( item
);
82 CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell
& rDocShell
, const css::uno::Reference
< css::ui::XUIConfigurationManager
>& rxAppCfgMgr
) : mrDocSh( rDocShell
)
84 m_xCfgSupp
.set( mrDocSh
.GetModel(), uno::UNO_QUERY_THROW
);
85 m_xAppCfgMgr
.set( rxAppCfgMgr
, uno::UNO_QUERY_THROW
);
88 uno::Reference
< ui::XUIConfigurationManager
>
89 CustomToolBarImportHelper::getCfgManager()
91 return m_xCfgSupp
->getUIConfigurationManager();
94 uno::Reference
< ui::XUIConfigurationManager
>
95 CustomToolBarImportHelper::getAppCfgManager()
101 CustomToolBarImportHelper::createCommandFromMacro( const OUString
& sCmd
)
103 //"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
104 static OUString
scheme( "vnd.sun.star.script:" );
105 static OUString
part2( "?language=Basic&location=document" );
107 OUString scriptURL
= scheme
+ sCmd
+ part2
;
108 return uno::makeAny( scriptURL
);
111 OUString
CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd
)
114 if ( pMSOCmdConvertor
.get() )
115 result
= pMSOCmdConvertor
->MSOCommandToOOCommand( msoCmd
);
119 OUString
CustomToolBarImportHelper::MSOTCIDToOOCommand( sal_Int16 msoTCID
)
122 if ( pMSOCmdConvertor
.get() )
123 result
= pMSOCmdConvertor
->MSOTCIDToOOCommand( msoTCID
);
128 CustomToolBarImportHelper::createMenu( const OUString
& rName
, const uno::Reference
< container::XIndexAccess
>& xMenuDesc
, bool bPersist
)
133 uno::Reference
< ui::XUIConfigurationManager
> xCfgManager( getCfgManager() );
134 OUString
sMenuBar("private:resource/menubar/");
136 uno::Reference
< container::XIndexContainer
> xPopup( xCfgManager
->createSettings(), uno::UNO_QUERY_THROW
);
137 uno::Reference
< beans::XPropertySet
> xProps( xPopup
, uno::UNO_QUERY_THROW
);
138 // set name for menubar
139 xProps
->setPropertyValue( OUString("UIName"), uno::makeAny( rName
) );
142 uno::Sequence
< beans::PropertyValue
> aPopupMenu( 4 );
143 aPopupMenu
[0].Name
= OUString("CommandURL");
144 aPopupMenu
[0].Value
= uno::makeAny( OUString("vnd.openoffice.org:") + rName
);
145 aPopupMenu
[1].Name
= OUString("Label");
146 aPopupMenu
[1].Value
<<= rName
;
147 aPopupMenu
[2].Name
= OUString("ItemDescriptorContainer");
148 aPopupMenu
[2].Value
= uno::makeAny( xMenuDesc
);
149 aPopupMenu
[3].Name
= OUString("Type" );
150 aPopupMenu
[3].Value
<<= sal_Int32( 0 );
152 xPopup
->insertByIndex( xPopup
->getCount(), uno::makeAny( aPopupMenu
) );
155 xCfgManager
->insertSettings( sMenuBar
, uno::Reference
< container::XIndexAccess
>( xPopup
, uno::UNO_QUERY
) );
156 uno::Reference
< ui::XUIConfigurationPersistence
> xPersistence( xCfgManager
, uno::UNO_QUERY_THROW
);
157 xPersistence
->store();
161 catch( const uno::Exception
& )
169 TBBase::indent_printf( FILE* fp
, const char* format
, ... )
172 va_start ( ap
, format
);
174 // indent nIndent spaces
175 for ( int i
=0; i
<nIndent
; ++i
)
177 // append the rest of the message
178 vfprintf( fp
, format
, ap
);
182 TBCHeader::TBCHeader() : bSignature( 0x3 )
185 ,tct(0x1) // default to Button
192 TBCHeader::~TBCHeader()
196 bool TBCHeader::Read( SvStream
&rS
)
198 OSL_TRACE("TBCHeader::Read() stream pos 0x%x", rS
.Tell() );
200 rS
>> bSignature
>> bVersion
>> bFlagsTCR
>> tct
>> tcid
>> tbct
>> bPriority
;
201 // bit 4 ( from lsb )
202 if ( bFlagsTCR
& 0x10 )
204 width
.reset( new sal_uInt16
);
205 height
.reset( new sal_uInt16
);
206 rS
>> *width
>> *height
;
211 void TBCHeader::Print( FILE* fp
)
214 indent_printf(fp
,"[ 0x%x ] TBCHeader -- dump\n", nOffSet
);
215 indent_printf(fp
," bSignature 0x%x\n", bSignature
);
216 indent_printf(fp
," bVersion 0x%x\n", bVersion
);
217 indent_printf(fp
," bFlagsTCR 0x%x\n", bFlagsTCR
);
218 indent_printf(fp
," tct 0x%x\n", tct
);
219 indent_printf(fp
," tcid 0x%x\n", tcid
);
220 indent_printf(fp
," tbct 0x%x\n", static_cast< unsigned int >( tbct
));
221 indent_printf(fp
," bPriority 0x%x\n", bPriority
);
223 indent_printf(fp
," width 0x%d(0x%x)\n", *width
, *width
);
225 indent_printf(fp
," height 0x%d(0x%x)\n", *height
, *height
);
228 TBCData::TBCData( const TBCHeader
& Header
) : rHeader( Header
)
232 bool TBCData::Read(SvStream
&rS
)
234 OSL_TRACE("TBCData::Read() stream pos 0x%x", rS
.Tell() );
236 if ( !controlGeneralInfo
.Read(rS
) /*|| !controlSpecificInfo.Read(rS)*/ )
238 switch ( rHeader
.getTct() )
240 case 0x01: // (Button control)
241 case 0x10: // (ExpandingGrid control)
242 controlSpecificInfo
.reset( new TBCBSpecific() );
244 case 0x0A: // (Popup control)
245 case 0x0C: // (ButtonPopup control)
246 case 0x0D: // (SplitButtonPopup control)
247 case 0x0E: // (SplitButtonMRUPopup control)
248 controlSpecificInfo
.reset( new TBCMenuSpecific() );
250 case 0x02: // (Edit control)
251 case 0x04: // (ComboBox control)
252 case 0x14: // (GraphicCombo control)
253 case 0x03: // (DropDown control)
254 case 0x06: // (SplitDropDown control)
255 case 0x09: // (GraphicDropDown control)
256 controlSpecificInfo
.reset( new TBCComboDropdownSpecific( rHeader
) );
261 if ( controlSpecificInfo
.get() )
262 return controlSpecificInfo
->Read( rS
);
263 //#FIXME I need to be able to handle different controlSpecificInfo types.
267 TBCMenuSpecific
* TBCData::getMenuSpecific()
269 TBCMenuSpecific
* pMenu
= dynamic_cast< TBCMenuSpecific
* >( controlSpecificInfo
.get() );
272 bool TBCData::ImportToolBarControl( CustomToolBarImportHelper
& helper
, std::vector
< css::beans::PropertyValue
>& props
, bool& bBeginGroup
, bool bIsMenuBar
)
274 sal_uInt16 nStyle
= 0;
275 bBeginGroup
= rHeader
.isBeginGroup();
276 controlGeneralInfo
.ImportToolBarControlData( helper
, props
);
277 beans::PropertyValue aProp
;
278 aProp
.Name
= OUString("Visible") ;
279 aProp
.Value
= uno::makeAny( rHeader
.isVisible() ); // where is the visible attribute stored
280 props
.push_back( aProp
);
281 if ( rHeader
.getTct() == 0x01
282 || rHeader
.getTct() == 0x10 )
284 TBCBSpecific
* pSpecificInfo
= dynamic_cast< TBCBSpecific
* >( controlSpecificInfo
.get() );
287 // if we have a icon then lets set it for the command
289 for ( std::vector
< css::beans::PropertyValue
>::iterator it
= props
.begin(); it
!= props
.end(); ++it
)
291 if ( it
->Name
== "CommandURL" )
292 it
->Value
>>= sCommand
;
294 if ( TBCBitMap
* pIcon
= pSpecificInfo
->getIcon() )
296 // Without a command openoffice won't display the icon
297 if ( !sCommand
.isEmpty() )
299 BitmapEx
aBitEx( pIcon
->getBitMap() );
300 if ( pSpecificInfo
->getIconMask() )
301 // according to the spec:
302 // "the iconMask is white in all the areas in which the icon is
303 // displayed as transparent and is black in all other areas."
304 aBitEx
= BitmapEx( aBitEx
.GetBitmap(), pSpecificInfo
->getIconMask()->getBitMap().CreateMask( Color( COL_WHITE
) ) );
306 Graphic
aGraphic( aBitEx
);
307 helper
.addIcon( aGraphic
.GetXGraphic(), sCommand
);
310 else if ( pSpecificInfo
->getBtnFace() )
313 OUString sBuiltInCmd
= helper
.MSOTCIDToOOCommand( *pSpecificInfo
->getBtnFace() );
314 if ( !sBuiltInCmd
.isEmpty() )
316 uno::Sequence
< OUString
> sCmds(1);
317 sCmds
[ 0 ] = sBuiltInCmd
;
318 uno::Reference
< ui::XImageManager
> xImageManager( helper
.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW
);
319 // 0 = default image size
320 uno::Sequence
< uno::Reference
< graphic::XGraphic
> > sImages
= xImageManager
->getImages( 0, sCmds
);
321 if ( sImages
.getLength() && sImages
[0].is() )
322 helper
.addIcon( sImages
[0], sCommand
);
327 else if ( rHeader
.getTct() == 0x0a )
329 aProp
.Name
= OUString("CommandURL") ;
330 OUString
sMenuBar("private:resource/menubar/");
332 TBCMenuSpecific
* pMenu
= getMenuSpecific();
334 aProp
.Value
= uno::makeAny( sMenuBar
+= pMenu
->Name() ); // name of popup
335 nStyle
|= ui::ItemStyle::DROP_DOWN
;
336 props
.push_back( aProp
);
339 short icontext
= ( rHeader
.getTbct() & 0x03 );
340 aProp
.Name
= OUString("Style") ;
343 nStyle
|= ui::ItemStyle::TEXT
;
344 if ( !icontext
|| icontext
== 0x3 )
346 nStyle
|= ui::ItemStyle::ICON
;
350 if ( ( icontext
& 0x02 ) == 0x02 )
351 nStyle
|= ui::ItemStyle::TEXT
;
352 if ( !icontext
|| ( icontext
& 0x03 ) == 0x03 )
353 nStyle
|= ui::ItemStyle::ICON
;
355 aProp
.Value
<<= nStyle
;
356 props
.push_back( aProp
);
357 return true; // just ignore
360 void TBCData::Print( FILE* fp
)
363 indent_printf(fp
,"[ 0x%x ] TBCData -- dump\n", nOffSet
);
364 indent_printf(fp
," dumping controlGeneralInfo( TBCGeneralInfo )\n");
365 controlGeneralInfo
.Print( fp
);
366 //if ( rHeader.getTct() == 1 )
367 if ( controlSpecificInfo
.get() )
369 indent_printf(fp
," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
370 controlSpecificInfo
->Print( fp
);
375 WString::Read( SvStream
&rS
)
377 OSL_TRACE("WString::Read() stream pos 0x%x", rS
.Tell() );
379 sal_uInt8 nChars
= 0;
381 sString
= read_uInt16s_ToOUString(rS
, nChars
);
385 TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 )
390 TBCExtraInfo::Read( SvStream
&rS
)
392 OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", rS
.Tell() );
394 if( !wstrHelpFile
.Read( rS
) )
399 if ( !wstrTag
.Read( rS
) || !wstrOnAction
.Read( rS
) || !wstrParam
.Read( rS
) )
407 TBCExtraInfo::Print( FILE* fp
)
410 indent_printf( fp
, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet
);
411 indent_printf( fp
, " wstrHelpFile %s\n",
412 OUStringToOString( wstrHelpFile
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
413 indent_printf( fp
, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext
) );
414 indent_printf( fp
, " wstrTag %s\n",
415 OUStringToOString( wstrTag
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
416 indent_printf( fp
, " wstrOnAction %s\n",
417 OUStringToOString( wstrOnAction
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
418 indent_printf( fp
, " wstrParam %s\n",
419 OUStringToOString( wstrParam
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
420 indent_printf( fp
, " tbcu 0x%x\n", tbcu
);
421 indent_printf( fp
, " tbmg 0x%x\n", tbmg
);
426 TBCExtraInfo::getOnAction()
428 return wstrOnAction
.getString();
431 TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
435 bool TBCGeneralInfo::Read( SvStream
&rS
)
437 OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", rS
.Tell() );
441 if ( ( bFlags
& 0x1 ) && !customText
.Read( rS
) )
443 if ( ( bFlags
& 0x2 ) && ( !descriptionText
.Read( rS
) || !tooltip
.Read( rS
) ) )
445 if ( ( bFlags
& 0x4 ) && !extraInfo
.Read( rS
) )
451 TBCGeneralInfo::Print( FILE* fp
)
454 indent_printf( fp
, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet
);
455 indent_printf( fp
, " bFlags 0x%x\n", bFlags
);
456 indent_printf( fp
, " customText %s\n",
457 OUStringToOString( customText
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
458 indent_printf( fp
, " description %s\n",
459 OUStringToOString( descriptionText
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
460 indent_printf( fp
, " tooltip %s\n",
461 OUStringToOString( tooltip
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
463 extraInfo
.Print( fp
);
467 TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper
& helper
, std::vector
< beans::PropertyValue
>& sControlData
)
469 if ( ( bFlags
& 0x5 ) )
471 beans::PropertyValue aProp
;
472 // probably access to the header would be a better test than seeing if there is an action, e.g.
473 // if ( rHeader.getTct() == 0x01 && rHeader.getTcID() == 0x01 ) // not defined, probably this is a command
474 if ( !extraInfo
.getOnAction().isEmpty() )
476 aProp
.Name
= OUString("CommandURL");
477 ooo::vba::MacroResolvedInfo aMacroInf
= ooo::vba::resolveVBAMacro( &helper
.GetDocShell(), extraInfo
.getOnAction(), true );
478 if ( aMacroInf
.mbFound
)
479 aProp
.Value
= helper
.createCommandFromMacro( aMacroInf
.msResolvedMacro
);
481 aProp
.Value
<<= OUString( "UnResolvedMacro[" ).concat( extraInfo
.getOnAction() ).concat( OUString( "]" ) );
482 sControlData
.push_back( aProp
);
485 aProp
.Name
= OUString("Label");
486 aProp
.Value
= uno::makeAny( customText
.getString().replace('&','~') );
487 sControlData
.push_back( aProp
);
489 aProp
.Name
= OUString("Type");
490 aProp
.Value
= uno::makeAny( ui::ItemType::DEFAULT
);
491 sControlData
.push_back( aProp
);
493 aProp
.Name
= OUString("Tooltip");
494 aProp
.Value
= uno::makeAny( tooltip
.getString() );
495 sControlData
.push_back( aProp
);
497 aToolbarItem(0).Name = "CommandURL" wstrOnAction
498 aToolbarItem(0).Value = Command
499 aToolbarItem(1).Name = "Label" customText
500 aToolbarItem(1).Value = Label
501 aToolbarItem(2).Name = "Type"
502 aToolbarItem(2).Value = 0
503 aToolbarItem(3).Name = "Visible"
504 aToolbarItem(3).Value = true
510 TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
515 TBCMenuSpecific::Read( SvStream
&rS
)
517 OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", rS
.Tell() );
522 name
.reset( new WString() );
523 return name
->Read( rS
);
529 TBCMenuSpecific::Print( FILE* fp
)
532 indent_printf( fp
, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet
);
533 indent_printf( fp
, " tbid 0x%x\n", static_cast< unsigned int >( tbid
) );
535 indent_printf( fp
, " name %s\n", OUStringToOString( name
->getString(), RTL_TEXTENCODING_UTF8
).getStr() );
539 OUString
TBCMenuSpecific::Name()
543 aName
= name
->getString();
546 TBCBSpecific::TBCBSpecific() : bFlags( 0 )
550 bool TBCBSpecific::Read( SvStream
&rS
)
552 OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", rS
.Tell() );
556 // bFlags determines what we read next
558 // bFlags.fCustomBitmap = 1 ( 0x8 ) set
561 icon
.reset( new TBCBitMap() );
562 iconMask
.reset( new TBCBitMap() );
563 if ( !icon
->Read( rS
) || !iconMask
->Read( rS
) )
566 // if bFlags.fCustomBtnFace = 1 ( 0x10 )
569 iBtnFace
.reset( new sal_uInt16
);
570 rS
>> *iBtnFace
.get();
572 // if bFlags.fAccelerator equals 1 ( 0x04 )
575 wstrAcc
.reset( new WString() );
576 return wstrAcc
->Read( rS
);
582 void TBCBSpecific::Print( FILE* fp
)
585 indent_printf( fp
, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet
);
586 indent_printf( fp
, " bFlags 0x%x\n", bFlags
);
587 bool bResult
= ( icon
.get() != NULL
);
588 indent_printf( fp
, " icon present? %s\n", bResult
? "true" : "false" );
592 indent_printf( fp
, " icon: \n");
593 icon
->Print( fp
); // will dump size
595 bResult
= ( iconMask
.get() != NULL
);
596 indent_printf( fp
, " icon mask present? %s\n", bResult
? "true" : "false" );
600 indent_printf( fp
, " icon mask: \n");
601 iconMask
->Print( fp
); // will dump size
603 if ( iBtnFace
.get() )
605 indent_printf( fp
, " iBtnFace 0x%x\n", *(iBtnFace
.get()) );
607 bResult
= ( wstrAcc
.get() != NULL
);
608 indent_printf( fp
, " option string present? %s ->%s<-\n", bResult
? "true" : "false", bResult
? OUStringToOString( wstrAcc
->getString(), RTL_TEXTENCODING_UTF8
).getStr() : "N/A" );
612 TBCBSpecific::getIcon()
618 TBCBSpecific::getIconMask()
620 return iconMask
.get();
623 TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader
& header
)
625 if ( header
.getTcID() == 0x01 )
626 data
.reset( new TBCCDData() );
629 bool TBCComboDropdownSpecific::Read( SvStream
&rS
)
633 return data
->Read( rS
);
637 void TBCComboDropdownSpecific::Print( FILE* fp
)
640 indent_printf(fp
,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet
);
644 indent_printf(fp
," no data " );
647 TBCCDData::TBCCDData() : cwstrItems( 0 )
654 TBCCDData::~TBCCDData()
658 bool TBCCDData::Read( SvStream
&rS
)
664 for( sal_Int32 index
=0; index
< cwstrItems
; ++index
)
667 if ( !aString
.Read( rS
) )
669 wstrList
.push_back( aString
);
672 rS
>> cwstrMRU
>> iSel
>> cLines
>> dxWidth
;
674 return wstrEdit
.Read( rS
);
677 void TBCCDData::Print( FILE* fp
)
680 indent_printf(fp
,"[ 0x%x ] TBCCDData -- dump\n", nOffSet
);
681 indent_printf(fp
," cwstrItems items in wstrList 0x%d\n", cwstrItems
);
682 for ( sal_Int32 index
=0; index
< cwstrItems
; ++index
)
685 indent_printf(fp
, " wstrList[%d] %s", static_cast< int >( index
), OUStringToOString( wstrList
[index
].getString(), RTL_TEXTENCODING_UTF8
).getStr() );
687 indent_printf(fp
," cwstrMRU num most recently used string 0x%d item\n", cwstrMRU
);
688 indent_printf(fp
," iSel index of selected item 0x%d item\n", iSel
);
689 indent_printf(fp
," cLines num of suggested lines to display 0x%d", cLines
);
690 indent_printf(fp
," dxWidth width in pixels 0x%d", dxWidth
);
691 indent_printf(fp
," wstrEdit %s", OUStringToOString( wstrEdit
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
694 TBCBitMap::TBCBitMap() : cbDIB( 0 )
698 TBCBitMap::~TBCBitMap()
704 TBCBitMap::getBitMap()
709 bool TBCBitMap::Read( SvStream
& rS
)
711 OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", rS
.Tell() );
714 // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
715 return mBitMap
.Read( rS
, sal_False
, sal_True
);
718 void TBCBitMap::Print( FILE* fp
)
721 indent_printf(fp
, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet
);
722 indent_printf(fp
, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB
) );
725 TB::TB() : bSignature(0x2),
735 bool TB::Read(SvStream
&rS
)
737 OSL_TRACE("TB::Read() stream pos 0x%x", rS
.Tell() );
739 rS
>> bSignature
>> bVersion
>> cCL
>> ltbid
>> ltbtr
>> cRowsDefault
>> bFlags
;
747 return ( bFlags
& 0x01 ) != 0x01;
750 void TB::Print( FILE* fp
)
753 indent_printf(fp
,"[ 0x%x ] TB -- dump\n", nOffSet
);
754 indent_printf(fp
," bSignature 0x%x\n", bSignature
);
755 indent_printf(fp
," bVersion 0x%x\n", bVersion
);
756 indent_printf(fp
," cCL 0x%x\n", cCL
);
757 indent_printf(fp
," ltbid 0x%x\n", ltbid
);
758 indent_printf(fp
," ltbtr 0x%x\n", ltbtr
);
759 indent_printf(fp
," cRowsDefault 0x%x\n", cRowsDefault
);
760 indent_printf(fp
," bFlags 0x%x\n", bFlags
);
761 indent_printf(fp
, " name %s\n", OUStringToOString( name
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
764 TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0)
768 bool TBVisualData::Read( SvStream
& rS
)
770 OSL_TRACE("TBVisualData::Read() stream pos 0x%x", rS
.Tell() );
772 rS
>> tbds
>> tbv
>> tbdsDock
>> iRow
;
778 void SRECT::Print( FILE* fp
)
781 indent_printf( fp
, " left 0x%x\n", left
);
782 indent_printf( fp
, " top 0x%x\n", top
);
783 indent_printf( fp
, " right 0x%x\n", right
);
784 indent_printf( fp
, " bottom 0x%x\n", bottom
);
787 void TBVisualData::Print( FILE* fp
)
790 indent_printf( fp
, "[ 0x%x ] TBVisualData -- dump\n", nOffSet
);
791 indent_printf( fp
, " tbds 0x%x\n", tbds
);
792 indent_printf( fp
, " tbv 0x%x\n", tbv
);
793 indent_printf( fp
, " tbdsDoc 0x%x\n", tbdsDock
);
794 indent_printf( fp
, " iRow 0x%x\n", iRow
);
799 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */