fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / vcl / toolbox.hxx
blobf27c721348f76854efc28b7efdd8aec34bfa4650
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 _SV_TOOLBOX_HXX
21 #define _SV_TOOLBOX_HXX
23 #include <tools/solar.h>
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 <vcl/timer.hxx>
29 #include <vector>
31 #include <com/sun/star/frame/XFrame.hpp>
33 class UserDrawEvent;
35 struct ImplToolItem;
36 struct ImplToolSize;
37 struct ImplToolBoxPrivateData;
38 class ImplTrackRect;
39 class PopupMenu;
41 namespace vcl
43 class IImageListProvider;
46 // -------------------------
47 // - ToolBoxCustomizeEvent -
48 // -------------------------
50 #define TOOLBOX_CUSTOMIZE_RESIZE ((sal_uInt16)0xFFFE)
52 class VCL_DLLPUBLIC ToolBoxCustomizeEvent
54 private:
55 ToolBox* mpTargetBox;
56 void* mpData;
57 sal_uInt16 mnIdFrom;
58 sal_uInt16 mnPosTo;
60 public:
61 ToolBoxCustomizeEvent();
62 ToolBoxCustomizeEvent( ToolBox* pDropBox,
63 sal_uInt16 nId, sal_uInt16 nPos = 0,
64 void* pUserData = NULL );
66 ToolBox* GetTargetBox() const { return mpTargetBox; }
67 sal_uInt16 GetTargetPos() const { return mnPosTo; }
68 sal_uInt16 GetSourceId() const { return mnIdFrom; }
69 void* GetData() const { return mpData; }
70 sal_Bool IsResized() const;
73 inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent()
75 mpTargetBox = NULL;
76 mnIdFrom = 0;
77 mnPosTo = 0;
78 mpData = NULL;
81 inline ToolBoxCustomizeEvent::ToolBoxCustomizeEvent( ToolBox* pDropBox,
82 sal_uInt16 nId, sal_uInt16 nPos,
83 void* pUserData )
85 mpTargetBox = pDropBox;
86 mnIdFrom = nId;
87 mnPosTo = nPos;
88 mpData = pUserData;
91 inline sal_Bool ToolBoxCustomizeEvent::IsResized() const
93 if ( mnPosTo == TOOLBOX_CUSTOMIZE_RESIZE )
94 return sal_True;
95 else
96 return sal_False;
99 // -----------------
100 // - ToolBox-Types -
101 // -----------------
103 #define TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004)
105 #define TOOLBOX_APPEND ((sal_uInt16)0xFFFF)
106 #define TOOLBOX_ITEM_NOTFOUND ((sal_uInt16)0xFFFF)
108 // item ids in the custom menu may not exceed this constant
109 #define TOOLBOX_MENUITEM_START ((sal_uInt16)0xE000)
111 // defines for the menubutton
112 #define TOOLBOX_MENUTYPE_NONE ((sal_uInt16)0x0000) // no menu at all, scrolling by spin buttons
113 #define TOOLBOX_MENUTYPE_CLIPPEDITEMS ((sal_uInt16)0x0001) // menu will contain "more" indicator
114 #define TOOLBOX_MENUTYPE_CUSTOMIZE ((sal_uInt16)0x0002) // menu will contain "customization" and "more" indicator
116 // small or large force an exact toolbox size for proper alignemnt
117 // dontcare will let the toolbox decide about its size
118 enum ToolBoxButtonSize { TOOLBOX_BUTTONSIZE_DONTCARE, TOOLBOX_BUTTONSIZE_SMALL, TOOLBOX_BUTTONSIZE_LARGE };
120 // TBX_LAYOUT_NORMAL - traditional layout, items are centered in the toolbar
121 // TBX_LAYOUT_LOCKVERT - special mode (currently used for calc input/formula
122 // bar) where item's vertical position is locked, e.g.
123 // toolbox is prevented from centering the items
124 enum ToolBoxLayoutMode { TBX_LAYOUT_NORMAL, TBX_LAYOUT_LOCKVERT };
126 struct ImplToolSize
128 long mnWidth;
129 long mnHeight;
130 sal_uInt16 mnLines;
133 // -----------
134 // - ToolBox -
135 // -----------
137 class VCL_DLLPUBLIC ToolBox : public DockingWindow
139 friend class FloatingWindow;
140 friend class ImplTBDragMgr;
142 private:
143 ImplToolBoxPrivateData* mpData;
144 std::vector<ImplToolSize> maFloatSizes;
145 ImageList maImageList;
146 Timer maTimer;
147 Rectangle maUpperRect;
148 Rectangle maLowerRect;
149 Rectangle maOutDockRect;
150 Rectangle maInDockRect;
151 Rectangle maPaintRect;
152 FloatingWindow* mpFloatWin;
153 sal_uInt16 mnKeyModifier;
154 long mnDX;
155 long mnDY;
156 long mnMaxItemWidth; // max item width
157 long mnMaxItemHeight; // max item height (for standard items)
158 long mnWinHeight; // max window height (for window items)
159 long mnLeftBorder; // inner border
160 long mnTopBorder;
161 long mnRightBorder;
162 long mnBottomBorder;
163 long mnLastResizeDY;
164 long mnActivateCount;
165 sal_uInt16 mnLastFocusItemId;
166 sal_uInt16 mnFocusPos;
167 sal_uInt16 mnOutStyle;
168 sal_uInt16 mnHighItemId;
169 sal_uInt16 mnCurItemId;
170 sal_uInt16 mnDownItemId;
171 sal_uInt16 mnCurPos;
172 sal_uInt16 mnLines; // total number of toolbox lines
173 sal_uInt16 mnCurLine; // the currently visible line
174 sal_uInt16 mnCurLines; // number of lines due to line breaking
175 sal_uInt16 mnVisLines; // number of visible lines (for scrolling)
176 sal_uInt16 mnFloatLines; // number of lines during floating mode
177 sal_uInt16 mnDockLines;
178 sal_uInt16 mnConfigItem;
179 sal_uInt16 mnMouseClicks;
180 sal_uInt16 mnMouseModifier;
181 unsigned int mbDrag:1,
182 mbSelection:1,
183 mbCommandDrag:1,
184 mbUpper:1,
185 mbLower:1,
186 mbIn:1,
187 mbCalc:1,
188 mbFormat:1,
189 mbFullPaint:1,
190 mbHorz:1,
191 mbScroll:1,
192 mbLastFloatMode:1,
193 mbCustomize:1,
194 mbCustomizeMode:1,
195 mbDragging:1,
196 mbMenuStrings:1,
197 mbIsShift:1,
198 mbIsKeyEvent:1,
199 mbChangingHighlight:1;
200 WindowAlign meAlign;
201 WindowAlign meDockAlign;
202 ButtonType meButtonType;
203 PointerStyle meLastStyle;
204 WinBits mnWinStyle;
205 ToolBoxLayoutMode meLayoutMode;
206 Link maClickHdl;
207 Link maDoubleClickHdl;
208 Link maActivateHdl;
209 Link maDeactivateHdl;
210 Link maHighlightHdl;
211 Link maSelectHdl;
212 Link maCommandHandler;
213 Link maStateChangedHandler;
214 Link maDataChangedHandler;
216 public:
217 using Window::ImplInit;
218 private:
219 SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle );
220 using DockingWindow::ImplInitSettings;
221 SAL_DLLPRIVATE void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
222 SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId );
223 SAL_DLLPRIVATE ImplToolItem* ImplGetItem( sal_uInt16 nId ) const;
224 SAL_DLLPRIVATE sal_Bool ImplCalcItem();
225 SAL_DLLPRIVATE sal_uInt16 ImplCalcBreaks( long nWidth, long* pMaxLineWidth, sal_Bool bCalcHorz );
226 SAL_DLLPRIVATE void ImplFormat( sal_Bool bResize = sal_False );
227 SAL_DLLPRIVATE void ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn );
228 SAL_DLLPRIVATE void ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect );
229 SAL_DLLPRIVATE void ImplDrawItem( sal_uInt16 nPos, sal_uInt16 nHighlight = 0, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
230 using Window::ImplInvalidate;
231 SAL_DLLPRIVATE void ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool bFullPaint = sal_False );
232 SAL_DLLPRIVATE void ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
233 SAL_DLLPRIVATE const OUString ImplConvertMenuString( const XubString& rStr );
234 SAL_DLLPRIVATE sal_Bool ImplHandleMouseMove( const MouseEvent& rMEvt, sal_Bool bRepeat = sal_False );
235 SAL_DLLPRIVATE sal_Bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, sal_Bool bCancel = sal_False );
236 SAL_DLLPRIVATE void ImplChangeHighlight( ImplToolItem* pItem, sal_Bool bNoGrabFocus = sal_False );
237 SAL_DLLPRIVATE sal_Bool ImplChangeHighlightUpDn( sal_Bool bUp, sal_Bool bNoCycle = sal_False );
238 SAL_DLLPRIVATE sal_uInt16 ImplGetItemLine( ImplToolItem* pCurrentItem );
239 SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( sal_uInt16 nLine );
240 SAL_DLLPRIVATE sal_Bool ImplOpenItem( KeyCode aKeyCode );
241 SAL_DLLPRIVATE sal_Bool ImplActivateItem( KeyCode aKeyCode );
242 SAL_DLLPRIVATE void ImplShowFocus();
243 SAL_DLLPRIVATE void ImplHideFocus();
244 SAL_DLLPRIVATE void ImplUpdateInputEnable();
245 SAL_DLLPRIVATE void ImplFillLayoutData() const;
246 SAL_DLLPRIVATE sal_Bool ImplHasClippedItems();
247 SAL_DLLPRIVATE Point ImplGetPopupPosition( const Rectangle& rRect, const Size& rSize ) const;
248 SAL_DLLPRIVATE void ImplExecuteCustomMenu();
249 SAL_DLLPRIVATE sal_Bool ImplIsFloatingMode() const;
250 SAL_DLLPRIVATE sal_Bool ImplIsInPopupMode() const;
251 SAL_DLLPRIVATE const XubString& ImplGetHelpText( sal_uInt16 nItemId ) const;
252 SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize();
253 SAL_DLLPRIVATE sal_Bool ImplHasExternalMenubutton();
254 SAL_DLLPRIVATE void ImplDrawFloatwinBorder( ImplToolItem* pItem );
256 DECL_DLLPRIVATE_LINK( ImplCallExecuteCustomMenu, void* );
257 DECL_DLLPRIVATE_LINK( ImplUpdateHdl, void* );
258 DECL_DLLPRIVATE_LINK( ImplResetAutoSizeTriesHdl, void* );
259 DECL_DLLPRIVATE_LINK( ImplCustomMenuListener, VclMenuEvent* );
260 DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl, void* );
262 // Copy assignment is forbidden and not implemented.
263 SAL_DLLPRIVATE ToolBox (const ToolBox &);
264 SAL_DLLPRIVATE ToolBox& operator= (const ToolBox &);
266 SAL_DLLPRIVATE void ImplUpdateImageList(); // called if StateChanged
267 public:
268 SAL_DLLPRIVATE void ImplFloatControl( sal_Bool bStart, FloatingWindow* pWindow = NULL );
269 SAL_DLLPRIVATE void ImplDisableFlatButtons();
271 static SAL_DLLPRIVATE int ImplGetDragWidth( ToolBox* pThis );
272 static SAL_DLLPRIVATE void ImplUpdateDragArea( ToolBox *pThis );
273 static SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, long& rLeft, long& rTop,
274 long& rRight, long& rBottom, const ToolBox *pThis );
275 static SAL_DLLPRIVATE void ImplDrawGrip( ToolBox* pThis );
276 static SAL_DLLPRIVATE void ImplDrawGradientBackground( ToolBox* pThis, ImplDockingWindowWrapper *pWrapper );
277 static SAL_DLLPRIVATE sal_Bool ImplDrawNativeBackground( ToolBox* pThis, const Region &rRegion );
278 static SAL_DLLPRIVATE void ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegion );
279 static SAL_DLLPRIVATE void ImplDrawConstantBackground( ToolBox* pThis, const Region &rRegion, sal_Bool bIsInPopupMode );
280 static SAL_DLLPRIVATE void ImplDrawBackground( ToolBox* pThis, const Rectangle &rRect );
281 static SAL_DLLPRIVATE void ImplErase( ToolBox* pThis, const Rectangle &rRect, sal_Bool bHighlight = sal_False, sal_Bool bHasOpenPopup = sal_False );
282 static SAL_DLLPRIVATE void ImplDrawBorder( ToolBox* pWin );
283 static SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem( const ToolBox* pThis );
284 static SAL_DLLPRIVATE Size ImplCalcSize( const ToolBox* pThis, sal_uInt16 nCalcLines, sal_uInt16 nCalcMode = 0 );
285 static SAL_DLLPRIVATE void ImplCalcFloatSizes( ToolBox* pThis );
286 static SAL_DLLPRIVATE Size ImplCalcFloatSize( ToolBox* pThis, sal_uInt16& rLines );
287 static SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( ToolBox* pThis, Size& rMinSize, Size& rMaxSize );
288 static SAL_DLLPRIVATE void ImplSetMinMaxFloatSize( ToolBox *pThis );
289 static SAL_DLLPRIVATE sal_uInt16 ImplCalcLines( ToolBox* pThis, long nToolSize );
290 static SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( ToolBox* pThis, const Point& rPos );
291 static SAL_DLLPRIVATE void ImplLineSizing( ToolBox* pThis, const Point& rPos, Rectangle& rRect, sal_uInt16 nLineMode );
292 static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( ToolBox* pBox, const Point& rPos );
293 static SAL_DLLPRIVATE sal_uInt16 ImplFindItemPos( const ImplToolItem* pItem, const std::vector< ImplToolItem >& rList );
294 static SAL_DLLPRIVATE void ImplDrawMenubutton( ToolBox *pThis, sal_Bool bHighlight );
295 static SAL_DLLPRIVATE sal_uInt16 ImplCountLineBreaks( const ToolBox *pThis );
296 SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; }
298 protected:
299 void SetCurItemId(sal_uInt16 nSet) { mnCurItemId = nSet; }
301 public:
302 ToolBox( Window* pParent, WinBits nStyle = 0 );
303 ToolBox( Window* pParent, const ResId& rResId );
304 ~ToolBox();
306 virtual void Click();
307 virtual void DoubleClick();
308 virtual void Activate();
309 virtual void Deactivate();
310 virtual void Highlight();
311 virtual void Select();
312 virtual void Customize( const ToolBoxCustomizeEvent& rCEvt );
313 virtual void UserDraw( const UserDrawEvent& rUDEvt );
315 virtual void MouseButtonDown( const MouseEvent& rMEvt );
316 virtual void MouseButtonUp( const MouseEvent& rMEvt );
317 virtual void MouseMove( const MouseEvent& rMEvt );
318 virtual void Tracking( const TrackingEvent& rTEvt );
319 virtual void Paint( const Rectangle& rRect );
320 virtual void Move();
321 virtual void Resize();
322 virtual void RequestHelp( const HelpEvent& rHEvt );
323 virtual long Notify( NotifyEvent& rNEvt );
324 virtual void Command( const CommandEvent& rCEvt );
325 virtual void StateChanged( StateChangedType nType );
326 virtual void DataChanged( const DataChangedEvent& rDCEvt );
328 virtual void GetFocus();
329 virtual void LoseFocus();
330 virtual void KeyInput( const KeyEvent& rKEvt );
332 virtual sal_Bool PrepareToggleFloatingMode();
333 virtual void ToggleFloatingMode();
334 virtual void StartDocking();
335 virtual sal_Bool Docking( const Point& rPos, Rectangle& rRect );
336 virtual void EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
337 virtual void Resizing( Size& rSize );
338 virtual Size GetOptimalSize() const;
340 void InsertItem( const ResId& rResId,
341 sal_uInt16 nPos = TOOLBOX_APPEND );
342 /// Insert a command (like '.uno:Save').
343 virtual void InsertItem( const OUString& rCommand,
344 const com::sun::star::uno::Reference<com::sun::star::frame::XFrame>& rFrame,
345 ToolBoxItemBits nBits = 0,
346 sal_uInt16 nPos = TOOLBOX_APPEND );
347 void InsertItem( sal_uInt16 nItemId, const Image& rImage,
348 ToolBoxItemBits nBits = 0,
349 sal_uInt16 nPos = TOOLBOX_APPEND );
350 void InsertItem( sal_uInt16 nItemId, const Image& rImage,
351 const XubString& rText,
352 ToolBoxItemBits nBits = 0,
353 sal_uInt16 nPos = TOOLBOX_APPEND );
354 void InsertItem( sal_uInt16 nItemId, const XubString& rText,
355 ToolBoxItemBits nBits = 0,
356 sal_uInt16 nPos = TOOLBOX_APPEND );
357 void InsertWindow( sal_uInt16 nItemId, Window* pWindow,
358 ToolBoxItemBits nBits = 0,
359 sal_uInt16 nPos = TOOLBOX_APPEND );
360 void InsertSpace( sal_uInt16 nPos = TOOLBOX_APPEND );
361 void InsertSeparator( sal_uInt16 nPos = TOOLBOX_APPEND,
362 sal_uInt16 nPixSize = 0 );
363 void InsertBreak( sal_uInt16 nPos = TOOLBOX_APPEND );
364 void RemoveItem( sal_uInt16 nPos );
365 void CopyItem( const ToolBox& rToolBox, sal_uInt16 nItemId,
366 sal_uInt16 nNewPos = TOOLBOX_APPEND );
367 void Clear();
369 const ImageList& GetImageList() const { return maImageList; }
370 void SetImageList( const ImageList& rImageList );
372 void SetButtonType( ButtonType eNewType = BUTTON_SYMBOL );
373 ButtonType GetButtonType() const { return meButtonType; }
375 // sets a fixed button size (small, large or dontcare (==autosize))
376 void SetToolboxButtonSize( ToolBoxButtonSize eSize );
377 ToolBoxButtonSize GetToolboxButtonSize() const;
379 void SetAlign( WindowAlign eNewAlign = WINDOWALIGN_TOP );
380 WindowAlign GetAlign() const { return meAlign; }
381 sal_Bool IsHorizontal() const { return mbHorz; }
383 void SetLineCount( sal_uInt16 nNewLines );
384 sal_uInt16 GetLineCount() const { return mnLines; }
385 sal_uInt16 GetCurLine() const { return mnCurLine; }
386 void ShowLine( sal_Bool bNext );
388 // Used to enable/disable scrolling one page at a time for toolbar
389 void SetPageScroll( sal_Bool b );
391 sal_uInt16 GetItemCount() const;
392 ToolBoxItemType GetItemType( sal_uInt16 nPos ) const;
393 sal_uInt16 GetItemPos( sal_uInt16 nItemId ) const;
394 sal_uInt16 GetItemPos( const Point& rPos ) const;
395 sal_uInt16 GetItemId( sal_uInt16 nPos ) const;
396 sal_uInt16 GetItemId( const Point& rPos ) const;
397 /// Map the command name (like .uno:Save) back to item id.
398 sal_uInt16 GetItemId( const OUString& rCommand ) const;
399 Rectangle GetItemRect( sal_uInt16 nItemId ) const;
400 Rectangle GetItemPosRect( sal_uInt16 nPos ) const;
402 /// Retrieves the optimal position to place a popup window for this item (subtoolbar or dropdown)
403 Point GetItemPopupPosition( sal_uInt16 nItemId, const Size& rSize ) const;
405 Rectangle GetScrollRect() const;
406 sal_uInt16 GetCurItemId() const { return mnCurItemId; }
407 sal_uInt16 GetDownItemId() const { return mnDownItemId; }
408 sal_uInt16 GetClicks() const { return mnMouseClicks; }
409 sal_uInt16 GetModifier() const { return mnMouseModifier; }
410 sal_uInt16 GetKeyModifier() const { return mnKeyModifier; }
412 void SetItemBits( sal_uInt16 nItemId, ToolBoxItemBits nBits );
413 ToolBoxItemBits GetItemBits( sal_uInt16 nItemId ) const;
415 void SetItemData( sal_uInt16 nItemId, void* pNewData );
416 void* GetItemData( sal_uInt16 nItemId ) const;
417 void SetItemImage( sal_uInt16 nItemId, const Image& rImage );
418 Image GetItemImage( sal_uInt16 nItemId ) const;
419 void SetItemImageAngle( sal_uInt16 nItemId, long nAngle10 );
420 void SetItemImageMirrorMode( sal_uInt16 nItemId, sal_Bool bMirror );
421 void SetItemText( sal_uInt16 nItemId, const XubString& rText );
422 const XubString& GetItemText( sal_uInt16 nItemId ) const;
423 void SetItemWindow( sal_uInt16 nItemId, Window* pNewWindow );
424 Window* GetItemWindow( sal_uInt16 nItemId ) const;
425 sal_uInt16 GetHighlightItemId() const { return mnHighItemId; }
427 void StartSelection();
428 void EndSelection();
430 void SetItemDown( sal_uInt16 nItemId, sal_Bool bDown, sal_Bool bRelease = sal_True );
432 void SetItemState( sal_uInt16 nItemId, TriState eState );
433 TriState GetItemState( sal_uInt16 nItemId ) const;
435 void CheckItem( sal_uInt16 nItemId, sal_Bool bCheck = sal_True );
436 sal_Bool IsItemChecked( sal_uInt16 nItemId ) const;
438 void EnableItem( sal_uInt16 nItemId, sal_Bool bEnable = sal_True );
439 sal_Bool IsItemEnabled( sal_uInt16 nItemId ) const;
441 void TriggerItem( sal_uInt16 nItemId, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
442 void ShowItem( sal_uInt16 nItemId, sal_Bool bVisible = sal_True );
443 void HideItem( sal_uInt16 nItemId ) { ShowItem( nItemId, sal_False ); }
444 sal_Bool IsItemVisible( sal_uInt16 nItemId ) const;
445 sal_Bool IsItemReallyVisible( sal_uInt16 nItemId ) const;
447 void SetItemCommand( sal_uInt16 nItemId, const XubString& rCommand );
448 const XubString& GetItemCommand( sal_uInt16 nItemId ) const;
450 using Window::SetQuickHelpText;
451 void SetQuickHelpText( sal_uInt16 nItemId, const XubString& rText );
452 using Window::GetQuickHelpText;
453 const XubString& GetQuickHelpText( sal_uInt16 nItemId ) const;
455 void SetHelpText( sal_uInt16 nItemId, const XubString& rText );
456 const XubString& GetHelpText( sal_uInt16 nItemId ) const;
458 void SetHelpId( sal_uInt16 nItemId, const OString& rHelpId );
459 OString GetHelpId( sal_uInt16 nItemId ) const;
461 // window size according to current alignment, floating state and number of lines
462 Size CalcWindowSizePixel() const;
463 // window size according to current alignment, floating state and a given number of lines
464 Size CalcWindowSizePixel( sal_uInt16 nCalcLines ) const;
465 // window size according to current floating state and a given number of lines and a given alignment
466 Size CalcWindowSizePixel( sal_uInt16 nCalcLines, WindowAlign eAlign ) const;
467 // floating window size according to number of lines (uses the number of line breaks)
468 Size CalcFloatingWindowSizePixel() const;
469 // floating window size with a given number of lines
470 Size CalcFloatingWindowSizePixel( sal_uInt16 nCalcLines ) const;
471 // automatic window size for popoup mode
472 Size CalcPopupWindowSizePixel() const;
474 // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
475 Size CalcMinimumWindowSizePixel() const;
477 void SetDockingRects( const Rectangle& rOutRect,
478 const Rectangle& rInRect );
479 void SetFloatingLines( sal_uInt16 nFloatLines );
480 sal_uInt16 GetFloatingLines() const;
482 void SetStyle( WinBits nNewStyle ) { mnWinStyle = nNewStyle; }
483 WinBits GetStyle() const { return mnWinStyle; }
485 // enable/disable undocking
486 void Lock( sal_Bool bLock = sal_True );
488 // read configuration to determine locking behaviour
489 static sal_Bool AlwaysLocked();
491 void EnableMenuStrings( sal_Bool bEnable = sal_True ) { mbMenuStrings = (bEnable != 0); }
492 sal_Bool IsMenuStringsEnabled() const { return mbMenuStrings; }
494 void SetOutStyle( sal_uInt16 nNewStyle );
495 sal_uInt16 GetOutStyle() const { return mnOutStyle; }
497 void EnableCustomize( sal_Bool bEnable = sal_True );
498 sal_Bool IsCustomize() { return mbCustomize; }
499 sal_Bool IsInCustomizeMode() const { return mbCustomizeMode; }
501 void SetHelpText( const XubString& rText )
502 { DockingWindow::SetHelpText( rText ); }
503 const XubString& GetHelpText() const
504 { return DockingWindow::GetHelpText(); }
506 void SetHelpId( const OString& rId )
507 { DockingWindow::SetHelpId( rId ); }
508 const OString& GetHelpId() const
509 { return DockingWindow::GetHelpId(); }
511 void SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
512 const Link& GetClickHdl() const { return maClickHdl; }
513 void SetDoubleClickHdl( const Link& rLink ) { maDoubleClickHdl = rLink; }
514 const Link& GetDoubleClickHdl() const { return maDoubleClickHdl; }
515 void SetDropdownClickHdl( const Link& rLink );
516 const Link& GetDropdownClickHdl() const;
517 void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; }
518 const Link& GetActivateHdl() const { return maActivateHdl; }
519 void SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; }
520 const Link& GetDeactivateHdl() const { return maDeactivateHdl; }
521 void SetHighlightHdl( const Link& rLink ) { maHighlightHdl = rLink; }
522 const Link& GetHighlightHdl() const { return maHighlightHdl; }
523 void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; }
524 const Link& GetSelectHdl() const { return maSelectHdl; }
525 void SetCommandHdl( const Link& aLink ) { maCommandHandler = aLink; }
526 const Link& GetCommandHdl() const { return maCommandHandler; }
527 void SetStateChangedHdl( const Link& aLink ) { maStateChangedHandler = aLink; }
528 const Link& GetStateChangedHdl() const { return maStateChangedHandler; }
529 void SetDataChangedHdl( const Link& aLink ) { maDataChangedHandler = aLink; }
530 const Link& GetDataChangedHdl() { return maDataChangedHandler; }
532 // support for custom menu (eg for configuration)
533 // note: this menu will also be used to display currently
534 // clipped toolbox items, so you should only touch
535 // items that you added by yourself
536 // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
537 // to allow for customization of the menu the coresponding handler is called
538 // when the menu button was clicked and before the menu is executed
539 void SetMenuType( sal_uInt16 aType = TOOLBOX_MENUTYPE_CUSTOMIZE );
540 sal_uInt16 GetMenuType() const;
541 sal_Bool IsMenuEnabled() const;
542 PopupMenu* GetMenu() const;
543 void UpdateCustomMenu();
544 void SetMenuButtonHdl( const Link& rLink );
546 // open custommenu
547 void ExecuteCustomMenu();
549 // allow Click Handler to detect special key
550 bool IsShift() const { return mbIsShift; }
551 // allow Click Handler to distinguish between mouse and key input
552 sal_Bool IsKeyEvent() const { return mbIsKeyEvent; }
554 // allows framework to set/query the planned popupmode
555 sal_Bool WillUsePopupMode() const;
556 void WillUsePopupMode( sal_Bool b);
558 // accessibility helpers
560 // gets the displayed text
561 OUString GetDisplayText() const;
562 // returns the bounding box for the character at index nIndex
563 // where nIndex is relative to the starting index of the item
564 // with id nItemId (in coordinates of the displaying window)
565 Rectangle GetCharacterBounds( sal_uInt16 nItemId, long nIndex ) const;
566 // -1 is returned if no character is at that point
567 // if an index is found the corresponding item id is filled in (else 0)
568 long GetIndexForPoint( const Point& rPoint, sal_uInt16& rItemID ) const;
570 static const Size& GetDefaultImageSize(bool bLarge);
571 const Size& GetDefaultImageSize() const;
572 void ChangeHighlight( sal_uInt16 nPos );
574 void SetImageListProvider(vcl::IImageListProvider* _pProvider);
575 void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
578 inline void ToolBox::CheckItem( sal_uInt16 nItemId, sal_Bool bCheck )
580 SetItemState( nItemId, (bCheck) ? STATE_CHECK : STATE_NOCHECK );
583 inline sal_Bool ToolBox::IsItemChecked( sal_uInt16 nItemId ) const
585 return (GetItemState( nItemId ) == STATE_CHECK);
588 inline Size ToolBox::CalcWindowSizePixel() const
590 return CalcWindowSizePixel( mnLines );
593 inline Rectangle ToolBox::GetScrollRect() const
595 return maUpperRect.GetUnion( maLowerRect );
598 inline void ToolBox::SetDockingRects( const Rectangle& rOutRect,
599 const Rectangle& rInRect )
601 maOutDockRect = rOutRect;
602 maInDockRect = rInRect;
605 inline void ToolBox::SetFloatingLines( sal_uInt16 nNewLines )
607 mnFloatLines = nNewLines;
610 inline sal_uInt16 ToolBox::GetFloatingLines() const
612 return mnFloatLines;
615 #endif // _SV_TOOLBOX_HXX
617 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */