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_MOVE = 0x0004,
153  APP_COPY = 0x0008,
154  APP_DROP = 0x0010,
155  // Entries may be dropped via the uppermost Entry
156  // The DropTarget is 0 in that case
157  ENABLE_TOP = 0x0020,
158  ALL = 0x003f,
159 };
160 namespace o3tl
161 {
162  template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x003f> {};
163 }
164 
166 {
167  NONE = 0x0000,
168  IN_EDT = 0x0001,
169  EDT_ENABLED = 0x0002,
170  TARGEMPH_VIS = 0x0004,
171  EDTEND_CALLED = 0x0008,
172 };
173 namespace o3tl
174 {
175  template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
176 }
177 
178 struct SvTreeListBoxImpl;
179 
181  :public Control
182  ,public SvListView
183  ,public DropTargetHelper
184  ,public DragSourceHelper
187 {
188  friend class SvImpLBox;
189  friend class IconViewImpl;
190  friend class TreeControlPeer;
191  friend class SalInstanceTreeView;
193 
194  std::unique_ptr<SvTreeListBoxImpl> mpImpl;
202 
207 
210  short nIndent;
211  short nFocusWidth;
212  sal_uInt16 nFirstSelTab;
213  sal_uInt16 nLastSelTab;
218  bool mbQuickSearch; // Enables type-ahead search in the check list box.
219 
221 
226  sal_Int32 nMinWidthInChars;
227 
230 
231 protected:
232  std::unique_ptr<SvImpLBox> pImpl;
233  short nColumns;
235  short nEntryWidth;
237 
241  std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
244  // Move/CopySelection: Position of the current Entry in SelectionList
245  sal_uInt16 nCurEntrySelPos;
246 
247 private:
248  DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
249  DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void );
250  // Handler that is called by TreeList to clone an Entry
252 
253  // Handler and methods for Drag - finished handler.
254  // The Handle retrieved by GetDragFinishedHdl can be set on the
255  // TransferDataContainer. This link is a callback for the DragFinished
256  // call. The AddBox method is called from the GetDragFinishedHdl() and the
257  // remove is called in the link callback and in the dtor. So it can't be
258  // called for a deleted object.
259  VCL_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
260  VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
261  DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
262 
263  // after a checkbox entry is inserted, use this to get its width to support
264  // autowidth for the 1st checkbox column
265  VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
266 
267 protected:
268 
269  bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
270  void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
271  void EnableSelectionAsDropTarget( bool bEnable = true );
272  // Standard impl returns 0; derived classes which support D'n'D must override
273  using Window::GetDropTarget;
274  virtual SvTreeListEntry* GetDropTarget( const Point& );
275 
276  // Invalidate children on enable/disable
277  virtual void StateChanged( StateChangedType eType ) override;
278 
279  virtual sal_uLong Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uLong nPos=TREELIST_APPEND);
280  virtual sal_uLong Insert( SvTreeListEntry* pEntry,sal_uLong nRootPos = TREELIST_APPEND );
281 
282  // In-place editing
283  std::unique_ptr<SvInplaceEdit2> pEdCtrl;
284  void EditText( const OUString&, const tools::Rectangle&,const Selection&);
285  void CancelTextEditing();
286  bool EditingCanceled() const;
287 
288  // InitViewData is called right after CreateViewData
289  // The Entry is has not yet been added to the View in InitViewData!
290  virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
291  // Calls InitViewData for all Items
292  void RecalcViewData();
293 
294  // Handler and methods for Drag - finished handler. This link can be set
295  // to the TransferDataContainer. The AddBox/RemoveBox methods must be
296  // called before the StartDrag call.
297  // The Remove will be called from the handler, which then calls DragFinish.
298  // The Remove is also called in the DTOR of the SvTreeListBox -
299  // so it can't be called for a deleted object.
300  Link<sal_Int8,void> GetDragFinishedHdl() const;
301 
302  // For asynchronous D'n'D
303  sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
304 
305  void OnCurrentEntryChanged();
306 
307  // IMnemonicEntryList
308  virtual const void* FirstSearchEntry( OUString& _rEntryText ) const override;
309  virtual const void* NextSearchEntry( const void* _pCurrentSearchEntry, OUString& _rEntryText ) const override;
310  virtual void SelectSearchEntry( const void* _pEntry ) override;
311  virtual void ExecuteSearchEntry( const void* _pEntry ) const override;
312 
313  // ISearchableStringList
314  virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
315  virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
316  virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
317 
318 public:
319 
320  SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
321  virtual ~SvTreeListBox() override;
322  virtual void dispose() override;
323 
325  {
326  return pModel.get();
327  }
328 
330  {
331  return pModel ? pModel->GetEntryCount() : 0;
332  }
334  {
335  return pModel ? pModel->First() : nullptr;
336  }
338  {
339  return pModel->Next(pEntry);
340  }
342  {
343  return pModel->Prev(pEntry);
344  }
346  {
347  return pModel ? pModel->Last() : nullptr;
348  }
349 
350  SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
351 
352  bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
353  bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback );
354  void RemoveSelection();
358  void RemoveEntry(SvTreeListEntry const * pEntry);
359 
360  DragDropMode GetDragDropMode() const { return nDragDropMode; }
361  SelectionMode GetSelectionMode() const { return eSelMode; }
362 
363  // pParent == 0 -> Root level
364  SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uLong nPos ) const;
365  SvTreeListEntry* GetEntry( sal_uLong nRootPos ) const;
366 
367  SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
368  void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
369 
370  using Window::GetParent;
371  const SvTreeListEntry* GetParent( const SvTreeListEntry* pEntry ) const;
372  SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
373  SvTreeListEntry* GetRootLevelParent(SvTreeListEntry* pEntry ) const;
374 
375  using Window::GetChildCount;
376  sal_uLong GetChildCount( SvTreeListEntry const * pParent ) const;
377  sal_uLong GetLevelChildCount( SvTreeListEntry* pParent ) const;
378 
379  SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
380  SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
381  const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
382 
383  bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
384  bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
385  void EndEditing( bool bCancel = false );
386  void ForbidEmptyText();
387 
388  void Clear();
389 
402  void EnableEntryMnemonics();
403  bool IsEntryMnemonicsEnabled() const;
404 
405  bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
406 
424  bool HandleKeyInput( const KeyEvent& rKEvt );
425 
426  void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
427  void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
428  void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
429  const Link<SvTreeListBox*,bool>& GetDoubleClickHdl() const { return aDoubleClickHdl; }
430  void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
431  void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
432  void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
433 
434  virtual void ExpandedHdl();
435  virtual bool ExpandingHdl();
436  virtual void SelectHdl();
437  virtual void DeselectHdl();
438  virtual bool DoubleClickHdl();
439  SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
440 
441  // Is called for an Entry that gets expanded with the Flag
442  // ENTRYFLAG_CHILDREN_ON_DEMAND set.
443  virtual void RequestingChildren( SvTreeListEntry* pParent );
444 
445  // Drag & Drop
446  // New D'n'D API
447  virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
448  virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
449  virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
450  virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData,
451  SvTreeListEntry* );
452  virtual void DragFinished( sal_Int8 nDropAction );
453  virtual bool NotifyAcceptDrop( SvTreeListEntry* );
454 
455  virtual SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
456 
457  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
458  virtual TriState NotifyMoving(
459  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
460  SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
461  SvTreeListEntry*& rpNewParent, // New TargetParent
462  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
463 
464  // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
465  virtual TriState NotifyCopying(
466  SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
467  SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
468  SvTreeListEntry*& rpNewParent, // New TargetParent
469  sal_uLong& rNewChildPos); // The TargetParent's position in Childlist
470 
471  // ACCESSIBILITY ==========================================================
472 
474  virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
475 
477  void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl::AccessibleStateSetHelper& rStateSet ) const;
478 
483  tools::Rectangle GetBoundingRect( SvTreeListEntry* pEntry );
484 
486  void EnableCellFocus();
487 
488  SvTreeFlags GetTreeFlags() const {return nTreeFlags;}
489 
490  static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry);
491  virtual OUString GetEntryAltText(SvTreeListEntry* pEntry) const;
492  virtual OUString GetEntryLongDescription(SvTreeListEntry* pEntry) const;
493 
494  void set_min_width_in_chars(sal_Int32 nChars);
495 
496  virtual bool set_property(const OString &rKey, const OUString &rValue) override;
497 
498 protected:
499 
500  VCL_DLLPRIVATE void SetEntryHeight( SvTreeListEntry const * pEntry );
501  void AdjustEntryHeight( const Image& rBmp );
502  VCL_DLLPRIVATE void AdjustEntryHeight();
503 
504  VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
505  VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, long nLine, vcl::RenderContext& rRenderContext );
506 
507  VCL_DLLPRIVATE void InitTreeView();
508  VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, long nX, SvLBoxTab** ppTab );
509  VCL_DLLPRIVATE void ImplInitStyle();
510 
511  void SetupDragOrigin();
512  void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
513  const Selection& );
514  void EditedText(const OUString&);
515 
516  // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
517  // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
518  virtual void SetTabs();
519  void AddTab( long nPos, SvLBoxTabFlags nFlags );
520  sal_uInt16 TabCount() const { return aTabs.size(); }
521  SvLBoxTab* GetFirstDynamicTab() const;
522  SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
523  SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
524  void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
525  SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
526  void ClearTabList();
527 
528  virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
529 
530  virtual void NotifyEndScroll();
531  virtual void NotifyScrolled();
532  void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
533  long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
534 
535  virtual void Command( const CommandEvent& rCEvt ) override;
536 
537  virtual void RequestHelp( const HelpEvent& rHEvt ) override;
538  virtual void PreparePaint(vcl::RenderContext& rRenderContext, SvTreeListEntry& rEntry);
539  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
540 
541  void InitSettings();
542 
543  virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
544 
545  bool IsCellFocusEnabled() const;
546  bool SetCurrentTabPos( sal_uInt16 _nNewPos );
547  sal_uInt16 GetCurrentTabPos() const;
548  void CallImplEventListeners(VclEventId nEvent, void* pData);
549 
550  void ImplEditEntry( SvTreeListEntry* pEntry );
551 
552  bool AreChildrenTransient() const;
553  void SetChildrenNotTransient();
554 
555  void AdjustEntryHeightAndRecalc();
556 public:
557 
558  void SetNoAutoCurEntry( bool b );
559 
560  void EnableCheckButton( SvLBoxButtonData* );
561  void SetCheckButtonData( SvLBoxButtonData* );
562  void SetNodeBitmaps( const Image& rCollapsedNodeBmp, const Image& rExpandedNodeBmp );
563 
567  static const Image& GetDefaultExpandedNodeImage( );
568 
572  static const Image& GetDefaultCollapsedNodeImage( );
573 
577  {
578  SetNodeBitmaps(
579  GetDefaultCollapsedNodeImage( ),
580  GetDefaultExpandedNodeImage( )
581  );
582  }
583 
584  virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
585  bool bChildrenOnDemand = false,
586  sal_uLong nPos=TREELIST_APPEND, void* pUserData = nullptr);
587 
588  virtual SvTreeListEntry* InsertEntry( const OUString& rText,
589  const Image& rExpandedEntryBmp,
590  const Image& rCollapsedEntryBmp,
591  SvTreeListEntry* pParent = nullptr,
592  bool bChildrenOnDemand = false,
593  sal_uLong nPos = TREELIST_APPEND, void* pUserData = nullptr );
594 
595  const Image& GetDefaultExpandedEntryBmp( ) const;
596  const Image& GetDefaultCollapsedEntryBmp( ) const;
597 
598  void SetDefaultExpandedEntryBmp( const Image& rBmp );
599  void SetDefaultCollapsedEntryBmp( const Image& rBmp );
600 
601  void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
602  SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
603 
604  void SetEntryText(SvTreeListEntry*, const OUString& );
605  void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
606  void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
607 
608  virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
609  static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
610  static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
611 
612  void SetCheckButtonHdl( const Link<SvTreeListBox*,void>& rLink ) { aCheckButtonHdl=rLink; }
613  virtual void CheckButtonHdl();
614 
615  void SetSublistOpenWithReturn(); // open/close sublist with return/enter
616  void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
617  void SetSublistDontOpenWithDoubleClick( bool bDontOpen ); // set mouse double click open/close sublist behavior
618 
619  void EnableInplaceEditing( bool bEnable );
620  // Edits the Entry's first StringItem, 0 == Cursor
621  void EditEntry( SvTreeListEntry* pEntry );
622  virtual bool EditingEntry( SvTreeListEntry* pEntry, Selection& );
623  virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
624 
625  virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
626  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
627  virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
628  virtual void MouseMove( const MouseEvent& rMEvt ) override;
629  virtual void KeyInput( const KeyEvent& rKEvt ) override;
630  virtual void Resize() override;
631  virtual void GetFocus() override;
632  virtual void LoseFocus() override;
633  void SetUpdateMode( bool );
634 
635  virtual void ModelHasCleared() override;
636  virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
637  virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
638  virtual void ModelIsMoving(SvTreeListEntry* pSource,
639  SvTreeListEntry* pTargetParent, sal_uLong nChildPos ) override;
640  virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
641  virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
642  virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
643  void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
644 
645  void ScrollOutputArea( short nDeltaEntries );
646 
647  short GetColumnsCount() const { return nColumns; }
648  short GetEntryHeight() const { return nEntryHeight; }
649  void SetEntryHeight( short nHeight, bool bForce = false );
650  short GetEntryWidth() const { return nEntryWidth; }
651  void SetEntryWidth( short nWidth );
652  Size GetOutputSizePixel() const;
653  short GetIndent() const { return nIndent; }
654  void SetIndent( short nIndent );
655  // Place the expander checkitem at the optimal indent for hierarchical lists
656  void SetOptimalImageIndent() { SetIndent(12); }
657  void SetSpaceBetweenEntries( short nSpace );
658  short GetSpaceBetweenEntries() const {return nEntryHeightOffs;}
659  Point GetEntryPosition( SvTreeListEntry* ) const;
660  void MakeVisible( SvTreeListEntry* pEntry );
661  void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
662 
663  void SetCollapsedNodeBmp( const Image& );
664  void SetExpandedNodeBmp( const Image& );
665  Image const & GetExpandedNodeBmp( ) const;
666 
667  void SetFont( const vcl::Font& rFont );
668 
669  using Window::SetCursor;
670  void SetCursor( SvTreeListEntry* pEntry, bool bForceNoSelect = false );
671 
672  SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
673 
674  virtual tools::Rectangle GetFocusRect( SvTreeListEntry*, long nLine );
675  // Respects indentation
676  virtual sal_IntPtr GetTabPos( SvTreeListEntry*, SvLBoxTab* );
677  void InvalidateEntry( SvTreeListEntry* );
678  SvLBoxItem* GetItem( SvTreeListEntry*, long nX, SvLBoxTab** ppTab);
679  SvLBoxItem* GetItem( SvTreeListEntry*, long nX );
680 
681  void SetDragDropMode( DragDropMode );
682  void SetSelectionMode( SelectionMode );
683 
684  virtual bool Expand( SvTreeListEntry* pParent );
685  virtual bool Collapse( SvTreeListEntry* pParent );
686  virtual bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
687  sal_uLong SelectChildren( SvTreeListEntry* pParent, bool bSelect );
688  void SelectAll( bool bSelect, bool bPaint = true );
689 
690  void SetCurEntry( SvTreeListEntry* _pEntry );
691  SvTreeListEntry* GetCurEntry() const;
692 
693  using Window::Invalidate;
694  virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
695  virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
696 
697  void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
698 
699  // A Parent's Children are turned into Children of the Parent which comes next in hierarchy
700  void RemoveParentKeepChildren( SvTreeListEntry* pParent );
701 
702  sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
703 
704  DECL_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
705  virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
706  SvTreeListEntry* pEntry2, sal_uLong nPos ) override;
707 
708  void EndSelection();
709  ScrollBar* GetVScroll();
710  ScrollBar* GetHScroll();
711  void EnableAsyncDrag( bool b );
712 
713  SvTreeListEntry* GetFirstEntryInView() const;
714  SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
715  SvTreeListEntry* GetPrevEntryInView(SvTreeListEntry*) const;
716  SvTreeListEntry* GetLastEntryInView() const;
717  void ScrollToAbsPos( long nPos );
718 
719  void ShowFocusRect( const SvTreeListEntry* pEntry );
720  void InitStartEntry();
721 
722  virtual VclPtr<PopupMenu> CreateContextMenu();
723  virtual void ExecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry );
724 
725  void EnableContextMenuHandling();
726 
727  long getPreferredDimensions(std::vector<long> &rWidths) const;
728 
729  virtual Size GetOptimalSize() const override;
730 
731  void SetAlternatingRowColors( const bool bEnable );
732 
733  // Enables type-ahead search in the check list box.
734  void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
735 
736  void SetForceMakeVisible(bool bEnable);
737 
738  virtual FactoryFunction GetUITestFactory() const override;
739 };
740 
742 {
748  bool bCanceled;
750 
751  void CallCallBackHdl_Impl();
752  DECL_LINK( Timeout_Impl, Timer *, void );
753  DECL_LINK( ReturnHdl_Impl, Accelerator&, void );
754  DECL_LINK( EscapeHdl_Impl, Accelerator&, void );
755 
756 public:
757  SvInplaceEdit2( vcl::Window* pParent, const Point& rPos, const Size& rSize,
758  const OUString& rData, const Link<SvInplaceEdit2&,void>& rNotifyEditEnd,
759  const Selection& );
760  ~SvInplaceEdit2();
761  bool KeyInput( const KeyEvent& rKEvt );
762  void LoseFocus();
763  bool EditingCanceled() const { return bCanceled; }
764  OUString GetText() const;
765  OUString const & GetSavedValue() const;
766  void StopEditing( bool bCancel );
767  void Hide();
768 };
769 
770 #endif
771 
772 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ModelHasEntryInvalidated(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1181
virtual FactoryFunction GetUITestFactory() const
Definition: window.cxx:3766
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:412
bool KeyInput(const KeyEvent &rKEvt)
void CallCallBackHdl_Impl()
void SetExpandingHdl(const Link< SvTreeListBox *, bool > &rNewHdl)
InvalidateFlags
Definition: window.hxx:211
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)
OUString const & GetSavedValue() const
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
SvInplaceEdit2(vcl::Window *pParent, const Point &rPos, const Size &rSize, const OUString &rData, const Link< SvInplaceEdit2 &, void > &rNotifyEditEnd, const Selection &)
Definition: treelistbox.cxx:95
const MapMode & GetMapMode() const
Definition: outdev.hxx:1673
SelectionMode
Definition: vclenum.hxx:26
bool IsDynamic() const
Link< const CommandEvent &, bool > aPopupMenuHdl
short nContextBmpWidthMax
bool mbUpdateAlternatingRows
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:419
SvTreeListBoxFlags nImpFlags
bool mbAlternatingRowColors
long mnCheckboxItemWidth
SvTreeFlags
Definition: treelistbox.hxx:88
SvLBoxTabFlags nFlags
Accelerator aAccEscape
StateChangedType
Definition: window.hxx:309
VclPtr< Edit > pEdit
SvLBoxItemType
sal_Int64 WinBits
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
DragDropMode
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:1156
Link< SvTreeListBox *, bool > aDoubleClickHdl
VclEventId
Definition: vclevent.hxx:41
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:58
void Enable(bool bEnabled)
short GetEntryHeight() const
Link< SvTreeListBox *, void > aDeselectHdl
SvTreeListEntry * GetHdlEntry() const
DragDropMode nOldDragMode
Link< SvInplaceEdit2 &, void > const aCallBackHdl
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: transfer2.cxx:290
SvTreeListEntry * pHdlEntry
callback for a MnemonicEngine
sal_uInt16 nCurEntrySelPos
SvTreeListEntry * pTargetEntry
Image aCurInsertedColBmp
Image aPrevInsertedExpBmp
void StopEditing(bool bCancel)
short GetEntryWidth() const
Accelerator aAccReturn
SelectionMode eSelMode
void SetPos(long nNewPos)
sal_uInt16 nLastSelTab
virtual void InitViewData(SvViewDataEntry *, SvTreeListEntry *pEntry)
Definition: treelist.cxx:1345
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
DragDropMode nDragDropMode
bool IsEditable() const
void Clear()
Definition: treelist.cxx:1132
DECL_LINK(AutocompleteHdl, Edit &, void)
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt)
Definition: transfer2.cxx:284
OUString GetText() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1153
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:657
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2971
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:304
std::unique_ptr< SvImpLBox > pImpl
virtual void ModelHasRemoved(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1174
void SetPopupMenuHdl(const Link< const CommandEvent &, bool > &rLink)
Link< SvTreeListBox *, void > aSelectHdl
void SetCheckButtonHdl(const Link< SvTreeListBox *, void > &rLink)
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
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1425
Link< SvTreeListBox *, void > aCheckButtonHdl
DragDropMode GetDragDropMode() const
virtual void LoseFocus()
Definition: window.cxx:1818
vcl::Window * GetParent() const
Definition: window2.cxx:1091
long X() const
short GetSpaceBetweenEntries() const
void SetExpandedHdl(const Link< SvTreeListBox *, void > &rNewHdl)
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:1767
virtual Size GetOptimalSize() const override
Definition: ctrl.cxx:374
SvTreeListEntry * First() const
void SetOptimalImageIndent()
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:1170
SvTreeListEntry * pEdEntry
Definition: ctrl.hxx:33
short nEntryHeightOffs
sal_Int8 nDragOptions
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:1804
sal_uInt16 nFirstSelTab
void SetCursor(vcl::Cursor *pCursor)
Definition: window.cxx:3009
void SetFont(const vcl::Font &rNewFont)
virtual void ModelIsMoving(SvTreeListEntry *pSource, SvTreeListEntry *pTargetParent, sal_uLong nPos)
Definition: treelist.cxx:1160
Definition: image.hxx:51
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1010
SvTreeListEntry * Last() const
const Point & GetOrigin() const
Definition: mapmod.cxx:165
#define VCL_DLLPRIVATE
Definition: dllapi.h:31
bool EditingCanceled() const
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:406
short GetIndent() const
Definition: timer.hxx:26
long GetXOffset() const
virtual void ModelHasCleared()
Definition: treelist.cxx:1148
SvLBoxTabFlags
Definition: treelistbox.hxx:63
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1886
SvTreeFlags nTreeFlags
TriState
DECL_LINK(Timeout_Impl, Timer *, void)
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uLong nPos)
Definition: treelist.cxx:1294
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1832
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:1166
virtual void ModelHasInserted(SvTreeListEntry *pEntry)
Definition: treelist.cxx:1152
SvTreeListEntry * Prev(SvTreeListEntry *pEntry) const
SvTreeFlags GetTreeFlags() const
void SetQuickSearch(bool bEnable)
Link< SvTreeListBox *, void > aScrolledHdl
std::unique_ptr< SvInplaceEdit2 > pEdCtrl
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:30
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:35
const Link< SvTreeListBox *, bool > & GetDoubleClickHdl() const