LibreOffice Module vcl (master)  1
treelistbox.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 #pragma once
21 
22 #if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23 #error "don't use this in new code"
24 #endif
25 
26 #include <vcl/dllapi.h>
27 
28 #include <deque>
29 #include <memory>
30 #include <vector>
31 
32 #include <vcl/ctrl.hxx>
34 #include <vcl/image.hxx>
35 #include <tools/gen.hxx>
36 #include <tools/contnr.hxx>
37 #include <vcl/toolkit/treelist.hxx>
38 #include <vcl/transfer.hxx>
39 #include <vcl/menu.hxx>
40 #include <o3tl/typed_flags_set.hxx>
41 
42 class SvTreeListBox;
43 class SvTreeListEntry;
44 struct SvViewDataItem;
45 class SvViewDataEntry;
46 class SvInplaceEdit2;
47 class SvLBoxString;
48 class SvImpLBox;
49 class SvLBoxButtonData;
50 class Timer;
51 class Edit;
52 
53 namespace utl {
54  class AccessibleStateSetHelper;
55 }
56 
58 
59 // *********************************************************************
60 // *************************** Tabulators ******************************
61 // *********************************************************************
62 
63 enum class SvLBoxTabFlags
64 {
65  NONE = 0x0000,
66  DYNAMIC = 0x0001, // Item's output column changes according to the Child Depth
67  ADJUST_RIGHT = 0x0002, // Item's right margin at the tabulator
68  ADJUST_LEFT = 0x0004, // Left margin
69  ADJUST_CENTER = 0x0008, // Center the item at the tabulator
70 
71  SHOW_SELECTION = 0x0010, // Visualize selection state
72  // Item needs to be able to return the surrounding polygon (D'n'D cursor)
73  EDITABLE = 0x0020, // Item editable at the tabulator
74  FORCE = 0x0040, // Switch off the default calculation of the first tabulator
75  // (on which Abo Tabpage/Extras/Option/Customize, etc. rely on)
76  // The first tab's position corresponds precisely to the Flags set
77  // and column widths
78 };
79 namespace o3tl
80 {
81  template<> struct typed_flags<SvLBoxTabFlags> : is_typed_flags<SvLBoxTabFlags, 0x007f> {};
82 }
83 
84 #define SV_TAB_BORDER 8
85 
86 #define SV_ENTRYHEIGHTOFFS_PIXEL 2
87 
88 enum class SvTreeFlags
89 {
90  CHKBTN = 0x01,
91  USESEL = 0x02,
92  MANINS = 0x04,
93  RECALCTABS = 0x08,
94  FIXEDHEIGHT = 0x10,
95 };
96 namespace o3tl
97 {
98  template<> struct typed_flags<SvTreeFlags> : is_typed_flags<SvTreeFlags, 0x1f> {};
99 }
100 
102 
104 {
105  long nPos;
106 public:
107  SvLBoxTab();
108  SvLBoxTab( long nPos, SvLBoxTabFlags nFlags );
109  SvLBoxTab( const SvLBoxTab& );
110  ~SvLBoxTab();
111 
113 
114  bool IsDynamic() const { return bool(nFlags & SvLBoxTabFlags::DYNAMIC); }
115  void SetPos( long nNewPos) { nPos = nNewPos; }
116  long GetPos() const { return nPos; }
117  long CalcOffset( long nItemLength, long nTabWidth );
118  bool IsEditable() const { return bool(nFlags & SvLBoxTabFlags::EDITABLE); }
119 };
120 
122 {
123 protected:
125 
126 public:
127  SvLBoxItem();
128  virtual ~SvLBoxItem();
129  virtual SvLBoxItemType GetType() const = 0;
130  virtual int CalcWidth(const SvTreeListBox* pView) const;
131  int GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
132  int GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos);
133  int GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
134  static int GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
135  void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
136 
137  virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0;
138 
139  virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry,
140  // If != 0: this Pointer must be used!
141  // If == 0: it needs to be retrieved via the View
142  SvViewDataItem* pViewData = nullptr) = 0;
143  // View-dependent data is not cloned
144  virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const = 0;
145 };
146 
147 enum class DragDropMode
148 {
149  NONE = 0x0000,
150  CTRL_MOVE = 0x0001,
151  APP_COPY = 0x0004,
152  // Entries may be dropped via the uppermost Entry
153  // The DropTarget is 0 in that case
154  ENABLE_TOP = 0x0010,
155  ALL = 0x0015,
156 };
157 namespace o3tl
158 {
159  template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0015> {};
160 }
161 
163 {
164  NONE = 0x0000,
165  IN_EDT = 0x0001,
166  EDT_ENABLED = 0x0002,
167  TARGEMPH_VIS = 0x0004,
168  EDTEND_CALLED = 0x0008,
169 };
170 namespace o3tl
171 {
172  template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
173 }
174 
176 
177 typedef std::pair<vcl::RenderContext&, const SvTreeListEntry&> svtree_measure_args;
178 typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&> svtree_render_args;
179 
181  :public Control
182  ,public SvListView
183  ,public DropTargetHelper
184  ,public DragSourceHelper
186 {
187  friend class SvImpLBox;
188  friend class SvLBoxString;
189  friend class IconViewImpl;
190  friend class TreeControlPeer;
191  friend class SalInstanceIconView;
192  friend class SalInstanceTreeView;
194 
195  std::unique_ptr<SvTreeListBoxImpl> mpImpl;
205 
210 
213  short nIndent;
214  short nFocusWidth;
215  sal_uInt16 nFirstSelTab;
216  sal_uInt16 nLastSelTab;
221  bool mbQuickSearch; // Enables type-ahead search in the check list box.
222  bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
223  bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
224 
226 
230  sal_Int32 nMinWidthInChars;
231 
233 
236 
238 
239 protected:
240  std::unique_ptr<SvImpLBox> pImpl;
241  short nColumns;
243  short nEntryWidth;
245 
249  std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
252  // Move/CopySelection: Position of the current Entry in SelectionList
253  sal_uInt16 nCurEntrySelPos;
254 
255 private:
256  DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
257  DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void );
258  // Handler that is called by TreeList to clone an Entry
260 
261  // Handler and methods for Drag - finished handler.
262  // The Handle retrieved by GetDragFinishedHdl can be set on the
263  // TransferDataContainer. This link is a callback for the DragFinished
264  // call. The AddBox method is called from the GetDragFinishedHdl() and the
265  // remove is called in the link callback and in the dtor. So it can't be
266  // called for a deleted object.
267  VCL_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
268  VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
269  DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
270 
271  // after a checkbox entry is inserted, use this to get its width to support
272  // autowidth for the 1st checkbox column
273  VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
274 
275  VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry);
276  VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext& rRenderContext, const SvTreeListEntry& rEntry);
277 
285  VCL_DLLPRIVATE bool HandleKeyInput(const KeyEvent& rKEvt);
286 
287  void UnsetDropTarget();
288 
289 protected:
290 
291  bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
292  void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
293  void EnableSelectionAsDropTarget( bool bEnable = true );
294  // Standard impl returns 0; derived classes which support D'n'D must override
295  using Window::GetDropTarget;
296  virtual SvTreeListEntry* GetDropTarget( const Point& );
297 
298  // Invalidate children on enable/disable
299  virtual void StateChanged( StateChangedType eType ) override;
300 
301  virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND);
302  virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND );
303 
304  // In-place editing
305  std::unique_ptr<SvInplaceEdit2> pEdCtrl;
306  void EditText( const OUString&, const tools::Rectangle&,const Selection&);
307  void CancelTextEditing();
308 
309  // InitViewData is called right after CreateViewData
310  // The Entry is has not yet been added to the View in InitViewData!
311  virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
312  // Calls InitViewData for all Items
313  void RecalcViewData();
314 
315  // Handler and methods for Drag - finished handler. This link can be set
316  // to the TransferDataContainer. The AddBox/RemoveBox methods must be
317  // called before the StartDrag call.
318  // The Remove will be called from the handler, which then calls DragFinish.
319  // The Remove is also called in the DTOR of the SvTreeListBox -
320  // so it can't be called for a deleted object.
321  Link<sal_Int8,void> GetDragFinishedHdl() const;
322 
323  // For asynchronous D'n'D
324  sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
325 
326  void OnCurrentEntryChanged();
327 
328  // ISearchableStringList
329  virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
330  virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
331  virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
332 
333 public:
334 
335  SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
336  virtual ~SvTreeListBox() override;
337  virtual void dispose() override;
338 
340  {
341  return pModel.get();
342  }
343 
345  {
346  return pModel ? pModel->GetEntryCount() : 0;
347  }
349  {
350  return pModel ? pModel->First() : nullptr;
351  }
353  {
354  return pModel->Next(pEntry);
355  }
357  {
358  return pModel->Prev(pEntry);
359  }
361  {
362  return pModel ? pModel->Last() : nullptr;
363  }
364 
365  SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
366 
367  bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
368  bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback );
369  void RemoveSelection();
373  void RemoveEntry(SvTreeListEntry const * pEntry);
374 
375  DragDropMode GetDragDropMode() const { return nDragDropMode; }
376  SelectionMode GetSelectionMode() const { return eSelMode; }
377 
378  // pParent == 0 -> Root level
379  SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const;
380  SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const;
381 
382  SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
383  void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
384 
385  using Window::GetParent;
386  SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
387 
388  using Window::GetChildCount;
389  sal_uLong GetChildCount( SvTreeListEntry const * pParent ) const;
390  sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
391 
392  SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
393  SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
394  const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
395 
396  bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
397  bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
398  void EndEditing( bool bCancel = false );
399 
400  void Clear();
401 
402  bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
403 
404  void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
405  void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
406  void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
407  void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
408  void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
409  void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
410  void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { aTooltipHdl = rLink; }
411  void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { aCustomRenderHdl = rLink; }
412  void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { aCustomMeasureHdl = rLink; }
413 
414  void ExpandedHdl();
415  bool ExpandingHdl();
416  void SelectHdl();
417  void DeselectHdl();
418  bool DoubleClickHdl();
419  SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
420 
421  // Is called for an Entry that gets expanded with the Flag
422  // ENTRYFLAG_CHILDREN_ON_DEMAND set.
423  virtual void RequestingChildren( SvTreeListEntry* pParent );
424 
425  // Drag & Drop
426  // New D'n'D API
427  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
428  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
429  virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
430  virtual DragDropMode NotifyStartDrag();
431  virtual void DragFinished( sal_Int8 nDropAction );
432 
433  SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
434 
435  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
436  TriState NotifyMoving(
437  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
438  SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
439  SvTreeListEntry*& rpNewParent, // New TargetParent
440  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
441 
442  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
443  TriState NotifyCopying(
444  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
445  SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
446  SvTreeListEntry*& rpNewParent, // New TargetParent
447  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
448 
449  // ACCESSIBILITY ==========================================================
450 
452  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
453 
455  void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const;
456 
461  tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry);
462 
463  SvTreeFlags GetTreeFlags() const {return nTreeFlags;}
464 
465  static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry);
466 
467  void set_min_width_in_chars(sal_Int32 nChars);
468 
469  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
470 
471 protected:
472 
473  VCL_DLLPRIVATE void SetEntryHeight( SvTreeListEntry const * pEntry );
474  void AdjustEntryHeight( const Image& rBmp );
475  VCL_DLLPRIVATE void AdjustEntryHeight();
476 
477  VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
478  VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, long nLine, vcl::RenderContext& rRenderContext );
479 
480  VCL_DLLPRIVATE void InitTreeView();
481  VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, long nX, SvLBoxTab** ppTab );
482  VCL_DLLPRIVATE void ImplInitStyle();
483 
484  void SetupDragOrigin();
485  void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
486  const Selection& );
487  void EditedText(const OUString&);
488 
489  // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
490  // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
491  virtual void SetTabs();
492  void AddTab( long nPos, SvLBoxTabFlags nFlags );
493  sal_uInt16 TabCount() const { return aTabs.size(); }
494  SvLBoxTab* GetFirstDynamicTab() const;
495  SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
496  SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
497  void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
498  SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
499  void ClearTabList();
500 
501  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
502 
503  void NotifyScrolled();
504  void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
505  long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
506 
507  virtual void Command( const CommandEvent& rCEvt ) override;
508 
509  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
510  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
511 
512  void InitSettings();
513 
514  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
515 
516  void CallImplEventListeners(VclEventId nEvent, void* pData);
517 
518  void ImplEditEntry( SvTreeListEntry* pEntry );
519 
520  void AdjustEntryHeightAndRecalc();
521 
522  // true if rPos is over the SvTreeListBox body, i.e. not over a
523  // scrollbar
524  VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
525 public:
526 
527  void SetNoAutoCurEntry( bool b );
528 
529  void EnableCheckButton( SvLBoxButtonData* );
530  void SetCheckButtonData( SvLBoxButtonData* );
531  void SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp );
532 
536  static const Image& GetDefaultExpandedNodeImage( );
537 
541  static const Image& GetDefaultCollapsedNodeImage( );
542 
546  {
547  SetNodeBitmaps(
548  GetDefaultCollapsedNodeImage( ),
549  GetDefaultExpandedNodeImage( )
550  );
551  }
552 
553  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
554  bool bChildrenOnDemand = false,
555  sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr);
556 
557  virtual SvTreeListEntry* InsertEntry( const OUString& rText,
558  const Image& rExpandedEntryBmp,
559  const Image& rCollapsedEntryBmp,
560  SvTreeListEntry* pParent = nullptr,
561  bool bChildrenOnDemand = false,
562  sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr );
563 
564  const Image& GetDefaultExpandedEntryBmp( ) const;
565  const Image& GetDefaultCollapsedEntryBmp( ) const;
566 
567  void SetDefaultExpandedEntryBmp( const Image& rBmp );
568  void SetDefaultCollapsedEntryBmp( const Image& rBmp );
569 
570  void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
571  SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
572 
573  void SetEntryText(SvTreeListEntry*, const OUString& );
574  void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
575  void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
576 
577  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
578  static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
579  static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
580 
581  void CheckButtonHdl();
582 
583  void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
584 
585  void EnableInplaceEditing( bool bEnable );
586  // Edits the Entry's first StringItem, 0 == Cursor
587  void EditEntry( SvTreeListEntry* pEntry );
588  virtual bool EditingEntry( SvTreeListEntry* pEntry );
589  virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
590 
591  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
592  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
593  virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
594  virtual void MouseMove( const MouseEvent& rMEvt ) override;
595  virtual void KeyInput( const KeyEvent& rKEvt ) override;
596  virtual void Resize() override;
597  virtual void GetFocus() override;
598  virtual void LoseFocus() override;
599  void SetUpdateMode( bool );
600 
601  virtual void ModelHasCleared() override;
602  virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
603  virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
604  virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
605  virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
606  virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
607  virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
608  void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
609 
610  void ScrollOutputArea( short nDeltaEntries );
611 
612  short GetColumnsCount() const { return nColumns; }
613  short GetEntryHeight() const { return nEntryHeight; }
614  void SetEntryHeight( short nHeight );
615  short GetEntryWidth() const { return nEntryWidth; }
616  void SetEntryWidth( short nWidth );
617  Size GetOutputSizePixel() const;
618  short GetIndent() const { return nIndent; }
619  void SetSpaceBetweenEntries( short nSpace );
620  Point GetEntryPosition(const SvTreeListEntry*) const;
621  void MakeVisible( SvTreeListEntry* pEntry );
622  void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
623 
624  void SetCollapsedNodeBmp( const Image& );
625  void SetExpandedNodeBmp( const Image& );
626  Image const & GetExpandedNodeBmp( ) const;
627 
628  void SetFont( const vcl::Font& rFont );
629 
630  SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
631 
632  virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, long nLine );
633  // Respects indentation
634  sal_IntPtr GetTabPos(const SvTreeListEntry*, SvLBoxTab*);
635  void InvalidateEntry( SvTreeListEntry* );
636  SvLBoxItem* GetItem( SvTreeListEntry*, long nX, SvLBoxTab** ppTab);
637  SvLBoxItem* GetItem( SvTreeListEntry*, long nX );
638 
639  void SetDragDropMode( DragDropMode );
640  void SetSelectionMode( SelectionMode );
641 
642  bool Expand( SvTreeListEntry* pParent );
643  bool Collapse( SvTreeListEntry* pParent );
644  bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
645  sal_uLong SelectChildren( SvTreeListEntry* pParent, bool bSelect );
646  void SelectAll( bool bSelect );
647 
648  void SetCurEntry( SvTreeListEntry* _pEntry );
649  SvTreeListEntry* GetCurEntry() const;
650 
651  using Window::Invalidate;
652  virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
653  virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
654 
655  void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
656 
657  sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
658 
659  DECL_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
660  virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
661  SvTreeListEntry* pEntry2, sal_uLong nPos ) override;
662 
663  SvTreeListEntry* GetFirstEntryInView() const;
664  SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
665  void ScrollToAbsPos( long nPos );
666 
667  long getPreferredDimensions(std::vector<long> &rWidths) const;
668 
669  virtual Size GetOptimalSize() const override;
670 
671  void SetAlternatingRowColors( const bool bEnable );
672 
673  // Enables type-ahead search in the check list box.
674  void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
675 
676  // Make single click "activate" a row like a double-click normally does
677  void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
678 
679  // Make mouse over a row "select" a row like a single-click normally does
680  void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
681  bool GetHoverSelection() const { return mbHoverSelection; }
682 
683  void SetForceMakeVisible(bool bEnable);
684 
685  virtual FactoryFunction GetUITestFactory() const override;
686 
687  void SetDragHelper(rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
688 };
689 
690 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Link< svtree_measure_args, Size > aCustomMeasureHdl
virtual void ModelHasEntryInvalidated(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1135
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3864
void SetDeselectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
SvListAction
Definition: treelist.hxx:35
sal_uInt16 TabCount() const
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
virtual void MouseButtonDown(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
Link< const HelpEvent &, bool > aTooltipHdl
void SetExpandingHdl(const Link< SvTreeListBox *, bool > &rNewHdl)
InvalidateFlags
Definition: window.hxx:212
signed char sal_Int8
SvTreeList * GetModel() const
bool IsEditingActive() const
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
void SetDoubleClickHdl(const Link< SvTreeListBox *, bool > &rNewHdl)
sal_uIntPtr sal_uLong
sal_uLong GetEntryCount() const
bool mbCenterAndClipText
virtual StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const =0
returns the current entry in the list of searchable strings.
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
void SetScrolledHdl(const Link< SvTreeListBox *, void > &rLink)
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
const MapMode & GetMapMode() const
Definition: outdev.hxx:1677
SelectionMode
Definition: vclenum.hxx:26
bool IsDynamic() const
Link< const CommandEvent &, bool > aPopupMenuHdl
short nContextBmpWidthMax
bool mbUpdateAlternatingRows
void SetCustomMeasureHdl(const Link< svtree_measure_args, Size > &rLink)
SelectionMode GetSelectionMode() const
long GetPos() const
short GetColumnsCount() const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: ctrl.cxx:418
View-dependent data for a tree list entry created in the virtual function SvTreeListBox::CreateViewDa...
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:421
SvTreeListBoxFlags nImpFlags
bool mbAlternatingRowColors
long mnCheckboxItemWidth
SvTreeFlags
Definition: treelistbox.hxx:88
SvLBoxTabFlags nFlags
StateChangedType
Definition: window.hxx:317
SvLBoxItemType
sal_Int64 WinBits
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
rtl::Reference< TransferDataContainer > m_xTransferHelper
DragDropMode
std::pair< vcl::RenderContext &, const SvTreeListEntry & > svtree_measure_args
SvLBoxButtonData * pCheckButtonData
virtual void SelectEntry(StringEntryIdentifier _entry)=0
selects a given entry
bool mbContextBmpExpanded
sal_Int32 nMinWidthInChars
SvTreeListBoxFlags
SvLBoxItem * pEdItem
virtual void ModelHasInsertedTree(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1111
Link< SvTreeListBox *, bool > aDoubleClickHdl
VclEventId
Definition: vclevent.hxx:37
Image aCurInsertedExpBmp
const void * StringEntryIdentifier
void SetSelectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
Definition: edit.hxx:55
void Enable(bool bEnabled)
bool GetHoverSelection() const
short GetEntryHeight() const
Link< SvTreeListBox *, void > aDeselectHdl
SvTreeListEntry * GetHdlEntry() const
DragDropMode nOldDragMode
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: transfer2.cxx:292
void SetHoverSelection(bool bEnable)
SvTreeListEntry * pHdlEntry
sal_uInt16 nCurEntrySelPos
SvTreeListEntry * pTargetEntry
Image aCurInsertedColBmp
Image aPrevInsertedExpBmp
short GetEntryWidth() const
SelectionMode eSelMode
void SetPos(long nNewPos)
sal_uInt16 nLastSelTab
virtual void InitViewData(SvViewDataEntry *, SvTreeListEntry *pEntry)
Definition: treelist.cxx:1296
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
DragDropMode nDragDropMode
bool IsEditable() const
void Clear()
Definition: treelist.cxx:1087
DECL_LINK(AutocompleteHdl, Edit &, void)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: transfer2.cxx:286
bool mbActivateOnSingleClick
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1162
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:659
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2951
Link< SvTreeListBox *, void > aExpandedHdl
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
std::unique_ptr< SvImpLBox > pImpl
virtual void ModelHasRemoved(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1128
void SetPopupMenuHdl(const Link< const CommandEvent &, bool > &rLink)
Link< SvTreeListBox *, void > aSelectHdl
SvButtonState
Definition: treelistbox.hxx:57
bool TextCenterAndClipEnabled() const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ctrl.cxx:59
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
void SetNodeDefaultImages()
Sets default bitmaps for collapsed and expanded nodes.
Image aPrevInsertedColBmp
void SetCustomRenderHdl(const Link< svtree_render_args, void > &rLink)
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1431
DragDropMode GetDragDropMode() const
virtual void LoseFocus()
Definition: window.cxx:1849
void SetTooltipHdl(const Link< const HelpEvent &, bool > &rLink)
vcl::Window * GetParent() const
Definition: window2.cxx:1097
void SetExpandedHdl(const Link< SvTreeListBox *, void > &rNewHdl)
long CalcOffset(long nItemLength, long nTabWidth)
SvTreeListEntry * Next(SvTreeListEntry *pEntry) const
std::vector< std::unique_ptr< SvLBoxTab > > aTabs
std::unique_ptr< SvTreeListBoxImpl > mpImpl
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1799
virtual Size GetOptimalSize() const override
Definition: ctrl.cxx:374
SvTreeListEntry * First() const
bool IsInplaceEditingEnabled() const
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1005
Link< SvTreeListBox *, bool > aExpandingHdl
virtual StringEntryIdentifier NextEntry(StringEntryIdentifier _currentEntry, OUString &_out_entryText) const =0
returns the next entry in the list.
virtual void Resize() override
Definition: ctrl.cxx:74
virtual void ModelIsRemoving(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1124
void SetActivateOnSingleClick(bool bEnable)
SvTreeListEntry * pEdEntry
Definition: ctrl.hxx:33
short nEntryHeightOffs
virtual void GetFocus()
Definition: window.cxx:1835
unsigned char sal_uInt8
sal_uInt16 nFirstSelTab
void SetFont(const vcl::Font &rNewFont)
sal_Int8 mnDragAction
Definition: image.hxx:39
std::tuple< vcl::RenderContext &, const tools::Rectangle &, const SvTreeListEntry & > svtree_render_args
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1019
SvTreeListEntry * Last() const
const Point & GetOrigin() const
Definition: mapmod.cxx:170
#define VCL_DLLPRIVATE
Definition: dllapi.h:31
virtual void ModelIsMoving(SvTreeListEntry *pSource)
Definition: treelist.cxx:1115
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:408
short GetIndent() const
Link< svtree_render_args, void > aCustomRenderHdl
Definition: timer.hxx:26
long GetXOffset() const
virtual void ModelHasCleared()
Definition: treelist.cxx:1103
SvLBoxTabFlags
Definition: treelistbox.hxx:63
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1917
SvTreeFlags nTreeFlags
TriState
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uLong nPos)
Definition: treelist.cxx:1248
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1863
virtual void ModelHasMoved(SvTreeListEntry *pSource)
Definition: treelist.cxx:1120
virtual void ModelHasInserted(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1107
SvTreeListEntry * Prev(SvTreeListEntry *pEntry) const
SvTreeFlags GetTreeFlags() const
void SetQuickSearch(bool bEnable)
Link< SvTreeListBox *, void > aScrolledHdl
std::unique_ptr< SvInplaceEdit2 > pEdCtrl
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35