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/.
10 #include <sal/config.h>
12 #include <comphelper/propertyvalue.hxx>
13 #include <filter/msfilter/mstoolbar.hxx>
14 #include <o3tl/safeint.hxx>
15 #include <sal/log.hxx>
16 #include <com/sun/star/beans/XPropertySet.hpp>
17 #include <com/sun/star/container/XIndexContainer.hpp>
18 #include <com/sun/star/frame/XModel.hpp>
19 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
20 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
21 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
22 #include <com/sun/star/ui/XImageManager.hpp>
23 #include <com/sun/star/ui/ImageType.hpp>
24 #include <com/sun/star/ui/ItemType.hpp>
25 #include <com/sun/star/ui/ItemStyle.hpp>
27 #include <vcl/dibtools.hxx>
28 #include <vcl/graph.hxx>
29 #include <vcl/bitmapex.hxx>
30 #include <sfx2/objsh.hxx>
31 #include <filter/msfilter/msvbahelper.hxx>
32 #include <vcl/svapp.hxx>
33 #include <vcl/window.hxx>
35 using namespace com::sun::star
;
37 int TBBase::nIndent
= 0;
39 void CustomToolBarImportHelper::ScaleImage( uno::Reference
< graphic::XGraphic
>& xGraphic
, tools::Long nNewSize
)
41 Graphic
aGraphic( xGraphic
);
42 Size aSize
= aGraphic
.GetSizePixel();
43 if ( aSize
.Height() && ( aSize
.Height() == aSize
.Width() ) )
45 Graphic
aImage(xGraphic
);
46 if ( aSize
.Height() != nNewSize
)
48 BitmapEx aBitmap
= aImage
.GetBitmapEx();
49 BitmapEx aBitmapex
= BitmapEx::AutoScaleBitmap(aBitmap
, nNewSize
);
50 aImage
= Graphic(aBitmapex
);
51 xGraphic
= aImage
.GetXGraphic();
56 void CustomToolBarImportHelper::applyIcons()
58 for (auto const& concommand
: iconcommands
)
60 uno::Sequence
<OUString
> commands
{ concommand
.sCommand
};
61 uno::Sequence
< uno::Reference
< graphic::XGraphic
> > images
{ concommand
.image
};
62 auto pimages
= images
.getArray();
64 uno::Reference
< ui::XImageManager
> xImageManager( getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW
);
65 sal_uInt16 nColor
= ui::ImageType::COLOR_NORMAL
;
67 vcl::Window
* topwin
= Application::GetActiveTopWindow();
68 if ( topwin
!= nullptr && topwin
->GetBackgroundColor().IsDark() )
69 nColor
= css::ui::ImageType::COLOR_HIGHCONTRAST
;
71 ScaleImage( pimages
[ 0 ], 16 );
72 xImageManager
->replaceImages( ui::ImageType::SIZE_DEFAULT
| nColor
, commands
, images
);
73 ScaleImage( pimages
[ 0 ], 26 );
74 xImageManager
->replaceImages( ui::ImageType::SIZE_LARGE
| nColor
, commands
, images
);
78 void CustomToolBarImportHelper::addIcon( const uno::Reference
< graphic::XGraphic
>& xImage
, const OUString
& sString
)
81 item
.sCommand
= sString
;
83 iconcommands
.push_back( item
);
86 CustomToolBarImportHelper::CustomToolBarImportHelper( SfxObjectShell
& rDocShell
, const css::uno::Reference
< css::ui::XUIConfigurationManager
>& rxAppCfgMgr
) : mrDocSh( rDocShell
)
88 m_xCfgSupp
.set( mrDocSh
.GetModel(), uno::UNO_QUERY_THROW
);
89 m_xAppCfgMgr
.set( rxAppCfgMgr
, uno::UNO_SET_THROW
);
92 uno::Reference
< ui::XUIConfigurationManager
>
93 CustomToolBarImportHelper::getCfgManager()
95 return m_xCfgSupp
->getUIConfigurationManager();
100 CustomToolBarImportHelper::createCommandFromMacro( std::u16string_view sCmd
)
102 //"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=document"
105 = OUString::Concat("vnd.sun.star.script:") + sCmd
+ "?language=Basic&location=document";
106 return uno::Any( scriptURL
);
109 OUString
CustomToolBarImportHelper::MSOCommandToOOCommand( sal_Int16 msoCmd
)
112 if (pMSOCmdConvertor
)
113 result
= pMSOCmdConvertor
->MSOCommandToOOCommand( msoCmd
);
117 OUString
CustomToolBarImportHelper::MSOTCIDToOOCommand( sal_Int16 msoTCID
)
120 if (pMSOCmdConvertor
)
121 result
= pMSOCmdConvertor
->MSOTCIDToOOCommand( msoTCID
);
126 CustomToolBarImportHelper::createMenu( const OUString
& rName
, const uno::Reference
< container::XIndexAccess
>& xMenuDesc
)
131 uno::Reference
< ui::XUIConfigurationManager
> xCfgManager( getCfgManager() );
132 OUString sMenuBar
= "private:resource/menubar/" + rName
;
133 uno::Reference
< container::XIndexContainer
> xPopup( xCfgManager
->createSettings(), uno::UNO_SET_THROW
);
134 uno::Reference
< beans::XPropertySet
> xProps( xPopup
, uno::UNO_QUERY_THROW
);
135 // set name for menubar
136 xProps
->setPropertyValue("UIName", uno::Any( rName
) );
139 uno::Sequence
< beans::PropertyValue
> aPopupMenu
{
140 comphelper::makePropertyValue("CommandURL", "vnd.openoffice.org:" + rName
),
141 comphelper::makePropertyValue("Label", rName
),
142 comphelper::makePropertyValue("ItemDescriptorContainer", xMenuDesc
),
143 comphelper::makePropertyValue("Type", sal_Int32( 0 ))
146 xPopup
->insertByIndex( xPopup
->getCount(), uno::Any( aPopupMenu
) );
147 xCfgManager
->insertSettings( sMenuBar
, xPopup
);
148 uno::Reference
< ui::XUIConfigurationPersistence
> xPersistence( xCfgManager
, uno::UNO_QUERY_THROW
);
149 xPersistence
->store();
152 catch( const uno::Exception
& )
159 #ifdef DEBUG_FILTER_MSTOOLBAR
160 void TBBase::indent_printf( FILE* fp
, const char* format
, ... )
163 va_start ( ap
, format
);
165 // indent nIndent spaces
166 for ( int i
=0; i
<nIndent
; ++i
)
168 // append the rest of the message
169 vfprintf( fp
, format
, ap
);
174 TBCHeader::TBCHeader()
178 , tct(0x1) // default to Button
185 TBCHeader::~TBCHeader()
189 bool TBCHeader::Read( SvStream
&rS
)
191 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
193 rS
.ReadSChar( bSignature
).ReadSChar( bVersion
).ReadUChar( bFlagsTCR
).ReadUChar( tct
).ReadUInt16( tcid
).ReadUInt32( tbct
).ReadUChar( bPriority
);
194 // bit 4 ( from lsb )
195 if ( bFlagsTCR
& 0x10 )
197 width
= std::make_shared
<sal_uInt16
>();
198 height
= std::make_shared
<sal_uInt16
>();
199 rS
.ReadUInt16( *width
).ReadUInt16( *height
);
204 #ifdef DEBUG_FILTER_MSTOOLBAR
205 void TBCHeader::Print( FILE* fp
)
208 indent_printf(fp
,"[ 0x%x ] TBCHeader -- dump\n", nOffSet
);
209 indent_printf(fp
," bSignature 0x%x\n", bSignature
);
210 indent_printf(fp
," bVersion 0x%x\n", bVersion
);
211 indent_printf(fp
," bFlagsTCR 0x%x\n", bFlagsTCR
);
212 indent_printf(fp
," tct 0x%x\n", tct
);
213 indent_printf(fp
," tcid 0x%x\n", tcid
);
214 indent_printf(fp
," tbct 0x%x\n", static_cast< unsigned int >( tbct
));
215 indent_printf(fp
," bPriority 0x%x\n", bPriority
);
217 indent_printf(fp
," width %d(0x%x)\n", *width
, *width
);
219 indent_printf(fp
," height %d(0x%x)\n", *height
, *height
);
223 TBCData::TBCData( TBCHeader Header
) : rHeader(std::move( Header
))
227 bool TBCData::Read(SvStream
&rS
)
229 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
231 if ( !controlGeneralInfo
.Read(rS
) /*|| !controlSpecificInfo.Read(rS)*/ )
233 switch ( rHeader
.getTct() )
235 case 0x01: // (Button control)
236 case 0x10: // (ExpandingGrid control)
237 controlSpecificInfo
= std::make_shared
<TBCBSpecific
>();
239 case 0x0A: // (Popup control)
240 case 0x0C: // (ButtonPopup control)
241 case 0x0D: // (SplitButtonPopup control)
242 case 0x0E: // (SplitButtonMRUPopup control)
243 controlSpecificInfo
= std::make_shared
<TBCMenuSpecific
>();
245 case 0x02: // (Edit control)
246 case 0x04: // (ComboBox control)
247 case 0x14: // (GraphicCombo control)
248 case 0x03: // (DropDown control)
249 case 0x06: // (SplitDropDown control)
250 case 0x09: // (GraphicDropDown control)
251 controlSpecificInfo
= std::make_shared
<TBCComboDropdownSpecific
>( rHeader
);
256 if ( controlSpecificInfo
)
257 return controlSpecificInfo
->Read( rS
);
258 //#FIXME I need to be able to handle different controlSpecificInfo types.
262 TBCMenuSpecific
* TBCData::getMenuSpecific()
264 TBCMenuSpecific
* pMenu
= dynamic_cast< TBCMenuSpecific
* >( controlSpecificInfo
.get() );
267 void TBCData::ImportToolBarControl( CustomToolBarImportHelper
& helper
, std::vector
< css::beans::PropertyValue
>& props
, bool& bBeginGroup
, bool bIsMenuBar
)
269 sal_uInt16 nStyle
= 0;
270 bBeginGroup
= rHeader
.isBeginGroup();
271 controlGeneralInfo
.ImportToolBarControlData( helper
, props
);
272 beans::PropertyValue aProp
;
273 aProp
.Name
= "Visible";
274 aProp
.Value
<<= rHeader
.isVisible(); // where is the visible attribute stored
275 props
.push_back( aProp
);
276 if ( rHeader
.getTct() == 0x01
277 || rHeader
.getTct() == 0x10 )
279 TBCBSpecific
* pSpecificInfo
= dynamic_cast< TBCBSpecific
* >( controlSpecificInfo
.get() );
282 // if we have an icon then lets set it for the command
284 for (auto const& property
: props
)
286 // TODO JNA : couldn't we break if we find CommandURL to avoid keeping on the loop?
287 if ( property
.Name
== "CommandURL" )
288 property
.Value
>>= sCommand
;
290 if ( TBCBitMap
* pIcon
= pSpecificInfo
->getIcon() )
292 // Without a command openoffice won't display the icon
293 if ( !sCommand
.isEmpty() )
295 BitmapEx
aBitEx( pIcon
->getBitMap() );
296 TBCBitMap
* pIconMask
= pSpecificInfo
->getIconMask();
299 const Bitmap
& rMaskBase(pIconMask
->getBitMap().GetBitmap());
300 Size aMaskSize
= rMaskBase
.GetSizePixel();
301 if (aMaskSize
.Width() && aMaskSize
.Height())
303 // according to the spec:
304 // "the iconMask is white in all the areas in which the icon is
305 // displayed as transparent and is black in all other areas."
306 aBitEx
= BitmapEx(aBitEx
.GetBitmap(), rMaskBase
.CreateMask(COL_WHITE
));
310 Graphic
aGraphic( aBitEx
);
311 helper
.addIcon( aGraphic
.GetXGraphic(), sCommand
);
314 else if ( pSpecificInfo
->getBtnFace() )
317 OUString sBuiltInCmd
= helper
.MSOTCIDToOOCommand( *pSpecificInfo
->getBtnFace() );
318 if ( !sBuiltInCmd
.isEmpty() )
320 uno::Sequence
<OUString
> sCmds
{ sBuiltInCmd
};
321 uno::Reference
< ui::XImageManager
> xImageManager( helper
.getAppCfgManager()->getImageManager(), uno::UNO_QUERY_THROW
);
322 // 0 = default image size
323 uno::Sequence
< uno::Reference
< graphic::XGraphic
> > sImages
= xImageManager
->getImages( 0, sCmds
);
324 if ( sImages
.hasElements() && sImages
[0].is() )
325 helper
.addIcon( sImages
[0], sCommand
);
330 else if ( rHeader
.getTct() == 0x0a )
332 aProp
.Name
= "CommandURL";
334 TBCMenuSpecific
* pMenu
= getMenuSpecific();
337 OUString sMenuBar
= "private:resource/menubar/" + pMenu
->Name();
338 aProp
.Value
<<= sMenuBar
; // name of popup
340 nStyle
|= ui::ItemStyle::DROP_DOWN
;
341 props
.push_back( aProp
);
344 short icontext
= ( rHeader
.getTbct() & 0x03 );
345 aProp
.Name
= "Style";
348 nStyle
|= ui::ItemStyle::TEXT
;
349 if ( !icontext
|| icontext
== 0x3 )
351 nStyle
|= ui::ItemStyle::ICON
;
355 if ( ( icontext
& 0x02 ) == 0x02 )
356 nStyle
|= ui::ItemStyle::TEXT
;
357 if ( !icontext
|| ( icontext
& 0x03 ) == 0x03 )
358 nStyle
|= ui::ItemStyle::ICON
;
360 aProp
.Value
<<= nStyle
;
361 props
.push_back( aProp
);
364 #ifdef DEBUG_FILTER_MSTOOLBAR
365 void TBCData::Print( FILE* fp
)
368 indent_printf(fp
,"[ 0x%x ] TBCData -- dump\n", nOffSet
);
369 indent_printf(fp
," dumping controlGeneralInfo( TBCGeneralInfo )\n");
370 controlGeneralInfo
.Print( fp
);
371 //if ( rHeader.getTct() == 1 )
372 if ( controlSpecificInfo
.get() )
374 indent_printf(fp
," dumping controlSpecificInfo( TBCBSpecificInfo )\n");
375 controlSpecificInfo
->Print( fp
);
381 WString::Read( SvStream
&rS
)
383 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
385 sal_uInt8 nChars
= 0;
386 rS
.ReadUChar( nChars
);
387 sString
= read_uInt16s_ToOUString(rS
, nChars
);
391 TBCExtraInfo::TBCExtraInfo()
399 TBCExtraInfo::Read( SvStream
&rS
)
401 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
403 if( !wstrHelpFile
.Read( rS
) )
406 rS
.ReadInt32( idHelpContext
);
408 if ( !wstrTag
.Read( rS
) || !wstrOnAction
.Read( rS
) || !wstrParam
.Read( rS
) )
411 rS
.ReadSChar( tbcu
).ReadSChar( tbmg
);
415 #ifdef DEBUG_FILTER_MSTOOLBAR
417 TBCExtraInfo::Print( FILE* fp
)
420 indent_printf( fp
, "[ 0x%x ] TBCExtraInfo -- dump\n", nOffSet
);
421 indent_printf( fp
, " wstrHelpFile %s\n",
422 OUStringToOString( wstrHelpFile
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
423 indent_printf( fp
, " idHelpContext 0x%x\n", static_cast< unsigned int >( idHelpContext
) );
424 indent_printf( fp
, " wstrTag %s\n",
425 OUStringToOString( wstrTag
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
426 indent_printf( fp
, " wstrOnAction %s\n",
427 OUStringToOString( wstrOnAction
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
428 indent_printf( fp
, " wstrParam %s\n",
429 OUStringToOString( wstrParam
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
430 indent_printf( fp
, " tbcu 0x%x\n", tbcu
);
431 indent_printf( fp
, " tbmg 0x%x\n", tbmg
);
436 TBCExtraInfo::getOnAction() const
438 return wstrOnAction
.getString();
441 TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 )
445 bool TBCGeneralInfo::Read( SvStream
&rS
)
447 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
449 rS
.ReadUChar( bFlags
);
451 if ( ( bFlags
& 0x1 ) && !customText
.Read( rS
) )
453 if ( ( bFlags
& 0x2 ) && ( !descriptionText
.Read( rS
) || !tooltip
.Read( rS
) ) )
455 if ( ( bFlags
& 0x4 ) && !extraInfo
.Read( rS
) )
460 #ifdef DEBUG_FILTER_MSFILTER
462 TBCGeneralInfo::Print( FILE* fp
)
465 indent_printf( fp
, "[ 0x%x ] TBCGeneralInfo -- dump\n", nOffSet
);
466 indent_printf( fp
, " bFlags 0x%x\n", bFlags
);
467 indent_printf( fp
, " customText %s\n",
468 OUStringToOString( customText
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
469 indent_printf( fp
, " description %s\n",
470 OUStringToOString( descriptionText
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
471 indent_printf( fp
, " tooltip %s\n",
472 OUStringToOString( tooltip
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
474 extraInfo
.Print( fp
);
479 TBCGeneralInfo::ImportToolBarControlData( CustomToolBarImportHelper
& helper
, std::vector
< beans::PropertyValue
>& sControlData
)
481 if ( !(bFlags
& 0x5) )
484 beans::PropertyValue aProp
;
485 // probably access to the header would be a better test than seeing if there is an action, e.g.
486 // if ( rHeader.getTct() == 0x01 && rHeader.getTcID() == 0x01 ) // not defined, probably this is a command
487 if ( !extraInfo
.getOnAction().isEmpty() )
489 aProp
.Name
= "CommandURL";
490 ooo::vba::MacroResolvedInfo aMacroInf
= ooo::vba::resolveVBAMacro( &helper
.GetDocShell(), extraInfo
.getOnAction(), true );
491 if ( aMacroInf
.mbFound
)
492 aProp
.Value
= CustomToolBarImportHelper::createCommandFromMacro( aMacroInf
.msResolvedMacro
);
494 aProp
.Value
<<= "UnResolvedMacro[" + extraInfo
.getOnAction() + "]";
495 sControlData
.push_back( aProp
);
498 aProp
.Name
= "Label";
499 aProp
.Value
<<= customText
.getString().replace('&','~');
500 sControlData
.push_back( aProp
);
503 aProp
.Value
<<= ui::ItemType::DEFAULT
;
504 sControlData
.push_back( aProp
);
506 aProp
.Name
= "Tooltip";
507 aProp
.Value
<<= tooltip
.getString();
508 sControlData
.push_back( aProp
);
510 aToolbarItem(0).Name = "CommandURL" wstrOnAction
511 aToolbarItem(0).Value = Command
512 aToolbarItem(1).Name = "Label" customText
513 aToolbarItem(1).Value = Label
514 aToolbarItem(2).Name = "Type"
515 aToolbarItem(2).Value = 0
516 aToolbarItem(3).Name = "Visible"
517 aToolbarItem(3).Value = true
521 TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 )
526 TBCMenuSpecific::Read( SvStream
&rS
)
528 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
530 rS
.ReadInt32( tbid
);
533 name
= std::make_shared
<WString
>();
534 return name
->Read( rS
);
539 #ifdef DEBUG_FILTER_MSFILTER
541 TBCMenuSpecific::Print( FILE* fp
)
544 indent_printf( fp
, "[ 0x%x ] TBCMenuSpecific -- dump\n", nOffSet
);
545 indent_printf( fp
, " tbid 0x%x\n", static_cast< unsigned int >( tbid
) );
547 indent_printf( fp
, " name %s\n", OUStringToOString( name
->getString(), RTL_TEXTENCODING_UTF8
).getStr() );
551 OUString
TBCMenuSpecific::Name()
555 aName
= name
->getString();
558 TBCBSpecific::TBCBSpecific() : bFlags( 0 )
562 bool TBCBSpecific::Read( SvStream
&rS
)
564 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
566 rS
.ReadUChar( bFlags
);
568 // bFlags determines what we read next
570 // bFlags.fCustomBitmap = 1 ( 0x8 ) set
573 icon
= std::make_shared
<TBCBitMap
>();
574 iconMask
= std::make_shared
<TBCBitMap
>();
575 if ( !icon
->Read( rS
) || !iconMask
->Read( rS
) )
578 // if bFlags.fCustomBtnFace = 1 ( 0x10 )
581 iBtnFace
= std::make_shared
<sal_uInt16
>();
582 rS
.ReadUInt16( *iBtnFace
);
584 // if bFlags.fAccelerator equals 1 ( 0x04 )
587 wstrAcc
= std::make_shared
<WString
>();
588 return wstrAcc
->Read( rS
);
594 #ifdef DEBUG_FILTER_MSFILTER
595 void TBCBSpecific::Print( FILE* fp
)
598 indent_printf( fp
, "[ 0x%x ] TBCBSpecific -- dump\n", nOffSet
);
599 indent_printf( fp
, " bFlags 0x%x\n", bFlags
);
600 bool bResult
= ( icon
.get() != NULL
);
601 indent_printf( fp
, " icon present? %s\n", bResult
? "true" : "false" );
605 indent_printf( fp
, " icon: \n");
606 icon
->Print( fp
); // will dump size
608 bResult
= ( iconMask
.get() != NULL
);
609 indent_printf( fp
, " icon mask present? %s\n", bResult
? "true" : "false" );
613 indent_printf( fp
, " icon mask: \n");
614 iconMask
->Print( fp
); // will dump size
616 if ( iBtnFace
.get() )
618 indent_printf( fp
, " iBtnFace 0x%x\n", *iBtnFace
);
620 bResult
= ( wstrAcc
.get() != NULL
);
621 indent_printf( fp
, " option string present? %s ->%s<-\n", bResult
? "true" : "false", bResult
? OUStringToOString( wstrAcc
->getString(), RTL_TEXTENCODING_UTF8
).getStr() : "N/A" );
626 TBCBSpecific::getIcon()
632 TBCBSpecific::getIconMask()
634 return iconMask
.get();
637 TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader
& header
)
639 if ( header
.getTcID() == 0x01 )
640 data
= std::make_shared
<TBCCDData
>();
643 bool TBCComboDropdownSpecific::Read( SvStream
&rS
)
647 return data
->Read( rS
);
651 #ifdef DEBUG_FILTER_MSFILTER
652 void TBCComboDropdownSpecific::Print( FILE* fp
)
655 indent_printf(fp
,"[ 0x%x ] TBCComboDropdownSpecific -- dump\n", nOffSet
);
659 indent_printf(fp
," no data " );
663 TBCCDData::TBCCDData()
672 TBCCDData::~TBCCDData()
676 bool TBCCDData::Read( SvStream
&rS
)
679 rS
.ReadInt16( cwstrItems
);
682 auto nItems
= o3tl::make_unsigned(cwstrItems
);
683 //each WString is at least one byte
684 if (rS
.remainingSize() < nItems
)
686 for (decltype(nItems
) index
= 0; index
< nItems
; ++index
)
689 if ( !aString
.Read( rS
) )
691 wstrList
.push_back( aString
);
694 rS
.ReadInt16( cwstrMRU
).ReadInt16( iSel
).ReadInt16( cLines
).ReadInt16( dxWidth
);
696 return wstrEdit
.Read( rS
);
699 #ifdef DEBUG_FILTER_MSFILTER
700 void TBCCDData::Print( FILE* fp
)
703 indent_printf(fp
,"[ 0x%x ] TBCCDData -- dump\n", nOffSet
);
704 indent_printf(fp
," cwstrItems items in wstrList %d\n", cwstrItems
);
705 for ( sal_Int32 index
=0; index
< cwstrItems
; ++index
)
708 indent_printf(fp
, " wstrList[%d] %s", static_cast< int >( index
), OUStringToOString( wstrList
[index
].getString(), RTL_TEXTENCODING_UTF8
).getStr() );
710 indent_printf(fp
," cwstrMRU num most recently used string %d item\n", cwstrMRU
);
711 indent_printf(fp
," iSel index of selected item %d item\n", iSel
);
712 indent_printf(fp
," cLines num of suggested lines to display %d", cLines
);
713 indent_printf(fp
," dxWidth width in pixels %d", dxWidth
);
714 indent_printf(fp
," wstrEdit %s", OUStringToOString( wstrEdit
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
718 TBCBitMap::TBCBitMap() : cbDIB( 0 )
722 TBCBitMap::~TBCBitMap()
726 bool TBCBitMap::Read( SvStream
& rS
)
728 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
730 rS
.ReadInt32( cbDIB
);
731 // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10
732 return ReadDIBBitmapEx(mBitMap
, rS
, false, true);
735 #ifdef DEBUG_FILTER_MSTOOLBAR
736 void TBCBitMap::Print( FILE* fp
)
739 indent_printf(fp
, "[ 0x%x ] TBCBitMap -- dump\n", nOffSet
);
740 indent_printf(fp
, " TBCBitMap size of bitmap data 0x%x\n", static_cast< unsigned int > ( cbDIB
) );
744 TB::TB() : bSignature(0x2),
754 bool TB::Read(SvStream
&rS
)
756 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
758 rS
.ReadUChar( bSignature
).ReadUChar( bVersion
).ReadInt16( cCL
).ReadInt32( ltbid
).ReadUInt32( ltbtr
).ReadUInt16( cRowsDefault
).ReadUInt16( bFlags
);
764 bool TB::IsEnabled() const
766 return ( bFlags
& 0x01 ) != 0x01;
769 #ifdef DEBUG_FILTER_MSTOOLBAR
770 void TB::Print( FILE* fp
)
773 indent_printf(fp
,"[ 0x%x ] TB -- dump\n", nOffSet
);
774 indent_printf(fp
," bSignature 0x%x\n", bSignature
);
775 indent_printf(fp
," bVersion 0x%x\n", bVersion
);
776 indent_printf(fp
," cCL 0x%x\n", cCL
);
777 indent_printf(fp
," ltbid 0x%x\n", ltbid
);
778 indent_printf(fp
," ltbtr 0x%x\n", ltbtr
);
779 indent_printf(fp
," cRowsDefault 0x%x\n", cRowsDefault
);
780 indent_printf(fp
," bFlags 0x%x\n", bFlags
);
781 indent_printf(fp
, " name %s\n", OUStringToOString( name
.getString(), RTL_TEXTENCODING_UTF8
).getStr() );
785 TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0)
789 bool TBVisualData::Read( SvStream
& rS
)
791 SAL_INFO("filter.ms", "stream pos " << rS
.Tell());
793 rS
.ReadSChar( tbds
).ReadSChar( tbv
).ReadSChar( tbdsDock
).ReadSChar( iRow
);
799 #ifdef DEBUG_FILTER_MSTOOLBAR
800 void SRECT::Print( FILE* fp
)
803 indent_printf( fp
, " left 0x%x\n", left
);
804 indent_printf( fp
, " top 0x%x\n", top
);
805 indent_printf( fp
, " right 0x%x\n", right
);
806 indent_printf( fp
, " bottom 0x%x\n", bottom
);
810 #ifdef DEBUG_FILTER_MSTOOLBAR
811 void TBVisualData::Print( FILE* fp
)
814 indent_printf( fp
, "[ 0x%x ] TBVisualData -- dump\n", nOffSet
);
815 indent_printf( fp
, " tbds 0x%x\n", tbds
);
816 indent_printf( fp
, " tbv 0x%x\n", tbv
);
817 indent_printf( fp
, " tbdsDoc 0x%x\n", tbdsDock
);
818 indent_printf( fp
, " iRow 0x%x\n", iRow
);
824 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */