LibreOffice Module svtools (master) 1
valueset.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
22#include <o3tl/safeint.hxx>
25#include <tools/debug.hxx>
26#include <vcl/canvastools.hxx>
27#include <vcl/decoview.hxx>
28#include <vcl/event.hxx>
29#include <vcl/svapp.hxx>
30#include <vcl/settings.hxx>
31#include <vcl/virdev.hxx>
32
33#include <com/sun/star/accessibility/AccessibleEventId.hpp>
34#include <com/sun/star/lang/XComponent.hpp>
35#include <rtl/ustring.hxx>
36#include <sal/log.hxx>
37#include "valueimp.hxx"
38
39#include <svtools/valueset.hxx>
40
41#include <uiobject.hxx>
42#include <vcl/uitest/logger.hxx>
44
45using namespace css::uno;
46using namespace css::lang;
47using namespace css::accessibility;
48
49namespace
50{
51void collectUIInformation( const OUString& aID , const OUString& aParentID , const OUString& aPos )
52{
53 EventDescription aDescription;
54 aDescription.aID = aID ;
55 aDescription.aParameters = {{"POS", aPos }};
56 aDescription.aAction = "SELECT";
57 aDescription.aKeyWord = "ValueSet";
58 aDescription.aParent = aParentID;
59 UITestLogger::getInstance().logEvent(aDescription);
60}
61
62enum
63{
64 ITEM_OFFSET = 4,
65 ITEM_OFFSET_DOUBLE = 6,
66 NAME_LINE_OFF_X = 2,
67 NAME_LINE_OFF_Y = 2,
68 NAME_LINE_HEIGHT = 2,
69 NAME_OFFSET = 2,
70};
71
72}
73
74ValueSet::ValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
75 : maVirDev( VclPtr<VirtualDevice>::Create())
76 , mxScrolledWindow(std::move(pScrolledWindow))
77 , mnHighItemId(0)
79 , mnStyle(0)
80 , mbFormat(true)
81 , mbHighlight(false)
82{
83 mnItemWidth = 0;
84 mnItemHeight = 0;
85 mnTextOffset = 0;
86 mnVisLines = 0;
87 mnLines = 0;
90 mnFirstLine = 0;
91 mnSelItemId = 0;
92 mnSavedItemId = -1;
93 mnCols = 0;
94 mnCurCol = 0;
95 mnUserCols = 0;
97 mnSpacing = 0;
98 mnFrameStyle = DrawFrameStyle::NONE;
99 mbNoSelection = true;
100 mbDoubleSel = false;
101 mbScroll = false;
102 mbFullMode = true;
103 mbEdgeBlending = false;
104 mbHasVisibleItems = false;
105
107 mxScrolledWindow->connect_vadjustment_changed(LINK(this, ValueSet, ImplScrollHdl));
108}
109
111{
112 CustomWidgetController::SetDrawingArea(pDrawingArea);
113 // #106446#, #106601# force mirroring of virtual device
114 maVirDev->EnableRTL(pDrawingArea->get_direction());
115}
116
117Reference<XAccessible> ValueSet::CreateAccessible()
118{
119 if (!mxAccessible)
120 mxAccessible.set(new ValueSetAcc(this));
121 return mxAccessible;
122}
123
125{
126 Reference<XComponent> xComponent(mxAccessible, UNO_QUERY);
127 if (xComponent.is())
128 xComponent->dispose();
129
131}
132
134{
135 const size_t n = mItemList.size();
136
137 for ( size_t i = 0; i < n; ++i )
138 {
139 ValueSetItem* pItem = mItemList[i].get();
140 if ( pItem->mbVisible && ImplHasAccessibleListeners() )
141 {
142 Any aOldAny;
143 Any aNewAny;
144
145 aOldAny <<= pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ );
146 ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, aNewAny);
147 }
148
149 mItemList[i].reset();
150 }
151
152 mItemList.clear();
153}
154
156{
157 collectUIInformation(GetDrawingArea()->get_buildable_name() , GetDrawingArea()->get_help_id() , OUString::number(GetSelectedItemId()));
158 maSelectHdl.Call( this );
159}
160
162{
163}
164
165size_t ValueSet::ImplGetItem( const Point& rPos ) const
166{
168 {
170 }
171
173 {
175 }
176
177 if (maItemListRect.Contains(rPos))
178 {
179 const int xc = rPos.X() - maItemListRect.Left();
180 const int yc = rPos.Y() - maItemListRect.Top();
181 // The point is inside the area of item list,
182 // let's find the containing item.
183 const int col = xc / (mnItemWidth + mnSpacing);
184 const int x = xc % (mnItemWidth + mnSpacing);
185 const int row = yc / (mnItemHeight + mnSpacing);
186 const int y = yc % (mnItemHeight + mnSpacing);
187
188 if (x < mnItemWidth && y < mnItemHeight)
189 {
190 // the point is inside item rect and not inside spacing
191 const size_t item = (mnFirstLine + row) * static_cast<size_t>(mnCols) + col;
192 if (item < mItemList.size())
193 {
194 return item;
195 }
196 }
197 }
198
200}
201
203{
205 return mpNoneItem.get();
206 else
207 return (nPos < mItemList.size()) ? mItemList[nPos].get() : nullptr;
208}
209
211{
212 return !mItemList.empty() ? mItemList[0].get() : nullptr;
213}
214
216{
217 sal_uInt16 nRet = 0;
218 const size_t nItemCount = mItemList.size();
219
220 for ( size_t n = 0; n < nItemCount; ++n )
221 {
222 if ( mItemList[n]->mbVisible )
223 ++nRet;
224 }
225
226 return nRet;
227}
228
229void ValueSet::ImplFireAccessibleEvent( short nEventId, const Any& rOldValue, const Any& rNewValue )
230{
232
233 if( pAcc )
234 pAcc->FireAccessibleEvent( nEventId, rOldValue, rNewValue );
235}
236
238{
240 return( pAcc && pAcc->HasAccessibleListeners() );
241}
242
243IMPL_LINK(ValueSet, ImplScrollHdl, weld::ScrolledWindow&, rScrollWin, void)
244{
245 auto nNewFirstLine = rScrollWin.vadjustment_get_value();
246 if ( nNewFirstLine != mnFirstLine )
247 {
248 mnFirstLine = nNewFirstLine;
249 mbFormat = true;
250 Invalidate();
251 }
252}
253
255{
256 rRenderContext.SetBackground(Application::GetSettings().GetStyleSettings().GetFaceColor());
257 rRenderContext.Erase();
258 ImplDraw(rRenderContext);
259}
260
262{
263 SAL_INFO("svtools", "value set getting focus");
264 Invalidate();
265 CustomWidgetController::GetFocus();
266
267 // Tell the accessible object that we got the focus.
269 if (pAcc)
270 pAcc->GetFocus();
271}
272
274{
275 SAL_INFO("svtools", "value set losing focus");
276 Invalidate();
277 CustomWidgetController::LoseFocus();
278
279 // Tell the accessible object that we lost the focus.
281 if( pAcc )
282 pAcc->LoseFocus();
283}
284
286{
287 mbFormat = true;
288 if ( IsReallyVisible() && IsUpdateMode() )
289 Invalidate();
290 CustomWidgetController::Resize();
291}
292
293bool ValueSet::KeyInput( const KeyEvent& rKeyEvent )
294{
295 size_t nLastItem = mItemList.size();
296
297 if ( !nLastItem || !ImplGetFirstItem() )
298 return CustomWidgetController::KeyInput(rKeyEvent);
299
300 if (mbFormat)
301 Invalidate();
302
303 --nLastItem;
304
305 const size_t nCurPos
307 size_t nItemPos = VALUESET_ITEM_NOTFOUND;
308 size_t nVStep = mnCols;
309
310 switch (rKeyEvent.GetKeyCode().GetCode())
311 {
312 case KEY_HOME:
313 nItemPos = mpNoneItem ? VALUESET_ITEM_NONEITEM : 0;
314 break;
315
316 case KEY_END:
317 nItemPos = nLastItem;
318 break;
319
320 case KEY_LEFT:
321 if (nCurPos != VALUESET_ITEM_NONEITEM)
322 {
323 if (nCurPos)
324 {
325 nItemPos = nCurPos-1;
326 }
327 else if (mpNoneItem)
328 {
329 nItemPos = VALUESET_ITEM_NONEITEM;
330 }
331 }
332 break;
333
334 case KEY_RIGHT:
335 if (nCurPos < nLastItem)
336 {
337 if (nCurPos == VALUESET_ITEM_NONEITEM)
338 {
339 nItemPos = 0;
340 }
341 else
342 {
343 nItemPos = nCurPos+1;
344 }
345 }
346 break;
347
348 case KEY_PAGEUP:
349 if (rKeyEvent.GetKeyCode().IsShift() || rKeyEvent.GetKeyCode().IsMod1() || rKeyEvent.GetKeyCode().IsMod2())
350 {
351 return CustomWidgetController::KeyInput(rKeyEvent);
352 }
353 nVStep *= mnVisLines;
354 [[fallthrough]];
355 case KEY_UP:
356 if (nCurPos != VALUESET_ITEM_NONEITEM)
357 {
358 if (nCurPos == nLastItem)
359 {
360 const size_t nCol = mnCols ? nLastItem % mnCols : 0;
361 if (nCol < mnCurCol)
362 {
363 // Move to previous row/page, keeping the old column
364 nVStep -= mnCurCol - nCol;
365 }
366 }
367 if (nCurPos >= nVStep)
368 {
369 // Go up of a whole page
370 nItemPos = nCurPos-nVStep;
371 }
372 else if (mpNoneItem)
373 {
374 nItemPos = VALUESET_ITEM_NONEITEM;
375 }
376 else if (nCurPos > mnCols)
377 {
378 // Go to same column in first row
379 nItemPos = nCurPos % mnCols;
380 }
381 }
382 break;
383
384 case KEY_PAGEDOWN:
385 if (rKeyEvent.GetKeyCode().IsShift() || rKeyEvent.GetKeyCode().IsMod1() || rKeyEvent.GetKeyCode().IsMod2())
386 {
387 return CustomWidgetController::KeyInput(rKeyEvent);
388 }
389 nVStep *= mnVisLines;
390 [[fallthrough]];
391 case KEY_DOWN:
392 if (nCurPos != nLastItem)
393 {
394 if (nCurPos == VALUESET_ITEM_NONEITEM)
395 {
396 nItemPos = nVStep-mnCols+mnCurCol;
397 }
398 else
399 {
400 nItemPos = nCurPos+nVStep;
401 }
402 if (nItemPos > nLastItem)
403 {
404 nItemPos = nLastItem;
405 }
406 }
407 break;
408
409 case KEY_RETURN:
411 {
412 // tdf#142479 on return select the entry the cursor is in
413 // before calling Select
414 if (nCurPos != VALUESET_ITEM_NONEITEM)
415 {
416 const sal_uInt16 nItemId = GetItemId(nCurPos);
417 if (nItemId != mnSelItemId)
418 SelectItem(nItemId);
419 }
420 Select();
421 break;
422 }
423 [[fallthrough]];
424 default:
425 return CustomWidgetController::KeyInput(rKeyEvent);
426 }
427
428 if ( nItemPos == VALUESET_ITEM_NOTFOUND )
429 return true;
430
431 if ( nItemPos!=VALUESET_ITEM_NONEITEM && nItemPos<nLastItem )
432 {
433 // update current column only in case of a new position
434 // which is also not a "specially" handled one.
435 mnCurCol = mnCols ? nItemPos % mnCols : 0;
436 }
437 const sal_uInt16 nItemId = (nItemPos != VALUESET_ITEM_NONEITEM) ? GetItemId( nItemPos ) : 0;
438 if ( nItemId != mnSelItemId )
439 {
440 SelectItem( nItemId );
441 if (!(GetStyle() & WB_NO_DIRECTSELECT))
442 {
443 // select only if WB_NO_DIRECTSELECT is not set
444 Select();
445 }
446 }
447
448 return true;
449}
450
451void ValueSet::ImplTracking(bool bLeaveWindow, const Point& rPos)
452{
453 ValueSetItem* pItem = bLeaveWindow ? nullptr : ImplGetItem(ImplGetItem(rPos));
454 if ( pItem )
455 {
457 mbHighlight = true;
458
459 ImplHighlightItem(pItem->mnId);
460 }
461 else
462 {
464 mbHighlight = true;
465
467 }
468}
469
470bool ValueSet::MouseButtonDown( const MouseEvent& rMouseEvent )
471{
472 if (rMouseEvent.IsLeft() && !rMouseEvent.IsMod2())
473 {
474 bool bConsumed = false;
475 ValueSetItem* pItem = ImplGetItem( ImplGetItem( rMouseEvent.GetPosPixel() ) );
476 if (rMouseEvent.GetClicks() == 1)
477 {
478 if (pItem)
479 SelectItem(pItem->mnId);
480 GrabFocus();
481 bConsumed = true;
482 }
483 else if (pItem && rMouseEvent.GetClicks() == 2)
484 {
486 bConsumed = true;
487 }
488 return bConsumed;
489 }
490
491 return CustomWidgetController::MouseButtonDown( rMouseEvent );
492}
493
494bool ValueSet::MouseButtonUp( const MouseEvent& rMouseEvent )
495{
496 if (rMouseEvent.IsLeft() && !rMouseEvent.IsMod2())
497 {
498 // tdf#142150 MouseUp seen without previous MouseDown
499 if (mnSelItemId)
500 Select();
501 return true;
502 }
503
504 return CustomWidgetController::MouseButtonUp( rMouseEvent );
505}
506
507bool ValueSet::MouseMove(const MouseEvent& rMouseEvent)
508{
509 // because of SelectionMode
511 ImplTracking(rMouseEvent.IsLeaveWindow(), rMouseEvent.GetPosPixel());
512 return CustomWidgetController::MouseMove(rMouseEvent);
513}
514
516{
517 queue_resize();
519 mbFormat = true;
520 if ( IsReallyVisible() && IsUpdateMode() )
521 Invalidate();
522}
523
524void ValueSet::RemoveItem( sal_uInt16 nItemId )
525{
526 size_t nPos = GetItemPos( nItemId );
527
529 return;
530
531 if ( nPos < mItemList.size() ) {
532 mItemList.erase( mItemList.begin() + nPos );
533 }
534
535 // reset variables
536 if (mnHighItemId == nItemId || mnSelItemId == nItemId)
537 {
538 mnCurCol = 0;
539 mnHighItemId = 0;
540 mnSelItemId = 0;
541 mbNoSelection = true;
542 }
543
545}
546
548{
549 if (mxScrolledWindow->get_vpolicy() == VclPolicyType::NEVER)
550 return false;
551 mxScrolledWindow->set_vpolicy(VclPolicyType::NEVER);
552 weld::DrawingArea* pDrawingArea = GetDrawingArea();
553 Size aPrefSize(pDrawingArea->get_preferred_size());
554 pDrawingArea->set_size_request(aPrefSize.Width() + GetScrollWidth(), aPrefSize.Height());
555 return true;
556}
557
559{
560 if (mxScrolledWindow->get_vpolicy() == VclPolicyType::ALWAYS)
561 return;
562 mxScrolledWindow->set_vpolicy(VclPolicyType::ALWAYS);
563 weld::DrawingArea* pDrawingArea = GetDrawingArea();
564 Size aPrefSize(pDrawingArea->get_preferred_size());
565 pDrawingArea->set_size_request(aPrefSize.Width() - GetScrollWidth(), aPrefSize.Height());
566}
567
569{
570 if (!mxScrolledWindow)
571 return;
572 const bool bScrollAllowed = GetStyle() & WB_VSCROLL;
573 if (!bScrollAllowed)
574 return;
575 // reset scrolled window state to initial value so it will get configured
576 // to the right adjustment on the next format which we toggle on to happen
577 // if the scrolledwindow wasn't in its initial state already
578 if (TurnOffScrollBar())
579 mbFormat = true;
580}
581
583{
585
586 // reset variables
587 mnFirstLine = 0;
588 mnCurCol = 0;
589 mnHighItemId = 0;
590 mnSelItemId = 0;
591 mbNoSelection = true;
592
594
595 mbFormat = true;
596 if ( IsReallyVisible() && IsUpdateMode() )
597 Invalidate();
598}
599
601{
602 return mItemList.size();
603}
604
605size_t ValueSet::GetItemPos( sal_uInt16 nItemId ) const
606{
607 for ( size_t i = 0, n = mItemList.size(); i < n; ++i ) {
608 if ( mItemList[i]->mnId == nItemId ) {
609 return i;
610 }
611 }
613}
614
615sal_uInt16 ValueSet::GetItemId( size_t nPos ) const
616{
617 return ( nPos < mItemList.size() ) ? mItemList[nPos]->mnId : 0 ;
618}
619
620sal_uInt16 ValueSet::GetItemId( const Point& rPos ) const
621{
622 size_t nItemPos = ImplGetItem( rPos );
623 if ( nItemPos != VALUESET_ITEM_NOTFOUND )
624 return GetItemId( nItemPos );
625
626 return 0;
627}
628
629tools::Rectangle ValueSet::GetItemRect( sal_uInt16 nItemId ) const
630{
631 const size_t nPos = GetItemPos( nItemId );
632
634 return ImplGetItemRect( nPos );
635
636 return tools::Rectangle();
637}
638
640{
641 const size_t nVisibleBegin = static_cast<size_t>(mnFirstLine)*mnCols;
642 const size_t nVisibleEnd = nVisibleBegin + static_cast<size_t>(mnVisLines)*mnCols;
643
644 // Check if the item is inside the range of the displayed ones,
645 // taking into account that last row could be incomplete
646 if ( nPos<nVisibleBegin || nPos>=nVisibleEnd || nPos>=mItemList.size() )
647 return tools::Rectangle();
648
649 nPos -= nVisibleBegin;
650
651 const size_t row = mnCols ? nPos/mnCols : 0;
652 const size_t col = mnCols ? nPos%mnCols : 0;
655
657}
658
659void ValueSet::ImplHighlightItem(sal_uInt16 nItemId)
660{
661 if ( mnHighItemId == nItemId )
662 return;
663
664 // remember the old item to delete the previous selection
665 mnHighItemId = nItemId;
666
667 // remove the old selection and draw the new one
668 Invalidate();
669}
670
672{
673 if (mbFormat)
674 Format(rRenderContext);
675
676 Point aDefPos;
677 Size aSize = maVirDev->GetOutputSizePixel();
678
679 rRenderContext.DrawOutDev(aDefPos, aSize, aDefPos, aSize, *maVirDev);
680
681 // draw parting line to the Namefield
682 if (GetStyle() & WB_NAMEFIELD)
683 {
684 if (!(GetStyle() & WB_FLATVALUESET))
685 {
686 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
687 Size aWinSize(GetOutputSizePixel());
688 Point aPos1(NAME_LINE_OFF_X, mnTextOffset + NAME_LINE_OFF_Y);
689 Point aPos2(aWinSize.Width() - (NAME_LINE_OFF_X * 2), mnTextOffset + NAME_LINE_OFF_Y);
690 if (!(rStyleSettings.GetOptions() & StyleSettingsOptions::Mono))
691 {
692 rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
693 rRenderContext.DrawLine(aPos1, aPos2);
694 aPos1.AdjustY( 1 );
695 aPos2.AdjustY( 1 );
696 rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
697 }
698 else
699 rRenderContext.SetLineColor(rStyleSettings.GetWindowTextColor());
700 rRenderContext.DrawLine(aPos1, aPos2);
701 }
702 }
703
704 ImplDrawSelect(rRenderContext);
705}
706
713{
714 Size aLargestItem = GetLargestItemSize();
715
716 if ( mnUserItemWidth != aLargestItem.Width() ||
717 mnUserItemHeight != aLargestItem.Height() )
718 {
719 mnUserItemWidth = aLargestItem.Width();
720 mnUserItemHeight = aLargestItem.Height();
722 }
723}
724
725void ValueSet::SetFirstLine(sal_uInt16 nNewFirstLine)
726{
727 if (nNewFirstLine != mnFirstLine)
728 {
729 mnFirstLine = nNewFirstLine;
731 mxScrolledWindow->vadjustment_set_value(mnFirstLine);
732 }
733}
734
735void ValueSet::SelectItem( sal_uInt16 nItemId )
736{
737 size_t nItemPos = 0;
738
739 if ( nItemId )
740 {
741 nItemPos = GetItemPos( nItemId );
742 if ( nItemPos == VALUESET_ITEM_NOTFOUND )
743 return;
744 }
745
746 if ( !((mnSelItemId != nItemId) || mbNoSelection) )
747 return;
748
749 const sal_uInt16 nOldItem = mnSelItemId;
750 mnSelItemId = nItemId;
751 mbNoSelection = false;
752
753 bool bNewOut = !mbFormat && IsReallyVisible() && IsUpdateMode();
754 bool bNewLine = false;
755
756 if (weld::DrawingArea* pNeedsFormatToScroll = !mnCols ? GetDrawingArea() : nullptr)
757 {
758 Format(pNeedsFormatToScroll->get_ref_device());
759 // reset scrollbar so it's set to the later calculated mnFirstLine on
760 // the next Format
762 }
763
764 // if necessary scroll to the visible area
765 if (mbScroll && nItemId && mnCols)
766 {
767 sal_uInt16 nNewLine = static_cast<sal_uInt16>(nItemPos / mnCols);
768 if ( nNewLine < mnFirstLine )
769 {
770 SetFirstLine(nNewLine);
771 bNewLine = true;
772 }
773 else if ( nNewLine > o3tl::make_unsigned(mnFirstLine+mnVisLines-1) )
774 {
775 SetFirstLine(static_cast<sal_uInt16>(nNewLine-mnVisLines+1));
776 bNewLine = true;
777 }
778 }
779
780 if ( bNewOut )
781 {
782 if ( bNewLine )
783 {
784 // redraw everything if the visible area has changed
785 mbFormat = true;
786 }
787 Invalidate();
788 }
789
791 return;
792
793 // focus event (deselect)
794 if( nOldItem )
795 {
796 const size_t nPos = GetItemPos( nItemId );
797
799 {
801 mItemList[nPos]->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
802
803 if( pItemAcc )
804 {
805 Any aOldAny;
806 Any aNewAny;
807 aOldAny <<= Reference(getXWeak(pItemAcc));
808 ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny );
809 }
810 }
811 }
812
813 // focus event (select)
814 const size_t nPos = GetItemPos( mnSelItemId );
815
816 ValueSetItem* pItem;
818 pItem = mItemList[nPos].get();
819 else
820 pItem = mpNoneItem.get();
821
822 ValueItemAcc* pItemAcc = nullptr;
823 if (pItem != nullptr)
824 pItemAcc = ValueItemAcc::getImplementation( pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/ ) );
825
826 if( pItemAcc )
827 {
828 Any aOldAny;
829 Any aNewAny;
830 aNewAny <<= Reference(getXWeak(pItemAcc));
831 ImplFireAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldAny, aNewAny);
832 }
833
834 // selection event
835 Any aOldAny;
836 Any aNewAny;
837 ImplFireAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, aOldAny, aNewAny);
838}
839
841{
842 mbNoSelection = true;
843 mbHighlight = false;
844
845 if (IsReallyVisible() && IsUpdateMode())
846 Invalidate();
847}
848
850{
851 if (nStyle != mnStyle)
852 {
853 mnStyle = nStyle;
854 mbFormat = true;
855 Invalidate();
856 }
857}
858
859void ValueSet::Format(vcl::RenderContext const & rRenderContext)
860{
861 Size aWinSize(GetOutputSizePixel());
862 size_t nItemCount = mItemList.size();
863 WinBits nStyle = GetStyle();
864 tools::Long nTxtHeight = rRenderContext.GetTextHeight();
865 tools::Long nOff;
866 tools::Long nNoneHeight;
867 tools::Long nNoneSpace;
868
869 if (mxScrolledWindow && !(nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER)
871
872 // calculate item offset
873 if (nStyle & WB_ITEMBORDER)
874 {
875 if (nStyle & WB_DOUBLEBORDER)
876 nOff = ITEM_OFFSET_DOUBLE;
877 else
878 nOff = ITEM_OFFSET;
879 }
880 else
881 nOff = 0;
882
883 // consider size, if NameField does exist
884 if (nStyle & WB_NAMEFIELD)
885 {
886 mnTextOffset = aWinSize.Height() - nTxtHeight - NAME_OFFSET;
887 aWinSize.AdjustHeight( -(nTxtHeight + NAME_OFFSET) );
888
889 if (!(nStyle & WB_FLATVALUESET))
890 {
891 mnTextOffset -= NAME_LINE_HEIGHT + NAME_LINE_OFF_Y;
892 aWinSize.AdjustHeight( -(NAME_LINE_HEIGHT + NAME_LINE_OFF_Y) );
893 }
894 }
895 else
896 mnTextOffset = 0;
897
898 // consider offset and size, if NoneField does exist
899 if (nStyle & WB_NONEFIELD)
900 {
901 nNoneHeight = nTxtHeight + nOff;
902 nNoneSpace = mnSpacing;
903 }
904 else
905 {
906 nNoneHeight = 0;
907 nNoneSpace = 0;
908 mpNoneItem.reset();
909 }
910
911 // calculate number of columns
912 if (!mnUserCols)
913 {
914 if (mnUserItemWidth)
915 {
916 mnCols = static_cast<sal_uInt16>((aWinSize.Width() - mnSpacing) / (mnUserItemWidth + mnSpacing));
917 if (mnCols <= 0)
918 mnCols = 1;
919 }
920 else
921 {
922 mnCols = 1;
923 }
924 }
925 else
926 {
928 }
929
930 // calculate number of rows
931 mbScroll = false;
932
933 auto nOldLines = mnLines;
934 // Floor( (M+N-1)/N )==Ceiling( M/N )
935 mnLines = (static_cast<tools::Long>(nItemCount) + mnCols - 1) / mnCols;
936 if (mnLines <= 0)
937 mnLines = 1;
938
939 bool bAdjustmentOutOfDate = nOldLines != mnLines;
940
941 auto nOldVisLines = mnVisLines;
942
943 tools::Long nCalcHeight = aWinSize.Height() - nNoneHeight;
944 if (mnUserVisLines)
945 {
947 }
948 else if (mnUserItemHeight)
949 {
950 mnVisLines = (nCalcHeight - nNoneSpace + mnSpacing) / (mnUserItemHeight + mnSpacing);
951 if (!mnVisLines)
952 mnVisLines = 1;
953 }
954 else
955 {
957 }
958
959 bAdjustmentOutOfDate |= nOldVisLines != mnVisLines;
960
961 if (mnLines > mnVisLines)
962 mbScroll = true;
963
964 if (mnLines <= mnVisLines)
965 {
966 SetFirstLine(0);
967 }
968 else
969 {
971 SetFirstLine(static_cast<sal_uInt16>(mnLines - mnVisLines));
972 }
973
974 // calculate item size
975 const tools::Long nColSpace = (mnCols - 1) * static_cast<tools::Long>(mnSpacing);
976 const tools::Long nLineSpace = ((mnVisLines - 1) * mnSpacing) + nNoneSpace;
978 {
980 if (mnItemWidth > aWinSize.Width() - nColSpace)
981 mnItemWidth = aWinSize.Width() - nColSpace;
982 }
983 else
984 mnItemWidth = (aWinSize.Width() - nColSpace) / mnCols;
986 {
988 if (mnItemHeight > nCalcHeight - nNoneSpace)
989 mnItemHeight = nCalcHeight - nNoneSpace;
990 }
991 else
992 {
993 nCalcHeight -= nLineSpace;
994 mnItemHeight = nCalcHeight / mnVisLines;
995 }
996
997 // Init VirDev
999 maVirDev->SetOutputSizePixel(aWinSize);
1000 maVirDev->Erase();
1001
1002 // nothing is changed in case of too small items
1003 if ((mnItemWidth <= 0) ||
1004 (mnItemHeight <= ((nStyle & WB_ITEMBORDER) ? 4 : 2)) ||
1005 !nItemCount)
1006 {
1007 mbHasVisibleItems = false;
1008
1009 if ((nStyle & WB_NONEFIELD) && mpNoneItem)
1010 {
1011 mpNoneItem->mbVisible = false;
1012 mpNoneItem->maText = GetText();
1013 }
1014
1015 for (size_t i = 0; i < nItemCount; i++)
1016 {
1017 mItemList[i]->mbVisible = false;
1018 }
1019
1020 if (mxScrolledWindow && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER)
1022 }
1023 else
1024 {
1025 mbHasVisibleItems = true;
1026
1027 // determine Frame-Style
1028 if (nStyle & WB_DOUBLEBORDER)
1029 mnFrameStyle = DrawFrameStyle::DoubleIn;
1030 else
1031 mnFrameStyle = DrawFrameStyle::In;
1032
1033 // draw the selection with double width if the items are bigger
1034 if ((nStyle & WB_DOUBLEBORDER) &&
1035 ((mnItemWidth >= 25) && (mnItemHeight >= 20)))
1036 {
1037 mbDoubleSel = true;
1038 }
1039 else
1040 {
1041 mbDoubleSel = false;
1042 }
1043
1044 // calculate offsets
1045 tools::Long nStartX;
1046 tools::Long nStartY;
1047 if (mbFullMode)
1048 {
1049 tools::Long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace;
1050 tools::Long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace;
1051 nStartX = (aWinSize.Width() - nAllItemWidth) / 2;
1052 nStartY = (aWinSize.Height() - nAllItemHeight) / 2;
1053 }
1054 else
1055 {
1056 nStartX = 0;
1057 nStartY = 0;
1058 }
1059
1060 // calculate and draw items
1061 maVirDev->SetLineColor();
1062 tools::Long x = nStartX;
1063 tools::Long y = nStartY;
1064
1065 // create NoSelection field and show it
1066 if (nStyle & WB_NONEFIELD)
1067 {
1068 if (!mpNoneItem)
1069 mpNoneItem.reset(new ValueSetItem(*this));
1070
1071 mpNoneItem->mnId = 0;
1072 mpNoneItem->meType = VALUESETITEM_NONE;
1073 mpNoneItem->mbVisible = true;
1076 maNoneItemRect.SetRight( maNoneItemRect.Left() + aWinSize.Width() - x - 1 );
1077 maNoneItemRect.SetBottom( y + nNoneHeight - 1 );
1078
1079 ImplFormatItem(rRenderContext, mpNoneItem.get(), maNoneItemRect);
1080
1081 y += nNoneHeight + nNoneSpace;
1082 }
1083
1084 // draw items
1085 sal_uLong nFirstItem = static_cast<sal_uLong>(mnFirstLine) * mnCols;
1086 sal_uLong nLastItem = nFirstItem + (mnVisLines * mnCols);
1087
1092
1093 if (!mbFullMode)
1094 {
1095 // If want also draw parts of items in the last line,
1096 // then we add one more line if parts of these line are
1097 // visible
1098 if (y + (mnVisLines * (mnItemHeight + mnSpacing)) < aWinSize.Height())
1099 nLastItem += mnCols;
1100 maItemListRect.SetBottom( aWinSize.Height() - y );
1101 }
1102 for (size_t i = 0; i < nItemCount; i++)
1103 {
1104 ValueSetItem* pItem = mItemList[i].get();
1105
1106 if (i >= nFirstItem && i < nLastItem)
1107 {
1108 if (!pItem->mbVisible && ImplHasAccessibleListeners())
1109 {
1110 Any aOldAny;
1111 Any aNewAny;
1112
1113 aNewAny <<= pItem->GetAccessible(false/*bIsTransientChildrenDisabled*/);
1114 ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, aNewAny);
1115 }
1116
1117 pItem->mbVisible = true;
1118 ImplFormatItem(rRenderContext, pItem, tools::Rectangle(Point(x, y), Size(mnItemWidth, mnItemHeight)));
1119
1120 if (!((i + 1) % mnCols))
1121 {
1122 x = nStartX;
1124 }
1125 else
1126 x += mnItemWidth + mnSpacing;
1127 }
1128 else
1129 {
1130 if (pItem->mbVisible && ImplHasAccessibleListeners())
1131 {
1132 Any aOldAny;
1133 Any aNewAny;
1134
1135 aOldAny <<= pItem->GetAccessible(false/*bIsTransientChildrenDisabled*/);
1136 ImplFireAccessibleEvent(AccessibleEventId::CHILD, aOldAny, aNewAny);
1137 }
1138
1139 pItem->mbVisible = false;
1140 }
1141 }
1142
1143 // arrange ScrollBar, set values and show it
1144 if (mxScrolledWindow && (nStyle & WB_VSCROLL))
1145 {
1146 bool bTurnScrollbarOn = mxScrolledWindow->get_vpolicy() != VclPolicyType::ALWAYS;
1147 if (bAdjustmentOutOfDate || bTurnScrollbarOn)
1148 {
1149 tools::Long nPageSize = mnVisLines;
1150 if (nPageSize < 1)
1151 nPageSize = 1;
1152 mxScrolledWindow->vadjustment_configure(mnFirstLine, 0, mnLines, 1,
1153 mnVisLines, nPageSize);
1154 }
1155
1156 if (bTurnScrollbarOn)
1158 }
1159 }
1160
1161 // waiting for the next since the formatting is finished
1162 mbFormat = false;
1163}
1164
1166{
1167 if (!IsReallyVisible())
1168 return;
1169
1170 const bool bFocus = HasFocus();
1171
1172 if (!bFocus && mbNoSelection && !mbHighlight)
1173 return;
1174
1175 tools::Rectangle aSelectedRect, aHoverRect;
1176 ValueSetItem* pSelectedItem = ImplGetDrawSelectItem(mnSelItemId, bFocus, aSelectedRect);
1177 ValueSetItem* pHighlightItem = mnHighItemId ? ImplGetDrawSelectItem(mnHighItemId, false, aHoverRect) : nullptr;
1178
1179 if (pSelectedItem)
1180 {
1181 const bool bHover = pSelectedItem == pHighlightItem;
1182 ImplDrawSelect(rRenderContext, aSelectedRect, pSelectedItem, bFocus, !mbNoSelection, true, bHover);
1183 }
1184 if (pHighlightItem && (pSelectedItem != pHighlightItem || mbNoSelection))
1185 {
1186 // For the case that there isn't a selected item, but due to wanting to
1187 // show focus is in the valueset, the above block will have drawn the
1188 // first item with a focus rect. For that situation; if the valueset is
1189 // the thin WB_MENUSTYLEVALUESET case then blend this highlight border
1190 // on top of that focus rect and it will appear with a highlighted
1191 // focus rect. If it's the other case of a thicker border then redraw
1192 // the focus rect highlighted with the hover color.
1193 bool bDrawFocus;
1194 WinBits nStyle = GetStyle();
1195 if (nStyle & WB_MENUSTYLEVALUESET)
1196 bDrawFocus = false;
1197 else
1198 bDrawFocus = pSelectedItem == pHighlightItem && mbNoSelection;
1199
1200 ImplDrawSelect(rRenderContext, aHoverRect, pHighlightItem, bDrawFocus, mbHighlight, false, true);
1201 }
1202}
1203
1204ValueSetItem* ValueSet::ImplGetDrawSelectItem(sal_uInt16 nItemId, const bool bFocus, tools::Rectangle& rRect)
1205{
1206 ValueSetItem* pItem = nullptr;
1207 if (nItemId)
1208 {
1209 const size_t nPos = GetItemPos( nItemId );
1210 pItem = mItemList[ nPos ].get();
1211 rRect = ImplGetItemRect( nPos );
1212 }
1213 else if (mpNoneItem)
1214 {
1215 pItem = mpNoneItem.get();
1216 rRect = maNoneItemRect;
1217 }
1218 else if (bFocus && (pItem = ImplGetFirstItem()))
1219 {
1220 rRect = ImplGetItemRect(0);
1221 }
1222 return pItem;
1223}
1224
1226 const tools::Rectangle& rRect, const ValueSetItem* pItem,
1227 const bool bFocus, const bool bDrawSel,
1228 const bool bSelected, const bool bHover)
1229{
1230 tools::Rectangle aRect(rRect);
1231
1232 // draw selection
1233 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1234 rRenderContext.SetFillColor();
1235
1236 Color aDoubleColor;
1237 Color aSingleColor;
1238
1239 sal_uInt16 nTransparencePercent = 0;
1240
1241 if (bSelected && bHover)
1242 {
1243 aDoubleColor = rStyleSettings.GetActiveColor();
1244 aSingleColor = rStyleSettings.GetActiveTextColor();
1245 }
1246 else if (bSelected || bHover)
1247 {
1248 aDoubleColor = rStyleSettings.GetHighlightColor();
1249 aSingleColor = rStyleSettings.GetHighlightTextColor();
1250 if (bHover)
1251 {
1252 nTransparencePercent = 55;
1253 }
1254 }
1255
1256 // specify selection output
1257 WinBits nStyle = GetStyle();
1258 if (nStyle & WB_MENUSTYLEVALUESET)
1259 {
1260 if (bFocus)
1261 InvertFocusRect(rRenderContext, aRect);
1262 if (bDrawSel)
1263 {
1264 rRenderContext.SetLineColor(aDoubleColor);
1265 tools::PolyPolygon aPolyPoly(1);
1266 aPolyPoly.Insert(tools::Polygon(aRect));
1267 rRenderContext.DrawTransparent(aPolyPoly, nTransparencePercent);
1268 }
1269 }
1270 else
1271 {
1272 rRenderContext.SetLineColor(aDoubleColor);
1273 tools::Rectangle aFocusRect;
1274
1275 if (!mbDoubleSel)
1276 {
1277 // an outer rectangle surrounding a "focus" rectangle, surrounding
1278 // an inner rectangle. Focus rectangle is always drawn, but rendered
1279 // empty when there is no focus. e.g. as seen in color valuesets
1280 if (bDrawSel)
1281 {
1282 tools::PolyPolygon aPolyPoly(1);
1283 aPolyPoly.Insert(tools::Polygon(aRect));
1284 rRenderContext.DrawTransparent(aPolyPoly, nTransparencePercent);
1285 }
1286
1287 aRect.AdjustLeft( 1 );
1288 aRect.AdjustTop( 1 );
1289 aRect.AdjustRight( -1 );
1290 aRect.AdjustBottom( -1 );
1291
1292 aFocusRect = aRect;
1293
1294 aRect.AdjustLeft( 1 );
1295 aRect.AdjustTop( 1 );
1296 aRect.AdjustRight( -1 );
1297 aRect.AdjustBottom( -1 );
1298
1299 if (bDrawSel)
1300 {
1301 tools::PolyPolygon aPolyPoly(1);
1302 aPolyPoly.Insert(tools::Polygon(aRect));
1303 rRenderContext.DrawTransparent(aPolyPoly, nTransparencePercent);
1304 }
1305
1306 if (bDrawSel)
1307 rRenderContext.SetLineColor(aSingleColor);
1308 else
1309 rRenderContext.SetLineColor(COL_LIGHTGRAY);
1310
1311 rRenderContext.DrawRect(aFocusRect);
1312 }
1313 else
1314 {
1315 // a thick bordered rectangle surrounding an optional "focus"
1316 // rectangle which is only drawn when focused, as seen in format,
1317 // bullets and numbering in writer
1318 const int nAdjust = 2;
1319
1320 aRect.AdjustLeft(nAdjust);
1321 aRect.AdjustTop(nAdjust);
1322 aRect.AdjustRight(-nAdjust);
1323 aRect.AdjustBottom(-nAdjust);
1324
1325 aFocusRect = aRect;
1326
1327 if (bDrawSel)
1328 {
1329 const basegfx::B2DPolygon aRectPoly(
1332
1333 const int nThickness = nAdjust * 2;
1334
1335 if (!rRenderContext.DrawPolyLineDirect(basegfx::B2DHomMatrix(),
1336 aRectPoly,
1337 nThickness,
1338 nTransparencePercent / 100.0,
1339 nullptr,
1341 {
1342 SAL_WARN("svtools", "presumably impossible in practice, but fallback to see something");
1343 rRenderContext.DrawPolyLine(aRectPoly, nThickness, basegfx::B2DLineJoin::Miter);
1344 }
1345 }
1346
1347 if (bFocus)
1348 {
1349 if (bDrawSel)
1350 rRenderContext.SetLineColor(aSingleColor);
1351 else
1352 rRenderContext.SetLineColor(COL_LIGHTGRAY);
1353 rRenderContext.DrawRect(aFocusRect);
1354 }
1355 }
1356
1357 if (bFocus)
1358 InvertFocusRect(rRenderContext, aFocusRect);
1359 }
1360
1361 ImplDrawItemText(rRenderContext, pItem->maText);
1362}
1363
1365{
1366 WinBits nStyle = GetStyle();
1367 if (nStyle & WB_ITEMBORDER)
1368 {
1369 aRect.AdjustLeft(1 );
1370 aRect.AdjustTop(1 );
1371 aRect.AdjustRight( -1 );
1372 aRect.AdjustBottom( -1 );
1373
1374 if (nStyle & WB_FLATVALUESET)
1375 {
1376 sal_Int32 nBorder = (nStyle & WB_DOUBLEBORDER) ? 2 : 1;
1377
1378 aRect.AdjustLeft(nBorder );
1379 aRect.AdjustTop(nBorder );
1380 aRect.AdjustRight( -nBorder );
1381 aRect.AdjustBottom( -nBorder );
1382 }
1383 else
1384 {
1385 DecorationView aView(maVirDev.get());
1386 aRect = aView.DrawFrame(aRect, mnFrameStyle);
1387 }
1388 }
1389
1390 if (pItem == mpNoneItem.get())
1391 pItem->maText = GetText();
1392
1393 if ((aRect.GetHeight() <= 0) || (aRect.GetWidth() <= 0))
1394 return;
1395
1396 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1397
1398 if (pItem == mpNoneItem.get())
1399 {
1400 maVirDev->SetFont(rRenderContext.GetFont());
1401 maVirDev->SetTextColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor());
1402 maVirDev->SetTextFillColor();
1403 maVirDev->SetFillColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor());
1404 maVirDev->DrawRect(aRect);
1405 Point aTxtPos(aRect.Left() + 2, aRect.Top());
1406 tools::Long nTxtWidth = rRenderContext.GetTextWidth(pItem->maText);
1407 if ((aTxtPos.X() + nTxtWidth) > aRect.Right())
1408 {
1409 maVirDev->SetClipRegion(vcl::Region(aRect));
1410 maVirDev->DrawText(aTxtPos, pItem->maText);
1411 maVirDev->SetClipRegion();
1412 }
1413 else
1414 maVirDev->DrawText(aTxtPos, pItem->maText);
1415 }
1416 else if (pItem->meType == VALUESETITEM_COLOR)
1417 {
1418 maVirDev->SetFillColor(pItem->maColor);
1419 maVirDev->DrawRect(aRect);
1420 }
1421 else
1422 {
1423 if (IsColor())
1424 maVirDev->SetFillColor(maColor);
1425 else if (nStyle & WB_MENUSTYLEVALUESET)
1426 maVirDev->SetFillColor(rStyleSettings.GetMenuColor());
1427 else if (IsEnabled())
1428 maVirDev->SetFillColor(rStyleSettings.GetWindowColor());
1429 else
1430 maVirDev->SetFillColor(rStyleSettings.GetFaceColor());
1431 maVirDev->DrawRect(aRect);
1432
1433 if (pItem->meType == VALUESETITEM_USERDRAW)
1434 {
1435 UserDrawEvent aUDEvt(maVirDev.get(), aRect, pItem->mnId);
1436 UserDraw(aUDEvt);
1437 }
1438 else
1439 {
1440 Size aImageSize = pItem->maImage.GetSizePixel();
1441 Size aRectSize = aRect.GetSize();
1442 Point aPos(aRect.Left(), aRect.Top());
1443 aPos.AdjustX((aRectSize.Width() - aImageSize.Width()) / 2 );
1444
1445 if (pItem->meType != VALUESETITEM_IMAGE_AND_TEXT)
1446 aPos.AdjustY((aRectSize.Height() - aImageSize.Height()) / 2 );
1447
1448 DrawImageFlags nImageStyle = DrawImageFlags::NONE;
1449 if (!IsEnabled())
1450 nImageStyle |= DrawImageFlags::Disable;
1451
1452 if (aImageSize.Width() > aRectSize.Width() ||
1453 aImageSize.Height() > aRectSize.Height())
1454 {
1455 maVirDev->SetClipRegion(vcl::Region(aRect));
1456 maVirDev->DrawImage(aPos, pItem->maImage, nImageStyle);
1457 maVirDev->SetClipRegion();
1458 }
1459 else
1460 maVirDev->DrawImage(aPos, pItem->maImage, nImageStyle);
1461
1462 if (pItem->meType == VALUESETITEM_IMAGE_AND_TEXT)
1463 {
1464 maVirDev->SetFont(rRenderContext.GetFont());
1465 maVirDev->SetTextColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor());
1466 maVirDev->SetTextFillColor();
1467
1468 tools::Long nTxtWidth = maVirDev->GetTextWidth(pItem->maText);
1469
1470 if (nTxtWidth > aRect.GetWidth())
1471 maVirDev->SetClipRegion(vcl::Region(aRect));
1472
1473 maVirDev->DrawText(Point(aRect.Left() +
1474 (aRect.GetWidth() - nTxtWidth) / 2,
1475 aRect.Bottom() - maVirDev->GetTextHeight()),
1476 pItem->maText);
1477
1478 if (nTxtWidth > aRect.GetWidth())
1479 maVirDev->SetClipRegion();
1480 }
1481 }
1482 }
1483
1484 const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
1485
1486 if (nEdgeBlendingPercent)
1487 {
1488 const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
1489 const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
1490 const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
1491 const BitmapEx aBlendFrame(createBlendFrame(aRect.GetSize(), nAlpha, rTopLeft, rBottomRight));
1492
1493 if (!aBlendFrame.IsEmpty())
1494 {
1495 maVirDev->DrawBitmapEx(aRect.TopLeft(), aBlendFrame);
1496 }
1497 }
1498}
1499
1500void ValueSet::ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUString& rText)
1501{
1502 if (!(GetStyle() & WB_NAMEFIELD))
1503 return;
1504
1505 Size aWinSize(GetOutputSizePixel());
1506 tools::Long nTxtWidth = rRenderContext.GetTextWidth(rText);
1507 tools::Long nTxtOffset = mnTextOffset;
1508
1509 rRenderContext.Push(vcl::PushFlags::TEXTCOLOR);
1510
1511 // delete rectangle and show text
1512 const bool bFlat(GetStyle() & WB_FLATVALUESET);
1513 if (!bFlat)
1514 nTxtOffset += NAME_LINE_HEIGHT+NAME_LINE_OFF_Y;
1515
1516 rRenderContext.SetTextColor(Application::GetSettings().GetStyleSettings().GetButtonTextColor());
1517 // tdf#153787 highlighted entry text is drawn in the same Paint as the selected text, so can
1518 // overwrite already rendered text
1519 rRenderContext.Erase(tools::Rectangle(Point(0, nTxtOffset), Point(aWinSize.Width(), aWinSize.Height())));
1520 rRenderContext.DrawText(Point((aWinSize.Width() - nTxtWidth) / 2, nTxtOffset + (NAME_OFFSET / 2)), rText);
1521
1522 rRenderContext.Pop();
1523}
1524
1526{
1527 mbFormat = true;
1528 CustomWidgetController::StyleUpdated();
1529}
1530
1531void ValueSet::EnableFullItemMode( bool bFullMode )
1532{
1533 mbFullMode = bFullMode;
1534}
1535
1536void ValueSet::SetColCount( sal_uInt16 nNewCols )
1537{
1538 if ( mnUserCols != nNewCols )
1539 {
1540 mnUserCols = nNewCols;
1541 QueueReformat();
1542 }
1543}
1544
1545void ValueSet::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
1546{
1547 size_t nPos = GetItemPos( nItemId );
1548
1550 return;
1551
1552 ValueSetItem* pItem = mItemList[nPos].get();
1553 pItem->meType = VALUESETITEM_IMAGE;
1554 pItem->maImage = rImage;
1555
1556 if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
1557 {
1558 const tools::Rectangle aRect = ImplGetItemRect(nPos);
1559 Invalidate(aRect);
1560 }
1561 else
1562 mbFormat = true;
1563}
1564
1565void ValueSet::SetItemColor( sal_uInt16 nItemId, const Color& rColor )
1566{
1567 size_t nPos = GetItemPos( nItemId );
1568
1570 return;
1571
1572 ValueSetItem* pItem = mItemList[nPos].get();
1573 pItem->meType = VALUESETITEM_COLOR;
1574 pItem->maColor = rColor;
1575
1576 if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
1577 {
1578 const tools::Rectangle aRect = ImplGetItemRect(nPos);
1579 Invalidate( aRect );
1580 }
1581 else
1582 mbFormat = true;
1583}
1584
1585Color ValueSet::GetItemColor( sal_uInt16 nItemId ) const
1586{
1587 size_t nPos = GetItemPos( nItemId );
1588
1590 return mItemList[nPos]->maColor;
1591 else
1592 return Color();
1593}
1594
1595Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCols,
1596 sal_uInt16 nDesireLines ) const
1597{
1598 size_t nCalcCols = nDesireCols;
1599 size_t nCalcLines = nDesireLines;
1600
1601 if ( !nCalcCols )
1602 {
1603 if ( mnUserCols )
1604 nCalcCols = mnUserCols;
1605 else
1606 nCalcCols = 1;
1607 }
1608
1609 if ( !nCalcLines )
1610 {
1611 nCalcLines = mnVisLines;
1612
1613 if ( mbFormat )
1614 {
1615 if ( mnUserVisLines )
1616 nCalcLines = mnUserVisLines;
1617 else
1618 {
1619 // Floor( (M+N-1)/N )==Ceiling( M/N )
1620 nCalcLines = (mItemList.size()+nCalcCols-1) / nCalcCols;
1621 if ( !nCalcLines )
1622 nCalcLines = 1;
1623 }
1624 }
1625 }
1626
1627 Size aSize( rItemSize.Width() * nCalcCols, rItemSize.Height() * nCalcLines );
1628 WinBits nStyle = GetStyle();
1629 tools::Long nTxtHeight = GetTextHeight();
1630 tools::Long n;
1631
1632 if ( nStyle & WB_ITEMBORDER )
1633 {
1634 if ( nStyle & WB_DOUBLEBORDER )
1635 n = ITEM_OFFSET_DOUBLE;
1636 else
1637 n = ITEM_OFFSET;
1638
1639 aSize.AdjustWidth(n * nCalcCols );
1640 aSize.AdjustHeight(n * nCalcLines );
1641 }
1642 else
1643 n = 0;
1644
1645 if ( mnSpacing )
1646 {
1647 aSize.AdjustWidth(mnSpacing * (nCalcCols - 1) );
1648 aSize.AdjustHeight(mnSpacing * (nCalcLines - 1) );
1649 }
1650
1651 if ( nStyle & WB_NAMEFIELD )
1652 {
1653 aSize.AdjustHeight(nTxtHeight + NAME_OFFSET );
1654 if ( !(nStyle & WB_FLATVALUESET) )
1655 aSize.AdjustHeight(NAME_LINE_HEIGHT + NAME_LINE_OFF_Y );
1656 }
1657
1658 if ( nStyle & WB_NONEFIELD )
1659 {
1660 aSize.AdjustHeight(nTxtHeight + n + mnSpacing );
1661 }
1662
1663 return aSize;
1664}
1665
1666void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage )
1667{
1668 std::unique_ptr<ValueSetItem> pItem(new ValueSetItem( *this ));
1669 pItem->mnId = nItemId;
1670 pItem->meType = VALUESETITEM_IMAGE;
1671 pItem->maImage = rImage;
1672 ImplInsertItem( std::move(pItem), VALUESET_APPEND );
1673}
1674
1675void ValueSet::InsertItem( sal_uInt16 nItemId, const Image& rImage,
1676 const OUString& rText, size_t nPos,
1677 bool bShowLegend )
1678{
1679 std::unique_ptr<ValueSetItem> pItem(new ValueSetItem( *this ));
1680 pItem->mnId = nItemId;
1681 pItem->meType = bShowLegend ? VALUESETITEM_IMAGE_AND_TEXT : VALUESETITEM_IMAGE;
1682 pItem->maImage = rImage;
1683 pItem->maText = rText;
1684 ImplInsertItem( std::move(pItem), nPos );
1685}
1686
1687void ValueSet::InsertItem( sal_uInt16 nItemId, size_t nPos )
1688{
1689 std::unique_ptr<ValueSetItem> pItem(new ValueSetItem( *this ));
1690 pItem->mnId = nItemId;
1691 pItem->meType = VALUESETITEM_USERDRAW;
1692 ImplInsertItem( std::move(pItem), nPos );
1693}
1694
1695void ValueSet::InsertItem( sal_uInt16 nItemId, const Color& rColor,
1696 const OUString& rText )
1697{
1698 std::unique_ptr<ValueSetItem> pItem(new ValueSetItem( *this ));
1699 pItem->mnId = nItemId;
1700 pItem->meType = VALUESETITEM_COLOR;
1701 pItem->maColor = rColor;
1702 pItem->maText = rText;
1703 ImplInsertItem( std::move(pItem), VALUESET_APPEND );
1704}
1705
1706void ValueSet::ImplInsertItem( std::unique_ptr<ValueSetItem> pItem, const size_t nPos )
1707{
1708 DBG_ASSERT( pItem->mnId, "ValueSet::InsertItem(): ItemId == 0" );
1709 DBG_ASSERT( GetItemPos( pItem->mnId ) == VALUESET_ITEM_NOTFOUND,
1710 "ValueSet::InsertItem(): ItemId already exists" );
1711
1712 if ( nPos < mItemList.size() ) {
1713 mItemList.insert( mItemList.begin() + nPos, std::move(pItem) );
1714 } else {
1715 mItemList.push_back( std::move(pItem) );
1716 }
1717
1718 QueueReformat();
1719}
1720
1722{
1723 if (mxScrolledWindow)
1724 return mxScrolledWindow->get_scroll_thickness();
1725 return 0;
1726}
1727
1729{
1730 if(mbEdgeBlending != bNew)
1731 {
1732 mbEdgeBlending = bNew;
1733 mbFormat = true;
1734
1736 {
1737 Invalidate();
1738 }
1739 }
1740}
1741
1742Size ValueSet::CalcItemSizePixel( const Size& rItemSize) const
1743{
1744 Size aSize = rItemSize;
1745
1746 WinBits nStyle = GetStyle();
1747 if ( nStyle & WB_ITEMBORDER )
1748 {
1749 tools::Long n;
1750
1751 if ( nStyle & WB_DOUBLEBORDER )
1752 n = ITEM_OFFSET_DOUBLE;
1753 else
1754 n = ITEM_OFFSET;
1755
1756 aSize.AdjustWidth(n );
1757 aSize.AdjustHeight(n );
1758 }
1759
1760 return aSize;
1761}
1762
1763void ValueSet::SetLineCount( sal_uInt16 nNewLines )
1764{
1765 if ( mnUserVisLines != nNewLines )
1766 {
1767 mnUserVisLines = nNewLines;
1768 QueueReformat();
1769 }
1770}
1771
1773{
1774 if ( mnUserItemWidth != nNewItemWidth )
1775 {
1776 mnUserItemWidth = nNewItemWidth;
1777 QueueReformat();
1778 }
1779}
1780
1781//method to set accessible when the style is user draw.
1782void ValueSet::InsertItem( sal_uInt16 nItemId, const OUString& rText, size_t nPos )
1783{
1784 DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
1786 "ValueSet::InsertItem(): ItemId already exists" );
1787 std::unique_ptr<ValueSetItem> pItem(new ValueSetItem( *this ));
1788 pItem->mnId = nItemId;
1789 pItem->meType = VALUESETITEM_USERDRAW;
1790 pItem->maText = rText;
1791 ImplInsertItem( std::move(pItem), nPos );
1792}
1793
1795{
1796 if ( mnUserItemHeight != nNewItemHeight )
1797 {
1798 mnUserItemHeight = nNewItemHeight;
1799 QueueReformat();
1800 }
1801}
1802
1804{
1805 Point aPos = rHelpRect.TopLeft();
1806 const size_t nItemPos = ImplGetItem( aPos );
1807 OUString sRet;
1808 if (nItemPos != VALUESET_ITEM_NOTFOUND)
1809 {
1810 rHelpRect = ImplGetItemRect(nItemPos);
1811 sRet = GetItemText(ImplGetItem(nItemPos)->mnId);
1812 }
1813 return sRet;
1814}
1815
1816OUString ValueSet::GetItemText(sal_uInt16 nItemId) const
1817{
1818 const size_t nPos = GetItemPos(nItemId);
1819
1821 return mItemList[nPos]->maText;
1822
1823 return OUString();
1824}
1825
1826void ValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing )
1827{
1828 if ( GetStyle() & WB_ITEMBORDER )
1829 {
1830 mnSpacing = nNewSpacing;
1831 QueueReformat();
1832 }
1833}
1834
1836{
1837 mbFormat = true;
1838}
1839
1840void ValueSet::SetItemData( sal_uInt16 nItemId, void* pData )
1841{
1842 size_t nPos = GetItemPos( nItemId );
1843
1845 return;
1846
1847 ValueSetItem* pItem = mItemList[nPos].get();
1848 pItem->mpData = pData;
1849
1850 if ( pItem->meType == VALUESETITEM_USERDRAW )
1851 {
1852 if ( !mbFormat && IsReallyVisible() && IsUpdateMode() )
1853 {
1854 const tools::Rectangle aRect = ImplGetItemRect(nPos);
1855 Invalidate(aRect);
1856 }
1857 else
1858 mbFormat = true;
1859 }
1860}
1861
1862void* ValueSet::GetItemData( sal_uInt16 nItemId ) const
1863{
1864 size_t nPos = GetItemPos( nItemId );
1865
1867 return mItemList[nPos]->mpData;
1868 else
1869 return nullptr;
1870}
1871
1872void ValueSet::SetItemText(sal_uInt16 nItemId, const OUString& rText)
1873{
1874 size_t nPos = GetItemPos( nItemId );
1875
1877 return;
1878
1879 ValueSetItem* pItem = mItemList[nPos].get();
1880
1881 // Remember old and new name for accessibility event.
1882 Any aOldName;
1883 Any aNewName;
1884 OUString sString (pItem->maText);
1885 aOldName <<= sString;
1886 sString = rText;
1887 aNewName <<= sString;
1888
1889 pItem->maText = rText;
1890
1891 if (!mbFormat && IsReallyVisible() && IsUpdateMode())
1892 {
1893 sal_uInt16 nTempId = mnSelItemId;
1894
1895 if (mbHighlight)
1896 nTempId = mnHighItemId;
1897
1898 if (nTempId == nItemId)
1899 Invalidate();
1900 }
1901
1903 {
1904 Reference<XAccessible> xAccessible(pItem->GetAccessible( false/*bIsTransientChildrenDisabled*/));
1905 ValueItemAcc* pValueItemAcc = static_cast<ValueItemAcc*>(xAccessible.get());
1906 pValueItemAcc->FireAccessibleEvent(AccessibleEventId::NAME_CHANGED, aOldName, aNewName);
1907 }
1908}
1909
1911{
1912 Size aLargestItem;
1913
1914 for (const std::unique_ptr<ValueSetItem>& pItem : mItemList)
1915 {
1916 if (!pItem->mbVisible)
1917 continue;
1918
1919 if (pItem->meType != VALUESETITEM_IMAGE &&
1920 pItem->meType != VALUESETITEM_IMAGE_AND_TEXT)
1921 {
1922 // handle determining an optimal size for this case
1923 continue;
1924 }
1925
1926 Size aSize = pItem->maImage.GetSizePixel();
1927 if (pItem->meType == VALUESETITEM_IMAGE_AND_TEXT)
1928 {
1929 aSize.AdjustHeight(3 * NAME_LINE_HEIGHT +
1930 maVirDev->GetTextHeight() );
1931 aSize.setWidth( std::max(aSize.Width(),
1932 maVirDev->GetTextWidth(pItem->maText) + NAME_OFFSET) );
1933 }
1934
1935 aLargestItem.setWidth( std::max(aLargestItem.Width(), aSize.Width()) );
1936 aLargestItem.setHeight( std::max(aLargestItem.Height(), aSize.Height()) );
1937 }
1938
1939 return aLargestItem;
1940}
1941
1943{
1944 Size aLargestSize(GetLargestItemSize());
1945 aLargestSize.setWidth(std::max(aLargestSize.Width(), mnUserItemWidth));
1946 aLargestSize.setHeight(std::max(aLargestSize.Height(), mnUserItemHeight));
1947 Size aPrefSize(CalcWindowSizePixel(aLargestSize));
1948 GetDrawingArea()->set_size_request(aPrefSize.Width(), aPrefSize.Height());
1949}
1950
1951Image ValueSet::GetItemImage(sal_uInt16 nItemId) const
1952{
1953 size_t nPos = GetItemPos( nItemId );
1954
1956 return mItemList[nPos]->maImage;
1957 else
1958 return Image();
1959}
1960
1961void ValueSet::SetColor(const Color& rColor)
1962{
1963 maColor = rColor;
1964 mbFormat = true;
1965 if (IsReallyVisible() && IsUpdateMode())
1966 Invalidate();
1967}
1968
1970{
1971 if (mxScrolledWindow)
1972 mxScrolledWindow->show();
1973 CustomWidgetController::Show();
1974}
1975
1977{
1978 CustomWidgetController::Hide();
1979 if (mxScrolledWindow)
1980 mxScrolledWindow->hide();
1981}
1982
1984{
1986}
1987
1988/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
basegfx::BColor maColor
DrawImageFlags
BitmapEx VCL_DLLPUBLIC createBlendFrame(const Size &rSize, sal_uInt8 nAlpha, Color aColorTopLeft, Color aColorBottomRight)
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
bool IsEmpty() const
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
Size GetSizePixel() const
const vcl::KeyCode & GetKeyCode() const
bool IsMod2() const
bool IsLeaveWindow() const
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
bool IsLeft() const
const vcl::Font & GetFont() const
void DrawPolyLine(const tools::Polygon &rPoly)
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetLineColor()
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void SetTextColor(const Color &rColor)
bool DrawPolyLineDirect(const basegfx::B2DHomMatrix &rObjectTransform, const basegfx::B2DPolygon &rB2DPolygon, double fLineWidth=0.0, double fTransparency=0.0, const std::vector< double > *=nullptr, basegfx::B2DLineJoin eLineJoin=basegfx::B2DLineJoin::NONE, css::drawing::LineCap eLineCap=css::drawing::LineCap_BUTT, double fMiterMinimumAngle=basegfx::deg2rad(15.0))
void SetFillColor()
SAL_DLLPRIVATE void DrawOutDev(const Point &, const Size &, const Point &, const Size &, const Printer &)=delete
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
void SetBackground()
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetWindowColor() const
const Color & GetShadowColor() const
const Color & GetMenuColor() const
StyleSettingsOptions GetOptions() const
const Color & GetWindowTextColor() const
const Color & GetActiveColor() const
const Color & GetLightColor() const
const Color & GetEdgeBlendingTopLeftColor() const
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetMenuTextColor() const
const Color & GetHighlightTextColor() const
sal_uInt16 GetEdgeBlending() const
const Color & GetActiveTextColor() const
const Color & GetEdgeBlendingBottomRightColor() const
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
static ValueItemAcc * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
Definition: valueacc.cxx:79
void FireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
Definition: valueacc.cxx:381
bool HasAccessibleListeners() const
Definition: valueimp.hxx:84
static ValueSetAcc * getImplementation(const css::uno::Reference< css::uno::XInterface > &rxData) noexcept
Definition: valueacc.cxx:438
void GetFocus()
Called by the corresponding ValueSet when it gets the focus.
Definition: valueacc.cxx:445
void LoseFocus()
Called by the corresponding ValueSet when it loses the focus.
Definition: valueacc.cxx:458
void FireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
Definition: valueacc.cxx:412
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
Definition: uiobject.cxx:38
SVT_DLLPRIVATE void ImplDeleteItems()
Definition: valueset.cxx:133
void RecalculateItemSizes()
An inelegant method; sets the item width & height such that all of the included items and their label...
Definition: valueset.cxx:712
void InsertItem(sal_uInt16 nItemId, const Image &rImage)
Insert @rImage item.
Definition: valueset.cxx:1666
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: valueset.cxx:507
SVT_DLLPRIVATE void TurnOnScrollBar()
Definition: valueset.cxx:558
Size GetLargestItemSize()
Definition: valueset.cxx:1910
virtual void Show() override
Definition: valueset.cxx:1969
tools::Long mnUserItemWidth
Definition: valueset.hxx:199
void SetFormat()
Definition: valueset.cxx:1835
tools::Long mnLines
Definition: valueset.hxx:198
Link< ValueSet *, void > maSelectHdl
Definition: valueset.hxx:215
int GetScrollWidth() const
Definition: valueset.cxx:1721
bool mbHasVisibleItems
Definition: valueset.hxx:224
void SetOptimalSize()
Definition: valueset.cxx:1942
tools::Rectangle maNoneItemRect
Definition: valueset.hxx:192
sal_uInt16 mnSelItemId
Definition: valueset.hxx:201
SVT_DLLPRIVATE bool ImplHasAccessibleListeners() const
Definition: valueset.cxx:237
virtual ~ValueSet() override
Definition: valueset.cxx:124
OUString const & GetText() const
Definition: valueset.hxx:289
size_t GetItemCount() const
Definition: valueset.cxx:600
SVT_DLLPRIVATE tools::Rectangle ImplGetItemRect(size_t nPos) const
Definition: valueset.cxx:639
virtual OUString RequestHelp(tools::Rectangle &rHelpRect) override
Definition: valueset.cxx:1803
OUString GetItemText(sal_uInt16 nItemId) const
Definition: valueset.cxx:1816
void SetItemData(sal_uInt16 nItemId, void *pData)
Definition: valueset.cxx:1840
void SetEdgeBlending(bool bNew)
Definition: valueset.cxx:1728
bool mbFormat
Definition: valueset.hxx:217
void SetItemText(sal_uInt16 nItemId, const OUString &rStr)
Definition: valueset.cxx:1872
virtual void LoseFocus() override
Definition: valueset.cxx:273
SVT_DLLPRIVATE void QueueReformat()
Definition: valueset.cxx:515
void SetStyle(WinBits nStyle)
Definition: valueset.cxx:849
sal_uInt16 mnUserCols
Definition: valueset.hxx:206
tools::Long mnItemWidth
Definition: valueset.hxx:194
void SelectItem(sal_uInt16 nItemId)
Definition: valueset.cxx:735
friend class ValueSetAcc
Definition: valueset.hxx:227
SVT_DLLPRIVATE void SetFirstLine(sal_uInt16 nNewFirstLine)
Definition: valueset.cxx:725
SVT_DLLPRIVATE void RecalcScrollBar()
Definition: valueset.cxx:568
sal_uInt16 GetSelectedItemId() const
Definition: valueset.hxx:333
SVT_DLLPRIVATE void ImplInsertItem(std::unique_ptr< ValueSetItem > pItem, const size_t nPos)
Definition: valueset.cxx:1706
Size CalcWindowSizePixel(const Size &rItemSize, sal_uInt16 nCalcCols=0, sal_uInt16 nCalcLines=0) const
Definition: valueset.cxx:1595
SVT_DLLPRIVATE ValueSetItem * ImplGetDrawSelectItem(sal_uInt16 nItemId, const bool bFocus, tools::Rectangle &rRect)
Definition: valueset.cxx:1204
virtual void UserDraw(const UserDrawEvent &rUDEvt)
Definition: valueset.cxx:161
css::uno::Reference< css::accessibility::XAccessible > mxAccessible
Definition: valueset.hxx:188
std::unique_ptr< ValueSetItem > mpNoneItem
Definition: valueset.hxx:190
void EnableFullItemMode(bool bFullMode)
Definition: valueset.cxx:1531
WinBits mnStyle
Definition: valueset.hxx:213
SVT_DLLPRIVATE size_t ImplGetItem(const Point &rPoint) const
Definition: valueset.cxx:165
Size CalcItemSizePixel(const Size &rSize) const
Definition: valueset.cxx:1742
virtual bool MouseButtonUp(const MouseEvent &rMEvt) override
Definition: valueset.cxx:494
int mnSavedItemId
Definition: valueset.hxx:202
tools::Long mnTextOffset
Definition: valueset.hxx:196
tools::Long mnUserItemHeight
Definition: valueset.hxx:200
SVT_DLLPRIVATE void ImplFormatItem(vcl::RenderContext const &rRenderContext, ValueSetItem *pItem, tools::Rectangle aRect)
Definition: valueset.cxx:1364
bool mbNoSelection
Definition: valueset.hxx:219
void SetLineCount(sal_uInt16 nNewLines=0)
Definition: valueset.cxx:1763
SVT_DLLPRIVATE ValueSetItem * ImplGetFirstItem()
Definition: valueset.cxx:210
void SetColor()
Definition: valueset.hxx:362
virtual FactoryFunction GetUITestFactory() const override
Definition: valueset.cxx:1983
void * GetItemData(sal_uInt16 nItemId) const
Definition: valueset.cxx:1862
ScopedVclPtr< VirtualDevice > maVirDev
Definition: valueset.hxx:187
virtual void Select()
Definition: valueset.cxx:155
WinBits GetStyle() const
Definition: valueset.hxx:292
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: valueset.cxx:254
sal_uInt16 mnHighItemId
Definition: valueset.hxx:203
SVT_DLLPRIVATE void ImplTracking(bool bLeaveWindow, const Point &rPos)
Definition: valueset.cxx:451
bool mbScroll
Definition: valueset.hxx:221
Color GetItemColor(sal_uInt16 nItemId) const
Definition: valueset.cxx:1585
SVT_DLLPRIVATE bool TurnOffScrollBar()
Definition: valueset.cxx:547
SVT_DLLPRIVATE sal_uInt16 ImplGetVisibleItemCount() const
Definition: valueset.cxx:215
virtual void StyleUpdated() override
Definition: valueset.cxx:1525
bool GetEdgeBlending() const
Definition: valueset.hxx:392
SVT_DLLPRIVATE void ImplFireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
Definition: valueset.cxx:229
void SetColCount(sal_uInt16 nNewCols=1)
Definition: valueset.cxx:1536
virtual void Resize() override
Definition: valueset.cxx:285
void Clear()
Definition: valueset.cxx:582
virtual void Hide() override
Definition: valueset.cxx:1976
void Format(vcl::RenderContext const &rRenderContext)
Definition: valueset.cxx:859
bool mbHighlight
Definition: valueset.hxx:218
ValueItemList mItemList
Definition: valueset.hxx:189
bool mbDoubleSel
Definition: valueset.hxx:220
bool mbFullMode
Definition: valueset.hxx:222
void SetItemColor(sal_uInt16 nItemId, const Color &rColor)
Definition: valueset.cxx:1565
sal_uInt16 mnCols
Definition: valueset.hxx:204
sal_uInt16 mnSpacing
Definition: valueset.hxx:209
SVT_DLLPRIVATE void ImplDrawSelect(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect, const ValueSetItem *pItem, const bool bFocus, const bool bDrawSel, const bool bSelected, const bool bHover)
Definition: valueset.cxx:1225
SVT_DLLPRIVATE void ImplDraw(vcl::RenderContext &rRenderContext)
Definition: valueset.cxx:671
void SetItemImage(sal_uInt16 nItemId, const Image &rImage)
Definition: valueset.cxx:1545
Link< ValueSet *, void > maDoubleClickHdl
Definition: valueset.hxx:214
virtual void GetFocus() override
Definition: valueset.cxx:261
tools::Rectangle GetItemRect(sal_uInt16 nItemId) const
Definition: valueset.cxx:629
ValueSet(const ValueSet &)=delete
void SetItemHeight(tools::Long nLineHeight)
Definition: valueset.cxx:1794
tools::Long mnItemHeight
Definition: valueset.hxx:195
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: valueset.cxx:470
sal_uInt16 mnUserVisLines
Definition: valueset.hxx:207
tools::Rectangle maItemListRect
Definition: valueset.hxx:193
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Definition: valueset.cxx:117
void SetNoSelection()
Definition: valueset.cxx:840
SVT_DLLPRIVATE void ImplHighlightItem(sal_uInt16 nItemId)
Definition: valueset.cxx:659
bool mbEdgeBlending
Definition: valueset.hxx:223
size_t GetItemPos(sal_uInt16 nItemId) const
Definition: valueset.cxx:605
sal_uInt16 GetItemId(size_t nPos) const
Definition: valueset.cxx:615
tools::Long mnVisLines
Definition: valueset.hxx:197
Color maColor
Definition: valueset.hxx:211
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
Definition: valueset.hxx:191
DrawFrameStyle mnFrameStyle
Definition: valueset.hxx:210
void RemoveItem(sal_uInt16 nItemId)
Definition: valueset.cxx:524
virtual bool KeyInput(const KeyEvent &rKEvt) override
Definition: valueset.cxx:293
SVT_DLLPRIVATE void ImplDrawItemText(vcl::RenderContext &rRenderContext, const OUString &rStr)
Definition: valueset.cxx:1500
bool IsColor() const
Definition: valueset.hxx:366
Image GetItemImage(sal_uInt16 nItemId) const
Definition: valueset.cxx:1951
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
Definition: valueset.cxx:110
void SetExtraSpacing(sal_uInt16 nNewSpacing)
Definition: valueset.cxx:1826
void SetItemWidth(tools::Long nItemWidth)
Definition: valueset.cxx:1772
sal_uInt16 mnCurCol
Definition: valueset.hxx:205
sal_uInt16 mnFirstLine
Definition: valueset.hxx:208
reference_type * get() const
void Insert(const tools::Polygon &rPoly, sal_uInt16 nPos=POLYPOLY_APPEND)
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
bool IsMod1() const
sal_uInt16 GetCode() const
bool IsShift() const
bool IsMod2() const
weld::DrawingArea * GetDrawingArea() const
Size const & GetOutputSizePixel() const
virtual void set_size_request(int nWidth, int nHeight)=0
virtual Size get_preferred_size() const=0
virtual bool get_direction() const=0
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_ASSERT(sCon, aError)
sal_uInt16 mnId
float y
float x
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
sal_Int64 n
constexpr sal_uInt16 KEY_RETURN
constexpr sal_uInt16 KEY_HOME
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_END
sal_uInt16 nPos
sal_Int16 nAdjust
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
RttiCompleteObjectLocator col
tools::Long const nBorder
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
Reference
int i
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
long Long
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
VCL_DLLPUBLIC void InvertFocusRect(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
sal_uIntPtr sal_uLong
std::map< OUString, OUString > aParameters
bool mbVisible
Definition: valueimp.hxx:59
void * mpData
Definition: valueimp.hxx:53
OUString maText
Definition: valueimp.hxx:52
sal_uInt16 mnId
Definition: valueimp.hxx:57
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bIsTransientChildrenDisabled)
Definition: valueacc.cxx:55
sal_uInt8 meType
Definition: valueimp.hxx:58
Color maColor
Definition: valueimp.hxx:56
Image maImage
Definition: valueimp.hxx:55
bool mbVisible
unsigned char sal_uInt8
#define VALUESET_ITEM_NONEITEM
Definition: valueimp.hxx:35
@ VALUESETITEM_COLOR
Definition: valueimp.hxx:42
@ VALUESETITEM_USERDRAW
Definition: valueimp.hxx:43
@ VALUESETITEM_NONE
Definition: valueimp.hxx:39
@ VALUESETITEM_IMAGE_AND_TEXT
Definition: valueimp.hxx:41
@ VALUESETITEM_IMAGE
Definition: valueimp.hxx:40
IMPL_LINK(ValueSet, ImplScrollHdl, weld::ScrolledWindow &, rScrollWin, void)
Definition: valueset.cxx:243
#define WB_FLATVALUESET
Definition: valueset.hxx:177
#define WB_ITEMBORDER
Definition: valueset.hxx:173
#define WB_NONEFIELD
Definition: valueset.hxx:176
#define VALUESET_ITEM_NOTFOUND
Definition: valueset.hxx:182
#define VALUESET_APPEND
Definition: valueset.hxx:181
#define WB_DOUBLEBORDER
Definition: valueset.hxx:174
#define WB_NAMEFIELD
Definition: valueset.hxx:175
#define WB_MENUSTYLEVALUESET
Definition: valueset.hxx:179
#define WB_NO_DIRECTSELECT
Definition: valueset.hxx:178
sal_Int64 WinBits
WinBits const WB_VSCROLL