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;
216 bool mbQuickSearch; // Enables type-ahead search in the check list box.
217 bool mbActivateOnSingleClick; // Make single click "activate" a row like a double-click normally does
218 bool mbHoverSelection; // Make mouse over a row "select" a row like a single-click normally does
219 bool mbSelectingByHover; // true during "Select" if it was due to hover
220 sal_Int8 mnClicksToToggle; // 0 == Click on a row not toggle its checkbox.
221 // 1 == Every click on row toggle its checkbox.
222 // 2 == First click select, second click toggle.
223
225
230
232
235
237
238protected:
239 std::unique_ptr<SvImpLBox> pImpl;
240 short nColumns;
244
248 std::vector<std::unique_ptr<SvLBoxTab>> aTabs;
251 // Move/CopySelection: Position of the current Entry in SelectionList
252 sal_uInt16 nCurEntrySelPos;
253
254private:
255 DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData *, void );
256 DECL_DLLPRIVATE_LINK( TextEditEndedHdl_Impl, SvInplaceEdit2&, void );
257 // Handler that is called by TreeList to clone an Entry
259
260 // Handler and methods for Drag - finished handler.
261 // The Handle retrieved by GetDragFinishedHdl can be set on the
262 // TransferDataContainer. This link is a callback for the DragFinished
263 // call. The AddBox method is called from the GetDragFinishedHdl() and the
264 // remove is called in the link callback and in the dtor. So it can't be
265 // called for a deleted object.
266 VCL_DLLPRIVATE static void AddBoxToDDList_Impl( const SvTreeListBox& rB );
267 VCL_DLLPRIVATE static void RemoveBoxFromDDList_Impl( const SvTreeListBox& rB );
268 DECL_DLLPRIVATE_LINK( DragFinishHdl_Impl, sal_Int8, void );
269
270 // after a checkbox entry is inserted, use this to get its width to support
271 // autowidth for the 1st checkbox column
272 VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry* pEntry);
273
274 VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry);
275 VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext& rRenderContext, const SvTreeListEntry& rEntry) const;
276
284 VCL_DLLPRIVATE bool HandleKeyInput(const KeyEvent& rKEvt);
285
286 void UnsetDropTarget();
287
288protected:
289
290 bool CheckDragAndDropMode( SvTreeListBox const * pSource, sal_Int8 );
291 void ImplShowTargetEmphasis( SvTreeListEntry* pEntry, bool bShow);
292 void EnableSelectionAsDropTarget( bool bEnable = true );
293 // Standard impl returns 0; derived classes which support D'n'D must override
294 using Window::GetDropTarget;
295 virtual SvTreeListEntry* GetDropTarget( const Point& );
296
297 // Invalidate children on enable/disable
298 virtual void StateChanged( StateChangedType eType ) override;
299
300 virtual sal_uInt32 Insert( SvTreeListEntry* pEnt,SvTreeListEntry* pPar,sal_uInt32 nPos=TREELIST_APPEND);
301 virtual sal_uInt32 Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos = TREELIST_APPEND );
302
303 // In-place editing
304 std::unique_ptr<SvInplaceEdit2> pEdCtrl;
305 void EditText( const OUString&, const tools::Rectangle&,const Selection&);
306 void CancelTextEditing();
307
308 // InitViewData is called right after CreateViewData
309 // The Entry is has not yet been added to the View in InitViewData!
310 virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) override;
311 // Calls InitViewData for all Items
312 void RecalcViewData();
313
314 // Handler and methods for Drag - finished handler. This link can be set
315 // to the TransferDataContainer. The AddBox/RemoveBox methods must be
316 // called before the StartDrag call.
317 // The Remove will be called from the handler, which then calls DragFinish.
318 // The Remove is also called in the DTOR of the SvTreeListBox -
319 // so it can't be called for a deleted object.
320 Link<sal_Int8,void> GetDragFinishedHdl() const;
321
322 // For asynchronous D'n'D
323 sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt, SvTreeListBox* pSourceView );
324
325 void OnCurrentEntryChanged();
326
327 // ISearchableStringList
328 virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override;
329 virtual vcl::StringEntryIdentifier NextEntry( vcl::StringEntryIdentifier _currentEntry, OUString& _out_entryText ) const override;
330 virtual void SelectEntry( vcl::StringEntryIdentifier _entry ) override;
331
332public:
333
334 SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 );
335 virtual ~SvTreeListBox() override;
336 virtual void dispose() override;
337
339 {
340 return pModel.get();
341 }
342
343 sal_uInt32 GetEntryCount() const
344 {
345 return pModel ? pModel->GetEntryCount() : 0;
346 }
348 {
349 return pModel ? pModel->First() : nullptr;
350 }
352 {
353 return pModel->Next(pEntry);
354 }
356 {
357 return pModel->Prev(pEntry);
358 }
360 {
361 return pModel ? pModel->Last() : nullptr;
362 }
363
364 SvTreeListEntry* FirstChild( SvTreeListEntry* pParent ) const;
365
366 bool CopySelection( SvTreeListBox* pSource, SvTreeListEntry* pTarget );
367 bool MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback );
368 void RemoveSelection();
372 void RemoveEntry(SvTreeListEntry const * pEntry);
373
374 DragDropMode GetDragDropMode() const { return nDragDropMode; }
375 SelectionMode GetSelectionMode() const { return eSelMode; }
376
377 // pParent == 0 -> Root level
378 SvTreeListEntry* GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const;
379 SvTreeListEntry* GetEntry( sal_uInt32 nRootPos ) const;
380
381 SvTreeListEntry* GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const;
382 void FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const;
383
384 using Window::GetParent;
385 SvTreeListEntry* GetParent( SvTreeListEntry* pEntry ) const;
386
387 using Window::GetChildCount;
388 sal_uInt32 GetChildCount( SvTreeListEntry const * pParent ) const;
389 sal_uInt32 GetLevelChildCount( SvTreeListEntry* pParent ) const;
390
391 SvViewDataEntry* GetViewDataEntry( SvTreeListEntry const * pEntry ) const;
392 SvViewDataItem* GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *);
393 const SvViewDataItem* GetViewDataItem(const SvTreeListEntry*, const SvLBoxItem*) const;
394
395 OUString GetEntryTooltip(SvTreeListEntry* pEntry) const { return aTooltipHdl.Call(pEntry); }
396
397 VclPtr<Edit> GetEditWidget() const; // for UITest
398 bool IsInplaceEditingEnabled() const { return bool(nImpFlags & SvTreeListBoxFlags::EDT_ENABLED); }
399 bool IsEditingActive() const { return bool(nImpFlags & SvTreeListBoxFlags::IN_EDT); }
400 void EndEditing( bool bCancel = false );
401
402 void Clear();
403
404 bool TextCenterAndClipEnabled() const { return mbCenterAndClipText; }
405
406 void SetSelectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aSelectHdl=rNewHdl; }
407 void SetDeselectHdl( const Link<SvTreeListBox*,void>& rNewHdl ) {aDeselectHdl=rNewHdl; }
408 void SetDoubleClickHdl(const Link<SvTreeListBox*,bool>& rNewHdl) {aDoubleClickHdl=rNewHdl;}
409 void SetExpandingHdl(const Link<SvTreeListBox*,bool>& rNewHdl){aExpandingHdl=rNewHdl;}
410 void SetExpandedHdl(const Link<SvTreeListBox*,void>& rNewHdl){aExpandedHdl=rNewHdl;}
411 void SetPopupMenuHdl(const Link<const CommandEvent&, bool>& rLink) { aPopupMenuHdl = rLink; }
412 void SetTooltipHdl(const Link<SvTreeListEntry*, OUString>& rLink) { aTooltipHdl = rLink; }
413 void SetCustomRenderHdl(const Link<svtree_render_args, void>& rLink) { aCustomRenderHdl = rLink; }
414 void SetCustomMeasureHdl(const Link<svtree_measure_args, Size>& rLink) { aCustomMeasureHdl = rLink; }
415
416 void ExpandedHdl();
417 bool ExpandingHdl();
418 void SelectHdl();
419 void DeselectHdl();
420 bool DoubleClickHdl();
421 SvTreeListEntry* GetHdlEntry() const { return pHdlEntry; }
422
423 // Is called for an Entry that gets expanded with the Flag
424 // ENTRYFLAG_CHILDREN_ON_DEMAND set.
425 virtual void RequestingChildren( SvTreeListEntry* pParent );
426
427 // Drag & Drop
428 // New D'n'D API
429 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override;
430 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override;
431 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ) override;
432 virtual DragDropMode NotifyStartDrag();
433 virtual void DragFinished( sal_Int8 nDropAction );
434
435 SvTreeListEntry* CloneEntry( SvTreeListEntry* pSource );
436
437 // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
438 TriState NotifyMoving(
439 SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
440 const SvTreeListEntry* pEntry, // Entry to be moved from GetSourceListBox()->GetModel()
441 SvTreeListEntry*& rpNewParent, // New TargetParent
442 sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
443
444 // Return value: TRISTATE_TRUE == Ok, TRISTATE_FALSE == Cancel, TRISTATE_INDET == Ok and Make visible moved entry
445 TriState NotifyCopying(
446 SvTreeListEntry* pTarget, // D'n'D DropPosition in GetModel()
447 const SvTreeListEntry* pEntry, // Entry to be copied from GetSourceListBox()->GetModel()
448 SvTreeListEntry*& rpNewParent, // New TargetParent
449 sal_uInt32& rNewChildPos); // The TargetParent's position in Childlist
450
451 // ACCESSIBILITY ==========================================================
452
454 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
455
457 void FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const;
458
459 virtual OUString GetEntryAccessibleDescription(SvTreeListEntry* pEntry) const;
460
465 tools::Rectangle GetBoundingRect(const SvTreeListEntry* pEntry);
466
467 SvTreeFlags GetTreeFlags() const {return nTreeFlags;}
468
469 static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry* pEntry);
470
471 void set_min_width_in_chars(sal_Int32 nChars);
472
473 virtual bool set_property(const OString &rKey, const OUString &rValue) override;
474
475 VCL_DLLPRIVATE void SetCollapsedNodeBmp( const Image& );
476 VCL_DLLPRIVATE void SetExpandedNodeBmp( const Image& );
477 VCL_DLLPRIVATE Image const & GetExpandedNodeBmp( ) const;
478
479protected:
480
481 virtual void CalcEntryHeight(SvTreeListEntry const* pEntry);
482 void AdjustEntryHeight( const Image& rBmp );
483 VCL_DLLPRIVATE void AdjustEntryHeight();
484
485 VCL_DLLPRIVATE void ImpEntryInserted( SvTreeListEntry* pEntry );
486 VCL_DLLPRIVATE void PaintEntry1( SvTreeListEntry&, tools::Long nLine, vcl::RenderContext& rRenderContext );
487
488 VCL_DLLPRIVATE void InitTreeView();
489 VCL_DLLPRIVATE SvLBoxItem* GetItem_Impl( SvTreeListEntry*, tools::Long nX, SvLBoxTab** ppTab );
490 VCL_DLLPRIVATE void ImplInitStyle();
491
492 void SetupDragOrigin();
493 void EditItemText( SvTreeListEntry* pEntry, SvLBoxString* pItem,
494 const Selection& );
495 void EditedText(const OUString&);
496
497 // Recalculate all tabs depending on TreeListStyle and Bitmap sizes
498 // Is called automatically when inserting/changing Bitmaps, changing the Model etc.
499 virtual void SetTabs();
500 void AddTab( tools::Long nPos, SvLBoxTabFlags nFlags );
501 sal_uInt16 TabCount() const { return aTabs.size(); }
502 SvLBoxTab* GetFirstDynamicTab() const;
503 SvLBoxTab* GetFirstDynamicTab( sal_uInt16& rTabPos ) const;
504 SvLBoxTab* GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
505 void GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos );
506 SvLBoxTab* GetTab( SvTreeListEntry const *, SvLBoxItem const * ) const;
507 void ClearTabList();
508
509 virtual void InitEntry(SvTreeListEntry*, const OUString&, const Image&, const Image&);
510
511 void NotifyScrolled();
512 void SetScrolledHdl( const Link<SvTreeListBox*,void>& rLink ) { aScrolledHdl = rLink; }
513 tools::Long GetXOffset() const { return GetMapMode().GetOrigin().X(); }
514
515 virtual void Command( const CommandEvent& rCEvt ) override;
516
517 virtual void RequestHelp( const HelpEvent& rHEvt ) override;
518 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
519
520 void InitSettings();
521
522 virtual void ApplySettings(vcl::RenderContext& rRenderContext) override;
523
524 void CallImplEventListeners(VclEventId nEvent, void* pData);
525
526 void ImplEditEntry( SvTreeListEntry* pEntry );
527
528 void AdjustEntryHeightAndRecalc();
529
530 // true if rPos is over the SvTreeListBox body, i.e. not over a
531 // scrollbar
532 VCL_DLLPRIVATE bool PosOverBody(const Point& rPos) const;
533public:
534
535 void SetNoAutoCurEntry( bool b );
536
537 void EnableCheckButton( SvLBoxButtonData* );
538 void SetCheckButtonData( SvLBoxButtonData* );
539
543 static const Image& GetDefaultExpandedNodeImage( );
544
548 static const Image& GetDefaultCollapsedNodeImage( );
549
552 void SetNodeDefaultImages();
553
554 virtual SvTreeListEntry* InsertEntry( const OUString& rText, SvTreeListEntry* pParent = nullptr,
555 bool bChildrenOnDemand = false,
556 sal_uInt32 nPos=TREELIST_APPEND, void* pUserData = nullptr);
557
558 const Image& GetDefaultExpandedEntryBmp( ) const;
559 const Image& GetDefaultCollapsedEntryBmp( ) const;
560
561 void SetDefaultExpandedEntryBmp( const Image& rBmp );
562 void SetDefaultCollapsedEntryBmp( const Image& rBmp );
563
564 void SetCheckButtonState( SvTreeListEntry*, SvButtonState );
565 SvButtonState GetCheckButtonState( SvTreeListEntry* ) const;
566
567 void SetEntryText(SvTreeListEntry*, const OUString& );
568 void SetExpandedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
569 void SetCollapsedEntryBmp( SvTreeListEntry* _pEntry, const Image& _rImage );
570
571 virtual OUString GetEntryText( SvTreeListEntry* pEntry ) const;
572 static const Image& GetExpandedEntryBmp(const SvTreeListEntry* _pEntry );
573 static const Image& GetCollapsedEntryBmp(const SvTreeListEntry* _pEntry );
574
575 void CheckButtonHdl();
576
577 void SetSublistOpenWithLeftRight(); // open/close sublist with cursor left/right
578
579 void EnableInplaceEditing( bool bEnable );
580 // Edits the Entry's first StringItem, 0 == Cursor
581 void EditEntry( SvTreeListEntry* pEntry );
582 virtual bool EditingEntry( SvTreeListEntry* pEntry );
583 virtual bool EditedEntry( SvTreeListEntry* pEntry, const OUString& rNewText );
584
585 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
586 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
587 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
588 virtual void MouseMove( const MouseEvent& rMEvt ) override;
589 virtual void KeyInput( const KeyEvent& rKEvt ) override;
590 virtual void Resize() override;
591 virtual void GetFocus() override;
592 virtual void LoseFocus() override;
593 void SetUpdateMode( bool );
594
595 virtual void ModelHasCleared() override;
596 virtual void ModelHasInserted( SvTreeListEntry* pEntry ) override;
597 virtual void ModelHasInsertedTree( SvTreeListEntry* pEntry ) override;
598 virtual void ModelIsMoving(SvTreeListEntry* pSource ) override;
599 virtual void ModelHasMoved(SvTreeListEntry* pSource ) override;
600 virtual void ModelIsRemoving( SvTreeListEntry* pEntry ) override;
601 virtual void ModelHasRemoved( SvTreeListEntry* pEntry ) override;
602 void ModelHasEntryInvalidated( SvTreeListEntry* pEntry ) override;
603
604 void ScrollOutputArea( short nDeltaEntries );
605
606 short GetColumnsCount() const { return nColumns; }
607 short GetEntryHeight() const { return nEntryHeight; }
608 void SetEntryHeight( short nHeight );
609 short GetEntryWidth() const { return nEntryWidth; }
610 void SetEntryWidth( short nWidth );
611 Size GetOutputSizePixel() const;
612 short GetIndent() const { return nIndent; }
613 void SetSpaceBetweenEntries( short nSpace );
614 Point GetEntryPosition(const SvTreeListEntry*) const;
615 void MakeVisible( SvTreeListEntry* pEntry );
616 void MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop );
617
618 void SetFont( const vcl::Font& rFont );
619
620 SvTreeListEntry* GetEntry( const Point& rPos, bool bHit = false ) const;
621
622 virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long nLine );
623 // Respects indentation
624 sal_IntPtr GetTabPos(const SvTreeListEntry*, const SvLBoxTab*) const;
625 void InvalidateEntry( SvTreeListEntry* );
628 std::pair<tools::Long, tools::Long> GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx);
629
630 void SetDragDropMode( DragDropMode );
631 void SetSelectionMode( SelectionMode );
632
633 bool Expand( SvTreeListEntry* pParent );
634 bool Collapse( SvTreeListEntry* pParent );
635 bool Select( SvTreeListEntry* pEntry, bool bSelect=true );
636 sal_uInt32 SelectChildren( SvTreeListEntry* pParent, bool bSelect );
637 void SelectAll( bool bSelect );
638
639 void SetCurEntry( SvTreeListEntry* _pEntry );
640 SvTreeListEntry* GetCurEntry() const;
641
642 using Window::Invalidate;
643 virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE) override;
644 virtual void Invalidate( const tools::Rectangle&, InvalidateFlags nFlags = InvalidateFlags::NONE ) override;
645
646 void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff);
647
648 sal_Int32 DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText);
649
650 DECL_DLLPRIVATE_LINK( DefaultCompare, const SvSortData&, sal_Int32 );
651 virtual void ModelNotification( SvListAction nActionId, SvTreeListEntry* pEntry1,
652 SvTreeListEntry* pEntry2, sal_uInt32 nPos ) override;
653
654 SvTreeListEntry* GetFirstEntryInView() const;
655 SvTreeListEntry* GetNextEntryInView(SvTreeListEntry*) const;
656 void ScrollToAbsPos( tools::Long nPos );
657
658 tools::Long getPreferredDimensions(std::vector<tools::Long> &rWidths) const;
659
660 virtual Size GetOptimalSize() const override;
661
662 void SetAlternatingRowColors( const bool bEnable );
663
664 // Enables type-ahead search in the check list box.
665 void SetQuickSearch(bool bEnable) { mbQuickSearch = bEnable; }
666
667 // Make single click "activate" a row like a double-click normally does
668 void SetActivateOnSingleClick(bool bEnable) { mbActivateOnSingleClick = bEnable; }
669 bool GetActivateOnSingleClick() const { return mbActivateOnSingleClick; }
670
671 // Make mouse over a row "select" a row like a single-click normally does
672 void SetHoverSelection(bool bEnable) { mbHoverSelection = bEnable; }
673 bool GetHoverSelection() const { return mbHoverSelection; }
674
675 // only true during Select if the Select is due to a Hover
676 bool IsSelectDueToHover() const { return mbSelectingByHover; }
677
678 // Set when clicks toggle the checkbox of the row.
679 void SetClicksToToggle(sal_Int8 nCount) { mnClicksToToggle = nCount; }
680
681 void SetForceMakeVisible(bool bEnable);
682
683 virtual FactoryFunction GetUITestFactory() const override;
684
685 void SetDragHelper(const rtl::Reference<TransferDataContainer>& rHelper, sal_uInt8 eDNDConstants);
686
687 virtual void EnableRTL(bool bEnable = true) override;
688};
689
690/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: ctrl.hxx:82
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:171
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)
bool mbAlternatingRowColors
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
bool mbUpdateAlternatingRows
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