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