LibreOffice Module vcl (master) 1
toolbox2.cxx
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#include <sal/config.h>
21#include <utility>
22#include <vcl/uitest/logger.hxx>
23#include <sal/log.hxx>
24
25#include <comphelper/base64.hxx>
27#include <boost/property_tree/ptree.hpp>
28
29#include <vcl/cvtgrf.hxx>
30#include <vcl/svapp.hxx>
31#include <vcl/idle.hxx>
32#include <vcl/bitmap.hxx>
34#include <vcl/toolbox.hxx>
35#include <vcl/mnemonic.hxx>
36#include <vcl/menu.hxx>
37#include <vcl/settings.hxx>
38#include <vcl/IconThemeInfo.hxx>
40
41#include <svdata.hxx>
42#include <brdwin.hxx>
43#include <toolbox.h>
44
46#include <tools/json_writer.hxx>
47
49
51
52using namespace vcl;
53
54#define TB_SEP_SIZE 8 // Separator size
55
56
58{
61
66
67 mbIsLocked = false;
68 mbNativeButtons = false;
69 mbIsPaintLocked = false;
70 mbAssumeDocked = false;
71 mbAssumePopupMode = false;
72 mbAssumeFloating = false;
73 mbKeyInputDisabled = false;
76 mbWillUsePopupMode = false;
78}
79
81{
82 m_pLayoutData.reset();
84}
85
87 bool bEmptyBtn)
88{
89 mnId = nItemId;
90 mpWindow = nullptr;
92 mpUserData = nullptr;
94 mnBits = nItemBits;
96 mbEnabled = true;
97 mbVisible = true;
98 mbEmptyBtn = bEmptyBtn;
99 mbShowWindow = false;
100 mbBreak = false;
103 mnImageAngle = 0_deg10;
104 mbMirrorMode = false;
105 mbVisibleText = false;
106 mbExpand = false;
107}
108
110{
112}
113
115 ToolBoxItemBits nItemBits ) :
116 maImage(std::move( aImage ))
117{
118 init(nItemId, nItemBits, false);
119}
120
122 OUString aCommand, ToolBoxItemBits nItemBits ) :
123 maText(std::move( aText )),
124 maCommandStr(std::move( aCommand ))
125{
126 init(nItemId, nItemBits, false);
127}
128
130 OUString aText, ToolBoxItemBits nItemBits ) :
131 maImage(std::move( aImage )),
132 maText(std::move( aText ))
133{
134 init(nItemId, nItemBits, false);
135}
136
137Size ImplToolItem::GetSize( bool bHorz, bool bCheckMaxWidth, tools::Long maxWidth, const Size& rDefaultSize )
138{
139 Size aSize( rDefaultSize ); // the size of 'standard' toolbox items
140 // non-standard items are eg windows or buttons with text
141
143 {
144 aSize = maItemSize;
145
146 if ( mpWindow && bHorz )
147 {
148 // get size of item window and check if it fits
149 // no windows in vertical toolbars (the default is mbShowWindow=false)
150 Size aWinSize = mpWindow->GetSizePixel();
151
153 // Window wants no label? Then don't check width, it'll be just
154 // clipped.
155 bCheckMaxWidth = false;
156
157 if ( !bCheckMaxWidth || (aWinSize.Width() <= maxWidth) )
158 {
159 aSize.setWidth( aWinSize.Width() );
160 aSize.setHeight( aWinSize.Height() );
161 mbShowWindow = true;
162 }
163 else
164 {
165 if ( mbEmptyBtn )
166 {
167 aSize.setWidth( 0 );
168 aSize.setHeight( 0 );
169 }
170 }
171 }
172 }
174 {
175 if ( bHorz )
176 {
177 aSize.setWidth( mnSepSize );
178 aSize.setHeight( rDefaultSize.Height() );
179 }
180 else
181 {
182 aSize.setWidth( rDefaultSize.Width() );
183 aSize.setHeight( mnSepSize );
184 }
185 }
186 else if ( meType == ToolBoxItemType::BREAK )
187 {
188 aSize.setWidth( 0 );
189 aSize.setHeight( 0 );
190 }
191
192 return aSize;
193}
194
195void ImplToolItem::DetermineButtonDrawStyle( ButtonType eButtonType, bool& rbImage, bool& rbText ) const
196{
198 {
199 // no button -> draw nothing
200 rbImage = rbText = false;
201 return;
202 }
203
204 bool bHasImage;
205 bool bHasText;
206
207 // check for image and/or text
208 bHasImage = !!maImage;
209 bHasText = !maText.isEmpty();
210
211 // prefer images if symbolonly buttons are drawn
212 // prefer texts if textonly buttons are drawn
213
214 if ( eButtonType == ButtonType::SYMBOLONLY ) // drawing icons only
215 {
216 if( bHasImage || !bHasText )
217 {
218 rbImage = true;
219 rbText = false;
220 }
221 else
222 {
223 rbImage = false;
224 rbText = true;
225 }
226 }
227 else if ( eButtonType == ButtonType::TEXT ) // drawing text only
228 {
229 if( bHasText || !bHasImage )
230 {
231 rbImage = false;
232 rbText = true;
233 }
234 else
235 {
236 rbImage = true;
237 rbText = false;
238 }
239 }
240 else // drawing icons and text both
241 {
242 rbImage = true;
243 rbText = true;
244 }
245}
246
248{
249 tools::Rectangle aRect;
251 {
252 aRect = maRect;
253 if( mbVisibleText && !bHorz )
254 // item will be rotated -> place dropdown to the bottom
255 aRect.SetTop( aRect.Bottom() - mnDropDownArrowWidth );
256 else
257 // place dropdown to the right
258 aRect.SetLeft( aRect.Right() - mnDropDownArrowWidth );
259 }
260 return aRect;
261}
262
264{
266}
267
269{
270 return ( meType == ToolBoxItemType::BUTTON && !mbVisible );
271}
272
273void ToolBox::ImplInvalidate( bool bNewCalc, bool bFullPaint )
274{
276
277 if ( bNewCalc )
278 mbCalc = true;
279
280 if ( bFullPaint )
281 {
282 mbFormat = true;
283
284 // do we need to redraw?
285 if ( IsReallyVisible() && IsUpdateMode() )
286 {
289 mpIdle->Stop();
290 }
291 }
292 else
293 {
294 if ( !mbFormat )
295 {
296 mbFormat = true;
297
298 // do we need to redraw?
299 if ( IsReallyVisible() && IsUpdateMode() )
300 mpIdle->Start();
301 }
302 }
303
304 // request new layout by layoutmanager
306}
307
308void ToolBox::ImplUpdateItem( ImplToolItems::size_type nIndex )
309{
310 // do we need to redraw?
311 if ( !(IsReallyVisible() && IsUpdateMode()) )
312 return;
313
314 if ( nIndex == ITEM_NOTFOUND )
315 {
316 // #i52217# no immediate draw as this might lead to paint problems
318 }
319 else
320 {
321 if ( !mbFormat )
322 {
323 // #i52217# no immediate draw as this might lead to paint problems
324 Invalidate( mpData->m_aItems[nIndex].maRect );
325 }
326 else
327 maPaintRect.Union( mpData->m_aItems[nIndex].maRect );
328 }
329}
330
332{
334 maClickHdl.Call( this );
336}
337
339{
341 maDoubleClickHdl.Call( this );
342}
343
345{
348 maActivateHdl.Call( this );
349}
350
352{
355 maDeactivateHdl.Call( this );
356}
357
359{
361}
362
364{
366}
367
369{
370 VclPtr<vcl::Window> xWindow = this;
371
373 maSelectHdl.Call( this );
374
375 if ( xWindow->isDisposed() )
376 return;
377
378 // TODO: GetFloatingWindow in DockingWindow is currently inline, change it to check dockingwrapper
380 if( pWrapper && pWrapper->GetFloatingWindow() && static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->IsInPopupMode() )
381 static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->EndPopupMode();
382}
383
384void ToolBox::InsertItem( ToolBoxItemId nItemId, const Image& rImage, ToolBoxItemBits nBits, ImplToolItems::size_type nPos )
385{
386 SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" );
387 SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl",
388 "ToolBox::InsertItem(): ItemId already exists" );
389
390 // create item and add to list
391 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
392 ImplToolItem( nItemId, rImage, nBits ) );
393 mpData->ImplClearLayoutData();
394
395 ImplInvalidate( true );
396
397 // Notify
398 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
399 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >(nNewPos ) );
400}
401
402void ToolBox::InsertItem( ToolBoxItemId nItemId, const Image& rImage, const OUString& rText, ToolBoxItemBits nBits,
403 ImplToolItems::size_type nPos )
404{
405 SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" );
406 SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl",
407 "ToolBox::InsertItem(): ItemId already exists" );
408
409 // create item and add to list
410 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
411 ImplToolItem( nItemId, rImage, MnemonicGenerator::EraseAllMnemonicChars(rText), nBits ) );
412 mpData->ImplClearLayoutData();
413
414 ImplInvalidate( true );
415
416 // Notify
417 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
418 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
419}
420
421void ToolBox::InsertItem( ToolBoxItemId nItemId, const OUString& rText, const OUString& rCommand, ToolBoxItemBits nBits,
422 ImplToolItems::size_type nPos )
423{
424 SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertItem(): ItemId == 0" );
425 SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl",
426 "ToolBox::InsertItem(): ItemId already exists" );
427
428 // create item and add to list
429 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
430 ImplToolItem( nItemId, MnemonicGenerator::EraseAllMnemonicChars(rText), rCommand, nBits ) );
431 mpData->ImplClearLayoutData();
432
433 ImplInvalidate( true );
434
435 // Notify
436 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
437 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
438}
439
440void ToolBox::InsertItem(const OUString& rCommand, const css::uno::Reference<css::frame::XFrame>& rFrame, ToolBoxItemBits nBits,
441 const Size& rRequestedSize, ImplToolItems::size_type nPos)
442{
443 OUString aModuleName(vcl::CommandInfoProvider::GetModuleIdentifier(rFrame));
446 OUString aTooltip(vcl::CommandInfoProvider::GetTooltipForCommand(rCommand, aProperties, rFrame));
448
449 ToolBoxItemId nItemId(GetItemCount() + 1);
450 //TODO: ImplToolItems::size_type -> sal_uInt16!
451 InsertItem(nItemId, aLabel, rCommand, nBits, nPos);
452 SetItemImage(nItemId, aImage);
453 SetQuickHelpText(nItemId, aTooltip);
454
455 // set the minimal size
456 ImplToolItem* pItem = ImplGetItem( nItemId );
457 if ( pItem )
458 pItem->maMinimalItemSize = rRequestedSize;
459}
460
462 ToolBoxItemBits nBits, ImplToolItems::size_type nPos )
463{
464 SAL_WARN_IF( !nItemId, "vcl", "ToolBox::InsertWindow(): ItemId == 0" );
465 SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl",
466 "ToolBox::InsertWindow(): ItemId already exists" );
467
468 // create item and add to list
469 ImplToolItem aItem;
470 aItem.mnId = nItemId;
472 aItem.mnBits = nBits;
473 aItem.mpWindow = pWindow;
474 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem );
475 mpData->ImplClearLayoutData();
476
477 if ( pWindow )
478 pWindow->Hide();
479
480 ImplInvalidate( true );
481
482 // Notify
483 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
484 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
485}
486
488{
489 // create item and add to list
490 ImplToolItem aItem;
492 aItem.mbEnabled = false;
493 mpData->m_aItems.push_back( aItem );
494 mpData->ImplClearLayoutData();
495
497
498 // Notify
499 ImplToolItems::size_type nNewPos = mpData->m_aItems.size() - 1;
500 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
501}
502
503void ToolBox::InsertSeparator( ImplToolItems::size_type nPos, sal_uInt16 nPixSize )
504{
505 // create item and add to list
506 ImplToolItem aItem;
508 aItem.mbEnabled = false;
509 if ( nPixSize )
510 aItem.mnSepSize = nPixSize;
511 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem );
512 mpData->ImplClearLayoutData();
513
515
516 // Notify
517 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
518 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
519}
520
521void ToolBox::InsertBreak( ImplToolItems::size_type nPos )
522{
523 // create item and add to list
524 ImplToolItem aItem;
526 aItem.mbEnabled = false;
527 mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem );
528 mpData->ImplClearLayoutData();
529
531
532 // Notify
533 ImplToolItems::size_type nNewPos = ( nPos == APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos;
534 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos ) );
535}
536
537void ToolBox::RemoveItem( ImplToolItems::size_type nPos )
538{
539 if( nPos >= mpData->m_aItems.size() )
540 return;
541
542 bool bMustCalc;
543 bMustCalc = mpData->m_aItems[nPos].meType == ToolBoxItemType::BUTTON;
544
545 if ( mpData->m_aItems[nPos].mpWindow )
546 mpData->m_aItems[nPos].mpWindow->Hide();
547
548 // add the removed item to PaintRect
549 maPaintRect.Union( mpData->m_aItems[nPos].maRect );
550
551 // ensure not to delete in the Select-Handler
552 if ( mpData->m_aItems[nPos].mnId == mnCurItemId )
554 if ( mpData->m_aItems[nPos].mnId == mnHighItemId )
556
557 ImplInvalidate( bMustCalc );
558
559 mpData->m_aItems.erase( mpData->m_aItems.begin()+nPos );
560 mpData->ImplClearLayoutData();
561
562 // Notify
563 CallEventListeners( VclEventId::ToolboxItemRemoved, reinterpret_cast< void* >( nPos ) );
564}
565
566void ToolBox::CopyItem( const ToolBox& rToolBox, ToolBoxItemId nItemId )
567{
568 SAL_WARN_IF( GetItemPos( nItemId ) != ITEM_NOTFOUND, "vcl",
569 "ToolBox::CopyItem(): ItemId already exists" );
570
571 ImplToolItems::size_type nPos = rToolBox.GetItemPos( nItemId );
572
573 // found item
574 if ( nPos == ITEM_NOTFOUND )
575 return;
576
577 // push ToolBox item onto the list
578 ImplToolItem aNewItem = rToolBox.mpData->m_aItems[nPos];
579 // reset state
580 aNewItem.mpWindow = nullptr;
581 aNewItem.mbShowWindow = false;
582
583 mpData->m_aItems.push_back( aNewItem );
584 mpData->ImplClearLayoutData();
585 // redraw ToolBox
587
588 // Notify
589 ImplToolItems::size_type nNewPos2 = mpData->m_aItems.size() - 1;
590 CallEventListeners( VclEventId::ToolboxItemAdded, reinterpret_cast< void* >( nNewPos2 ) );
591}
592
594{
595 mpData->m_aItems.clear();
596 mpData->ImplClearLayoutData();
597
598 // ensure not to delete in the Select-Handler
601
602 ImplInvalidate( true, true );
603
604 // Notify
606}
607
609{
610 if ( meButtonType != eNewType )
611 {
612 meButtonType = eNewType;
613
614 // better redraw everything, as otherwise there might be problems
615 // with regions that were copied with CopyBits
616 ImplInvalidate( true );
617 }
618}
619
621{
622 if( mpData->meButtonSize != eSize )
623 {
624 mpData->meButtonSize = eSize;
625 mbCalc = true;
626 mbFormat = true;
627 }
628}
629
631{
632 return mpData->meButtonSize;
633}
634
636{
637 ImageType eImageType = ImageType::Size16;
638 if (mpData->meButtonSize == ToolBoxButtonSize::Large)
639 eImageType = ImageType::Size26;
640 else if (mpData->meButtonSize == ToolBoxButtonSize::Size32)
641 eImageType = ImageType::Size32;
642
643 return eImageType;
644}
645
647{
649 float fScaleFactor = pDefault ? pDefault->GetDPIScaleFactor() : 1.0;
650
651 Size aUnscaledSize(16, 16);
652
653 if (eToolBoxButtonSize == ToolBoxButtonSize::Large)
654 {
656 aUnscaledSize = vcl::IconThemeInfo::SizeByThemeName(iconTheme);
657 }
658 else if (eToolBoxButtonSize == ToolBoxButtonSize::Size32)
659 {
660 aUnscaledSize = Size(32, 32);
661 }
662 return Size(aUnscaledSize.Width() * fScaleFactor,
663 aUnscaledSize.Height() * fScaleFactor);
664}
665
667{
669}
670
672{
673 if ( meAlign == eNewAlign )
674 return;
675
676 meAlign = eNewAlign;
677
678 if ( ImplIsFloatingMode() )
679 return;
680
681 // set horizontal/vertical alignment
682 if ( (eNewAlign == WindowAlign::Left) || (eNewAlign == WindowAlign::Right) )
683 mbHorz = false;
684 else
685 mbHorz = true;
686
687 // Update the background according to Persona if necessary
688 ImplInitSettings( false, false, true );
689
690 // redraw everything, as the border has changed
691 mbCalc = true;
692 mbFormat = true;
693 if ( IsReallyVisible() && IsUpdateMode() )
694 Invalidate();
695}
696
697void ToolBox::SetLineCount( ImplToolItems::size_type nNewLines )
698{
699 if ( !nNewLines )
700 nNewLines = 1;
701
702 if ( mnLines != nNewLines )
703 {
704 mnLines = nNewLines;
705
706 // better redraw everything, as otherwise there might be problems
707 // with regions that were copied with CopyBits
708 Invalidate();
709 }
710}
711
712ToolBox::ImplToolItems::size_type ToolBox::GetItemCount() const
713{
714 return mpData ? mpData->m_aItems.size() : 0;
715}
716
717ToolBoxItemType ToolBox::GetItemType( ImplToolItems::size_type nPos ) const
718{
719 return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].meType : ToolBoxItemType::DONTKNOW;
720}
721
722ToolBox::ImplToolItems::size_type ToolBox::GetItemPos( ToolBoxItemId nItemId ) const
723{
724 if (mpData)
725 {
726 ImplToolItems::size_type nCount = mpData->m_aItems.size();
727 for( ImplToolItems::size_type nPos = 0; nPos < nCount; nPos++ )
728 if( mpData->m_aItems[nPos].mnId == nItemId )
729 return nPos;
730 }
731 return ITEM_NOTFOUND;
732}
733
734ToolBox::ImplToolItems::size_type ToolBox::GetItemPos( const Point& rPos ) const
735{
736 // search the item position on the given point
737 auto it = std::find_if(mpData->m_aItems.begin(), mpData->m_aItems.end(),
738 [&rPos](const ImplToolItem& rItem) { return rItem.maRect.Contains( rPos ); });
739
740 if( it != mpData->m_aItems.end() )
741 return std::distance(mpData->m_aItems.begin(), it);
742
743 return ITEM_NOTFOUND;
744}
745
746ToolBoxItemId ToolBox::GetItemId( ImplToolItems::size_type nPos ) const
747{
748 return (nPos < mpData->m_aItems.size()) ? mpData->m_aItems[nPos].mnId : ToolBoxItemId(0);
749}
750
752{
753 // find item that was clicked
754 auto it = std::find_if(mpData->m_aItems.begin(), mpData->m_aItems.end(),
755 [&rPos](const ImplToolItem& rItem) { return rItem.maRect.Contains( rPos ); });
756
757 if( (it != mpData->m_aItems.end()) && (it->meType == ToolBoxItemType::BUTTON) )
758 return it->mnId;
759
760 return ToolBoxItemId(0);
761}
762
764{
765 if ( mbCalc || mbFormat )
766 ImplFormat();
767
768 ImplToolItems::size_type nPos = GetItemPos( nItemId );
769 if ( nPos < mpData->m_aItems.size() )
770 return mpData->m_aItems[nPos].maContentSize;
771 else
772 return Size();
773}
774
775ToolBoxItemId ToolBox::GetItemId(const OUString &rCommand) const
776{
777 if (!mpData)
778 return ToolBoxItemId(0);
779
780 auto it = std::find_if(mpData->m_aItems.begin(), mpData->m_aItems.end(),
781 [&rCommand](const ImplToolItem& rItem) { return rItem.maCommandStr == rCommand; });
782 if (it != mpData->m_aItems.end())
783 return it->mnId;
784
785 return ToolBoxItemId(0);
786}
787
789{
790 Point aPos;
791 if( !rRect.IsEmpty() )
792 {
794
795 // the popup should be positioned so that it will not cover
796 // the item rect and that it fits the desktop
797 // the preferred direction is always towards the center of
798 // the application window
799
800 Point devPos; // the position in device coordinates for screen comparison
801 switch( meAlign )
802 {
803 case WindowAlign::Top:
804 aPos = rRect.BottomLeft();
805 aPos.AdjustY( 1 );
806 devPos = OutputToAbsoluteScreenPixel( aPos );
807 if( devPos.Y() >= aScreen.Bottom() )
808 aPos.setY( rRect.Top() );
809 break;
811 aPos = rRect.TopLeft();
812 aPos.AdjustY( -1 );
813 devPos = OutputToAbsoluteScreenPixel( aPos );
814 if( devPos.Y() <= aScreen.Top() )
815 aPos.setY( rRect.Bottom() );
816 break;
818 aPos = rRect.TopRight();
819 aPos.AdjustX( 1 );
820 devPos = OutputToAbsoluteScreenPixel( aPos );
821 if( devPos.X() >= aScreen.Right() )
822 aPos.setX( rRect.Left() );
823 break;
825 aPos = rRect.TopLeft();
826 aPos.AdjustX( -1 );
827 devPos = OutputToAbsoluteScreenPixel( aPos );
828 if( devPos.X() <= aScreen.Left() )
829 aPos.setX( rRect.Right() );
830 break;
831 default:
832 break;
833 }
834 }
835 return aPos;
836}
837
839{
840 if ( mbCalc || mbFormat )
841 ImplFormat();
842
843 ImplToolItems::size_type nPos = GetItemPos( nItemId );
844 return GetItemPosRect( nPos );
845}
846
847tools::Rectangle ToolBox::GetItemPosRect( ImplToolItems::size_type nPos )
848{
849 if ( mbCalc || mbFormat )
850 ImplFormat();
851
852 if ( nPos < mpData->m_aItems.size() )
853 return mpData->m_aItems[nPos].maRect;
854 else
855 return tools::Rectangle();
856}
857
859{
860 return mpData->maMenubuttonItem.maRect;
861}
862
864{
865 // check if the borderwindow (i.e. the decoration) provides the menu button
866 bool bRet = false;
867 if( ImplIsFloatingMode() )
868 {
869 // custom menu is placed in the decoration
870 ImplBorderWindow *pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( GetWindowType::Border ) );
871 if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() )
872 bRet = true;
873 }
874 return bRet;
875}
876
878{
879 ImplToolItems::size_type nPos = GetItemPos( nItemId );
880
881 if ( nPos < GetItemCount() )
882 {
883 ToolBoxItemBits nOldBits = mpData->m_aItems[nPos].mnBits;
884 mpData->m_aItems[nPos].mnBits = nBits;
887 // trigger reformat when the item width has changed (dropdown arrow)
889 if ( nBits != nOldBits )
890 ImplInvalidate( true, bFormat );
891 }
892}
893
894void ToolBox::SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive)
895{
896 ImplToolItems::size_type nPos = GetItemPos( nItemId );
897
898 if ( nPos < GetItemCount() )
899 {
900 mpData->m_aItems[nPos].mbNonInteractiveWindow = bNonInteractive;
901 }
902}
903
905{
906 ImplToolItem* pItem = ImplGetItem( nItemId );
907
908 if ( pItem )
909 return pItem->mnBits;
910 else
912}
913
914void ToolBox::SetItemExpand( ToolBoxItemId nItemId, bool bExpand )
915{
916 ImplToolItem* pItem = ImplGetItem( nItemId );
917 if (!pItem)
918 return;
919
920 if (pItem->mbExpand != bExpand)
921 {
922 pItem->mbExpand = bExpand;
923 ImplInvalidate(true, true);
924 }
925}
926
927void ToolBox::SetItemData( ToolBoxItemId nItemId, void* pNewData )
928{
929 ImplToolItems::size_type nPos = GetItemPos( nItemId );
930
931 if ( nPos < mpData->m_aItems.size() )
932 {
933 mpData->m_aItems[nPos].mpUserData = pNewData;
935 }
936}
937
939{
940 ImplToolItem* pItem = ImplGetItem( nItemId );
941
942 if ( pItem )
943 return pItem->mpUserData;
944 else
945 return nullptr;
946}
947
948static Image ImplMirrorImage( const Image& rImage )
949{
950 BitmapEx aMirrBitmapEx( rImage.GetBitmapEx() );
951
952 aMirrBitmapEx.Mirror( BmpMirrorFlags::Horizontal );
953
954 return Image( aMirrBitmapEx );
955}
956
957static Image ImplRotImage( const Image& rImage, Degree10 nAngle10 )
958{
959 BitmapEx aRotBitmapEx( rImage.GetBitmapEx() );
960
961 aRotBitmapEx.Rotate( nAngle10, COL_WHITE );
962
963 return Image( aRotBitmapEx );
964}
965
966void ToolBox::SetItemImage( ToolBoxItemId nItemId, const Image& rImage )
967{
968 ImplToolItems::size_type nPos = GetItemPos( nItemId );
969
970 if ( nPos == ITEM_NOTFOUND )
971 return;
972
973 ImplToolItem* pItem = &mpData->m_aItems[nPos];
974 Size aOldSize = pItem->maImage.GetSizePixel();
975
976 pItem->maImage = pItem->mbMirrorMode ? ImplMirrorImage(rImage) : rImage;
977 if (pItem->mnImageAngle != 0_deg10)
978 pItem->maImage = ImplRotImage(pItem->maImage, pItem->mnImageAngle);
979
980 // only once all is calculated, do extra work
981 if (!mbCalc)
982 {
983 if (aOldSize != pItem->maImage.GetSizePixel())
984 ImplInvalidate( true );
985 else
987 }
988}
989
991{
992 ImplToolItems::size_type nPos = GetItemPos( nItemId );
993
994 if ( nPos == ITEM_NOTFOUND )
995 return;
996
997 ImplToolItem* pItem = &mpData->m_aItems[nPos];
998 pItem->mnImageAngle = nAngle10;
999}
1000
1002{
1003 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1004
1005 if ( nPos == ITEM_NOTFOUND )
1006 return;
1007
1008 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1009 pItem->mbMirrorMode = bMirror;
1010}
1011
1013{
1014 ImplToolItem* pItem = ImplGetItem(nItemId);
1015 return pItem ? pItem->maImage : Image();
1016}
1017
1018void ToolBox::SetItemText( ToolBoxItemId nItemId, const OUString& rText )
1019{
1020 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1021
1022 if ( nPos == ITEM_NOTFOUND )
1023 return;
1024
1025 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1026 // only once all is calculated, do extra work
1027 if ( !mbCalc &&
1028 ((meButtonType != ButtonType::SYMBOLONLY) || !pItem->maImage) )
1029 {
1030 tools::Long nOldWidth = GetOutDev()->GetCtrlTextWidth( pItem->maText );
1032 mpData->ImplClearLayoutData();
1033 if ( nOldWidth != GetOutDev()->GetCtrlTextWidth( pItem->maText ) )
1034 ImplInvalidate( true );
1035 else
1037 }
1038 else
1040
1041 // Notify button changed event to prepare accessibility bridge
1042 CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
1043
1044 // Notify
1045 CallEventListeners( VclEventId::ToolboxItemTextChanged, reinterpret_cast< void* >( nPos ) );
1046}
1047
1048const OUString& ToolBox::GetItemText( ToolBoxItemId nItemId ) const
1049{
1050
1051 ImplToolItem* pItem = ImplGetItem( nItemId );
1052
1053 assert( pItem );
1054
1055 return pItem->maText;
1056}
1057
1059{
1060 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1061
1062 if ( nPos != ITEM_NOTFOUND )
1063 {
1064 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1065 pItem->mpWindow = pNewWindow;
1066 if ( pNewWindow )
1067 pNewWindow->Hide();
1068 ImplInvalidate( true );
1069 CallEventListeners( VclEventId::ToolboxItemWindowChanged, reinterpret_cast< void* >( nPos ) );
1070 }
1071}
1072
1074{
1075 ImplToolItem* pItem = ImplGetItem( nItemId );
1076
1077 if ( pItem )
1078 return pItem->mpWindow;
1079 else
1080 return nullptr;
1081}
1082
1084{
1085 if ( mbDrag )
1086 {
1087 // reset
1088 mbDrag = false;
1089 if (mnCurPos != ITEM_NOTFOUND)
1091 EndTracking();
1092 if (IsMouseCaptured())
1093 ReleaseMouse();
1094 Deactivate();
1095 }
1096
1100 mnMouseModifier = 0;
1101}
1102
1103void ToolBox::SetItemDown( ToolBoxItemId nItemId, bool bDown )
1104{
1105 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1106
1107 if ( nPos == ITEM_NOTFOUND )
1108 return;
1109
1110 if ( bDown )
1111 {
1112 if ( nPos != mnCurPos )
1113 {
1114 mnCurPos = nPos;
1116 GetOutDev()->Flush();
1117 }
1118 }
1119 else
1120 {
1121 if ( nPos == mnCurPos )
1122 {
1124 GetOutDev()->Flush();
1126 }
1127 }
1128
1129 if ( mbDrag )
1130 {
1131 mbDrag = false;
1132 EndTracking();
1133 if (IsMouseCaptured())
1134 ReleaseMouse();
1135 Deactivate();
1136 }
1137
1140 mnMouseModifier = 0;
1141}
1142
1144{
1145 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1146
1147 if ( nPos == ITEM_NOTFOUND )
1148 return;
1149
1150 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1151
1152 // the state has changed
1153 if ( pItem->meState == eState )
1154 return;
1155
1156 // if RadioCheck, un-check the previous
1157 if ( (eState == TRISTATE_TRUE) && (pItem->mnBits & ToolBoxItemBits::AUTOCHECK) &&
1159 {
1160 ImplToolItem* pGroupItem;
1161 ImplToolItems::size_type nGroupPos;
1162 ImplToolItems::size_type nItemCount = GetItemCount();
1163
1164 nGroupPos = nPos;
1165 while ( nGroupPos )
1166 {
1167 pGroupItem = &mpData->m_aItems[nGroupPos-1];
1168 if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
1169 {
1170 if ( pGroupItem->meState != TRISTATE_FALSE )
1171 SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
1172 }
1173 else
1174 break;
1175 nGroupPos--;
1176 }
1177
1178 nGroupPos = nPos+1;
1179 while ( nGroupPos < nItemCount )
1180 {
1181 pGroupItem = &mpData->m_aItems[nGroupPos];
1182 if ( pGroupItem->mnBits & ToolBoxItemBits::RADIOCHECK )
1183 {
1184 if ( pGroupItem->meState != TRISTATE_FALSE )
1185 SetItemState( pGroupItem->mnId, TRISTATE_FALSE );
1186 }
1187 else
1188 break;
1189 nGroupPos++;
1190 }
1191 }
1192
1193 pItem->meState = eState;
1195
1196 // Notify button changed event to prepare accessibility bridge
1197 CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
1198
1199 // Call accessible listener to notify state_changed event
1200 CallEventListeners( VclEventId::ToolboxItemUpdated, reinterpret_cast< void* >(nPos) );
1201}
1202
1204{
1205 ImplToolItem* pItem = ImplGetItem( nItemId );
1206
1207 if ( pItem )
1208 return pItem->meState;
1209 else
1210 return TRISTATE_FALSE;
1211}
1212
1213void ToolBox::EnableItem( ToolBoxItemId nItemId, bool bEnable )
1214{
1215 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1216
1217 if ( nPos == ITEM_NOTFOUND )
1218 return;
1219
1220 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1221 if ( pItem->mbEnabled == bEnable )
1222 return;
1223
1224 pItem->mbEnabled = bEnable;
1225
1226 // if existing, also redraw the window
1227 if ( pItem->mpWindow )
1228 pItem->mpWindow->Enable( pItem->mbEnabled );
1229
1230 // update item
1232
1234
1235 // Notify button changed event to prepare accessibility bridge
1236 CallEventListeners( VclEventId::ToolboxButtonStateChanged, reinterpret_cast< void* >( nPos ) );
1237
1239}
1240
1242{
1243 ImplToolItem* pItem = ImplGetItem( nItemId );
1244
1245 if ( pItem )
1246 return pItem->mbEnabled;
1247 else
1248 return false;
1249}
1250
1251void ToolBox::ShowItem( ToolBoxItemId nItemId, bool bVisible )
1252{
1253 ImplToolItems::size_type nPos = GetItemPos( nItemId );
1254 mpData->ImplClearLayoutData();
1255
1256 if ( nPos != ITEM_NOTFOUND )
1257 {
1258 ImplToolItem* pItem = &mpData->m_aItems[nPos];
1259 if ( pItem->mbVisible != bVisible )
1260 {
1261 pItem->mbVisible = bVisible;
1263 }
1264 }
1265}
1266
1268{
1269 ImplToolItem* pItem = ImplGetItem( nItemId );
1270
1271 if ( pItem )
1272 return pItem->IsClipped();
1273 else
1274 return false;
1275}
1276
1278{
1279 ImplToolItem* pItem = ImplGetItem( nItemId );
1280
1281 if ( pItem )
1282 return pItem->mbVisible;
1283 else
1284 return false;
1285}
1286
1288{
1289 // is the item on the visible area of the toolbox?
1290 bool bRet = false;
1292 ImplToolItem* pItem = ImplGetItem( nItemId );
1293
1294 if ( pItem && pItem->mbVisible &&
1295 !pItem->maRect.IsEmpty() && aRect.Overlaps( pItem->maRect ) )
1296 {
1297 bRet = true;
1298 }
1299
1300 return bRet;
1301}
1302
1303void ToolBox::SetItemCommand(ToolBoxItemId nItemId, const OUString& rCommand)
1304{
1305 ImplToolItem* pItem = ImplGetItem( nItemId );
1306
1307 if (pItem)
1308 pItem->maCommandStr = rCommand;
1309}
1310
1312{
1313 ImplToolItem* pItem = ImplGetItem( nItemId );
1314
1315 if (pItem)
1316 return pItem->maCommandStr;
1317
1318 return OUString();
1319}
1320
1321void ToolBox::SetQuickHelpText( ToolBoxItemId nItemId, const OUString& rText )
1322{
1323 ImplToolItem* pItem = ImplGetItem( nItemId );
1324
1325 if ( pItem )
1326 pItem->maQuickHelpText = rText;
1327}
1328
1330{
1331 ImplToolItem* pItem = ImplGetItem( nItemId );
1332
1333 if ( pItem )
1334 return pItem->maQuickHelpText;
1335 else
1336 return OUString();
1337}
1338
1339void ToolBox::SetHelpText( ToolBoxItemId nItemId, const OUString& rText )
1340{
1341 ImplToolItem* pItem = ImplGetItem( nItemId );
1342
1343 if ( pItem )
1344 pItem->maHelpText = rText;
1345}
1346
1347const OUString& ToolBox::GetHelpText( ToolBoxItemId nItemId ) const
1348{
1349 return ImplGetHelpText( nItemId );
1350}
1351
1352void ToolBox::SetHelpId( ToolBoxItemId nItemId, const OUString& rHelpId )
1353{
1354 ImplToolItem* pItem = ImplGetItem( nItemId );
1355
1356 if ( pItem )
1357 pItem->maHelpId = rHelpId;
1358}
1359
1360// disable key input if all items are disabled
1362{
1363 mpData->mbKeyInputDisabled = std::none_of(mpData->m_aItems.begin(), mpData->m_aItems.end(),
1364 [](const ImplToolItem& rItem) {
1365 // at least one useful entry
1366 return rItem.mbEnabled;
1367 });
1368}
1369
1371{
1372 mpData->m_pLayoutData.emplace();
1373
1374 ImplToolItems::size_type nCount = mpData->m_aItems.size();
1375 for( ImplToolItems::size_type i = 0; i < nCount; i++ )
1376 {
1377 ImplToolItem* pItem = &mpData->m_aItems[i];
1378
1379 // only draw, if the rectangle is within PaintRectangle
1380 if (!pItem->maRect.IsEmpty())
1382 }
1383}
1384
1386{
1387 if( ! mpData->m_pLayoutData )
1388 const_cast<ToolBox *>(this)->ImplFillLayoutData();
1389 return mpData->m_pLayoutData ? mpData->m_pLayoutData->m_aDisplayText : OUString();
1390}
1391
1393{
1394 tools::Long nItemIndex = -1;
1395 if( ! mpData->m_pLayoutData )
1397 if( mpData->m_pLayoutData )
1398 {
1399 for( size_t i = 0; i < mpData->m_pLayoutData->m_aLineItemIds.size(); i++ )
1400 {
1401 if( mpData->m_pLayoutData->m_aLineItemIds[i] == nItemID )
1402 {
1403 nItemIndex = mpData->m_pLayoutData->m_aLineIndices[i];
1404 break;
1405 }
1406 }
1407 }
1408 return (mpData->m_pLayoutData && nItemIndex != -1) ? mpData->m_pLayoutData->GetCharacterBounds( nItemIndex+nIndex ) : tools::Rectangle();
1409}
1410
1412{
1413 tools::Long nIndex = -1;
1414 rItemID = ToolBoxItemId(0);
1415 if( ! mpData->m_pLayoutData )
1417 if( mpData->m_pLayoutData )
1418 {
1419 nIndex = mpData->m_pLayoutData->GetIndexForPoint( rPoint );
1420 for( size_t i = 0; i < mpData->m_pLayoutData->m_aLineIndices.size(); i++ )
1421 {
1422 if( mpData->m_pLayoutData->m_aLineIndices[i] <= nIndex &&
1423 (i == mpData->m_pLayoutData->m_aLineIndices.size()-1 || mpData->m_pLayoutData->m_aLineIndices[i+1] > nIndex) )
1424 {
1425 rItemID = mpData->m_pLayoutData->m_aLineItemIds[i];
1426 break;
1427 }
1428 }
1429 }
1430 return nIndex;
1431}
1432
1434{
1435 if (mpData != nullptr) {
1436 mpData->maDropdownClickHdl = rLink;
1437 }
1438}
1439
1441{
1442 if( aType == mpData->maMenuType )
1443 return;
1444
1445 mpData->maMenuType = aType;
1446 if( IsFloatingMode() )
1447 {
1448 // the menu button may have to be moved into the decoration which changes the layout
1450 if( pWrapper )
1451 pWrapper->ShowMenuTitleButton( bool( aType & ToolBoxMenuType::Customize) );
1452
1453 mbFormat = true;
1454 ImplFormat();
1456 }
1457 else
1458 {
1459 // trigger redraw of menu button
1460 if( !mpData->maMenubuttonItem.maRect.IsEmpty() )
1461 Invalidate(mpData->maMenubuttonItem.maRect);
1462 }
1463}
1464
1466{
1467 return mpData->maMenuType;
1468}
1469
1471{
1472 return mpData->maMenuType != ToolBoxMenuType::NONE;
1473}
1474
1476{
1477 return mpData == nullptr ? nullptr : mpData->mpMenu;
1478}
1479
1481{
1482 mpData->maMenuButtonHdl = rLink;
1483}
1484
1486{
1487 // are any items currently clipped ?
1488 ImplFormat();
1489 return std::any_of(mpData->m_aItems.begin(), mpData->m_aItems.end(),
1490 [](const ImplToolItem& rItem) { return rItem.IsClipped(); });
1491}
1492
1493namespace
1494{
1495 MenuItemBits ConvertBitsFromToolBoxToMenu(ToolBoxItemBits nToolItemBits)
1496 {
1497 MenuItemBits nMenuItemBits = MenuItemBits::NONE;
1498 if ((nToolItemBits & ToolBoxItemBits::CHECKABLE) ||
1499 (nToolItemBits & ToolBoxItemBits::DROPDOWN))
1500 {
1501 nMenuItemBits |= MenuItemBits::CHECKABLE;
1502 }
1503 return nMenuItemBits;
1504 }
1505}
1506
1508{
1509 // fill clipped items into menu
1510 PopupMenu *pMenu = GetMenu();
1511 pMenu->Clear();
1512
1513 // add menu items: first the overflow items, then hidden items, both in the
1514 // order they would usually appear in the toolbar. Separators that would be
1515 // in the toolbar are ignored as they would introduce too much clutter,
1516 // instead we have a single separator to help distinguish between overflow
1517 // and hidden items.
1518 if ( mpData->m_aItems.empty() )
1519 return;
1520
1521 // nStartPos will hold the number of clipped items appended from first loop
1522 for ( const auto& rItem : mpData->m_aItems )
1523 {
1524 if( rItem.IsClipped() )
1525 {
1526 sal_uInt16 id = sal_uInt16(rItem.mnId) + TOOLBOX_MENUITEM_START;
1527 MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
1528 pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits);
1529 pMenu->SetItemCommand( id, rItem.maCommandStr );
1530 pMenu->EnableItem( id, rItem.mbEnabled );
1531 pMenu->CheckItem ( id, rItem.meState == TRISTATE_TRUE );
1532 }
1533 }
1534
1535 // add a separator below the inserted clipped-items
1536 pMenu->InsertSeparator();
1537
1538 // now append the items that are explicitly disabled
1539 for ( const auto& rItem : mpData->m_aItems )
1540 {
1541 if( rItem.IsItemHidden() )
1542 {
1543 sal_uInt16 id = sal_uInt16(rItem.mnId) + TOOLBOX_MENUITEM_START;
1544 MenuItemBits nMenuItemBits = ConvertBitsFromToolBoxToMenu(rItem.mnBits);
1545 pMenu->InsertItem( id, rItem.maText, rItem.maImage, nMenuItemBits );
1546 pMenu->SetItemCommand( id, rItem.maCommandStr );
1547 pMenu->EnableItem( id, rItem.mbEnabled );
1548 pMenu->CheckItem( id, rItem.meState == TRISTATE_TRUE );
1549 }
1550 }
1551}
1552
1553IMPL_LINK( ToolBox, ImplCustomMenuListener, VclMenuEvent&, rEvent, void )
1554{
1555 if( rEvent.GetMenu() == GetMenu() && rEvent.GetId() == VclEventId::MenuSelect )
1556 {
1557 sal_uInt16 id = GetMenu()->GetItemId( rEvent.GetItemPos() );
1558 if( id >= TOOLBOX_MENUITEM_START )
1559 TriggerItem( ToolBoxItemId(id - TOOLBOX_MENUITEM_START) );
1560 }
1561}
1562
1564{
1565 if ( !IsMenuEnabled() || ImplIsInPopupMode() )
1566 return;
1567
1569
1571 // call button handler to allow for menu customization
1572 mpData->maMenuButtonHdl.Call( this );
1573
1574 GetMenu()->AddEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
1575
1576 // make sure all disabled entries will be shown
1578 GetMenu()->GetMenuFlags() | MenuFlags::AlwaysShowDisabledEntries );
1579
1580 // toolbox might be destroyed during execute
1581 bool bBorderDel = false;
1582
1583 VclPtr<vcl::Window> pWin = this;
1584 tools::Rectangle aMenuRect = rRect;
1585 VclPtr<ImplBorderWindow> pBorderWin;
1586 if( aMenuRect.IsEmpty() && IsFloatingMode() )
1587 {
1588 // custom menu is placed in the decoration
1589 pBorderWin = dynamic_cast<ImplBorderWindow*>( GetWindow( GetWindowType::Border ) );
1590 if( pBorderWin && !pBorderWin->GetMenuRect().IsEmpty() )
1591 {
1592 pWin = pBorderWin;
1593 aMenuRect = pBorderWin->GetMenuRect();
1594 bBorderDel = true;
1595 }
1596 }
1597
1598 sal_uInt16 uId = GetMenu()->Execute( pWin, tools::Rectangle( ImplGetPopupPosition( aMenuRect ), Size() ),
1600
1601 if ( pWin->isDisposed() )
1602 return;
1603
1604 if( GetMenu() )
1605 GetMenu()->RemoveEventListener( LINK( this, ToolBox, ImplCustomMenuListener ) );
1606 if( bBorderDel )
1607 {
1608 if( pBorderWin->isDisposed() )
1609 return;
1610 }
1611
1612 pWin->Invalidate( aMenuRect );
1613
1614 if( uId )
1616}
1617
1618// checks override first, useful during calculation of sizes
1620{
1621 SAL_WARN_IF( mpData->mbAssumeDocked && mpData->mbAssumeFloating, "vcl",
1622 "cannot assume docked and floating" );
1623
1624 if( mpData->mbAssumeDocked )
1625 return false;
1626 else if( mpData->mbAssumeFloating )
1627 return true;
1628 else
1629 return IsFloatingMode();
1630}
1631
1632// checks override first, useful during calculation of sizes
1634{
1635 if( mpData->mbAssumePopupMode )
1636 return true;
1637 else
1638 {
1640 return ( pWrapper && pWrapper->GetFloatingWindow() && static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->IsInPopupMode() );
1641 }
1642}
1643
1644void ToolBox::Lock( bool bLock )
1645{
1647 if( !pWrapper )
1648 return;
1649 if( mpData->mbIsLocked != bLock )
1650 {
1651 mpData->mbIsLocked = bLock;
1652 if( !ImplIsFloatingMode() )
1653 {
1654 mbCalc = true;
1655 mbFormat = true;
1657 Invalidate();
1658 }
1659 }
1660}
1661
1663{
1664 // read config item to determine toolbox behaviour, used for subtoolbars
1665
1666 static int nAlwaysLocked = -1;
1667
1668 if( nAlwaysLocked == -1 )
1669 {
1670 nAlwaysLocked = 0; // ask configuration only once
1671
1674 "/org.openoffice.Office.UI.GlobalSettings/Toolbars" ); // note: case sensitive !
1675 if ( aNode.isValid() )
1676 {
1677 // feature enabled ?
1678 bool bStatesEnabled = bool();
1679 css::uno::Any aValue = aNode.getNodeValue( "StatesEnabled" );
1680 if( aValue >>= bStatesEnabled )
1681 {
1682 if( bStatesEnabled )
1683 {
1684 // now read the locking state
1687 "/org.openoffice.Office.UI.GlobalSettings/Toolbars/States" ); // note: case sensitive !
1688
1689 bool bLocked = bool();
1690 css::uno::Any aValue2 = aNode2.getNodeValue( "Locked" );
1691 if( aValue2 >>= bLocked )
1692 nAlwaysLocked = bLocked ? 1 : 0;
1693 }
1694 }
1695 }
1696 }
1697
1698 return nAlwaysLocked == 1;
1699}
1700
1702{
1703 return mpData->mbWillUsePopupMode;
1704}
1705
1707{
1708 mpData->mbWillUsePopupMode = b;
1709}
1710
1712{
1714
1715 auto childrenNode = rJsonWriter.startArray("children");
1716 for (ToolBox::ImplToolItems::size_type i = 0; i < GetItemCount(); ++i)
1717 {
1718 auto childNode = rJsonWriter.startStruct();
1720
1721 vcl::Window* pWindow = GetItemWindow(nId);
1722 if (pWindow)
1723 {
1724 pWindow->DumpAsPropertyTree(rJsonWriter);
1725 }
1726 else
1727 {
1728 OUString sCommand = GetItemCommand(nId);
1729 rJsonWriter.put("type", "toolitem");
1730 rJsonWriter.put("text", GetItemText(nId));
1731 rJsonWriter.put("command", sCommand);
1732 if (IsItemChecked(nId))
1733 rJsonWriter.put("selected", true);
1734 if (!IsItemVisible(nId))
1735 rJsonWriter.put("visible", false);
1737 rJsonWriter.put("dropdown", true);
1738 if (!IsItemEnabled(nId))
1739 rJsonWriter.put("enabled", false);
1740
1741 Image aImage = GetItemImage(nId);
1742 if (!sCommand.startsWith(".uno:") && !!aImage)
1743 {
1744 SvMemoryStream aOStm(6535, 6535);
1746 {
1747 css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell());
1748 OStringBuffer aBuffer("data:image/png;base64,");
1750 rJsonWriter.put("image", aBuffer);
1751 }
1752 }
1753 }
1754 }
1755}
1756
1757/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Text maText
PropertiesInfo aProperties
const StyleSettings & GetStyleSettings() const
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
Definition: svapp.cxx:1043
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:638
bool Rotate(Degree10 nAngle10, const Color &rFillColor)
Rotate bitmap by the specified angle.
Definition: BitmapEx.cxx:325
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
Definition: BitmapEx.cxx:268
ImplDockingWindowWrapper * GetDockingWindowWrapper(const vcl::Window *pWin)
Definition: dockmgr.cxx:280
bool IsFloatingMode() const
Definition: dockwin.cxx:951
bool IsInPopupMode() const
Definition: floatwin.hxx:130
static ErrCode Export(SvStream &rOStm, const Graphic &rGraphic, ConvertDataFormat nFormat)
Definition: cvtgrf.cxx:51
Definition: image.hxx:40
BitmapEx GetBitmapEx() const
Definition: Image.cxx:96
Size GetSizePixel() const
Definition: Image.cxx:88
tools::Rectangle GetMenuRect() const
Definition: brdwin.cxx:1982
ImplDockingWindowWrapper.
void ShowMenuTitleButton(bool bVisible)
Definition: dockmgr.cxx:757
SystemWindow * GetFloatingWindow() const
Definition: dockmgr.cxx:1068
void SetMenuFlags(MenuFlags nFlags)
Definition: menu.hxx:252
void AddEventListener(const Link< VclMenuEvent &, void > &rEventListener)
Definition: menu.cxx:407
void InsertSeparator(const OUString &rIdent={}, sal_uInt16 nPos=MENU_APPEND)
Definition: menu.cxx:472
void Clear()
Definition: menu.cxx:571
void RemoveEventListener(const Link< VclMenuEvent &, void > &rEventListener)
Definition: menu.cxx:412
void CheckItem(sal_uInt16 nItemId, bool bCheck=true)
Definition: menu.cxx:838
void SetItemCommand(sal_uInt16 nItemId, const OUString &rCommand)
Definition: menu.cxx:1054
void EnableItem(sal_uInt16 nItemId, bool bEnable=true)
Definition: menu.cxx:919
void InsertItem(sal_uInt16 nItemId, const OUString &rStr, MenuItemBits nItemBits=MenuItemBits::NONE, const OUString &rIdent={}, sal_uInt16 nPos=MENU_APPEND)
Definition: menu.cxx:432
static OUString EraseAllMnemonicChars(const OUString &rStr)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
tools::Long GetCtrlTextWidth(const OUString &rStr, const SalLayoutGlyphs *pLayoutCache=nullptr) const
Definition: text.cxx:2290
float GetDPIScaleFactor() const
Definition: outdev.hxx:396
virtual void Flush()
Definition: outdev.hxx:429
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
sal_uInt16 Execute(vcl::Window *pWindow, const Point &rPopupPos)
Definition: menu.cxx:2771
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
OUString DetermineIconTheme() const
Determine which icon theme should be used.
const void * GetData()
sal_uInt64 Tell() const
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
A toolbar: contains all those icons, typically below the menu bar.
Definition: toolbox.hxx:74
SAL_DLLPRIVATE bool ImplIsFloatingMode() const
Definition: toolbox2.cxx:1619
ToolBoxItemId GetItemId(ImplToolItems::size_type nPos) const
Definition: toolbox2.cxx:746
ToolBoxItemId mnCurItemId
Definition: toolbox.hxx:119
void InsertBreak(ImplToolItems::size_type nPos=APPEND)
Definition: toolbox2.cxx:521
ToolBoxItemType GetItemType(ImplToolItems::size_type nPos) const
Definition: toolbox2.cxx:717
static bool AlwaysLocked()
Definition: toolbox2.cxx:1662
ImplToolItems::size_type mnCurPos
Definition: toolbox.hxx:121
void RemoveItem(ImplToolItems::size_type nPos)
Definition: toolbox2.cxx:537
virtual void Click()
Definition: toolbox2.cxx:331
bool IsItemChecked(ToolBoxItemId nItemId) const
Definition: toolbox.hxx:514
void SetDropdownClickHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox2.cxx:1433
tools::Long mnBottomBorder
Definition: toolbox.hxx:114
void EndSelection()
Definition: toolbox2.cxx:1083
vcl::ImageType GetImageSize() const
Definition: toolbox2.cxx:635
SAL_DLLPRIVATE void ImplInvalidate(bool bNewCalc=false, bool bFullPaint=false)
Definition: toolbox2.cxx:273
void SetQuickHelpText(ToolBoxItemId nItemId, const OUString &rText)
Definition: toolbox2.cxx:1321
Size GetDefaultImageSize() const
Definition: toolbox2.cxx:666
SAL_DLLPRIVATE bool ImplHasExternalMenubutton() const
Definition: toolbox2.cxx:863
void InsertWindow(ToolBoxItemId nItemId, vcl::Window *pWindow, ToolBoxItemBits nBits=ToolBoxItemBits::NONE, ImplToolItems::size_type nPos=APPEND)
Definition: toolbox2.cxx:461
Link< ToolBox *, void > maDeactivateHdl
Definition: toolbox.hxx:155
virtual void Activate() override
Definition: toolbox2.cxx:344
bool WillUsePopupMode() const
Definition: toolbox2.cxx:1701
void SetItemDown(ToolBoxItemId nItemId, bool bDown)
Definition: toolbox2.cxx:1103
bool mbDrag
Definition: toolbox.hxx:129
OUString GetItemCommand(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1311
ButtonType meButtonType
Definition: toolbox.hxx:147
tools::Rectangle GetCharacterBounds(ToolBoxItemId nItemId, tools::Long nIndex)
Definition: toolbox2.cxx:1392
bool IsItemEnabled(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1241
void InsertSeparator(ImplToolItems::size_type nPos=APPEND, sal_uInt16 nPixSize=0)
Definition: toolbox2.cxx:503
ToolBoxMenuType GetMenuType() const
Definition: toolbox2.cxx:1465
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
SAL_DLLPRIVATE void ImplFillLayoutData()
Definition: toolbox2.cxx:1370
tools::Long GetIndexForPoint(const Point &rPoint, ToolBoxItemId &rItemID)
Definition: toolbox2.cxx:1411
void SetItemImageAngle(ToolBoxItemId nItemId, Degree10 nAngle10)
Definition: toolbox2.cxx:990
tools::Long mnDY
Definition: toolbox.hxx:107
void EnableItem(ToolBoxItemId nItemId, bool bEnable=true)
Definition: toolbox2.cxx:1213
Link< ToolBox *, void > maDoubleClickHdl
Definition: toolbox.hxx:153
SAL_DLLPRIVATE void InvalidateItem(ImplToolItems::size_type nPosition)
Definition: toolbox.cxx:3396
bool IsItemVisible(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1277
OUString GetDisplayText() const override
Definition: toolbox2.cxx:1385
Link< ToolBox *, void > maActivateHdl
Definition: toolbox.hxx:154
SAL_DLLPRIVATE bool ImplHasClippedItems()
Definition: toolbox2.cxx:1485
void SetItemImageMirrorMode(ToolBoxItemId nItemId, bool bMirror)
Definition: toolbox2.cxx:1001
void SetHelpText(ToolBoxItemId nItemId, const OUString &rText)
Definition: toolbox2.cxx:1339
void * GetItemData(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:938
bool IsItemReallyVisible(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1287
ImplToolItems::size_type GetItemCount() const
Definition: toolbox2.cxx:712
ImplToolItems::size_type mnLines
Definition: toolbox.hxx:122
tools::Long mnRightBorder
Definition: toolbox.hxx:113
void ShowItem(ToolBoxItemId nItemId, bool bVisible=true)
Shows or hides items.
Definition: toolbox2.cxx:1251
virtual void Deactivate() override
Definition: toolbox2.cxx:351
void SetItemExpand(ToolBoxItemId nItemId, bool bExpand)
Definition: toolbox2.cxx:914
Image GetItemImage(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1012
tools::Rectangle maPaintRect
Definition: toolbox.hxx:104
static constexpr auto APPEND
Definition: toolbox.hxx:86
virtual FactoryFunction GetUITestFactory() const override
Definition: toolbox2.cxx:363
ToolBoxItemId mnDownItemId
Definition: toolbox.hxx:120
void SetItemWindow(ToolBoxItemId nItemId, vcl::Window *pNewWindow)
Definition: toolbox2.cxx:1058
tools::Long mnLeftBorder
Definition: toolbox.hxx:111
void SetItemState(ToolBoxItemId nItemId, TriState eState)
Definition: toolbox2.cxx:1143
void Lock(bool bLock)
Definition: toolbox2.cxx:1644
void ExecuteCustomMenu(const tools::Rectangle &rRect=tools::Rectangle())
Definition: toolbox2.cxx:1563
void CopyItem(const ToolBox &rToolBox, ToolBoxItemId nItemId)
Definition: toolbox2.cxx:566
void SetLineCount(ImplToolItems::size_type nNewLines)
Definition: toolbox2.cxx:697
void SetItemData(ToolBoxItemId nItemId, void *pNewData)
Definition: toolbox2.cxx:927
SAL_DLLPRIVATE bool ImplIsInPopupMode() const
Definition: toolbox2.cxx:1633
void SetItemCommand(ToolBoxItemId nItemId, const OUString &rCommand)
Definition: toolbox2.cxx:1303
SAL_DLLPRIVATE Point ImplGetPopupPosition(const tools::Rectangle &rRect) const
Definition: toolbox2.cxx:788
SAL_DLLPRIVATE void ImplUpdateInputEnable()
Definition: toolbox2.cxx:1361
virtual void InsertItem(const OUString &rCommand, const css::uno::Reference< css::frame::XFrame > &rFrame, ToolBoxItemBits nBits, const Size &rRequestedSize, ImplToolItems::size_type nPos=APPEND)
Insert a command (like '.uno:Save').
Definition: toolbox2.cxx:440
SAL_DLLPRIVATE ImplToolItem * ImplGetItem(ToolBoxItemId nId) const
Definition: toolbox.cxx:1325
void SetHelpId(ToolBoxItemId nItemId, const OUString &rHelpId)
Definition: toolbox2.cxx:1352
void DoubleClick()
Definition: toolbox2.cxx:338
WindowAlign meAlign
Definition: toolbox.hxx:145
tools::Rectangle GetItemPosRect(ImplToolItems::size_type nPos)
Definition: toolbox2.cxx:847
void SetButtonType(ButtonType eNewType)
Definition: toolbox2.cxx:608
void Highlight()
Definition: toolbox2.cxx:358
bool IsItemClipped(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1267
TriState GetItemState(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1203
bool IsMenuEnabled() const
Definition: toolbox2.cxx:1470
tools::Rectangle GetItemRect(ToolBoxItemId nItemId)
Definition: toolbox2.cxx:838
SAL_DLLPRIVATE const OUString & ImplGetHelpText(ToolBoxItemId nItemId) const
Definition: toolbox.cxx:3592
std::unique_ptr< ImplToolBoxPrivateData > mpData
Definition: toolbox.hxx:99
bool mbFormat
Definition: toolbox.hxx:134
void SetMenuExecuteHdl(const Link< ToolBox *, void > &rLink)
Definition: toolbox2.cxx:1480
Link< ToolBox *, void > maSelectHdl
Definition: toolbox.hxx:156
SAL_DLLPRIVATE void ImplInitSettings()
Definition: dockwin.cxx:328
sal_uInt16 mnMouseModifier
Definition: toolbox.hxx:128
Link< ToolBox *, void > maClickHdl
Definition: toolbox.hxx:152
virtual void Select()
Definition: toolbox2.cxx:368
void Clear()
Definition: toolbox2.cxx:593
void SetMenuType(ToolBoxMenuType aType=ToolBoxMenuType::Customize)
Definition: toolbox2.cxx:1440
ToolBoxButtonSize GetToolboxButtonSize() const
Definition: toolbox2.cxx:630
tools::Long mnTopBorder
Definition: toolbox.hxx:112
ToolBoxItemId mnHighItemId
Definition: toolbox.hxx:118
SAL_DLLPRIVATE void ImplUpdateItem(ImplToolItems::size_type nIndex=ITEM_NOTFOUND)
Definition: toolbox2.cxx:308
SAL_DLLPRIVATE void ImplFormat(bool bResize=false)
Definition: toolbox.cxx:1887
static constexpr auto ITEM_NOTFOUND
Definition: toolbox.hxx:89
void SetAlign(WindowAlign eNewAlign=WindowAlign::Top)
Definition: toolbox2.cxx:671
PopupMenu * GetMenu() const
Definition: toolbox2.cxx:1475
void SetItemText(ToolBoxItemId nItemId, const OUString &rText)
Definition: toolbox2.cxx:1018
void SetItemImage(ToolBoxItemId nItemId, const Image &rImage)
Definition: toolbox2.cxx:966
tools::Rectangle const & GetOverflowRect() const
Definition: toolbox2.cxx:858
Size GetItemContentSize(ToolBoxItemId nItemId)
Returns size of the bitmap / text that is inside this toolbox item.
Definition: toolbox2.cxx:763
bool mbHorz
Definition: toolbox.hxx:136
void SetToolboxButtonSize(ToolBoxButtonSize eSize)
Definition: toolbox2.cxx:620
void InsertSpace()
Definition: toolbox2.cxx:487
vcl::Window * GetItemWindow(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1073
void SetItemWindowNonInteractive(ToolBoxItemId nItemId, bool bNonInteractive)
Definition: toolbox2.cxx:894
const OUString & GetItemText(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:1048
void UpdateCustomMenu()
Definition: toolbox2.cxx:1507
ImplToolItems::size_type GetItemPos(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:722
tools::Long mnDX
Definition: toolbox.hxx:106
virtual void DumpAsPropertyTree(tools::JsonWriter &) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: toolbox2.cxx:1711
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
Definition: toolbox2.cxx:904
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
Definition: toolbox2.cxx:877
SAL_DLLPRIVATE void ImplSetMinMaxFloatSize()
Definition: toolbox.cxx:859
void logAction(VclPtr< Control > const &xUIElement, VclEventId nEvent)
Definition: logger.cxx:147
static UITestLogger & getInstance()
Definition: logger.cxx:611
void disposeAndClear()
Definition: vclptr.hxx:200
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
bool isDisposed() const
static void encode(OUStringBuffer &aStrBuffer, const css::uno::Sequence< sal_Int8 > &aPass)
void put(std::u16string_view pPropName, const OUString &rPropValue)
ScopedJsonWriterStruct startStruct()
ScopedJsonWriterArray startArray(std::string_view)
constexpr void SetLeft(tools::Long v)
bool Overlaps(const tools::Rectangle &rRect) const
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr tools::Long Right() const
constexpr Point TopRight() const
tools::Rectangle & Union(const tools::Rectangle &rRect)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
constexpr bool IsEmpty() const
constexpr Point BottomLeft() const
css::uno::Any getNodeValue(const OUString &_rPath) const noexcept
static OConfigurationTreeRoot tryCreateWithComponentContext(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
static Size SizeByThemeName(std::u16string_view)
Obtain the icon size by theme name.
bool IsReallyVisible() const
Definition: window2.cxx:1133
bool IsMouseCaptured() const
Definition: mouse.cxx:481
tools::Rectangle GetDesktopRectPixel() const
Definition: window.cxx:2799
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:293
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1036
bool IsUpdateMode() const
Definition: window2.cxx:1199
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2433
void GrabFocusToDocument()
Definition: window.cxx:2986
WinBits GetStyle() const
Definition: window2.cxx:979
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
void Hide()
Definition: window.hxx:879
void ReleaseMouse()
Definition: mouse.cxx:469
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON.
Definition: window.cxx:3356
virtual Size GetSizePixel() const
Definition: window.cxx:2402
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2855
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: event.cxx:219
const OUString & GetQuickHelpText() const
Definition: window2.cxx:1258
const OUString & GetHelpText() const
Definition: window.cxx:3090
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
int nCount
ItemID nItemID
#define ERRCODE_NONE
TriState
TRISTATE_FALSE
TRISTATE_TRUE
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
sal_Int32 nIndex
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
@ AlwaysShowDisabledEntries
std::vector< SvtDynMenuEntry > GetMenu(EDynamicMenuType eMenu)
Reference< XComponentContext > getProcessComponentContext()
int i
long Long
Sequence< beans::PropertyValue > GetCommandProperties(const OUString &rsCommandName, const OUString &rsModuleName)
Return a label for the given command.
OUString GetTooltipForCommand(const OUString &rsCommandName, const css::uno::Sequence< css::beans::PropertyValue > &rProperties, const Reference< frame::XFrame > &rxFrame)
OUString GetModuleIdentifier(const Reference< frame::XFrame > &rxFrame)
Image GetImageForCommand(const OUString &rsCommandName, const Reference< frame::XFrame > &rxFrame, vcl::ImageType eImageType)
OUString GetLabelForCommand(const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Return a label for the given command.
ImageType
Definition: vclenum.hxx:280
sal_Int16 nId
tools::Long mnMenuButtonWidth
Definition: toolbox.h:140
ToolBoxButtonSize meButtonSize
Definition: toolbox.h:129
VclPtr< PopupMenu > mpMenu
Definition: toolbox.h:132
bool mbMenubuttonWasLastSelected
Definition: toolbox.h:151
ToolBoxMenuType maMenuType
Definition: toolbox.h:133
ImplToolItem maMenubuttonItem
Definition: toolbox.h:139
std::optional< vcl::ToolBoxLayoutData > m_pLayoutData
Definition: toolbox.h:116
OUString maCommandStr
Definition: toolbox.h:46
ToolBoxItemBits mnBits
Definition: toolbox.h:59
void init(ToolBoxItemId nItemId, ToolBoxItemBits nItemBits, bool bEmptyBtn)
Definition: toolbox2.cxx:86
tools::Rectangle maRect
Definition: toolbox.h:48
bool mbExpand
Definition: toolbox.h:68
bool mbShowWindow
Definition: toolbox.h:65
bool mbEnabled
Definition: toolbox.h:62
ToolBoxItemId mnId
Definition: toolbox.h:61
OUString maText
Definition: toolbox.h:43
tools::Long mnDropDownArrowWidth
Definition: toolbox.h:55
Size maMinimalItemSize
Widget layout may request size; set it as the minimal size (like, the item will always have at least ...
Definition: toolbox.h:51
ToolBoxItemType meType
Definition: toolbox.h:58
Size GetSize(bool bHorz, bool bCheckMaxWidth, tools::Long maxWidth, const Size &rDefaultSize)
Definition: toolbox2.cxx:137
tools::Rectangle GetDropDownRect(bool bHorz) const
Definition: toolbox2.cxx:247
bool mbVisibleText
Definition: toolbox.h:67
bool mbBreak
Definition: toolbox.h:66
bool IsItemHidden() const
Definition: toolbox2.cxx:268
VclPtr< vcl::Window > mpWindow
Definition: toolbox.h:37
Degree10 mnImageAngle
Definition: toolbox.h:41
Size maItemSize
The overall horizontal item size, including one or more of [image size + textlength + dropdown arrow]...
Definition: toolbox.h:53
OUString maQuickHelpText
Definition: toolbox.h:44
bool mbVisible
Definition: toolbox.h:63
tools::Long mnSepSize
Definition: toolbox.h:54
bool mbMirrorMode
Definition: toolbox.h:42
TriState meState
Definition: toolbox.h:60
bool IsClipped() const
Definition: toolbox2.cxx:263
void * mpUserData
Definition: toolbox.h:39
bool mbEmptyBtn
Definition: toolbox.h:64
void DetermineButtonDrawStyle(ButtonType eButtonType, bool &rbImage, bool &rbText) const
Definition: toolbox2.cxx:195
OUString maHelpText
Definition: toolbox.h:45
OUString maHelpId
Definition: toolbox.h:47
Image maImage
Definition: toolbox.h:40
bool mbNonInteractiveWindow
Definition: toolbox.h:38
DockingManager * ImplGetDockingManager()
Definition: svdata.cxx:316
bool bVisible
OUString aCommand
static Image ImplMirrorImage(const Image &rImage)
Definition: toolbox2.cxx:948
IMPL_LINK(ToolBox, ImplCustomMenuListener, VclMenuEvent &, rEvent, void)
Definition: toolbox2.cxx:1553
#define TB_SEP_SIZE
Definition: toolbox2.cxx:54
static Image ImplRotImage(const Image &rImage, Degree10 nAngle10)
Definition: toolbox2.cxx:957
#define TB_DROPDOWNARROWWIDTH
Definition: toolbox.h:28
#define TB_MENUBUTTON_SIZE
Definition: toolbox.h:30
#define TB_MENUBUTTON_OFFSET
Definition: toolbox.h:31
constexpr sal_uInt16 TOOLBOX_MENUITEM_START
Definition: toolbox.hxx:46
ToolBoxMenuType
Definition: toolbox.hxx:49
o3tl::strong_int< sal_uInt16, struct ToolBoxItemIdTag > ToolBoxItemId
Definition: toolboxid.hxx:14
signed char sal_Int8
OUString aLabel
MenuItemBits
Definition: vclenum.hxx:33
ToolBoxButtonSize
Definition: vclenum.hxx:267
ToolBoxItemType
Definition: vclenum.hxx:69
ToolBoxItemBits
Definition: vclenum.hxx:51
ButtonType
Definition: vclenum.hxx:71
@ ToolboxItemUpdated
@ ToolboxItemEnabled
@ ToolboxFormatChanged
@ ToolboxItemWindowChanged
@ ToolboxItemRemoved
@ ToolboxDoubleClick
@ ToolboxButtonStateChanged
@ ToolboxItemTextChanged
@ ToolboxItemDisabled
@ ToolboxAllItemsChanged
WinBits const WB_NOLABEL
Definition: wintypes.hxx:157
WindowAlign
Definition: wintypes.hxx:232
std::unique_ptr< char[]> aBuffer