LibreOffice Module vcl (master)  1
listbox.hxx
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 #ifndef INCLUDED_VCL_INC_LISTBOX_HXX
21 #define INCLUDED_VCL_INC_LISTBOX_HXX
22 
23 #include <sal/config.h>
24 
25 #include <o3tl/safeint.hxx>
26 #include <vcl/toolkit/button.hxx>
27 #include <vcl/toolkit/floatwin.hxx>
29 #include <vcl/vcllayout.hxx>
30 
31 #include "glyphid.hxx"
32 
33 #include <set>
34 #include <vector>
35 #include <memory>
36 
37 class ScrollBar;
38 class ScrollBarBox;
39 
40 #define HORZ_SCROLL 4
41 #define IMG_TXT_DISTANCE 6
42 
44 {
49 };
50 
52 {
53  OUString maStr;
56  void* mpUserData;
60 
62 
63  ImplEntryType( const OUString& rStr, const Image& rImage ) :
64  maStr( rStr ),
65  maImage( rImage ),
66  mnFlags( ListBoxEntryFlags::NONE ),
67  mnHeight( 0 )
68  {
69  mbIsSelected = false;
70  mpUserData = nullptr;
71  }
72 
73  ImplEntryType( const OUString& rStr ) :
74  maStr( rStr ),
75  mnFlags( ListBoxEntryFlags::NONE ),
76  mnHeight( 0 )
77  {
78  mbIsSelected = false;
79  mpUserData = nullptr;
80  }
81 
83  SalLayoutGlyphs* GetTextGlyphs(const OutputDevice* pOutputDevice);
84 };
85 
87 {
88 private:
90  sal_Int32 mnLastSelected;
91  sal_Int32 mnSelectionAnchor;
92  sal_Int32 mnImages;
93 
94  sal_Int32 mnMRUCount;
95  sal_Int32 mnMaxMRUCount;
96 
99  std::vector<std::unique_ptr<ImplEntryType> > maEntries;
100 
101  ImplEntryType* GetEntry( sal_Int32 nPos ) const
102  {
103  if (nPos < 0 || o3tl::make_unsigned(nPos) >= maEntries.size())
104  return nullptr;
105  return maEntries[nPos].get();
106  }
107 
108 public:
109  ImplEntryList( vcl::Window* pWindow );
110  ~ImplEntryList();
111 
112  sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort );
113  void RemoveEntry( sal_Int32 nPos );
114  const ImplEntryType* GetEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); }
115  ImplEntryType* GetMutableEntryPtr( sal_Int32 nPos ) const { return GetEntry( nPos ); }
116  void Clear();
117  void dispose();
118 
119  sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const;
120  sal_Int32 FindEntry( std::u16string_view rStr, bool bSearchMRUArea = false ) const;
121 
126  tools::Long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex ) const;
127  tools::Long GetEntryHeight( sal_Int32 nPos ) const;
128 
129  sal_Int32 GetEntryCount() const { return static_cast<sal_Int32>(maEntries.size()); }
130  bool HasImages() const { return mnImages != 0; }
131 
132  OUString GetEntryText( sal_Int32 nPos ) const;
133 
134  bool HasEntryImage( sal_Int32 nPos ) const;
135  Image GetEntryImage( sal_Int32 nPos ) const;
136 
137  void SetEntryData( sal_Int32 nPos, void* pNewData );
138  void* GetEntryData( sal_Int32 nPos ) const;
139 
140  void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
141 
142  void SelectEntry( sal_Int32 nPos, bool bSelect );
143 
144  sal_Int32 GetSelectedEntryCount() const;
145  OUString GetSelectedEntry( sal_Int32 nIndex ) const;
146  sal_Int32 GetSelectedEntryPos( sal_Int32 nIndex ) const;
147  bool IsEntryPosSelected( sal_Int32 nIndex ) const;
148 
149  void SetLastSelected( sal_Int32 nPos ) { mnLastSelected = nPos; }
150  sal_Int32 GetLastSelected() const { return mnLastSelected; }
151 
152  void SetSelectionAnchor( sal_Int32 nPos ) { mnSelectionAnchor = nPos; }
153  sal_Int32 GetSelectionAnchor() const { return mnSelectionAnchor; }
154 
155  void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maSelectionChangedHdl = rLnk; }
156  void SetCallSelectionChangedHdl( bool bCall ) { mbCallSelectionChangedHdl = bCall; }
157 
158  void SetMRUCount( sal_Int32 n ) { mnMRUCount = n; }
159  sal_Int32 GetMRUCount() const { return mnMRUCount; }
160 
161  void SetMaxMRUCount( sal_Int32 n ) { mnMaxMRUCount = n; }
162  sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; }
163 
166  bool IsEntrySelectable( sal_Int32 nPos ) const;
167 
173  sal_Int32 FindFirstSelectable( sal_Int32 nPos, bool bForward = true ) const;
174 };
175 
177 {
178 private:
181 
183 
193 
194  sal_Int32 mnCurrentPos;
196 
197  std::set< sal_Int32 > maSeparators;
198 
199  sal_Int32 mnUserDrawEntry;
200 
201  sal_Int32 mnTop;
204 
205  sal_uInt16 mnSelectModifier;
206 
207  bool mbHasFocusRect : 1;
208  bool mbSort : 1;
209  bool mbTrack : 1;
210  bool mbMulti : 1;
211  bool mbSimpleMode : 1;
212  bool mbTravelSelect : 1;
213  bool mbTrackingSelect : 1;
215  bool mbMouseMoveSelect : 1;
216  bool mbGrabFocus : 1;
217  bool mbUserDrawEnabled : 1;
218  bool mbInUserDraw : 1;
219  bool mbReadOnly : 1;
220  bool mbCenter : 1;
221  bool mbRight : 1;
222  bool mbEdgeBlending : 1;
224  bool mbIsDropdown : 1;
225 
234 
236 
237  virtual void KeyInput( const KeyEvent& rKEvt ) override;
238  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
239  virtual void MouseMove( const MouseEvent& rMEvt ) override;
240  virtual void Tracking( const TrackingEvent& rTEvt ) override;
241  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
242  virtual void Resize() override;
243  virtual void GetFocus() override;
244  virtual void LoseFocus() override;
245 
246  bool SelectEntries( sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift = false, bool bCtrl = false, bool bSelectPosChange = false );
247  void ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nPos);
248  void ImplDoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
249  void ImplCalcMetrics();
250  void ImplUpdateEntryMetrics( ImplEntryType& rEntry );
251  void ImplCallSelect();
252 
253  void ImplShowFocusRect();
254  void ImplHideFocusRect();
255 
256  virtual void StateChanged( StateChangedType nType ) override;
257  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
258 
259 public:
260  virtual void FillLayoutData() const override;
261 
262  ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle );
263  virtual ~ImplListBoxWindow() override;
264  virtual void dispose() override;
265 
266  const ImplEntryList& GetEntryList() const { return maEntryList; }
268 
269  sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); // sorts using mbSort
270  sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); // to insert ignoring mbSort, e.g. mru
271  void RemoveEntry( sal_Int32 nPos );
272  void Clear();
273  void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
274  sal_Int32 GetCurrentPos() const { return mnCurrentPos; }
275  sal_uInt16 GetDisplayLineCount() const;
276  void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
277 
278  void DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText);
279 
280  void SelectEntry( sal_Int32 nPos, bool bSelect );
281  void DeselectAll();
282  sal_Int32 GetEntryPosForPoint( const Point& rPoint ) const;
283  sal_Int32 GetLastVisibleEntry() const;
284 
285  bool ProcessKeyInput( const KeyEvent& rKEvt );
286 
287  void SetTopEntry( sal_Int32 nTop );
288  sal_Int32 GetTopEntry() const { return mnTop; }
291  void ShowProminentEntry( sal_Int32 nEntryPos );
292  using Window::IsVisible;
293  bool IsVisible( sal_Int32 nEntry ) const;
294 
295  tools::Long GetLeftIndent() const { return mnLeft; }
296  void SetLeftIndent( tools::Long n );
297  void ScrollHorz( tools::Long nDiff );
298 
299  void AllowGrabFocus( bool b ) { mbGrabFocus = b; }
300  bool IsGrabFocusAllowed() const { return mbGrabFocus; }
301 
306  void SetSeparatorPos( sal_Int32 n );
311  sal_Int32 GetSeparatorPos() const;
312 
316  void AddSeparator( sal_Int32 n ) { maSeparators.insert( n ); }
320  bool isSeparator( const sal_Int32 &n ) const;
321 
322  void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
323  bool IsTravelSelect() const { return mbTravelSelect; }
324  bool IsTrackingSelect() const { return mbTrackingSelect; }
325 
326  void SetUserItemSize( const Size& rSz );
327 
328  void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
329  bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
330 
331  void EnableMultiSelection( bool bMulti ) { mbMulti = bMulti; }
332  bool IsMultiSelectionEnabled() const { return mbMulti; }
333 
334  void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; }
335 
336  void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
337  bool IsMouseMoveSelect() const { return mbMouseMoveSelect; }
338 
339  Size CalcSize(sal_Int32 nMaxLines) const;
340  tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
341 
345 
346  void SetScrollHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maScrollHdl = rLink; }
347  void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maSelectHdl = rLink; }
348  void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maCancelHdl = rLink; }
349  void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maDoubleClickHdl = rLink; }
350  void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maUserDrawHdl = rLink; }
351  void SetMRUChangedHdl( const Link<LinkParamNone*,void>& rLink ) { maMRUChangedHdl = rLink; }
352  void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maFocusHdl = rLink ; }
353 
354  void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maListItemSelectHdl = rLink ; }
355  bool IsSelectionChanged() const { return mbSelectionChanged; }
356  sal_uInt16 GetSelectModifier() const { return mnSelectModifier; }
357 
358  void EnableSort( bool b ) { mbSort = b; }
359 
360  void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; }
361  bool IsReadOnly() const { return mbReadOnly; }
362 
364 
365  bool GetEdgeBlending() const { return mbEdgeBlending; }
366  void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
367 
369  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
370 
371 private:
372  // ISearchableStringList
373  virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
374  virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
375  virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
376 };
377 
378 class ImplListBox final : public Control
379 {
380 private:
385 
386  bool mbVScroll : 1; // VScroll on or off
387  bool mbHScroll : 1; // HScroll on or off
388  bool mbAutoHScroll : 1; // AutoHScroll on or off
389  bool mbEdgeBlending : 1;
390 
391  Link<ImplListBox*,void> maScrollHdl; // because it is needed by ImplListBoxWindow itself
392 
393  virtual void GetFocus() override;
394  virtual void StateChanged( StateChangedType nType ) override;
395 
396  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
397 
398  void ImplResizeControls();
399  void ImplCheckScrollBars();
400  void ImplInitScrollBars();
401 
402  DECL_LINK( ScrollBarHdl, ScrollBar*, void );
403  DECL_LINK( LBWindowScrolled, ImplListBoxWindow*, void );
404  DECL_LINK( MRUChanged, LinkParamNone*, void );
405 
406 public:
407  ImplListBox( vcl::Window* pParent, WinBits nWinStyle );
408  virtual ~ImplListBox() override;
409  virtual void dispose() override;
410 
411  const ImplEntryList& GetEntryList() const { return maLBWindow->GetEntryList(); }
412  ImplListBoxWindow* GetMainWindow() { return maLBWindow.get(); }
413 
414  virtual void Resize() override;
415  virtual const Wallpaper& GetDisplayBackground() const override;
416 
417  sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr );
418  sal_Int32 InsertEntry( sal_Int32 nPos, const OUString& rStr, const Image& rImage );
419  void RemoveEntry( sal_Int32 nPos );
420  void SetEntryData( sal_Int32 nPos, void* pNewData ) { maLBWindow->GetEntryList().SetEntryData( nPos, pNewData ); }
421  void Clear();
422 
423  void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
424 
425  void SelectEntry( sal_Int32 nPos, bool bSelect );
426  void SetNoSelection();
427  void ResetCurrentPos() { maLBWindow->ResetCurrentPos(); }
428  sal_Int32 GetCurrentPos() const { return maLBWindow->GetCurrentPos(); }
429 
430  bool ProcessKeyInput( const KeyEvent& rKEvt ) { return maLBWindow->ProcessKeyInput( rKEvt ); }
431  bool HandleWheelAsCursorTravel(const CommandEvent& rCEvt, Control& rControl);
432 
437  void SetSeparatorPos( sal_Int32 n ) { maLBWindow->SetSeparatorPos( n ); }
442  sal_Int32 GetSeparatorPos() const { return maLBWindow->GetSeparatorPos(); }
443 
447  void AddSeparator( sal_Int32 n ) { maLBWindow->AddSeparator( n ); }
448 
449  void SetTopEntry( sal_Int32 nTop ) { maLBWindow->SetTopEntry( nTop ); }
450  sal_Int32 GetTopEntry() const { return maLBWindow->GetTopEntry(); }
451  void ShowProminentEntry( sal_Int32 nPos ) { maLBWindow->ShowProminentEntry( nPos ); }
452  using Window::IsVisible;
453  bool IsVisible( sal_Int32 nEntry ) const { return maLBWindow->IsVisible( nEntry ); }
454 
455  tools::Long GetLeftIndent() const { return maLBWindow->GetLeftIndent(); }
456  void SetLeftIndent( sal_uInt16 n ) { maLBWindow->SetLeftIndent( n ); }
457 
458  void SetTravelSelect( bool bTravelSelect ) { maLBWindow->SetTravelSelect( bTravelSelect ); }
459  bool IsTravelSelect() const { return maLBWindow->IsTravelSelect(); }
460  bool IsTrackingSelect() const { return maLBWindow->IsTrackingSelect(); }
461 
462  void EnableMultiSelection( bool bMulti ) { maLBWindow->EnableMultiSelection( bMulti ); }
463  bool IsMultiSelectionEnabled() const { return maLBWindow->IsMultiSelectionEnabled(); }
464 
465  void SetMultiSelectionSimpleMode( bool bSimple ) { maLBWindow->SetMultiSelectionSimpleMode( bSimple ); }
466 
467  void SetReadOnly( bool b ) { maLBWindow->SetReadOnly( b ); }
468  bool IsReadOnly() const { return maLBWindow->IsReadOnly(); }
469 
470  Size CalcSize( sal_Int32 nMaxLines ) const { return maLBWindow->CalcSize( nMaxLines ); }
471  tools::Long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); }
473  tools::Long GetMaxEntryWidth() const { return maLBWindow->GetMaxEntryWidth(); }
474 
475  void SetScrollHdl( const Link<ImplListBox*,void>& rLink ) { maScrollHdl = rLink; }
476  void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetSelectHdl( rLink ); }
477  void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetCancelHdl( rLink ); }
478  void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maLBWindow->SetDoubleClickHdl( rLink ); }
479  void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maLBWindow->SetUserDrawHdl( rLink ); }
480  void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maLBWindow->SetFocusHdl( rLink ); }
481  void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maLBWindow->SetListItemSelectHdl( rLink ); }
483  void SetCallSelectionChangedHdl( bool bCall ) { maLBWindow->GetEntryList().SetCallSelectionChangedHdl( bCall ); }
484  bool IsSelectionChanged() const { return maLBWindow->IsSelectionChanged(); }
485  sal_uInt16 GetSelectModifier() const { return maLBWindow->GetSelectModifier(); }
486 
487  void SetMRUEntries( std::u16string_view rEntries, sal_Unicode cSep );
488  OUString GetMRUEntries( sal_Unicode cSep ) const;
489  void SetMaxMRUCount( sal_Int32 n ) { maLBWindow->GetEntryList().SetMaxMRUCount( n ); }
490  sal_Int32 GetMaxMRUCount() const { return maLBWindow->GetEntryList().GetMaxMRUCount(); }
491  sal_uInt16 GetDisplayLineCount() const
492  { return maLBWindow->GetDisplayLineCount(); }
493 
494  bool GetEdgeBlending() const { return mbEdgeBlending; }
495  void SetEdgeBlending(bool bNew);
496 };
497 
499 {
500 private:
503  sal_uInt16 mnDDLineCount;
506 
507  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
508 
509 public:
511  virtual ~ImplListBoxFloatingWindow() override;
512  virtual void dispose() override;
513  void SetImplListBox( ImplListBox* pLB ) { mpImplLB = pLB; }
514 
515  void SetPrefSize( const Size& rSz ) { maPrefSz = rSz; }
516  const Size& GetPrefSize() const { return maPrefSz; }
517 
518  void SetAutoWidth( bool b ) { mbAutoWidth = b; }
519 
520  Size CalcFloatSize() const;
521  void StartFloat( bool bStartTracking );
522 
523  virtual void setPosSizePixel( tools::Long nX, tools::Long nY,
524  tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags = PosSizeFlags::All ) override;
525 
526  void SetDropDownLineCount( sal_uInt16 n ) { mnDDLineCount = n; }
527  sal_uInt16 GetDropDownLineCount() const { return mnDDLineCount; }
528 
530 
531  virtual void Resize() override;
532 };
533 
534 class ImplWin final : public Control
535 {
536 private:
537 
538  sal_Int32 mnItemPos;
539  OUString maString;
541 
543 
545 
546  bool mbEdgeBlending : 1;
547 
548  void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false);
549  virtual void FillLayoutData() const override;
550 
551 public:
552  ImplWin( vcl::Window* pParent, WinBits nWinStyle );
553 
554  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
555  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
556  virtual void Resize() override;
557  virtual void GetFocus() override;
558  virtual void LoseFocus() override;
559  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
560 
561  sal_Int32 GetItemPos() const { return mnItemPos; }
562  void SetItemPos( sal_Int32 n ) { mnItemPos = n; }
563 
564  void SetString( const OUString& rStr ) { maString = rStr; }
565 
566  void SetImage( const Image& rImg ) { maImage = rImg; }
567 
568  void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
569 
570  void DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout);
571 
572  bool GetEdgeBlending() const { return mbEdgeBlending; }
573  void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
574 
575  virtual void ShowFocus(const tools::Rectangle& rRect) override;
576 
578  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
579 
580 };
581 
582 class ImplBtn final : public PushButton
583 {
584 private:
586 
587 public:
588  ImplBtn( vcl::Window* pParent, WinBits nWinStyle );
589 
590  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
591  void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
592 };
593 
594 void ImplInitDropDownButton( PushButton* pButton );
595 
596 #endif // INCLUDED_VCL_INC_LISTBOX_HXX
597 
598 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Rectangle maFocusRect
Definition: listbox.hxx:542
void SelectEntry(sal_Int32 nPos, bool bSelect)
bool GetEdgeBlending() const
Definition: listbox.hxx:494
void ResetCurrentPos()
Definition: listbox.hxx:427
virtual void ShowFocus(const tools::Rectangle &rRect) override
bool mbAutoHScroll
Definition: listbox.hxx:388
virtual void LoseFocus() override
tools::Long GetEntryHeight() const
Definition: listbox.hxx:342
Link< sal_Int32, void > maFocusHdl
Definition: listbox.hxx:232
bool mbEdgeBlending
Definition: listbox.hxx:546
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:476
sal_Int32 GetMaxMRUCount() const
Definition: listbox.hxx:490
SalLayoutGlyphs maStrGlyphs
Definition: listbox.hxx:54
bool mbTrack
Tracking.
Definition: listbox.hxx:209
virtual void Resize() override
bool IsSelectionChanged() const
Definition: listbox.hxx:355
virtual void LoseFocus() override
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:568
bool HasEntryImage(sal_Int32 nPos) const
virtual void StateChanged(StateChangedType nType) override
void SetNoSelection()
OUString maString
Definition: listbox.hxx:539
void SetSelectionAnchor(sal_Int32 nPos)
Definition: listbox.hxx:152
virtual void FillLayoutData() const override
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.hxx:442
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:266
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
void SetUserItemSize(const Size &rSz)
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:352
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual ~ImplListBoxWindow() override
bool IsTravelSelect() const
Definition: listbox.hxx:459
void ScrollHorz(tools::Long nDiff)
Image maImage
Definition: listbox.hxx:55
bool mbVScroll
Definition: listbox.hxx:386
void AllowGrabFocus(bool b)
Definition: listbox.hxx:299
tools::Rectangle maFocusRect
Definition: listbox.hxx:180
long Long
tools::Long mnHeight
Definition: listbox.hxx:59
tools::Long mnMaxImgWidth
Maximum width of an image item.
Definition: listbox.hxx:189
bool mbSelectionChanged
Do not call Select() too often ...
Definition: listbox.hxx:214
void ImplResizeControls()
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:463
const Size & GetPrefSize() const
Definition: listbox.hxx:516
bool mbEdgeBlending
Definition: listbox.hxx:389
Link< ImplListBoxWindow *, void > maScrollHdl
Definition: listbox.hxx:226
bool IsVisible(sal_Int32 nEntry) const
Definition: listbox.hxx:453
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
void EnableMouseMoveSelect(bool bMouseMoveSelect)
Definition: listbox.hxx:336
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:450
DECL_LINK(ScrollBarHdl, ScrollBar *, void)
sal_Int32 GetEntryPosForPoint(const Point &rPoint) const
void EnableMultiSelection(bool bMulti)
Definition: listbox.hxx:331
sal_Int32 GetLastSelected() const
Definition: listbox.hxx:150
void SetMRUCount(sal_Int32 n)
Definition: listbox.hxx:158
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void SetTravelSelect(bool bTravelSelect)
Definition: listbox.hxx:322
void SelectEntry(sal_Int32 nPos, bool bSelect)
Definition: imp_listbox.cxx:89
sal_Int32 FindEntry(std::u16string_view rStr, bool bSearchMRUArea=false) const
sal_Int32 GetSelectedEntryCount() const
bool IsTrackingSelect() const
Definition: listbox.hxx:324
PosSizeFlags
Definition: window.hxx:125
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:156
ImplEntryList & GetEntryList()
Definition: listbox.hxx:267
sal_Int32 mnMRUCount
Definition: listbox.hxx:94
bool mbMouseMoveSelect
Select at MouseMove.
Definition: listbox.hxx:215
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:274
sal_Int32 mnTop
output from line on
Definition: listbox.hxx:201
sal_uInt16 GetDisplayLineCount() const
tools::Long GetLeftIndent() const
Definition: listbox.hxx:295
bool IsTrackingSelect() const
Definition: listbox.hxx:460
bool IsReadOnly() const
Definition: listbox.hxx:468
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
bool mbCenter
center Text output
Definition: listbox.hxx:220
sal_Int32 GetSelectionAnchor() const
Definition: listbox.hxx:153
void SetDropDownLineCount(sal_uInt16 n)
Definition: listbox.hxx:526
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual void Tracking(const TrackingEvent &rTEvt) override
tools::Long GetLeftIndent() const
Definition: listbox.hxx:455
DrawTextFlags
void ImplUpdateEntryMetrics(ImplEntryType &rEntry)
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:479
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:37
VclPtr< ImplListBoxWindow > maLBWindow
Definition: listbox.hxx:381
bool mbReadOnly
ReadOnly.
Definition: listbox.hxx:219
ImplEntryList(vcl::Window *pWindow)
Definition: imp_listbox.cxx:60
NONE
void ImplInitScrollBars()
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:585
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:288
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:51
void RemoveEntry(sal_Int32 nPos)
void * GetEntryData(sal_Int32 nPos) const
StateChangedType
Definition: window.hxx:289
tools::Long mnMaxWidth
Maximum width of an entry.
Definition: listbox.hxx:191
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:483
tools::Long mnTextHeight
text height
Definition: listbox.hxx:203
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:473
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:347
VclPtr< vcl::Window > mpWindow
For getting the current locale when matching strings.
Definition: listbox.hxx:89
sal_Int64 WinBits
sal_uInt16 sal_Unicode
bool IsTravelSelect() const
Definition: listbox.hxx:323
std::set< sal_Int32 > maSeparators
Separator positions.
Definition: listbox.hxx:197
virtual bool PreNotify(NotifyEvent &rNEvt) override
void RemoveEntry(sal_Int32 nPos)
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:428
tools::Long mnMaxImgTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:187
void SetReadOnly(bool b)
Definition: listbox.hxx:467
VclPtr< ImplListBox > mpImplLB
Definition: listbox.hxx:501
virtual void StateChanged(StateChangedType nType) override
LB_EVENT_TYPE
Definition: listbox.hxx:43
virtual ~ImplListBoxFloatingWindow() override
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool mbHScroll
Definition: listbox.hxx:387
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:447
void SetEntryData(sal_Int32 nPos, void *pNewData)
Definition: listbox.hxx:420
void SetTravelSelect(bool bTravelSelect)
Definition: listbox.hxx:458
void SetMRUChangedHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:351
virtual const Wallpaper & GetDisplayBackground() const override
tools::Long GetMaxEntryWidth() const
Definition: listbox.hxx:344
bool mbIsDropdown
Listbox is actually a dropdown (either combobox, or popup window treated as dropdown) ...
Definition: listbox.hxx:224
tools::Long mnMaxTxtWidth
Maximum width of a text item.
Definition: listbox.hxx:185
tools::Long getHeightWithMargin() const
virtual void Resize() override
void SetMRUEntries(std::u16string_view rEntries, sal_Unicode cSep)
const void * StringEntryIdentifier
sal_Int32 GetMaxMRUCount() const
Definition: listbox.hxx:162
Link< LinkParamNone *, void > maListItemSelectHdl
Definition: listbox.hxx:233
ImplWin(vcl::Window *pParent, WinBits nWinStyle)
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:478
sal_Int32 mnMaxMRUCount
Definition: listbox.hxx:95
bool mbSimpleMode
SimpleMode for MultiListBox.
Definition: listbox.hxx:211
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:485
Image GetEntryImage(sal_Int32 nPos) const
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:412
sal_Int32 mnTrackingSaveSelection
Selection before Tracking();.
Definition: listbox.hxx:195
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
ImplEntryType(const OUString &rStr, const Image &rImage)
Definition: listbox.hxx:63
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:465
void SetTopEntry(sal_Int32 nTop)
Definition: listbox.hxx:449
void ResetCurrentPos()
Definition: listbox.hxx:273
void RemoveEntry(sal_Int32 nPos)
void SetScrollHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:346
void SetReadOnly(bool bReadOnly)
Definition: listbox.hxx:360
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:544
ImplListBoxFloatingWindow(vcl::Window *pParent)
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
sal_Int32 GetMRUCount() const
Definition: listbox.hxx:159
sal_uInt16 GetDisplayLineCount() const
Definition: listbox.hxx:491
void ShowProminentEntry(sal_Int32 nPos)
Definition: listbox.hxx:451
bool ProcessKeyInput(const KeyEvent &rKEvt)
void SetMaxMRUCount(sal_Int32 n)
Definition: listbox.hxx:161
void SetScrollHdl(const Link< ImplListBox *, void > &rLink)
Definition: listbox.hxx:475
virtual void KeyInput(const KeyEvent &rKEvt) override
ImplEntryType * GetMutableEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:115
std::vector< std::unique_ptr< ImplEntryType > > maEntries
Definition: listbox.hxx:99
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:155
void AddSeparator(sal_Int32 n)
Adds a new separator at the given position n.
Definition: listbox.hxx:316
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void Resize() override
bool IsEntryPosSelected(sal_Int32 nIndex) const
tools::Long GetEntryHeight() const
Definition: listbox.hxx:471
ImplBtn(vcl::Window *pParent, WinBits nWinStyle)
virtual void Resize() override
virtual ~ImplListBox() override
virtual bool PreNotify(NotifyEvent &rNEvt) override
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.hxx:527
void SetImage(const Image &rImg)
Definition: listbox.hxx:566
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:334
bool mbMulti
MultiListBox.
Definition: listbox.hxx:210
tools::Long mnLeft
output from column on
Definition: listbox.hxx:202
void ImplCheckScrollBars()
Link< ImplListBoxWindow *, void > maDoubleClickHdl
Definition: listbox.hxx:229
sal_Int32 mnSelectionAnchor
Definition: listbox.hxx:91
ImplListBox(vcl::Window *pParent, WinBits nWinStyle)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:175
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
tools::Long GetEntryHeightWithMargin() const
VclPtr< ScrollBarBox > mpScrollBarBox
Definition: listbox.hxx:384
Size CalcSize(sal_Int32 nMaxLines) const
void SetLastSelected(sal_Int32 nPos)
Definition: listbox.hxx:149
void SetItemPos(sal_Int32 n)
Definition: listbox.hxx:562
DrawTextFlags ImplGetTextStyle() const
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:366
void ImplDoPaint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
void SetLeftIndent(tools::Long n)
vcl::QuickSelectionEngine maQuickSelectionEngine
Definition: listbox.hxx:235
bool GetEdgeBlending() const
Definition: listbox.hxx:572
VclPtr< ScrollBar > mpHScrollBar
Definition: listbox.hxx:382
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt, Control &rControl)
Link< LinkParamNone *, void > maCancelHdl
Definition: listbox.hxx:228
bool mbSort
ListBox sorted.
Definition: listbox.hxx:208
bool GetEdgeBlending() const
Definition: listbox.hxx:365
void DrawEntry(vcl::RenderContext &rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText)
OUString maStr
Definition: listbox.hxx:53
sal_Int32 GetPopupModeStartSaveSelection() const
Definition: listbox.hxx:529
Link< UserDrawEvent *, void > maUserDrawHdl
Definition: listbox.hxx:230
bool mbTravelSelect
TravelSelect.
Definition: listbox.hxx:212
ListBoxEntryFlags mnFlags
Definition: listbox.hxx:58
sal_Int32 FindMatchingEntry(const OUString &rStr, sal_Int32 nStart, bool bLazy) const
void SetLeftIndent(sal_uInt16 n)
Definition: listbox.hxx:456
void ImplPaint(vcl::RenderContext &rRenderContext, sal_Int32 nPos)
Link< LinkParamNone *, void > maMRUChangedHdl
Definition: listbox.hxx:231
virtual void MouseMove(const MouseEvent &rMEvt) override
void DrawEntry(vcl::RenderContext &rRenderContext, bool bLayout)
Size CalcSize(sal_Int32 nMaxLines) const
Definition: listbox.hxx:470
void EnableSort(bool b)
Definition: listbox.hxx:358
ImplEntryType(const OUString &rStr)
Definition: listbox.hxx:73
bool mbIsSelected
Definition: listbox.hxx:57
sal_Int32 mnCurrentPos
Position (Focus)
Definition: listbox.hxx:194
bool mbUserDrawEnabled
UserDraw possible.
Definition: listbox.hxx:217
VclPtr< ScrollBar > mpVScrollBar
Definition: listbox.hxx:383
bool IsMouseMoveSelect() const
Definition: listbox.hxx:337
tools::Long mnMaxTxtHeight
Maximum height of a text item.
Definition: listbox.hxx:184
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:356
void * mpUserData
Definition: listbox.hxx:56
tools::Long GetAddedHeight(sal_Int32 nEndIndex, sal_Int32 nBeginIndex) const
helper: add up heights up to index nEndIndex.
bool IsUserDrawEnabled() const
Definition: listbox.hxx:329
void EnableMultiSelection(bool bMulti)
Definition: listbox.hxx:462
ImplEntryType * GetEntry(sal_Int32 nPos) const
Definition: listbox.hxx:101
void SetPrefSize(const Size &rSz)
Definition: listbox.hxx:515
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:430
const ImplEntryType * GetEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:114
Definition: ctrl.hxx:81
bool IsEntrySelectable(sal_Int32 nPos) const
An Entry is selectable if its mnFlags does not have the ListBoxEntryFlags::DisableSelection flag set...
ListBoxEntryFlags
Definition: lstbox.hxx:47
sal_Int32 mnItemPos
because of UserDraw I have to know which item I draw
Definition: listbox.hxx:538
virtual void GetFocus() override
sal_Int32 mnLastSelected
Definition: listbox.hxx:90
tools::Long GetEntryHeightWithMargin() const
Definition: listbox.hxx:472
bool IsVisible() const
Definition: window2.cxx:1125
virtual vcl::StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const override
returns the current entry in the list of searchable strings.
void SetAutoWidth(bool b)
Definition: listbox.hxx:518
sal_Int32 mnPopupModeStartSaveSelection
Definition: listbox.hxx:504
void SetSeparatorPos(sal_Int32 n)
Removes existing separators, and sets the position of the one and only separator. ...
Definition: listbox.hxx:437
bool SelectEntries(sal_Int32 nSelect, LB_EVENT_TYPE eLET, bool bShift=false, bool bCtrl=false, bool bSelectPosChange=false)
sal_Int32 FindFirstSelectable(sal_Int32 nPos, bool bForward=true) const
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:573
sal_uInt16 mnSelectModifier
Modifiers.
Definition: listbox.hxx:205
Definition: image.hxx:39
bool IsSelectionChanged() const
Definition: listbox.hxx:484
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:482
tools::Long mnMaxImgHeight
Maximum height of an image item.
Definition: listbox.hxx:190
void SetMaxMRUCount(sal_Int32 n)
Definition: listbox.hxx:489
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:350
ImplListBoxWindow(vcl::Window *pParent, WinBits nWinStyle)
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:477
bool IsGrabFocusAllowed() const
Definition: listbox.hxx:300
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:332
sal_Int32 mnImages
Definition: listbox.hxx:92
virtual void GetFocus() override
tools::Long GetEntryHeight(sal_Int32 nPos) const
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry)
virtual bool EventNotify(NotifyEvent &rNEvt) override
void ImplInitSettings()
Definition: ctrl.cxx:423
sal_Int32 InsertEntry(sal_Int32 nPos, const OUString &rStr)
bool isSeparator(const sal_Int32 &n) const
Checks if the given number n is an element of the separator positions set.
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
Image maImage
Definition: listbox.hxx:540
OUString GetSelectedEntry(sal_Int32 nIndex) const
void SetTopEntry(sal_Int32 nTop)
OUString GetMRUEntries(sal_Unicode cSep) const
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:480
void SelectEntry(sal_Int32 nPos, bool bSelect)
Link< sal_Int32, void > maSelectionChangedHdl
Definition: listbox.hxx:97
sal_Int32 mnUserDrawEntry
Definition: listbox.hxx:199
virtual void FillLayoutData() const override
bool IsReadOnly() const
Definition: listbox.hxx:361
OUString GetEntryText(sal_Int32 nPos) const
void StartFloat(bool bStartTracking)
sal_Int32 GetLastVisibleEntry() const
void SetEntryData(sal_Int32 nPos, void *pNewData)
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void SetString(const OUString &rStr)
Definition: listbox.hxx:564
bool HasImages() const
Definition: listbox.hxx:130
void EnableUserDraw(bool bUserDraw)
Definition: listbox.hxx:328
bool mbInUserDraw
In UserDraw.
Definition: listbox.hxx:218
sal_Int32 GetItemPos() const
Definition: listbox.hxx:561
bool mbGrabFocus
Grab focus at MBDown.
Definition: listbox.hxx:216
virtual vcl::StringEntryIdentifier NextEntry(vcl::StringEntryIdentifier _currentEntry, OUString &_out_entryText) const override
returns the next entry in the list.
SalLayoutGlyphs * GetTextGlyphs(const OutputDevice *pOutputDevice)
Computes maStr's text layout (glyphs), cached in maStrGlyphs.
void SetImplListBox(ImplListBox *pLB)
Definition: listbox.hxx:513
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:354
void SetEdgeBlending(bool bNew)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
tools::Long mnMaxHeight
Maximum height of an entry.
Definition: listbox.hxx:192
void ShowProminentEntry(sal_Int32 nEntryPos)
ShowProminentEntry will set the entry corresponding to nEntryPos either at top or in the middle depen...
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry, bool bSort)
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:348
bool IsVisible(sal_Int32 nEntry) const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
virtual void GetFocus() override
bool mbCallSelectionChangedHdl
Definition: listbox.hxx:98
sal_Int32 GetEntryCount() const
Definition: listbox.hxx:129
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:591
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
Link< ImplListBox *, void > maScrollHdl
Definition: listbox.hxx:391
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Link< LinkParamNone *, void > maSelectHdl
Definition: listbox.hxx:227
void ImplDraw(vcl::RenderContext &rRenderContext, bool bLayout=false)
void SetListItemSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:481
bool mbTrackingSelect
Selected at a MouseMove.
Definition: listbox.hxx:213
ImplEntryList maEntryList
EntryList.
Definition: listbox.hxx:179
const ImplEntryList & GetEntryList() const
Definition: listbox.hxx:411
bool mbRight
right align Text output
Definition: listbox.hxx:221
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:349