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 
111 
112  bool IsDynamic() const { return bool(nFlags & SvLBoxTabFlags::DYNAMIC); }
113  void SetPos( tools::Long nNewPos) { nPos = nNewPos; }
114  tools::Long GetPos() const { return nPos; }
115  tools::Long CalcOffset( tools::Long nItemLength, tools::Long nTabWidth );
116  bool IsEditable() const { return bool(nFlags & SvLBoxTabFlags::EDITABLE); }
117 };
118 
120 {
121 protected:
123 
124 public:
125  SvLBoxItem();
126  virtual ~SvLBoxItem();
127  virtual SvLBoxItemType GetType() const = 0;
128  virtual int CalcWidth(const SvTreeListBox* pView) const;
129  int GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
130  int GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos) const;
131  int GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
132  static int GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
133  void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
134 
135  virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0;
136 
137  virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry,
138  // If != 0: this Pointer must be used!
139  // If == 0: it needs to be retrieved via the View
140  SvViewDataItem* pViewData = nullptr) = 0;
141  // View-dependent data is not cloned
142  virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const = 0;
143 };
144 
145 enum class DragDropMode
146 {
147  NONE = 0x0000,
148  CTRL_MOVE = 0x0001,
149  APP_COPY = 0x0004,
150  // Entries may be dropped via the uppermost Entry
151  // The DropTarget is 0 in that case
152  ENABLE_TOP = 0x0010,
153  ALL = 0x0015,
154 };
155 namespace o3tl
156 {
157  template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0015> {};
158 }
159 
161 {
162  NONE = 0x0000,
163  IN_EDT = 0x0001,
164  EDT_ENABLED = 0x0002,
165  TARGEMPH_VIS = 0x0004,
166  EDTEND_CALLED = 0x0008,
167 };
168 namespace o3tl
169 {
170  template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
171 }
172 
174 
175 typedef std::pair<vcl::RenderContext&, const SvTreeListEntry&> svtree_measure_args;
176 typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&> svtree_render_args;
177 
179  :public Control
180  ,public SvListView
181  ,public DropTargetHelper
182  ,public DragSourceHelper
184 {
185  friend class SvImpLBox;
186  friend class SvLBoxString;
187  friend class IconViewImpl;
188  friend class TreeControlPeer;
189  friend class SalInstanceIconView;
190  friend class SalInstanceTreeView;
192 
193  std::unique_ptr<SvTreeListBoxImpl> mpImpl;
203 
208 
211  short nIndent;
212  short nFocusWidth;
213  sal_uInt16 nFirstSelTab;
214  sal_uInt16 nLastSelTab;
219  bool mbQuickSearch; // Enables type-ahead search in the check list box.
220  bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
221  bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
222  bool mbSelectingByHover; // true during "Select" if it was due to hover
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) const;
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  VCL_DLLPRIVATE void SetCollapsedNodeBmp( const Image& );
474  VCL_DLLPRIVATE void SetExpandedNodeBmp( const Image& );
475  VCL_DLLPRIVATE Image const & GetExpandedNodeBmp( ) const;
476 
477 protected:
478 
479  VCL_DLLPRIVATE void SetEntryHeight( SvTreeListEntry const * pEntry );
480  void AdjustEntryHeight( const Image& rBmp );
481  VCL_DLLPRIVATE void AdjustEntryHeight();
482 
483  VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
484  VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, tools::Long nLine, vcl::RenderContext& rRenderContext );
485 
486  VCL_DLLPRIVATE void InitTreeView();
487  VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, tools::Long nX, SvLBoxTab** ppTab );
488  VCL_DLLPRIVATE void ImplInitStyle();
489 
490  void SetupDragOrigin();
491  void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
492  const Selection& );
493  void EditedText(const OUString&);
494 
495  // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
496  // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
497  virtual void SetTabs();
498  void AddTab( tools::Long nPos, SvLBoxTabFlags nFlags );
499  sal_uInt16 TabCount() const { return aTabs.size(); }
500  SvLBoxTab* GetFirstDynamicTab() const;
501  SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
502  SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
503  void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
504  SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
505  void ClearTabList();
506 
507  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
508 
509  void NotifyScrolled();
510  void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
511  tools::Long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
512 
513  virtual void Command( const CommandEvent& rCEvt ) override;
514 
515  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
516  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
517 
518  void InitSettings();
519 
520  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
521 
522  void CallImplEventListeners(VclEventId nEvent, void* pData);
523 
524  void ImplEditEntry( SvTreeListEntry* pEntry );
525 
526  void AdjustEntryHeightAndRecalc();
527 
528  // true if rPos is over the SvTreeListBox body, i.e. not over a
529  // scrollbar
530  VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
531 public:
532 
533  void SetNoAutoCurEntry( bool b );
534 
535  void EnableCheckButton( SvLBoxButtonData* );
536  void SetCheckButtonData( SvLBoxButtonData* );
537 
541  static const Image& GetDefaultExpandedNodeImage( );
542 
546  static const Image& GetDefaultCollapsedNodeImage( );
547 
550  void SetNodeDefaultImages();
551 
552  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
553  bool bChildrenOnDemand = false,
554  sal_uInt32 nPos=TREELIST_APPEND, void* pUserData = nullptr);
555 
556  const Image& GetDefaultExpandedEntryBmp( ) const;
557  const Image& GetDefaultCollapsedEntryBmp( ) const;
558 
559  void SetDefaultExpandedEntryBmp( const Image& rBmp );
560  void SetDefaultCollapsedEntryBmp( const Image& rBmp );
561 
562  void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
563  SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
564 
565  static bool HasEntryText(const SvTreeListEntry* pEntry);
566 
567  void SetEntryText(SvTreeListEntry*, const OUString& );
568  void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
569  void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
570 
571  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
572  static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
573  static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
574 
575  void CheckButtonHdl();
576 
577  void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
578 
579  void EnableInplaceEditing( bool bEnable );
580  // Edits the Entry's first StringItem, 0 == Cursor
581  void EditEntry( SvTreeListEntry* pEntry );
582  virtual bool EditingEntry( SvTreeListEntry* pEntry );
583  virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
584 
585  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
586  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
587  virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
588  virtual void MouseMove( const MouseEvent& rMEvt ) override;
589  virtual void KeyInput( const KeyEvent& rKEvt ) override;
590  virtual void Resize() override;
591  virtual void GetFocus() override;
592  virtual void LoseFocus() override;
593  void SetUpdateMode( bool );
594 
595  virtual void ModelHasCleared() override;
596  virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
597  virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
598  virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
599  virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
600  virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
601  virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
602  void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
603 
604  void ScrollOutputArea( short nDeltaEntries );
605 
606  short GetColumnsCount() const { return nColumns; }
607  short GetEntryHeight() const { return nEntryHeight; }
608  void SetEntryHeight( short nHeight );
609  short GetEntryWidth() const { return nEntryWidth; }
610  void SetEntryWidth( short nWidth );
611  Size GetOutputSizePixel() const;
612  short GetIndent() const { return nIndent; }
613  void SetSpaceBetweenEntries( short nSpace );
614  Point GetEntryPosition(const SvTreeListEntry*) const;
615  void MakeVisible( SvTreeListEntry* pEntry );
616  void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
617 
618  void SetFont( const vcl::Font& rFont );
619 
620  SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
621 
622  virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long nLine );
623  // Respects indentation
624  sal_IntPtr GetTabPos(const SvTreeListEntry*, const SvLBoxTab*) const;
625  void InvalidateEntry( SvTreeListEntry* );
628  std::pair<tools::Long, tools::Long> GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx);
629 
630  void SetDragDropMode( DragDropMode );
631  void SetSelectionMode( SelectionMode );
632 
633  bool Expand( SvTreeListEntry* pParent );
634  bool Collapse( SvTreeListEntry* pParent );
635  bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
636  sal_uInt32 SelectChildren( SvTreeListEntry* pParent, bool bSelect );
637  void SelectAll( bool bSelect );
638 
639  void SetCurEntry( SvTreeListEntry* _pEntry );
640  SvTreeListEntry* GetCurEntry() const;
641 
642  using Window::Invalidate;
643  virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
644  virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
645 
646  void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
647 
648  sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
649 
650  DECL_DLLPRIVATE_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
651  virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
652  SvTreeListEntry* pEntry2, sal_uInt32 nPos ) override;
653 
654  SvTreeListEntry* GetFirstEntryInView() const;
655  SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
656  void ScrollToAbsPos( tools::Long nPos );
657 
658  tools::Long getPreferredDimensions(std::vector<tools::Long> &rWidths) const;
659 
660  virtual Size GetOptimalSize() const override;
661 
662  void SetAlternatingRowColors( const bool bEnable );
663 
664  // Enables type-ahead search in the check list box.
665  void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
666 
667  // Make single click "activate" a row like a double-click normally does
668  void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
669  bool GetActivateOnSingleClick() const { return mbActivateOnSingleClick; }
670 
671  // Make mouse over a row "select" a row like a single-click normally does
672  void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
673  bool GetHoverSelection() const { return mbHoverSelection; }
674 
675  // only true during Select if the Select is due to a Hover
676  bool IsSelectDueToHover() const { return mbSelectingByHover; }
677 
678  // Set when clicks toggle the checkbox of the row.
679  void SetClicksToToggle(sal_Int8 nCount) { mnClicksToToggle = nCount; }
680 
681  void SetForceMakeVisible(bool bEnable);
682 
683  virtual FactoryFunction GetUITestFactory() const override;
684 
685  void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
686 
687  virtual void EnableRTL(bool bEnable = true) override;
688 };
689 
690 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Link< svtree_measure_args, Size > aCustomMeasureHdl
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:65
virtual void ModelHasEntryInvalidated(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1131
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3940
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:420
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:256
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:1244
SelectionMode GetSelectionMode() const
short GetColumnsCount() const
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: ctrl.cxx:413
View-dependent data for a tree list entry created in the virtual function SvTreeListBox::CreateViewDa...
virtual void MouseButtonUp(const MouseEvent &rMEvt)
Definition: mouse.cxx:427
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:1107
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:290
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:1293
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
DragDropMode nDragDropMode
bool IsEditable() const
void Clear()
Definition: treelist.cxx:1083
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: transfer2.cxx:284
tools::Long GetXOffset() const
const MapMode & GetMapMode() const
Definition: window3.cxx:99
bool mbActivateOnSingleClick
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:673
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2972
Link< SvTreeListBox *, void > aExpandedHdl
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:175
std::unique_ptr< SvImpLBox > pImpl
virtual void ModelHasRemoved(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1124
bool mbSelectingByHover
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:58
Image aPrevInsertedColBmp
void SetCustomRenderHdl(const Link< svtree_render_args, void > &rLink)
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1468
DragDropMode GetDragDropMode() const
virtual void LoseFocus()
Definition: window.cxx:1857
void SetTooltipHdl(const Link< const HelpEvent &, bool > &rLink)
vcl::Window * GetParent() const
Definition: window2.cxx:1120
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:1807
void SetClicksToToggle(sal_Int8 nCount)
virtual Size GetOptimalSize() const override
Definition: ctrl.cxx:369
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:1120
void SetActivateOnSingleClick(bool bEnable)
SvTreeListEntry * pEdEntry
Definition: ctrl.hxx:81
short nEntryHeightOffs
virtual void GetFocus()
Definition: window.cxx:1843
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
bool IsSelectDueToHover() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
SvTreeListEntry * Last() const
const Point & GetOrigin() const
Definition: mapmod.cxx:152
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:1111
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
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:1099
SvLBoxTabFlags
Definition: treelistbox.hxx:62
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1925
SvTreeFlags nTreeFlags
TriState
tools::Long CalcOffset(tools::Long nItemLength, tools::Long nTabWidth)
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1871
virtual void ModelHasMoved(SvTreeListEntry *pSource)
Definition: treelist.cxx:1116
virtual void ModelHasInserted(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1103
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)