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