diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-23 15:33:01 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2015-11-24 07:22:01 +0000 |
commit | 1e82a3e6e3ea8b5cda520551faed81bc74c848c1 (patch) | |
tree | 728f7be8a56e41d5814f6fe50f8195fa77871088 | |
parent | 00bb8141beee7088625992a046e94c6f8da8da83 (diff) |
Vcl: Cleanup Toolbox
* Move defines to header file
* Limit line length to 120 chars
* Some other smaller cleanups (unused defines etc)
Change-Id: I14b52579f9b5bae4ea0bc1df434cc3d29c223d4e
Reviewed-on: https://gerrit.libreoffice.org/20133
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
-rw-r--r-- | include/vcl/toolbox.hxx | 134 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 126 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 34 |
3 files changed, 129 insertions, 165 deletions
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 362d9424a440..4a4122738e38 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -37,41 +37,6 @@ struct ImplToolBoxPrivateData; class ImplTrackRect; class PopupMenu; -#define TOOLBOX_CUSTOMIZE_RESIZE ((sal_uInt16)0xFFFE) - -class VCL_DLLPUBLIC ToolBoxCustomizeEvent -{ -private: - VclPtr<ToolBox> mpTargetBox; - void* mpData; - sal_uInt16 mnIdFrom; - sal_uInt16 mnPosTo; - -public: - ToolBoxCustomizeEvent(); - ToolBoxCustomizeEvent( ToolBox* pDropBox, - sal_uInt16 nId, sal_uInt16 nPos = 0, - void* pUserData = nullptr ); -}; - -inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent() -{ - mpTargetBox = nullptr; - mnIdFrom = 0; - mnPosTo = 0; - mpData = nullptr; -} - -inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox, - sal_uInt16 nId, sal_uInt16 nPos, - void* pUserData ) -{ - mpTargetBox = pDropBox; - mnIdFrom = nId; - mnPosTo = nPos; - mpData = pUserData; -} - #define TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) #define TOOLBOX_APPEND ((sal_uInt16)0xFFFF) @@ -85,6 +50,44 @@ inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox, #define TOOLBOX_MENUTYPE_CLIPPEDITEMS ((sal_uInt16)0x0001) // menu will contain "more" indicator #define TOOLBOX_MENUTYPE_CUSTOMIZE ((sal_uInt16)0x0002) // menu will contain "customization" and "more" indicator +#define SMALLBUTTON_HSIZE 7 +#define SMALLBUTTON_VSIZE 7 + +#define SMALLBUTTON_OFF_NORMAL_X 3 +#define SMALLBUTTON_OFF_NORMAL_Y 3 + +#define TB_TEXTOFFSET 2 +#define TB_IMAGETEXTOFFSET 3 +#define TB_LINESPACING 3 +#define TB_SPIN_SIZE 14 +#define TB_SPIN_OFFSET 2 +#define TB_BORDER_OFFSET1 4 +#define TB_BORDER_OFFSET2 2 +#define TB_CUSTOMIZE_OFFSET 2 +#define TB_RESIZE_OFFSET 3 +#define TB_MAXLINES 5 +#define TB_MAXNOSCROLL 32765 + +#define TB_MIN_WIN_WIDTH 20 +#define TB_DRAGWIDTH 8 // the default width of the drag grip +#define TB_SEP_SIZE 8 // Separator size + +#define TB_CALCMODE_HORZ 1 +#define TB_CALCMODE_VERT 2 +#define TB_CALCMODE_FLOAT 3 + +#define TB_WBLINESIZING (WB_SIZEABLE | WB_DOCKABLE | WB_SCROLL) + +#define DOCK_LINEHSIZE ((sal_uInt16)0x0001) +#define DOCK_LINEVSIZE ((sal_uInt16)0x0002) +#define DOCK_LINERIGHT ((sal_uInt16)0x1000) +#define DOCK_LINEBOTTOM ((sal_uInt16)0x2000) +#define DOCK_LINELEFT ((sal_uInt16)0x4000) +#define DOCK_LINETOP ((sal_uInt16)0x8000) +#define DOCK_LINEOFFSET 3 + +typedef ::std::vector< VclPtr<ToolBox> > ImplTBList; + // small or large force an exact toolbox size for proper alignemnt // dontcare will let the toolbox decide about its size enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE }; @@ -102,13 +105,61 @@ struct ImplToolSize sal_uInt16 mnLines; }; + +class ImplTBDragMgr +{ +private: + ImplTBList* mpBoxList; + VclPtr<ToolBox> mpDragBox; + Point maMouseOff; + Rectangle maRect; + Rectangle maStartRect; + Accelerator maAccel; + long mnMinWidth; + long mnMaxWidth; + sal_uInt16 mnLineMode; + sal_uInt16 mnStartLines; + void* mpCustomizeData; + bool mbResizeMode; + bool mbShowDragRect; + +public: + ImplTBDragMgr(); + ~ImplTBDragMgr(); + + void push_back( ToolBox* pBox ) + { mpBoxList->push_back( pBox ); } + void erase( ToolBox* pBox ) + { + for ( ImplTBList::iterator it = mpBoxList->begin(); it != mpBoxList->end(); ++it ) { + if ( *it == pBox ) { + mpBoxList->erase( it ); + break; + } + } + } + size_t size() const + { return mpBoxList->size(); } + + ToolBox* FindToolBox( const Rectangle& rRect ); + + void StartDragging( ToolBox* pDragBox, const Point& rPos, const Rectangle& rRect, sal_uInt16 nLineMode, + bool bResizeItem, void* pData = nullptr ); + void Dragging( const Point& rPos ); + void EndDragging( bool bOK = true ); + void HideDragRect(); + void UpdateDragRect(); + DECL_LINK_TYPED( SelectHdl, Accelerator&, void ); +}; + + class VCL_DLLPUBLIC ToolBox : public DockingWindow { friend class FloatingWindow; friend class ImplTBDragMgr; private: - ImplToolBoxPrivateData* mpData; + ImplToolBoxPrivateData* mpData; std::vector<ImplToolSize> maFloatSizes; ImageList maImageList; Idle maIdle; @@ -117,8 +168,8 @@ private: Rectangle maOutDockRect; Rectangle maInDockRect; Rectangle maPaintRect; - VclPtr<FloatingWindow> mpFloatWin; - sal_uInt16 mnKeyModifier; + VclPtr<FloatingWindow> mpFloatWin; + sal_uInt16 mnKeyModifier; long mnDX; long mnDY; long mnMaxItemWidth; // max item width @@ -334,12 +385,10 @@ public: ToolBoxItemBits nBits = ToolBoxItemBits::NONE, sal_uInt16 nPos = TOOLBOX_APPEND ); void InsertSpace( sal_uInt16 nPos = TOOLBOX_APPEND ); - void InsertSeparator( sal_uInt16 nPos = TOOLBOX_APPEND, - sal_uInt16 nPixSize = 0 ); + void InsertSeparator( sal_uInt16 nPos = TOOLBOX_APPEND, sal_uInt16 nPixSize = 0 ); void InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND ); void RemoveItem( sal_uInt16 nPos ); - void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, - sal_uInt16 nNewPos = TOOLBOX_APPEND ); + void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId, sal_uInt16 nNewPos = TOOLBOX_APPEND ); void Clear(); const ImageList& GetImageList() const { return maImageList; } @@ -469,7 +518,6 @@ public: // enable/disable undocking void Lock( bool bLock = true ); - // read configuration to determine locking behaviour static bool AlwaysLocked(); diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 01a73059611c..948ad25919d0 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -48,89 +48,11 @@ #include <vector> #include <math.h> -#define SMALLBUTTON_HSIZE 7 -#define SMALLBUTTON_VSIZE 7 - -#define SMALLBUTTON_OFF_NORMAL_X 3 -#define SMALLBUTTON_OFF_NORMAL_Y 3 - -#define TB_TEXTOFFSET 2 -#define TB_IMAGETEXTOFFSET 3 -#define TB_LINESPACING 3 -#define TB_SPIN_SIZE 14 -#define TB_SPIN_OFFSET 2 -#define TB_BORDER_OFFSET1 4 -#define TB_BORDER_OFFSET2 2 -#define TB_CUSTOMIZE_OFFSET 2 -#define TB_RESIZE_OFFSET 3 -#define TB_MAXLINES 5 -#define TB_MAXNOSCROLL 32765 - -#define TB_MIN_WIN_WIDTH 20 - -#define TB_CALCMODE_HORZ 1 -#define TB_CALCMODE_VERT 2 -#define TB_CALCMODE_FLOAT 3 - -#define TB_WBLINESIZING (WB_SIZEABLE | WB_DOCKABLE | WB_SCROLL) - -#define DOCK_LINEHSIZE ((sal_uInt16)0x0001) -#define DOCK_LINEVSIZE ((sal_uInt16)0x0002) -#define DOCK_LINERIGHT ((sal_uInt16)0x1000) -#define DOCK_LINEBOTTOM ((sal_uInt16)0x2000) -#define DOCK_LINELEFT ((sal_uInt16)0x4000) -#define DOCK_LINETOP ((sal_uInt16)0x8000) -#define DOCK_LINEOFFSET 3 - -typedef ::std::vector< VclPtr<ToolBox> > ImplTBList; - -class ImplTBDragMgr +void ImplTBDragMgr::HideDragRect() { -private: - ImplTBList* mpBoxList; - VclPtr<ToolBox> mpDragBox; - Point maMouseOff; - Rectangle maRect; - Rectangle maStartRect; - Accelerator maAccel; - long mnMinWidth; - long mnMaxWidth; - sal_uInt16 mnLineMode; - sal_uInt16 mnStartLines; - void* mpCustomizeData; - bool mbResizeMode; - bool mbShowDragRect; - -public: - ImplTBDragMgr(); - ~ImplTBDragMgr(); - - void push_back( ToolBox* pBox ) - { mpBoxList->push_back( pBox ); } - void erase( ToolBox* pBox ) - { - for ( ImplTBList::iterator it = mpBoxList->begin(); it != mpBoxList->end(); ++it ) { - if ( *it == pBox ) { - mpBoxList->erase( it ); - break; - } - } - } - size_t size() const - { return mpBoxList->size(); } - - ToolBox* FindToolBox( const Rectangle& rRect ); - - void StartDragging( ToolBox* pDragBox, - const Point& rPos, const Rectangle& rRect, - sal_uInt16 nLineMode, bool bResizeItem, - void* pData = nullptr ); - void Dragging( const Point& rPos ); - void EndDragging( bool bOK = true ); - void HideDragRect() { if ( mbShowDragRect ) mpDragBox->HideTracking(); } - void UpdateDragRect(); - DECL_LINK_TYPED( SelectHdl, Accelerator&, void ); -}; + if ( mbShowDragRect ) + mpDragBox->HideTracking(); +} static ImplTBDragMgr* ImplGetTBDragMgr() { @@ -142,8 +64,6 @@ static ImplTBDragMgr* ImplGetTBDragMgr() int ToolBox::ImplGetDragWidth( ToolBox* pThis ) { - #define TB_DRAGWIDTH 8 // the default width of the grip - int nWidth = TB_DRAGWIDTH; if( pThis->IsNativeControlSupported( CTRL_TOOLBAR, PART_ENTIRE_CONTROL ) ) { @@ -854,14 +774,12 @@ Size ToolBox::ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines ) } sal_uInt16 i = 0; - while ( i + 1u < pThis->maFloatSizes.size() && - rLines < pThis->maFloatSizes[i].mnLines ) + while ( i + 1u < pThis->maFloatSizes.size() && rLines < pThis->maFloatSizes[i].mnLines ) { i++; } - Size aSize( pThis->maFloatSizes[i].mnWidth, - pThis->maFloatSizes[i].mnHeight ); + Size aSize( pThis->maFloatSizes[i].mnWidth, pThis->maFloatSizes[i].mnHeight ); rLines = pThis->maFloatSizes[i].mnLines; return aSize; @@ -1409,13 +1327,9 @@ void ToolBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) DockingWindow::ImplInit( pParent, nStyle & ~(WB_BORDER) ); - // always set WB_TABSTOP for ToolBars !!! if( mnWinStyle & WB_TABSTOP ) - { - // dockingwindow's ImplInit removes some bits, so restore them here - // to allow keyboard handling for toolbars - ImplGetWindowImpl()->mnStyle |= WB_TABSTOP|WB_NODIALOGCONTROL; - ImplGetWindowImpl()->mnStyle &= ~WB_DIALOGCONTROL; - } + // dockingwindow's ImplInit removes some bits, so restore them here to allow keyboard handling for toolbars + ImplGetWindowImpl()->mnStyle |= WB_TABSTOP|WB_NODIALOGCONTROL; // always set WB_TABSTOP for ToolBars + ImplGetWindowImpl()->mnStyle &= ~WB_DIALOGCONTROL; ImplInitSettings(true, true, true); } @@ -2949,7 +2863,8 @@ void ToolBox::ImplDrawSeparator(vcl::RenderContext& rRenderContext, sal_uInt16 n } } -void ToolBox::ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow ) +void ToolBox::ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle &rRect, sal_uInt16 highlight, + bool bChecked, bool bEnabled, bool bIsWindow ) { // draws toolbar button background either native or using a coloured selection // if bIsWindow is true, the corresponding item is a control and only a selection border will be drawn @@ -2971,7 +2886,8 @@ void ToolBox::ImplDrawButton(vcl::RenderContext& rRenderContext, const Rectangle } if (!bNativeOk) - vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, bIsWindow ? 3 : highlight, bChecked, true, bIsWindow, nullptr, 2); + vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, rRect, bIsWindow ? 3 : highlight, + bChecked, true, bIsWindow, nullptr, 2); } void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, sal_uInt16 nHighlight, bool bPaint, bool bLayout) @@ -3092,7 +3008,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, mpData->m_pLayoutData->m_aLineItemIds.push_back( pItem->mnId ); mpData->m_pLayoutData->m_aLineItemPositions.push_back( nPos ); } - rRenderContext.DrawCtrlText( aPos, pItem->maText, 0, pItem->maText.getLength(), DrawTextFlags::Mnemonic, pVector, pDisplayText ); + rRenderContext.DrawCtrlText( aPos, pItem->maText, 0, pItem->maText.getLength(), DrawTextFlags::Mnemonic, + pVector, pDisplayText ); if (bClip) rRenderContext.SetClipRegion(); rRenderContext.SetFont(aOldFont); @@ -3189,7 +3106,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, if( bHasOpenPopup ) ImplDrawFloatwinBorder(rRenderContext, pItem); else - ImplDrawButton(rRenderContext, aButtonRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow); + ImplDrawButton(rRenderContext, aButtonRect, nHighlight, pItem->meState == TRISTATE_TRUE, + pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow); if( nHighlight != 0 ) { @@ -3243,7 +3161,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, if( bHasOpenPopup ) ImplDrawFloatwinBorder(rRenderContext, pItem); else - ImplDrawButton(rRenderContext, pItem->maRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ); + ImplDrawButton(rRenderContext, pItem->maRect, nHighlight, pItem->meState == TRISTATE_TRUE, + pItem->mbEnabled && IsEnabled(), pItem->mbShowWindow ); } DrawTextFlags nTextStyle = DrawTextFlags::NONE; @@ -3285,7 +3204,8 @@ void ToolBox::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, if( bHasOpenPopup ) ImplDrawFloatwinBorder(rRenderContext, pItem); else - ImplDrawButton(rRenderContext, aDropDownRect, nHighlight, pItem->meState == TRISTATE_TRUE, pItem->mbEnabled && IsEnabled(), false); + ImplDrawButton(rRenderContext, aDropDownRect, nHighlight, pItem->meState == TRISTATE_TRUE, + pItem->mbEnabled && IsEnabled(), false); } } ImplDrawDropdownArrow(rRenderContext, aDropDownRect, bSetColor, bRotate); @@ -5642,9 +5562,7 @@ void ToolBox::ImplDisableFlatButtons() bInit = true; HKEY hkey; - if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, - "Software\\LibreOffice\\Accessibility\\AtToolSupport", - &hkey) ) + if( ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER, "Software\\LibreOffice\\Accessibility\\AtToolSupport", &hkey) ) { DWORD dwType = 0; sal_uInt8 Data[6]; // possible values: "true", "false", "1", "0", DWORD diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 26d74981592e..6b64a0c085bf 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -43,8 +43,6 @@ using namespace vcl; using namespace com::sun::star; -#define TB_SEP_SIZE 8 - ImplToolBoxPrivateData::ImplToolBoxPrivateData() : m_pLayoutData( nullptr ) { @@ -383,8 +381,7 @@ void ToolBox::ImplUpdateItem( sal_uInt16 nIndex ) if ( nIndex == 0xFFFF ) { // #i52217# no immediate draw as this might lead to paint problems - Invalidate( Rectangle( mnLeftBorder, mnTopBorder, - mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) ); + Invalidate( Rectangle( mnLeftBorder, mnTopBorder, mnDX-mnRightBorder-1, mnDY-mnBottomBorder-1 ) ); } else { @@ -522,8 +519,7 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) bNewCalc = true; DBG_ASSERT( aItem.mnId, "ToolBox::InsertItem(): ItemId == 0" ); - DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND, - "ToolBox::InsertItem(): ItemId already exists" ); + DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); } // create item and add to list @@ -538,15 +534,15 @@ void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos ) CallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, - ToolBoxItemBits nBits, sal_uInt16 nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list - mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) ); + mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), + ImplToolItem( nItemId, rImage, nBits ) ); SetItemImage(nItemId, rImage); mpData->ImplClearLayoutData(); @@ -557,16 +553,16 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, CallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >(nNewPos ) ); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, - const OUString& rText, - ToolBoxItemBits nBits, sal_uInt16 nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits, + sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list - mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) ); + mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), + ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) ); SetItemImage(nItemId, rImage); mpData->ImplClearLayoutData(); @@ -577,15 +573,15 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage, CallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } -void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, - ToolBoxItemBits nBits, sal_uInt16 nPos ) +void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, ToolBoxItemBits nBits, sal_uInt16 nPos ) { DBG_ASSERT( nItemId, "ToolBox::InsertItem(): ItemId == 0" ); DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND, "ToolBox::InsertItem(): ItemId already exists" ); // create item and add to list - mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ) ); + mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), + ImplToolItem( nItemId, ImplConvertMenuString( rText ), nBits ) ); mpData->ImplClearLayoutData(); ImplInvalidate( true ); @@ -595,11 +591,13 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText, CallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) ); } -void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::XFrame>& rFrame, ToolBoxItemBits nBits, const Size& rRequestedSize, sal_uInt16 nPos) +void ToolBox::InsertItem(const OUString& rCommand, const uno::Reference<frame::XFrame>& rFrame, ToolBoxItemBits nBits, + const Size& rRequestedSize, sal_uInt16 nPos) { OUString aLabel(vcl::CommandInfoProvider::Instance().GetLabelForCommand(rCommand, rFrame)); OUString aTooltip(vcl::CommandInfoProvider::Instance().GetTooltipForCommand(rCommand, rFrame)); - Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand(rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), rFrame)); + Image aImage(vcl::CommandInfoProvider::Instance().GetImageForCommand( + rCommand, (GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE), rFrame)); sal_uInt16 nItemId = GetItemCount() + 1; InsertItem(nItemId, aImage, aLabel, nBits, nPos); |