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>
46 if ( aSize.
Height() != nNewSize )
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;
69 nColor = css::ui::ImageType::COLOR_HIGHCONTRAST;
72 xImageManager->replaceImages( ui::ImageType::SIZE_DEFAULT | nColor, commands, images );
74 xImageManager->replaceImages( ui::ImageType::SIZE_LARGE | nColor, commands, images );
92uno::Reference< ui::XUIConfigurationManager >
95 return m_xCfgSupp->getUIConfigurationManager();
105 = OUString::Concat(
"vnd.sun.star.script:") + sCmd +
"?language=Basic&location=document";
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 );
136 xProps->setPropertyValue(
"UIName",
uno::Any( rName ) );
139 uno::Sequence< beans::PropertyValue > aPopupMenu{
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
160void TBBase::indent_printf( FILE* fp,
const char* format, ... )
163 va_start ( ap, format );
169 vfprintf( fp, format, ap );
197 width = std::make_shared<sal_uInt16>();
198 height = std::make_shared<sal_uInt16>();
204#ifdef DEBUG_FILTER_MSTOOLBAR
205void 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);
269 sal_uInt16 nStyle = 0;
272 beans::PropertyValue aProp;
273 aProp.Name =
"Visible";
275 props.push_back( aProp );
287 if (
property.Name ==
"CommandURL" )
288 property.Value >>= sCommand;
293 if ( !sCommand.isEmpty() )
295 BitmapEx aBitEx( pIcon->getBitMap() );
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 );
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 );
332 aProp.Name =
"CommandURL";
337 OUString sMenuBar =
"private:resource/menubar/" + pMenu->
Name();
338 aProp.Value <<= sMenuBar;
340 nStyle |= ui::ItemStyle::DROP_DOWN;
341 props.push_back( aProp );
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
365void TBCData::Print( FILE* fp )
368 indent_printf(fp,
"[ 0x%x ] TBCData -- dump\n",
nOffSet );
369 indent_printf(fp,
" dumping controlGeneralInfo( TBCGeneralInfo )\n");
374 indent_printf(fp,
" dumping controlSpecificInfo( TBCBSpecificInfo )\n");
415#ifdef DEBUG_FILTER_MSTOOLBAR
417TBCExtraInfo::Print( FILE* fp )
420 indent_printf( fp,
"[ 0x%x ] TBCExtraInfo -- dump\n",
nOffSet );
421 indent_printf( fp,
" wstrHelpFile %s\n",
423 indent_printf( fp,
" idHelpContext 0x%x\n",
static_cast< unsigned int >(
idHelpContext ) );
424 indent_printf( fp,
" wstrTag %s\n",
426 indent_printf( fp,
" wstrOnAction %s\n",
428 indent_printf( fp,
" wstrParam %s\n",
430 indent_printf( fp,
" tbcu 0x%x\n",
tbcu );
431 indent_printf( fp,
" tbmg 0x%x\n",
tbmg );
460#ifdef DEBUG_FILTER_MSFILTER
462TBCGeneralInfo::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",
469 indent_printf( fp,
" description %s\n",
471 indent_printf( fp,
" tooltip %s\n",
484 beans::PropertyValue aProp;
489 aProp.Name =
"CommandURL";
495 sControlData.push_back( aProp );
498 aProp.Name =
"Label";
500 sControlData.push_back( aProp );
503 aProp.Value <<= ui::ItemType::DEFAULT;
504 sControlData.push_back( aProp );
506 aProp.Name =
"Tooltip";
508 sControlData.push_back( aProp );
533 name = std::make_shared<WString>();
534 return name->Read( rS );
539#ifdef DEBUG_FILTER_MSFILTER
541TBCMenuSpecific::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() );
573 icon = std::make_shared<TBCBitMap>();
574 iconMask = std::make_shared<TBCBitMap>();
581 iBtnFace = std::make_shared<sal_uInt16>();
587 wstrAcc = std::make_shared<WString>();
594#ifdef DEBUG_FILTER_MSFILTER
595void 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");
609 indent_printf( fp,
" icon mask present? %s\n", bResult ?
"true" :
"false" );
613 indent_printf( fp,
" icon mask: \n");
618 indent_printf( fp,
" iBtnFace 0x%x\n", *
iBtnFace );
621 indent_printf( fp,
" option string present? %s ->%s<-\n", bResult ?
"true" :
"false", bResult ?
OUStringToOString(
wstrAcc->getString(), RTL_TEXTENCODING_UTF8 ).getStr() :
"N/A" );
639 if (
header.getTcID() == 0x01 )
640 data = std::make_shared<TBCCDData>();
647 return data->Read( rS );
651#ifdef DEBUG_FILTER_MSFILTER
652void TBCComboDropdownSpecific::Print( FILE* fp)
655 indent_printf(fp,
"[ 0x%x ] TBCComboDropdownSpecific -- dump\n",
nOffSet );
659 indent_printf(fp,
" no data " );
689 if ( !aString.
Read( rS ) )
699#ifdef DEBUG_FILTER_MSFILTER
700void 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);
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);
735#ifdef DEBUG_FILTER_MSTOOLBAR
736void 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 ) );
766 return (
bFlags & 0x01 ) != 0x01;
769#ifdef DEBUG_FILTER_MSTOOLBAR
770void 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 );
799#ifdef DEBUG_FILTER_MSTOOLBAR
800void 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
811void 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);
constexpr sal_Int8 header[]
static vcl::Window * GetActiveTopWindow()
static BitmapEx AutoScaleBitmap(BitmapEx const &aBitmap, const tools::Long aStandardSize)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
Bitmap CreateMask(const Color &rTransColor) const
Size GetSizePixel() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
Size GetSizePixel(const OutputDevice *pRefDevice=nullptr) const
bool Read(SvStream &rS) override
css::uno::Reference< css::frame::XModel3 > GetModel() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SvStream & ReadInt16(sal_Int16 &rInt16)
SvStream & ReadUInt32(sal_uInt32 &rUInt32)
SvStream & ReadInt32(sal_Int32 &rInt32)
SvStream & ReadSChar(signed char &rChar)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt64 remainingSize()
SvStream & ReadUChar(unsigned char &rChar)
std::shared_ptr< TBCBitMap > icon
std::shared_ptr< TBCBitMap > iconMask
bool Read(SvStream &rS) override
std::shared_ptr< sal_uInt16 > iBtnFace
TBCBitMap * getIconMask()
std::shared_ptr< WString > wstrAcc
sal_uInt16 * getBtnFace()
virtual ~TBCBitMap() override
bool Read(SvStream &rS) override
virtual ~TBCCDData() override
bool Read(SvStream &rS) override
std::vector< WString > wstrList
std::shared_ptr< TBCCDData > data
TBCComboDropdownSpecific(const TBCHeader &header)
bool Read(SvStream &rS) override
TBCGeneralInfo controlGeneralInfo
TBCData(const TBCData &)=delete
bool Read(SvStream &rS) override
void ImportToolBarControl(CustomToolBarImportHelper &, std::vector< css::beans::PropertyValue > &, bool &bBeginGroup, bool bIsMenuBar)
std::shared_ptr< TBBase > controlSpecificInfo
TBCMenuSpecific * getMenuSpecific()
void ImportToolBarControlData(CustomToolBarImportHelper &, std::vector< css::beans::PropertyValue > &)
bool Read(SvStream &rS) override
bool Read(SvStream &rS) override
bool Read(SvStream &rS) override
const OUString & getString() const
bool Read(SvStream &rS) override
Color GetBackgroundColor() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
#define SAL_INFO(area, stream)
Shape IDs per cluster in DGG atom.
OUString getString(const Any &_rAny)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
OUString resolveVBAMacro(SfxObjectShell const *pShell, const OUString &rLibName, const OUString &rModuleName, const OUString &rMacroName, bool bOnlyPublic, const OUString &sSkipModule)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
TOOLS_DLLPUBLIC OUString read_uInt16s_ToOUString(SvStream &rStrm, std::size_t nUnits)