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 #ifndef INCLUDED_VCL_TREELISTBOX_HXX
21 #define INCLUDED_VCL_TREELISTBOX_HXX
22 
23 #include <vcl/dllapi.h>
24 
25 #include <deque>
26 #include <memory>
27 #include <vector>
28 
29 #include <vcl/ctrl.hxx>
30 #include <vcl/accel.hxx>
31 #include <vcl/mnemonicengine.hxx>
33 #include <vcl/image.hxx>
34 #include <tools/gen.hxx>
35 #include <tools/contnr.hxx>
36 #include <vcl/treelist.hxx>
37 #include <vcl/transfer.hxx>
38 #include <vcl/idle.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  CTRL_COPY = 0x0002,
152  APP_COPY = 0x0004,
153  // Entries may be dropped via the uppermost Entry
154  // The DropTarget is 0 in that case
155  ENABLE_TOP = 0x0010,
156  ALL = 0x0017,
157 };
158 namespace o3tl
159 {
160  template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0017> {};
161 }
162 
164 {
165  NONE = 0x0000,
166  IN_EDT = 0x0001,
167  EDT_ENABLED = 0x0002,
168  TARGEMPH_VIS = 0x0004,
169  EDTEND_CALLED = 0x0008,
170 };
171 namespace o3tl
172 {
173  template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
174 }
175 
177 
178 typedef std::pair<vcl::RenderContext&, const SvTreeListEntry&> svtree_measure_args;
179 typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&> svtree_render_args;
180 
182  :public Control
183  ,public SvListView
184  ,public DropTargetHelper
185  ,public DragSourceHelper
188 {
189  friend class SvImpLBox;
190  friend class SvLBoxString;
191  friend class IconViewImpl;
192  friend class TreeControlPeer;
193  friend class SalInstanceIconView;
194  friend class SalInstanceTreeView;
196 
197  std::unique_ptr<SvTreeListBoxImpl> mpImpl;
207 
212 
215  short nIndent;
216  short nFocusWidth;
217  sal_uInt16 nFirstSelTab;
218  sal_uInt16 nLastSelTab;
223  bool mbQuickSearch; // Enables type-ahead search in the check list box.
224  bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
225  bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
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 
280  void UnsetDropTarget();
281 
282 protected:
283 
284  bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
285  void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
286  void EnableSelectionAsDropTarget( bool bEnable = true );
287  // Standard impl returns 0; derived classes which support D'n'D must override
288  using Window::GetDropTarget;
289  virtual SvTreeListEntry* GetDropTarget( const Point& );
290 
291  // Invalidate children on enable/disable
292  virtual void StateChanged( StateChangedType eType ) override;
293 
294  virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND);
295  virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND );
296 
297  // In-place editing
298  std::unique_ptr<SvInplaceEdit2> pEdCtrl;
299  void EditText( const OUString&, const tools::Rectangle&,const Selection&);
300  void CancelTextEditing();
301  bool EditingCanceled() const;
302 
303  // InitViewData is called right after CreateViewData
304  // The Entry is has not yet been added to the View in InitViewData!
305  virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
306  // Calls InitViewData for all Items
307  void RecalcViewData();
308 
309  // Handler and methods for Drag - finished handler. This link can be set
310  // to the TransferDataContainer. The AddBox/RemoveBox methods must be
311  // called before the StartDrag call.
312  // The Remove will be called from the handler, which then calls DragFinish.
313  // The Remove is also called in the DTOR of the SvTreeListBox -
314  // so it can't be called for a deleted object.
315  Link<sal_Int8,void> GetDragFinishedHdl() const;
316 
317  // For asynchronous D'n'D
318  sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
319 
320  void OnCurrentEntryChanged();
321 
322  // IMnemonicEntryList
323  virtual const void* FirstSearchEntry( OUString& _rEntryText ) const override;
324  virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, OUString& _rEntryText ) const override;
325  virtual void SelectSearchEntry( const void* _pEntry ) override;
326  virtual void ExecuteSearchEntry( const void* _pEntry ) const override;
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  SvTreeListEntry* GetRootLevelParent(SvTreeListEntry* pEntry ) const;
388 
389  using Window::GetChildCount;
390  sal_uLong GetChildCount( SvTreeListEntry const * pParent ) const;
391  sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
392 
393  SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
394  SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
395  const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
396 
397  bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
398  bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
399  void EndEditing( bool bCancel = false );
400 
401  void Clear();
402 
415  void EnableEntryMnemonics();
416  bool IsEntryMnemonicsEnabled() const;
417 
418  bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
419 
437  bool HandleKeyInput( const KeyEvent& rKEvt );
438 
439  void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
440  void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
441  void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
442  void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
443  void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
444  void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
445  void SetTooltipHdl(const Link<const HelpEvent&, bool>& rLink) { aTooltipHdl = rLink; }
446  void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { aCustomRenderHdl = rLink; }
447  void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { aCustomMeasureHdl = rLink; }
448 
449  void ExpandedHdl();
450  bool ExpandingHdl();
451  virtual void SelectHdl();
452  virtual void DeselectHdl();
453  virtual bool DoubleClickHdl();
454  SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
455 
456  // Is called for an Entry that gets expanded with the Flag
457  // ENTRYFLAG_CHILDREN_ON_DEMAND set.
458  virtual void RequestingChildren( SvTreeListEntry* pParent );
459 
460  // Drag & Drop
461  // New D'n'D API
462  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
463  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
464  virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
465  virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData,
466  SvTreeListEntry* );
467  virtual void DragFinished( sal_Int8 nDropAction );
468 
469  SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
470 
471  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
472  TriState NotifyMoving(
473  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
474  SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
475  SvTreeListEntry*& rpNewParent, // New TargetParent
476  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
477 
478  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
479  TriState NotifyCopying(
480  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
481  SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
482  SvTreeListEntry*& rpNewParent, // New TargetParent
483  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
484 
485  // ACCESSIBILITY ==========================================================
486 
488  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
489 
491  void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const;
492 
497  tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry);
498 
499  SvTreeFlags GetTreeFlags() const {return nTreeFlags;}
500 
501  static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry);
502 
503  void set_min_width_in_chars(sal_Int32 nChars);
504 
505  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
506 
507 protected:
508 
509  VCL_DLLPRIVATE void SetEntryHeight( SvTreeListEntry const * pEntry );
510  void AdjustEntryHeight( const Image& rBmp );
511  VCL_DLLPRIVATE void AdjustEntryHeight();
512 
513  VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
514  VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, long nLine, vcl::RenderContext& rRenderContext );
515 
516  VCL_DLLPRIVATE void InitTreeView();
517  VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, long nX, SvLBoxTab** ppTab );
518  VCL_DLLPRIVATE void ImplInitStyle();
519 
520  void SetupDragOrigin();
521  void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
522  const Selection& );
523  void EditedText(const OUString&);
524 
525  // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
526  // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
527  virtual void SetTabs();
528  void AddTab( long nPos, SvLBoxTabFlags nFlags );
529  sal_uInt16 TabCount() const { return aTabs.size(); }
530  SvLBoxTab* GetFirstDynamicTab() const;
531  SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
532  SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
533  void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
534  SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
535  void ClearTabList();
536 
537  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
538 
539  virtual void NotifyEndScroll();
540  virtual void NotifyScrolled();
541  void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
542  long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
543 
544  virtual void Command( const CommandEvent& rCEvt ) override;
545 
546  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
547  virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry);
548  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
549 
550  void InitSettings();
551 
552  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
553 
554  void CallImplEventListeners(VclEventId nEvent, void* pData);
555 
556  void ImplEditEntry( SvTreeListEntry* pEntry );
557 
558  void AdjustEntryHeightAndRecalc();
559 
560  // true if rPos is over the SvTreeListBox body, i.e. not over a
561  // scrollbar
562  VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
563 public:
564 
565  void SetNoAutoCurEntry( bool b );
566 
567  void EnableCheckButton( SvLBoxButtonData* );
568  void SetCheckButtonData( SvLBoxButtonData* );
569  void SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp );
570 
574  static const Image& GetDefaultExpandedNodeImage( );
575 
579  static const Image& GetDefaultCollapsedNodeImage( );
580 
584  {
585  SetNodeBitmaps(
586  GetDefaultCollapsedNodeImage( ),
587  GetDefaultExpandedNodeImage( )
588  );
589  }
590 
591  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
592  bool bChildrenOnDemand = false,
593  sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr);
594 
595  virtual SvTreeListEntry* InsertEntry( const OUString& rText,
596  const Image& rExpandedEntryBmp,
597  const Image& rCollapsedEntryBmp,
598  SvTreeListEntry* pParent = nullptr,
599  bool bChildrenOnDemand = false,
600  sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr );
601 
602  const Image& GetDefaultExpandedEntryBmp( ) const;
603  const Image& GetDefaultCollapsedEntryBmp( ) const;
604 
605  void SetDefaultExpandedEntryBmp( const Image& rBmp );
606  void SetDefaultCollapsedEntryBmp( const Image& rBmp );
607 
608  void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
609  SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
610 
611  void SetEntryText(SvTreeListEntry*, const OUString& );
612  void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
613  void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
614 
615  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
616  static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
617  static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
618 
619  virtual void CheckButtonHdl();
620 
621  void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
622 
623  void EnableInplaceEditing( bool bEnable );
624  // Edits the Entry's first StringItem, 0 == Cursor
625  void EditEntry( SvTreeListEntry* pEntry );
626  virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& );
627  virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
628 
629  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
630  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
631  virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
632  virtual void MouseMove( const MouseEvent& rMEvt ) override;
633  virtual void KeyInput( const KeyEvent& rKEvt ) override;
634  virtual void Resize() override;
635  virtual void GetFocus() override;
636  virtual void LoseFocus() override;
637  void SetUpdateMode( bool );
638 
639  virtual void ModelHasCleared() override;
640  virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
641  virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
642  virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
643  virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
644  virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
645  virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
646  void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
647 
648  void ScrollOutputArea( short nDeltaEntries );
649 
650  short GetColumnsCount() const { return nColumns; }
651  short GetEntryHeight() const { return nEntryHeight; }
652  void SetEntryHeight( short nHeight );
653  short GetEntryWidth() const { return nEntryWidth; }
654  void SetEntryWidth( short nWidth );
655  Size GetOutputSizePixel() const;
656  short GetIndent() const { return nIndent; }
657  void SetSpaceBetweenEntries( short nSpace );
658  Point GetEntryPosition(const SvTreeListEntry*) const;
659  void MakeVisible( SvTreeListEntry* pEntry );
660  void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
661 
662  void SetCollapsedNodeBmp( const Image& );
663  void SetExpandedNodeBmp( const Image& );
664  Image const & GetExpandedNodeBmp( ) const;
665 
666  void SetFont( const vcl::Font& rFont );
667 
668  using Window::SetCursor;
669  void SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect = false );
670 
671  SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
672 
673  virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, long nLine );
674  // Respects indentation
675  sal_IntPtr GetTabPos(const SvTreeListEntry*, SvLBoxTab*);
676  void InvalidateEntry( SvTreeListEntry* );
677  SvLBoxItem* GetItem( SvTreeListEntry*, long nX, SvLBoxTab** ppTab);
678  SvLBoxItem* GetItem( SvTreeListEntry*, long nX );
679 
680  void SetDragDropMode( DragDropMode );
681  void SetSelectionMode( SelectionMode );
682 
683  bool Expand( SvTreeListEntry* pParent );
684  bool Collapse( SvTreeListEntry* pParent );
685  virtual bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
686  sal_uLong SelectChildren( SvTreeListEntry* pParent, bool bSelect );
687  void SelectAll( bool bSelect );
688 
689  void SetCurEntry( SvTreeListEntry* _pEntry );
690  SvTreeListEntry* GetCurEntry() const;
691 
692  using Window::Invalidate;
693  virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
694  virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
695 
696  void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
697 
698  sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
699 
700  DECL_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
701  virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
702  SvTreeListEntry* pEntry2, sal_uLong nPos ) override;
703 
704  void EndSelection();
705 
706  SvTreeListEntry* GetFirstEntryInView() const;
707  SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
708  void ScrollToAbsPos( long nPos );
709 
710  void ShowFocusRect( const SvTreeListEntry* pEntry );
711 
712  virtual VclPtr<PopupMenu> CreateContextMenu();
713 
714  void EnableContextMenuHandling();
715 
716  long getPreferredDimensions(std::vector<long> &rWidths) const;
717 
718  virtual Size GetOptimalSize() const override;
719 
720  void SetAlternatingRowColors( const bool bEnable );
721 
722  // Enables type-ahead search in the check list box.
723  void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
724 
725  // Make single click "activate" a row like a double-click normally does
726  void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
727 
728  // Make mouse over a row "select" a row like a single-click normally does
729  void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
730  bool GetHoverSelection() const { return mbHoverSelection; }
731 
732  void SetForceMakeVisible(bool bEnable);
733 
734  virtual FactoryFunction GetUITestFactory() const override;
735 
736  void SetDragHelper(rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
737 };
738 
739 #endif
740 
741 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Link< svtree_measure_args, Size > aCustomMeasureHdl
virtual void ModelHasEntryInvalidated(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1166
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3914
void SetDeselectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
SvListAction
Definition: treelist.hxx:32
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:1679
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:310
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:1142
Link< SvTreeListBox *, bool > aDoubleClickHdl
VclEventId
Definition: vclevent.hxx:39
Image aCurInsertedExpBmp
const void * StringEntryIdentifier
virtual void SelectSearchEntry(const void *_pEntry)=0
"selects" a given entry.
void SetSelectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
Definition: edit.hxx:56
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
callback for a MnemonicEngine
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:1327
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
DragDropMode nDragDropMode
bool IsEditable() const
void Clear()
Definition: treelist.cxx:1118
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:658
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2998
Link< SvTreeListBox *, void > aExpandedHdl
virtual void ExecuteSearchEntry(const void *_pEntry) const =0
"executes" the current search entry, i.e.
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:1159
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:1851
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:1801
virtual Size GetOptimalSize() const override
Definition: ctrl.cxx:374
SvTreeListEntry * First() const
bool IsInplaceEditingEnabled() const
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1012
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:1155
void SetActivateOnSingleClick(bool bEnable)
SvTreeListEntry * pEdEntry
Definition: ctrl.hxx:33
short nEntryHeightOffs
virtual const void * NextSearchEntry(const void *_pCurrentSearchEntry, OUString &_rEntryText) const =0
returns the next list entry for the mnemonic search
virtual void GetFocus()
Definition: window.cxx:1837
unsigned char sal_uInt8
sal_uInt16 nFirstSelTab
void SetCursor(vcl::Cursor *pCursor)
Definition: window.cxx:3044
void SetFont(const vcl::Font &rNewFont)
sal_Int8 mnDragAction
Definition: image.hxx:40
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:1146
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:1134
SvLBoxTabFlags
Definition: treelistbox.hxx:63
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1919
SvTreeFlags nTreeFlags
TriState
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uLong nPos)
Definition: treelist.cxx:1279
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1865
virtual const void * FirstSearchEntry(OUString &_rEntryText) const =0
returns the first list entry for the mnemonic search
virtual void ModelHasMoved(SvTreeListEntry *pSource)
Definition: treelist.cxx:1151
virtual void ModelHasInserted(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1138
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