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