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 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_TOOLBOX_HXX
21 #define INCLUDED_VCL_TOOLBOX_HXX
23 #include <vcl/vclstatuslistener.hxx>
24 #include <rsc/rsc-vcl-shared-types.hxx>
25 #include <vcl/dllapi.h>
26 #include <vcl/dockwin.hxx>
27 #include <vcl/image.hxx>
28 #include <o3tl/typed_flags_set.hxx>
33 #include <com/sun/star/frame/XFrame.hpp>
34 #include <com/sun/star/frame/FeatureStateEvent.hpp>
39 struct ImplToolBoxPrivateData
;
43 #define TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004)
45 // item ids in the custom menu may not exceed this constant
46 #define TOOLBOX_MENUITEM_START ((sal_uInt16)0x1000)
48 // defines for the menubutton
49 enum class ToolBoxMenuType
{
50 NONE
= 0x0000, // no menu at all, scrolling by spin buttons
51 ClippedItems
= 0x0001, // menu will contain "more" indicator
52 Customize
= 0x0002 // menu will contain "customization" and "more" indicator
56 template<> struct typed_flags
<ToolBoxMenuType
> : is_typed_flags
<ToolBoxMenuType
, 0x0003> {};
59 // small, large, size32 force an exact toolbox size for proper alignemnt
60 // dontcare will let the toolbox decide about its size
61 enum class ToolBoxButtonSize
69 // ToolBoxLayoutMode::Normal - traditional layout, items are centered in the toolbar
70 // ToolBoxLayoutMode::LockVert - special mode (currently used for calc input/formula
71 // bar) where item's vertical position is locked, e.g.
72 // toolbox is prevented from centering the items
73 enum class ToolBoxLayoutMode
{ Normal
, LockVert
};
75 // Position of the text when icon and text are painted
76 enum class ToolBoxTextPosition
{ Right
, Bottom
};
79 class VCL_DLLPUBLIC ToolBox
: public DockingWindow
81 friend class FloatingWindow
;
82 friend class ImplTBDragMgr
;
85 using ImplToolItems
= std::vector
<ImplToolItem
>;
87 static constexpr auto APPEND
88 = std::numeric_limits
<ImplToolItems::size_type
>::max();
90 static constexpr auto ITEM_NOTFOUND
91 = std::numeric_limits
<ImplToolItems::size_type
>::max();
98 ImplToolItems::size_type mnLines
;
101 ImplToolBoxPrivateData
* mpData
;
102 std::vector
<ImplToolSize
> maFloatSizes
;
104 tools::Rectangle maUpperRect
;
105 tools::Rectangle maLowerRect
;
106 tools::Rectangle maOutDockRect
;
107 tools::Rectangle maInDockRect
;
108 tools::Rectangle maPaintRect
;
109 VclPtr
<FloatingWindow
> mpFloatWin
;
110 sal_uInt16 mnKeyModifier
;
113 long mnMaxItemWidth
; // max item width
114 long mnMaxItemHeight
; // max item height (for standard items)
115 long mnWinHeight
; // max window height (for window items)
116 long mnLeftBorder
; // inner border
121 long mnActivateCount
;
122 long mnImagesRotationAngle
;
123 sal_uInt16 mnLastFocusItemId
;
124 sal_uInt16 mnOutStyle
;
125 sal_uInt16 mnHighItemId
;
126 sal_uInt16 mnCurItemId
;
127 sal_uInt16 mnDownItemId
;
128 ImplToolItems::size_type mnCurPos
;
129 ImplToolItems::size_type mnLines
; // total number of toolbox lines
130 ImplToolItems::size_type mnCurLine
; // the currently visible line
131 ImplToolItems::size_type mnCurLines
; // number of lines due to line breaking
132 ImplToolItems::size_type mnVisLines
; // number of visible lines (for scrolling)
133 ImplToolItems::size_type mnFloatLines
; // number of lines during floating mode
134 ImplToolItems::size_type mnDockLines
;
135 sal_uInt16 mnMouseClicks
;
136 sal_uInt16 mnMouseModifier
;
152 mbChangingHighlight
:1,
155 WindowAlign meDockAlign
;
156 ButtonType meButtonType
;
157 PointerStyle meLastStyle
;
159 ToolBoxLayoutMode meLayoutMode
;
160 ToolBoxTextPosition meTextPosition
;
161 Link
<ToolBox
*, void> maClickHdl
;
162 Link
<ToolBox
*, void> maDoubleClickHdl
;
163 Link
<ToolBox
*, void> maActivateHdl
;
164 Link
<ToolBox
*, void> maDeactivateHdl
;
165 Link
<ToolBox
*, void> maSelectHdl
;
166 Link
<ToolBox
*, void> maMenuButtonHdl
;
167 Link
<StateChangedType
const *, void> maStateChangedHandler
;
168 Link
<DataChangedEvent
const *, void> maDataChangedHandler
;
169 /** StatusListener. Notifies about rotated images etc */
170 rtl::Reference
<VclStatusListener
<ToolBox
>> mpStatusListener
;
173 using Window::ImplInit
;
175 SAL_DLLPRIVATE
void InvalidateItem(ImplToolItems::size_type nPosition
);
176 SAL_DLLPRIVATE
void InvalidateSpin(bool bInvalidateUpper
= true,
177 bool bInvalidateLower
= true);
178 SAL_DLLPRIVATE
void InvalidateMenuButton();
180 SAL_DLLPRIVATE
void ImplInitToolBoxData();
181 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
182 using DockingWindow::ImplInitSettings
;
183 SAL_DLLPRIVATE
void ImplInitSettings( bool bFont
, bool bForeground
, bool bBackground
);
184 SAL_DLLPRIVATE ImplToolItem
* ImplGetItem( sal_uInt16 nId
) const;
185 SAL_DLLPRIVATE
bool ImplCalcItem();
186 SAL_DLLPRIVATE
ImplToolItems::size_type
ImplCalcBreaks( long nWidth
, long* pMaxLineWidth
, bool bCalcHorz
) const;
187 SAL_DLLPRIVATE
void ImplFormat( bool bResize
= false );
188 SAL_DLLPRIVATE
void ImplDrawSpin(vcl::RenderContext
& rRenderContext
);
189 SAL_DLLPRIVATE
void ImplDrawSeparator(vcl::RenderContext
& rRenderContext
, ImplToolItems::size_type nPos
, const tools::Rectangle
& rRect
);
190 SAL_DLLPRIVATE
void ImplDrawItem(vcl::RenderContext
& rRenderContext
, ImplToolItems::size_type nPos
, sal_uInt16 nHighlight
);
191 using Window::ImplInvalidate
;
192 SAL_DLLPRIVATE
void ImplInvalidate( bool bNewCalc
= false, bool bFullPaint
= false );
193 SAL_DLLPRIVATE
void ImplUpdateItem( ImplToolItems::size_type nIndex
= ITEM_NOTFOUND
);
194 SAL_DLLPRIVATE
bool ImplHandleMouseMove( const MouseEvent
& rMEvt
, bool bRepeat
= false );
195 SAL_DLLPRIVATE
bool ImplHandleMouseButtonUp( const MouseEvent
& rMEvt
, bool bCancel
= false );
196 SAL_DLLPRIVATE
void ImplChangeHighlight( ImplToolItem
* pItem
, bool bNoGrabFocus
= false );
197 SAL_DLLPRIVATE
bool ImplChangeHighlightUpDn( bool bUp
, bool bNoCycle
= false );
198 SAL_DLLPRIVATE
ImplToolItems::size_type
ImplGetItemLine( ImplToolItem
* pCurrentItem
);
199 SAL_DLLPRIVATE ImplToolItem
* ImplGetFirstValidItem( ImplToolItems::size_type nLine
);
200 SAL_DLLPRIVATE
bool ImplOpenItem( vcl::KeyCode aKeyCode
);
201 SAL_DLLPRIVATE
bool ImplActivateItem( vcl::KeyCode aKeyCode
);
202 SAL_DLLPRIVATE
void ImplShowFocus();
203 SAL_DLLPRIVATE
void ImplHideFocus();
204 SAL_DLLPRIVATE
void ImplUpdateInputEnable();
205 SAL_DLLPRIVATE
void ImplFillLayoutData();
206 SAL_DLLPRIVATE
bool ImplHasClippedItems();
207 SAL_DLLPRIVATE Point
ImplGetPopupPosition( const tools::Rectangle
& rRect
) const;
208 SAL_DLLPRIVATE
bool ImplIsFloatingMode() const;
209 SAL_DLLPRIVATE
bool ImplIsInPopupMode() const;
210 SAL_DLLPRIVATE
const OUString
& ImplGetHelpText( sal_uInt16 nItemId
) const;
211 SAL_DLLPRIVATE Size
ImplGetOptimalFloatingSize();
212 SAL_DLLPRIVATE
bool ImplHasExternalMenubutton();
213 SAL_DLLPRIVATE
void ImplDrawFloatwinBorder(vcl::RenderContext
& rRenderContext
, ImplToolItem
* pItem
);
215 DECL_DLLPRIVATE_LINK( ImplCallExecuteCustomMenu
, void*, void );
216 DECL_DLLPRIVATE_LINK( ImplUpdateHdl
, Timer
*, void );
217 DECL_DLLPRIVATE_LINK( ImplCustomMenuListener
, VclMenuEvent
&, void );
218 DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl
, Timer
*, void );
220 ToolBox (const ToolBox
&) = delete;
221 ToolBox
& operator= (const ToolBox
&) = delete;
224 SAL_DLLPRIVATE
void ImplFloatControl( bool bStart
, FloatingWindow
* pWindow
);
225 SAL_DLLPRIVATE
void ImplDisableFlatButtons();
227 SAL_DLLPRIVATE
int ImplGetDragWidth() const;
228 static SAL_DLLPRIVATE
int ImplGetDragWidth( const vcl::RenderContext
& rRenderContext
,
230 SAL_DLLPRIVATE
void ImplUpdateDragArea() const;
231 SAL_DLLPRIVATE
void ImplCalcBorder( WindowAlign eAlign
, long& rLeft
, long& rTop
,
232 long& rRight
, long& rBottom
) const;
233 SAL_DLLPRIVATE
void ImplCheckUpdate();
234 static SAL_DLLPRIVATE
void ImplDrawGrip(vcl::RenderContext
& rRenderContext
,
235 const tools::Rectangle
&aDragArea
, int nDragWidth
,
236 WindowAlign eAlign
, bool bHorz
);
238 SAL_DLLPRIVATE
void ImplDrawGrip(vcl::RenderContext
& rRenderContext
);
239 SAL_DLLPRIVATE
void ImplDrawGradientBackground(vcl::RenderContext
& rRenderContext
);
240 SAL_DLLPRIVATE
bool ImplDrawNativeBackground(vcl::RenderContext
& rRenderContext
);
241 SAL_DLLPRIVATE
void ImplDrawTransparentBackground(const vcl::Region
&rRegion
);
242 SAL_DLLPRIVATE
static void ImplDrawConstantBackground(vcl::RenderContext
& rRenderContext
, const vcl::Region
&rRegion
, bool bIsInPopupMode
);
243 SAL_DLLPRIVATE
void ImplDrawBackground(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&rRect
);
245 SAL_DLLPRIVATE
void ImplErase(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&rRect
, bool bHighlight
, bool bHasOpenPopup
= false );
247 SAL_DLLPRIVATE
void ImplDrawBorder(vcl::RenderContext
& rRenderContext
);
248 SAL_DLLPRIVATE
const ImplToolItem
*ImplGetFirstClippedItem() const;
249 SAL_DLLPRIVATE Size
ImplCalcSize( ImplToolItems::size_type nCalcLines
, sal_uInt16 nCalcMode
= 0 );
250 SAL_DLLPRIVATE
void ImplCalcFloatSizes();
251 SAL_DLLPRIVATE Size
ImplCalcFloatSize( ImplToolItems::size_type
& rLines
);
252 SAL_DLLPRIVATE
void ImplCalcMinMaxFloatSize( Size
& rMinSize
, Size
& rMaxSize
);
253 SAL_DLLPRIVATE
void ImplSetMinMaxFloatSize();
254 SAL_DLLPRIVATE
ImplToolItems::size_type
ImplCalcLines( long nToolSize
) const;
255 SAL_DLLPRIVATE sal_uInt16
ImplTestLineSize( const Point
& rPos
) const;
256 SAL_DLLPRIVATE
void ImplLineSizing( const Point
& rPos
, tools::Rectangle
& rRect
, sal_uInt16 nLineMode
);
257 static SAL_DLLPRIVATE
ImplToolItems::size_type
ImplFindItemPos( const ImplToolItem
* pItem
, const ImplToolItems
& rList
);
258 SAL_DLLPRIVATE
void ImplDrawMenuButton(vcl::RenderContext
& rRenderContext
, bool bHighlight
);
259 SAL_DLLPRIVATE
void ImplDrawButton(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
&rRect
, sal_uInt16 highlight
, bool bChecked
, bool bEnabled
, bool bIsWindow
);
260 SAL_DLLPRIVATE
ImplToolItems::size_type
ImplCountLineBreaks() const;
261 SAL_DLLPRIVATE ImplToolBoxPrivateData
* ImplGetToolBoxPrivateData() const { return mpData
; }
264 virtual void ApplySettings(vcl::RenderContext
& rRenderContext
) override
;
265 void SetCurItemId(sal_uInt16 nSet
)
271 ToolBox(vcl::Window
* pParent
, WinBits nStyle
= 0);
272 ToolBox(vcl::Window
* pParent
, const OString
& rID
, const OUString
& rUIXMLDescription
,
273 const css::uno::Reference
<css::frame::XFrame
> &rFrame
= css::uno::Reference
<css::frame::XFrame
>());
274 virtual ~ToolBox() override
;
275 virtual void dispose() override
;
277 virtual void Click();
279 virtual void Activate() override
;
280 virtual void Deactivate() override
;
282 virtual void Select();
284 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
285 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) override
;
286 virtual void MouseMove( const MouseEvent
& rMEvt
) override
;
287 virtual void Tracking( const TrackingEvent
& rTEvt
) override
;
288 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
289 virtual void Resize() override
;
290 virtual void RequestHelp( const HelpEvent
& rHEvt
) override
;
291 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
292 virtual void Command( const CommandEvent
& rCEvt
) override
;
293 virtual void StateChanged( StateChangedType nType
) override
;
294 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
296 virtual void LoseFocus() override
;
297 virtual void KeyInput( const KeyEvent
& rKEvt
) override
;
299 virtual void ToggleFloatingMode() override
;
300 virtual void StartDocking() override
;
301 virtual bool Docking( const Point
& rPos
, tools::Rectangle
& rRect
) override
;
302 virtual void EndDocking( const tools::Rectangle
& rRect
, bool bFloatMode
) override
;
303 virtual void Resizing( Size
& rSize
) override
;
304 virtual Size
GetOptimalSize() const override
;
305 virtual void doDeferredInit(WinBits nBits
) override
;
307 /// Insert a command (like '.uno:Save').
308 virtual void InsertItem( const OUString
& rCommand
,
309 const css::uno::Reference
<css::frame::XFrame
>& rFrame
,
310 ToolBoxItemBits nBits
,
311 const Size
& rRequestedSize
,
312 ImplToolItems::size_type nPos
= APPEND
);
313 void InsertItem( sal_uInt16 nItemId
, const Image
& rImage
,
314 ToolBoxItemBits nBits
= ToolBoxItemBits::NONE
,
315 ImplToolItems::size_type nPos
= APPEND
);
316 void InsertItem( sal_uInt16 nItemId
, const Image
& rImage
,
317 const OUString
& rText
,
318 ToolBoxItemBits nBits
= ToolBoxItemBits::NONE
,
319 ImplToolItems::size_type nPos
= APPEND
);
320 void InsertItem( sal_uInt16 nItemId
, const OUString
& rText
,
321 ToolBoxItemBits nBits
= ToolBoxItemBits::NONE
,
322 ImplToolItems::size_type nPos
= APPEND
);
323 void InsertWindow( sal_uInt16 nItemId
, vcl::Window
* pWindow
,
324 ToolBoxItemBits nBits
= ToolBoxItemBits::NONE
,
325 ImplToolItems::size_type nPos
= APPEND
);
327 void InsertSeparator( ImplToolItems::size_type nPos
= APPEND
, sal_uInt16 nPixSize
= 0 );
328 void InsertBreak( ImplToolItems::size_type nPos
= APPEND
);
329 void RemoveItem( ImplToolItems::size_type nPos
);
330 void CopyItem( const ToolBox
& rToolBox
, sal_uInt16 nItemId
);
333 void SetButtonType( ButtonType eNewType
= ButtonType::SYMBOLONLY
);
334 ButtonType
GetButtonType() const { return meButtonType
; }
336 // sets a fixed button size (small, large or dontcare (==autosize))
337 void SetToolboxButtonSize( ToolBoxButtonSize eSize
);
338 ToolBoxButtonSize
GetToolboxButtonSize() const;
339 vcl::ImageType
GetImageSize() const;
341 void SetAlign( WindowAlign eNewAlign
= WindowAlign::Top
);
342 WindowAlign
GetAlign() const { return meAlign
; }
343 bool IsHorizontal() const { return mbHorz
; }
345 void SetLineCount( ImplToolItems::size_type nNewLines
);
346 void ShowLine( bool bNext
);
348 // Used to enable/disable scrolling one page at a time for toolbar
349 void SetPageScroll( bool b
);
351 ImplToolItems::size_type
GetItemCount() const;
352 ToolBoxItemType
GetItemType( ImplToolItems::size_type nPos
) const;
353 ImplToolItems::size_type
GetItemPos( sal_uInt16 nItemId
) const;
354 ImplToolItems::size_type
GetItemPos( const Point
& rPos
) const;
355 sal_uInt16
GetItemId( ImplToolItems::size_type nPos
) const;
356 sal_uInt16
GetItemId( const Point
& rPos
) const;
357 /// Map the command name (like .uno:Save) back to item id.
358 sal_uInt16
GetItemId( const OUString
& rCommand
) const;
359 tools::Rectangle
GetItemRect( sal_uInt16 nItemId
);
360 tools::Rectangle
GetItemPosRect( ImplToolItems::size_type nPos
);
361 tools::Rectangle
GetOverflowRect() const;
363 /// Returns size of the bitmap / text that is inside this toolbox item.
364 Size
GetItemContentSize( sal_uInt16 nItemId
);
366 sal_uInt16
GetCurItemId() const { return mnCurItemId
; }
367 sal_uInt16
GetDownItemId() const { return mnDownItemId
; }
368 sal_uInt16
GetModifier() const { return mnMouseModifier
; }
369 sal_uInt16
GetKeyModifier() const { return mnKeyModifier
; }
371 void SetItemBits( sal_uInt16 nItemId
, ToolBoxItemBits nBits
);
372 ToolBoxItemBits
GetItemBits( sal_uInt16 nItemId
) const;
374 void SetItemExpand( sal_uInt16 nItemId
, bool bExpand
);
376 void SetItemData( sal_uInt16 nItemId
, void* pNewData
);
377 void* GetItemData( sal_uInt16 nItemId
) const;
378 void SetItemImage( sal_uInt16 nItemId
, const Image
& rImage
);
379 Image
GetItemImage( sal_uInt16 nItemId
) const;
380 void SetItemImageAngle( sal_uInt16 nItemId
, long nAngle10
);
381 void SetItemImageMirrorMode( sal_uInt16 nItemId
, bool bMirror
);
382 void SetItemText( sal_uInt16 nItemId
, const OUString
& rText
);
383 const OUString
& GetItemText( sal_uInt16 nItemId
) const;
384 void SetItemWindow( sal_uInt16 nItemId
, vcl::Window
* pNewWindow
);
385 vcl::Window
* GetItemWindow( sal_uInt16 nItemId
) const;
386 sal_uInt16
GetHighlightItemId() const { return mnHighItemId
; }
388 void StartSelection();
391 void SetItemDown( sal_uInt16 nItemId
, bool bDown
);
393 void SetItemState( sal_uInt16 nItemId
, TriState eState
);
394 TriState
GetItemState( sal_uInt16 nItemId
) const;
396 void CheckItem( sal_uInt16 nItemId
, bool bCheck
= true );
397 bool IsItemChecked( sal_uInt16 nItemId
) const;
399 void EnableItem( sal_uInt16 nItemId
, bool bEnable
= true );
400 bool IsItemEnabled( sal_uInt16 nItemId
) const;
402 void TriggerItem( sal_uInt16 nItemId
);
404 /// Shows or hides items.
405 void ShowItem(sal_uInt16 nItemId
, bool bVisible
= true);
407 /// Convenience method to hide items (via ShowItem).
408 void HideItem(sal_uInt16 nItemId
) { ShowItem( nItemId
, false ); }
410 bool IsItemClipped( sal_uInt16 nItemId
) const;
411 bool IsItemVisible( sal_uInt16 nItemId
) const;
412 bool IsItemReallyVisible( sal_uInt16 nItemId
) const;
414 void SetItemCommand( sal_uInt16 nItemId
, const OUString
& rCommand
);
415 const OUString
GetItemCommand( sal_uInt16 nItemId
) const;
417 using Window::SetQuickHelpText
;
418 void SetQuickHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
419 using Window::GetQuickHelpText
;
420 OUString
GetQuickHelpText( sal_uInt16 nItemId
) const;
422 void SetHelpText( sal_uInt16 nItemId
, const OUString
& rText
);
423 const OUString
& GetHelpText( sal_uInt16 nItemId
) const;
425 void SetHelpId( sal_uInt16 nItemId
, const OString
& rHelpId
);
426 OString
GetHelpId( sal_uInt16 nItemId
) const;
428 // window size according to current alignment, floating state and number of lines
429 Size
CalcWindowSizePixel();
430 // window size according to current alignment, floating state and a given number of lines
431 Size
CalcWindowSizePixel( ImplToolItems::size_type nCalcLines
);
432 // window size according to current floating state and a given number of lines and a given alignment
433 Size
CalcWindowSizePixel( ImplToolItems::size_type nCalcLines
, WindowAlign eAlign
);
434 // floating window size according to number of lines (uses the number of line breaks)
435 Size
CalcFloatingWindowSizePixel();
436 // floating window size with a given number of lines
437 Size
CalcFloatingWindowSizePixel( ImplToolItems::size_type nCalcLines
);
438 // automatic window size for popup mode
439 Size
CalcPopupWindowSizePixel();
441 // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
442 Size
CalcMinimumWindowSizePixel();
444 ImplToolItems::size_type
GetFloatingLines() const;
446 void SetStyle( WinBits nNewStyle
);
447 WinBits
GetStyle() const { return mnWinStyle
; }
449 // enable/disable undocking
450 void Lock( bool bLock
);
451 // read configuration to determine locking behaviour
452 static bool AlwaysLocked();
454 void SetOutStyle( sal_uInt16 nNewStyle
);
455 sal_uInt16
GetOutStyle() const { return mnOutStyle
; }
457 void EnableCustomize( bool bEnable
= true );
458 bool IsCustomize() { return mbCustomize
; }
460 using DockingWindow::SetHelpText
;
461 using DockingWindow::GetHelpText
;
462 using DockingWindow::SetHelpId
;
463 using DockingWindow::GetHelpId
;
465 void SetClickHdl( const Link
<ToolBox
*, void>& rLink
) { maClickHdl
= rLink
; }
466 void SetDoubleClickHdl( const Link
<ToolBox
*, void>& rLink
) { maDoubleClickHdl
= rLink
; }
467 void SetDropdownClickHdl( const Link
<ToolBox
*, void>& rLink
);
468 void SetActivateHdl( const Link
<ToolBox
*, void>& rLink
) { maActivateHdl
= rLink
; }
469 void SetDeactivateHdl( const Link
<ToolBox
*, void>& rLink
) { maDeactivateHdl
= rLink
; }
470 void SetSelectHdl( const Link
<ToolBox
*, void>& rLink
) { maSelectHdl
= rLink
; }
471 const Link
<ToolBox
*, void>& GetSelectHdl() const { return maSelectHdl
; }
472 void SetStateChangedHdl( const Link
<StateChangedType
const *, void>& aLink
) { maStateChangedHandler
= aLink
; }
473 void SetDataChangedHdl( const Link
<DataChangedEvent
const *, void>& aLink
) { maDataChangedHandler
= aLink
; }
474 void SetMenuButtonHdl( const Link
<ToolBox
*, void>& rLink
) { maMenuButtonHdl
= rLink
; }
476 // support for custom menu (eg for configuration)
477 // note: this menu will also be used to display currently
478 // clipped toolbox items, so you should only touch
479 // items that you added by yourself
480 // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
481 // to allow for customization of the menu the coresponding handler is called
482 // when the menu button was clicked and before the menu is executed
483 void SetMenuType( ToolBoxMenuType aType
= ToolBoxMenuType::Customize
);
484 ToolBoxMenuType
GetMenuType() const;
485 bool IsMenuEnabled() const;
486 PopupMenu
* GetMenu() const;
487 void UpdateCustomMenu();
488 void SetMenuExecuteHdl( const Link
<ToolBox
*, void>& rLink
);
491 void ExecuteCustomMenu( const tools::Rectangle
& rRect
= tools::Rectangle() );
493 // allow Click Handler to distinguish between mouse and key input
494 bool IsKeyEvent() const { return mbIsKeyEvent
; }
496 // allows framework to set/query the planned popupmode
497 bool WillUsePopupMode() const;
498 void WillUsePopupMode( bool b
);
500 // accessibility helpers
502 // gets the displayed text
503 OUString
GetDisplayText() const override
;
504 // returns the bounding box for the character at index nIndex
505 // where nIndex is relative to the starting index of the item
506 // with id nItemId (in coordinates of the displaying window)
507 tools::Rectangle
GetCharacterBounds( sal_uInt16 nItemId
, long nIndex
);
508 // -1 is returned if no character is at that point
509 // if an index is found the corresponding item id is filled in (else 0)
510 long GetIndexForPoint( const Point
& rPoint
, sal_uInt16
& rItemID
);
512 static Size
GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize
);
513 Size
GetDefaultImageSize() const;
514 void ChangeHighlight( ImplToolItems::size_type nPos
);
516 void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout
);
517 void statusChanged(const css::frame::FeatureStateEvent
& rEvent
);
519 void SetToolBoxTextPosition( ToolBoxTextPosition ePosition
);
522 inline void ToolBox::CheckItem( sal_uInt16 nItemId
, bool bCheck
)
524 SetItemState( nItemId
, (bCheck
) ? TRISTATE_TRUE
: TRISTATE_FALSE
);
527 inline bool ToolBox::IsItemChecked( sal_uInt16 nItemId
) const
529 return (GetItemState( nItemId
) == TRISTATE_TRUE
);
532 inline Size
ToolBox::CalcWindowSizePixel()
534 return CalcWindowSizePixel( mnLines
);
537 inline ToolBox::ImplToolItems::size_type
ToolBox::GetFloatingLines() const
542 #endif // INCLUDED_VCL_TOOLBOX_HXX
544 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */