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/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;
58  long mnHeight;
59 
60  long getHeightWithMargin() const;
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 
117  sal_Int32 FindMatchingEntry( const OUString& rStr, sal_Int32 nStart, bool bLazy ) const;
118  sal_Int32 FindEntry( const OUString& rStr, bool bSearchMRUArea = false ) const;
119 
124  long GetAddedHeight( sal_Int32 nEndIndex, sal_Int32 nBeginIndex ) const;
125  long GetEntryHeight( sal_Int32 nPos ) const;
126 
127  sal_Int32 GetEntryCount() const { return static_cast<sal_Int32>(maEntries.size()); }
128  bool HasImages() const { return mnImages != 0; }
129 
130  OUString GetEntryText( sal_Int32 nPos ) const;
131 
132  bool HasEntryImage( sal_Int32 nPos ) const;
133  Image GetEntryImage( sal_Int32 nPos ) const;
134 
135  void SetEntryData( sal_Int32 nPos, void* pNewData );
136  void* GetEntryData( sal_Int32 nPos ) const;
137 
138  void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
139 
140  void SelectEntry( sal_Int32 nPos, bool bSelect );
141 
142  sal_Int32 GetSelectedEntryCount() const;
143  OUString GetSelectedEntry( sal_Int32 nIndex ) const;
144  sal_Int32 GetSelectedEntryPos( sal_Int32 nIndex ) const;
145  bool IsEntryPosSelected( sal_Int32 nIndex ) const;
146 
147  void SetLastSelected( sal_Int32 nPos ) { mnLastSelected = nPos; }
148  sal_Int32 GetLastSelected() const { return mnLastSelected; }
149 
150  void SetSelectionAnchor( sal_Int32 nPos ) { mnSelectionAnchor = nPos; }
151  sal_Int32 GetSelectionAnchor() const { return mnSelectionAnchor; }
152 
153  void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maSelectionChangedHdl = rLnk; }
154  void SetCallSelectionChangedHdl( bool bCall ) { mbCallSelectionChangedHdl = bCall; }
155 
156  void SetMRUCount( sal_Int32 n ) { mnMRUCount = n; }
157  sal_Int32 GetMRUCount() const { return mnMRUCount; }
158 
159  void SetMaxMRUCount( sal_Int32 n ) { mnMaxMRUCount = n; }
160  sal_Int32 GetMaxMRUCount() const { return mnMaxMRUCount; }
161 
164  bool IsEntrySelectable( sal_Int32 nPos ) const;
165 
171  sal_Int32 FindFirstSelectable( sal_Int32 nPos, bool bForward = true );
172 };
173 
175 {
176 private:
177  std::unique_ptr<ImplEntryList> mpEntryList;
179 
181 
184  long mnMaxImgTxtWidth;
186  long mnMaxImgWidth;
189  long mnMaxWidth;
190  long mnMaxHeight;
191 
192  sal_Int32 mnCurrentPos;
194 
195  std::set< sal_Int32 > maSeparators;
196 
197  sal_Int32 mnUserDrawEntry;
198 
199  sal_Int32 mnTop;
200  long mnLeft;
202 
203  sal_uInt16 mnSelectModifier;
204 
205  bool mbHasFocusRect : 1;
206  bool mbSort : 1;
207  bool mbTrack : 1;
208  bool mbMulti : 1;
209  bool mbSimpleMode : 1;
210  bool mbTravelSelect : 1;
211  bool mbTrackingSelect : 1;
213  bool mbMouseMoveSelect : 1;
214  bool mbGrabFocus : 1;
215  bool mbUserDrawEnabled : 1;
216  bool mbInUserDraw : 1;
217  bool mbReadOnly : 1;
218  bool mbCenter : 1;
219  bool mbRight : 1;
220  bool mbEdgeBlending : 1;
222  bool mbIsDropdown : 1;
223 
232 
234 
235 protected:
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  ImplEntryList* GetEntryList() const { return mpEntryList.get(); }
266 
267  sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry ); // sorts using mbSort
268  sal_Int32 InsertEntry( sal_Int32 nPos, ImplEntryType* pNewEntry, bool bSort ); // to insert ignoring mbSort, e.g. mru
269  void RemoveEntry( sal_Int32 nPos );
270  void Clear();
271  void ResetCurrentPos() { mnCurrentPos = LISTBOX_ENTRY_NOTFOUND; }
272  sal_Int32 GetCurrentPos() const { return mnCurrentPos; }
273  sal_uInt16 GetDisplayLineCount() const;
274  void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
275 
276  void DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32 nPos, bool bDrawImage, bool bDrawText);
277 
278  void SelectEntry( sal_Int32 nPos, bool bSelect );
279  void DeselectAll();
280  sal_Int32 GetEntryPosForPoint( const Point& rPoint ) const;
281  sal_Int32 GetLastVisibleEntry() const;
282 
283  bool ProcessKeyInput( const KeyEvent& rKEvt );
284 
285  void SetTopEntry( sal_Int32 nTop );
286  sal_Int32 GetTopEntry() const { return mnTop; }
289  void ShowProminentEntry( sal_Int32 nEntryPos );
290  using Window::IsVisible;
291  bool IsVisible( sal_Int32 nEntry ) const;
292 
293  long GetLeftIndent() const { return mnLeft; }
294  void SetLeftIndent( long n );
295  void ScrollHorz( long nDiff );
296 
297  void AllowGrabFocus( bool b ) { mbGrabFocus = b; }
298  bool IsGrabFocusAllowed() const { return mbGrabFocus; }
299 
304  void SetSeparatorPos( sal_Int32 n );
309  sal_Int32 GetSeparatorPos() const;
310 
314  void AddSeparator( sal_Int32 n ) { maSeparators.insert( n ); }
318  bool isSeparator( const sal_Int32 &n ) const;
319 
320  void SetTravelSelect( bool bTravelSelect ) { mbTravelSelect = bTravelSelect; }
321  bool IsTravelSelect() const { return mbTravelSelect; }
322  bool IsTrackingSelect() const { return mbTrackingSelect; }
323 
324  void SetUserItemSize( const Size& rSz );
325 
326  void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; }
327  bool IsUserDrawEnabled() const { return mbUserDrawEnabled; }
328 
329  void EnableMultiSelection( bool bMulti ) { mbMulti = bMulti; }
330  bool IsMultiSelectionEnabled() const { return mbMulti; }
331 
332  void SetMultiSelectionSimpleMode( bool bSimple ) { mbSimpleMode = bSimple; }
333 
334  void EnableMouseMoveSelect( bool bMouseMoveSelect ) { mbMouseMoveSelect = bMouseMoveSelect; }
335  bool IsMouseMoveSelect() const { return mbMouseMoveSelect; }
336 
337  Size CalcSize(sal_Int32 nMaxLines) const;
338  tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const;
339 
340  long GetEntryHeight() const { return mnMaxHeight; }
341  long GetEntryHeightWithMargin() const;
342  long GetMaxEntryWidth() const { return mnMaxWidth; }
343 
344  void SetScrollHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maScrollHdl = rLink; }
345  void SetSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maSelectHdl = rLink; }
346  void SetCancelHdl( const Link<LinkParamNone*,void>& rLink ) { maCancelHdl = rLink; }
347  void SetDoubleClickHdl( const Link<ImplListBoxWindow*,void>& rLink ) { maDoubleClickHdl = rLink; }
348  void SetUserDrawHdl( const Link<UserDrawEvent*, void>& rLink ) { maUserDrawHdl = rLink; }
349  void SetMRUChangedHdl( const Link<LinkParamNone*,void>& rLink ) { maMRUChangedHdl = rLink; }
350  void SetFocusHdl( const Link<sal_Int32,void>& rLink ) { maFocusHdl = rLink ; }
351 
352  void SetListItemSelectHdl( const Link<LinkParamNone*,void>& rLink ) { maListItemSelectHdl = rLink ; }
353  bool IsSelectionChanged() const { return mbSelectionChanged; }
354  sal_uInt16 GetSelectModifier() const { return mnSelectModifier; }
355 
356  void EnableSort( bool b ) { mbSort = b; }
357 
358  void SetReadOnly( bool bReadOnly ) { mbReadOnly = bReadOnly; }
359  bool IsReadOnly() const { return mbReadOnly; }
360 
362 
363  bool GetEdgeBlending() const { return mbEdgeBlending; }
364  void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
365 
367  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
368 
369 protected:
370  // ISearchableStringList
371  virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
372  virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
373  virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
374 };
375 
376 class ImplListBox : public Control
377 {
378 private:
383 
384  bool mbVScroll : 1; // VScroll on or off
385  bool mbHScroll : 1; // HScroll on or off
386  bool mbAutoHScroll : 1; // AutoHScroll on or off
387  bool mbEdgeBlending : 1;
388 
389  Link<ImplListBox*,void> maScrollHdl; // because it is needed by ImplListBoxWindow itself
390 
391 protected:
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 );
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  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  long GetEntryHeight() const { return maLBWindow->GetEntryHeight(); }
471  long GetEntryHeightWithMargin() const{ return maLBWindow->GetEntryHeightWithMargin(); }
472  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 ); }
481  void SetSelectionChangedHdl( const Link<sal_Int32,void>& rLnk ) { maLBWindow->GetEntryList()->SetSelectionChangedHdl( rLnk ); }
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 protected:
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 
521  void StartFloat( bool bStartTracking );
522 
523  virtual void setPosSizePixel( long nX, long nY,
524  long nWidth, 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 : 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 protected:
550  virtual void FillLayoutData() const override;
551 
552 public:
553  ImplWin( vcl::Window* pParent, WinBits nWinStyle );
554 
555  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
556  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
557  virtual void Resize() override;
558  virtual void GetFocus() override;
559  virtual void LoseFocus() override;
560  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
561 
562  sal_Int32 GetItemPos() const { return mnItemPos; }
563  void SetItemPos( sal_Int32 n ) { mnItemPos = n; }
564 
565  void SetString( const OUString& rStr ) { maString = rStr; }
566 
567  void SetImage( const Image& rImg ) { maImage = rImg; }
568 
569  void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
570 
571  void DrawEntry(vcl::RenderContext& rRenderContext, bool bLayout);
572 
573  bool GetEdgeBlending() const { return mbEdgeBlending; }
574  void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
575 
576  virtual void ShowFocus(const tools::Rectangle& rRect) override;
577 
579  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
580 
581 };
582 
583 class ImplBtn : public PushButton
584 {
585 private:
587 
588 public:
589  ImplBtn( vcl::Window* pParent, WinBits nWinStyle );
590 
591  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
592  void SetMBDownHdl( const Link<void*,void>& rLink ) { maMBDownHdl = rLink; }
593 };
594 
595 void ImplInitDropDownButton( PushButton* pButton );
596 
597 #endif // INCLUDED_VCL_INC_LISTBOX_HXX
598 
599 /* 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:493
void ResetCurrentPos()
Definition: listbox.hxx:426
virtual void ShowFocus(const tools::Rectangle &rRect) override
bool mbAutoHScroll
Definition: listbox.hxx:386
virtual void LoseFocus() override
Link< sal_Int32, void > maFocusHdl
Definition: listbox.hxx:230
long GetLeftIndent() const
Definition: listbox.hxx:293
bool mbEdgeBlending
Definition: listbox.hxx:546
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:207
virtual void Resize() override
bool IsSelectionChanged() const
Definition: listbox.hxx:353
virtual void LoseFocus() override
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:569
bool HasEntryImage(sal_Int32 nPos) const
virtual void StateChanged(StateChangedType nType) override
const ImplEntryList * GetEntryList() const
Definition: listbox.hxx:410
void SetNoSelection()
OUString maString
Definition: listbox.hxx:539
void SetSelectionAnchor(sal_Int32 nPos)
Definition: listbox.hxx:150
virtual void FillLayoutData() const override
sal_Int32 GetSeparatorPos() const
Gets the position of the separator which was added first.
Definition: listbox.hxx:441
sal_Int32 GetSelectedEntryPos(sal_Int32 nIndex) const
void SetUserItemSize(const Size &rSz)
void SetFocusHdl(const Link< sal_Int32, void > &rLink)
Definition: listbox.hxx:350
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual ~ImplListBoxWindow() override
bool IsTravelSelect() const
Definition: listbox.hxx:458
Image maImage
Definition: listbox.hxx:54
bool mbVScroll
Definition: listbox.hxx:384
ImplEntryList * GetEntryList() const
Definition: listbox.hxx:265
void AllowGrabFocus(bool b)
Definition: listbox.hxx:297
tools::Rectangle maFocusRect
Definition: listbox.hxx:178
long mnLeft
output from column on
Definition: listbox.hxx:200
long mnMaxTxtWidth
Maximum width of a text item Entry without Image.
Definition: listbox.hxx:183
bool mbSelectionChanged
Do not call Select() too often ...
Definition: listbox.hxx:212
void ImplResizeControls()
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:462
const Size & GetPrefSize() const
Definition: listbox.hxx:516
bool mbEdgeBlending
Definition: listbox.hxx:387
Link< ImplListBoxWindow *, void > maScrollHdl
Definition: listbox.hxx:224
bool IsVisible(sal_Int32 nEntry) const
Definition: listbox.hxx:452
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
void EnableMouseMoveSelect(bool bMouseMoveSelect)
Definition: listbox.hxx:334
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:329
sal_Int32 GetLastSelected() const
Definition: listbox.hxx:148
void SetMRUCount(sal_Int32 n)
Definition: listbox.hxx:156
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:320
void SelectEntry(sal_Int32 nPos, bool bSelect)
Definition: imp_listbox.cxx:84
sal_Int32 GetSelectedEntryCount() const
bool IsTrackingSelect() const
Definition: listbox.hxx:322
PosSizeFlags
Definition: window.hxx:140
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:154
long GetMaxEntryWidth() const
Definition: listbox.hxx:472
sal_Int32 mnMRUCount
Definition: listbox.hxx:93
bool mbMouseMoveSelect
Select at MouseMove.
Definition: listbox.hxx:213
long GetLeftIndent() const
Definition: listbox.hxx:454
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:272
sal_Int32 mnTop
output from line on
Definition: listbox.hxx:199
sal_uInt16 GetDisplayLineCount() const
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:218
sal_Int32 GetSelectionAnchor() const
Definition: listbox.hxx:151
void SetDropDownLineCount(sal_uInt16 n)
Definition: listbox.hxx:526
void SetEntryFlags(sal_Int32 nPos, ListBoxEntryFlags nFlags)
virtual void Tracking(const TrackingEvent &rTEvt) override
sal_Int32 FindEntry(const OUString &rStr, bool bSearchMRUArea=false) const
void ImplUpdateEntryMetrics(ImplEntryType &rEntry)
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:478
#define LISTBOX_ENTRY_NOTFOUND
Definition: lstbox.hxx:38
VclPtr< ImplListBoxWindow > maLBWindow
Definition: listbox.hxx:379
bool mbReadOnly
ReadOnly.
Definition: listbox.hxx:217
ImplEntryList(vcl::Window *pWindow)
Definition: imp_listbox.cxx:61
NONE
long GetEntryHeightWithMargin() const
void ImplInitScrollBars()
Link< void *, void > maMBDownHdl
Definition: listbox.hxx:586
sal_Int32 GetTopEntry() const
Definition: listbox.hxx:286
void ImplInitDropDownButton(PushButton *pButton)
Definition: imp_listbox.cxx:52
bool HandleWheelAsCursorTravel(const CommandEvent &rCEvt)
virtual void setPosSizePixel(long nX, long nY, long nWidth, long nHeight, PosSizeFlags nFlags=PosSizeFlags::All) override
void RemoveEntry(sal_Int32 nPos)
void * GetEntryData(sal_Int32 nPos) const
StateChangedType
Definition: window.hxx:310
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
void SetCallSelectionChangedHdl(bool bCall)
Definition: listbox.hxx:482
void SetSelectHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:345
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:321
std::set< sal_Int32 > maSeparators
Separator positions.
Definition: listbox.hxx:195
virtual bool PreNotify(NotifyEvent &rNEvt) override
void RemoveEntry(sal_Int32 nPos)
sal_Int32 GetCurrentPos() const
Definition: listbox.hxx:427
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
long mnTextHeight
text height
Definition: listbox.hxx:201
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool mbHScroll
Definition: listbox.hxx:385
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:349
virtual const Wallpaper & GetDisplayBackground() const override
bool mbIsDropdown
Listbox is actually a dropdown (either combobox, or popup window treated as dropdown) ...
Definition: listbox.hxx:222
virtual void Resize() override
long mnHeight
Definition: listbox.hxx:58
const void * StringEntryIdentifier
sal_Int32 GetMaxMRUCount() const
Definition: listbox.hxx:160
Link< LinkParamNone *, void > maListItemSelectHdl
Definition: listbox.hxx:231
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:209
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:484
Image GetEntryImage(sal_Int32 nPos) const
long mnMaxTxtHeight
Maximum height of a text item.
Definition: listbox.hxx:182
ImplListBoxWindow * GetMainWindow()
Definition: listbox.hxx:411
sal_Int32 mnTrackingSaveSelection
Selection before Tracking();.
Definition: listbox.hxx:193
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:271
void RemoveEntry(sal_Int32 nPos)
void SetScrollHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:344
void SetReadOnly(bool bReadOnly)
Definition: listbox.hxx:358
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:157
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:159
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:153
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:314
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
void ScrollHorz(long nDiff)
virtual void Resize() override
bool IsEntryPosSelected(sal_Int32 nIndex) const
ImplBtn(vcl::Window *pParent, WinBits nWinStyle)
virtual void Resize() override
virtual ~ImplListBox() override
virtual bool PreNotify(NotifyEvent &rNEvt) override
long mnMaxWidth
Maximum width of an entry.
Definition: listbox.hxx:189
sal_uInt16 GetDropDownLineCount() const
Definition: listbox.hxx:527
void SetImage(const Image &rImg)
Definition: listbox.hxx:567
void SetMultiSelectionSimpleMode(bool bSimple)
Definition: listbox.hxx:332
bool mbMulti
MultiListBox.
Definition: listbox.hxx:208
void ImplCheckScrollBars()
Link< ImplListBoxWindow *, void > maDoubleClickHdl
Definition: listbox.hxx:227
sal_Int32 mnSelectionAnchor
Definition: listbox.hxx:90
long mnMaxHeight
Maximum height of an entry.
Definition: listbox.hxx:190
ImplListBox(vcl::Window *pParent, WinBits nWinStyle)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
VclPtr< ScrollBarBox > mpScrollBarBox
Definition: listbox.hxx:382
Size CalcSize(sal_Int32 nMaxLines) const
void SetLastSelected(sal_Int32 nPos)
Definition: listbox.hxx:147
void SetItemPos(sal_Int32 n)
Definition: listbox.hxx:563
long GetEntryHeight(sal_Int32 nPos) const
DrawTextFlags ImplGetTextStyle() const
void SetEdgeBlending(bool bNew)
Definition: listbox.hxx:364
void ImplDoPaint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
vcl::QuickSelectionEngine maQuickSelectionEngine
Definition: listbox.hxx:233
DrawTextFlags
Definition: outdev.hxx:142
bool GetEdgeBlending() const
Definition: listbox.hxx:573
VclPtr< ScrollBar > mpHScrollBar
Definition: listbox.hxx:380
Link< LinkParamNone *, void > maCancelHdl
Definition: listbox.hxx:226
std::unique_ptr< ImplEntryList > mpEntryList
EntryList.
Definition: listbox.hxx:177
bool mbSort
ListBox sorted.
Definition: listbox.hxx:206
bool GetEdgeBlending() const
Definition: listbox.hxx:363
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:529
Link< UserDrawEvent *, void > maUserDrawHdl
Definition: listbox.hxx:228
bool mbTravelSelect
TravelSelect.
Definition: listbox.hxx:210
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:229
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:356
ImplEntryType(const OUString &rStr)
Definition: listbox.hxx:72
bool mbIsSelected
Definition: listbox.hxx:56
sal_Int32 mnCurrentPos
Position (Focus)
Definition: listbox.hxx:192
bool mbUserDrawEnabled
UserDraw possible.
Definition: listbox.hxx:215
VclPtr< ScrollBar > mpVScrollBar
Definition: listbox.hxx:381
bool IsMouseMoveSelect() const
Definition: listbox.hxx:335
long mnMaxImgWidth
Maximum width of an image item.
Definition: listbox.hxx:187
long GetEntryHeight() const
Definition: listbox.hxx:340
sal_uInt16 GetSelectModifier() const
Definition: listbox.hxx:354
void * mpUserData
Definition: listbox.hxx:55
bool IsUserDrawEnabled() const
Definition: listbox.hxx:327
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:515
bool ProcessKeyInput(const KeyEvent &rKEvt)
Definition: listbox.hxx:429
const ImplEntryType * GetEntryPtr(sal_Int32 nPos) const
Definition: listbox.hxx:113
Definition: ctrl.hxx:33
bool IsEntrySelectable(sal_Int32 nPos) const
An Entry is selectable if its mnFlags does not have the ListBoxEntryFlags::DisableSelection flag set...
long GetEntryHeight() const
Definition: listbox.hxx:470
ListBoxEntryFlags
Definition: lstbox.hxx:48
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:89
bool IsVisible() const
Definition: window2.cxx:1102
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:503
long mnMaxImgHeight
Maximum height of an image item.
Definition: listbox.hxx:188
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:574
sal_uInt16 mnSelectModifier
Modifiers.
Definition: listbox.hxx:203
long GetMaxEntryWidth() const
Definition: listbox.hxx:342
Definition: image.hxx:39
bool IsSelectionChanged() const
Definition: listbox.hxx:483
long GetAddedHeight(sal_Int32 nEndIndex, sal_Int32 nBeginIndex) const
helper: add up heights up to index nEndIndex.
void SetSelectionChangedHdl(const Link< sal_Int32, void > &rLnk)
Definition: listbox.hxx:481
long GetEntryHeightWithMargin() const
Definition: listbox.hxx:471
long mnMaxImgTxtWidth
Maximum width of a text item Entry AND Image.
Definition: listbox.hxx:185
void SetMaxMRUCount(sal_Int32 n)
Definition: listbox.hxx:488
void SetUserDrawHdl(const Link< UserDrawEvent *, void > &rLink)
Definition: listbox.hxx:348
ImplListBoxWindow(vcl::Window *pParent, WinBits nWinStyle)
void SetCancelHdl(const Link< LinkParamNone *, void > &rLink)
Definition: listbox.hxx:476
bool IsGrabFocusAllowed() const
Definition: listbox.hxx:298
bool IsMultiSelectionEnabled() const
Definition: listbox.hxx:330
sal_Int32 mnImages
Definition: listbox.hxx:91
long getHeightWithMargin() const
virtual void GetFocus() override
sal_Int32 InsertEntry(sal_Int32 nPos, ImplEntryType *pNewEntry)
virtual bool EventNotify(NotifyEvent &rNEvt) override
void ImplInitSettings()
Definition: ctrl.cxx:428
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:479
void SelectEntry(sal_Int32 nPos, bool bSelect)
Link< sal_Int32, void > maSelectionChangedHdl
Definition: listbox.hxx:96
sal_Int32 mnUserDrawEntry
Definition: listbox.hxx:197
virtual void FillLayoutData() const override
bool IsReadOnly() const
Definition: listbox.hxx:359
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:565
void SetLeftIndent(long n)
bool HasImages() const
Definition: listbox.hxx:128
void EnableUserDraw(bool bUserDraw)
Definition: listbox.hxx:326
bool mbInUserDraw
In UserDraw.
Definition: listbox.hxx:216
sal_Int32 GetItemPos() const
Definition: listbox.hxx:562
bool mbGrabFocus
Grab focus at MBDown.
Definition: listbox.hxx:214
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:352
void SetEdgeBlending(bool bNew)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
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:346
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:127
void SetMBDownHdl(const Link< void *, void > &rLink)
Definition: listbox.hxx:592
tools::Rectangle GetBoundingRectangle(sal_Int32 nItem) const
Link< ImplListBox *, void > maScrollHdl
Definition: listbox.hxx:389
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:225
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:211
bool mbRight
right align Text output
Definition: listbox.hxx:219
void SetDoubleClickHdl(const Link< ImplListBoxWindow *, void > &rLink)
Definition: listbox.hxx:347