LibreOffice Module vcl (master)  1
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 <vcl/builder.hxx>
21 #include <vcl/commandevent.hxx>
22 #include <vcl/event.hxx>
23 #include <vcl/toolkit/lstbox.hxx>
24 #include <vcl/settings.hxx>
25 #include <vcl/uitest/uiobject.hxx>
26 #include <sal/log.hxx>
27 
28 #include <svdata.hxx>
29 #include <listbox.hxx>
30 #include <dndeventdispatcher.hxx>
31 #include <comphelper/lok.hxx>
32 
33 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
34 #include <boost/property_tree/ptree.hpp>
35 #include <tools/json_writer.hxx>
36 
38  : Control(nType)
39  , mpImplLB(nullptr)
40 {
42 }
43 
45 {
47  ImplInit( pParent, nStyle );
48 }
49 
51 {
52  disposeOnce();
53 }
54 
56 {
58 
63 
65 }
66 
68 {
69  mpFloatWin = nullptr;
70  mpImplWin = nullptr;
71  mpBtn = nullptr;
72  mnDDHeight = 0;
73  mnLineCount = 0;
74  m_nMaxWidthChars = -1;
75  mbDDAutoSize = true;
76 }
77 
78 void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle )
79 {
80  nStyle = ImplInitStyle( nStyle );
81  if ( !(nStyle & WB_NOBORDER) && ( nStyle & WB_DROPDOWN ) )
82  nStyle |= WB_BORDER;
83 
84  Control::ImplInit( pParent, nStyle, nullptr );
85 
86  css::uno::Reference< css::datatransfer::dnd::XDropTargetListener> xDrop = new DNDEventDispatcher(this);
87 
88  if( nStyle & WB_DROPDOWN )
89  {
90  sal_Int32 nLeft, nTop, nRight, nBottom;
91  GetBorder( nLeft, nTop, nRight, nBottom );
92  mnDDHeight = static_cast<sal_uInt16>(GetTextHeight() + nTop + nBottom + 4);
93 
94  if( IsNativeWidgetEnabled() &&
96  {
97  ImplControlValue aControlValue;
98  tools::Rectangle aCtrlRegion( Point( 0, 0 ), Size( 20, mnDDHeight ) );
99  tools::Rectangle aBoundingRgn( aCtrlRegion );
100  tools::Rectangle aContentRgn( aCtrlRegion );
102  ControlState::ENABLED, aControlValue,
103  aBoundingRgn, aContentRgn ) )
104  {
105  sal_Int32 nHeight = aBoundingRgn.GetHeight();
106  if( nHeight > mnDDHeight )
107  mnDDHeight = static_cast<sal_uInt16>(nHeight);
108  }
109  }
110 
114  mpFloatWin->SetAutoWidth( true );
115  mpFloatWin->SetPopupModeEndHdl( LINK( this, ListBox, ImplPopupModeEndHdl ) );
116  mpFloatWin->GetDropTarget()->addDropTargetListener(xDrop);
117 
118  mpImplWin = VclPtr<ImplWin>::Create( this, (nStyle & (WB_LEFT|WB_RIGHT|WB_CENTER))|WB_NOBORDER );
119  mpImplWin->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
120  mpImplWin->Show();
121  mpImplWin->GetDropTarget()->addDropTargetListener(xDrop);
122  mpImplWin->SetEdgeBlending(false);
123 
126  mpBtn->SetMBDownHdl( LINK( this, ListBox, ImplClickBtnHdl ) );
127  mpBtn->Show();
128  mpBtn->GetDropTarget()->addDropTargetListener(xDrop);
129  }
130 
131  vcl::Window* pLBParent = this;
132  if ( mpFloatWin )
133  pLBParent = mpFloatWin;
134  mpImplLB = VclPtr<ImplListBox>::Create( pLBParent, nStyle&(~WB_BORDER) );
135  mpImplLB->SetSelectHdl( LINK( this, ListBox, ImplSelectHdl ) );
136  mpImplLB->SetScrollHdl( LINK( this, ListBox, ImplScrollHdl ) );
137  mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
138  mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) );
139  mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) );
140  mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) );
141  mpImplLB->SetPosPixel( Point() );
142  mpImplLB->SetEdgeBlending(false);
143  mpImplLB->Show();
144 
145  mpImplLB->GetDropTarget()->addDropTargetListener(xDrop);
146 
147  if ( mpFloatWin )
148  {
150  mpImplLB->SetSelectionChangedHdl( LINK( this, ListBox, ImplSelectionChangedHdl ) );
151  }
152  else
154 
155  SetCompoundControl( true );
156 }
157 
159 {
160  if ( !(nStyle & WB_NOTABSTOP) )
161  nStyle |= WB_TABSTOP;
162  if ( !(nStyle & WB_NOGROUP) )
163  nStyle |= WB_GROUP;
164  return nStyle;
165 }
166 
167 IMPL_LINK_NOARG(ListBox, ImplSelectHdl, LinkParamNone*, void)
168 {
169  bool bPopup = IsInDropDown();
170  if( IsDropDownBox() )
171  {
172  if( !mpImplLB->IsTravelSelect() )
173  {
174  mpFloatWin->EndPopupMode();
175  mpImplWin->GrabFocus();
176  }
177 
178  mpImplWin->SetItemPos( GetSelectedEntryPos() );
179  mpImplWin->SetString( GetSelectedEntry() );
180  if( mpImplLB->GetEntryList().HasImages() )
181  {
182  Image aImage = mpImplLB->GetEntryList().GetEntryImage( GetSelectedEntryPos() );
183  mpImplWin->SetImage( aImage );
184  }
185  mpImplWin->Invalidate();
186  }
187 
188  if ( ( !IsTravelSelect() || mpImplLB->IsSelectionChanged() ) || ( bPopup && !IsMultiSelectionEnabled() ) )
189  Select();
190 }
191 
192 IMPL_LINK( ListBox, ImplFocusHdl, sal_Int32, nPos, void )
193 {
194  CallEventListeners( VclEventId::ListboxFocus, reinterpret_cast<void*>(nPos) );
195 }
196 
197 IMPL_LINK_NOARG( ListBox, ImplListItemSelectHdl, LinkParamNone*, void )
198 {
199  CallEventListeners( VclEventId::DropdownSelect );
200 }
201 
202 IMPL_LINK_NOARG(ListBox, ImplScrollHdl, ImplListBox*, void)
203 {
204  CallEventListeners( VclEventId::ListboxScrolled );
205 }
206 
207 IMPL_LINK_NOARG(ListBox, ImplCancelHdl, LinkParamNone*, void)
208 {
209  if( IsInDropDown() )
210  mpFloatWin->EndPopupMode();
211 }
212 
213 IMPL_LINK( ListBox, ImplSelectionChangedHdl, sal_Int32, nChanged, void )
214 {
215  if ( mpImplLB->IsTrackingSelect() )
216  return;
217 
218  const ImplEntryList& rEntryList = mpImplLB->GetEntryList();
219  if ( rEntryList.IsEntryPosSelected( nChanged ) )
220  {
221  // FIXME? This should've been turned into an ImplPaintEntry some time ago...
222  if ( nChanged < rEntryList.GetMRUCount() )
223  nChanged = rEntryList.FindEntry( rEntryList.GetEntryText( nChanged ) );
224  mpImplWin->SetItemPos( nChanged );
225  mpImplWin->SetString( rEntryList.GetEntryText( nChanged ) );
226  if( rEntryList.HasImages() )
227  {
228  Image aImage = rEntryList.GetEntryImage( nChanged );
229  mpImplWin->SetImage( aImage );
230  }
231  }
232  else
233  {
234  mpImplWin->SetItemPos( LISTBOX_ENTRY_NOTFOUND );
235  mpImplWin->SetString( OUString() );
236  Image aImage;
237  mpImplWin->SetImage( aImage );
238  }
239  mpImplWin->Invalidate();
240 }
241 
242 IMPL_LINK_NOARG(ListBox, ImplDoubleClickHdl, ImplListBoxWindow*, void)
243 {
244  DoubleClick();
245 }
246 
247 IMPL_LINK_NOARG(ListBox, ImplClickBtnHdl, void*, void)
248 {
249  if( mpFloatWin->IsInPopupMode() )
250  return;
251 
252  CallEventListeners( VclEventId::DropdownPreOpen );
253  mpImplWin->GrabFocus();
254  mpBtn->SetPressed( true );
255  mpFloatWin->StartFloat( true );
256  CallEventListeners( VclEventId::DropdownOpen );
257 
258  ImplClearLayoutData();
259  if( mpImplLB )
260  mpImplLB->GetMainWindow()->ImplClearLayoutData();
261  if( mpImplWin )
262  mpImplWin->ImplClearLayoutData();
263 }
264 
265 IMPL_LINK_NOARG(ListBox, ImplPopupModeEndHdl, FloatingWindow*, void)
266 {
267  if( mpFloatWin->IsPopupModeCanceled() )
268  {
269  if ( ( mpFloatWin->GetPopupModeStartSaveSelection() != LISTBOX_ENTRY_NOTFOUND )
270  && !IsEntryPosSelected( mpFloatWin->GetPopupModeStartSaveSelection() ) )
271  {
272  mpImplLB->SelectEntry( mpFloatWin->GetPopupModeStartSaveSelection(), true );
273  bool bTravelSelect = mpImplLB->IsTravelSelect();
274  mpImplLB->SetTravelSelect( true );
275 
276  VclPtr<vcl::Window> xWindow = this;
277  Select();
278  if ( xWindow->isDisposed() )
279  return;
280 
281  mpImplLB->SetTravelSelect( bTravelSelect );
282  }
283  }
284 
285  ImplClearLayoutData();
286  if( mpImplLB )
287  mpImplLB->GetMainWindow()->ImplClearLayoutData();
288  if( mpImplWin )
289  mpImplWin->ImplClearLayoutData();
290 
291  mpBtn->SetPressed( false );
292  CallEventListeners( VclEventId::DropdownClose );
293 }
294 
296 {
297  if( !IsDropDownBox() )
298  return;
299 
300  if( mpFloatWin->IsInPopupMode() )
302  else
303  {
305  mpImplWin->GrabFocus();
306  mpBtn->SetPressed( true );
307  mpFloatWin->StartFloat( true );
309  }
310 }
311 
313 {
314  rRenderContext.SetBackground();
315 }
316 
317 void ListBox::Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags )
318 {
320 
321  Point aPos = pDev->LogicToPixel( rPos );
322  Size aSize = GetSizePixel();
323  vcl::Font aFont = mpImplLB->GetMainWindow()->GetDrawPixelFont( pDev );
324 
325  pDev->Push();
326  pDev->SetMapMode();
327  pDev->SetFont( aFont );
328  pDev->SetTextFillColor();
329 
330  // Border/Background
331  pDev->SetLineColor();
332  pDev->SetFillColor();
333  bool bBorder = (GetStyle() & WB_BORDER);
334  bool bBackground = IsControlBackground();
335  if ( bBorder || bBackground )
336  {
337  tools::Rectangle aRect( aPos, aSize );
338  if ( bBorder )
339  {
340  ImplDrawFrame( pDev, aRect );
341  }
342  if ( bBackground )
343  {
345  pDev->DrawRect( aRect );
346  }
347  }
348 
349  // Content
350  if ( nFlags & SystemTextColorFlags::Mono )
351  {
352  pDev->SetTextColor( COL_BLACK );
353  }
354  else
355  {
356  if ( !IsEnabled() )
357  {
358  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
359  pDev->SetTextColor( rStyleSettings.GetDisableColor() );
360  }
361  else
362  {
363  pDev->SetTextColor( GetTextColor() );
364  }
365  }
366 
367  const tools::Long nOnePixel = GetDrawPixel( pDev, 1 );
368  const tools::Long nOffX = 3*nOnePixel;
370  tools::Rectangle aTextRect( aPos, aSize );
371 
372  if ( GetStyle() & WB_CENTER )
373  nTextStyle |= DrawTextFlags::Center;
374  else if ( GetStyle() & WB_RIGHT )
375  nTextStyle |= DrawTextFlags::Right;
376  else
377  nTextStyle |= DrawTextFlags::Left;
378 
379  aTextRect.AdjustLeft(nOffX );
380  aTextRect.AdjustRight( -nOffX );
381 
382  if ( IsDropDownBox() )
383  {
384  OUString aText = GetSelectedEntry();
385  tools::Long nTextHeight = pDev->GetTextHeight();
386  tools::Long nTextWidth = pDev->GetTextWidth( aText );
387  tools::Long nOffY = (aSize.Height()-nTextHeight) / 2;
388 
389  // Clipping?
390  if ( (nOffY < 0) ||
391  ((nOffY+nTextHeight) > aSize.Height()) ||
392  ((nOffX+nTextWidth) > aSize.Width()) )
393  {
394  tools::Rectangle aClip( aPos, aSize );
395  if ( nTextHeight > aSize.Height() )
396  aClip.AdjustBottom(nTextHeight-aSize.Height()+1 ); // So that HP Printers don't optimize this away
397  pDev->IntersectClipRegion( aClip );
398  }
399 
400  pDev->DrawText( aTextRect, aText, nTextStyle );
401  }
402  else
403  {
404  tools::Long nTextHeight = pDev->GetTextHeight();
405  sal_uInt16 nLines = ( nTextHeight > 0 ) ? static_cast<sal_uInt16>(aSize.Height() / nTextHeight) : 1;
406  tools::Rectangle aClip( aPos, aSize );
407 
408  pDev->IntersectClipRegion( aClip );
409 
410  if ( !nLines )
411  nLines = 1;
412 
413  for ( sal_uInt16 n = 0; n < nLines; n++ )
414  {
415  sal_Int32 nEntry = n+mpImplLB->GetTopEntry();
416  bool bSelected = mpImplLB->GetEntryList().IsEntryPosSelected( nEntry );
417  if ( bSelected )
418  {
419  pDev->SetFillColor( COL_BLACK );
420  pDev->DrawRect( tools::Rectangle( Point( aPos.X(), aPos.Y() + n*nTextHeight ),
421  Point( aPos.X() + aSize.Width(), aPos.Y() + (n+1)*nTextHeight + 2*nOnePixel ) ) );
422  pDev->SetFillColor();
423  pDev->SetTextColor( COL_WHITE );
424  }
425 
426  aTextRect.SetTop( aPos.Y() + n*nTextHeight );
427  aTextRect.SetBottom( aTextRect.Top() + nTextHeight );
428 
429  pDev->DrawText( aTextRect, mpImplLB->GetEntryList().GetEntryText( nEntry ), nTextStyle );
430 
431  if ( bSelected )
432  pDev->SetTextColor( COL_BLACK );
433  }
434  }
435 
436  pDev->Pop();
437 }
438 
440 {
441  if ( mpImplLB )
442  {
443  if( IsDropDownBox() )
444  mpImplWin->GrabFocus();
445  else
446  mpImplLB->GrabFocus();
447  }
448 
450 }
451 
453 {
454  if( IsDropDownBox() )
455  {
456  if (mpImplWin)
457  mpImplWin->HideFocus();
458  }
459  else
460  {
461  if (mpImplLB)
462  mpImplLB->HideFocus();
463  }
464 
466 }
467 
469 {
470  Control::DataChanged( rDCEvt );
471 
472  if ( !((rDCEvt.GetType() == DataChangedEventType::FONTS) ||
474  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
475  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
476  return;
477 
478  SetBackground(); // Due to a hack in Window::UpdateSettings the background must be reset
479  // otherwise it will overpaint NWF drawn listboxes
480  Resize();
481  mpImplLB->Resize(); // Is not called by ListBox::Resize() if the ImplLB does not change
482 
483  if ( mpImplWin )
484  {
485  mpImplWin->GetOutDev()->SetSettings( GetSettings() ); // If not yet set...
487 
490  }
491 
492  if ( IsDropDownBox() )
493  Invalidate();
494 }
495 
496 void ListBox::EnableAutoSize( bool bAuto )
497 {
498  mbDDAutoSize = bAuto;
499  if ( mpFloatWin )
500  {
501  if ( bAuto && !mpFloatWin->GetDropDownLineCount() )
502  {
503  // use GetListBoxMaximumLineCount here; before, was on fixed number of five
505  }
506  else if ( !bAuto )
507  {
509  }
510  }
511 }
512 
513 void ListBox::SetDropDownLineCount( sal_uInt16 nLines )
514 {
515  mnLineCount = nLines;
516  if ( mpFloatWin )
518 }
519 
521 {
522  // Adapt to maximum allowed number.
523  // Limit for LOK as we can't render outside of the dialog canvas.
526  else
527  SetDropDownLineCount(GetSettings().GetStyleSettings().GetListBoxMaximumLineCount());
528 }
529 
531 {
532  if ( mpFloatWin )
534  return mnLineCount;
535 }
536 
538 {
539  if( IsDropDownBox() && ( nFlags & PosSizeFlags::Size ) )
540  {
541  Size aPrefSz = mpFloatWin->GetPrefSize();
542  if ( ( nFlags & PosSizeFlags::Height ) && ( nHeight >= 2*mnDDHeight ) )
543  aPrefSz.setHeight( nHeight-mnDDHeight );
544  if ( nFlags & PosSizeFlags::Width )
545  aPrefSz.setWidth( nWidth );
546  mpFloatWin->SetPrefSize( aPrefSz );
547 
548  if (IsAutoSizeEnabled())
549  nHeight = mnDDHeight;
550  }
551 
552  Control::setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
553 }
554 
556 {
557  Size aOutSz = GetOutputSizePixel();
558  if( IsDropDownBox() )
559  {
560  // Initialize the dropdown button size with the standard scrollbar width
562  tools::Long nBottom = aOutSz.Height();
563 
564  // Note: in case of no border, pBorder will actually be this
566  ImplControlValue aControlValue;
567  Point aPoint;
568  tools::Rectangle aContent, aBound;
569 
570  // Use the full extent of the control
571  tools::Rectangle aArea( aPoint, pBorder->GetOutputSizePixel() );
572 
574  aArea, ControlState::NONE, aControlValue, aBound, aContent) )
575  {
576  // Convert back from border space to local coordinates
577  aPoint = pBorder->ScreenToOutputPixel( OutputToScreenPixel( aPoint ) );
578  aContent.Move( -aPoint.X(), -aPoint.Y() );
579 
580  // Use the themes drop down size for the button
581  aOutSz.setWidth( aContent.Left() );
582  mpBtn->setPosSizePixel( aContent.Left(), 0, aContent.GetWidth(), nBottom );
583 
584  // Adjust the size of the edit field
586  aArea, ControlState::NONE, aControlValue, aBound, aContent) )
587  {
588  // Convert back from border space to local coordinates
589  aContent.Move( -aPoint.X(), -aPoint.Y() );
590 
591  // Use the themes drop down size
593  {
594  // No border but focus ring behavior -> we have a problem; the
595  // native rect relies on the border to draw the focus
596  // let's do the best we can and center vertically, so it doesn't look
597  // completely wrong.
598  Size aSz( GetOutputSizePixel() );
599  tools::Long nDiff = aContent.Top() - (aSz.Height() - aContent.GetHeight())/2;
600  aContent.AdjustTop( -nDiff );
601  aContent.AdjustBottom( -nDiff );
602  }
603  mpImplWin->SetPosSizePixel( aContent.TopLeft(), aContent.GetSize() );
604  }
605  else
606  mpImplWin->SetSizePixel( aOutSz );
607  }
608  else
609  {
610  nSBWidth = CalcZoom( nSBWidth );
611  mpImplWin->setPosSizePixel( 0, 0, aOutSz.Width() - nSBWidth, aOutSz.Height() );
612  mpBtn->setPosSizePixel( aOutSz.Width() - nSBWidth, 0, nSBWidth, aOutSz.Height() );
613  }
614  }
615  else
616  {
617  mpImplLB->SetSizePixel( aOutSz );
618  }
619 
620  // Retain FloatingWindow size even when it's invisible, as we still process KEY_PGUP/DOWN ...
621  if ( mpFloatWin )
623 
624  Control::Resize();
625 }
626 
628 {
629  mxLayoutData.emplace();
630  const ImplListBoxWindow* rMainWin = mpImplLB->GetMainWindow();
631  if( mpFloatWin )
632  {
633  // Dropdown mode
636  if( mpFloatWin->IsReallyVisible() )
637  {
638  AppendLayoutData( *rMainWin );
639  rMainWin->SetLayoutDataParent( this );
640  }
641  }
642  else
643  {
644  AppendLayoutData( *rMainWin );
645  rMainWin->SetLayoutDataParent( this );
646  }
647 }
648 
649 tools::Long ListBox::GetIndexForPoint( const Point& rPoint, sal_Int32& rPos ) const
650 {
651  if( !HasLayoutData() )
652  FillLayoutData();
653 
654  // Check whether rPoint fits at all
656  if( nIndex != -1 )
657  {
658  // Point must be either in main list window
659  // or in impl window (dropdown case)
661 
662  // Convert coordinates to ImplListBoxWindow pixel coordinate space
663  Point aConvPoint = LogicToPixel( rPoint );
664  aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
665  aConvPoint = rMain->AbsoluteScreenToOutputPixel( aConvPoint );
666  aConvPoint = rMain->PixelToLogic( aConvPoint );
667 
668  // Try to find entry
669  sal_Int32 nEntry = rMain->GetEntryPosForPoint( aConvPoint );
670  if( nEntry == LISTBOX_ENTRY_NOTFOUND )
671  {
672  // Not found, maybe dropdown case
674  {
675  // Convert to impl window pixel coordinates
676  aConvPoint = LogicToPixel( rPoint );
677  aConvPoint = OutputToAbsoluteScreenPixel( aConvPoint );
678  aConvPoint = mpImplWin->AbsoluteScreenToOutputPixel( aConvPoint );
679 
680  // Check whether converted point is inside impl window
681  Size aImplWinSize = mpImplWin->GetOutputSizePixel();
682  if( aConvPoint.X() >= 0 && aConvPoint.Y() >= 0 && aConvPoint.X() < aImplWinSize.Width() && aConvPoint.Y() < aImplWinSize.Height() )
683  {
684  // Inside the impl window, the position is the current item pos
685  rPos = mpImplWin->GetItemPos();
686  }
687  else
688  nIndex = -1;
689  }
690  else
691  nIndex = -1;
692  }
693  else
694  rPos = nEntry;
695 
696  SAL_WARN_IF( nIndex == -1, "vcl", "found index for point, but relative index failed" );
697  }
698 
699  // Get line relative index
700  if( nIndex != -1 )
701  nIndex = ToRelativeLineIndex( nIndex );
702 
703  return nIndex;
704 }
705 
707 {
708  if( nType == StateChangedType::ReadOnly )
709  {
710  if( mpImplWin )
711  mpImplWin->Enable( !IsReadOnly() );
712  if( mpBtn )
713  mpBtn->Enable( !IsReadOnly() );
714  }
715  else if( nType == StateChangedType::Enable )
716  {
717  mpImplLB->Enable( IsEnabled() );
718  if( mpImplWin )
719  {
720  mpImplWin->Enable( IsEnabled() );
723  {
725  }
726  else
728  }
729  if( mpBtn )
730  mpBtn->Enable( IsEnabled() );
731  }
732  else if( nType == StateChangedType::UpdateMode )
733  {
735  }
736  else if ( nType == StateChangedType::Zoom )
737  {
738  mpImplLB->SetZoom( GetZoom() );
739  if ( mpImplWin )
740  {
741  mpImplWin->SetZoom( GetZoom() );
744  }
745  Resize();
746  }
747  else if ( nType == StateChangedType::ControlFont )
748  {
750  if ( mpImplWin )
751  {
755  }
756  Resize();
757  }
758  else if ( nType == StateChangedType::ControlForeground )
759  {
761  if ( mpImplWin )
762  {
767  }
768  }
769  else if ( nType == StateChangedType::ControlBackground )
770  {
772  if ( mpImplWin )
773  {
775  {
776  // Transparent background
779  }
780  else
781  {
784  }
787  }
788  }
789  else if ( nType == StateChangedType::Style )
790  {
792  mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) != 0 );
793  bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
794  mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
795  }
796  else if( nType == StateChangedType::Mirroring )
797  {
798  if( mpBtn )
799  {
802  }
804  if( mpImplWin )
806  Resize();
807  }
808 
809  Control::StateChanged( nType );
810 }
811 
813 {
814  bool bDone = false;
815  if ( mpImplLB )
816  {
817  if( ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) && ( rNEvt.GetWindow() == mpImplWin ) )
818  {
819  KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
820  switch( aKeyEvt.GetKeyCode().GetCode() )
821  {
822  case KEY_DOWN:
823  {
824  if( mpFloatWin && !mpFloatWin->IsInPopupMode() &&
825  aKeyEvt.GetKeyCode().IsMod2() )
826  {
828  mpBtn->SetPressed( true );
829  mpFloatWin->StartFloat( false );
831  bDone = true;
832  }
833  else
834  {
835  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
836  }
837  }
838  break;
839  case KEY_UP:
840  {
841  if( mpFloatWin && mpFloatWin->IsInPopupMode() &&
842  aKeyEvt.GetKeyCode().IsMod2() )
843  {
845  bDone = true;
846  }
847  else
848  {
849  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
850  }
851  }
852  break;
853  case KEY_RETURN:
854  {
855  if( IsInDropDown() )
856  {
857  mpImplLB->ProcessKeyInput( aKeyEvt );
858  bDone = true;
859  }
860  }
861  break;
862 
863  default:
864  {
865  bDone = mpImplLB->ProcessKeyInput( aKeyEvt );
866  }
867  }
868  }
869  else if ( rNEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
870  {
871  if ( IsInDropDown() && !HasChildPathFocus( true ) )
873  }
874  else if ( (rNEvt.GetType() == MouseNotifyEvent::COMMAND) &&
876  (rNEvt.GetWindow() == mpImplWin) )
877  {
878  MouseWheelBehaviour nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() );
879  if ( ( nWheelBehavior == MouseWheelBehaviour::ALWAYS )
880  || ( ( nWheelBehavior == MouseWheelBehaviour::FocusOnly )
881  && HasChildPathFocus()
882  )
883  )
884  {
885  bDone = mpImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this);
886  }
887  else
888  {
889  bDone = false; // Don't consume this event, let the default handling take it (i.e. scroll the context)
890  }
891  }
892  }
893 
894  return bDone || Control::PreNotify( rNEvt );
895 }
896 
898 {
900 }
901 
903 {
905 }
906 
908 {
909  if (!mpImplLB)
910  return;
911  mpImplLB->Clear();
912  if( IsDropDownBox() )
913  {
915  mpImplWin->SetString( OUString() );
916  Image aImage;
917  mpImplWin->SetImage( aImage );
919  }
920  CallEventListeners( VclEventId::ListboxItemRemoved, reinterpret_cast<void*>(-1) );
921 }
922 
924 {
926  if( IsDropDownBox() )
927  {
929  mpImplWin->SetString( OUString() );
930  Image aImage;
931  mpImplWin->SetImage( aImage );
933  }
934 }
935 
936 sal_Int32 ListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos )
937 {
938  sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList().GetMRUCount(), rStr );
939  nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - mpImplLB->GetEntryList().GetMRUCount());
940  CallEventListeners( VclEventId::ListboxItemAdded, reinterpret_cast<void*>(nRealPos) );
941  return nRealPos;
942 }
943 
944 sal_Int32 ListBox::InsertEntry( const OUString& rStr, const Image& rImage, sal_Int32 nPos )
945 {
946  sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + mpImplLB->GetEntryList().GetMRUCount(), rStr, rImage );
947  nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - mpImplLB->GetEntryList().GetMRUCount());
948  CallEventListeners( VclEventId::ListboxItemAdded, reinterpret_cast<void*>(nRealPos) );
949  return nRealPos;
950 }
951 
952 void ListBox::RemoveEntry( sal_Int32 nPos )
953 {
955  CallEventListeners( VclEventId::ListboxItemRemoved, reinterpret_cast<void*>(nPos) );
956 }
957 
958 Image ListBox::GetEntryImage( sal_Int32 nPos ) const
959 {
960  if ( mpImplLB && mpImplLB->GetEntryList().HasEntryImage( nPos ) )
961  return mpImplLB->GetEntryList().GetEntryImage( nPos );
962  return Image();
963 }
964 
965 sal_Int32 ListBox::GetEntryPos( std::u16string_view rStr ) const
966 {
967  if (!mpImplLB)
968  return LISTBOX_ENTRY_NOTFOUND;
969  sal_Int32 nPos = mpImplLB->GetEntryList().FindEntry( rStr );
970  if ( nPos != LISTBOX_ENTRY_NOTFOUND )
971  nPos = nPos - mpImplLB->GetEntryList().GetMRUCount();
972  return nPos;
973 }
974 
975 OUString ListBox::GetEntry( sal_Int32 nPos ) const
976 {
977  if (!mpImplLB)
978  return OUString();
980 }
981 
982 sal_Int32 ListBox::GetEntryCount() const
983 {
984  if (!mpImplLB)
985  return 0;
987 }
988 
989 OUString ListBox::GetSelectedEntry(sal_Int32 nIndex) const
990 {
991  return GetEntry( GetSelectedEntryPos( nIndex ) );
992 }
993 
995 {
996  if (!mpImplLB)
997  return 0;
999 }
1000 
1001 sal_Int32 ListBox::GetSelectedEntryPos( sal_Int32 nIndex ) const
1002 {
1003  if (!mpImplLB)
1004  return LISTBOX_ENTRY_NOTFOUND;
1005 
1006  sal_Int32 nPos = mpImplLB->GetEntryList().GetSelectedEntryPos( nIndex );
1007  if ( nPos != LISTBOX_ENTRY_NOTFOUND )
1008  {
1009  if ( nPos < mpImplLB->GetEntryList().GetMRUCount() )
1011  nPos = nPos - mpImplLB->GetEntryList().GetMRUCount();
1012  }
1013  return nPos;
1014 }
1015 
1016 bool ListBox::IsEntryPosSelected( sal_Int32 nPos ) const
1017 {
1019 }
1020 
1021 void ListBox::SelectEntry( std::u16string_view rStr, bool bSelect )
1022 {
1023  SelectEntryPos( GetEntryPos( rStr ), bSelect );
1024 }
1025 
1026 void ListBox::SelectEntryPos( sal_Int32 nPos, bool bSelect )
1027 {
1028  if (!mpImplLB)
1029  return;
1030 
1031  if ( 0 <= nPos && nPos < mpImplLB->GetEntryList().GetEntryCount() )
1032  {
1033  sal_Int32 nCurrentPos = mpImplLB->GetCurrentPos();
1034  mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList().GetMRUCount(), bSelect );
1035  //Only when bSelect == true, send both Selection & Focus events
1036  if (nCurrentPos != nPos && bSelect)
1037  {
1038  CallEventListeners( VclEventId::ListboxSelect, reinterpret_cast<void*>(nPos));
1039  if (HasFocus())
1040  CallEventListeners( VclEventId::ListboxFocus, reinterpret_cast<void*>(nPos));
1041  }
1042  }
1043 }
1044 
1045 void ListBox::SelectEntriesPos( const std::vector<sal_Int32>& rPositions, bool bSelect )
1046 {
1047  if (!mpImplLB)
1048  return;
1049 
1050  bool bCallListeners = false;
1051 
1052  const sal_Int32 nCurrentPos = mpImplLB->GetCurrentPos();
1053  const auto nEntryCount = mpImplLB->GetEntryList().GetEntryCount();
1054  const auto nMRUCount = mpImplLB->GetEntryList().GetMRUCount();
1055 
1056  for (auto nPos : rPositions)
1057  {
1058  if (0 <= nPos && nPos < nEntryCount)
1059  {
1060  mpImplLB->SelectEntry(nPos + nMRUCount, bSelect);
1061  if (nCurrentPos != nPos && bSelect)
1062  bCallListeners = true;
1063  }
1064  }
1065 
1066  //Only when bSelect == true, send both Selection & Focus events
1067  if (bCallListeners)
1068  {
1070  if (HasFocus())
1072  }
1073 }
1074 
1075 void ListBox::SetEntryData( sal_Int32 nPos, void* pNewData )
1076 {
1077  mpImplLB->SetEntryData( nPos + mpImplLB->GetEntryList().GetMRUCount(), pNewData );
1078 }
1079 
1080 void* ListBox::GetEntryData( sal_Int32 nPos ) const
1081 {
1083 }
1084 
1085 void ListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
1086 {
1087  mpImplLB->SetEntryFlags( nPos + mpImplLB->GetEntryList().GetMRUCount(), nFlags );
1088 }
1089 
1090 void ListBox::SetTopEntry( sal_Int32 nPos )
1091 {
1093 }
1094 
1095 sal_Int32 ListBox::GetTopEntry() const
1096 {
1098  if ( nPos < mpImplLB->GetEntryList().GetMRUCount() )
1099  nPos = 0;
1100  return nPos;
1101 }
1102 
1104 {
1105  return mpImplLB->IsTravelSelect();
1106 }
1107 
1109 {
1110  // when the dropdown is dismissed, first mbInPopupMode is set to false, and on the next event iteration then
1111  // mbPopupMode is set to false
1113 }
1114 
1116 {
1118  tools::Rectangle aOffset = mpImplLB->GetMainWindow()->GetWindowExtentsRelative( static_cast<vcl::Window*>(const_cast<ListBox *>(this)) );
1119  aRect.Move( aOffset.Left(), aOffset.Top() );
1120  return aRect;
1121 }
1122 
1124 {
1125  mpImplLB->EnableMultiSelection( bMulti );
1126 
1127  // WB_SIMPLEMODE:
1128  // The MultiListBox behaves just like a normal ListBox
1129  // MultiSelection is possible via corresponding additional keys
1130  bool bSimpleMode = ( GetStyle() & WB_SIMPLEMODE ) != 0;
1131  mpImplLB->SetMultiSelectionSimpleMode( bSimpleMode );
1132 
1133  // In a MultiSelection, we can't see us travelling without focus
1134  if ( mpFloatWin )
1135  mpImplLB->GetMainWindow()->AllowGrabFocus( bMulti );
1136 }
1137 
1139 {
1141 }
1142 
1144 {
1145  Size aSz;
1146 
1147  if (!mpImplLB)
1148  return aSz;
1149 
1150  aSz = CalcSubEditSize();
1151 
1152  bool bAddScrollWidth = false;
1153 
1154  if (IsDropDownBox())
1155  {
1156  aSz.AdjustHeight(4 ); // add a space between entry and border
1157  aSz.AdjustWidth(4 ); // add a little breathing space
1158  bAddScrollWidth = true;
1159  }
1160  else
1161  bAddScrollWidth = (GetStyle() & WB_VSCROLL) == WB_VSCROLL;
1162 
1163  if (bAddScrollWidth)
1164  {
1165  // Try native borders; scrollbar size may not be a good indicator
1166  // See how large the edit area inside is to estimate what is needed for the dropdown
1167  ImplControlValue aControlValue;
1168  tools::Rectangle aContent, aBound;
1169  Size aTestSize( 100, 20 );
1170  tools::Rectangle aArea( Point(), aTestSize );
1172  aControlValue, aBound, aContent) )
1173  {
1174  // use the themes drop down size
1175  aSz.AdjustWidth(aTestSize.Width() - aContent.GetWidth() );
1176  }
1177  else
1178  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1179  }
1180 
1181  aSz = CalcWindowSize( aSz );
1182 
1183  if (IsDropDownBox()) // Check minimum height of dropdown box
1184  {
1185  ImplControlValue aControlValue;
1186  tools::Rectangle aRect( Point( 0, 0 ), aSz );
1187  tools::Rectangle aContent, aBound;
1189  aControlValue, aBound, aContent) )
1190  {
1191  if( aBound.GetHeight() > aSz.Height() )
1192  aSz.setHeight( aBound.GetHeight() );
1193  }
1194  }
1195 
1196  return aSz;
1197 }
1198 
1200 {
1201  Size aSz;
1202 
1203  if (!mpImplLB)
1204  return aSz;
1205 
1206  if ( !IsDropDownBox() )
1208  else
1209  {
1210  aSz.setHeight( mpImplLB->GetEntryHeight() );
1211  // Size to maximum entry width
1213 
1214  if (m_nMaxWidthChars != -1)
1215  {
1217  aSz.setWidth( std::min(aSz.Width(), nMaxWidth) );
1218  }
1219 
1220  // Do not create ultrathin ListBoxes, it doesn't look good
1222  aSz.setWidth( GetSettings().GetStyleSettings().GetScrollBarSize() );
1223  }
1224 
1225  return aSz;
1226 }
1227 
1229 {
1230  return CalcMinimumSize();
1231 }
1232 
1233 Size ListBox::CalcAdjustedSize( const Size& rPrefSize ) const
1234 {
1235  Size aSz = rPrefSize;
1236  sal_Int32 nLeft, nTop, nRight, nBottom;
1237  static_cast<vcl::Window*>(const_cast<ListBox *>(this))->GetBorder( nLeft, nTop, nRight, nBottom );
1238  aSz.AdjustHeight( -(nTop+nBottom) );
1239  if ( !IsDropDownBox() )
1240  {
1241  tools::Long nEntryHeight = CalcBlockSize( 1, 1 ).Height();
1242  tools::Long nLines = aSz.Height() / nEntryHeight;
1243  if ( nLines < 1 )
1244  nLines = 1;
1245  aSz.setHeight( nLines * nEntryHeight );
1246  }
1247  else
1248  {
1249  aSz.setHeight( mnDDHeight );
1250  }
1251  aSz.AdjustHeight(nTop+nBottom );
1252 
1253  aSz = CalcWindowSize( aSz );
1254  return aSz;
1255 }
1256 
1257 Size ListBox::CalcBlockSize( sal_uInt16 nColumns, sal_uInt16 nLines ) const
1258 {
1259  // ScrollBars are shown if needed
1260  Size aMinSz = CalcMinimumSize();
1261  // aMinSz = ImplCalcOutSz( aMinSz );
1262 
1263  Size aSz;
1264 
1265  // Height
1266  if ( nLines )
1267  {
1268  if ( !IsDropDownBox() )
1269  aSz.setHeight( mpImplLB->CalcSize( nLines ).Height() );
1270  else
1271  aSz.setHeight( mnDDHeight );
1272  }
1273  else
1274  aSz.setHeight( aMinSz.Height() );
1275 
1276  // Width
1277  if ( nColumns )
1278  aSz.setWidth( nColumns * GetTextWidth( OUString('X') ) );
1279  else
1280  aSz.setWidth( aMinSz.Width() );
1281 
1282  if ( IsDropDownBox() )
1283  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1284 
1285  if ( !IsDropDownBox() )
1286  {
1287  if ( aSz.Width() < aMinSz.Width() )
1288  aSz.AdjustHeight(GetSettings().GetStyleSettings().GetScrollBarSize() );
1289  if ( aSz.Height() < aMinSz.Height() )
1290  aSz.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize() );
1291  }
1292 
1293  aSz = CalcWindowSize( aSz );
1294  return aSz;
1295 }
1296 
1297 void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
1298 {
1299  float nCharWidth = approximate_char_width();
1300  if ( !IsDropDownBox() )
1301  {
1303  rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth);
1304  rnLines = static_cast<sal_uInt16>(aOutSz.Height()/mpImplLB->GetEntryHeightWithMargin());
1305  }
1306  else
1307  {
1308  Size aOutSz = mpImplWin->GetOutputSizePixel();
1309  rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth);
1310  rnLines = 1;
1311  }
1312 }
1313 
1314 void ListBox::SetReadOnly( bool bReadOnly )
1315 {
1316  if ( mpImplLB->IsReadOnly() != bReadOnly )
1317  {
1318  mpImplLB->SetReadOnly( bReadOnly );
1320  }
1321 }
1322 
1324 {
1325  return mpImplLB->IsReadOnly();
1326 }
1327 
1328 void ListBox::SetSeparatorPos( sal_Int32 n )
1329 {
1330  mpImplLB->SetSeparatorPos( n );
1331 }
1332 
1333 sal_Int32 ListBox::GetSeparatorPos() const
1334 {
1335  return mpImplLB->GetSeparatorPos();
1336 }
1337 
1338 void ListBox::AddSeparator( sal_Int32 n )
1339 {
1340  mpImplLB->AddSeparator( n );
1341 }
1342 
1344 {
1345  return mpImplLB->GetDisplayLineCount();
1346 }
1347 
1349 {
1351 }
1352 
1354 {
1355  // !!! Recursion does not occur because the ImplListBox is initialized by default
1356  // to a non-transparent color in Window::ImplInitData
1357  return mpImplLB->GetDisplayBackground();
1358 }
1359 
1360 void ListBox::setMaxWidthChars(sal_Int32 nWidth)
1361 {
1362  if (nWidth != m_nMaxWidthChars)
1363  {
1364  m_nMaxWidthChars = nWidth;
1365  queue_resize();
1366  }
1367 }
1368 
1369 bool ListBox::set_property(const OString &rKey, const OUString &rValue)
1370 {
1371  if (rKey == "active")
1372  SelectEntryPos(rValue.toInt32());
1373  else if (rKey == "max-width-chars")
1374  setMaxWidthChars(rValue.toInt32());
1375  else if (rKey == "can-focus")
1376  {
1377  // as far as I can see in Gtk, setting a ComboBox as can.focus means
1378  // the focus gets stuck in it, so try here to behave like gtk does
1379  // with the settings that work, i.e. can.focus of false doesn't
1380  // set the hard WB_NOTABSTOP
1381  WinBits nBits = GetStyle();
1382  nBits &= ~(WB_TABSTOP|WB_NOTABSTOP);
1383  if (toBool(rValue))
1384  nBits |= WB_TABSTOP;
1385  SetStyle(nBits);
1386  }
1387  else
1388  return Control::set_property(rKey, rValue);
1389  return true;
1390 }
1391 
1393 {
1394  return ListBoxUIObject::create;
1395 }
1396 
1398 {
1399  Control::DumpAsPropertyTree(rJsonWriter);
1400 
1401  {
1402  auto entriesNode = rJsonWriter.startArray("entries");
1403  for (int i = 0; i < GetEntryCount(); ++i)
1404  {
1405  rJsonWriter.putSimpleValue(GetEntry(i));
1406  }
1407  }
1408 
1409  rJsonWriter.put("selectedCount", GetSelectedEntryCount());
1410 
1411  {
1412  auto entriesNode = rJsonWriter.startArray("selectedEntries");
1413  for (int i = 0; i < GetSelectedEntryCount(); ++i)
1414  {
1415  rJsonWriter.putSimpleValue(OUString::number(GetSelectedEntryPos(i)));
1416  }
1417  }
1418 }
1419 
1420 MultiListBox::MultiListBox( vcl::Window* pParent, WinBits nStyle ) :
1422 {
1423  ImplInit( pParent, nStyle );
1424  EnableMultiSelection( true );
1425 }
1426 
1427 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool toBool(std::string_view rValue)
Definition: builder.cxx:89
sal_Int32 m_nMaxWidthChars
Definition: lstbox.hxx:90
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
bool IsControlBackground() const
Definition: window2.cxx:1081
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:64
bool IsInPopupMode() const
Definition: floatwin.hxx:130
virtual Size GetOptimalSize() const override
Definition: listbox.cxx:1228
void SetBackground()
Definition: window3.cxx:100
Image GetEntryImage(sal_Int32 nPos) const
Definition: listbox.cxx:958
bool IsDropDownBox() const
Definition: lstbox.hxx:114
bool ImplCallEventListenersAndHandler(VclEventId nEvent, std::function< void()> const &callHandler)
this calls both our event listeners, and a specified handler
Definition: ctrl.cxx:300
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:475
OUString GetSelectedEntry(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:989
void HideFocus()
Definition: window2.cxx:93
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const
Definition: floatwin.hxx:104
sal_Int32 nIndex
void RemoveEntry(sal_Int32 nPos)
Definition: listbox.cxx:952
void SetPopupModeEndHdl(const Link< FloatingWindow *, void > &rLink)
Definition: floatwin.hxx:135
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:567
bool HasEntryImage(sal_Int32 nPos) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: listbox.cxx:312
void SetNoSelection()
sal_Int32 GetSelectedEntryPos(sal_Int32 nSelIndex=0) const
Definition: listbox.cxx:1001
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.hxx:441
void setWidth(tools::Long nWidth)
sal_uInt16 mnDDHeight
Definition: lstbox.hxx:89
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
const CommandEvent * GetCommandEvent() const
Definition: event.hxx:332
bool IsTravelSelect() const
Definition: listbox.hxx:458
VclPtr< ImplBtn > mpBtn
Definition: lstbox.hxx:88
std::optional< vcl::ControlLayoutData > mxLayoutData
Definition: ctrl.hxx:84
SAL_DLLPRIVATE void ImplDrawFrame(OutputDevice *pDev, tools::Rectangle &rRect)
draws a frame around the give rectangle, onto the given device
Definition: ctrl.cxx:330
A widget used to choose from a list of items and which has no entry.
Definition: lstbox.hxx:82
IMPL_LINK_NOARG(ListBox, ImplSelectHdl, LinkParamNone *, void)
Definition: listbox.cxx:167
constexpr tools::Long Left() const
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: listbox.cxx:78
SAL_DLLPRIVATE float approximate_char_width() const
Definition: window3.cxx:61
void AllowGrabFocus(bool b)
Definition: listbox.hxx:298
WinBits const WB_NOGROUP
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2862
long Long
void disposeAndClear()
Definition: vclptr.hxx:200
const StyleSettings & GetStyleSettings() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:33
ScopedJsonWriterArray startArray(const char *)
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:462
void Select()
Definition: listbox.cxx:897
const Size & GetPrefSize() const
Definition: listbox.hxx:515
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:255
ImplSVNWFData maNWFData
Definition: svdata.hxx:402
sal_Int64 n
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:449
virtual Size GetSizePixel() const
Definition: window.cxx:2402
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1256
WinBits const WB_RIGHT
sal_Int32 GetEntryPosForPoint(const Point &rPoint) const
SAL_DLLPRIVATE void CompatStateChanged(StateChangedType nStateChange)
Definition: window.cxx:3891
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
virtual FactoryFunction GetUITestFactory() const override
Definition: listbox.cxx:1392
void SetTextFillColor()
Definition: text.cxx:706
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
sal_Int32 FindEntry(std::u16string_view rStr, bool bSearchMRUArea=false) const
sal_Int32 GetSelectedEntryCount() const
PosSizeFlags
Definition: window.hxx:125
DataChangedEventType GetType() const
Definition: event.hxx:362
const KeyEvent * GetKeyEvent() const
Definition: event.hxx:316
void IntersectClipRegion(const tools::Rectangle &rRect)
void AppendLayoutData(const Control &rSubControl) const
Definition: ctrl.cxx:268
WinBits const WB_VSCROLL
void SetDropDownLineCount(sal_uInt16 nLines)
Definition: listbox.cxx:513
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:216
void Clear()
Definition: listbox.cxx:907
const Color & GetControlBackground() const
Definition: window2.cxx:1076
VclPtr< ImplListBox > mpImplLB
Definition: lstbox.hxx:85
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
Definition: listbox.cxx:1328
bool IsReadOnly() const
Definition: listbox.hxx:467
void DoubleClick()
Definition: listbox.cxx:902
void SetDropDownLineCount(sal_uInt16 n)
Definition: listbox.hxx:525
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
bool IsRTLEnabled() const
Definition: window3.cxx:127
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3004
void SetMapMode()
Definition: map.cxx:594
DrawTextFlags
void SetTextColor(const Color &rColor)
Definition: window3.cxx:108
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:37
The invalidated area is painted with the background color/pattern.
const Fraction & GetZoom() const
Definition: window2.cxx:1204
void * GetEntryData(sal_Int32 nPos) const
StateChangedType
Definition: window.hxx:289
constexpr tools::Long Width() const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:472
sal_Int64 WinBits
vcl::Window * GetWindow() const
Definition: event.hxx:309
void SetBackground()
Definition: background.cxx:27
void SetControlFont()
Definition: window2.cxx:403
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:427
void SetReadOnly(bool b)
Definition: listbox.hxx:466
void Enable(bool bEnable=true, bool bChild=true)
Definition: window.cxx:2433
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
Definition: listbox.cxx:1115
void EnableAutoSize(bool bAuto)
Definition: listbox.cxx:496
sal_Int32 GetEntryCount() const
Definition: listbox.cxx:982
Size CalcAdjustedSize(const Size &rPrefSize) const
Definition: listbox.cxx:1233
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: listbox.cxx:468
virtual void DumpAsPropertyTree(tools::JsonWriter &)
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: window.cxx:3358
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:446
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.hxx:419
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
virtual const Wallpaper & GetDisplayBackground() const override
void EnableMultiSelection(bool bMulti)
Definition: listbox.cxx:1123
constexpr tools::Long GetWidth() const
SystemTextColorFlags
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1321
void * GetEntryData(sal_Int32 nPos) const
Definition: listbox.cxx:1080
void Pop()
Definition: stack.cxx:92
void SetCompoundControl(bool bCompound)
Definition: window2.cxx:941
OUString GetEntry(sal_Int32 nPos) const
Definition: listbox.cxx:975
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:477
tools::Rectangle GetWindowExtentsRelative(const vcl::Window *pRelativeWindow) const
Definition: window.cxx:2910
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
bool IsReadOnly() const
Definition: listbox.cxx:1323
bool mbDDAutoSize
Definition: lstbox.hxx:94
Image GetEntryImage(sal_Int32 nPos) const
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:411
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
const Color & GetControlForeground() const
Definition: window2.cxx:1066
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:464
void SelectEntry(std::u16string_view rStr, bool bSelect=true)
Definition: listbox.cxx:1021
void SetTopEntry(sal_Int32 nTop)
Definition: listbox.hxx:448
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
void RemoveEntry(sal_Int32 nPos)
WinBits const WB_NOLIGHTBORDER
sal_Int32 GetMRUCount() const
Definition: listbox.hxx:158
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.hxx:490
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:75
Size CalcWindowSize(const Size &rOutSz) const
Definition: window2.cxx:531
bool IsAutoSizeEnabled() const
Definition: lstbox.hxx:150
void SetScrollHdl(const Link< ImplListBox *, void > &rLink)
Definition: listbox.hxx:474
void SetLineColor()
Definition: line.cxx:36
sal_Int32 GetScrollBarSize() const
const Color & GetDisableColor() const
Point LogicToPixel(const Point &rLogicPt) const
Definition: window3.cxx:131
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:52
virtual bool set_property(const OString &rKey, const OUString &rValue) override
Definition: listbox.cxx:1369
int i
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: text.cxx:863
virtual void Resize() override
void setMaxWidthChars(sal_Int32 nWidth)
Definition: listbox.cxx:1360
bool IsEntryPosSelected(sal_Int32 nIndex) const
tools::Long GetEntryHeight() const
Definition: listbox.hxx:470
The edit field part of a control, e.g.
bool IsNativeWidgetEnabled() const
Definition: window.cxx:3703
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.cxx:1338
void SetControlBackground()
Definition: window2.cxx:491
void SelectEntryPos(sal_Int32 nPos, bool bSelect=true)
Definition: listbox.cxx:1026
WinBits const WB_SIMPLEMODE
void SetReadOnly(bool bReadOnly=true)
Definition: listbox.cxx:1314
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.hxx:526
void SetImage(const Image &rImg)
Definition: listbox.hxx:565
void SelectEntriesPos(const std::vector< sal_Int32 > &rPositions, bool bSelect=true)
Definition: listbox.cxx:1045
void SetControlForeground()
Definition: window2.cxx:451
tools::Rectangle GetDropDownPosSizePixel() const
Definition: listbox.cxx:1348
bool IsTravelSelect() const
Definition: listbox.cxx:1103
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1165
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:665
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2967
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.cxx:530
virtual ~ListBox() override
Definition: listbox.cxx:50
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:292
bool IsUpdateMode() const
Definition: window2.cxx:1167
void SetFillColor()
Definition: fill.cxx:29
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:168
const AllSettings & GetSettings() const
Definition: window3.cxx:129
CommandEventId GetCommand() const
void SetNoSelection()
Definition: listbox.cxx:923
sal_Int32 GetSelectedEntryCount() const
Definition: listbox.cxx:994
void SetZoom(const Fraction &rZoom)
Definition: window2.cxx:364
void SetTextColor(const Color &rColor)
Definition: text.cxx:688
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
Definition: window3.cxx:79
void SetItemPos(sal_Int32 n)
Definition: listbox.hxx:561
WinBits const WB_RECTSTYLE
constexpr tools::Long Top() const
sal_Int32 InsertEntry(const OUString &rStr, sal_Int32 nPos=LISTBOX_APPEND)
Definition: listbox.cxx:936
bool bPopup
bool IsEntryPosSelected(sal_Int32 nPos) const
Definition: listbox.cxx:1016
MouseNotifyEvent GetType() const
Definition: event.hxx:308
sal_Int32 GetEntryPos(std::u16string_view rStr) const
Definition: listbox.cxx:965
void GetMaxVisColumnsAndLines(sal_uInt16 &rnCols, sal_uInt16 &rnLines) const
Definition: listbox.cxx:1297
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.cxx:1343
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ctrl.cxx:57
WinBits const WB_DROPDOWN
virtual void Resize() override
Definition: listbox.cxx:555
constexpr void SetBottom(tools::Long v)
Point PixelToLogic(const Point &rDevicePt) const
Definition: window3.cxx:161
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt, Control &rControl)
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1439
WinBits const WB_SORT
void RequestDoubleBuffering(bool bRequest)
Enable/disable double-buffering of the frame window and all its children.
Definition: window.cxx:3858
virtual void LoseFocus()
Definition: window.cxx:1855
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2809
void GrabFocus()
Definition: window.cxx:2976
Size CalcSubEditSize() const
Definition: listbox.cxx:1199
void ToggleDropDown()
Definition: listbox.cxx:295
virtual const Wallpaper & GetDisplayBackground() const override
Definition: listbox.cxx:1353
SAL_DLLPRIVATE void ImplInitListBoxData()
Definition: listbox.cxx:67
WinBits const WB_LEFT
constexpr void SetTop(tools::Long v)
void SetStyle(WinBits nStyle)
Definition: window.cxx:1962
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
Definition: window.cxx:2852
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
this methods stores a combination of flags from the ListBoxEntryFlags::* defines at the given entry...
Definition: listbox.cxx:1085
void put(const char *pPropName, const OUString &rPropValue)
Size CalcSize(sal_Int32 nMaxLines) const
Definition: listbox.hxx:469
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
WinBits const WB_NOBORDER
void EnableSort(bool b)
Definition: listbox.hxx:357
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
Definition: window2.cxx:1262
constexpr Point TopLeft() const
Size CalcMinimumSize() const
Definition: listbox.cxx:1143
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: listbox.cxx:812
tools::Long AdjustTop(tools::Long nVertMoveDelta)
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:878
tools::Long GetIndexForPoint(const Point &rPoint, sal_Int32 &rPos) const
Definition: listbox.cxx:649
virtual void DumpAsPropertyTree(tools::JsonWriter &) override
Dumps itself and potentially its children to a property tree, to be written easily to JSON...
Definition: listbox.cxx:1397
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Definition: window.cxx:2666
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
Definition: window.cxx:938
virtual void GetFocus() override
Definition: listbox.cxx:439
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2424
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: listbox.cxx:55
Size CalcBlockSize(sal_uInt16 nColumns, sal_uInt16 nLines) const
Definition: listbox.cxx:1257
constexpr Size GetSize() const
void SetPressed(bool bPressed)
Definition: button.cxx:1614
static SAL_DLLPRIVATE WinBits ImplInitStyle(WinBits nStyle)
Definition: listbox.cxx:158
void EnableMultiSelection(bool bMulti)
Definition: listbox.hxx:461
virtual void Resize() override
Definition: ctrl.cxx:73
sal_uInt16 mnLineCount
Definition: lstbox.hxx:92
tools::Long GetIndexForPoint(const Point &rPoint) const
Definition: ctrl.cxx:133
void SetPrefSize(const Size &rSz)
Definition: listbox.hxx:514
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:429
WindowType
VclPtr< ImplListBoxFloatingWindow > mpFloatWin
Definition: lstbox.hxx:86
Definition: ctrl.hxx:81
ListBoxEntryFlags
Definition: lstbox.hxx:47
virtual void GetFocus()
Definition: window.cxx:1841
bool mbNoFocusRects
Definition: svdata.hxx:326
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
WinBits const WB_BORDER
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:53
sal_Int32 GetTopEntry() const
Definition: listbox.cxx:1095
tools::Long GetEntryHeightWithMargin() const
Definition: listbox.hxx:471
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:874
void SetAutoWidth(bool b)
Definition: listbox.hxx:517
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
Definition: listbox.hxx:436
virtual void FillLayoutData() const override
Definition: listbox.cxx:627
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:572
vcl::Font GetDrawPixelFont(::OutputDevice const *pDev) const
Definition: window2.cxx:547
::OutputDevice const * GetOutDev() const
Definition: window.cxx:568
tools::Long AdjustWidth(tools::Long n)
Definition: image.hxx:39
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:481
const Color & GetTextColor() const
Definition: window3.cxx:109
tools::Long CalcZoom(tools::Long n) const
Definition: window2.cxx:391
tools::Long GetDrawPixel(::OutputDevice const *pDev, tools::Long nPixels) const
Definition: window2.cxx:557
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.cxx:1333
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:476
const vcl::Font & GetFont() const
Definition: window3.cxx:58
tools::Long AdjustHeight(tools::Long n)
void putSimpleValue(const OUString &rPropValue)
WinBits const WB_TABSTOP
Size GetOutputSizePixel() const
Definition: window3.cxx:89
VclPtr< ImplWin > mpImplWin
Definition: lstbox.hxx:87
bool IsMultiSelectionEnabled() const
Definition: listbox.cxx:1138
void setHeight(tools::Long nHeight)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
WinBits const WB_CENTER
sal_Int32 InsertEntry(sal_Int32 nPos, const OUString &rStr)
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
bool IsEnabled() const
Definition: window2.cxx:1116
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
MouseWheelBehaviour
Definition: settings.hxx:77
void AdaptDropDownLineCountToMaximum()
Definition: listbox.cxx:520
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:479
virtual void LoseFocus() override
Definition: listbox.cxx:452
WinBits GetStyle() const
Definition: window2.cxx:947
void SelectEntry(sal_Int32 nPos, bool bSelect)
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
OUString GetEntryText(sal_Int32 nPos) const
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2803
void StartFloat(bool bStartTracking)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
WinBits const WB_GROUP
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:50
void SetTopEntry(sal_Int32 nPos)
Definition: listbox.cxx:1090
void SetString(const OUString &rStr)
Definition: listbox.hxx:563
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.cxx:1075
bool HasImages() const
Definition: listbox.hxx:129
bool IsReallyVisible() const
Definition: window2.cxx:1101
vcl::Font GetControlFont() const
Definition: window2.cxx:432
sal_Int32 GetItemPos() const
Definition: listbox.hxx:560
void SetImplListBox(ImplListBox *pLB)
Definition: listbox.hxx:512
Link< ListBox &, void > maSelectHdl
Definition: lstbox.hxx:91
bool HasFocus() const
Definition: window.cxx:2981
bool IsInDropDown() const
Definition: listbox.cxx:1108
void SetEdgeBlending(bool bNew)
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:774
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
Definition: floatwin.cxx:944
WinBits const WB_NOTABSTOP
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1251
bool isDisposed() const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: listbox.cxx:317
sal_Int32 GetEntryCount() const
Definition: listbox.hxx:128
virtual void StateChanged(StateChangedType nType) override
Definition: listbox.cxx:706
bool HasLayoutData() const
determines whether we currently have layout data
Definition: ctrl.cxx:89
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:590
sal_uInt16 nPos
tools::Long ToRelativeLineIndex(tools::Long nIndex) const
ToRelativeLineIndex changes a layout data index to a count relative to its line.
Definition: ctrl.cxx:210
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
ListBox(WindowType nType)
Definition: listbox.cxx:37
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
Definition: listbox.cxx:537
constexpr tools::Long GetHeight() const
void SetLayoutDataParent(const Control *pParent) const
Definition: ctrl.cxx:319
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:480
bool IsMod2() const
Definition: keycod.hxx:58
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
IMPL_LINK(ListBox, ImplFocusHdl, sal_Int32, nPos, void)
Definition: listbox.cxx:192
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:410