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>
38#include <vcl/transfer.hxx>
40
41class SvTreeListBox;
42class SvTreeListEntry;
43struct SvViewDataItem;
44class SvViewDataEntry;
45class SvInplaceEdit2;
46class SvLBoxString;
47class SvImpLBox;
49class Timer;
50class Edit;
51
53
54// *********************************************************************
55// *************************** Tabulators ******************************
56// *********************************************************************
57
59{
60 NONE = 0x0000,
61 DYNAMIC = 0x0001, // Item's output column changes according to the Child Depth
62 ADJUST_RIGHT = 0x0002, // Item's right margin at the tabulator
63 ADJUST_LEFT = 0x0004, // Left margin
64 ADJUST_CENTER = 0x0008, // Center the item at the tabulator
65
66 SHOW_SELECTION = 0x0010, // Visualize selection state
67 // Item needs to be able to return the surrounding polygon (D'n'D cursor)
68 EDITABLE = 0x0020, // Item editable at the tabulator
69 FORCE = 0x0040, // Switch off the default calculation of the first tabulator
70 // (on which Abo Tabpage/Extras/Option/Customize, etc. rely on)
71 // The first tab's position corresponds precisely to the Flags set
72 // and column widths
73};
74namespace o3tl
75{
76 template<> struct typed_flags<SvLBoxTabFlags> : is_typed_flags<SvLBoxTabFlags, 0x007f> {};
77}
78
79#define SV_TAB_BORDER 8
80
81#define SV_ENTRYHEIGHTOFFS_PIXEL 2
82
83enum class SvTreeFlags
84{
85 CHKBTN = 0x01,
86 USESEL = 0x02,
87 MANINS = 0x04,
88 RECALCTABS = 0x08,
89 FIXEDHEIGHT = 0x10,
90};
91namespace o3tl
92{
93 template<> struct typed_flags<SvTreeFlags> : is_typed_flags<SvTreeFlags, 0x1f> {};
94}
95
97
99{
101public:
102 SvLBoxTab();
104 SvLBoxTab( const SvLBoxTab& );
105
107
108 bool IsDynamic() const { return bool(nFlags & SvLBoxTabFlags::DYNAMIC); }
109 void SetPos( tools::Long nNewPos) { nPos = nNewPos; }
110 tools::Long GetPos() const { return nPos; }
111 tools::Long CalcOffset( tools::Long nItemLength, tools::Long nTabWidth );
112 bool IsEditable() const { return bool(nFlags & SvLBoxTabFlags::EDITABLE); }
113};
114
116{
117protected:
119
120public:
121 SvLBoxItem();
122 virtual ~SvLBoxItem();
123 virtual SvLBoxItemType GetType() const = 0;
124 virtual int CalcWidth(const SvTreeListBox* pView) const;
125 int GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
126 int GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos) const;
127 int GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const;
128 static int GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos);
129 void Enable(bool bEnabled) { mbDisabled = !bEnabled; }
130 bool isEnable() const { return !mbDisabled; }
131
132 virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext, const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) = 0;
133
134 virtual void InitViewData(SvTreeListBox* pView, SvTreeListEntry* pEntry,
135 // If != 0: this Pointer must be used!
136 // If == 0: it needs to be retrieved via the View
137 SvViewDataItem* pViewData = nullptr) = 0;
138 // View-dependent data is not cloned
139 virtual std::unique_ptr<SvLBoxItem> Clone(SvLBoxItem const * pSource) const = 0;
140};
141
142enum class DragDropMode
143{
144 NONE = 0x0000,
145 CTRL_MOVE = 0x0001,
146 APP_COPY = 0x0004,
147 // Entries may be dropped via the uppermost Entry
148 // The DropTarget is 0 in that case
149 ENABLE_TOP = 0x0010,
150 ALL = 0x0015,
151};
152namespace o3tl
153{
154 template<> struct typed_flags<DragDropMode> : is_typed_flags<DragDropMode, 0x0015> {};
155}
156
158{
159 NONE = 0x0000,
160 IN_EDT = 0x0001,
161 EDT_ENABLED = 0x0002,
162 TARGEMPH_VIS = 0x0004,
163 EDTEND_CALLED = 0x0008,
164};
165namespace o3tl
166{
167 template<> struct typed_flags<SvTreeListBoxFlags> : is_typed_flags<SvTreeListBoxFlags, 0x000f> {};
168}
169
170struct SvTreeListBoxImpl;
171
172typedef std::pair<vcl::RenderContext&, const SvTreeListEntry&> svtree_measure_args;
173typedef std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&> svtree_render_args;
174
176 :public Control
177 ,public SvListView
178 ,public DropTargetHelper
179 ,public DragSourceHelper
181{
182 friend class SvImpLBox;
183 friend class SvLBoxString;
184 friend class IconViewImpl;
185 friend class TreeControlPeer;
189
190 std::unique_ptr<SvTreeListBoxImpl> mpImpl;
200
205
208 short nIndent;
210 sal_uInt16 nFirstSelTab;
211 sal_uInt16 nLastSelTab;
214 bool mbQuickSearch; // Enables type-ahead search in the check list box.
215 bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
216 bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
217 bool mbSelectingByHover; // true during "Select" if it was due to hover
218 sal_Int8 mnClicksToToggle; // 0 == Click on a row not toggle its checkbox.
219 // 1 == Every click on row toggle its checkbox.
220 // 2 == First click select, second click toggle.
221
223
228
230
233
235
236protected:
237 std::unique_ptr<SvImpLBox> pImpl;
238 short nColumns;
242
246 std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
249 // Move/CopySelection: Position of the current Entry in SelectionList
250 sal_uInt16 nCurEntrySelPos;
251
252private:
253 DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
254 DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void );
255 // Handler that is called by TreeList to clone an Entry
257
258 // Handler and methods for Drag - finished handler.
259 // The Handle retrieved by GetDragFinishedHdl can be set on the
260 // TransferDataContainer. This link is a callback for the DragFinished
261 // call. The AddBox method is called from the GetDragFinishedHdl() and the
262 // remove is called in the link callback and in the dtor. So it can't be
263 // called for a deleted object.
264 VCL_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
265 VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
266 DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
267
268 // after a checkbox entry is inserted, use this to get its width to support
269 // autowidth for the 1st checkbox column
270 VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
271
272 VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry);
273 VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext& rRenderContext, const SvTreeListEntry& rEntry) const;
274
282 VCL_DLLPRIVATE bool HandleKeyInput(const KeyEvent& rKEvt);
283
284 void UnsetDropTarget();
285
286protected:
287
288 bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
289 void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
290 void EnableSelectionAsDropTarget( bool bEnable = true );
291 // Standard impl returns 0; derived classes which support D'n'D must override
292 using Window::GetDropTarget;
293 virtual SvTreeListEntry* GetDropTarget( const Point& );
294
295 // Invalidate children on enable/disable
296 virtual void StateChanged( StateChangedType eType ) override;
297
298 virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND);
299 virtual sal_uInt32 Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos = TREELIST_APPEND );
300
301 // In-place editing
302 std::unique_ptr<SvInplaceEdit2> pEdCtrl;
303 void EditText( const OUString&, const tools::Rectangle&,const Selection&);
304 void CancelTextEditing();
305
306 // InitViewData is called right after CreateViewData
307 // The Entry is has not yet been added to the View in InitViewData!
308 virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
309 // Calls InitViewData for all Items
310 void RecalcViewData();
311
312 // Handler and methods for Drag - finished handler. This link can be set
313 // to the TransferDataContainer. The AddBox/RemoveBox methods must be
314 // called before the StartDrag call.
315 // The Remove will be called from the handler, which then calls DragFinish.
316 // The Remove is also called in the DTOR of the SvTreeListBox -
317 // so it can't be called for a deleted object.
318 Link<sal_Int8,void> GetDragFinishedHdl() const;
319
320 // For asynchronous D'n'D
321 sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
322
323 void OnCurrentEntryChanged();
324
325 // ISearchableStringList
326 virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
327 virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
328 virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
329
330public:
331
332 SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
333 virtual ~SvTreeListBox() override;
334 virtual void dispose() override;
335
337 {
338 return pModel.get();
339 }
340
341 sal_uInt32 GetEntryCount() const
342 {
343 return pModel ? pModel->GetEntryCount() : 0;
344 }
346 {
347 return pModel ? pModel->First() : nullptr;
348 }
350 {
351 return pModel->Next(pEntry);
352 }
354 {
355 return pModel->Prev(pEntry);
356 }
358 {
359 return pModel ? pModel->Last() : nullptr;
360 }
361
362 SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
363
364 bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
365 bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback );
366 void RemoveSelection();
370 void RemoveEntry(SvTreeListEntry const * pEntry);
371
372 DragDropMode GetDragDropMode() const { return nDragDropMode; }
373 SelectionMode GetSelectionMode() const { return eSelMode; }
374
375 // pParent == 0 -> Root level
376 SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const;
377 SvTreeListEntry* GetEntry( sal_uInt32 nRootPos ) const;
378
379 SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
380 void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
381
382 using Window::GetParent;
383 SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
384
385 using Window::GetChildCount;
386 sal_uInt32 GetChildCount( SvTreeListEntry const * pParent ) const;
387 sal_uInt32 GetLevelChildCount( SvTreeListEntry* pParent ) const;
388
389 SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
390 SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
391 const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
392
393 OUString GetEntryTooltip(SvTreeListEntry* pEntry) const { return aTooltipHdl.Call(pEntry); }
394
395 VclPtr<Edit> GetEditWidget() const; // for UITest
396 bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
397 bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
398 void EndEditing( bool bCancel = false );
399
400 void Clear();
401
402 bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
403
404 void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
405 void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
406 void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
407 void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
408 void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
409 void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
410 void SetTooltipHdl(const Link<SvTreeListEntry*, OUString>& rLink) { aTooltipHdl = rLink; }
411 void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { aCustomRenderHdl = rLink; }
412 void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { aCustomMeasureHdl = rLink; }
413
414 void ExpandedHdl();
415 bool ExpandingHdl();
416 void SelectHdl();
417 void DeselectHdl();
418 bool DoubleClickHdl();
419 SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
420
421 // Is called for an Entry that gets expanded with the Flag
422 // ENTRYFLAG_CHILDREN_ON_DEMAND set.
423 virtual void RequestingChildren( SvTreeListEntry* pParent );
424
425 // Drag & Drop
426 // New D'n'D API
427 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
428 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
429 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
430 virtual DragDropMode NotifyStartDrag();
431 virtual void DragFinished( sal_Int8 nDropAction );
432
433 SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
434
435 // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
436 TriState NotifyMoving(
437 SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
438 const SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
439 SvTreeListEntry*& rpNewParent, // New TargetParent
440 sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
441
442 // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
443 TriState NotifyCopying(
444 SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
445 const SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
446 SvTreeListEntry*& rpNewParent, // New TargetParent
447 sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
448
449 // ACCESSIBILITY ==========================================================
450
452 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
453
455 void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const;
456
457 virtual OUString GetEntryAccessibleDescription(SvTreeListEntry* pEntry) 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 OUString &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
477protected:
478
479 virtual void CalcEntryHeight(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;
531public:
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 void SetEntryText(SvTreeListEntry*, const OUString& );
566 void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
567 void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
568
569 virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
570 static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
571 static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
572
573 void CheckButtonHdl();
574
575 void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
576
577 void EnableInplaceEditing( bool bEnable );
578 // Edits the Entry's first StringItem, 0 == Cursor
579 void EditEntry( SvTreeListEntry* pEntry );
580 virtual bool EditingEntry( SvTreeListEntry* pEntry );
581 virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
582
583 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
584 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
585 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
586 virtual void MouseMove( const MouseEvent& rMEvt ) override;
587 virtual void KeyInput( const KeyEvent& rKEvt ) override;
588 virtual void Resize() override;
589 virtual void GetFocus() override;
590 virtual void LoseFocus() override;
591 void SetUpdateMode( bool );
592
593 virtual void ModelHasCleared() override;
594 virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
595 virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
596 virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
597 virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
598 virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
599 virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
600 void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
601
602 void ScrollOutputArea( short nDeltaEntries );
603
604 short GetColumnsCount() const { return nColumns; }
605 short GetEntryHeight() const { return nEntryHeight; }
606 void SetEntryHeight( short nHeight );
607 short GetEntryWidth() const { return nEntryWidth; }
608 void SetEntryWidth( short nWidth );
609 Size GetOutputSizePixel() const;
610 short GetIndent() const { return nIndent; }
611 void SetSpaceBetweenEntries( short nSpace );
612 Point GetEntryPosition(const SvTreeListEntry*) const;
613 void MakeVisible( SvTreeListEntry* pEntry );
614 void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
615
616 void SetFont( const vcl::Font& rFont );
617
618 SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
619
620 virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long nLine );
621 // Respects indentation
622 sal_IntPtr GetTabPos(const SvTreeListEntry*, const SvLBoxTab*) const;
623 void InvalidateEntry( SvTreeListEntry* );
626 std::pair<tools::Long, tools::Long> GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx);
627
628 void SetDragDropMode( DragDropMode );
629 void SetSelectionMode( SelectionMode );
630
631 bool Expand( SvTreeListEntry* pParent );
632 bool Collapse( SvTreeListEntry* pParent );
633 bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
634 sal_uInt32 SelectChildren( SvTreeListEntry* pParent, bool bSelect );
635 void SelectAll( bool bSelect );
636
637 void SetCurEntry( SvTreeListEntry* _pEntry );
638 SvTreeListEntry* GetCurEntry() const;
639
640 virtual void ImplInvalidate( const vcl::Region* rRegion, InvalidateFlags nFlags ) override;
641
642 void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
643
644 sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
645
646 DECL_DLLPRIVATE_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
647 virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
648 SvTreeListEntry* pEntry2, sal_uInt32 nPos ) override;
649
650 SvTreeListEntry* GetFirstEntryInView() const;
651 SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
652 void ScrollToAbsPos( tools::Long nPos );
653
654 tools::Long getPreferredDimensions(std::vector<tools::Long> &rWidths) const;
655
656 virtual Size GetOptimalSize() const override;
657
658 // Enables type-ahead search in the check list box.
659 void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
660
661 // Make single click "activate" a row like a double-click normally does
662 void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
663 bool GetActivateOnSingleClick() const { return mbActivateOnSingleClick; }
664
665 // Make mouse over a row "select" a row like a single-click normally does
666 void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
667 bool GetHoverSelection() const { return mbHoverSelection; }
668
669 // only true during Select if the Select is due to a Hover
670 bool IsSelectDueToHover() const { return mbSelectingByHover; }
671
672 // Set when clicks toggle the checkbox of the row.
673 void SetClicksToToggle(sal_Int8 nCount) { mnClicksToToggle = nCount; }
674
675 void SetForceMakeVisible(bool bEnable);
676
677 virtual FactoryFunction GetUITestFactory() const override;
678
679 void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
680
681 virtual void EnableRTL(bool bEnable = true) override;
682};
683
684/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: ctrl.hxx:80
Definition: edit.hxx:56
Definition: image.hxx:40
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
virtual void InitViewData(SvTreeListBox *pView, SvTreeListEntry *pEntry, SvViewDataItem *pViewData=nullptr)=0
bool isEnable() const
virtual std::unique_ptr< SvLBoxItem > Clone(SvLBoxItem const *pSource) const =0
virtual SvLBoxItemType GetType() const =0
virtual void Paint(const Point &rPos, SvTreeListBox &rOutDev, vcl::RenderContext &rRenderContext, const SvViewDataEntry *pView, const SvTreeListEntry &rEntry)=0
void Enable(bool bEnabled)
bool IsEditable() const
tools::Long GetPos() const
tools::Long nPos
tools::Long CalcOffset(tools::Long nItemLength, tools::Long nTabWidth)
bool IsDynamic() const
SvLBoxTabFlags nFlags
void SetPos(tools::Long nNewPos)
sal_uInt16 nCurEntrySelPos
SvTreeListEntry * Prev(SvTreeListEntry *pEntry) const
bool mbSelectingByHover
SvTreeListEntry * pTargetEntry
SvTreeFlags GetTreeFlags() const
sal_Int8 mnClicksToToggle
Image aCurInsertedExpBmp
sal_uInt16 nFirstSelTab
Link< const CommandEvent &, bool > aPopupMenuHdl
void SetDeselectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
void SetScrolledHdl(const Link< SvTreeListBox *, void > &rLink)
sal_uInt32 GetEntryCount() const
bool GetActivateOnSingleClick() const
Link< SvTreeListBox *, void > aDeselectHdl
void SetDoubleClickHdl(const Link< SvTreeListBox *, bool > &rNewHdl)
OUString GetEntryTooltip(SvTreeListEntry *pEntry) const
void SetClicksToToggle(sal_Int8 nCount)
SvTreeListEntry * GetHdlEntry() const
void SetActivateOnSingleClick(bool bEnable)
void SetExpandedHdl(const Link< SvTreeListBox *, void > &rNewHdl)
Image aPrevInsertedColBmp
bool TextCenterAndClipEnabled() const
void SetHoverSelection(bool bEnable)
std::unique_ptr< SvTreeListBoxImpl > mpImpl
bool IsSelectDueToHover() const
void SetTooltipHdl(const Link< SvTreeListEntry *, OUString > &rLink)
Link< SvTreeListBox *, void > aExpandedHdl
DragDropMode nDragDropMode
SvTreeListEntry * Next(SvTreeListEntry *pEntry) const
Link< svtree_measure_args, Size > aCustomMeasureHdl
DECL_DLLPRIVATE_LINK(DragFinishHdl_Impl, sal_Int8, void)
sal_uInt16 nLastSelTab
DECL_DLLPRIVATE_LINK(CloneHdl_Impl, SvTreeListEntry *, SvTreeListEntry *)
SvTreeListEntry * pHdlEntry
bool IsInplaceEditingEnabled() const
SvTreeListEntry * pEdEntry
Image aPrevInsertedExpBmp
bool GetHoverSelection() const
bool mbContextBmpExpanded
SvTreeListEntry * Last() const
void SetCustomRenderHdl(const Link< svtree_render_args, void > &rLink)
bool mbActivateOnSingleClick
tools::Long GetXOffset() const
SvLBoxButtonData * pCheckButtonData
sal_uInt16 TabCount() const
bool IsEditingActive() const
sal_Int32 nMinWidthInChars
short GetEntryHeight() const
SelectionMode eSelMode
rtl::Reference< TransferDataContainer > m_xTransferHelper
Image aCurInsertedColBmp
tools::Long mnCheckboxItemWidth
std::vector< std::unique_ptr< SvLBoxTab > > aTabs
short nContextBmpWidthMax
Link< SvTreeListBox *, bool > aExpandingHdl
void SetCustomMeasureHdl(const Link< svtree_measure_args, Size > &rLink)
SvTreeListEntry * First() const
DragDropMode GetDragDropMode() const
bool mbCenterAndClipText
std::unique_ptr< SvInplaceEdit2 > pEdCtrl
Link< SvTreeListEntry *, OUString > aTooltipHdl
DECL_DLLPRIVATE_LINK(DefaultCompare, const SvSortData &, sal_Int32)
DECL_DLLPRIVATE_LINK(TextEditEndedHdl_Impl, SvInplaceEdit2 &, void)
void SetSelectHdl(const Link< SvTreeListBox *, void > &rNewHdl)
short GetColumnsCount() const
Link< SvTreeListBox *, void > aScrolledHdl
void SetQuickSearch(bool bEnable)
SvTreeFlags nTreeFlags
SelectionMode GetSelectionMode() const
std::unique_ptr< SvImpLBox > pImpl
Link< SvTreeListBox *, bool > aDoubleClickHdl
DragDropMode nOldDragMode
DECL_DLLPRIVATE_LINK(CheckButtonClick, SvLBoxButtonData *, void)
Link< svtree_render_args, void > aCustomRenderHdl
void SetPopupMenuHdl(const Link< const CommandEvent &, bool > &rLink)
short GetEntryWidth() const
void SetExpandingHdl(const Link< SvTreeListBox *, bool > &rNewHdl)
SvTreeListBoxFlags nImpFlags
short nEntryHeightOffs
sal_Int8 mnDragAction
SvLBoxItem * pEdItem
SvTreeList * GetModel() const
short GetIndent() const
Link< SvTreeListBox *, void > aSelectHdl
View-dependent data for a tree list entry created in the virtual function SvTreeListBox::CreateViewDa...
Definition: timer.hxx:27
int nCount
virtual void Insert(SotClipboardFormatId nFormat, const OUString &rFormatName) override
#define VCL_DLLPRIVATE
Definition: dllapi.h:31
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
TriState
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
void Clear(EHistoryType eHistory)
NONE
void dispose()
long Long
const void * StringEntryIdentifier
@ MouseButtonDown
SvListAction
Definition: treelist.hxx:35
SvButtonState
Definition: treelistbox.hxx:52
std::tuple< vcl::RenderContext &, const tools::Rectangle &, const SvTreeListEntry & > svtree_render_args
SvLBoxItemType
Definition: treelistbox.hxx:96
SvTreeFlags
Definition: treelistbox.hxx:84
std::pair< vcl::RenderContext &, const SvTreeListEntry & > svtree_measure_args
SvLBoxTabFlags
Definition: treelistbox.hxx:59
SvTreeListBoxFlags
DragDropMode
unsigned char sal_uInt8
signed char sal_Int8
SelectionMode
Definition: vclenum.hxx:26
VclEventId
Definition: vclevent.hxx:38
StateChangedType
Definition: window.hxx:291
InvalidateFlags
Definition: window.hxx:186
sal_Int64 WinBits
Definition: wintypes.hxx:109