LibreOffice Module vcl (master) 1
toolbox.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_VCL_TOOLBOX_HXX
21#define INCLUDED_VCL_TOOLBOX_HXX
22
23#include <vcl/vclenum.hxx>
24#include <vcl/dllapi.h>
25#include <vcl/dockwin.hxx>
26#include <vcl/image.hxx>
27#include <vcl/keycod.hxx>
28#include <vcl/toolboxid.hxx>
30#include <tools/degree.hxx>
31
32#include <limits>
33#include <memory>
34#include <vector>
35
36namespace com::sun::star::frame { class XFrame; }
37
38class Timer;
39struct ImplToolItem;
41class PopupMenu;
42class VclMenuEvent;
43class StyleSettings;
44
45// item ids in the custom menu may not exceed this constant
46constexpr sal_uInt16 TOOLBOX_MENUITEM_START = 0x1000;
47
48// defines for the menubutton
49enum 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
53};
54namespace o3tl
55{
56 template<> struct typed_flags<ToolBoxMenuType> : is_typed_flags<ToolBoxMenuType, 0x0003> {};
57}
58
60{
61 Normal, // traditional layout, items are centered in the toolbar
62 Locked // horizontal positions of all items remain unchanged,
63 // vertical positions of items smaller than first item are aligned to first item's vertical center,
64 // vertical positions of items larger than first item remain unchanged
65};
66
67// Position of the text when icon and text are painted
69
70class Idle;
71
74{
75 friend class FloatingWindow;
76 friend class ImplTBDragMgr;
77
78public:
79 using ImplToolItems = std::vector<ImplToolItem>;
80
81 virtual FactoryFunction GetUITestFactory() const override;
82
83 void SetCurItemId( ToolBoxItemId CurID ) { mnCurItemId=CurID; }
84
85 static constexpr auto APPEND
86 = std::numeric_limits<ImplToolItems::size_type>::max();
87
88 static constexpr auto ITEM_NOTFOUND
89 = std::numeric_limits<ImplToolItems::size_type>::max();
90
91private:
93 {
96 ImplToolItems::size_type mnLines;
97 };
98
99 std::unique_ptr<ImplToolBoxPrivateData> mpData;
100 std::vector<ImplToolSize> maFloatSizes;
101 std::unique_ptr<Idle> mpIdle;
108 tools::Long mnMaxItemWidth; // max item width
109 tools::Long mnMaxItemHeight; // max item height (for standard items)
110 tools::Long mnWinHeight; // max window height (for window items)
111 tools::Long mnLeftBorder; // inner border
121 ImplToolItems::size_type mnCurPos;
122 ImplToolItems::size_type mnLines; // total number of toolbox lines
123 ImplToolItems::size_type mnCurLine; // the currently visible line
124 ImplToolItems::size_type mnCurLines; // number of lines due to line breaking
125 ImplToolItems::size_type mnVisLines; // number of visible lines (for scrolling)
126 ImplToolItems::size_type mnFloatLines; // number of lines during floating mode
127 ImplToolItems::size_type mnDockLines;
128 sal_uInt16 mnMouseModifier;
129 bool mbDrag:1,
160
161public:
162 using Window::ImplInit;
163private:
164 SAL_DLLPRIVATE void InvalidateItem(ImplToolItems::size_type nPosition);
165 SAL_DLLPRIVATE void InvalidateSpin(bool bInvalidateUpper = true,
166 bool bInvalidateLower = true);
167 SAL_DLLPRIVATE void InvalidateMenuButton();
168
169 SAL_DLLPRIVATE void ImplInitToolBoxData();
170 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
172 SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
173 SAL_DLLPRIVATE ImplToolItem* ImplGetItem( ToolBoxItemId nId ) const;
174 SAL_DLLPRIVATE bool ImplCalcItem();
175 SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcBreaks( tools::Long nWidth, sal_Int32* pMaxLineWidth, bool bCalcHorz ) const;
176 SAL_DLLPRIVATE void ImplFormat( bool bResize = false );
177 SAL_DLLPRIVATE void ImplDrawSpin(vcl::RenderContext& rRenderContext);
178 SAL_DLLPRIVATE void ImplDrawSeparator(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, const tools::Rectangle& rRect);
179 SAL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext& rRenderContext, ImplToolItems::size_type nPos, sal_uInt16 nHighlight );
180 using Window::ImplInvalidate;
181 SAL_DLLPRIVATE void ImplInvalidate( bool bNewCalc = false, bool bFullPaint = false );
182 SAL_DLLPRIVATE void ImplUpdateItem( ImplToolItems::size_type nIndex = ITEM_NOTFOUND );
183 SAL_DLLPRIVATE bool ImplHandleMouseMove( const MouseEvent& rMEvt, bool bRepeat = false );
184 SAL_DLLPRIVATE bool ImplHandleMouseButtonUp( const MouseEvent& rMEvt, bool bCancel = false );
185 SAL_DLLPRIVATE void ImplChangeHighlight( ImplToolItem const * pItem, bool bNoGrabFocus = false );
186 SAL_DLLPRIVATE bool ImplChangeHighlightUpDn( bool bUp, bool bNoCycle = false );
187 SAL_DLLPRIVATE ImplToolItems::size_type ImplGetItemLine( ImplToolItem const * pCurrentItem );
188 SAL_DLLPRIVATE ImplToolItem* ImplGetFirstValidItem( ImplToolItems::size_type nLine );
189 SAL_DLLPRIVATE bool ImplOpenItem( vcl::KeyCode aKeyCode );
190 SAL_DLLPRIVATE bool ImplActivateItem( vcl::KeyCode aKeyCode );
191 SAL_DLLPRIVATE void ImplShowFocus();
192 SAL_DLLPRIVATE void ImplHideFocus();
193 SAL_DLLPRIVATE void ImplUpdateInputEnable();
194 SAL_DLLPRIVATE void ImplFillLayoutData();
195 SAL_DLLPRIVATE bool ImplHasClippedItems();
196 SAL_DLLPRIVATE Point ImplGetPopupPosition( const tools::Rectangle& rRect ) const;
197 SAL_DLLPRIVATE bool ImplIsFloatingMode() const;
198 SAL_DLLPRIVATE bool ImplIsInPopupMode() const;
199 SAL_DLLPRIVATE const OUString& ImplGetHelpText( ToolBoxItemId nItemId ) const;
200 SAL_DLLPRIVATE Size ImplGetOptimalFloatingSize();
201 SAL_DLLPRIVATE bool ImplHasExternalMenubutton() const;
202 SAL_DLLPRIVATE void ImplDrawFloatwinBorder(vcl::RenderContext& rRenderContext, ImplToolItem const * pItem );
203
204 DECL_DLLPRIVATE_LINK( ImplUpdateHdl, Timer*, void );
205 DECL_DLLPRIVATE_LINK( ImplCustomMenuListener, VclMenuEvent&, void );
206 DECL_DLLPRIVATE_LINK( ImplDropdownLongClickHdl, Timer*, void );
207
208 ToolBox (const ToolBox &) = delete;
209 ToolBox& operator= (const ToolBox &) = delete;
210
211public:
212 SAL_DLLPRIVATE void ImplFloatControl( bool bStart, FloatingWindow* pWindow );
213
214 SAL_DLLPRIVATE int ImplGetDragWidth() const;
215 static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::RenderContext& rRenderContext,
216 bool bHorz );
217 static SAL_DLLPRIVATE int ImplGetDragWidth( const vcl::Window& rWindow,
218 bool bHorz );
219 SAL_DLLPRIVATE void ImplUpdateDragArea() const;
220 SAL_DLLPRIVATE void ImplCalcBorder( WindowAlign eAlign, tools::Long& rLeft, tools::Long& rTop,
221 tools::Long& rRight, tools::Long& rBottom ) const;
222 SAL_DLLPRIVATE void ImplCheckUpdate();
223 static SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext,
224 const tools::Rectangle &aDragArea, int nDragWidth,
225 WindowAlign eAlign, bool bHorz);
226
227 SAL_DLLPRIVATE void ImplDrawGrip(vcl::RenderContext& rRenderContext);
228 SAL_DLLPRIVATE void ImplDrawGradientBackground(vcl::RenderContext& rRenderContext);
229 SAL_DLLPRIVATE bool ImplDrawNativeBackground(vcl::RenderContext& rRenderContext) const;
230 SAL_DLLPRIVATE void ImplDrawTransparentBackground(const vcl::Region &rRegion);
231 SAL_DLLPRIVATE static void ImplDrawConstantBackground(vcl::RenderContext& rRenderContext, const vcl::Region &rRegion, bool bIsInPopupMode);
232 SAL_DLLPRIVATE void ImplDrawBackground(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect);
233
234 SAL_DLLPRIVATE void ImplErase(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, bool bHighlight, bool bHasOpenPopup = false );
235
236 SAL_DLLPRIVATE void ImplDrawBorder(vcl::RenderContext& rRenderContext);
237 SAL_DLLPRIVATE const ImplToolItem *ImplGetFirstClippedItem() const;
238 SAL_DLLPRIVATE Size ImplCalcSize( ImplToolItems::size_type nCalcLines, sal_uInt16 nCalcMode = 0 );
239 SAL_DLLPRIVATE void ImplCalcFloatSizes();
240 SAL_DLLPRIVATE Size ImplCalcFloatSize( ImplToolItems::size_type& rLines );
241 SAL_DLLPRIVATE void ImplCalcMinMaxFloatSize( Size& rMinSize, Size& rMaxSize );
242 SAL_DLLPRIVATE void ImplSetMinMaxFloatSize();
243 SAL_DLLPRIVATE ImplToolItems::size_type ImplCalcLines( tools::Long nToolSize ) const;
244 SAL_DLLPRIVATE sal_uInt16 ImplTestLineSize( const Point& rPos ) const;
245 SAL_DLLPRIVATE void ImplLineSizing( const Point& rPos, tools::Rectangle& rRect, sal_uInt16 nLineMode );
246 SAL_DLLPRIVATE static ImplToolItems::size_type ImplFindItemPos( const ImplToolItem* pItem, const ImplToolItems& rList );
247 SAL_DLLPRIVATE void ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight);
248 SAL_DLLPRIVATE void ImplDrawButton(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow);
249 SAL_DLLPRIVATE ImplToolItems::size_type ImplCountLineBreaks() const;
250 SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData.get(); }
251
252 SAL_DLLPRIVATE void ApplyBackgroundSettings(vcl::RenderContext&, const StyleSettings&);
253 SAL_DLLPRIVATE void ApplyForegroundSettings(vcl::RenderContext&, const StyleSettings&);
254
255protected:
256 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
257
258public:
259 ToolBox(vcl::Window* pParent, WinBits nStyle = 0);
260 ToolBox(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription,
261 const css::uno::Reference<css::frame::XFrame> &rFrame = css::uno::Reference<css::frame::XFrame>());
262 virtual ~ToolBox() override;
263 virtual void dispose() override;
264
265 virtual void Click();
266 void DoubleClick();
267 virtual void Activate() override;
268 virtual void Deactivate() override;
269 void Highlight();
270 virtual void Select();
271
272 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
273 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
274 virtual void MouseMove( const MouseEvent& rMEvt ) override;
275 virtual void Tracking( const TrackingEvent& rTEvt ) override;
276 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
277 virtual void Resize() override;
278 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
279 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
280 virtual void Command( const CommandEvent& rCEvt ) override;
281 virtual void StateChanged( StateChangedType nType ) override;
282 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
283
284 virtual void LoseFocus() override;
285 virtual void KeyInput( const KeyEvent& rKEvt ) override;
286
287 virtual void ToggleFloatingMode() override;
288 virtual void StartDocking() override;
289 virtual bool Docking( const Point& rPos, tools::Rectangle& rRect ) override;
290 virtual void EndDocking( const tools::Rectangle& rRect, bool bFloatMode ) override;
291 virtual void Resizing( Size& rSize ) override;
292 virtual Size GetOptimalSize() const override;
293 virtual void doDeferredInit(WinBits nBits) override;
294 virtual void queue_resize(StateChangedType eReason = StateChangedType::Layout) override;
295
297 virtual void InsertItem( const OUString& rCommand,
298 const css::uno::Reference<css::frame::XFrame>& rFrame,
299 ToolBoxItemBits nBits,
300 const Size& rRequestedSize,
301 ImplToolItems::size_type nPos = APPEND );
302 void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
304 ImplToolItems::size_type nPos = APPEND );
305 void InsertItem( ToolBoxItemId nItemId, const Image& rImage,
306 const OUString& rText,
308 ImplToolItems::size_type nPos = APPEND );
309 void InsertItem( ToolBoxItemId nItemId, const OUString& rText,
310 const OUString& rCommand,
312 ImplToolItems::size_type nPos = APPEND );
313 void InsertWindow( ToolBoxItemId nItemId, vcl::Window* pWindow,
315 ImplToolItems::size_type nPos = APPEND );
316 void InsertSpace();
317 void InsertSeparator( ImplToolItems::size_type nPos = APPEND, sal_uInt16 nPixSize = 0 );
318 void InsertBreak( ImplToolItems::size_type nPos = APPEND );
319 void RemoveItem( ImplToolItems::size_type nPos );
320 void CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId );
321 void Clear();
322
323 void SetButtonType( ButtonType eNewType );
324 ButtonType GetButtonType() const { return meButtonType; }
325
326 // sets a fixed button size (small, large or dontcare (==autosize))
327 void SetToolboxButtonSize( ToolBoxButtonSize eSize );
328 ToolBoxButtonSize GetToolboxButtonSize() const;
329 vcl::ImageType GetImageSize() const;
330
331 void SetAlign( WindowAlign eNewAlign = WindowAlign::Top );
332 WindowAlign GetAlign() const { return meAlign; }
333 bool IsHorizontal() const { return mbHorz; }
334
335 void SetLineCount( ImplToolItems::size_type nNewLines );
336 void ShowLine( bool bNext );
337
338 ImplToolItems::size_type GetItemCount() const;
339 ToolBoxItemType GetItemType( ImplToolItems::size_type nPos ) const;
340 ImplToolItems::size_type GetItemPos( ToolBoxItemId nItemId ) const;
341 ImplToolItems::size_type GetItemPos( const Point& rPos ) const;
342 ToolBoxItemId GetItemId( ImplToolItems::size_type nPos ) const;
343 ToolBoxItemId GetItemId( const Point& rPos ) const;
345 ToolBoxItemId GetItemId( const OUString& rCommand ) const;
346 tools::Rectangle GetItemRect( ToolBoxItemId nItemId );
347 tools::Rectangle GetItemPosRect( ImplToolItems::size_type nPos );
348 tools::Rectangle const & GetOverflowRect() const;
349
351 Size GetItemContentSize( ToolBoxItemId nItemId );
352
353 ToolBoxItemId GetCurItemId() const { return mnCurItemId; }
354 ToolBoxItemId GetDownItemId() const { return mnDownItemId; }
355 sal_uInt16 GetModifier() const { return mnMouseModifier; }
356
357 void SetItemBits( ToolBoxItemId nItemId, ToolBoxItemBits nBits );
358 ToolBoxItemBits GetItemBits( ToolBoxItemId nItemId ) const;
359
360 void SetItemExpand( ToolBoxItemId nItemId, bool bExpand );
361 // e.g. a label used as an itemwindow
362 void SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive);
363
364
365 void SetItemData( ToolBoxItemId nItemId, void* pNewData );
366 void* GetItemData( ToolBoxItemId nItemId ) const;
367 void SetItemImage( ToolBoxItemId nItemId, const Image& rImage );
368 Image GetItemImage( ToolBoxItemId nItemId ) const;
369 void SetItemImageAngle( ToolBoxItemId nItemId, Degree10 nAngle10 );
370 void SetItemImageMirrorMode( ToolBoxItemId nItemId, bool bMirror );
371 void SetItemText( ToolBoxItemId nItemId, const OUString& rText );
372 const OUString& GetItemText( ToolBoxItemId nItemId ) const;
373 void SetItemWindow( ToolBoxItemId nItemId, vcl::Window* pNewWindow );
374 vcl::Window* GetItemWindow( ToolBoxItemId nItemId ) const;
375 ToolBoxItemId GetHighlightItemId() const { return mnHighItemId; }
376
377 void EndSelection();
378
379 void SetItemDown( ToolBoxItemId nItemId, bool bDown );
380
381 void SetItemState( ToolBoxItemId nItemId, TriState eState );
382 TriState GetItemState( ToolBoxItemId nItemId ) const;
383
384 void CheckItem( ToolBoxItemId nItemId, bool bCheck = true );
385 bool IsItemChecked( ToolBoxItemId nItemId ) const;
386
387 void EnableItem( ToolBoxItemId nItemId, bool bEnable = true );
388 bool IsItemEnabled( ToolBoxItemId nItemId ) const;
389
390 void TriggerItem( ToolBoxItemId nItemId );
391
393 void ShowItem(ToolBoxItemId nItemId, bool bVisible = true);
394
396 void HideItem(ToolBoxItemId nItemId) { ShowItem( nItemId, false ); }
397
398 bool IsItemClipped( ToolBoxItemId nItemId ) const;
399 bool IsItemVisible( ToolBoxItemId nItemId ) const;
400 bool IsItemReallyVisible( ToolBoxItemId nItemId ) const;
401
402 void SetItemCommand( ToolBoxItemId nItemId, const OUString& rCommand );
403 OUString GetItemCommand( ToolBoxItemId nItemId ) const;
404
405 using Window::SetQuickHelpText;
406 void SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText );
407 using Window::GetQuickHelpText;
408 OUString GetQuickHelpText( ToolBoxItemId nItemId ) const;
409
410 void SetHelpText( ToolBoxItemId nItemId, const OUString& rText );
411 const OUString& GetHelpText( ToolBoxItemId nItemId ) const;
412
413 void SetHelpId( ToolBoxItemId nItemId, const OString& rHelpId );
414
415 // window size according to current alignment, floating state and number of lines
416 Size CalcWindowSizePixel();
417 // window size according to current alignment, floating state and a given number of lines
418 Size CalcWindowSizePixel( ImplToolItems::size_type nCalcLines );
419 // window size according to current floating state and a given number of lines and a given alignment
420 Size CalcWindowSizePixel( ImplToolItems::size_type nCalcLines, WindowAlign eAlign );
421 // floating window size according to number of lines (uses the number of line breaks)
422 Size CalcFloatingWindowSizePixel();
423 // floating window size with a given number of lines
424 Size CalcFloatingWindowSizePixel( ImplToolItems::size_type nCalcLines );
425 // automatic window size for popup mode
426 Size CalcPopupWindowSizePixel();
427
428 // computes the smallest useful size when docked, ie with the first item visible only (+drag area and menu button)
429 Size CalcMinimumWindowSizePixel();
430
431 ImplToolItems::size_type GetFloatingLines() const;
432
433 void SetStyle( WinBits nNewStyle );
434 WinBits GetStyle() const { return mnWinStyle; }
435
436 // enable/disable undocking
437 void Lock( bool bLock );
438 // read configuration to determine locking behaviour
439 static bool AlwaysLocked();
440
441 void EnableCustomize( bool bEnable = true );
442 bool IsCustomize() const { return mbCustomize; }
443
448
449 void SetClickHdl( const Link<ToolBox *, void>& rLink ) { maClickHdl = rLink; }
450 void SetDoubleClickHdl( const Link<ToolBox *, void>& rLink ) { maDoubleClickHdl = rLink; }
451 void SetDropdownClickHdl( const Link<ToolBox *, void>& rLink );
452 void SetActivateHdl( const Link<ToolBox *, void>& rLink ) { maActivateHdl = rLink; }
453 void SetDeactivateHdl( const Link<ToolBox *, void>& rLink ) { maDeactivateHdl = rLink; }
454 void SetSelectHdl( const Link<ToolBox *, void>& rLink ) { maSelectHdl = rLink; }
455 void SetStateChangedHdl( const Link<StateChangedType const *, void>& aLink ) { maStateChangedHandler = aLink; }
456 void SetDataChangedHdl( const Link<DataChangedEvent const *, void>& aLink ) { maDataChangedHandler = aLink; }
457 void SetMenuButtonHdl( const Link<ToolBox *, void>& rLink ) { maMenuButtonHdl = rLink; }
458
459 // support for custom menu (eg for configuration)
460 // note: this menu will also be used to display currently
461 // clipped toolbox items, so you should only touch
462 // items that you added by yourself
463 // the private toolbox items will only use item ids starting from TOOLBOX_MENUITEM_START
464 // to allow for customization of the menu the corresponding handler is called
465 // when the menu button was clicked and before the menu is executed
466 void SetMenuType( ToolBoxMenuType aType = ToolBoxMenuType::Customize );
467 ToolBoxMenuType GetMenuType() const;
468 bool IsMenuEnabled() const;
469 PopupMenu* GetMenu() const;
470 void UpdateCustomMenu();
471 void SetMenuExecuteHdl( const Link<ToolBox *, void>& rLink );
472
473 // open custommenu
474 void ExecuteCustomMenu( const tools::Rectangle& rRect = tools::Rectangle() );
475
476 // allow Click Handler to distinguish between mouse and key input
477 bool IsKeyEvent() const { return mbIsKeyEvent; }
478
479 // allows framework to set/query the planned popupmode
480 bool WillUsePopupMode() const;
481 void WillUsePopupMode( bool b);
482
483 // accessibility helpers
484
485 // gets the displayed text
486 OUString GetDisplayText() const override;
487 // returns the bounding box for the character at index nIndex
488 // where nIndex is relative to the starting index of the item
489 // with id nItemId (in coordinates of the displaying window)
490 tools::Rectangle GetCharacterBounds( ToolBoxItemId nItemId, tools::Long nIndex );
491 // -1 is returned if no character is at that point
492 // if an index is found the corresponding item id is filled in (else 0)
493 tools::Long GetIndexForPoint( const Point& rPoint, ToolBoxItemId& rItemID );
494
495 static Size GetDefaultImageSize(ToolBoxButtonSize eToolBoxButtonSize);
496 Size GetDefaultImageSize() const;
497 void ChangeHighlight( ImplToolItems::size_type nPos );
498
499
500 void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
501
502 void SetToolBoxTextPosition( ToolBoxTextPosition ePosition );
503
504 void SetLineSpacing(bool b) { mbLineSpacing = b; }
505
506 virtual void DumpAsPropertyTree(tools::JsonWriter&) override;
507};
508
509inline void ToolBox::CheckItem( ToolBoxItemId nItemId, bool bCheck )
510{
511 SetItemState( nItemId, bCheck ? TRISTATE_TRUE : TRISTATE_FALSE );
512}
513
514inline bool ToolBox::IsItemChecked( ToolBoxItemId nItemId ) const
515{
516 return (GetItemState( nItemId ) == TRISTATE_TRUE);
517}
518
520{
522}
523
524inline ToolBox::ImplToolItems::size_type ToolBox::GetFloatingLines() const
525{
526 return mnFloatLines;
527}
528
529#endif // INCLUDED_VCL_TOOLBOX_HXX
530
531/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: dockwin.cxx:686
virtual void Resizing(Size &rSize)
Definition: dockwin.cxx:643
virtual void StateChanged(StateChangedType nType) override
Definition: dockwin.cxx:662
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: dockwin.cxx:313
virtual Size GetOptimalSize() const override
Definition: dockwin.cxx:1017
virtual void StartDocking()
Definition: dockwin.cxx:583
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: dockwin.cxx:525
virtual void EndDocking(const tools::Rectangle &rRect, bool bFloatMode)
Definition: dockwin.cxx:593
virtual bool Docking(const Point &rPos, tools::Rectangle &rRect)
Definition: dockwin.cxx:588
DockingWindow & operator=(const DockingWindow &)=delete
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: dockwin.cxx:410
SAL_DLLPRIVATE void ImplInitSettings()
Definition: dockwin.cxx:328
virtual void ToggleFloatingMode()
Definition: dockwin.cxx:639
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout) override
Definition: dockwin.cxx:1034
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: dockwin.cxx:395
virtual void doDeferredInit(WinBits nBits)
Definition: dockwin.cxx:363
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
Definition: image.hxx:40
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:171
Definition: timer.hxx:27
A toolbar: contains all those icons, typically below the menu bar.
Definition: toolbox.hxx:74
ToolBoxItemId GetDownItemId() const
Definition: toolbox.hxx:354
bool mbUpper
Definition: toolbox.hxx:130
bool mbLastFloatMode
Definition: toolbox.hxx:138
ToolBoxItemId GetHighlightItemId() const
Definition: toolbox.hxx:375
ImplToolItems::size_type mnCurLine
Definition: toolbox.hxx:123
ToolBoxItemId mnCurItemId
Definition: toolbox.hxx:119
void SetSelectHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:454
bool mbIsArranged
Definition: toolbox.hxx:144
ImplToolItems::size_type mnCurPos
Definition: toolbox.hxx:121
void SetDataChangedHdl(const Link< DataChangedEvent const *, void > &aLink)
Definition: toolbox.hxx:456
void SetDeactivateHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:453
void SetLineSpacing(bool b)
Definition: toolbox.hxx:504
WindowAlign meDockAlign
Definition: toolbox.hxx:146
bool IsItemChecked(ToolBoxItemId nItemId) const
Definition: toolbox.hxx:514
tools::Long mnBottomBorder
Definition: toolbox.hxx:114
DECL_DLLPRIVATE_LINK(ImplDropdownLongClickHdl, Timer *, void)
ImplToolItems::size_type mnVisLines
Definition: toolbox.hxx:125
DECL_DLLPRIVATE_LINK(ImplUpdateHdl, Timer *, void)
tools::Long mnWinHeight
Definition: toolbox.hxx:110
Link< StateChangedType const *, void > maStateChangedHandler
Definition: toolbox.hxx:158
ImplToolItems::size_type mnDockLines
Definition: toolbox.hxx:127
Link< ToolBox *, void > maDeactivateHdl
Definition: toolbox.hxx:155
tools::Rectangle maUpperRect
Definition: toolbox.hxx:102
bool mbDrag
Definition: toolbox.hxx:129
bool mbCustomize
Definition: toolbox.hxx:139
ImplToolItems::size_type mnCurLines
Definition: toolbox.hxx:124
ButtonType meButtonType
Definition: toolbox.hxx:147
SAL_DLLPRIVATE ImplToolBoxPrivateData * ImplGetToolBoxPrivateData() const
Definition: toolbox.hxx:250
std::vector< ImplToolSize > maFloatSizes
Definition: toolbox.hxx:100
void SetDoubleClickHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:450
bool mbCalc
Definition: toolbox.hxx:133
tools::Long mnActivateCount
Definition: toolbox.hxx:116
std::unique_ptr< Idle > mpIdle
Definition: toolbox.hxx:101
Size CalcWindowSizePixel()
Definition: toolbox.hxx:519
std::vector< ImplToolItem > ImplToolItems
Definition: toolbox.hxx:79
void SetCurItemId(ToolBoxItemId CurID)
Definition: toolbox.hxx:83
tools::Long mnDY
Definition: toolbox.hxx:107
PointerStyle meLastStyle
Definition: toolbox.hxx:148
Link< ToolBox *, void > maDoubleClickHdl
Definition: toolbox.hxx:153
void CheckItem(ToolBoxItemId nItemId, bool bCheck=true)
Definition: toolbox.hxx:509
ToolBoxLayoutMode meLayoutMode
Definition: toolbox.hxx:150
Link< ToolBox *, void > maActivateHdl
Definition: toolbox.hxx:154
DECL_DLLPRIVATE_LINK(ImplCustomMenuListener, VclMenuEvent &, void)
WinBits mnWinStyle
Definition: toolbox.hxx:149
bool mbIn
Definition: toolbox.hxx:132
VclPtr< FloatingWindow > mpFloatWin
Definition: toolbox.hxx:105
ImplToolItems::size_type mnLines
Definition: toolbox.hxx:122
tools::Long mnRightBorder
Definition: toolbox.hxx:113
void SetStateChangedHdl(const Link< StateChangedType const *, void > &aLink)
Definition: toolbox.hxx:455
ImplToolItems::size_type mnFloatLines
Definition: toolbox.hxx:126
tools::Rectangle maPaintRect
Definition: toolbox.hxx:104
bool mbLineSpacing
Definition: toolbox.hxx:143
Link< ToolBox *, void > maMenuButtonHdl
Definition: toolbox.hxx:157
ToolBoxItemId mnDownItemId
Definition: toolbox.hxx:120
tools::Long mnLeftBorder
Definition: toolbox.hxx:111
void SetItemState(ToolBoxItemId nItemId, TriState eState)
Definition: toolbox2.cxx:1143
bool mbChangingHighlight
Definition: toolbox.hxx:142
ToolBoxItemId GetCurItemId() const
Definition: toolbox.hxx:353
void SetActivateHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:452
tools::Long mnLastResizeDY
Definition: toolbox.hxx:115
void HideItem(ToolBoxItemId nItemId)
Convenience method to hide items (via ShowItem).
Definition: toolbox.hxx:396
WindowAlign meAlign
Definition: toolbox.hxx:145
bool mbIsKeyEvent
Definition: toolbox.hxx:141
TriState GetItemState(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1203
bool mbFullPaint
Definition: toolbox.hxx:135
tools::Long mnMaxItemHeight
Definition: toolbox.hxx:109
std::unique_ptr< ImplToolBoxPrivateData > mpData
Definition: toolbox.hxx:99
bool mbFormat
Definition: toolbox.hxx:134
Link< ToolBox *, void > maSelectHdl
Definition: toolbox.hxx:156
void SetClickHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:449
bool mbDragging
Definition: toolbox.hxx:140
bool IsHorizontal() const
Definition: toolbox.hxx:333
sal_uInt16 mnMouseModifier
Definition: toolbox.hxx:128
Link< ToolBox *, void > maClickHdl
Definition: toolbox.hxx:152
ToolBoxTextPosition meTextPosition
Definition: toolbox.hxx:151
ImplToolItems::size_type GetFloatingLines() const
Definition: toolbox.hxx:524
tools::Long mnMaxItemWidth
Definition: toolbox.hxx:108
ToolBox(const ToolBox &)=delete
tools::Long mnTopBorder
Definition: toolbox.hxx:112
ButtonType GetButtonType() const
Definition: toolbox.hxx:324
ToolBoxItemId mnHighItemId
Definition: toolbox.hxx:118
bool IsKeyEvent() const
Definition: toolbox.hxx:477
bool mbLower
Definition: toolbox.hxx:131
tools::Rectangle maLowerRect
Definition: toolbox.hxx:103
bool mbHorz
Definition: toolbox.hxx:136
void SetMenuButtonHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox.hxx:457
bool IsCustomize() const
Definition: toolbox.hxx:442
ToolBoxItemId mnLastFocusItemId
Definition: toolbox.hxx:117
WindowAlign GetAlign() const
Definition: toolbox.hxx:332
bool mbScroll
Definition: toolbox.hxx:137
WinBits GetStyle() const
Definition: toolbox.hxx:434
Link< DataChangedEvent const *, void > maDataChangedHandler
Definition: toolbox.hxx:159
tools::Long mnDX
Definition: toolbox.hxx:106
sal_uInt16 GetModifier() const
Definition: toolbox.hxx:355
void SetStyle(WinBits nStyle)
Definition: window.cxx:1966
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1873
void SetHelpText(const OUString &rHelpText)
Definition: window2.cxx:1251
virtual void Resize()
Definition: window.cxx:1839
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1927
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:420
SAL_DLLPRIVATE void ImplInvalidate(const vcl::Region *rRegion, InvalidateFlags nFlags)
Definition: paint.cxx:780
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:427
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1809
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
const OString & GetHelpId() const
Definition: window2.cxx:854
virtual OUString GetDisplayText() const
Definition: window.cxx:3068
void SetHelpId(const OString &)
Definition: window2.cxx:849
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3365
virtual void Deactivate()
Definition: window.cxx:1843
virtual void LoseFocus()
Definition: window.cxx:1859
virtual void ApplySettings(vcl::RenderContext &rRenderContext)
Definition: window.cxx:3851
virtual void Activate()
Definition: window.cxx:1841
void SetQuickHelpText(const OUString &rHelpText)
Definition: window2.cxx:1257
const OUString & GetQuickHelpText() const
Definition: window2.cxx:1263
const OUString & GetHelpText() const
Definition: window.cxx:3097
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3942
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
TriState
TRISTATE_FALSE
TRISTATE_TRUE
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
std::vector< SvtDynMenuEntry > GetMenu(EDynamicMenuType eMenu)
void Clear(EHistoryType eHistory)
NONE
long Long
ImageType
Definition: vclenum.hxx:287
PointerStyle
Definition: ptrstyle.hxx:26
static void ImplCalcBorder(WindowAlign eAlign, tools::Long &rLeft, tools::Long &rTop, tools::Long &rRight, tools::Long &rBottom)
Definition: splitwin.cxx:140
tools::Long mnWidth
Definition: toolbox.hxx:94
tools::Long mnHeight
Definition: toolbox.hxx:95
ImplToolItems::size_type mnLines
Definition: toolbox.hxx:96
APPEND
constexpr sal_uInt16 TOOLBOX_MENUITEM_START
Definition: toolbox.hxx:46
ToolBoxTextPosition
Definition: toolbox.hxx:68
ToolBoxLayoutMode
Definition: toolbox.hxx:60
ToolBoxMenuType
Definition: toolbox.hxx:49
Right
ToolBoxButtonSize
Definition: vclenum.hxx:274
ToolBoxItemType
Definition: vclenum.hxx:69
ToolBoxItemBits
Definition: vclenum.hxx:51
ButtonType
Definition: vclenum.hxx:71
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowAlign
Definition: wintypes.hxx:232