LibreOffice Module vcl (master) 1
imp_listbox.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 <memory>
21
22#include <vcl/svapp.hxx>
23#include <vcl/settings.hxx>
24#include <vcl/event.hxx>
25#include <vcl/i18nhelp.hxx>
26#include <vcl/naturalsort.hxx>
29
30#include <listbox.hxx>
31#include <svdata.hxx>
32#include <window.h>
33
34#include <com/sun/star/accessibility/AccessibleRole.hpp>
35
36#include <sal/log.hxx>
37#include <o3tl/safeint.hxx>
38#include <o3tl/string_view.hxx>
39#include <osl/diagnose.h>
40#include <comphelper/string.hxx>
42
43#include <limits>
44
45#define MULTILINE_ENTRY_DRAW_FLAGS ( DrawTextFlags::WordBreak | DrawTextFlags::MultiLine | DrawTextFlags::VCenter )
46
47using namespace ::com::sun::star;
48
49constexpr tools::Long gnBorder = 1;
50
52{
54
57 pButton->SetBackground();
58}
59
61{
62 mpWindow = pWindow;
65 mnImages = 0;
67
68 mnMRUCount = 0;
69 mnMaxMRUCount = 0;
70}
71
73{
74 Clear();
75}
76
78{
79 mnImages = 0;
80 maEntries.clear();
81}
82
84{
85 Clear();
87}
88
89void ImplEntryList::SelectEntry( sal_Int32 nPos, bool bSelect )
90{
91 if (0 <= nPos && o3tl::make_unsigned(nPos) < maEntries.size())
92 {
93 std::vector<std::unique_ptr<ImplEntryType> >::iterator iter = maEntries.begin()+nPos;
94
95 if ( ( (*iter)->mbIsSelected != bSelect ) &&
97 {
98 (*iter)->mbIsSelected = bSelect;
101 }
102 }
103}
104
105namespace
106{
108 {
110 ::comphelper::getProcessComponentContext(),
111 Application::GetSettings().GetLanguageTag().getLocale());
112 return gSorter;
113 };
114}
115
116namespace vcl
117{
118 sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB)
119 {
120 const comphelper::string::NaturalStringSorter &rSorter = GetSorter();
121 return rSorter.compare(rA, rB);
122 }
123}
124
125sal_Int32 ImplEntryList::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort )
126{
127 assert(nPos >= 0);
128 assert(maEntries.size() < LISTBOX_MAX_ENTRIES);
129
130 if ( !!pNewEntry->maImage )
131 mnImages++;
132
133 sal_Int32 insPos = 0;
134 const sal_Int32 nEntriesSize = static_cast<sal_Int32>(maEntries.size());
135
136 if ( !bSort || maEntries.empty())
137 {
138 if (0 <= nPos && nPos < nEntriesSize)
139 {
140 insPos = nPos;
141 maEntries.insert( maEntries.begin() + nPos, std::unique_ptr<ImplEntryType>(pNewEntry) );
142 }
143 else
144 {
145 insPos = nEntriesSize;
146 maEntries.push_back(std::unique_ptr<ImplEntryType>(pNewEntry));
147 }
148 }
149 else
150 {
151 const comphelper::string::NaturalStringSorter &rSorter = GetSorter();
152
153 const OUString& rStr = pNewEntry->maStr;
154
155 ImplEntryType* pTemp = GetEntry( nEntriesSize-1 );
156
157 try
158 {
159 sal_Int32 nComp = rSorter.compare(rStr, pTemp->maStr);
160
161 // fast insert for sorted data
162 if ( nComp >= 0 )
163 {
164 insPos = nEntriesSize;
165 maEntries.push_back(std::unique_ptr<ImplEntryType>(pNewEntry));
166 }
167 else
168 {
169 pTemp = GetEntry( mnMRUCount );
170
171 nComp = rSorter.compare(rStr, pTemp->maStr);
172 if ( nComp <= 0 )
173 {
174 insPos = 0;
175 maEntries.insert(maEntries.begin(), std::unique_ptr<ImplEntryType>(pNewEntry));
176 }
177 else
178 {
179 sal_uLong nLow = mnMRUCount;
180 sal_uLong nHigh = maEntries.size()-1;
181 sal_Int32 nMid;
182
183 // binary search
184 do
185 {
186 nMid = static_cast<sal_Int32>((nLow + nHigh) / 2);
187 pTemp = GetEntry( nMid );
188
189 nComp = rSorter.compare(rStr, pTemp->maStr);
190
191 if ( nComp < 0 )
192 nHigh = nMid-1;
193 else
194 {
195 if ( nComp > 0 )
196 nLow = nMid + 1;
197 else
198 break;
199 }
200 }
201 while ( nLow <= nHigh );
202
203 if ( nComp >= 0 )
204 nMid++;
205
206 insPos = nMid;
207 maEntries.insert(maEntries.begin()+nMid, std::unique_ptr<ImplEntryType>(pNewEntry));
208 }
209 }
210 }
211 catch (uno::RuntimeException& )
212 {
213 // XXX this is arguable, if the exception occurred because pNewEntry is
214 // garbage you wouldn't insert it. If the exception occurred because the
215 // Collator implementation is garbage then give the user a chance to see
216 // his stuff
217 insPos = 0;
218 maEntries.insert(maEntries.begin(), std::unique_ptr<ImplEntryType>(pNewEntry));
219 }
220
221 }
222
223 return insPos;
224}
225
226void ImplEntryList::RemoveEntry( sal_Int32 nPos )
227{
228 if (0 <= nPos && o3tl::make_unsigned(nPos) < maEntries.size())
229 {
230 std::vector<std::unique_ptr<ImplEntryType> >::iterator iter = maEntries.begin()+ nPos;
231
232 if ( !!(*iter)->maImage )
233 mnImages--;
234
235 maEntries.erase(iter);
236 }
237}
238
239sal_Int32 ImplEntryList::FindEntry( std::u16string_view rString, bool bSearchMRUArea ) const
240{
241 const sal_Int32 nEntries = static_cast<sal_Int32>(maEntries.size());
242 for ( sal_Int32 n = bSearchMRUArea ? 0 : GetMRUCount(); n < nEntries; n++ )
243 {
244 OUString aComp( vcl::I18nHelper::filterFormattingChars( maEntries[n]->maStr ) );
245 if ( aComp == rString )
246 return n;
247 }
249}
250
251sal_Int32 ImplEntryList::FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const
252{
253 sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND;
254 sal_Int32 nEntryCount = GetEntryCount();
255
257 for ( sal_Int32 n = nStart; n < nEntryCount; )
258 {
259 ImplEntryType* pImplEntry = GetEntry( n );
260 bool bMatch;
261 if ( bLazy )
262 {
263 bMatch = rI18nHelper.MatchString( rStr, pImplEntry->maStr );
264 }
265 else
266 {
267 bMatch = pImplEntry->maStr.startsWith(rStr);
268 }
269 if ( bMatch )
270 {
271 nPos = n;
272 break;
273 }
274
275 n++;
276 }
277
278 return nPos;
279}
280
281tools::Long ImplEntryList::GetAddedHeight( sal_Int32 i_nEndIndex, sal_Int32 i_nBeginIndex ) const
282{
283 tools::Long nHeight = 0;
284 sal_Int32 nStart = std::min(i_nEndIndex, i_nBeginIndex);
285 sal_Int32 nStop = std::max(i_nEndIndex, i_nBeginIndex);
286 sal_Int32 nEntryCount = GetEntryCount();
287 if( 0 <= nStop && nStop != LISTBOX_ENTRY_NOTFOUND && nEntryCount != 0 )
288 {
289 // sanity check
290 if( nStop > nEntryCount-1 )
291 nStop = nEntryCount-1;
292 if (nStart < 0)
293 nStart = 0;
294 else if( nStart > nEntryCount-1 )
295 nStart = nEntryCount-1;
296
297 sal_Int32 nIndex = nStart;
298 while( nIndex != LISTBOX_ENTRY_NOTFOUND && nIndex < nStop )
299 {
301 if (nHeight > ::std::numeric_limits<tools::Long>::max() - nPosHeight)
302 {
303 SAL_WARN( "vcl", "ImplEntryList::GetAddedHeight: truncated");
304 break;
305 }
306 nHeight += nPosHeight;
307 nIndex++;
308 }
309 }
310 else
311 nHeight = 0;
312 return i_nEndIndex > i_nBeginIndex ? nHeight : -nHeight;
313}
314
316{
317 ImplEntryType* pImplEntry = GetEntry( nPos );
318 return pImplEntry ? pImplEntry->getHeightWithMargin() : 0;
319}
320
321OUString ImplEntryList::GetEntryText( sal_Int32 nPos ) const
322{
323 OUString aEntryText;
324 ImplEntryType* pImplEntry = GetEntry( nPos );
325 if ( pImplEntry )
326 aEntryText = pImplEntry->maStr;
327 return aEntryText;
328}
329
330bool ImplEntryList::HasEntryImage( sal_Int32 nPos ) const
331{
332 bool bImage = false;
333 ImplEntryType* pImplEntry = GetEntry( nPos );
334 if ( pImplEntry )
335 bImage = !!pImplEntry->maImage;
336 return bImage;
337}
338
339Image ImplEntryList::GetEntryImage( sal_Int32 nPos ) const
340{
341 Image aImage;
342 ImplEntryType* pImplEntry = GetEntry( nPos );
343 if ( pImplEntry )
344 aImage = pImplEntry->maImage;
345 return aImage;
346}
347
348void ImplEntryList::SetEntryData( sal_Int32 nPos, void* pNewData )
349{
350 ImplEntryType* pImplEntry = GetEntry( nPos );
351 if ( pImplEntry )
352 pImplEntry->mpUserData = pNewData;
353}
354
355void* ImplEntryList::GetEntryData( sal_Int32 nPos ) const
356{
357 ImplEntryType* pImplEntry = GetEntry( nPos );
358 return pImplEntry ? pImplEntry->mpUserData : nullptr;
359}
360
362{
363 ImplEntryType* pImplEntry = GetEntry( nPos );
364 if ( pImplEntry )
365 pImplEntry->mnFlags = nFlags;
366}
367
369{
370 sal_Int32 nSelCount = 0;
371 for ( sal_Int32 n = GetEntryCount(); n; )
372 {
373 ImplEntryType* pImplEntry = GetEntry( --n );
374 if ( pImplEntry->mbIsSelected )
375 nSelCount++;
376 }
377 return nSelCount;
378}
379
380OUString ImplEntryList::GetSelectedEntry( sal_Int32 nIndex ) const
381{
383}
384
385sal_Int32 ImplEntryList::GetSelectedEntryPos( sal_Int32 nIndex ) const
386{
387 sal_Int32 nSelEntryPos = LISTBOX_ENTRY_NOTFOUND;
388 sal_Int32 nSel = 0;
389 sal_Int32 nEntryCount = GetEntryCount();
390
391 for ( sal_Int32 n = 0; n < nEntryCount; n++ )
392 {
393 ImplEntryType* pImplEntry = GetEntry( n );
394 if ( pImplEntry->mbIsSelected )
395 {
396 if ( nSel == nIndex )
397 {
398 nSelEntryPos = n;
399 break;
400 }
401 nSel++;
402 }
403 }
404
405 return nSelEntryPos;
406}
407
408bool ImplEntryList::IsEntryPosSelected( sal_Int32 nIndex ) const
409{
410 ImplEntryType* pImplEntry = GetEntry( nIndex );
411 return pImplEntry && pImplEntry->mbIsSelected;
412}
413
414bool ImplEntryList::IsEntrySelectable( sal_Int32 nPos ) const
415{
416 ImplEntryType* pImplEntry = GetEntry( nPos );
417 return pImplEntry == nullptr || ((pImplEntry->mnFlags & ListBoxEntryFlags::DisableSelection) == ListBoxEntryFlags::NONE);
418}
419
420sal_Int32 ImplEntryList::FindFirstSelectable( sal_Int32 nPos, bool bForward /* = true */ ) const
421{
422 if( IsEntrySelectable( nPos ) )
423 return nPos;
424
425 if( bForward )
426 {
427 for( nPos = nPos + 1; nPos < GetEntryCount(); nPos++ )
428 {
429 if( IsEntrySelectable( nPos ) )
430 return nPos;
431 }
432 }
433 else
434 {
435 while( nPos )
436 {
437 nPos--;
438 if( IsEntrySelectable( nPos ) )
439 return nPos;
440 }
441 }
442
444}
445
447 Control( pParent, 0 ),
448 maEntryList( this ),
449 maQuickSelectionEngine( *this )
450{
451
452 mnTop = 0;
453 mnLeft = 0;
456 mbTrack = false;
457 mbTravelSelect = false;
458 mbTrackingSelect = false;
459 mbSelectionChanged = false;
460 mbMouseMoveSelect = false;
461 mbMulti = false;
462 mbGrabFocus = false;
463 mbUserDrawEnabled = false;
464 mbInUserDraw = false;
465 mbReadOnly = false;
466 mbHasFocusRect = false;
467 mbRight = ( nWinStyle & WB_RIGHT );
468 mbCenter = ( nWinStyle & WB_CENTER );
469 mbSimpleMode = ( nWinStyle & WB_SIMPLEMODE );
470 mbSort = ( nWinStyle & WB_SORT );
471 mbIsDropdown = ( nWinStyle & WB_DROPDOWN );
472 mbEdgeBlending = false;
473
476
479 SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
480
483}
484
486{
487 disposeOnce();
488}
489
491{
494}
495
497{
498 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
499
500 ApplyControlFont(rRenderContext, rStyleSettings.GetFieldFont());
501 ApplyControlForeground(rRenderContext, rStyleSettings.GetListBoxWindowTextColor());
502
504 rRenderContext.SetBackground(GetControlBackground());
505 else
506 rRenderContext.SetBackground(rStyleSettings.GetListBoxWindowBackgroundColor());
507}
508
510{
511 mnMaxWidth = 0;
512 mnMaxTxtWidth = 0;
513 mnMaxImgWidth = 0;
515 mnMaxImgHeight = 0;
516
517 mnTextHeight = static_cast<sal_uInt16>(GetTextHeight());
520
522 mnMaxHeight = static_cast<sal_uInt16>(maUserItemSize.Height());
524 mnMaxWidth= static_cast<sal_uInt16>(maUserItemSize.Width());
525
526 for ( sal_Int32 n = maEntryList.GetEntryCount(); n; )
527 {
529 ImplUpdateEntryMetrics( *pEntry );
530 }
531
533 {
535 maFocusRect.SetSize( aSz );
536 }
537}
538
540{
542
544 mnMaxWidth = 0;
545 mnMaxTxtWidth = 0;
547 mnMaxImgWidth = 0;
548 mnMaxImgHeight = 0;
549 mnTop = 0;
550 mnLeft = 0;
552
555
556 Invalidate();
557}
558
560{
562 maUserItemSize = rSz;
564}
565
566namespace {
567
568struct ImplEntryMetrics
569{
570 bool bText;
571 bool bImage;
572 tools::Long nEntryWidth;
573 tools::Long nEntryHeight;
574 tools::Long nTextWidth;
575 tools::Long nImgWidth;
576 tools::Long nImgHeight;
577};
578
579}
580
582{
584}
585
587{
588 if (maStrGlyphs.IsValid())
589 // Use pre-calculated result.
590 return &maStrGlyphs;
591
592 std::unique_ptr<SalLayout> pLayout = pOutputDevice->ImplLayout(
593 maStr, 0, maStr.getLength(), Point(0, 0), 0, {}, {}, SalLayoutFlags::GlyphItemsOnly);
594 if (!pLayout)
595 return nullptr;
596
597 // Remember the calculation result.
598 maStrGlyphs = pLayout->GetGlyphs();
599
600 return &maStrGlyphs;
601}
602
604{
605 ImplEntryMetrics aMetrics;
606 aMetrics.bText = !rEntry.maStr.isEmpty();
607 aMetrics.bImage = !!rEntry.maImage;
608 aMetrics.nEntryWidth = 0;
609 aMetrics.nEntryHeight = 0;
610 aMetrics.nTextWidth = 0;
611 aMetrics.nImgWidth = 0;
612 aMetrics.nImgHeight = 0;
613
614 if ( aMetrics.bText )
615 {
617 {
618 // multiline case
619 Size aCurSize( PixelToLogic( GetSizePixel() ) );
620 // set the current size to a large number
621 // GetTextRect should shrink it to the actual size
622 aCurSize.setHeight( 0x7fffff );
623 tools::Rectangle aTextRect( Point( 0, 0 ), aCurSize );
624 aTextRect = GetTextRect( aTextRect, rEntry.maStr, DrawTextFlags::WordBreak | DrawTextFlags::MultiLine );
625 aMetrics.nTextWidth = aTextRect.GetWidth();
626 if( aMetrics.nTextWidth > mnMaxTxtWidth )
627 mnMaxTxtWidth = aMetrics.nTextWidth;
628 aMetrics.nEntryWidth = mnMaxTxtWidth;
629 aMetrics.nEntryHeight = aTextRect.GetHeight() + gnBorder;
630 }
631 else
632 {
633 // normal single line case
634 const SalLayoutGlyphs* pGlyphs = rEntry.GetTextGlyphs(GetOutDev());
635 aMetrics.nTextWidth
636 = static_cast<sal_uInt16>(GetTextWidth(rEntry.maStr, 0, -1, nullptr, pGlyphs));
637 if( aMetrics.nTextWidth > mnMaxTxtWidth )
638 mnMaxTxtWidth = aMetrics.nTextWidth;
639 aMetrics.nEntryWidth = mnMaxTxtWidth;
640 aMetrics.nEntryHeight = mnTextHeight + gnBorder;
641 }
642 }
643 if ( aMetrics.bImage )
644 {
645 Size aImgSz = rEntry.maImage.GetSizePixel();
646 aMetrics.nImgWidth = static_cast<sal_uInt16>(CalcZoom( aImgSz.Width() ));
647 aMetrics.nImgHeight = static_cast<sal_uInt16>(CalcZoom( aImgSz.Height() ));
648
649 if( aMetrics.nImgWidth > mnMaxImgWidth )
650 mnMaxImgWidth = aMetrics.nImgWidth;
651 if( aMetrics.nImgHeight > mnMaxImgHeight )
652 mnMaxImgHeight = aMetrics.nImgHeight;
653
654 mnMaxImgTxtWidth = std::max( mnMaxImgTxtWidth, aMetrics.nTextWidth );
655 aMetrics.nEntryHeight = std::max( aMetrics.nImgHeight, aMetrics.nEntryHeight );
656
657 }
658
659 bool bIsUserDrawEnabled = IsUserDrawEnabled();
660 if (bIsUserDrawEnabled || aMetrics.bImage)
661 {
662 aMetrics.nEntryWidth = std::max( aMetrics.nImgWidth, maUserItemSize.Width() );
663 if (!bIsUserDrawEnabled && aMetrics.bText)
664 aMetrics.nEntryWidth += aMetrics.nTextWidth + IMG_TXT_DISTANCE;
665 aMetrics.nEntryHeight = std::max( std::max( mnMaxImgHeight, maUserItemSize.Height() ) + 2,
666 aMetrics.nEntryHeight );
667 }
668
669 if (!aMetrics.bText && !aMetrics.bImage && !bIsUserDrawEnabled)
670 {
671 // entries which have no (aka an empty) text, and no image,
672 // and are not user-drawn, should be shown nonetheless
673 aMetrics.nEntryHeight = mnTextHeight + gnBorder;
674 }
675
676 if ( aMetrics.nEntryWidth > mnMaxWidth )
677 mnMaxWidth = aMetrics.nEntryWidth;
678 if ( aMetrics.nEntryHeight > mnMaxHeight )
679 mnMaxHeight = aMetrics.nEntryHeight;
680
681 rEntry.mnHeight = aMetrics.nEntryHeight;
682}
683
685{
686 if ( !IsTravelSelect() && GetEntryList().GetMaxMRUCount() )
687 {
688 // Insert the selected entry as MRU, if not already first MRU
689 sal_Int32 nSelected = GetEntryList().GetSelectedEntryPos( 0 );
690 sal_Int32 nMRUCount = GetEntryList().GetMRUCount();
691 OUString aSelected = GetEntryList().GetEntryText( nSelected );
692 sal_Int32 nFirstMatchingEntryPos = GetEntryList().FindEntry( aSelected, true );
693 if ( nFirstMatchingEntryPos || !nMRUCount )
694 {
695 bool bSelectNewEntry = false;
696 if ( nFirstMatchingEntryPos < nMRUCount )
697 {
698 RemoveEntry( nFirstMatchingEntryPos );
699 nMRUCount--;
700 if ( nFirstMatchingEntryPos == nSelected )
701 bSelectNewEntry = true;
702 }
703 else if ( nMRUCount == GetEntryList().GetMaxMRUCount() )
704 {
705 RemoveEntry( nMRUCount - 1 );
706 nMRUCount--;
707 }
708
710
711 ImplEntryType* pNewEntry = new ImplEntryType( aSelected );
712 pNewEntry->mbIsSelected = bSelectNewEntry;
713 GetEntryList().InsertEntry( 0, pNewEntry, false );
714 ImplUpdateEntryMetrics( *pNewEntry );
715 GetEntryList().SetMRUCount( ++nMRUCount );
716 SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
717 maMRUChangedHdl.Call( nullptr );
718 }
719 }
720
721 maSelectHdl.Call( nullptr );
722 mbSelectionChanged = false;
723}
724
725sal_Int32 ImplListBoxWindow::InsertEntry(sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort)
726{
727 assert(nPos >= 0);
729
731 sal_Int32 nNewPos = maEntryList.InsertEntry( nPos, pNewEntry, bSort );
732
733 if( GetStyle() & WB_WORDBREAK )
735
736 ImplUpdateEntryMetrics( *pNewEntry );
737 return nNewPos;
738}
739
740sal_Int32 ImplListBoxWindow::InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry )
741{
742 return InsertEntry(nPos, pNewEntry, mbSort);
743}
744
745void ImplListBoxWindow::RemoveEntry( sal_Int32 nPos )
746{
752}
753
755{
756 maEntryList.SetEntryFlags( nPos, nFlags );
758 if( pEntry )
759 ImplUpdateEntryMetrics( *pEntry );
760}
761
763{
764 if ( mbHasFocusRect )
765 HideFocus();
767 mbHasFocusRect = true;
768}
769
771{
772 if ( mbHasFocusRect )
773 {
774 HideFocus();
775 mbHasFocusRect = false;
776 }
777}
778
779sal_Int32 ImplListBoxWindow::GetEntryPosForPoint( const Point& rPoint ) const
780{
782
783 sal_Int32 nSelect = mnTop;
784 const ImplEntryType* pEntry = maEntryList.GetEntryPtr( nSelect );
785 while (pEntry)
786 {
787 tools::Long nEntryHeight = pEntry->getHeightWithMargin();
788 if (rPoint.Y() <= nEntryHeight + nY)
789 break;
790 nY += nEntryHeight;
791 pEntry = maEntryList.GetEntryPtr( ++nSelect );
792 }
793 if( pEntry == nullptr )
794 nSelect = LISTBOX_ENTRY_NOTFOUND;
795
796 return nSelect;
797}
798
799bool ImplListBoxWindow::IsVisible( sal_Int32 i_nEntry ) const
800{
801 bool bRet = false;
802
803 if( i_nEntry >= mnTop )
804 {
805 if( maEntryList.GetAddedHeight( i_nEntry, mnTop ) <
807 {
808 bRet = true;
809 }
810 }
811
812 return bRet;
813}
814
816{
818 return mnMaxHeight + nMargin;
819}
820
822{
823 sal_Int32 nPos = mnTop;
824 tools::Long nWindowHeight = GetSizePixel().Height();
825 sal_Int32 nCount = maEntryList.GetEntryCount();
826 tools::Long nDiff;
827 for( nDiff = 0; nDiff < nWindowHeight && nPos < nCount; nDiff = maEntryList.GetAddedHeight( nPos, mnTop ) )
828 nPos++;
829
830 if( nDiff > nWindowHeight && nPos > mnTop )
831 nPos--;
832
833 if( nPos >= nCount )
834 nPos = nCount-1;
835
836 return nPos;
837}
838
840{
841 mbMouseMoveSelect = false; // only till the first MouseButtonDown
843
844 if ( !IsReadOnly() )
845 {
846 if( rMEvt.GetClicks() == 1 )
847 {
848 sal_Int32 nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() );
849 if( nSelect != LISTBOX_ENTRY_NOTFOUND )
850 {
851 if ( !mbMulti && GetEntryList().GetSelectedEntryCount() )
853 else
855
856 mnCurrentPos = nSelect;
857 mbTrackingSelect = true;
858 bool bCurPosChange = (mnCurrentPos != nSelect);
859 (void)SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() ,bCurPosChange);
860 mbTrackingSelect = false;
861 if ( mbGrabFocus )
862 GrabFocus();
863
865 }
866 }
867 if( rMEvt.GetClicks() == 2 )
868 {
869 maDoubleClickHdl.Call( this );
870 }
871 }
872 else // if ( mbGrabFocus )
873 {
874 GrabFocus();
875 }
876}
877
879{
881 return;
882
884 if( !aRect.Contains( rMEvt.GetPosPixel() ) )
885 return;
886
887 if ( IsMouseMoveSelect() )
888 {
889 sal_Int32 nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() );
890 if( nSelect == LISTBOX_ENTRY_NOTFOUND )
891 nSelect = maEntryList.GetEntryCount() - 1;
892 nSelect = std::min( nSelect, GetLastVisibleEntry() );
893 nSelect = std::min( nSelect, static_cast<sal_Int32>( maEntryList.GetEntryCount() - 1 ) );
894 // Select only visible Entries with MouseMove, otherwise Tracking...
895 if ( IsVisible( nSelect ) &&
896 maEntryList.IsEntrySelectable( nSelect ) &&
897 ( ( nSelect != mnCurrentPos ) || !GetEntryList().GetSelectedEntryCount() || ( nSelect != GetEntryList().GetSelectedEntryPos( 0 ) ) ) )
898 {
899 mbTrackingSelect = true;
900 if ( SelectEntries( nSelect, LET_TRACKING ) )
901 {
902 // When list box selection change by mouse move, notify
903 // VclEventId::ListboxSelect vcl event.
904 maListItemSelectHdl.Call(nullptr);
905 }
906 mbTrackingSelect = false;
907 }
908 }
909
910 // if the DD button was pressed and someone moved into the ListBox
911 // with the mouse button pressed...
912 if ( rMEvt.IsLeft() && !rMEvt.IsSynthetic() )
913 {
914 if ( !mbMulti && GetEntryList().GetSelectedEntryCount() )
916 else
918
920 }
921}
922
924{
925 while ( GetEntryList().GetSelectedEntryCount() )
926 {
927 sal_Int32 nS = GetEntryList().GetSelectedEntryPos( 0 );
928 SelectEntry( nS, false );
929 }
930}
931
932void ImplListBoxWindow::SelectEntry( sal_Int32 nPos, bool bSelect )
933{
935 return;
936
938 if( bSelect )
939 {
940 if( !mbMulti )
941 {
942 // deselect the selected entry
943 sal_Int32 nDeselect = GetEntryList().GetSelectedEntryPos( 0 );
944 if( nDeselect != LISTBOX_ENTRY_NOTFOUND )
945 {
946 //SelectEntryPos( nDeselect, false );
947 GetEntryList().SelectEntry( nDeselect, false );
948 if (IsUpdateMode() && IsReallyVisible())
949 Invalidate();
950 }
951 }
954 if ( ( nPos != LISTBOX_ENTRY_NOTFOUND ) && IsUpdateMode() )
955 {
956 Invalidate();
957 if ( !IsVisible( nPos ) )
958 {
960 sal_Int32 nVisibleEntries = GetLastVisibleEntry()-mnTop;
961 if ( !nVisibleEntries || !IsReallyVisible() || ( nPos < GetTopEntry() ) )
962 {
963 Resize();
965 }
966 else
967 {
969 }
970 }
971 }
972 }
973 else
974 {
975 maEntryList.SelectEntry( nPos, false );
976 Invalidate();
977 }
978 mbSelectionChanged = true;
979}
980
981bool ImplListBoxWindow::SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift, bool bCtrl, bool bSelectPosChange /*=FALSE*/ )
982{
983 bool bSelectionChanged = false;
984
985 if( IsEnabled() && maEntryList.IsEntrySelectable( nSelect ) )
986 {
987 bool bFocusChanged = false;
988
989 // here (Single-ListBox) only one entry can be deselected
990 if( !mbMulti )
991 {
992 sal_Int32 nDeselect = maEntryList.GetSelectedEntryPos( 0 );
993 if( nSelect != nDeselect )
994 {
995 SelectEntry( nSelect, true );
996 maEntryList.SetLastSelected( nSelect );
997 bFocusChanged = true;
998 bSelectionChanged = true;
999 }
1000 }
1001 // MultiListBox without Modifier
1002 else if( mbSimpleMode && !bCtrl && !bShift )
1003 {
1004 sal_Int32 nEntryCount = maEntryList.GetEntryCount();
1005 for ( sal_Int32 nPos = 0; nPos < nEntryCount; nPos++ )
1006 {
1007 bool bSelect = nPos == nSelect;
1008 if ( maEntryList.IsEntryPosSelected( nPos ) != bSelect )
1009 {
1010 SelectEntry( nPos, bSelect );
1011 bFocusChanged = true;
1012 bSelectionChanged = true;
1013 }
1014 }
1015 maEntryList.SetLastSelected( nSelect );
1017 }
1018 // MultiListBox only with CTRL/SHIFT or not in SimpleMode
1019 else if( ( !mbSimpleMode /* && !bShift */ ) || ( mbSimpleMode && ( bCtrl || bShift ) ) )
1020 {
1021 // Space for selection change
1022 if( !bShift && ( ( eLET == LET_KEYSPACE ) || ( eLET == LET_MBDOWN ) ) )
1023 {
1024 bool bSelect = !maEntryList.IsEntryPosSelected( nSelect );
1025 SelectEntry( nSelect, bSelect );
1026 maEntryList.SetLastSelected( nSelect );
1028 if ( !maEntryList.IsEntryPosSelected( nSelect ) )
1030 bFocusChanged = true;
1031 bSelectionChanged = true;
1032 }
1033 else if( ( ( eLET == LET_TRACKING ) && ( nSelect != mnCurrentPos ) ) ||
1034 ( bShift && ( ( eLET == LET_KEYMOVE ) || ( eLET == LET_MBDOWN ) ) ) )
1035 {
1036 mnCurrentPos = nSelect;
1037 bFocusChanged = true;
1038
1039 sal_Int32 nAnchor = maEntryList.GetSelectionAnchor();
1041 {
1043 }
1044 if( nAnchor != LISTBOX_ENTRY_NOTFOUND )
1045 {
1046 // All entries from Anchor to nSelect have to be selected
1047 sal_Int32 nStart = std::min( nSelect, nAnchor );
1048 sal_Int32 nEnd = std::max( nSelect, nAnchor );
1049 for ( sal_Int32 n = nStart; n <= nEnd; n++ )
1050 {
1052 {
1053 SelectEntry( n, true );
1054 bSelectionChanged = true;
1055 }
1056 }
1057
1058 // if appropriate some more has to be deselected...
1059 sal_Int32 nLast = maEntryList.GetLastSelected();
1060 if ( nLast != LISTBOX_ENTRY_NOTFOUND )
1061 {
1062 if ( ( nLast > nSelect ) && ( nLast > nAnchor ) )
1063 {
1064 for ( sal_Int32 n = nSelect+1; n <= nLast; n++ )
1065 {
1067 {
1068 SelectEntry( n, false );
1069 bSelectionChanged = true;
1070 }
1071 }
1072 }
1073 else if ( ( nLast < nSelect ) && ( nLast < nAnchor ) )
1074 {
1075 for ( sal_Int32 n = nLast; n < nSelect; n++ )
1076 {
1078 {
1079 SelectEntry( n, false );
1080 bSelectionChanged = true;
1081 }
1082 }
1083 }
1084 }
1085 maEntryList.SetLastSelected( nSelect );
1086 }
1087 }
1088 else if( eLET != LET_TRACKING )
1089 {
1091 Invalidate();
1092 bFocusChanged = true;
1093 }
1094 }
1095 else if( bShift )
1096 {
1097 bFocusChanged = true;
1098 }
1099
1100 if( bSelectionChanged )
1101 mbSelectionChanged = true;
1102
1103 if( bFocusChanged )
1104 {
1105 tools::Long nHeightDiff = maEntryList.GetAddedHeight( nSelect, mnTop );
1106 maFocusRect.SetPos( Point( 0, nHeightDiff ) );
1107 Size aSz( maFocusRect.GetWidth(),
1108 maEntryList.GetEntryHeight( nSelect ) );
1109 maFocusRect.SetSize( aSz );
1110 if( HasFocus() )
1112 if (bSelectPosChange)
1113 {
1114 maFocusHdl.Call(nSelect);
1115 }
1116 }
1118 }
1119 return bSelectionChanged;
1120}
1121
1123{
1125 bool bInside = aRect.Contains( rTEvt.GetMouseEvent().GetPosPixel() );
1126
1127 if( rTEvt.IsTrackingCanceled() || rTEvt.IsTrackingEnded() ) // MouseButtonUp
1128 {
1129 if ( bInside && !rTEvt.IsTrackingCanceled() )
1130 {
1133 }
1134 else
1135 {
1136 maCancelHdl.Call( nullptr );
1137 if ( !mbMulti )
1138 {
1139 mbTrackingSelect = true;
1141 mbTrackingSelect = false;
1143 {
1145 maFocusRect.SetPos( Point( 0, nHeightDiff ) );
1146 Size aSz( maFocusRect.GetWidth(),
1148 maFocusRect.SetSize( aSz );
1150 }
1151 }
1152 }
1153
1154 mbTrack = false;
1155 }
1156 else
1157 {
1158 bool bTrackOrQuickClick = mbTrack;
1159 if( !mbTrack )
1160 {
1161 if ( bInside )
1162 {
1163 mbTrack = true;
1164 }
1165
1166 // this case only happens, if the mouse button is pressed very briefly
1167 if( rTEvt.IsTrackingEnded() && mbTrack )
1168 {
1169 bTrackOrQuickClick = true;
1170 mbTrack = false;
1171 }
1172 }
1173
1174 if( bTrackOrQuickClick )
1175 {
1176 MouseEvent aMEvt = rTEvt.GetMouseEvent();
1177 Point aPt( aMEvt.GetPosPixel() );
1178 bool bShift = aMEvt.IsShift();
1179 bool bCtrl = aMEvt.IsMod1();
1180
1181 sal_Int32 nSelect = LISTBOX_ENTRY_NOTFOUND;
1182 if( aPt.Y() < 0 )
1183 {
1185 {
1186 nSelect = mnCurrentPos ? ( mnCurrentPos - 1 ) : 0;
1187 if( nSelect < mnTop )
1188 SetTopEntry( mnTop-1 );
1189 }
1190 }
1191 else if( aPt.Y() > GetOutputSizePixel().Height() )
1192 {
1194 {
1195 nSelect = std::min( static_cast<sal_Int32>(mnCurrentPos+1), static_cast<sal_Int32>(maEntryList.GetEntryCount()-1) );
1196 if( nSelect >= GetLastVisibleEntry() )
1197 SetTopEntry( mnTop+1 );
1198 }
1199 }
1200 else
1201 {
1202 nSelect = static_cast<sal_Int32>( ( aPt.Y() + gnBorder ) / mnMaxHeight ) + mnTop;
1203 nSelect = std::min( nSelect, GetLastVisibleEntry() );
1204 nSelect = std::min( nSelect, static_cast<sal_Int32>( maEntryList.GetEntryCount() - 1 ) );
1205 }
1206
1207 if ( bInside )
1208 {
1209 if ( ( nSelect != mnCurrentPos ) || !GetEntryList().GetSelectedEntryCount() )
1210 {
1211 mbTrackingSelect = true;
1212 SelectEntries(nSelect, LET_TRACKING, bShift, bCtrl);
1213 mbTrackingSelect = false;
1214 }
1215 }
1216 else
1217 {
1218 if ( !mbMulti && GetEntryList().GetSelectedEntryCount() )
1219 {
1220 mbTrackingSelect = true;
1221 SelectEntry( GetEntryList().GetSelectedEntryPos( 0 ), false );
1222 mbTrackingSelect = false;
1223 }
1224 }
1225 mnCurrentPos = nSelect;
1227 {
1229 }
1230 else
1231 {
1233 maFocusRect.SetPos( Point( 0, nHeightDiff ) );
1235 maFocusRect.SetSize( aSz );
1237 }
1238 }
1239 }
1240}
1241
1243{
1244 if( !ProcessKeyInput( rKEvt ) )
1245 Control::KeyInput( rKEvt );
1246}
1247
1249{
1250 // entry to be selected
1251 sal_Int32 nSelect = LISTBOX_ENTRY_NOTFOUND;
1253
1254 vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
1255
1256 bool bShift = aKeyCode.IsShift();
1257 bool bCtrl = aKeyCode.IsMod1() || aKeyCode.IsMod3();
1258 bool bMod2 = aKeyCode.IsMod2();
1259 bool bDone = false;
1260 bool bHandleKey = false;
1261
1262 switch( aKeyCode.GetCode() )
1263 {
1264 case KEY_UP:
1265 {
1266 if ( IsReadOnly() )
1267 {
1268 if ( GetTopEntry() )
1269 SetTopEntry( GetTopEntry()-1 );
1270 }
1271 else if ( !bMod2 )
1272 {
1274 {
1275 nSelect = maEntryList.FindFirstSelectable( 0 );
1276 }
1277 else if ( mnCurrentPos )
1278 {
1279 // search first selectable above the current position
1280 nSelect = maEntryList.FindFirstSelectable( mnCurrentPos - 1, false );
1281 }
1282
1283 if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect < mnTop ) )
1284 SetTopEntry( mnTop-1 );
1285
1286 bDone = true;
1287 }
1289 }
1290 break;
1291
1292 case KEY_DOWN:
1293 {
1294 if ( IsReadOnly() )
1295 {
1296 SetTopEntry( GetTopEntry()+1 );
1297 }
1298 else if ( !bMod2 )
1299 {
1301 {
1302 nSelect = maEntryList.FindFirstSelectable( 0 );
1303 }
1304 else if ( (mnCurrentPos+1) < maEntryList.GetEntryCount() )
1305 {
1306 // search first selectable below the current position
1308 }
1309
1310 if( ( nSelect != LISTBOX_ENTRY_NOTFOUND ) && ( nSelect >= GetLastVisibleEntry() ) )
1311 SetTopEntry( mnTop+1 );
1312
1313 bDone = true;
1314 }
1316 }
1317 break;
1318
1319 case KEY_PAGEUP:
1320 {
1321 if ( IsReadOnly() )
1322 {
1323 sal_Int32 nCurVis = GetLastVisibleEntry() - mnTop +1;
1324 SetTopEntry( ( mnTop > nCurVis ) ?
1325 (mnTop-nCurVis) : 0 );
1326 }
1327 else if ( !bCtrl && !bMod2 )
1328 {
1330 {
1331 nSelect = maEntryList.FindFirstSelectable( 0 );
1332 }
1333 else if ( mnCurrentPos )
1334 {
1335 if( mnCurrentPos == mnTop )
1336 {
1337 sal_Int32 nCurVis = GetLastVisibleEntry() - mnTop +1;
1338 SetTopEntry( ( mnTop > nCurVis ) ? ( mnTop-nCurVis+1 ) : 0 );
1339 }
1340
1341 // find first selectable starting from mnTop looking forward
1343 }
1344 bDone = true;
1345 }
1347 }
1348 break;
1349
1350 case KEY_PAGEDOWN:
1351 {
1352 if ( IsReadOnly() )
1353 {
1355 }
1356 else if ( !bCtrl && !bMod2 )
1357 {
1359 {
1360 nSelect = maEntryList.FindFirstSelectable( 0 );
1361 }
1362 else if ( (mnCurrentPos+1) < maEntryList.GetEntryCount() )
1363 {
1364 sal_Int32 nCount = maEntryList.GetEntryCount();
1365 sal_Int32 nCurVis = GetLastVisibleEntry() - mnTop;
1366 sal_Int32 nTmp = std::min( nCurVis, nCount );
1367 nTmp += mnTop - 1;
1368 if( mnCurrentPos == nTmp && mnCurrentPos != nCount - 1 )
1369 {
1370 tools::Long nTmp2 = std::min( static_cast<tools::Long>(nCount-nCurVis), static_cast<tools::Long>(static_cast<tools::Long>(mnTop)+static_cast<tools::Long>(nCurVis)-1) );
1371 nTmp2 = std::max( tools::Long(0) , nTmp2 );
1372 nTmp = static_cast<sal_Int32>(nTmp2+(nCurVis-1) );
1373 SetTopEntry( static_cast<sal_Int32>(nTmp2) );
1374 }
1375 // find first selectable starting from nTmp looking backwards
1376 nSelect = maEntryList.FindFirstSelectable( nTmp, false );
1377 }
1378 bDone = true;
1379 }
1381 }
1382 break;
1383
1384 case KEY_HOME:
1385 {
1386 if ( IsReadOnly() )
1387 {
1388 SetTopEntry( 0 );
1389 }
1390 else if ( !bCtrl && !bMod2 && mnCurrentPos )
1391 {
1393 if( mnTop != 0 )
1394 SetTopEntry( 0 );
1395
1396 bDone = true;
1397 }
1399 }
1400 break;
1401
1402 case KEY_END:
1403 {
1404 if ( IsReadOnly() )
1405 {
1406 SetTopEntry( 0xFFFF );
1407 }
1408 else if ( !bCtrl && !bMod2 )
1409 {
1411 {
1412 nSelect = maEntryList.FindFirstSelectable( 0 );
1413 }
1414 else if ( (mnCurrentPos+1) < maEntryList.GetEntryCount() )
1415 {
1416 sal_Int32 nCount = maEntryList.GetEntryCount();
1417 nSelect = maEntryList.FindFirstSelectable( nCount - 1, false );
1418 sal_Int32 nCurVis = GetLastVisibleEntry() - mnTop + 1;
1419 if( nCount > nCurVis )
1420 SetTopEntry( nCount - nCurVis );
1421 }
1422 bDone = true;
1423 }
1425 }
1426 break;
1427
1428 case KEY_LEFT:
1429 {
1430 if ( !bCtrl && !bMod2 )
1431 {
1433 bDone = true;
1434 }
1436 }
1437 break;
1438
1439 case KEY_RIGHT:
1440 {
1441 if ( !bCtrl && !bMod2 )
1442 {
1444 bDone = true;
1445 }
1447 }
1448 break;
1449
1450 case KEY_RETURN:
1451 {
1452 if ( !bMod2 && !IsReadOnly() )
1453 {
1456 bDone = false; // do not catch RETURN
1457 }
1459 }
1460 break;
1461
1462 case KEY_SPACE:
1463 {
1464 if ( !bMod2 && !IsReadOnly() )
1465 {
1466 if( mbMulti && ( !mbSimpleMode || ( mbSimpleMode && bCtrl && !bShift ) ) )
1467 {
1468 nSelect = mnCurrentPos;
1469 eLET = LET_KEYSPACE;
1470 }
1471 bDone = true;
1472 }
1473 bHandleKey = true;
1474 }
1475 break;
1476
1477 case KEY_A:
1478 {
1479 if( bCtrl && mbMulti )
1480 {
1481 // paint only once
1482 bool bUpdates = IsUpdateMode();
1483 SetUpdateMode( false );
1484
1485 sal_Int32 nEntryCount = maEntryList.GetEntryCount();
1486 for( sal_Int32 i = 0; i < nEntryCount; i++ )
1487 SelectEntry( i, true );
1488
1489 // tdf#97066 - Update selected items
1491
1492 // restore update mode
1493 SetUpdateMode( bUpdates );
1494 Invalidate();
1495
1497
1498 bDone = true;
1499 }
1500 else
1501 {
1502 bHandleKey = true;
1503 }
1504 }
1505 break;
1506
1507 default:
1508 bHandleKey = true;
1509 break;
1510 }
1511 if (bHandleKey && !IsReadOnly())
1512 {
1513 bDone = maQuickSelectionEngine.HandleKeyEvent( rKEvt );
1514 }
1515
1516 if ( ( nSelect != LISTBOX_ENTRY_NOTFOUND )
1517 && ( ( !maEntryList.IsEntryPosSelected( nSelect ) )
1518 || ( eLET == LET_KEYSPACE )
1519 )
1520 )
1521 {
1522 SAL_WARN_IF( maEntryList.IsEntryPosSelected( nSelect ) && !mbMulti, "vcl", "ImplListBox: Selecting same Entry" );
1523 sal_Int32 nCount = maEntryList.GetEntryCount();
1524 if (nSelect >= nCount)
1525 nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
1526 bool bCurPosChange = (mnCurrentPos != nSelect);
1527 mnCurrentPos = nSelect;
1528 if(SelectEntries( nSelect, eLET, bShift, bCtrl, bCurPosChange))
1529 {
1530 // tdf#129043 Correctly deliver events when changing values with arrow keys in combobox
1532 mbTravelSelect = true;
1535 mbTravelSelect = false;
1536 }
1537 }
1538
1539 return bDone;
1540}
1541
1542namespace
1543{
1544 vcl::StringEntryIdentifier lcl_getEntry( const ImplEntryList& _rList, sal_Int32 _nPos, OUString& _out_entryText )
1545 {
1546 OSL_PRECOND( ( _nPos != LISTBOX_ENTRY_NOTFOUND ), "lcl_getEntry: invalid position!" );
1547 sal_Int32 nEntryCount( _rList.GetEntryCount() );
1548 if ( _nPos >= nEntryCount )
1549 _nPos = 0;
1550 _out_entryText = _rList.GetEntryText( _nPos );
1551
1552 // vcl::StringEntryIdentifier does not allow for 0 values, but our position is 0-based
1553 // => normalize
1554 return reinterpret_cast< vcl::StringEntryIdentifier >( _nPos + 1 );
1555 }
1556
1557 sal_Int32 lcl_getEntryPos( vcl::StringEntryIdentifier _entry )
1558 {
1559 // our pos is 0-based, but StringEntryIdentifier does not allow for a NULL
1560 return static_cast< sal_Int32 >( reinterpret_cast< sal_Int64 >( _entry ) ) - 1;
1561 }
1562}
1563
1565{
1566 return lcl_getEntry( GetEntryList(), ( mnCurrentPos == LISTBOX_ENTRY_NOTFOUND ) ? 0 : mnCurrentPos, _out_entryText );
1567}
1568
1570{
1571 sal_Int32 nNextPos = lcl_getEntryPos( _currentEntry ) + 1;
1572 return lcl_getEntry( GetEntryList(), nNextPos, _out_entryText );
1573}
1574
1576{
1577 sal_Int32 nSelect = lcl_getEntryPos( _entry );
1578 if ( maEntryList.IsEntryPosSelected( nSelect ) )
1579 {
1580 // ignore that. This method is a callback from the QuickSelectionEngine, which means the user attempted
1581 // to select the given entry by typing its starting letters. No need to act.
1582 return;
1583 }
1584
1585 // normalize
1586 OSL_ENSURE( nSelect < maEntryList.GetEntryCount(), "ImplListBoxWindow::SelectEntry: how that?" );
1587 sal_Int32 nCount = maEntryList.GetEntryCount();
1588 if (nSelect >= nCount)
1589 nSelect = nCount ? nCount-1 : LISTBOX_ENTRY_NOTFOUND;
1590
1591 // make visible
1592 ShowProminentEntry( nSelect );
1593
1594 // actually select
1595 mnCurrentPos = nSelect;
1596 if ( SelectEntries( nSelect, LET_KEYMOVE ) )
1597 {
1598 mbTravelSelect = true;
1599 mnSelectModifier = 0;
1601 mbTravelSelect = false;
1602 }
1603}
1604
1605void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos)
1606{
1607 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
1608
1609 const ImplEntryType* pEntry = maEntryList.GetEntryPtr( nPos );
1610 if (!pEntry)
1611 return;
1612
1615 tools::Rectangle aRect(Point(0, nY), Size(nWidth, pEntry->getHeightWithMargin()));
1616
1617 bool bSelected = maEntryList.IsEntryPosSelected(nPos);
1618 if (bSelected)
1619 {
1620 rRenderContext.SetTextColor(!IsEnabled() ? rStyleSettings.GetDisableColor() : rStyleSettings.GetListBoxWindowHighlightTextColor());
1621 rRenderContext.SetFillColor(rStyleSettings.GetListBoxWindowHighlightColor());
1622 rRenderContext.SetLineColor();
1623 rRenderContext.DrawRect(aRect);
1624 }
1625 else
1626 {
1627 ApplySettings(rRenderContext);
1628 if (!IsEnabled())
1629 rRenderContext.SetTextColor(rStyleSettings.GetDisableColor());
1630 }
1631 rRenderContext.SetTextFillColor();
1632
1633 if (IsUserDrawEnabled())
1634 {
1635 mbInUserDraw = true;
1637 aRect.AdjustLeft( -mnLeft );
1638 if (nPos < GetEntryList().GetMRUCount())
1639 nPos = GetEntryList().FindEntry(GetEntryList().GetEntryText(nPos));
1641
1642 UserDrawEvent aUDEvt(&rRenderContext, aRect, nPos, bSelected);
1643 maUserDrawHdl.Call( &aUDEvt );
1644 mbInUserDraw = false;
1645 }
1646 else
1647 {
1648 DrawEntry(rRenderContext, nPos, true, true);
1649 }
1650}
1651
1652void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText)
1653{
1654 const ImplEntryType* pEntry = maEntryList.GetEntryPtr(nPos);
1655 if (!pEntry)
1656 return;
1657
1658 tools::Long nEntryHeight = pEntry->getHeightWithMargin();
1659
1660 // when changing this function don't forget to adjust ImplWin::DrawEntry()
1661
1662 if (mbInUserDraw)
1663 nPos = mnUserDrawEntry; // real entry, not the matching entry from MRU
1664
1666
1667 if (bDrawImage && maEntryList.HasImages())
1668 {
1670 if (!!aImage)
1671 {
1672 Size aImgSz = aImage.GetSizePixel();
1673 Point aPtImg(gnBorder - mnLeft, nY + ((nEntryHeight - aImgSz.Height()) / 2));
1674
1675 if (!IsZoom())
1676 {
1677 rRenderContext.DrawImage(aPtImg, aImage);
1678 }
1679 else
1680 {
1681 aImgSz.setWidth( CalcZoom(aImgSz.Width()) );
1682 aImgSz.setHeight( CalcZoom(aImgSz.Height()) );
1683 rRenderContext.DrawImage(aPtImg, aImgSz, aImage);
1684 }
1685
1686 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1687 const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
1688
1689 if (nEdgeBlendingPercent && aImgSz.Width() && aImgSz.Height())
1690 {
1691 const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
1692 const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
1693 const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
1694 const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
1695
1696 if (!aBlendFrame.IsEmpty())
1697 {
1698 rRenderContext.DrawBitmapEx(aPtImg, aBlendFrame);
1699 }
1700 }
1701 }
1702 }
1703
1704 if (bDrawText)
1705 {
1706 OUString aStr(maEntryList.GetEntryText(nPos));
1707 if (!aStr.isEmpty())
1708 {
1709 tools::Long nMaxWidth = std::max(mnMaxWidth, GetOutputSizePixel().Width() - 2 * gnBorder);
1710 // a multiline entry should only be as wide as the window
1712 nMaxWidth = GetOutputSizePixel().Width() - 2 * gnBorder;
1713
1714 tools::Rectangle aTextRect(Point(gnBorder - mnLeft, nY),
1715 Size(nMaxWidth, nEntryHeight));
1716
1718 {
1719 tools::Long nImageWidth = std::max(mnMaxImgWidth, maUserItemSize.Width());
1720 aTextRect.AdjustLeft(nImageWidth + IMG_TXT_DISTANCE );
1721 }
1722
1723 DrawTextFlags nDrawStyle = ImplGetTextStyle();
1725 nDrawStyle |= MULTILINE_ENTRY_DRAW_FLAGS;
1727 nDrawStyle |= DrawTextFlags::Disable;
1728
1729 rRenderContext.DrawText(aTextRect, aStr, nDrawStyle);
1730 }
1731 }
1732
1733 if ( !maSeparators.empty() && ( isSeparator(nPos) || isSeparator(nPos-1) ) )
1734 {
1735 Color aOldLineColor(rRenderContext.GetLineColor());
1737 Point aStartPos(0, nY);
1738 if (isSeparator(nPos))
1739 aStartPos.AdjustY(pEntry->getHeightWithMargin() - 1 );
1740 Point aEndPos(aStartPos);
1741 aEndPos.setX( GetOutputSizePixel().Width() );
1742 rRenderContext.DrawLine(aStartPos, aEndPos);
1743 rRenderContext.SetLineColor(aOldLineColor);
1744 }
1745}
1746
1748{
1749 mxLayoutData.emplace();
1750 const_cast<ImplListBoxWindow*>(this)->Invalidate(tools::Rectangle(Point(0, 0), GetOutDev()->GetOutputSize()));
1751}
1752
1754{
1755 sal_Int32 nCount = maEntryList.GetEntryCount();
1756
1757 bool bShowFocusRect = mbHasFocusRect;
1758 if (mbHasFocusRect)
1760
1761 tools::Long nY = 0; // + gnBorder;
1762 tools::Long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + gnBorder;
1763
1764 for (sal_Int32 i = mnTop; i < nCount && nY < nHeight + mnMaxHeight; i++)
1765 {
1766 const ImplEntryType* pEntry = maEntryList.GetEntryPtr(i);
1767 tools::Long nEntryHeight = pEntry->getHeightWithMargin();
1768 if (nY + nEntryHeight >= rRect.Top() &&
1769 nY <= rRect.Bottom() + mnMaxHeight)
1770 {
1771 ImplPaint(rRenderContext, i);
1772 }
1773 nY += nEntryHeight;
1774 }
1775
1777 maFocusRect.SetPos(Point(0, nHeightDiff));
1779 maFocusRect.SetSize(aSz);
1780 if (HasFocus() && bShowFocusRect)
1782}
1783
1785{
1787 {
1788 // This widget is explicitly double-buffered, so avoid partial paints.
1790 ImplDoPaint(rRenderContext, aRect);
1791 }
1792 else
1793 ImplDoPaint(rRenderContext, rRect);
1794}
1795
1797{
1798 // FIXME: ListBoxEntryFlags::MultiLine
1799
1800 const sal_Int32 nCount = maEntryList.GetEntryCount()-mnTop;
1801 tools::Long nHeight = GetOutputSizePixel().Height();// - mnMaxHeight + gnBorder;
1802 sal_uInt16 nEntries = static_cast< sal_uInt16 >( ( nHeight + mnMaxHeight - 1 ) / mnMaxHeight );
1803 if( nEntries > nCount )
1804 nEntries = static_cast<sal_uInt16>(nCount);
1805
1806 return nEntries;
1807}
1808
1810{
1812
1813 bool bShowFocusRect = mbHasFocusRect;
1814 if ( bShowFocusRect )
1816
1818 {
1820 maFocusRect.SetSize( aSz );
1821 }
1822
1823 if ( bShowFocusRect )
1825
1827}
1828
1830{
1831 sal_Int32 nPos = mnCurrentPos;
1833 nPos = 0;
1835 maFocusRect.SetPos( Point( 0, nHeightDiff ) );
1837 maFocusRect.SetSize( aSz );
1840}
1841
1843{
1846}
1847
1849{
1850 if( maEntryList.GetEntryCount() == 0 )
1851 return;
1852
1853 tools::Long nWHeight = PixelToLogic( GetSizePixel() ).Height();
1854
1855 sal_Int32 nLastEntry = maEntryList.GetEntryCount()-1;
1856 if( nTop > nLastEntry )
1857 nTop = nLastEntry;
1858 const ImplEntryType* pLast = maEntryList.GetEntryPtr( nLastEntry );
1859 while( nTop > 0 && maEntryList.GetAddedHeight( nLastEntry, nTop-1 ) + pLast->getHeightWithMargin() <= nWHeight )
1860 nTop--;
1861
1862 if ( nTop == mnTop )
1863 return;
1864
1869 mnTop = nTop;
1870 Scroll( 0, nDiff );
1872 if( HasFocus() )
1874 maScrollHdl.Call( this );
1875}
1876
1877void ImplListBoxWindow::ShowProminentEntry( sal_Int32 nEntryPos )
1878{
1879 sal_Int32 nPos = nEntryPos;
1880 auto nWHeight = PixelToLogic( GetSizePixel() ).Height();
1881 while( nEntryPos > 0 && maEntryList.GetAddedHeight( nPos+1, nEntryPos ) < nWHeight/2 )
1882 nEntryPos--;
1883
1884 SetTopEntry( nEntryPos );
1885}
1886
1888{
1889 ScrollHorz( n - mnLeft );
1890}
1891
1893{
1894 tools::Long nDiff = 0;
1895 if ( n > 0 )
1896 {
1898 if( ( mnMaxWidth - mnLeft + n ) > nWidth )
1899 nDiff = n;
1900 }
1901 else if ( n < 0 )
1902 {
1903 if( mnLeft )
1904 {
1905 tools::Long nAbs = -n;
1906 nDiff = - std::min( mnLeft, nAbs );
1907 }
1908 }
1909
1910 if ( nDiff )
1911 {
1913 mnLeft = sal::static_int_cast<sal_uInt16>(mnLeft + nDiff);
1916 Scroll( -nDiff, 0 );
1918 if( HasFocus() )
1920 maScrollHdl.Call( this );
1921 }
1922}
1923
1925{
1926 maSeparators.clear();
1927
1928 if ( n != LISTBOX_ENTRY_NOTFOUND )
1929 {
1930 maSeparators.insert( n );
1931 }
1932}
1933
1935{
1936 if (!maSeparators.empty())
1937 return *(maSeparators.begin());
1938 else
1940}
1941
1942bool ImplListBoxWindow::isSeparator( const sal_Int32 &n) const
1943{
1944 return maSeparators.find(n) != maSeparators.end();
1945}
1946
1947Size ImplListBoxWindow::CalcSize(sal_Int32 nMaxLines) const
1948{
1949 // FIXME: ListBoxEntryFlags::MultiLine
1950
1951 Size aSz;
1952 aSz.setHeight(nMaxLines * GetEntryHeightWithMargin());
1953 aSz.setWidth( mnMaxWidth + 2*gnBorder );
1954 return aSz;
1955}
1956
1958{
1959 const ImplEntryType* pEntry = maEntryList.GetEntryPtr( nItem );
1960 Size aSz( GetSizePixel().Width(), pEntry ? pEntry->getHeightWithMargin() : GetEntryHeightWithMargin() );
1962 tools::Rectangle aRect( Point( 0, nY ), aSz );
1963 return aRect;
1964}
1965
1967{
1969
1971 {
1974 Invalidate();
1975 }
1976 else if ( nType == StateChangedType::UpdateMode )
1977 {
1978 if ( IsUpdateMode() && IsReallyVisible() )
1979 Invalidate();
1980 }
1982 {
1985 Invalidate();
1986 }
1988 {
1990 Invalidate();
1991 }
1993 {
1995 Invalidate();
1996 }
1997 else if( nType == StateChangedType::Enable )
1998 {
1999 Invalidate();
2000 }
2001
2003}
2004
2006{
2007 Control::DataChanged( rDCEvt );
2008
2009 if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
2011 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2012 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
2013 {
2017 Invalidate();
2018 }
2019}
2020
2022{
2024
2025 if (maEntryList.HasImages())
2026 nTextStyle |= DrawTextFlags::Left;
2027 else if (mbCenter)
2028 nTextStyle |= DrawTextFlags::Center;
2029 else if (mbRight)
2030 nTextStyle |= DrawTextFlags::Right;
2031 else
2032 nTextStyle |= DrawTextFlags::Left;
2033
2034 return nTextStyle;
2035}
2036
2038 Control( pParent, nWinStyle ),
2039 maLBWindow(VclPtr<ImplListBoxWindow>::Create( this, nWinStyle&(~WB_BORDER) ))
2040{
2041 // for native widget rendering we must be able to detect this window type
2043
2047
2048 Link<ScrollBar*,void> aLink( LINK( this, ImplListBox, ScrollBarHdl ) );
2049 mpVScrollBar->SetScrollHdl( aLink );
2050 mpHScrollBar->SetScrollHdl( aLink );
2051
2052 mbVScroll = false;
2053 mbHScroll = false;
2054 mbAutoHScroll = ( nWinStyle & WB_AUTOHSCROLL );
2055 mbEdgeBlending = false;
2056
2057 maLBWindow->SetScrollHdl( LINK( this, ImplListBox, LBWindowScrolled ) );
2058 maLBWindow->SetMRUChangedHdl( LINK( this, ImplListBox, MRUChanged ) );
2060 maLBWindow->Show();
2061}
2062
2064{
2065 disposeOnce();
2066}
2067
2069{
2075}
2076
2078{
2079 maLBWindow->Clear();
2080 if ( GetEntryList().GetMRUCount() )
2081 {
2084 }
2088}
2089
2090sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr )
2091{
2092 ImplEntryType* pNewEntry = new ImplEntryType( rStr );
2093 sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
2095 return nNewPos;
2096}
2097
2098sal_Int32 ImplListBox::InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage )
2099{
2100 ImplEntryType* pNewEntry = new ImplEntryType( rStr, rImage );
2101 sal_Int32 nNewPos = maLBWindow->InsertEntry( nPos, pNewEntry );
2103 return nNewPos;
2104}
2105
2106void ImplListBox::RemoveEntry( sal_Int32 nPos )
2107{
2110}
2111
2112void ImplListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
2113{
2114 maLBWindow->SetEntryFlags( nPos, nFlags );
2115}
2116
2117void ImplListBox::SelectEntry( sal_Int32 nPos, bool bSelect )
2118{
2119 maLBWindow->SelectEntry( nPos, bSelect );
2120}
2121
2123{
2125}
2126
2128{
2129 if (maLBWindow)
2131 else
2133}
2134
2136{
2140}
2141
2143{
2144 CompatStateChanged( StateChangedType::Data );
2145}
2146
2148{
2149 tools::Long nSet = GetTopEntry();
2150 if( nSet > mpVScrollBar->GetRangeMax() )
2151 mpVScrollBar->SetRangeMax( GetEntryList().GetEntryCount() );
2152 mpVScrollBar->SetThumbPos( GetTopEntry() );
2153
2154 mpHScrollBar->SetThumbPos( GetLeftIndent() );
2155
2156 maScrollHdl.Call( this );
2157}
2158
2159IMPL_LINK( ImplListBox, ScrollBarHdl, ScrollBar*, pSB, void )
2160{
2161 sal_uInt16 nPos = static_cast<sal_uInt16>(pSB->GetThumbPos());
2162 if( pSB == mpVScrollBar )
2163 SetTopEntry( nPos );
2164 else if( pSB == mpHScrollBar )
2165 SetLeftIndent( nPos );
2166 if( GetParent() )
2167 GetParent()->Invalidate( InvalidateFlags::Update );
2168}
2169
2171{
2172 bool bArrange = false;
2173
2174 Size aOutSz = GetOutputSizePixel();
2175 sal_Int32 nEntries = GetEntryList().GetEntryCount();
2176 sal_uInt16 nMaxVisEntries = static_cast<sal_uInt16>(aOutSz.Height() / GetEntryHeightWithMargin());
2177
2178 // vertical ScrollBar
2179 if( nEntries > nMaxVisEntries )
2180 {
2181 if( !mbVScroll )
2182 bArrange = true;
2183 mbVScroll = true;
2184
2185 // check of the scrolled-out region
2186 if( GetEntryList().GetSelectedEntryCount() == 1 &&
2189 else
2190 SetTopEntry( GetTopEntry() ); // MaxTop is being checked...
2191 }
2192 else
2193 {
2194 if( mbVScroll )
2195 bArrange = true;
2196 mbVScroll = false;
2197 SetTopEntry( 0 );
2198 }
2199
2200 // horizontal ScrollBar
2201 if( mbAutoHScroll )
2202 {
2203 tools::Long nWidth = static_cast<sal_uInt16>(aOutSz.Width());
2204 if ( mbVScroll )
2205 nWidth -= mpVScrollBar->GetSizePixel().Width();
2206
2207 tools::Long nMaxWidth = GetMaxEntryWidth();
2208 if( nWidth < nMaxWidth )
2209 {
2210 if( !mbHScroll )
2211 bArrange = true;
2212 mbHScroll = true;
2213
2214 if ( !mbVScroll ) // maybe we do need one now
2215 {
2216 nMaxVisEntries = static_cast<sal_uInt16>( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeightWithMargin() );
2217 if( nEntries > nMaxVisEntries )
2218 {
2219 bArrange = true;
2220 mbVScroll = true;
2221
2222 // check of the scrolled-out region
2223 if( GetEntryList().GetSelectedEntryCount() == 1 &&
2226 else
2227 SetTopEntry( GetTopEntry() ); // MaxTop is being checked...
2228 }
2229 }
2230
2231 // check of the scrolled-out region
2232 sal_uInt16 nMaxLI = static_cast<sal_uInt16>(nMaxWidth - nWidth);
2233 if ( nMaxLI < GetLeftIndent() )
2234 SetLeftIndent( nMaxLI );
2235 }
2236 else
2237 {
2238 if( mbHScroll )
2239 bArrange = true;
2240 mbHScroll = false;
2241 SetLeftIndent( 0 );
2242 }
2243 }
2244
2245 if( bArrange )
2247
2249}
2250
2252{
2254
2255 if ( mbVScroll )
2256 {
2257 sal_Int32 nEntries = GetEntryList().GetEntryCount();
2258 sal_uInt16 nVisEntries = static_cast<sal_uInt16>(aOutSz.Height() / GetEntryHeightWithMargin());
2259 mpVScrollBar->SetRangeMax( nEntries );
2260 mpVScrollBar->SetVisibleSize( nVisEntries );
2261 mpVScrollBar->SetPageSize( nVisEntries - 1 );
2262 }
2263
2264 if ( mbHScroll )
2265 {
2267 mpHScrollBar->SetVisibleSize( static_cast<sal_uInt16>(aOutSz.Width()) );
2270 }
2271}
2272
2274{
2275 // Here we only position the Controls; if the Scrollbars are to be
2276 // visible is already determined in ImplCheckScrollBars
2277
2278 Size aOutSz = GetOutputSizePixel();
2280 nSBWidth = CalcZoom( nSBWidth );
2281
2282 Size aInnerSz( aOutSz );
2283 if ( mbVScroll )
2284 aInnerSz.AdjustWidth( -nSBWidth );
2285 if ( mbHScroll )
2286 aInnerSz.AdjustHeight( -nSBWidth );
2287
2288 Point aWinPos( 0, 0 );
2289 maLBWindow->SetPosSizePixel( aWinPos, aInnerSz );
2290
2291 // ScrollBarBox
2292 if( mbVScroll && mbHScroll )
2293 {
2294 Point aBoxPos( aInnerSz.Width(), aInnerSz.Height() );
2295 mpScrollBarBox->SetPosSizePixel( aBoxPos, Size( nSBWidth, nSBWidth ) );
2297 }
2298 else
2299 {
2301 }
2302
2303 // vertical ScrollBar
2304 if( mbVScroll )
2305 {
2306 // Scrollbar on left or right side?
2307 Point aVPos( aOutSz.Width() - nSBWidth, 0 );
2308 mpVScrollBar->SetPosSizePixel( aVPos, Size( nSBWidth, aInnerSz.Height() ) );
2309 mpVScrollBar->Show();
2310 }
2311 else
2312 {
2313 mpVScrollBar->Hide();
2314 // #107254# Don't reset top entry after resize, but check for max top entry
2316 }
2317
2318 // horizontal ScrollBar
2319 if( mbHScroll )
2320 {
2321 Point aHPos( 0, aOutSz.Height() - nSBWidth );
2322 mpHScrollBar->SetPosSizePixel( aHPos, Size( aInnerSz.Width(), nSBWidth ) );
2323 mpHScrollBar->Show();
2324 }
2325 else
2326 {
2327 mpHScrollBar->Hide();
2328 SetLeftIndent( 0 );
2329 }
2330}
2331
2333{
2335 {
2337 }
2339 {
2340 bool bUpdate = IsUpdateMode();
2341 maLBWindow->SetUpdateMode( bUpdate );
2342 if ( bUpdate && IsReallyVisible() )
2344 }
2345 else if( nType == StateChangedType::Enable )
2346 {
2351
2352 Invalidate();
2353 }
2354 else if ( nType == StateChangedType::Zoom )
2355 {
2357 Resize();
2358 }
2360 {
2362 }
2364 {
2366 }
2368 {
2370 }
2372 {
2377 }
2378
2380}
2381
2383{
2384 bool bDone = false;
2385 if ( rNEvt.GetType() == NotifyEventType::COMMAND )
2386 {
2387 const CommandEvent& rCEvt = *rNEvt.GetCommandEvent();
2388 if ( rCEvt.GetCommand() == CommandEventId::Wheel )
2389 {
2390 const CommandWheelData* pData = rCEvt.GetWheelData();
2391 if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
2392 {
2394 }
2395 }
2396 else if (rCEvt.GetCommand() == CommandEventId::GesturePan)
2397 {
2399 }
2400 }
2401
2402 return bDone || Window::EventNotify( rNEvt );
2403}
2404
2406{
2408}
2409
2411{
2412 bool bDone = false;
2413 if ( rCEvt.GetCommand() == CommandEventId::Wheel )
2414 {
2415 const CommandWheelData* pData = rCEvt.GetWheelData();
2416 if( !pData->GetModifier() && ( pData->GetMode() == CommandWheelMode::SCROLL ) )
2417 {
2418 if (!rControl.HasChildPathFocus())
2419 rControl.GrabFocus();
2420 sal_uInt16 nKey = ( pData->GetDelta() < 0 ) ? KEY_DOWN : KEY_UP;
2421 KeyEvent aKeyEvent( 0, vcl::KeyCode( nKey ) );
2422 bDone = ProcessKeyInput( aKeyEvent );
2423 }
2424 }
2425 return bDone;
2426}
2427
2428void ImplListBox::SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep )
2429{
2430 bool bChanges = GetEntryList().GetMRUCount() != 0;
2431
2432 // Remove old MRU entries
2433 for ( sal_Int32 n = GetEntryList().GetMRUCount();n; )
2434 maLBWindow->RemoveEntry( --n );
2435
2436 sal_Int32 nMRUCount = 0;
2437 sal_Int32 nIndex = 0;
2438 do
2439 {
2440 OUString aEntry( o3tl::getToken(rEntries, 0, cSep, nIndex ) );
2441 // Accept only existing entries
2442 if ( GetEntryList().FindEntry( aEntry ) != LISTBOX_ENTRY_NOTFOUND )
2443 {
2444 ImplEntryType* pNewEntry = new ImplEntryType( aEntry );
2445 maLBWindow->InsertEntry(nMRUCount++, pNewEntry, false);
2446 bChanges = true;
2447 }
2448 }
2449 while ( nIndex >= 0 );
2450
2451 if ( bChanges )
2452 {
2453 maLBWindow->GetEntryList().SetMRUCount( nMRUCount );
2454 SetSeparatorPos( nMRUCount ? nMRUCount-1 : 0 );
2456 }
2457}
2458
2460{
2461 OUStringBuffer aEntries;
2462 for ( sal_Int32 n = 0; n < GetEntryList().GetMRUCount(); n++ )
2463 {
2464 aEntries.append(GetEntryList().GetEntryText( n ));
2465 if( n < ( GetEntryList().GetMRUCount() - 1 ) )
2466 aEntries.append(cSep);
2467 }
2468 return aEntries.makeStringAndClear();
2469}
2470
2472{
2473 if(mbEdgeBlending != bNew)
2474 {
2475 mbEdgeBlending = bNew;
2477 }
2478}
2479
2481{
2482 AllSettings aSettings(GetSettings());
2483 StyleSettings aStyle(aSettings.GetStyleSettings());
2484 aStyle.SetHighlightColor(rColor);
2485 aSettings.SetStyleSettings(aStyle);
2486 SetSettings(aSettings);
2487
2488 AllSettings aSettingsLB(maLBWindow->GetSettings());
2489 StyleSettings aStyleLB(aSettingsLB.GetStyleSettings());
2490 aStyleLB.SetListBoxWindowHighlightColor(rColor);
2491 aSettingsLB.SetStyleSettings(aStyleLB);
2492 maLBWindow->SetSettings(aSettingsLB);
2493}
2494
2496{
2497 AllSettings aSettings(GetSettings());
2498 StyleSettings aStyle(aSettings.GetStyleSettings());
2499 aStyle.SetHighlightTextColor(rColor);
2500 aSettings.SetStyleSettings(aStyle);
2501 SetSettings(aSettings);
2502
2503 AllSettings aSettingsLB(maLBWindow->GetSettings());
2504 StyleSettings aStyleLB(aSettingsLB.GetStyleSettings());
2505 aStyleLB.SetListBoxWindowHighlightTextColor(rColor);
2506 aSettingsLB.SetStyleSettings(aStyleLB);
2507 maLBWindow->SetSettings(aSettingsLB);
2508}
2509
2510ImplWin::ImplWin( vcl::Window* pParent, WinBits nWinStyle ) :
2511 Control ( pParent, nWinStyle )
2512{
2515 SetBackground();
2516 else
2517 SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
2518
2520
2521 mbEdgeBlending = false;
2523}
2524
2526{
2527 if( IsEnabled() )
2528 {
2529 maMBDownHdl.Call(this);
2530 }
2531}
2532
2534{
2535 mxLayoutData.emplace();
2536 ImplWin* pThis = const_cast<ImplWin*>(this);
2537 pThis->ImplDraw(*pThis->GetOutDev(), true);
2538}
2539
2540void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout)
2541{
2542 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
2543
2544 if (!bLayout)
2545 {
2546 bool bNativeOK = false;
2547 bool bHasFocus = HasFocus();
2548 bool bIsEnabled = IsEnabled();
2549
2553 {
2554 // Repaint the (focused) area similarly to
2555 // ImplSmallBorderWindowView::DrawWindow() in
2556 // vcl/source/window/brdwin.cxx
2557 vcl::Window *pWin = GetParent();
2558
2559 ImplControlValue aControlValue;
2560 bIsEnabled &= pWin->IsEnabled();
2561 if ( !bIsEnabled )
2562 nState &= ~ControlState::ENABLED;
2563 bHasFocus |= pWin->HasFocus();
2564 if ( bHasFocus )
2566
2567 // The listbox is painted over the entire control including the
2568 // border, but ImplWin does not contain the border => correction
2569 // needed.
2570 sal_Int32 nLeft, nTop, nRight, nBottom;
2571 pWin->GetBorder( nLeft, nTop, nRight, nBottom );
2572 Point aPoint( -nLeft, -nTop );
2573 tools::Rectangle aCtrlRegion( aPoint - GetPosPixel(), pWin->GetSizePixel() );
2574
2575 bool bMouseOver = pWin->IsMouseOver();
2576 if (!bMouseOver)
2577 {
2579 while( pChild )
2580 {
2581 bMouseOver = pChild->IsMouseOver();
2582 if (bMouseOver)
2583 break;
2584 pChild = pChild->GetWindow( GetWindowType::Next );
2585 }
2586 }
2587 if( bMouseOver )
2589
2590 Color aBackgroundColor = COL_AUTO;
2591 if (IsControlBackground())
2592 aBackgroundColor = GetControlBackground();
2593
2594 // if parent has no border, then nobody has drawn the background
2595 // since no border window exists. so draw it here.
2596 WinBits nParentStyle = pWin->GetStyle();
2597 if( ! (nParentStyle & WB_BORDER) || (nParentStyle & WB_NOBORDER) )
2598 {
2599 tools::Rectangle aParentRect( Point( 0, 0 ), pWin->GetSizePixel() );
2601 nState, aControlValue, OUString(), aBackgroundColor);
2602 }
2603
2604 bNativeOK = rRenderContext.DrawNativeControl(ControlType::Listbox, ControlPart::Entire, aCtrlRegion,
2605 nState, aControlValue, OUString(), aBackgroundColor);
2606 }
2607
2608 if (bIsEnabled)
2609 {
2610 if (bHasFocus && !ImplGetSVData()->maNWFData.mbDDListBoxNoTextArea)
2611 {
2612 if ( !ImplGetSVData()->maNWFData.mbNoFocusRects )
2613 {
2614 rRenderContext.SetFillColor( rStyleSettings.GetHighlightColor() );
2615 rRenderContext.SetTextColor( rStyleSettings.GetHighlightTextColor() );
2616 }
2617 else
2618 {
2619 rRenderContext.SetLineColor();
2620 rRenderContext.SetFillColor();
2621 rRenderContext.SetTextColor( rStyleSettings.GetFieldTextColor() );
2622 }
2623 rRenderContext.DrawRect( maFocusRect );
2624 }
2625 else
2626 {
2627 Color aColor;
2628 if (IsControlForeground())
2629 aColor = GetControlForeground();
2630 else if (ImplGetSVData()->maNWFData.mbDDListBoxNoTextArea)
2631 {
2632 if( bNativeOK && (nState & ControlState::ROLLOVER) )
2633 aColor = rStyleSettings.GetButtonRolloverTextColor();
2634 else
2635 aColor = rStyleSettings.GetButtonTextColor();
2636 }
2637 else
2638 {
2639 if( bNativeOK && (nState & ControlState::ROLLOVER) )
2640 aColor = rStyleSettings.GetFieldRolloverTextColor();
2641 else
2642 aColor = rStyleSettings.GetFieldTextColor();
2643 }
2644 rRenderContext.SetTextColor(aColor);
2645 if (!bNativeOK)
2646 rRenderContext.Erase(maFocusRect);
2647 }
2648 }
2649 else // Disabled
2650 {
2651 rRenderContext.SetTextColor(rStyleSettings.GetDisableColor());
2652 if (!bNativeOK)
2653 rRenderContext.Erase(maFocusRect);
2654 }
2655 }
2656
2657 DrawEntry(rRenderContext, bLayout);
2658}
2659
2661{
2662 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
2663
2664 ApplyControlFont(rRenderContext, rStyleSettings.GetFieldFont());
2665 ApplyControlForeground(rRenderContext, rStyleSettings.GetFieldTextColor());
2666
2667 if (IsControlBackground())
2668 rRenderContext.SetBackground(GetControlBackground());
2669 else
2670 rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
2671}
2672
2674{
2675 ImplDraw(rRenderContext);
2676}
2677
2678void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout)
2679{
2680 tools::Long nBorder = 1;
2681 Size aOutSz(GetOutputSizePixel());
2682
2683 bool bImage = !!maImage;
2684 if (bImage && !bLayout)
2685 {
2687 Size aImgSz = maImage.GetSizePixel();
2688 Point aPtImg( nBorder, ( ( aOutSz.Height() - aImgSz.Height() ) / 2 ) );
2689 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2690
2691 // check for HC mode
2692 Image *pImage = &maImage;
2693
2694 if ( !IsZoom() )
2695 {
2696 rRenderContext.DrawImage( aPtImg, *pImage, nStyle );
2697 }
2698 else
2699 {
2700 aImgSz.setWidth( CalcZoom( aImgSz.Width() ) );
2701 aImgSz.setHeight( CalcZoom( aImgSz.Height() ) );
2702 rRenderContext.DrawImage( aPtImg, aImgSz, *pImage, nStyle );
2703 }
2704
2705 const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0);
2706
2707 if(nEdgeBlendingPercent)
2708 {
2709 const Color& rTopLeft(rStyleSettings.GetEdgeBlendingTopLeftColor());
2710 const Color& rBottomRight(rStyleSettings.GetEdgeBlendingBottomRightColor());
2711 const sal_uInt8 nAlpha((nEdgeBlendingPercent * 255) / 100);
2712 const BitmapEx aBlendFrame(createBlendFrame(aImgSz, nAlpha, rTopLeft, rBottomRight));
2713
2714 if(!aBlendFrame.IsEmpty())
2715 {
2716 rRenderContext.DrawBitmapEx(aPtImg, aBlendFrame);
2717 }
2718 }
2719 }
2720
2721 if( !maString.isEmpty() )
2722 {
2724
2725 if ( bImage && !bLayout )
2726 nTextStyle |= DrawTextFlags::Left;
2727 else if ( GetStyle() & WB_CENTER )
2728 nTextStyle |= DrawTextFlags::Center;
2729 else if ( GetStyle() & WB_RIGHT )
2730 nTextStyle |= DrawTextFlags::Right;
2731 else
2732 nTextStyle |= DrawTextFlags::Left;
2733
2734 tools::Rectangle aTextRect( Point( nBorder, 0 ), Size( aOutSz.Width()-2*nBorder, aOutSz.Height() ) );
2735
2736 if ( bImage )
2737 {
2739 }
2740
2741 std::vector< tools::Rectangle >* pVector = bLayout ? &mxLayoutData->m_aUnicodeBoundRects : nullptr;
2742 OUString* pDisplayText = bLayout ? &mxLayoutData->m_aDisplayText : nullptr;
2743 rRenderContext.DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText );
2744 }
2745
2746 if( HasFocus() && !bLayout )
2748}
2749
2751{
2754 Invalidate();
2755}
2756
2758{
2760 if (IsNativeWidgetEnabled() &&
2762 {
2764 if( ! pWin )
2765 pWin = GetParent();
2766 pWin->Invalidate();
2767 }
2768 else
2769 Invalidate();
2771}
2772
2774{
2775 HideFocus();
2776 if (IsNativeWidgetEnabled() &&
2778 {
2780 if( ! pWin )
2781 pWin = GetParent();
2782 pWin->Invalidate();
2783 }
2784 else
2785 Invalidate();
2787}
2788
2790{
2792 {
2793 ImplControlValue aControlValue;
2794
2795 vcl::Window *pWin = GetParent();
2796 tools::Rectangle aParentRect(Point(0, 0), pWin->GetSizePixel());
2798 ControlState::FOCUSED, aControlValue, OUString());
2799 }
2800 Control::ShowFocus(rRect);
2801}
2802
2803ImplBtn::ImplBtn( vcl::Window* pParent, WinBits nWinStyle ) :
2804 PushButton( pParent, nWinStyle )
2805{
2806}
2807
2809{
2810 if( IsEnabled() )
2811 maMBDownHdl.Call(this);
2812}
2813
2815 FloatingWindow( pParent, WB_BORDER | WB_SYSTEMWINDOW | WB_NOSHADOW ) // no drop shadow for list boxes
2816{
2817 // for native widget rendering we must be able to detect this window type
2819
2820 mpImplLB = nullptr;
2821 mnDDLineCount = 0;
2822 mbAutoWidth = false;
2823
2825
2826 vcl::Window * pBorderWindow = ImplGetBorderWindow();
2827 if( pBorderWindow )
2828 {
2829 SetAccessibleRole(accessibility::AccessibleRole::PANEL);
2830 pBorderWindow->SetAccessibleRole(accessibility::AccessibleRole::WINDOW);
2831 }
2832 else
2833 {
2834 SetAccessibleRole(accessibility::AccessibleRole::WINDOW);
2835 }
2836
2837}
2838
2840{
2841 disposeOnce();
2842}
2843
2845{
2846 mpImplLB.clear();
2848}
2849
2850
2852{
2853 if( rNEvt.GetType() == NotifyEventType::LOSEFOCUS )
2854 {
2855 if( !GetParent()->HasChildPathFocus( true ) )
2856 EndPopupMode();
2857 }
2858
2859 return FloatingWindow::PreNotify( rNEvt );
2860}
2861
2863{
2864 FloatingWindow::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
2865
2866 // Fix #60890# ( MBA ): to be able to resize the Listbox even in its open state
2867 // after a call to Resize(), we adjust its position if necessary
2868 if ( IsReallyVisible() && ( nFlags & PosSizeFlags::Height ) )
2869 {
2870 Point aPos = GetParent()->GetPosPixel();
2871 aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
2872
2873 if ( nFlags & PosSizeFlags::X )
2874 aPos.setX( nX );
2875
2876 if ( nFlags & PosSizeFlags::Y )
2877 aPos.setY( nY );
2878
2879 sal_uInt16 nIndex;
2881 }
2882
2883// if( !IsReallyVisible() )
2884 {
2885 // The ImplListBox does not get a Resize() as not visible.
2886 // But the windows must get a Resize(), so that the number of
2887 // visible entries is correct for PgUp/PgDown.
2888 // The number also cannot be calculated by List/Combobox, as for
2889 // this the presence of the vertical Scrollbar has to be known.
2891 static_cast<vcl::Window*>(mpImplLB)->Resize();
2892 static_cast<vcl::Window*>(mpImplLB->GetMainWindow())->Resize();
2893 }
2894}
2895
2897{
2900}
2901
2903{
2904 Size aFloatSz( maPrefSz );
2905
2906 sal_Int32 nLeft, nTop, nRight, nBottom;
2907 GetBorder( nLeft, nTop, nRight, nBottom );
2908
2909 sal_Int32 nLines = mpImplLB->GetEntryList().GetEntryCount();
2910 if ( mnDDLineCount && ( nLines > mnDDLineCount ) )
2911 nLines = mnDDLineCount;
2912
2913 Size aSz = mpImplLB->CalcSize( nLines );
2914 tools::Long nMaxHeight = aSz.Height() + nTop + nBottom;
2915
2916 if ( mnDDLineCount )
2917 aFloatSz.setHeight( nMaxHeight );
2918
2919 if( mbAutoWidth )
2920 {
2921 // AutoSize first only for width...
2922
2923 aFloatSz.setWidth( aSz.Width() + nLeft + nRight );
2924 aFloatSz.AdjustWidth(nRight ); // adding some space looks better...
2925
2926 if ( ( aFloatSz.Height() < nMaxHeight ) || ( mnDDLineCount && ( mnDDLineCount < mpImplLB->GetEntryList().GetEntryCount() ) ) )
2927 {
2928 // then we also need the vertical Scrollbar
2930 aFloatSz.AdjustWidth(nSBWidth );
2931 }
2932
2933 tools::Long nDesktopWidth = GetDesktopRectPixel().getOpenWidth();
2934 if (aFloatSz.Width() > nDesktopWidth)
2935 // Don't exceed the desktop width.
2936 aFloatSz.setWidth( nDesktopWidth );
2937 }
2938
2939 if ( aFloatSz.Height() > nMaxHeight )
2940 aFloatSz.setHeight( nMaxHeight );
2941
2942 // Minimal height, in case height is not set to Float height.
2943 // The parent of FloatWin must be DropDown-Combo/Listbox.
2944 Size aParentSz = GetParent()->GetSizePixel();
2945 if( (!mnDDLineCount || !nLines) && ( aFloatSz.Height() < aParentSz.Height() ) )
2946 aFloatSz.setHeight( aParentSz.Height() );
2947
2948 // do not get narrower than the parent...
2949 if( aFloatSz.Width() < aParentSz.Width() )
2950 aFloatSz.setWidth( aParentSz.Width() );
2951
2952 // align height to entries...
2953 tools::Long nInnerHeight = aFloatSz.Height() - nTop - nBottom;
2955 if ( nInnerHeight % nEntryHeight )
2956 {
2957 nInnerHeight /= nEntryHeight;
2958 nInnerHeight++;
2959 nInnerHeight *= nEntryHeight;
2960 aFloatSz.setHeight( nInnerHeight + nTop + nBottom );
2961 }
2962
2963 if (aFloatSz.Width() < aSz.Width())
2964 {
2965 // The max width of list box entries exceeds the window width.
2966 // Account for the scroll bar height.
2968 aFloatSz.AdjustHeight(nSBWidth );
2969 }
2970
2971 return aFloatSz;
2972}
2973
2974void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking )
2975{
2976 if( IsInPopupMode() )
2977 return;
2978
2979 Size aFloatSz = CalcFloatSize();
2980
2981 SetSizePixel( aFloatSz );
2983
2984 sal_Int32 nPos = mpImplLB->GetEntryList().GetSelectedEntryPos( 0 );
2986
2987 Size aSz = GetParent()->GetSizePixel();
2988 Point aPos = GetParent()->GetPosPixel();
2989 aPos = GetParent()->GetParent()->OutputToScreenPixel( aPos );
2990 // FIXME: this ugly hack is for Mac/Aqua
2991 // should be replaced by a real mechanism to place the float rectangle
2992 if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
2994 {
2995 const sal_Int32 nLeft = 4, nTop = 4, nRight = 4, nBottom = 4;
2996 aPos.AdjustX(nLeft );
2997 aPos.AdjustY(nTop );
2998 aSz.AdjustWidth( -(nLeft + nRight) );
2999 aSz.AdjustHeight( -(nTop + nBottom) );
3000 }
3001 tools::Rectangle aRect( aPos, aSz );
3002
3003 // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI
3004 // where the document is unmirrored
3005 // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror
3006 vcl::Window *pGrandparent = GetParent()->GetParent();
3007 const OutputDevice *pGrandparentOutDev = pGrandparent->GetOutDev();
3008
3009 if( pGrandparent->GetOutDev()->ImplIsAntiparallel() )
3010 pGrandparentOutDev->ReMirror( aRect );
3011
3012 // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795
3014
3017
3018 if( bStartTracking )
3020
3023
3025
3026}
3027
3028/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BitmapEx createBlendFrame(const Size &rSize, sal_uInt8 nAlpha, Color aColorTopLeft, Color aColorBottomRight)
Create a blend frame as BitmapEx.
Definition: BitmapEx.cxx:1003
DrawImageFlags
DrawTextFlags
@ HasBackgroundTexture
const vcl::I18nHelper & GetLocaleI18nHelper() const
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:638
bool IsEmpty() const
Definition: BitmapEx.cxx:186
CommandEventId GetCommand() const
const CommandWheelData * GetWheelData() const
Definition: ctrl.hxx:80
std::optional< vcl::ControlLayoutData > mxLayoutData
Definition: ctrl.hxx:82
SAL_DLLPRIVATE void ImplClearLayoutData() const
Definition: ctrl.cxx:326
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
virtual void Resize() override
Definition: ctrl.cxx:77
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:68
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: ctrl.cxx:61
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void StartPopupMode(const tools::Rectangle &rRect, FloatWinPopupFlags nFlags)
Definition: floatwin.cxx:776
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: floatwin.cxx:204
static Point ImplCalcPos(vcl::Window *pWindow, const tools::Rectangle &rRect, FloatWinPopupFlags nFlags, sal_uInt16 &rArrangeIndex, Point *pLOKTwipsPos=nullptr)
Definition: floatwin.cxx:231
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
Definition: floatwin.cxx:964
bool IsInPopupMode() const
Definition: floatwin.hxx:130
Definition: image.hxx:40
Size GetSizePixel() const
Definition: Image.cxx:88
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:587
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
ImplBtn(vcl::Window *pParent, WinBits nWinStyle)
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
sal_Int32 mnImages
Definition: listbox.hxx:93
bool IsEntrySelectable(sal_Int32 nPos) const
An Entry is selectable if its mnFlags does not have the ListBoxEntryFlags::DisableSelection flag set.
void SetMRUCount(sal_Int32 n)
Definition: listbox.hxx:159
bool HasEntryImage(sal_Int32 nPos) const
void SetEntryData(sal_Int32 nPos, void *pNewData)
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
bool HasImages() const
Definition: listbox.hxx:131
Image GetEntryImage(sal_Int32 nPos) const
sal_Int32 mnMRUCount
Definition: listbox.hxx:95
sal_Int32 GetSelectedEntryCount() const
OUString GetSelectedEntry(sal_Int32 nIndex) const
sal_Int32 mnLastSelected
Definition: listbox.hxx:91
VclPtr< vcl::Window > mpWindow
For getting the current locale when matching strings.
Definition: listbox.hxx:90
void SelectEntry(sal_Int32 nPos, bool bSelect)
Definition: imp_listbox.cxx:89
sal_Int32 mnSelectionAnchor
Definition: listbox.hxx:92
void RemoveEntry(sal_Int32 nPos)
sal_Int32 FindEntry(std::u16string_view rStr, bool bSearchMRUArea=false) const
OUString GetEntryText(sal_Int32 nPos) const
bool mbCallSelectionChangedHdl
Definition: listbox.hxx:99
sal_Int32 FindFirstSelectable(sal_Int32 nPos, bool bForward=true) const
const ImplEntryType * GetEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:115
ImplEntryType * GetEntry(sal_Int32 nPos) const
Definition: listbox.hxx:102
sal_Int32 mnMaxMRUCount
Definition: listbox.hxx:96
ImplEntryType * GetMutableEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:116
sal_Int32 GetLastSelected() const
Definition: listbox.hxx:151
void * GetEntryData(sal_Int32 nPos) const
ImplEntryList(vcl::Window *pWindow)
Definition: imp_listbox.cxx:60
sal_Int32 GetEntryCount() const
Definition: listbox.hxx:130
sal_Int32 GetMRUCount() const
Definition: listbox.hxx:160
void SetLastSelected(sal_Int32 nPos)
Definition: listbox.hxx:150
sal_Int32 GetSelectionAnchor() const
Definition: listbox.hxx:154
tools::Long GetEntryHeight(sal_Int32 nPos) const
std::vector< std::unique_ptr< ImplEntryType > > maEntries
Definition: listbox.hxx:100
sal_Int32 FindMatchingEntry(const OUString &rStr, sal_Int32 nStart, bool bLazy) const
tools::Long GetAddedHeight(sal_Int32 nEndIndex, sal_Int32 nBeginIndex) const
helper: add up heights up to index nEndIndex.
Link< sal_Int32, void > maSelectionChangedHdl
Definition: listbox.hxx:98
bool IsEntryPosSelected(sal_Int32 nIndex) const
void SetSelectionAnchor(sal_Int32 nPos)
Definition: listbox.hxx:153
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry, bool bSort)
virtual void Resize() override
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
VclPtr< ImplListBox > mpImplLB
Definition: listbox.hxx:504
ImplListBoxFloatingWindow(vcl::Window *pParent)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
virtual bool PreNotify(NotifyEvent &rNEvt) override
sal_Int32 mnPopupModeStartSaveSelection
Definition: listbox.hxx:507
virtual ~ImplListBoxFloatingWindow() override
void StartFloat(bool bStartTracking)
std::set< sal_Int32 > maSeparators
Separator positions.
Definition: listbox.hxx:198
sal_Int32 mnUserDrawEntry
Definition: listbox.hxx:200
virtual void Tracking(const TrackingEvent &rTEvt) override
void ImplPaint(vcl::RenderContext &rRenderContext, sal_Int32 nPos)
sal_Int32 mnTop
output from line on
Definition: listbox.hxx:202
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry)
virtual void Resize() override
tools::Long mnMaxImgTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:188
sal_Int32 mnTrackingSaveSelection
Selection before Tracking();.
Definition: listbox.hxx:196
virtual vcl::StringEntryIdentifier NextEntry(vcl::StringEntryIdentifier _currentEntry, OUString &_out_entryText) const override
returns the next entry in the list.
sal_Int32 mnCurrentPos
Position (Focus)
Definition: listbox.hxx:195
vcl::QuickSelectionEngine maQuickSelectionEngine
Definition: listbox.hxx:236
virtual void LoseFocus() override
bool mbTrack
Tracking.
Definition: listbox.hxx:210
tools::Long mnMaxWidth
Maximum width of an entry.
Definition: listbox.hxx:192
void SetLeftIndent(tools::Long n)
virtual ~ImplListBoxWindow() override
bool ProcessKeyInput(const KeyEvent &rKEvt)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
sal_Int32 GetLastVisibleEntry() const
virtual void KeyInput(const KeyEvent &rKEvt) override
tools::Long GetEntryHeightWithMargin() const
bool mbUserDrawEnabled
UserDraw possible.
Definition: listbox.hxx:218
bool isSeparator(const sal_Int32 &n) const
Checks if the given number n is an element of the separator positions set.
sal_Int32 GetEntryPosForPoint(const Point &rPoint) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:289
tools::Long mnLeft
output from column on
Definition: listbox.hxx:203
ImplListBoxWindow(vcl::Window *pParent, WinBits nWinStyle)
bool mbRight
right align Text output
Definition: listbox.hxx:222
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
void ImplDoPaint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
bool SelectEntries(sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift=false, bool bCtrl=false, bool bSelectPosChange=false)
bool mbSort
ListBox sorted.
Definition: listbox.hxx:209
bool mbGrabFocus
Grab focus at MBDown.
Definition: listbox.hxx:217
bool IsMouseMoveSelect() const
Definition: listbox.hxx:338
tools::Rectangle maFocusRect
Definition: listbox.hxx:181
Size CalcSize(sal_Int32 nMaxLines) const
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator.
Link< ImplListBoxWindow *, void > maDoubleClickHdl
Definition: listbox.hxx:230
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:267
Link< LinkParamNone *, void > maListItemSelectHdl
Definition: listbox.hxx:234
void ShowProminentEntry(sal_Int32 nEntryPos)
ShowProminentEntry will set the entry corresponding to nEntryPos either at top or in the middle depen...
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool mbCenter
center Text output
Definition: listbox.hxx:221
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:367
Link< UserDrawEvent *, void > maUserDrawHdl
Definition: listbox.hxx:231
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual vcl::StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const override
returns the current entry in the list of searchable strings.
ImplEntryList maEntryList
EntryList.
Definition: listbox.hxx:180
void DrawEntry(vcl::RenderContext &rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText)
bool mbMouseMoveSelect
Select at MouseMove.
Definition: listbox.hxx:216
void RemoveEntry(sal_Int32 nPos)
Link< LinkParamNone *, void > maSelectHdl
Definition: listbox.hxx:228
virtual void FillLayoutData() const override
tools::Long mnMaxTxtHeight
Maximum height of a text item.
Definition: listbox.hxx:185
bool mbInUserDraw
In UserDraw.
Definition: listbox.hxx:219
bool mbSelectionChanged
Do not call Select() too often ...
Definition: listbox.hxx:215
bool mbMulti
MultiListBox.
Definition: listbox.hxx:211
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Link< LinkParamNone *, void > maCancelHdl
Definition: listbox.hxx:229
virtual void MouseMove(const MouseEvent &rMEvt) override
void SetScrollHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:347
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
tools::Long mnMaxTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:186
virtual void StateChanged(StateChangedType nType) override
void ScrollHorz(tools::Long nDiff)
Link< LinkParamNone *, void > maMRUChangedHdl
Definition: listbox.hxx:232
sal_uInt16 mnSelectModifier
Modifiers.
Definition: listbox.hxx:206
Link< ImplListBoxWindow *, void > maScrollHdl
Definition: listbox.hxx:227
tools::Long mnMaxImgHeight
Maximum height of an image item.
Definition: listbox.hxx:191
void SetUserItemSize(const Size &rSz)
void ImplUpdateEntryMetrics(ImplEntryType &rEntry)
void EnableMouseMoveSelect(bool bMouseMoveSelect)
Definition: listbox.hxx:337
tools::Long mnMaxImgWidth
Maximum width of an image item.
Definition: listbox.hxx:190
void SetTopEntry(sal_Int32 nTop)
tools::Long mnTextHeight
text height
Definition: listbox.hxx:204
bool IsTravelSelect() const
Definition: listbox.hxx:324
void SetMRUChangedHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:352
bool IsGrabFocusAllowed() const
Definition: listbox.hxx:301
tools::Long mnMaxHeight
Maximum height of an entry.
Definition: listbox.hxx:193
sal_uInt16 GetDisplayLineCount() const
DrawTextFlags ImplGetTextStyle() const
bool GetEdgeBlending() const
Definition: listbox.hxx:366
bool IsUserDrawEnabled() const
Definition: listbox.hxx:330
bool IsReadOnly() const
Definition: listbox.hxx:362
bool mbTrackingSelect
Selected at a MouseMove.
Definition: listbox.hxx:214
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Link< sal_Int32, void > maFocusHdl
Definition: listbox.hxx:233
bool mbTravelSelect
TravelSelect.
Definition: listbox.hxx:213
void SelectEntry(sal_Int32 nPos, bool bSelect)
virtual void GetFocus() override
bool mbSimpleMode
SimpleMode for MultiListBox.
Definition: listbox.hxx:212
bool mbReadOnly
ReadOnly.
Definition: listbox.hxx:220
bool mbIsDropdown
Listbox is actually a dropdown (either combobox, or popup window treated as dropdown)
Definition: listbox.hxx:225
VclPtr< ScrollBar > mpHScrollBar
Definition: listbox.hxx:383
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:413
virtual void StateChanged(StateChangedType nType) override
void ImplResizeControls()
bool mbVScroll
Definition: listbox.hxx:387
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:474
Size CalcSize(sal_Int32 nMaxLines) const
Definition: listbox.hxx:471
bool mbHScroll
Definition: listbox.hxx:388
void ImplInitScrollBars()
VclPtr< ScrollBar > mpVScrollBar
Definition: listbox.hxx:384
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator.
Definition: listbox.hxx:438
void SelectEntry(sal_Int32 nPos, bool bSelect)
void RemoveEntry(sal_Int32 nPos)
OUString GetMRUEntries(sal_Unicode cSep) const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
void SetHighlightColor(const Color &rColor)
void SetHighlightTextColor(const Color &rColor)
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
bool mbEdgeBlending
Definition: listbox.hxx:390
VclPtr< ImplListBoxWindow > maLBWindow
Definition: listbox.hxx:382
virtual const Wallpaper & GetDisplayBackground() const override
bool mbAutoHScroll
Definition: listbox.hxx:389
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:431
VclPtr< ScrollBarBox > mpScrollBarBox
Definition: listbox.hxx:385
void SetMRUEntries(std::u16string_view rEntries, sal_Unicode cSep)
virtual ~ImplListBox() override
virtual void Resize() override
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:451
virtual bool EventNotify(NotifyEvent &rNEvt) override
void SetTopEntry(sal_Int32 nTop)
Definition: listbox.hxx:450
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:412
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt, Control &rControl)
void SetNoSelection()
void ShowProminentEntry(sal_Int32 nPos)
Definition: listbox.hxx:452
void SetLeftIndent(sal_uInt16 n)
Definition: listbox.hxx:457
bool GetEdgeBlending() const
Definition: listbox.hxx:497
tools::Long GetEntryHeightWithMargin() const
Definition: listbox.hxx:473
sal_Int32 InsertEntry(sal_Int32 nPos, const OUString &rStr)
void ImplCheckScrollBars()
void SetEdgeBlending(bool bNew)
ImplListBox(vcl::Window *pParent, WinBits nWinStyle)
tools::Long GetLeftIndent() const
Definition: listbox.hxx:456
virtual void GetFocus() override
tools::Rectangle maFocusRect
Definition: listbox.hxx:545
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:547
OUString maString
Definition: listbox.hxx:542
virtual void ShowFocus(const tools::Rectangle &rRect) override
virtual void GetFocus() override
virtual void LoseFocus() override
sal_Int32 mnItemPos
because of UserDraw I have to know which item I draw
Definition: listbox.hxx:541
void ImplDraw(vcl::RenderContext &rRenderContext, bool bLayout=false)
ImplWin(vcl::Window *pParent, WinBits nWinStyle)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void FillLayoutData() const override
bool mbEdgeBlending
Definition: listbox.hxx:549
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool GetEdgeBlending() const
Definition: listbox.hxx:574
void DrawEntry(vcl::RenderContext &rRenderContext, bool bLayout)
Image maImage
Definition: listbox.hxx:543
virtual void Resize() override
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
bool IsMod1() const
Definition: event.hxx:160
bool IsSynthetic() const
Definition: event.hxx:142
bool IsLeaveWindow() const
Definition: event.hxx:140
sal_uInt16 GetModifier() const
Definition: event.hxx:156
sal_uInt16 GetClicks() const
Definition: event.hxx:126
const Point & GetPosPixel() const
Definition: event.hxx:123
bool IsLeft() const
Definition: event.hxx:149
bool IsShift() const
Definition: event.hxx:158
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:332
NotifyEventType GetType() const
Definition: event.hxx:308
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
Definition: bitmapex.cxx:33
SAL_DLLPRIVATE bool ImplIsAntiparallel() const
Definition: outdev.cxx:655
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:161
void SetLineColor()
Definition: line.cxx:37
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void SetFillColor()
Definition: fill.cxx:29
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
Definition: outdev.cxx:671
const Color & GetLineColor() const
Definition: outdev.hxx:510
void SetTextFillColor()
Definition: text.cxx:734
void Erase()
Definition: wallpaper.cxx:96
void SetBackground()
Definition: background.cxx:27
std::unique_ptr< SalLayout > ImplLayout(const OUString &, sal_Int32 nIndex, sal_Int32 nLen, const Point &rLogicPos=Point(0, 0), tools::Long nLogicWidth=0, KernArraySpan aKernArray=KernArraySpan(), o3tl::span< const sal_Bool > pKashidaArray={}, SalLayoutFlags flags=SalLayoutFlags::NONE, vcl::text::TextLayoutCache const *=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr) const
Definition: text.cxx:1292
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
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)
Definition: text.cxx:797
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
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)
void SetSymbol(SymbolType eSymbol)
Definition: button.cxx:1630
bool IsValid() const
void SetThumbPos(tools::Long nThumbPos) override
Definition: scrbar.cxx:1362
void SetScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:130
void SetVisibleSize(tools::Long nNewSize) override
Definition: scrbar.cxx:1376
void SetRangeMax(tools::Long nNewRange) override
Definition: scrbar.cxx:1333
void SetLineSize(tools::Long nNewSize) override
Definition: scrbar.hxx:118
void SetPageSize(tools::Long nNewSize) override
Definition: scrbar.hxx:120
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 & GetListBoxWindowHighlightColor() const
sal_Int32 GetScrollBarSize() const
const Color & GetListBoxWindowTextColor() const
const Color & GetFieldTextColor() const
void SetHighlightTextColor(const Color &rColor)
const Color & GetFieldColor() const
void SetListBoxWindowHighlightColor(const Color &rColor)
void SetListBoxWindowHighlightTextColor(const Color &rColor)
const vcl::Font & GetFieldFont() const
const Color & GetListBoxWindowHighlightTextColor() const
void SetHighlightColor(const Color &rColor)
const Color & GetEdgeBlendingTopLeftColor() const
const Color & GetHighlightColor() const
const Color & GetHighlightTextColor() const
sal_uInt16 GetEdgeBlending() const
const Color & GetDisableColor() const
const Color & GetButtonTextColor() const
const Color & GetListBoxWindowBackgroundColor() const
const Color & GetButtonRolloverTextColor() const
const Color & GetFieldRolloverTextColor() const
const Color & GetEdgeBlendingBottomRightColor() const
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: syswin.cxx:198
virtual void Resize() override
Definition: syswin.cxx:993
bool IsTrackingEnded() const
Definition: event.hxx:261
bool IsTrackingCanceled() const
Definition: event.hxx:263
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:257
Event to pass information for UserDraw() handling eg. in comboboxes.
Definition: event.hxx:222
A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for refer...
Definition: vclptr.hxx:58
void disposeAndClear()
Definition: vclptr.hxx:200
void clear()
Definition: vclptr.hxx:190
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
bool mbUseNativeFocus
Definition: window.h:361
sal_Int32 compare(const OUString &rLHS, const OUString &rRHS) const
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr tools::Long Top() const
void SetSize(const Size &)
void SetPos(const Point &rPoint)
constexpr tools::Long GetHeight() const
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
tools::Long getOpenWidth() const
constexpr tools::Long Bottom() const
static OUString filterFormattingChars(const OUString &)
Definition: i18nhelp.cxx:94
bool MatchString(const OUString &rStr1, const OUString &rStr2) const
Definition: i18nhelp.cxx:125
bool IsMod1() const
Definition: keycod.hxx:56
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
sal_uInt16 GetModifier() const
Definition: keycod.hxx:52
bool IsShift() const
Definition: keycod.hxx:54
bool IsMod2() const
Definition: keycod.hxx:58
bool IsMod3() const
Definition: keycod.hxx:60
bool HandleKeyEvent(const KeyEvent &_rKEvt)
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2806
tools::Rectangle GetTextRect(const tools::Rectangle &rRect, const OUString &rStr, DrawTextFlags nStyle=DrawTextFlags::WordBreak, TextRectInfo *pInfo=nullptr, const vcl::ITextLayout *_pTextLayout=nullptr) const
Definition: window3.cxx:201
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
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
Width of the text.
Definition: window3.cxx:66
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2967
bool IsNativeWidgetEnabled() const
Definition: window.cxx:3710
bool IsReallyVisible() const
Definition: window2.cxx:1133
virtual void GetFocus()
Definition: window.cxx:1841
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:252
vcl::Window * GetParent() const
Definition: window2.cxx:1123
void PaintImmediately()
Definition: paint.cxx:1268
void SetControlForeground()
Definition: window2.cxx:486
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3004
tools::Rectangle GetDesktopRectPixel() const
Definition: window.cxx:2799
bool HandleScrollCommand(const CommandEvent &rCmd, Scrollable *pHScrl, Scrollable *pVScrl)
Definition: window2.cxx:644
void SetControlFont()
Definition: window2.cxx:438
virtual const Wallpaper & GetDisplayBackground() const
Definition: window.cxx:3067
bool IsMouseOver() const
Definition: mouse.cxx:596
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly?
Definition: window.cxx:3860
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2424
tools::Long CalcZoom(tools::Long n) const
Definition: window2.cxx:426
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1036
SAL_DLLPRIVATE vcl::Window * ImplGetBorderWindow() const
Definition: window2.cxx:906
void HideFocus()
Definition: window2.cxx:95
const Color & GetControlForeground() const
Definition: window2.cxx:1098
void GrabFocus()
Definition: window.cxx:2976
void SetControlBackground()
Definition: window2.cxx:526
bool IsUpdateMode() const
Definition: window2.cxx:1199
bool HasFocus() const
Definition: window.cxx:2981
virtual Point GetPosPixel() const
Definition: window.cxx:2794
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2433
bool IsControlForeground() const
Definition: window2.cxx:1103
WinBits GetStyle() const
Definition: window2.cxx:979
const Fraction & GetZoom() const
Definition: window2.cxx:1236
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
vcl::Font GetControlFont() const
Definition: window2.cxx:467
void SetTextFillColor()
Definition: window3.cxx:97
bool IsZoom() const
Definition: window2.cxx:1241
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2666
void Hide()
Definition: window.hxx:879
void SetAccessibleRole(sal_uInt16 nRole)
SAL_DLLPRIVATE WindowImpl * ImplGetWindowImpl() const
Definition: window.hxx:528
void SetSettings(const AllSettings &rSettings)
Definition: window3.cxx:208
void SetZoom(const Fraction &rZoom)
Definition: window2.cxx:399
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2944
virtual void ShowFocus(const tools::Rectangle &rRect)
Definition: window2.cxx:53
bool IsRTLEnabled() const
Definition: window3.cxx:127
Point PixelToLogic(const Point &rDevicePt) const
Definition: window3.cxx:161
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
bool IsControlBackground() const
Definition: window2.cxx:1113
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual void LoseFocus()
Definition: window.cxx:1855
const Color & GetControlBackground() const
Definition: window2.cxx:1108
bool IsVisible() const
Definition: window2.cxx:1128
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1283
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Definition: window2.cxx:478
void SetType(WindowType nType)
Definition: window2.cxx:994
void ApplyControlForeground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
Definition: window2.cxx:518
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1294
bool IsEnabled() const
Definition: window2.cxx:1148
void SetBackground()
Definition: window3.cxx:100
SAL_DLLPRIVATE void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3898
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
int nCount
ScXMLEditAttributeMap::Entry const aEntries[]
sal_Int32 nState
constexpr tools::Long gnBorder
Definition: imp_listbox.cxx:49
IMPL_LINK(ImplListBox, ScrollBarHdl, ScrollBar *, pSB, void)
#define MULTILINE_ENTRY_DRAW_FLAGS
Definition: imp_listbox.cxx:45
IMPL_LINK_NOARG(ImplListBox, MRUChanged, LinkParamNone *, void)
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:51
sal_Int32 nIndex
sal_Int64 n
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
constexpr sal_uInt16 KEY_SPACE
Definition: keycodes.hxx:123
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
sal_uInt16 nPos
LB_EVENT_TYPE
Definition: listbox.hxx:45
@ LET_KEYSPACE
Definition: listbox.hxx:49
@ LET_TRACKING
Definition: listbox.hxx:47
@ LET_MBDOWN
Definition: listbox.hxx:46
@ LET_KEYMOVE
Definition: listbox.hxx:48
#define IMG_TXT_DISTANCE
Definition: listbox.hxx:42
#define HORZ_SCROLL
Definition: listbox.hxx:41
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:37
#define LISTBOX_MAX_ENTRIES
Definition: lstbox.hxx:38
ListBoxEntryFlags
Definition: lstbox.hxx:48
@ DrawDisabled
this flags lets the item be drawn disabled (e.g.
@ DisableSelection
this flag disables a selection of an entry completely.
@ MultiLine
this flag can be used to make an entry multiline capable A normal entry is single line and will there...
aStr
std::unique_ptr< sal_Int32[]> pData
tools::Long const nBorder
const LanguageTag & getLocale()
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)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
long Long
sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB)
const void * StringEntryIdentifier
QPRO_FUNC_TYPE nType
sal_uIntPtr sal_uLong
ListBoxEntryFlags mnFlags
Definition: listbox.hxx:59
bool mbIsSelected
Definition: listbox.hxx:58
Image maImage
Definition: listbox.hxx:56
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
Computes maStr's text layout (glyphs), cached in maStrGlyphs.
tools::Long getHeightWithMargin() const
tools::Long mnHeight
Definition: listbox.hxx:60
void * mpUserData
Definition: listbox.hxx:57
OUString maStr
Definition: listbox.hxx:54
SalLayoutGlyphs maStrGlyphs
Definition: listbox.hxx:55
ImplSVNWFData maNWFData
Definition: svdata.hxx:403
bool mbNoFocusRects
Definition: svdata.hxx:325
int mnListBoxEntryMargin
Definition: svdata.hxx:346
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:77
bool bIsEnabled
unsigned char sal_uInt8
sal_uInt16 sal_Unicode
PosSizeFlags
Definition: window.hxx:127
StateChangedType
Definition: window.hxx:291
@ Update
The invalidated area is updated immediately.
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_CENTER
Definition: wintypes.hxx:147
WinBits const WB_DROPDOWN
Definition: wintypes.hxx:159
WinBits const WB_DRAG
Definition: wintypes.hxx:152
WinBits const WB_SYSTEMWINDOW
Definition: wintypes.hxx:126
WinBits const WB_SIMPLEMODE
Definition: wintypes.hxx:201
WinBits const WB_AUTOHSCROLL
Definition: wintypes.hxx:161
WinBits const WB_RIGHT
Definition: wintypes.hxx:148
WinBits const WB_BORDER
Definition: wintypes.hxx:115
WinBits const WB_SORT
Definition: wintypes.hxx:158
WinBits const WB_WORDBREAK
Definition: wintypes.hxx:156
WinBits const WB_VSCROLL
Definition: wintypes.hxx:178
WinBits const WB_NOBORDER
Definition: wintypes.hxx:116
WinBits const WB_NOSHADOW
Definition: wintypes.hxx:171
WinBits const WB_HSCROLL
Definition: wintypes.hxx:177
sal_Int32 _nPos