LibreOffice Module vcl (master) 1
treelistbox.cxx
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/*
21 TODO:
22 - delete anchor in SelectionEngine when selecting manually
23 - SelectAll( false ) => only repaint the deselected entries
24*/
25
28#include <com/sun/star/accessibility/AccessibleStateType.hpp>
29#include <vcl/help.hxx>
30#include <vcl/svapp.hxx>
31#include <vcl/builder.hxx>
32#include <vcl/toolkit/edit.hxx>
33#include <vcl/settings.hxx>
34#include <vcl/commandevent.hxx>
35#include <vcl/decoview.hxx>
37#include <sot/formats.hxx>
38#include <comphelper/string.hxx>
39#include <sal/log.hxx>
40#include <tools/debug.hxx>
41
45#include <accel.hxx>
46#include <svimpbox.hxx>
47
48#include <set>
49#include <string.h>
50#include <vector>
51
52using namespace css::accessibility;
53
54// Drag&Drop
57
58#define SVLBOX_ACC_RETURN 1
59#define SVLBOX_ACC_ESCAPE 2
60
62{
66 Idle aIdle { "svtools::SvInplaceEdit2 aIdle" };
70
72 DECL_LINK( Timeout_Impl, Timer *, void );
73 DECL_LINK( ReturnHdl_Impl, Accelerator&, void );
74 DECL_LINK( EscapeHdl_Impl, Accelerator&, void );
75
76public:
77 SvInplaceEdit2( vcl::Window* pParent, const Point& rPos, const Size& rSize,
78 const OUString& rData, const Link<SvInplaceEdit2&,void>& rNotifyEditEnd,
79 const Selection& );
81 bool KeyInput( const KeyEvent& rKEvt );
82 void LoseFocus();
83 bool EditingCanceled() const { return bCanceled; }
84 OUString GetText() const;
85 OUString const & GetSavedValue() const;
86 void StopEditing( bool bCancel );
87 void Hide();
88 const VclPtr<Edit> & GetEditWidget() const { return pEdit; };
89};
90
91// ***************************************************************
92
93namespace {
94
95class MyEdit_Impl : public Edit
96{
98public:
99 MyEdit_Impl( vcl::Window* pParent, SvInplaceEdit2* pOwner );
100 virtual ~MyEdit_Impl() override { disposeOnce(); }
101 virtual void dispose() override { pOwner = nullptr; Edit::dispose(); }
102 virtual void KeyInput( const KeyEvent& rKEvt ) override;
103 virtual void LoseFocus() override;
104};
105
106}
107
108MyEdit_Impl::MyEdit_Impl( vcl::Window* pParent, SvInplaceEdit2* _pOwner ) :
109
110 Edit( pParent, WB_LEFT ),
111
112 pOwner( _pOwner )
113
114{
115}
116
117void MyEdit_Impl::KeyInput( const KeyEvent& rKEvt )
118{
119 if( !pOwner->KeyInput( rKEvt ))
120 Edit::KeyInput( rKEvt );
121}
122
123void MyEdit_Impl::LoseFocus()
124{
125 if (pOwner)
126 pOwner->LoseFocus();
127}
128
130(
131 vcl::Window* pParent, const Point& rPos,
132 const Size& rSize,
133 const OUString& rData,
134 const Link<SvInplaceEdit2&,void>& rNotifyEditEnd,
135 const Selection& rSelection
136) :
137
138 aCallBackHdl ( rNotifyEditEnd ),
139 bCanceled ( false ),
140 bAlreadyInCallBack ( false )
141
142{
143
144 pEdit = VclPtr<MyEdit_Impl>::Create( pParent, this );
145
146 vcl::Font aFont( pParent->GetFont() );
147 aFont.SetTransparent( false );
148 Color aColor( pParent->GetBackground().GetColor() );
149 aFont.SetFillColor(aColor );
150 pEdit->SetFont( aFont );
151 pEdit->SetBackground( pParent->GetBackground() );
152 pEdit->SetPosPixel( rPos );
153 pEdit->SetSizePixel( rSize );
154 pEdit->SetText( rData );
155 pEdit->SetSelection( rSelection );
156 pEdit->SaveValue();
157
160
161 aAccReturn.SetActivateHdl( LINK( this, SvInplaceEdit2, ReturnHdl_Impl) );
162 aAccEscape.SetActivateHdl( LINK( this, SvInplaceEdit2, EscapeHdl_Impl) );
165
166 pEdit->Show();
167 pEdit->GrabFocus();
168}
169
171{
172 if( !bAlreadyInCallBack )
173 {
176 }
178}
179
180OUString const & SvInplaceEdit2::GetSavedValue() const
181{
182 return pEdit->GetSavedValue();
183}
184
186{
187 pEdit->Hide();
188}
189
190
192{
193 bCanceled = false;
194 CallCallBackHdl_Impl();
195}
196
198{
199 bCanceled = true;
200 CallCallBackHdl_Impl();
201}
202
204{
205 vcl::KeyCode aCode = rKEvt.GetKeyCode();
206 sal_uInt16 nCode = aCode.GetCode();
207
208 switch ( nCode )
209 {
210 case KEY_ESCAPE:
211 bCanceled = true;
213 return true;
214
215 case KEY_RETURN:
216 bCanceled = false;
218 return true;
219 }
220 return false;
221}
222
223void SvInplaceEdit2::StopEditing( bool bCancel )
224{
225 if ( !bAlreadyInCallBack )
226 {
227 bCanceled = bCancel;
229 }
230}
231
233{
236 )
237 {
238 bCanceled = false;
240 aIdle.SetInvokeHandler(LINK(this,SvInplaceEdit2,Timeout_Impl));
241 aIdle.Start();
242 }
243}
244
245IMPL_LINK_NOARG(SvInplaceEdit2, Timeout_Impl, Timer *, void)
246{
247 CallCallBackHdl_Impl();
248}
249
251{
252 aIdle.Stop();
253 if ( !bAlreadyInCallBack )
254 {
255 bAlreadyInCallBack = true;
258 pEdit->Hide();
259 aCallBackHdl.Call( *this );
260 }
261}
262
264{
265 return pEdit->GetText();
266}
267
268// ***************************************************************
269// class SvLBoxTab
270// ***************************************************************
271
272
274{
275 nPos = 0;
277}
278
280{
281 nPos = nPosition;
282 nFlags = nTabFlags;
283}
284
286{
287 nPos = rTab.nPos;
288 nFlags = rTab.nFlags;
289}
290
292{
293 tools::Long nOffset = 0;
295 {
296 nOffset = nTabWidth - nItemWidth;
297 if( nOffset < 0 )
298 nOffset = 0;
299 }
301 {
303 {
304 // correct implementation of centering
305 nOffset = ( nTabWidth - nItemWidth ) / 2;
306 if( nOffset < 0 )
307 nOffset = 0;
308 }
309 else
310 {
311 // historically grown, wrong calculation of tabs which is needed by
312 // Abo-Tabbox, Tools/Options/Customize etc.
313 nItemWidth++;
314 nOffset = -( nItemWidth / 2 );
315 }
316 }
317 return nOffset;
318}
319
320// ***************************************************************
321// class SvLBoxItem
322// ***************************************************************
323
324
326 : mbDisabled(false)
327{
328}
329
331{
332}
333
334int SvLBoxItem::GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
335{
336 const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
337 int nWidth = pViewData->mnWidth;
338 if (nWidth == -1)
339 {
340 nWidth = CalcWidth(pView);
341 const_cast<SvViewDataItem*>(pViewData)->mnWidth = nWidth;
342 }
343 return nWidth;
344}
345
346int SvLBoxItem::GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
347{
348 const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
349 return pViewData->mnHeight;
350}
351
352int SvLBoxItem::GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos) const
353{
354 const SvViewDataItem& rIData = pData->GetItem(nItemPos);
355 int nWidth = rIData.mnWidth;
356 if (nWidth == -1)
357 {
358 nWidth = CalcWidth(pView);
359 const_cast<SvViewDataItem&>(rIData).mnWidth = nWidth;
360 }
361 return nWidth;
362}
363
364int SvLBoxItem::GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos)
365{
366 const SvViewDataItem& rIData = pData->GetItem(nItemPos);
367 return rIData.mnHeight;
368}
369
370int SvLBoxItem::CalcWidth(const SvTreeListBox* /*pView*/) const
371{
372 return 0;
373}
374
376{
378
380
384};
385
387 Control(pParent, nWinStyle | WB_CLIPCHILDREN),
388 DropTargetHelper(this),
389 DragSourceHelper(this),
390 mpImpl(new SvTreeListBoxImpl(*this)),
391 mbContextBmpExpanded(false),
392 mbQuickSearch(false),
393 mbActivateOnSingleClick(false),
394 mbHoverSelection(false),
395 mbSelectingByHover(false),
396 mnClicksToToggle(0), //at default clicking on a row won't toggle its default checkbox
397 eSelMode(SelectionMode::NONE),
398 nMinWidthInChars(0),
399 mnDragAction(DND_ACTION_COPYMOVE | DND_ACTION_LINK),
400 mbCenterAndClipText(false)
401{
403 pTargetEntry = nullptr;
405 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
406 pHdlEntry = nullptr;
410
411 InitTreeView();
412 pImpl->SetModel( pModel.get() );
413
415}
416
418{
419 if (pModel)
420 pModel->Clear(); // Model calls SvTreeListBox::ModelHasCleared()
421}
422
424{
425 return CloneEntry(pEntry);
426}
427
428sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uInt32 nPos )
429{
430 sal_uInt32 nInsPos = pModel->Insert( pEntry, pParent, nPos );
431 return nInsPos;
432}
433
434sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos )
435{
436 sal_uInt32 nInsPos = pModel->Insert( pEntry, nRootPos );
437 return nInsPos;
438}
439
441{
442 return !aExpandingHdl.IsSet() || aExpandingHdl.Call( this );
443}
444
446{
447 aExpandedHdl.Call( this );
448}
449
451{
452 aSelectHdl.Call( this );
453}
454
456{
457 aDeselectHdl.Call( this );
458}
459
461{
462 return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this);
463}
464
466{
467 if ( pSource != this )
468 return false; // no drop
469
471 return false; // D&D locked within list
472
473 if( DND_ACTION_MOVE == nAction )
474 {
476 return false; // no local move
477 }
478 else
479 return false; // no local copy
480
481 return true;
482}
483
484
485/*
486 NotifyMoving/Copying
487 ====================
488
489 default behavior:
490
491 1. target doesn't have children
492 - entry becomes sibling of target. entry comes after target
493 (->Window: below the target)
494 2. target is an expanded parent
495 - entry inserted at the beginning of the target childlist
496 3. target is a collapsed parent
497 - entry is inserted at the end of the target childlist
498*/
500 SvTreeListEntry* pTarget, // D&D dropping position in GetModel()
501 const SvTreeListEntry* pEntry, // entry that we want to move, from
502 // GetSourceListBox()->GetModel()
503 SvTreeListEntry*& rpNewParent, // new target parent
504 sal_uInt32& rNewChildPos) // position in childlist of target parent
505{
506 DBG_ASSERT(pEntry,"NotifyMoving:SourceEntry?");
507 if( !pTarget )
508 {
509 rpNewParent = nullptr;
510 rNewChildPos = 0;
511 return TRISTATE_TRUE;
512 }
513 if ( !pTarget->HasChildren() && !pTarget->HasChildrenOnDemand() )
514 {
515 // case 1
516 rpNewParent = GetParent( pTarget );
517 rNewChildPos = SvTreeList::GetRelPos( pTarget ) + 1;
518 rNewChildPos += nCurEntrySelPos;
520 }
521 else
522 {
523 // cases 2 & 3
524 rpNewParent = pTarget;
525 if( IsExpanded(pTarget))
526 rNewChildPos = 0;
527 else
528 rNewChildPos = TREELIST_APPEND;
529 }
530 return TRISTATE_TRUE;
531}
532
534 SvTreeListEntry* pTarget, // D&D dropping position in GetModel()
535 const SvTreeListEntry* pEntry, // entry that we want to move, from
536 // GetSourceListBox()->GetModel()
537 SvTreeListEntry*& rpNewParent, // new target parent
538 sal_uInt32& rNewChildPos) // position in childlist of target parent
539{
540 return NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
541}
542
544{
545 return pModel->FirstChild(pParent);
546}
547
548// return: all entries copied
550{
551 nCurEntrySelPos = 0; // selection counter for NotifyMoving/Copying
552 bool bSuccess = true;
553 std::vector<SvTreeListEntry*> aList;
554 bool bClone = ( pSource->GetModel() != GetModel() );
555 Link<SvTreeListEntry*,SvTreeListEntry*> aCloneLink( pModel->GetCloneLink() );
556 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
557
558 // cache selection to simplify iterating over the selection when doing a D&D
559 // exchange within the same listbox
560 SvTreeListEntry* pSourceEntry = pSource->FirstSelected();
561 while ( pSourceEntry )
562 {
563 // children are copied automatically
564 pSource->SelectChildren( pSourceEntry, false );
565 aList.push_back( pSourceEntry );
566 pSourceEntry = pSource->NextSelected( pSourceEntry );
567 }
568
569 for (auto const& elem : aList)
570 {
571 pSourceEntry = elem;
572 SvTreeListEntry* pNewParent = nullptr;
573 sal_uInt32 nInsertionPos = TREELIST_APPEND;
574 TriState nOk = NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos);
575 if ( nOk )
576 {
577 if ( bClone )
578 {
579 sal_uInt32 nCloneCount = 0;
580 pSourceEntry = pModel->Clone(pSourceEntry, nCloneCount);
581 pModel->InsertTree(pSourceEntry, pNewParent, nInsertionPos);
582 }
583 else
584 {
585 sal_uInt32 nListPos = pModel->Copy(pSourceEntry, pNewParent, nInsertionPos);
586 pSourceEntry = GetEntry( pNewParent, nListPos );
587 }
588 }
589 else
590 bSuccess = false;
591
592 if (nOk == TRISTATE_INDET) // HACK: make visible moved entry
593 MakeVisible( pSourceEntry );
594 }
595 pModel->SetCloneLink( aCloneLink );
596 return bSuccess;
597}
598
599// return: all entries were moved
600bool SvTreeListBox::MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback )
601{
602 nCurEntrySelPos = 0; // selection counter for NotifyMoving/Copying
603 bool bSuccess = true;
604 std::vector<SvTreeListEntry*> aList;
605 bool bClone = ( pSource->GetModel() != GetModel() );
606 Link<SvTreeListEntry*,SvTreeListEntry*> aCloneLink( pModel->GetCloneLink() );
607 if ( bClone )
608 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
609
610 SvTreeListEntry* pSourceEntry = pSource->FirstSelected();
611 while ( pSourceEntry )
612 {
613 // children are automatically moved
614 pSource->SelectChildren( pSourceEntry, false );
615 aList.push_back( pSourceEntry );
616 pSourceEntry = pSource->NextSelected( pSourceEntry );
617 }
618
619 for (auto const& elem : aList)
620 {
621 pSourceEntry = elem;
622 SvTreeListEntry* pNewParent = nullptr;
623 sal_uInt32 nInsertionPos = TREELIST_APPEND;
624 TriState nOk = NotifyMoving(pTarget,pSourceEntry,pNewParent,nInsertionPos);
625 TriState nCopyOk = nOk;
626 if ( !nOk && bAllowCopyFallback )
627 {
628 nInsertionPos = TREELIST_APPEND;
629 nCopyOk = NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos);
630 }
631
632 if ( nOk || nCopyOk )
633 {
634 if ( bClone )
635 {
636 sal_uInt32 nCloneCount = 0;
637 pSourceEntry = pModel->Clone(pSourceEntry, nCloneCount);
638 pModel->InsertTree(pSourceEntry, pNewParent, nInsertionPos);
639 }
640 else
641 {
642 if ( nOk )
643 pModel->Move(pSourceEntry, pNewParent, nInsertionPos);
644 else
645 pModel->Copy(pSourceEntry, pNewParent, nInsertionPos);
646 }
647 }
648 else
649 bSuccess = false;
650
651 if (nOk == TRISTATE_INDET) // HACK: make moved entry visible
652 MakeVisible( pSourceEntry );
653 }
654 pModel->SetCloneLink( aCloneLink );
655 return bSuccess;
656}
657
659{
660 std::vector<const SvTreeListEntry*> aList;
661 // cache selection, as the implementation deselects everything on the first
662 // remove
663 SvTreeListEntry* pEntry = FirstSelected();
664 while ( pEntry )
665 {
666 aList.push_back( pEntry );
667 if ( pEntry->HasChildren() )
668 // remove deletes all children automatically
669 SelectChildren(pEntry, false);
670 pEntry = NextSelected( pEntry );
671 }
672
673 for (auto const& elem : aList)
674 pModel->Remove(elem);
675}
676
678{
679 pModel->Remove(pEntry);
680}
681
683{
684 SvTreeListEntry* pEntry = First();
685 while( pEntry )
686 {
687 sal_uInt16 nCount = pEntry->ItemCount();
688 sal_uInt16 nCurPos = 0;
689 while ( nCurPos < nCount )
690 {
691 SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
692 rItem.InitViewData( this, pEntry );
693 nCurPos++;
694 }
695 pEntry = Next( pEntry );
696 }
697}
698
700{
702 return;
703 if ( !bShow && !(nImpFlags & SvTreeListBoxFlags::TARGEMPH_VIS) )
704 return;
705 pImpl->PaintDDCursor( pEntry, bShow);
706 if( bShow )
708 else
710}
711
713{
714 if ( !mpImpl->m_bDoingQuickSelection )
715 mpImpl->m_aQuickSelectionEngine.Reset();
716}
717
718SvTreeListEntry* SvTreeListBox::GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const
719{
720 return pModel->GetEntry(pParent, nPos);
721}
722
723SvTreeListEntry* SvTreeListBox::GetEntry( sal_uInt32 nRootPos ) const
724{
725 return pModel->GetEntry(nRootPos);
726}
727
728SvTreeListEntry* SvTreeListBox::GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const
729{
730
731 SvTreeListEntry* pEntry = nullptr;
732 SvTreeListEntry* pParent = nullptr;
733 for (auto const& elem : _rPath)
734 {
735 pEntry = GetEntry( pParent, elem );
736 if ( !pEntry )
737 break;
738 pParent = pEntry;
739 }
740
741 return pEntry;
742}
743
744void SvTreeListBox::FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const
745{
746
747 if ( !pEntry )
748 return;
749
750 SvTreeListEntry* pParentEntry = GetParent( pEntry );
751 while ( true )
752 {
753 sal_uInt32 i, nCount = GetLevelChildCount( pParentEntry );
754 for ( i = 0; i < nCount; ++i )
755 {
756 SvTreeListEntry* pTemp = GetEntry( pParentEntry, i );
757 DBG_ASSERT( pEntry, "invalid entry" );
758 if ( pEntry == pTemp )
759 {
760 _rPath.push_front( static_cast<sal_Int32>(i) );
761 break;
762 }
763 }
764
765 if ( pParentEntry )
766 {
767 pEntry = pParentEntry;
768 pParentEntry = GetParent( pParentEntry );
769 }
770 else
771 break;
772 }
773}
774
776{
777 return pModel->GetParent(pEntry);
778}
779
780sal_uInt32 SvTreeListBox::GetChildCount( SvTreeListEntry const * pParent ) const
781{
782 return pModel->GetChildCount(pParent);
783}
784
786{
787
788 //if _pParent is 0, then pEntry is the first child of the root.
789 SvTreeListEntry* pEntry = FirstChild( _pParent );
790
791 if( !pEntry )//there is only root, root don't have children
792 return 0;
793
794 if( !_pParent )//root and children of root
795 return pEntry->pParent->m_Children.size();
796
797 return _pParent->m_Children.size();
798}
799
801{
802 return const_cast<SvViewDataEntry*>(SvListView::GetViewData(pEntry));
803}
804
806{
807 return const_cast<SvViewDataItem*>(static_cast<const SvTreeListBox*>(this)->GetViewDataItem(pEntry, pItem));
808}
809
811{
812 const SvViewDataEntry* pEntryData = SvListView::GetViewData(pEntry);
813 assert(pEntryData && "Entry not in View");
814 sal_uInt16 nItemPos = pEntry->GetPos(pItem);
815 return &pEntryData->GetItem(nItemPos);
816}
817
819{
820 SvTreeListEntry* pInhEntry = pEntry;
821 SvViewDataEntry* pEntryData = pData;
822
823 pEntryData->Init(pInhEntry->ItemCount());
824 sal_uInt16 nCount = pInhEntry->ItemCount();
825 sal_uInt16 nCurPos = 0;
826 while( nCurPos < nCount )
827 {
828 SvLBoxItem& rItem = pInhEntry->GetItem( nCurPos );
829 SvViewDataItem& rItemData = pEntryData->GetItem(nCurPos);
830 rItem.InitViewData( this, pInhEntry, &rItemData );
831 nCurPos++;
832 }
833}
834
836{
837 sal_uInt16 nRefDepth;
838 SvTreeListEntry* pTemp;
839
840 SvTreeListEntry* pSelEntry = FirstSelected();
841 while( pSelEntry )
842 {
843 if ( !bEnable )
844 {
846 nRefDepth = pModel->GetDepth( pSelEntry );
847 pTemp = Next( pSelEntry );
848 while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
849 {
851 pTemp = Next( pTemp );
852 }
853 }
854 else
855 {
857 nRefDepth = pModel->GetDepth( pSelEntry );
858 pTemp = Next( pSelEntry );
859 while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
860 {
862 pTemp = Next( pTemp );
863 }
864 }
865 pSelEntry = NextSelected( pSelEntry );
866 }
867}
868
869// ******************************************************************
870// InplaceEditing
871// ******************************************************************
872
874{
875 return pEdCtrl ? pEdCtrl->GetEditWidget() : nullptr;
876}
877
878void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect,
879 const Selection& rSel )
880{
881 pEdCtrl.reset();
884 HideFocus();
885 pEdCtrl.reset( new SvInplaceEdit2(
886 this, rRect.TopLeft(), rRect.GetSize(), rStr,
887 LINK( this, SvTreeListBox, TextEditEndedHdl_Impl ),
888 rSel ) );
889}
890
891IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl, SvInplaceEdit2&, void)
892{
893 if ( nImpFlags & SvTreeListBoxFlags::EDTEND_CALLED ) // avoid nesting
894 return;
896 OUString aStr;
897 if ( !pEdCtrl->EditingCanceled() )
898 aStr = pEdCtrl->GetText();
899 else
900 aStr = pEdCtrl->GetSavedValue();
901 EditedText( aStr );
902 // Hide may only be called after the new text was put into the entry, so
903 // that we don't call the selection handler in the GetFocus of the listbox
904 // with the old entry text.
905 pEdCtrl->Hide();
906 nImpFlags &= ~SvTreeListBoxFlags::IN_EDT;
907 GrabFocus();
908}
909
911{
912 if ( pEdCtrl )
913 pEdCtrl->StopEditing( true );
915}
916
917void SvTreeListBox::EndEditing( bool bCancel )
918{
919 if( pEdCtrl )
920 pEdCtrl->StopEditing( bCancel );
922}
923
925{
926 // always accept the current entry if there is one
927 SvTreeListEntry* pEntry( GetCurEntry() );
928 if (pEntry)
929 {
930 _out_entryText = GetEntryText(pEntry);
931 return pEntry;
932 }
933
934 pEntry = FirstSelected();
935 if ( !pEntry )
936 pEntry = First();
937
938 if ( pEntry )
939 _out_entryText = GetEntryText( pEntry );
940
941 return pEntry;
942}
943
944vcl::StringEntryIdentifier SvTreeListBox::NextEntry(vcl::StringEntryIdentifier _pCurrentSearchEntry, OUString& _out_entryText) const
945{
946 SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pCurrentSearchEntry ) );
947
948 if ( ( ( GetChildCount( pEntry ) > 0 )
949 || ( pEntry->HasChildrenOnDemand() )
950 )
951 && !IsExpanded( pEntry )
952 )
953 {
954 SvTreeListEntry* pNextSiblingEntry = pEntry->NextSibling();
955 if ( !pNextSiblingEntry )
956 pEntry = Next( pEntry );
957 else
958 pEntry = pNextSiblingEntry;
959 }
960 else
961 {
962 pEntry = Next( pEntry );
963 }
964
965 if ( !pEntry )
966 pEntry = First();
967
968 if ( pEntry )
969 _out_entryText = GetEntryText( pEntry );
970
971 return pEntry;
972}
973
975{
976 SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
977 DBG_ASSERT( pEntry, "SvTreeListBox::SelectSearchEntry: invalid entry!" );
978 if ( !pEntry )
979 return;
980
981 SelectAll( false );
982 SetCurEntry( pEntry );
983 Select( pEntry );
984}
985
987{
988 if ( _rKEvt.GetKeyCode().IsMod1() )
989 return false;
990
991 if (mbQuickSearch)
992 {
993 mpImpl->m_bDoingQuickSelection = true;
994 const bool bHandled = mpImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt );
995 mpImpl->m_bDoingQuickSelection = false;
996 if ( bHandled )
997 return true;
998 }
999
1000 return false;
1001}
1002
1003
1004//JP 28.3.2001: new Drag & Drop API
1006{
1008
1010 {
1012 }
1013 else if( nDragDropMode == DragDropMode::NONE )
1014 {
1015 SAL_WARN( "svtools.contnr", "SvTreeListBox::QueryDrop(): no target" );
1016 }
1017 else
1018 {
1019 SvTreeListEntry* pEntry = GetDropTarget( rEvt.maPosPixel );
1020 if( !IsDropFormatSupported( SotClipboardFormatId::TREELISTBOX ) )
1021 {
1022 SAL_WARN( "svtools.contnr", "SvTreeListBox::QueryDrop(): no format" );
1023 }
1024 else
1025 {
1026 DBG_ASSERT(g_pDDSource, "SvTreeListBox::QueryDrop(): SourceBox == 0");
1027 if (!( pEntry && g_pDDSource->GetModel() == GetModel()
1028 && DND_ACTION_MOVE == rEvt.mnAction
1030 {
1031 nRet = rEvt.mnAction;
1032 }
1033 }
1034
1035 // **** draw emphasis ****
1036 if( DND_ACTION_NONE == nRet )
1038 else if( pEntry != pTargetEntry || !(nImpFlags & SvTreeListBoxFlags::TARGEMPH_VIS) )
1039 {
1041 pTargetEntry = pEntry;
1043 }
1044 }
1045 return nRet;
1046}
1047
1049{
1050 assert(pSourceView);
1051 pSourceView->EnableSelectionAsDropTarget();
1052
1054 g_pDDTarget = this;
1055
1056 TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
1057
1058 sal_Int8 nRet;
1059 if( aData.HasFormat( SotClipboardFormatId::TREELISTBOX ))
1060 nRet = rEvt.mnAction;
1061 else
1062 nRet = DND_ACTION_NONE;
1063
1064 if( DND_ACTION_NONE != nRet )
1065 {
1066 nRet = DND_ACTION_NONE;
1067
1068 SvTreeListEntry* pTarget = pTargetEntry; // may be 0!
1069
1070 if( DND_ACTION_COPY == rEvt.mnAction )
1071 {
1072 if (CopySelection(g_pDDSource, pTarget))
1073 nRet = rEvt.mnAction;
1074 }
1075 else if( DND_ACTION_MOVE == rEvt.mnAction )
1076 {
1077 if (MoveSelectionCopyFallbackPossible( g_pDDSource, pTarget, false ))
1078 nRet = rEvt.mnAction;
1079 }
1080 else if( DND_ACTION_COPYMOVE == rEvt.mnAction )
1081 {
1083 nRet = rEvt.mnAction;
1084 }
1085 }
1086 return nRet;
1087}
1088
1090{
1091 return ExecuteDrop( rEvt, g_pDDSource );
1092}
1093
1099{
1100 g_pDDSource = this;
1101 g_pDDTarget = nullptr;
1102}
1103
1104void SvTreeListBox::StartDrag( sal_Int8, const Point& rPosPixel )
1105{
1106 if(!isDisposed())
1107 {
1108 // tdf#143114 do not start drag when a Button/Checkbox is in
1109 // drag-before-ButtonUp mode (CaptureMouse() active)
1110 if(pImpl->IsCaptureOnButtonActive())
1111 return;
1112 }
1113
1116 return;
1117
1118 ReleaseMouse();
1119
1120 SvTreeListEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos );
1121 if( !pEntry )
1122 {
1124 return;
1125 }
1126
1128
1129 if (!xContainer)
1130 {
1131 xContainer.set(new TransferDataContainer);
1132 // apparently some (unused) content is needed
1133 xContainer->CopyAnyData( SotClipboardFormatId::TREELISTBOX,
1134 "unused", SAL_N_ELEMENTS("unused") );
1135 }
1136
1139 {
1142 return;
1143 }
1144
1146
1147 bool bOldUpdateMode = Control::IsUpdateMode();
1148 Control::SetUpdateMode( true );
1150 Control::SetUpdateMode( bOldUpdateMode );
1151
1152 // Disallow using the selection and its children as drop targets.
1153 // Important: If the selection of the SourceListBox is changed in the
1154 // DropHandler, the entries have to be allowed as drop targets again:
1155 // (GetSourceListBox()->EnableSelectionAsDropTarget( true, true );)
1157
1158 xContainer->StartDrag(this, mnDragAction, GetDragFinishedHdl());
1159}
1160
1162{
1163 m_xTransferHelper = rHelper;
1164 mnDragAction = eDNDConstants;
1165}
1166
1168#ifndef UNX
1169nAction
1170#endif
1171)
1172{
1174
1175#ifndef UNX
1176 if ( (nAction == DND_ACTION_MOVE)
1177 && ( (g_pDDTarget && (g_pDDTarget->GetModel() != GetModel()))
1178 || !g_pDDTarget))
1179 {
1181 }
1182#endif
1183
1185 g_pDDSource = nullptr;
1186 g_pDDTarget = nullptr;
1188}
1189
1191{
1192 if (pTargetEntry)
1193 {
1195 pTargetEntry = nullptr;
1196 }
1197}
1198
1200{
1201 return DragDropMode(0xffff);
1202}
1203
1204// Handler and methods for Drag - finished handler.
1205// The with get GetDragFinishedHdl() get link can set on the
1206// TransferDataContainer. This link is a callback for the DragFinished
1207// call. AddBox method is called from the GetDragFinishedHdl() and the
1208// remove is called in link callback and in the destructor. So it can't
1209// called to a deleted object.
1210
1211namespace
1212{
1213 // void* to avoid loplugin:vclwidgets, we don't need ownership here
1214 std::set<const void*> gSortLBoxes;
1215}
1216
1218{
1219 gSortLBoxes.insert( &rB );
1220}
1221
1223{
1224 gSortLBoxes.erase( &rB );
1225}
1226
1227IMPL_LINK( SvTreeListBox, DragFinishHdl_Impl, sal_Int8, nAction, void )
1228{
1229 auto &rSortLBoxes = gSortLBoxes;
1230 auto it = rSortLBoxes.find(this);
1231 if( it != rSortLBoxes.end() )
1232 {
1233 DragFinished( nAction );
1234 rSortLBoxes.erase( it );
1235 }
1236}
1237
1239{
1240 AddBoxToDDList_Impl( *this );
1241 return LINK( const_cast<SvTreeListBox*>(this), SvTreeListBox, DragFinishHdl_Impl );
1242}
1243
1244/*
1245 Bugs/TODO
1246
1247 - calculate rectangle when editing in-place (bug with some fonts)
1248 - SetSpaceBetweenEntries: offset is not taken into account in SetEntryHeight
1249*/
1250
1251#define SV_LBOX_DEFAULT_INDENT_PIXEL 20
1252
1254{
1255 pCheckButtonData = nullptr;
1256 pEdEntry = nullptr;
1257 pEdItem = nullptr;
1258 nEntryHeight = 0;
1259 pEdCtrl = nullptr;
1260 nFirstSelTab = 0;
1261 nLastSelTab = 0;
1262 nFocusWidth = -1;
1264
1268 pImpl.reset( new SvImpLBox( this, GetModel(), GetStyle() ) );
1269
1270 mbContextBmpExpanded = true;
1272
1273 SetFont( GetFont() );
1275
1278 InitSettings();
1279 ImplInitStyle();
1280 SetTabs();
1281}
1282
1284{
1285 assert(pEntry);
1286 OUStringBuffer sRet;
1287
1288 sal_uInt16 nCount = pEntry->ItemCount();
1289 sal_uInt16 nCur = 0;
1290 while( nCur < nCount )
1291 {
1292 SvLBoxItem& rItem = pEntry->GetItem( nCur );
1293 if ( (rItem.GetType() == SvLBoxItemType::String) &&
1294 !static_cast<SvLBoxString&>( rItem ).GetText().isEmpty() )
1295 {
1296 sRet.append(static_cast<SvLBoxString&>( rItem ).GetText() + ",");
1297 }
1298 nCur++;
1299 }
1300
1301 if (!sRet.isEmpty())
1302 sRet.remove(sRet.getLength() - 1, 1);
1303 return sRet.makeStringAndClear();
1304}
1305
1307{
1308 disposeOnce();
1309}
1310
1312{
1313 if (IsMouseCaptured())
1314 ReleaseMouse();
1315
1316 if( pImpl )
1317 {
1318 pImpl->CallEventListeners( VclEventId::ObjectDying );
1319 pImpl.reset();
1320 }
1321 if( mpImpl )
1322 {
1323 ClearTabList();
1324
1325 pEdCtrl.reset();
1326
1328
1330
1331 if (this == g_pDDSource)
1332 g_pDDSource = nullptr;
1333 if (this == g_pDDTarget)
1334 g_pDDTarget = nullptr;
1335 mpImpl.reset();
1336 }
1337
1338 DropTargetHelper::dispose();
1339 DragSourceHelper::dispose();
1341}
1342
1344{
1345 pImpl->SetNoAutoCurEntry( b );
1346}
1347
1349{
1350 pImpl->m_bSubLstOpLR = true;
1351}
1352
1354{
1355 if( IsEditingActive() )
1356 EndEditing( true );
1357
1359
1360 pImpl->Resize();
1361 nFocusWidth = -1;
1362 pImpl->ShowCursor( false );
1363 pImpl->ShowCursor( true );
1364}
1365
1366/* Cases:
1367
1368 A) entries have bitmaps
1369 0. no buttons
1370 1. node buttons (can optionally also be on root items)
1371 2. node buttons (can optionally also be on root items) + CheckButton
1372 3. CheckButton
1373 B) entries don't have bitmaps (=>via WindowBits because of D&D!)
1374 0. no buttons
1375 1. node buttons (can optionally also be on root items)
1376 2. node buttons (can optionally also be on root items) + CheckButton
1377 3. CheckButton
1378*/
1379
1380#define NO_BUTTONS 0
1381#define NODE_BUTTONS 1
1382#define NODE_AND_CHECK_BUTTONS 2
1383#define CHECK_BUTTONS 3
1384
1385#define TABFLAGS_TEXT (SvLBoxTabFlags::DYNAMIC | \
1386 SvLBoxTabFlags::ADJUST_LEFT | \
1387 SvLBoxTabFlags::EDITABLE | \
1388 SvLBoxTabFlags::SHOW_SELECTION)
1389
1390#define TABFLAGS_CONTEXTBMP (SvLBoxTabFlags::DYNAMIC | SvLBoxTabFlags::ADJUST_CENTER)
1391
1392#define TABFLAGS_CHECKBTN (SvLBoxTabFlags::DYNAMIC | \
1393 SvLBoxTabFlags::ADJUST_CENTER)
1394
1395#define TAB_STARTPOS 2
1396
1397// take care of GetTextOffset when doing changes
1399{
1400 if( IsEditingActive() )
1401 EndEditing( true );
1403 nFocusWidth = -1;
1404 const WinBits nStyle( GetStyle() );
1405 bool bHasButtons = (nStyle & WB_HASBUTTONS)!=0;
1406 bool bHasButtonsAtRoot = (nStyle & (WB_HASLINESATROOT |
1408 tools::Long nStartPos = TAB_STARTPOS;
1409 tools::Long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
1410
1411 // pCheckButtonData->Width() knows nothing about the native checkbox width,
1412 // so we have mnCheckboxItemWidth which becomes valid when something is added.
1413 tools::Long nCheckWidth = 0;
1415 nCheckWidth = mnCheckboxItemWidth;
1416 tools::Long nCheckWidthDIV2 = nCheckWidth / 2;
1417
1418 tools::Long nContextWidth = nContextBmpWidthMax;
1419 tools::Long nContextWidthDIV2 = nContextWidth / 2;
1420
1421 ClearTabList();
1422
1423 int nCase = NO_BUTTONS;
1425 {
1426 if( bHasButtons )
1427 nCase = NODE_BUTTONS;
1428 }
1429 else
1430 {
1431 if( bHasButtons )
1432 nCase = NODE_AND_CHECK_BUTTONS;
1433 else
1434 nCase = CHECK_BUTTONS;
1435 }
1436
1437 switch( nCase )
1438 {
1439 case NO_BUTTONS :
1440 nStartPos += nContextWidthDIV2; // because of centering
1441 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1442 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1443 // only set a distance if there are bitmaps
1445 nStartPos += 5; // distance context bitmap to text
1446 AddTab( nStartPos, TABFLAGS_TEXT );
1447 break;
1448
1449 case NODE_BUTTONS :
1450 if( bHasButtonsAtRoot )
1451 nStartPos += ( nIndent + (nNodeWidthPixel/2) );
1452 else
1453 nStartPos += nContextWidthDIV2;
1454 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1455 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1456 // only set a distance if there are bitmaps
1458 nStartPos += 5; // distance context bitmap to text
1459 AddTab( nStartPos, TABFLAGS_TEXT );
1460 break;
1461
1463 if( bHasButtonsAtRoot )
1464 nStartPos += ( nIndent + nNodeWidthPixel );
1465 else
1466 nStartPos += nCheckWidthDIV2;
1467 AddTab( nStartPos, TABFLAGS_CHECKBTN );
1468 nStartPos += nCheckWidthDIV2; // right edge of CheckButton
1469 nStartPos += 3; // distance CheckButton to context bitmap
1470 nStartPos += nContextWidthDIV2; // center of context bitmap
1471 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1472 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1473 // only set a distance if there are bitmaps
1475 nStartPos += 5; // distance context bitmap to text
1476 AddTab( nStartPos, TABFLAGS_TEXT );
1477 break;
1478
1479 case CHECK_BUTTONS :
1480 nStartPos += nCheckWidthDIV2;
1481 AddTab( nStartPos, TABFLAGS_CHECKBTN );
1482 nStartPos += nCheckWidthDIV2; // right edge of CheckButton
1483 nStartPos += 3; // distance CheckButton to context bitmap
1484 nStartPos += nContextWidthDIV2; // center of context bitmap
1485 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1486 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1487 // only set a distance if there are bitmaps
1489 nStartPos += 5; // distance context bitmap to text
1490 AddTab( nStartPos, TABFLAGS_TEXT );
1491 break;
1492 }
1493 pImpl->NotifyTabsChanged();
1494}
1495
1497 const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp)
1498{
1500 {
1501 pEntry->AddItem(std::make_unique<SvLBoxButton>(pCheckButtonData));
1502 }
1503
1504 pEntry->AddItem(std::make_unique<SvLBoxContextBmp>( aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded));
1505
1506 pEntry->AddItem(std::make_unique<SvLBoxString>(aStr));
1507}
1508
1510{
1511 assert(pEntry);
1512 SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String));
1513 if (pItem) // There may be entries without text items, e.g. in IconView
1514 return pItem->GetText();
1515 return {};
1516}
1517
1519{
1520 assert(pEntry);
1521 const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
1522 assert(pItem);
1523 return pItem->GetBitmap2( );
1524}
1525
1527{
1528 assert(pEntry);
1529 const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
1530 assert(pItem);
1531 return pItem->GetBitmap1( );
1532}
1533
1534IMPL_LINK( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData, void )
1535{
1536 pHdlEntry = pData->GetActEntry();
1537 CheckButtonHdl();
1538}
1539
1541 const OUString& rText,
1542 SvTreeListEntry* pParent,
1543 bool bChildrenOnDemand, sal_uInt32 nPos,
1544 void* pUser
1545)
1546{
1548
1549 const Image& rDefExpBmp = pImpl->GetDefaultEntryExpBmp( );
1550 const Image& rDefColBmp = pImpl->GetDefaultEntryColBmp( );
1551
1552 aCurInsertedExpBmp = rDefExpBmp;
1553 aCurInsertedColBmp = rDefColBmp;
1554
1555 SvTreeListEntry* pEntry = new SvTreeListEntry;
1556 pEntry->SetUserData( pUser );
1557 InitEntry( pEntry, rText, rDefColBmp, rDefExpBmp );
1558 pEntry->EnableChildrenOnDemand( bChildrenOnDemand );
1559
1560 if( !pParent )
1561 Insert( pEntry, nPos );
1562 else
1563 Insert( pEntry, pParent, nPos );
1564
1565 aPrevInsertedExpBmp = rDefExpBmp;
1566 aPrevInsertedColBmp = rDefColBmp;
1567
1569
1570 return pEntry;
1571}
1572
1573void SvTreeListBox::SetEntryText(SvTreeListEntry* pEntry, const OUString& rStr)
1574{
1575 SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String));
1576 assert(pItem);
1577 pItem->SetText(rStr);
1578 pItem->InitViewData( this, pEntry );
1579 GetModel()->InvalidateEntry( pEntry );
1580}
1581
1583{
1585
1586 assert(pItem);
1587 pItem->SetBitmap2( aBmp );
1588
1590 CalcEntryHeight( pEntry );
1591 Size aSize = aBmp.GetSizePixel();
1592 short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) );
1593 if( nWidth > nContextBmpWidthMax )
1594 {
1595 nContextBmpWidthMax = nWidth;
1596 SetTabs();
1597 }
1598}
1599
1601{
1603
1604 assert(pItem);
1605 pItem->SetBitmap1( aBmp );
1606
1608 CalcEntryHeight( pEntry );
1609 Size aSize = aBmp.GetSizePixel();
1610 short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) );
1611 if( nWidth > nContextBmpWidthMax )
1612 {
1613 nContextBmpWidthMax = nWidth;
1614 SetTabs();
1615 }
1616}
1617
1619{
1620 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1621 if( pItem )
1622 {
1623 auto nWidth = pItem->GetWidth(this, pEntry);
1624 if( mnCheckboxItemWidth < nWidth )
1625 {
1626 mnCheckboxItemWidth = nWidth;
1628 }
1629 }
1630}
1631
1633{
1634
1635 SvTreeListEntry* pParent = pModel->GetParent( pEntry );
1636 if( pParent )
1637 {
1638 SvTLEntryFlags nFlags = pParent->GetFlags();
1640 pParent->SetFlags( nFlags );
1641 }
1642
1646 {
1647 Size aSize = GetCollapsedEntryBmp( pEntry ).GetSizePixel();
1648 if( aSize.Width() > nContextBmpWidthMax )
1649 {
1650 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1652 }
1653 aSize = GetExpandedEntryBmp( pEntry ).GetSizePixel();
1654 if( aSize.Width() > nContextBmpWidthMax )
1655 {
1656 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1658 }
1659 }
1660 CalcEntryHeight( pEntry );
1661
1663 return;
1664
1665 CheckBoxInserted(pEntry);
1666}
1667
1669{
1671 return;
1672
1673 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1674 if(!pItem)
1675 return ;
1676 switch( eState )
1677 {
1679 pItem->SetStateChecked();
1680 break;
1681
1683 pItem->SetStateUnchecked();
1684 break;
1685
1687 pItem->SetStateTristate();
1688 break;
1689 }
1690 InvalidateEntry( pEntry );
1691}
1692
1694{
1696 if( pEntry && ( nTreeFlags & SvTreeFlags::CHKBTN ) )
1697 {
1698 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1699 if(!pItem)
1701 SvItemStateFlags nButtonFlags = pItem->GetButtonFlags();
1702 eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags );
1703 }
1704 return eState;
1705}
1706
1708{
1709 if ( pCheckButtonData )
1710 pImpl->CallEventListeners( VclEventId::CheckboxToggle, static_cast<void*>(pCheckButtonData->GetActEntry()) );
1711}
1712
1713
1714// TODO: Currently all data is cloned so that they conform to the default tree
1715// view format. Actually, the model should be used as a reference here. This
1716// leads to us _not_ calling SvTreeListEntry::Clone, but only its base class
1717// SvTreeListEntry.
1718
1719
1721{
1722 OUString aStr;
1723 Image aCollEntryBmp;
1724 Image aExpEntryBmp;
1725
1726 SvLBoxString* pStringItem = static_cast<SvLBoxString*>(pSource->GetFirstItem(SvLBoxItemType::String));
1727 if( pStringItem )
1728 aStr = pStringItem->GetText();
1729 SvLBoxContextBmp* pBmpItem = static_cast<SvLBoxContextBmp*>(pSource->GetFirstItem(SvLBoxItemType::ContextBmp));
1730 if( pBmpItem )
1731 {
1732 aCollEntryBmp = pBmpItem->GetBitmap1( );
1733 aExpEntryBmp = pBmpItem->GetBitmap2( );
1734 }
1735 SvTreeListEntry* pClone = new SvTreeListEntry;
1736 InitEntry( pClone, aStr, aCollEntryBmp, aExpEntryBmp );
1737 pClone->SvTreeListEntry::Clone( pSource );
1738 pClone->EnableChildrenOnDemand( pSource->HasChildrenOnDemand() );
1739 pClone->SetUserData( pSource->GetUserData() );
1740
1741 return pClone;
1742}
1743
1745{
1746 return pImpl->GetDefaultEntryExpBmp( );
1747}
1748
1750{
1751 return pImpl->GetDefaultEntryColBmp( );
1752}
1753
1755{
1756 Size aSize = aBmp.GetSizePixel();
1757 if( aSize.Width() > nContextBmpWidthMax )
1758 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1759 SetTabs();
1760
1761 pImpl->SetDefaultEntryExpBmp( aBmp );
1762}
1763
1765{
1766 Size aSize = aBmp.GetSizePixel();
1767 if( aSize.Width() > nContextBmpWidthMax )
1768 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1769 SetTabs();
1770
1771 pImpl->SetDefaultEntryColBmp( aBmp );
1772}
1773
1775{
1776 if( !pData )
1778 else
1779 {
1782 pData->SetLink( LINK(this, SvTreeListBox, CheckButtonClick));
1783 }
1784
1785 SetTabs();
1786 if( IsUpdateMode() )
1787 Invalidate();
1788}
1789
1791{
1792 if ( pData )
1794}
1795
1797{
1799}
1800
1802{
1804}
1805
1807{
1810 SetTabs();
1811}
1812
1814{
1815 return true;
1816}
1817
1818bool SvTreeListBox::EditedEntry( SvTreeListEntry* /*pEntry*/,const OUString& /*rNewText*/)
1819{
1820 return true;
1821}
1822
1824{
1825 if (bOn)
1827 else
1829}
1830
1832{
1833 // under OS/2, we get key up/down even while editing
1834 if( IsEditingActive() )
1835 return;
1836
1837 if( !pImpl->KeyInput( rKEvt ) )
1838 {
1839 bool bHandled = HandleKeyInput( rKEvt );
1840 if ( !bHandled )
1841 Control::KeyInput( rKEvt );
1842 }
1843}
1844
1846{
1847 if( !pParent->HasChildren() )
1848 InsertEntry( "<dummy>", pParent );
1849}
1850
1852{
1853 //If there is no item in the tree, draw focus.
1854 if( !First())
1855 {
1856 Invalidate();
1857 }
1858 pImpl->GetFocus();
1860
1861 SvTreeListEntry* pEntry = FirstSelected();
1862 if ( !pEntry )
1863 {
1864 pEntry = pImpl->GetCurEntry();
1865 }
1866 if (pImpl->m_pCursor)
1867 {
1868 if (pEntry != pImpl->m_pCursor)
1869 pEntry = pImpl->m_pCursor;
1870 }
1871 if ( pEntry )
1872 pImpl->CallEventListeners( VclEventId::ListboxTreeFocus, pEntry );
1873
1874}
1875
1877{
1878 // If there is no item in the tree, delete visual focus.
1879 if ( !First() )
1880 Invalidate();
1881 if ( pImpl )
1882 pImpl->LoseFocus();
1884}
1885
1887{
1888 pImpl->m_pCursor = nullptr; // else we crash in GetFocus when editing in-place
1889 pTargetEntry = nullptr;
1890 pEdCtrl.reset();
1891 pImpl->Clear();
1892 nFocusWidth = -1;
1893
1897
1899 nEntryHeight = 0;
1903
1905}
1906
1907bool SvTreeListBox::PosOverBody(const Point& rPos) const
1908{
1909 if (rPos.X() < 0 || rPos.Y() < 0)
1910 return false;
1911 Size aSize(GetSizePixel());
1912 if (rPos.X() > aSize.Width() || rPos.Y() > aSize.Height())
1913 return false;
1914 if (pImpl->m_aVerSBar->IsVisible())
1915 {
1916 tools::Rectangle aRect(pImpl->m_aVerSBar->GetPosPixel(), pImpl->m_aVerSBar->GetSizePixel());
1917 if (aRect.Contains(rPos))
1918 return false;
1919 }
1920 if (pImpl->m_aHorSBar->IsVisible())
1921 {
1922 tools::Rectangle aRect(pImpl->m_aHorSBar->GetPosPixel(), pImpl->m_aHorSBar->GetSizePixel());
1923 if (aRect.Contains(rPos))
1924 return false;
1925 }
1926 return true;
1927}
1928
1929void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
1930{
1931 if( !nDeltaEntries || !pImpl->m_aVerSBar->IsVisible() )
1932 return;
1933
1934 tools::Long nThumb = pImpl->m_aVerSBar->GetThumbPos();
1935 tools::Long nMax = pImpl->m_aVerSBar->GetRange().Max();
1936
1937 if( nDeltaEntries < 0 )
1938 {
1939 // move window up
1940 nDeltaEntries *= -1;
1941 tools::Long nVis = pImpl->m_aVerSBar->GetVisibleSize();
1942 tools::Long nTemp = nThumb + nVis;
1943 if( nDeltaEntries > (nMax - nTemp) )
1944 nDeltaEntries = static_cast<short>(nMax - nTemp);
1945 pImpl->PageDown( static_cast<sal_uInt16>(nDeltaEntries) );
1946 }
1947 else
1948 {
1949 if( nDeltaEntries > nThumb )
1950 nDeltaEntries = static_cast<short>(nThumb);
1951 pImpl->PageUp( static_cast<sal_uInt16>(nDeltaEntries) );
1952 }
1953 pImpl->SyncVerThumb();
1954}
1955
1957{
1958 pImpl->ScrollToAbsPos( nPos );
1959}
1960
1962{
1963 eSelMode = eSelectMode;
1964 pImpl->SetSelectionMode( eSelectMode );
1965}
1966
1968{
1969 nDragDropMode = nDDMode;
1970 pImpl->SetDragDropMode( nDDMode );
1971}
1972
1974{
1975 short nHeightMax=0;
1976 sal_uInt16 nCount = pEntry->ItemCount();
1977 sal_uInt16 nCur = 0;
1978 SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
1979 while( nCur < nCount )
1980 {
1981 auto nHeight = SvLBoxItem::GetHeight(pViewData, nCur);
1982 if( nHeight > nHeightMax )
1983 nHeightMax = nHeight;
1984 nCur++;
1985 }
1986
1987 if( nHeightMax > nEntryHeight )
1988 {
1989 nEntryHeight = nHeightMax;
1991 pImpl->SetEntryHeight();
1992 }
1993}
1994
1996{
1997 if( nHeight > nEntryHeight )
1998 {
1999 nEntryHeight = nHeight;
2000 if( nEntryHeight )
2002 else
2005 pImpl->SetEntryHeight();
2006 }
2007}
2008
2010{
2011 nEntryWidth = nWidth;
2012}
2013
2015{
2016 const Size aSize( rBmp.GetSizePixel() );
2017 if( aSize.Height() > nEntryHeight )
2018 {
2019 nEntryHeight = static_cast<short>(aSize.Height()) + nEntryHeightOffs;
2020 pImpl->SetEntryHeight();
2021 }
2022}
2023
2025{
2026 tools::Long nHeight = GetTextHeight();
2027 if( nHeight > nEntryHeight )
2028 {
2029 nEntryHeight = static_cast<short>(nHeight) + nEntryHeightOffs;
2030 pImpl->SetEntryHeight();
2031 }
2032}
2033
2035{
2036 pHdlEntry = pParent;
2037 bool bExpanded = false;
2038 SvTLEntryFlags nFlags;
2039
2040 if( pParent->HasChildrenOnDemand() )
2041 RequestingChildren( pParent );
2042 bool bExpandAllowed = pParent->HasChildren() && ExpandingHdl();
2043 // double check if the expander callback ended up removing all children
2044 if (pParent->HasChildren())
2045 {
2046 if (bExpandAllowed)
2047 {
2048 bExpanded = true;
2049 ExpandListEntry( pParent );
2050 pImpl->EntryExpanded( pParent );
2051 pHdlEntry = pParent;
2052 ExpandedHdl();
2053 }
2054 nFlags = pParent->GetFlags();
2057 pParent->SetFlags( nFlags );
2058 }
2059 else
2060 {
2061 nFlags = pParent->GetFlags();
2063 pParent->SetFlags( nFlags );
2064 GetModel()->InvalidateEntry( pParent ); // repaint
2065 }
2066
2067 // #i92103#
2068 if ( bExpanded )
2069 {
2070 pImpl->CallEventListeners( VclEventId::ItemExpanded, pParent );
2071 }
2072
2073 return bExpanded;
2074}
2075
2077{
2078 pHdlEntry = pParent;
2079 bool bCollapsed = false;
2080
2081 if( ExpandingHdl() )
2082 {
2083 bCollapsed = true;
2084 pImpl->CollapsingEntry( pParent );
2085 CollapseListEntry( pParent );
2086 pImpl->EntryCollapsed( pParent );
2087 pHdlEntry = pParent;
2088 ExpandedHdl();
2089 }
2090
2091 // #i92103#
2092 if ( bCollapsed )
2093 {
2094 pImpl->CallEventListeners( VclEventId::ItemCollapsed, pParent );
2095 }
2096
2097 return bCollapsed;
2098}
2099
2100bool SvTreeListBox::Select( SvTreeListEntry* pEntry, bool bSelect )
2101{
2102 DBG_ASSERT(pEntry,"Select: Null-Ptr");
2103 bool bRetVal = SelectListEntry( pEntry, bSelect );
2104 DBG_ASSERT(IsSelected(pEntry)==bSelect,"Select failed");
2105 if( bRetVal )
2106 {
2107 pImpl->EntrySelected( pEntry, bSelect );
2108 pHdlEntry = pEntry;
2109 if( bSelect )
2110 {
2111 SelectHdl();
2113 }
2114 else
2115 DeselectHdl();
2116 }
2117 return bRetVal;
2118}
2119
2120sal_uInt32 SvTreeListBox::SelectChildren( SvTreeListEntry* pParent, bool bSelect )
2121{
2122 pImpl->DestroyAnchor();
2123 sal_uInt32 nRet = 0;
2124 if( !pParent->HasChildren() )
2125 return 0;
2126 sal_uInt16 nRefDepth = pModel->GetDepth( pParent );
2127 SvTreeListEntry* pChild = FirstChild( pParent );
2128 do {
2129 nRet++;
2130 Select( pChild, bSelect );
2131 pChild = Next( pChild );
2132 } while( pChild && pModel->GetDepth( pChild ) > nRefDepth );
2133 return nRet;
2134}
2135
2136void SvTreeListBox::SelectAll( bool bSelect )
2137{
2138 pImpl->SelAllDestrAnch(
2139 bSelect,
2140 true, // delete anchor,
2141 true ); // even when using SelectionMode::Single, deselect the cursor
2142}
2143
2145{
2146 sal_uInt16 nRefDepth = pModel->GetDepth( pEntry );
2147 SvTreeListEntry* pTmp = pEntry;
2148 do
2149 {
2150 ImpEntryInserted( pTmp );
2151 pTmp = Next( pTmp );
2152 } while( pTmp && nRefDepth < pModel->GetDepth( pTmp ) );
2153 pImpl->TreeInserted( pEntry );
2154}
2155
2157{
2158 ImpEntryInserted( pEntry );
2159 pImpl->EntryInserted( pEntry );
2160}
2161
2163{
2164 pImpl->MovingEntry( pSource );
2165}
2166
2168{
2169 pImpl->EntryMoved( pSource );
2170}
2171
2173{
2174 if(pEdEntry == pEntry)
2175 pEdEntry = nullptr;
2176
2177 pImpl->RemovingEntry( pEntry );
2178}
2179
2181{
2182 if (pEntry == pHdlEntry)
2183 pHdlEntry = nullptr;
2184
2185 if (pEntry == pTargetEntry)
2186 pTargetEntry = nullptr;
2187
2188 pImpl->EntryRemoved();
2189}
2190
2192{
2193 AdjustEntryHeight( rBmp );
2194 pImpl->SetCollapsedNodeBmp( rBmp );
2195}
2196
2198{
2199 AdjustEntryHeight( rBmp );
2200 pImpl->SetExpandedNodeBmp( rBmp );
2201}
2202
2203
2205{
2206 vcl::Font aTempFont( rFont );
2207 vcl::Font aOrigFont( GetFont() );
2208 aTempFont.SetTransparent( true );
2209 if (aTempFont == aOrigFont)
2210 return;
2211 Control::SetFont( aTempFont );
2212
2213 aTempFont.SetColor(aOrigFont.GetColor());
2214 aTempFont.SetFillColor(aOrigFont.GetFillColor());
2215 aTempFont.SetTransparent(aOrigFont.IsTransparent());
2216
2217 if (aTempFont == aOrigFont)
2218 return;
2219
2221}
2222
2224{
2226 // always invalidate, else things go wrong in SetEntryHeight
2228}
2229
2231{
2232 Control::Paint(rRenderContext, rRect);
2234 SetTabs();
2235 pImpl->Paint(rRenderContext, rRect);
2236
2237 //Add visual focus draw
2238 if (First())
2239 return;
2240
2241 if (HasFocus())
2242 {
2243 tools::Long nHeight = rRenderContext.GetTextHeight();
2244 tools::Rectangle aRect(Point(0, 0), Size(GetSizePixel().Width(), nHeight));
2245 ShowFocus(aRect);
2246 }
2247 else
2248 {
2249 HideFocus();
2250 }
2251}
2252
2254{
2255 // tdf#143114 remember the *correct* starting entry
2256 pImpl->m_pCursorOld = (rMEvt.IsLeft() && (nTreeFlags & SvTreeFlags::CHKBTN) && mnClicksToToggle > 0)
2257 ? GetEntry(rMEvt.GetPosPixel())
2258 : nullptr;
2259
2260 pImpl->MouseButtonDown( rMEvt );
2261}
2262
2264{
2265 // tdf#116675 clicking on an entry should toggle its checkbox
2266 // tdf#143114 use the already created starting entry and if it exists
2267 if (nullptr != pImpl->m_pCursorOld)
2268 {
2269 const Point aPnt = rMEvt.GetPosPixel();
2270 SvTreeListEntry* pEntry = GetEntry(aPnt);
2271
2272 // compare if MouseButtonUp *is* on the same entry, regardless of scrolling
2273 // or other things
2274 if (pEntry && pEntry->m_Items.size() > 0 && 1 == mnClicksToToggle && pEntry == pImpl->m_pCursorOld)
2275 {
2276 SvLBoxItem* pItem = GetItem(pEntry, aPnt.X());
2277 // if the checkbox button was clicked, that will be toggled later, do not toggle here
2278 // anyway users probably don't want to toggle the checkbox by clickink on another button
2279 if (!pItem || pItem->GetType() != SvLBoxItemType::Button)
2280 {
2281 SvLBoxButton* pItemCheckBox
2282 = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
2283 if (pItemCheckBox && pItemCheckBox->isEnable() && GetItemPos(pEntry, 0).first < aPnt.X() - GetMapMode().GetOrigin().X())
2284 {
2285 pItemCheckBox->ClickHdl(pEntry);
2286 InvalidateEntry(pEntry);
2287 }
2288 }
2289 }
2290 }
2291
2292 pImpl->MouseButtonUp( rMEvt );
2293}
2294
2296{
2297 pImpl->MouseMove( rMEvt );
2298}
2299
2301{
2302 pImpl->SetUpdateMode( bUpdate );
2303}
2304
2306{
2307 if( nOffsLogic != nEntryHeightOffs )
2308 {
2310 nEntryHeightOffs = nOffsLogic;
2311 nEntryHeight = nEntryHeight + nOffsLogic;
2313 pImpl->SetEntryHeight();
2314 }
2315}
2316
2318{
2319 pImpl->SetCurEntry( pEntry );
2320}
2321
2323{
2324 return pImpl->GetExpandedNodeBmp( );
2325}
2326
2328{
2329 return pImpl->GetEntryPosition( pEntry );
2330}
2331
2333{
2334 pImpl->MakeVisible(pEntry);
2335}
2336
2337void SvTreeListBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
2338{
2339 pImpl->MakeVisible( pEntry, bMoveToTop );
2340}
2341
2343{
2344
2345 // reinitialize the separate items of the entries
2346 sal_uInt16 nCount = pEntry->ItemCount();
2347 for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ )
2348 {
2349 SvLBoxItem& rItem = pEntry->GetItem( nIdx );
2350 rItem.InitViewData( this, pEntry );
2351 }
2352
2353 // repaint
2354 pImpl->InvalidateEntry( pEntry );
2355}
2356
2358{
2359 assert(pEntry && pItem);
2360 if( IsSelected( pEntry ))
2361 {
2362 pImpl->ShowCursor( false );
2363 SelectListEntry( pEntry, false );
2364 pImpl->InvalidateEntry(pEntry);
2365 SelectListEntry( pEntry, true );
2366 pImpl->ShowCursor( true );
2367 }
2368 pEdEntry = pEntry;
2369 pEdItem = pItem;
2370 SvLBoxTab* pTab = GetTab( pEntry, pItem );
2371 DBG_ASSERT(pTab,"EditItemText:Tab not found");
2372
2373 auto nItemHeight( pItem->GetHeight(this, pEntry) );
2374 Point aPos = GetEntryPosition( pEntry );
2375 aPos.AdjustY(( nEntryHeight - nItemHeight ) / 2 );
2376 aPos.setX( GetTabPos( pEntry, pTab ) );
2377 tools::Long nOutputWidth = pImpl->GetOutputSize().Width();
2378 Size aSize( nOutputWidth - aPos.X(), nItemHeight );
2379 sal_uInt16 nPos = std::find_if( aTabs.begin(), aTabs.end(),
2380 [pTab](const std::unique_ptr<SvLBoxTab>& p) { return p.get() == pTab; })
2381 - aTabs.begin();
2382 if( nPos+1 < static_cast<sal_uInt16>(aTabs.size()) )
2383 {
2384 SvLBoxTab* pRightTab = aTabs[ nPos + 1 ].get();
2385 tools::Long nRight = GetTabPos( pEntry, pRightTab );
2386 if( nRight <= nOutputWidth )
2387 aSize.setWidth( nRight - aPos.X() );
2388 }
2389 Point aOrigin( GetMapMode().GetOrigin() );
2390 aPos += aOrigin; // convert to win coordinates
2391 aSize.AdjustWidth( -(aOrigin.X()) );
2392 tools::Rectangle aRect( aPos, aSize );
2393 EditText( pItem->GetText(), aRect, rSelection );
2394}
2395
2397{
2398 pImpl->m_aEditClickPos = Point( -1, -1 );
2399 ImplEditEntry( pEntry );
2400}
2401
2403{
2404 if( IsEditingActive() )
2405 EndEditing();
2406 if( !pEntry )
2407 pEntry = GetCurEntry();
2408 if( !pEntry )
2409 return;
2410
2411 tools::Long nClickX = pImpl->m_aEditClickPos.X();
2412 bool bIsMouseTriggered = nClickX >= 0;
2413
2414 SvLBoxString* pItem = nullptr;
2415 sal_uInt16 nCount = pEntry->ItemCount();
2416 tools::Long nTabPos, nNextTabPos = 0;
2417 for( sal_uInt16 i = 0 ; i < nCount ; i++ )
2418 {
2419 SvLBoxItem& rTmpItem = pEntry->GetItem( i );
2420 if (rTmpItem.GetType() != SvLBoxItemType::String)
2421 continue;
2422
2423 SvLBoxTab* pTab = GetTab( pEntry, &rTmpItem );
2424 nNextTabPos = -1;
2425 if( i < nCount - 1 )
2426 {
2427 SvLBoxItem& rNextItem = pEntry->GetItem( i + 1 );
2428 SvLBoxTab* pNextTab = GetTab( pEntry, &rNextItem );
2429 nNextTabPos = pNextTab->GetPos();
2430 }
2431
2432 if( pTab && pTab->IsEditable() )
2433 {
2434 nTabPos = pTab->GetPos();
2435 if( !bIsMouseTriggered || (nClickX > nTabPos && (nNextTabPos == -1 || nClickX < nNextTabPos ) ) )
2436 {
2437 pItem = static_cast<SvLBoxString*>( &rTmpItem );
2438 break;
2439 }
2440 }
2441 }
2442
2443 if( pItem && EditingEntry( pEntry ) )
2444 {
2446 SelectAll( false );
2447 MakeVisible( pEntry );
2448 EditItemText( pEntry, pItem, aSel );
2449 }
2450}
2451
2452void SvTreeListBox::EditedText( const OUString& rStr )
2453
2454{
2455 if(pEdEntry) // we have to check if this entry is null that means that it is removed while editing
2456 {
2457 if( EditedEntry( pEdEntry, rStr ) )
2458 {
2459 static_cast<SvLBoxString*>(pEdItem)->SetText( rStr );
2460 pModel->InvalidateEntry( pEdEntry );
2461 }
2462 if( GetSelectionCount() == 0 )
2463 Select( pEdEntry );
2466 }
2467}
2468
2470{
2471 // scroll
2472 if( rPos.Y() < 12 )
2473 {
2475 ScrollOutputArea( +1 );
2476 }
2477 else
2478 {
2479 Size aSize( pImpl->GetOutputSize() );
2480 if( rPos.Y() > aSize.Height() - 12 )
2481 {
2483 ScrollOutputArea( -1 );
2484 }
2485 }
2486
2487 SvTreeListEntry* pTarget = pImpl->GetEntry( rPos );
2488 // when dropping in a vacant space, use the last entry
2489 if( !pTarget )
2490 return LastVisible();
2492 pTarget == First() && rPos.Y() < 6 )
2493 return nullptr;
2494
2495 return pTarget;
2496}
2497
2498
2499SvTreeListEntry* SvTreeListBox::GetEntry( const Point& rPos, bool bHit ) const
2500{
2501 SvTreeListEntry* pEntry = pImpl->GetEntry( rPos );
2502 if( pEntry && bHit )
2503 {
2504 tools::Long nLine = pImpl->GetEntryLine( pEntry );
2505 if( !(pImpl->EntryReallyHit( pEntry, rPos, nLine)) )
2506 return nullptr;
2507 }
2508 return pEntry;
2509}
2510
2512{
2513 return pImpl ? pImpl->GetCurEntry() : nullptr;
2514}
2515
2517{
2518 const WinBits nWindowStyle = GetStyle();
2519
2521 if (nWindowStyle & WB_SORT)
2522 {
2525 }
2526 else
2527 {
2530 }
2531 pImpl->SetStyle(nWindowStyle);
2532 pImpl->Resize();
2533 Invalidate();
2534}
2535
2537{
2538 DBG_ASSERT(pEntry,"InvalidateEntry:No Entry");
2539 if (pEntry)
2540 {
2541 GetModel()->InvalidateEntry(pEntry);
2542 }
2543}
2544
2546{
2547 tools::Rectangle aRect; // multi purpose
2548
2549 bool bHorSBar = pImpl->HasHorScrollBar();
2550
2551 pImpl->UpdateContextBmpWidthMax(&rEntry);
2552
2554 SetTabs();
2555
2556 short nTempEntryHeight = GetEntryHeight();
2557 tools::Long nWidth = pImpl->GetOutputSize().Width();
2558
2559 // Did we turn on the scrollbar within PreparePaints? If yes, we have to set
2560 // the ClipRegion anew.
2561 if (!bHorSBar && pImpl->HasHorScrollBar())
2562 rRenderContext.SetClipRegion(vcl::Region(pImpl->GetClipRegionRect()));
2563
2564 Point aEntryPos(rRenderContext.GetMapMode().GetOrigin());
2565 aEntryPos.setX( aEntryPos.X() * -1 ); // conversion document coordinates
2566 tools::Long nMaxRight = nWidth + aEntryPos.X() - 1;
2567
2568 Color aBackupTextColor(rRenderContext.GetTextColor());
2569 vcl::Font aBackupFont(rRenderContext.GetFont());
2570 Color aBackupColor = rRenderContext.GetFillColor();
2571
2572 bool bCurFontIsSel = false;
2573 // if a ClipRegion was set from outside, we don't have to reset it
2574 const WinBits nWindowStyle = GetStyle();
2575 const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) !=0 && !HasFocus();
2576 const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
2577
2578 vcl::Font aHighlightFont(rRenderContext.GetFont());
2579 const Color aHighlightTextColor(rSettings.GetHighlightTextColor());
2580 aHighlightFont.SetColor(aHighlightTextColor);
2581
2582 Size aRectSize(0, nTempEntryHeight);
2583
2584 SvViewDataEntry* pViewDataEntry = GetViewDataEntry( &rEntry );
2585 const bool bSeparator(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
2586
2587 const size_t nTabCount = aTabs.size();
2588 const size_t nItemCount = rEntry.ItemCount();
2589 size_t nCurTab = 0;
2590 size_t nCurItem = 0;
2591
2592 while (nCurTab < nTabCount && nCurItem < nItemCount)
2593 {
2594 SvLBoxTab* pTab = aTabs[nCurTab].get();
2595 const size_t nNextTab = nCurTab + 1;
2596 SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2597 SvLBoxItem& rItem = rEntry.GetItem(nCurItem);
2598
2599 SvLBoxTabFlags nFlags = pTab->nFlags;
2600 Size aSize(rItem.GetWidth(this, pViewDataEntry, nCurItem),
2601 SvLBoxItem::GetHeight(pViewDataEntry, nCurItem));
2602 tools::Long nTabPos = GetTabPos(&rEntry, pTab);
2603
2604 tools::Long nNextTabPos;
2605 if (pNextTab)
2606 nNextTabPos = GetTabPos(&rEntry, pNextTab);
2607 else
2608 {
2609 nNextTabPos = nMaxRight;
2610 if (nTabPos > nMaxRight)
2611 nNextTabPos += 50;
2612 }
2613
2614 tools::Long nX;
2616 // avoid cutting the right edge off the tab separation
2617 nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos - SV_TAB_BORDER - 1) - nTabPos);
2618 else
2619 nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos);
2620
2621 aEntryPos.setX( nX );
2622 aEntryPos.setY( nLine );
2623
2624 // set background pattern/color
2625
2626 Wallpaper aWallpaper = rRenderContext.GetBackground();
2627
2628 bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION);
2629
2630 if (pViewDataEntry->IsHighlighted() && bSelTab)
2631 {
2632 Color aNewWallColor = rSettings.GetHighlightColor();
2633 // if the face color is bright then the deactivate color is also bright
2634 // -> so you can't see any deactivate selection
2635 if (bHideSelection && !rSettings.GetFaceColor().IsBright()
2636 && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright())
2637 {
2638 aNewWallColor = rSettings.GetDeactiveColor();
2639 }
2640 // set font color to highlight
2641 if (!bCurFontIsSel)
2642 {
2643 rRenderContext.SetTextColor(aHighlightTextColor);
2644 rRenderContext.SetFont(aHighlightFont);
2645 bCurFontIsSel = true;
2646 }
2647 aWallpaper.SetColor(aNewWallColor);
2648 }
2649 else // no selection
2650 {
2651 if (bCurFontIsSel || rEntry.GetTextColor())
2652 {
2653 bCurFontIsSel = false;
2654 if (const auto & xCustomTextColor = rEntry.GetTextColor())
2655 rRenderContext.SetTextColor(*xCustomTextColor);
2656 else
2657 rRenderContext.SetTextColor(aBackupTextColor);
2658 rRenderContext.SetFont(aBackupFont);
2659 }
2660 }
2661
2662 // draw background
2664 {
2665 // only draw the area that is used by the item
2666 aRectSize.setWidth( aSize.Width() );
2667 aRect.SetPos(aEntryPos);
2668 aRect.SetSize(aRectSize);
2669 }
2670 else
2671 {
2672 // draw from the current to the next tab
2673 if (nCurTab != 0)
2674 aRect.SetLeft( nTabPos );
2675 else
2676 // if we're in the 0th tab, always draw from column 0 --
2677 // else we get problems with centered tabs
2678 aRect.SetLeft( 0 );
2679 aRect.SetTop( nLine );
2680 aRect.SetBottom( nLine + nTempEntryHeight - 1 );
2681 if (pNextTab)
2682 {
2683 tools::Long nRight;
2684 nRight = GetTabPos(&rEntry, pNextTab) - 1;
2685 if (nRight > nMaxRight)
2686 nRight = nMaxRight;
2687 aRect.SetRight( nRight );
2688 }
2689 else
2690 {
2691 aRect.SetRight( nMaxRight );
2692 }
2693 }
2694 // A custom selection that starts at a tab position > 0, do not fill
2695 // the background of the 0th item, else e.g. we might not be able to
2696 // realize tab listboxes with lines.
2697 if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
2698 {
2699 Color aBackgroundColor = aWallpaper.GetColor();
2700 if (aBackgroundColor != COL_TRANSPARENT)
2701 {
2702 rRenderContext.SetFillColor(aBackgroundColor);
2703 // this case may occur for smaller horizontal resizes
2704 if (aRect.Left() < aRect.Right())
2705 rRenderContext.DrawRect(aRect);
2706 }
2707 }
2708 // draw item
2709 // center vertically
2710 aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
2711
2712 rItem.Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry);
2713
2714 // division line between tabs (but not if this is a separator line)
2715 if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String &&
2716 // not at the right edge of the window!
2717 aRect.Right() < nMaxRight)
2718 {
2719 aRect.SetLeft( aRect.Right() - SV_TAB_BORDER );
2720 rRenderContext.DrawRect(aRect);
2721 }
2722
2723 rRenderContext.SetFillColor(aBackupColor);
2724
2725 nCurItem++;
2726 nCurTab++;
2727 }
2728
2729 if (pViewDataEntry->IsDragTarget())
2730 {
2731 rRenderContext.Push();
2732 rRenderContext.SetLineColor(rSettings.GetDeactiveColor());
2733 rRenderContext.SetFillColor(rSettings.GetDeactiveColor());
2734
2735 const bool bAsTree = GetStyle() & (WB_HASLINES | WB_HASLINESATROOT);
2736 if (bAsTree)
2737 {
2738 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine + nTempEntryHeight - 2), Size(nWidth, 2)));
2739 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2)));
2740 }
2741 else
2742 {
2743 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2)));
2744 }
2745
2746 rRenderContext.Pop();
2747 }
2748
2749 if (bCurFontIsSel || rEntry.GetTextColor())
2750 {
2751 rRenderContext.SetTextColor(aBackupTextColor);
2752 rRenderContext.SetFont(aBackupFont);
2753 }
2754
2755 sal_uInt16 nFirstDynTabPos(0);
2756 SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab(nFirstDynTabPos);
2757 tools::Long nDynTabPos = GetTabPos(&rEntry, pFirstDynamicTab);
2758 nDynTabPos += pImpl->m_nNodeBmpTabDistance;
2759 nDynTabPos += pImpl->m_nNodeBmpWidth / 2;
2760 nDynTabPos += 4; // 4 pixels of buffer, so the node bitmap is not too close
2761 // to the next tab
2762
2763 if( !((!(rEntry.GetFlags() & SvTLEntryFlags::NO_NODEBMP)) &&
2764 (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab &&
2765 (rEntry.HasChildren() || rEntry.HasChildrenOnDemand())))
2766 return;
2767
2768 // find first tab and check if the node bitmap extends into it
2769 sal_uInt16 nNextTab = nFirstDynTabPos;
2770 SvLBoxTab* pNextTab;
2771 do
2772 {
2773 nNextTab++;
2774 pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2775 } while (pNextTab && pNextTab->IsDynamic());
2776
2777 if (pNextTab && (GetTabPos( &rEntry, pNextTab ) <= nDynTabPos))
2778 return;
2779
2780 if (!((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(&rEntry) > 0))
2781 return;
2782
2783 Point aPos(GetTabPos(&rEntry, pFirstDynamicTab), nLine);
2784 aPos.AdjustX(pImpl->m_nNodeBmpTabDistance );
2785
2786 const Image* pImg = nullptr;
2787
2788 const bool bExpanded = IsExpanded(&rEntry);
2789 if (bExpanded)
2790 pImg = &pImpl->GetExpandedNodeBmp();
2791 else
2792 pImg = &pImpl->GetCollapsedNodeBmp();
2793 const bool bDefaultImage = bExpanded ? *pImg == GetDefaultExpandedNodeImage()
2794 : *pImg == GetDefaultCollapsedNodeImage();
2795 aPos.AdjustY((nTempEntryHeight - pImg->GetSizePixel().Height()) / 2 );
2796
2797 if (!bDefaultImage)
2798 {
2799 // If it's a custom image then draw what was explicitly set to use
2801 if (!IsEnabled())
2802 nStyle |= DrawImageFlags::Disable;
2803 rRenderContext.DrawImage(aPos, *pImg, nStyle);
2804 }
2805 else
2806 {
2807 bool bNativeOK = false;
2808 // native
2810 {
2811 ImplControlValue aControlValue;
2812 tools::Rectangle aCtrlRegion(aPos, pImg->GetSizePixel());
2814
2815 if (IsEnabled())
2817
2818 if (bExpanded)
2819 aControlValue.setTristateVal(ButtonValue::On); //expanded node
2820 else
2821 {
2822 if ((!rEntry.HasChildren()) && rEntry.HasChildrenOnDemand() &&
2823 (!(rEntry.GetFlags() & SvTLEntryFlags::HAD_CHILDREN)))
2824 {
2825 aControlValue.setTristateVal( ButtonValue::DontKnow ); //don't know
2826 }
2827 else
2828 {
2829 aControlValue.setTristateVal( ButtonValue::Off ); //collapsed node
2830 }
2831 }
2832
2833 bNativeOK = rRenderContext.DrawNativeControl(ControlType::ListNode, ControlPart::Entire, aCtrlRegion, nState, aControlValue, OUString());
2834 }
2835 if (!bNativeOK)
2836 {
2837 DecorationView aDecoView(&rRenderContext);
2839 if (!IsEnabled())
2840 nSymbolStyle |= DrawSymbolFlags::Disable;
2841
2842 Color aCol = aBackupTextColor;
2843 if (pViewDataEntry->IsHighlighted())
2844 aCol = aHighlightTextColor;
2845
2847 aDecoView.DrawSymbol(tools::Rectangle(aPos, pImg->GetSizePixel()), eSymbol, aCol, nSymbolStyle);
2848 }
2849 }
2850}
2851
2853{
2854 aCustomRenderHdl.Call(std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&>(rRenderContext, rRect, rEntry));
2855}
2856
2858{
2859 return aCustomMeasureHdl.Call(std::pair<vcl::RenderContext&, const SvTreeListEntry&>(rRenderContext, rEntry));
2860}
2861
2863{
2864 pImpl->UpdateContextBmpWidthMax( pEntry );
2865
2866 Size aSize;
2867 tools::Rectangle aRect;
2868 aRect.SetTop( nLine );
2869 aSize.setHeight( GetEntryHeight() );
2870
2871 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2872 nRealWidth -= GetMapMode().GetOrigin().X();
2873
2874 sal_uInt16 nCurTab;
2876 tools::Long nTabPos = 0;
2877 if( pTab )
2878 nTabPos = GetTabPos( pEntry, pTab );
2879 tools::Long nNextTabPos;
2880 if( pTab && nCurTab < aTabs.size() - 1 )
2881 {
2882 SvLBoxTab* pNextTab = aTabs[ nCurTab + 1 ].get();
2883 nNextTabPos = GetTabPos( pEntry, pNextTab );
2884 }
2885 else
2886 {
2887 nNextTabPos = nRealWidth;
2888 if( nTabPos > nRealWidth )
2889 nNextTabPos += 50;
2890 }
2891
2892 bool bUserSelection = bool( nTreeFlags & SvTreeFlags::USESEL );
2893 if( !bUserSelection )
2894 {
2895 if( pTab && nCurTab < pEntry->ItemCount() )
2896 {
2897 const SvLBoxItem& rItem = pEntry->GetItem( nCurTab );
2898 aSize.setWidth(rItem.GetWidth(this, pEntry));
2899 if( !aSize.Width() )
2900 aSize.setWidth( 15 );
2901 tools::Long nX = nTabPos; //GetTabPos( pEntry, pTab );
2902 // alignment
2903 nX += pTab->CalcOffset( aSize.Width(), nNextTabPos - nTabPos );
2904 aRect.SetLeft( nX );
2905 // make sure that first and last letter aren't cut off slightly
2906 aRect.SetSize( aSize );
2907 if( aRect.Left() > 0 )
2908 aRect.AdjustLeft( -1 );
2909 aRect.AdjustRight( 1 );
2910 }
2911 }
2912 else
2913 {
2914 // if SelTab != 0, we have to calculate also
2915 if( nFocusWidth == -1 || nFirstSelTab )
2916 {
2917 SvLBoxTab* pLastTab = nullptr; // default to select whole width
2918
2919 sal_uInt16 nLastTab;
2921 nLastTab++;
2922 if( nLastTab < aTabs.size() ) // is there another one?
2923 pLastTab = aTabs[ nLastTab ].get();
2924
2925 aSize.setWidth( pLastTab ? pLastTab->GetPos() : 0x0fffffff );
2926 nFocusWidth = static_cast<short>(aSize.Width());
2927 if( pTab )
2928 nFocusWidth = nFocusWidth - static_cast<short>(nTabPos); //pTab->GetPos();
2929 }
2930 else
2931 {
2932 aSize.setWidth( nFocusWidth );
2933 if( pTab )
2934 {
2935 if( nCurTab )
2936 aSize.AdjustWidth(nTabPos );
2937 else
2938 aSize.AdjustWidth(pTab->GetPos() ); // Tab0 always from the leftmost position
2939 }
2940 }
2941 // if selection starts with 0th tab, draw from column 0 on
2942 if( nCurTab != 0 )
2943 {
2944 aRect.SetLeft( nTabPos );
2945 aSize.AdjustWidth( -nTabPos );
2946 }
2947 aRect.SetSize( aSize );
2948 }
2949 // adjust right edge because of clipping
2950 if( aRect.Right() >= nRealWidth )
2951 {
2952 aRect.SetRight( nRealWidth-1 );
2953 nFocusWidth = static_cast<short>(aRect.GetWidth());
2954 }
2955 return aRect;
2956}
2957
2958sal_IntPtr SvTreeListBox::GetTabPos(const SvTreeListEntry* pEntry, const SvLBoxTab* pTab) const
2959{
2960 assert(pTab);
2961 sal_IntPtr nPos = pTab->GetPos();
2962 if( pTab->IsDynamic() )
2963 {
2964 sal_uInt16 nDepth = pModel->GetDepth( pEntry );
2965 nDepth = nDepth * static_cast<sal_uInt16>(nIndent);
2966 nPos += static_cast<sal_IntPtr>(nDepth);
2967 }
2968 return nPos + (pEntry->GetExtraIndent() * nIndent);
2969}
2970
2972 SvLBoxTab** ppTab )
2973{
2974 SvLBoxItem* pItemClicked = nullptr;
2975 sal_uInt16 nTabCount = aTabs.size();
2976 sal_uInt16 nItemCount = pEntry->ItemCount();
2977 SvLBoxTab* pTab = aTabs.front().get();
2978 SvLBoxItem* pItem = &pEntry->GetItem(0);
2979 sal_uInt16 nNextItem = 1;
2980 nX -= GetMapMode().GetOrigin().X();
2981 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2982 nRealWidth -= GetMapMode().GetOrigin().X();
2983
2984 while( true )
2985 {
2986 SvLBoxTab* pNextTab=nNextItem<nTabCount ? aTabs[nNextItem].get() : nullptr;
2987 tools::Long nStart = GetTabPos( pEntry, pTab );
2988
2989 tools::Long nNextTabPos;
2990 if( pNextTab )
2991 nNextTabPos = GetTabPos( pEntry, pNextTab );
2992 else
2993 {
2994 nNextTabPos = nRealWidth;
2995 if( nStart > nRealWidth )
2996 nNextTabPos += 50;
2997 }
2998
2999 auto nItemWidth(pItem->GetWidth(this, pEntry));
3000 nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
3001 auto nLen = nItemWidth;
3002 if( pNextTab )
3003 {
3004 tools::Long nTabWidth = GetTabPos( pEntry, pNextTab ) - nStart;
3005 if( nTabWidth < nLen )
3006 nLen = nTabWidth;
3007 }
3008
3009 if( nX >= nStart && nX < (nStart+nLen ) )
3010 {
3011 pItemClicked = pItem;
3012 if( ppTab )
3013 {
3014 *ppTab = pTab;
3015 break;
3016 }
3017 }
3018 if( nNextItem >= nItemCount || nNextItem >= nTabCount)
3019 break;
3020 pTab = aTabs[ nNextItem ].get();
3021 pItem = &pEntry->GetItem( nNextItem );
3022 nNextItem++;
3023 }
3024 return pItemClicked;
3025}
3026
3027std::pair<tools::Long, tools::Long> SvTreeListBox::GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx)
3028{
3029 sal_uInt16 nTabCount = aTabs.size();
3030 sal_uInt16 nItemCount = pEntry->ItemCount();
3031 if (nTabIdx >= nItemCount || nTabIdx >= nTabCount)
3032 return std::make_pair(-1, -1);
3033
3034 SvLBoxTab* pTab = aTabs.front().get();
3035 SvLBoxItem* pItem = &pEntry->GetItem(nTabIdx);
3036 sal_uInt16 nNextItem = nTabIdx + 1;
3037
3038 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
3039 nRealWidth -= GetMapMode().GetOrigin().X();
3040
3041 SvLBoxTab* pNextTab = nNextItem < nTabCount ? aTabs[nNextItem].get() : nullptr;
3042 tools::Long nStart = GetTabPos(pEntry, pTab);
3043
3044 tools::Long nNextTabPos;
3045 if (pNextTab)
3046 nNextTabPos = GetTabPos(pEntry, pNextTab);
3047 else
3048 {
3049 nNextTabPos = nRealWidth;
3050 if (nStart > nRealWidth)
3051 nNextTabPos += 50;
3052 }
3053
3054 auto nItemWidth(pItem->GetWidth(this, pEntry));
3055 nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
3056 auto nLen = nItemWidth;
3057 if (pNextTab)
3058 {
3059 tools::Long nTabWidth = GetTabPos(pEntry, pNextTab) - nStart;
3060 if (nTabWidth < nLen)
3061 nLen = nTabWidth;
3062 }
3063 return std::make_pair(nStart, nLen);
3064}
3065
3066tools::Long SvTreeListBox::getPreferredDimensions(std::vector<tools::Long> &rWidths) const
3067{
3068 tools::Long nHeight = 0;
3069 rWidths.clear();
3070 SvTreeListEntry* pEntry = First();
3071 while (pEntry)
3072 {
3073 sal_uInt16 nCount = pEntry->ItemCount();
3074 sal_uInt16 nCurPos = 0;
3075 if (nCount > rWidths.size())
3076 rWidths.resize(nCount);
3077 while (nCurPos < nCount)
3078 {
3079 SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
3080 auto nWidth = rItem.GetWidth(this, pEntry);
3081 if (nWidth)
3082 {
3083 nWidth += SV_TAB_BORDER * 2;
3084 if (nWidth > rWidths[nCurPos])
3085 rWidths[nCurPos] = nWidth;
3086 }
3087 ++nCurPos;
3088 }
3089 pEntry = Next( pEntry );
3090 nHeight += GetEntryHeight();
3091 }
3092 return nHeight;
3093}
3094
3096{
3097 std::vector<tools::Long> aWidths;
3098 Size aRet(0, getPreferredDimensions(aWidths));
3099 for (tools::Long aWidth : aWidths)
3100 aRet.AdjustWidth(aWidth );
3101
3102 sal_Int32 nLeftBorder(0), nTopBorder(0), nRightBorder(0), nBottomBorder(0);
3103 GetBorder(nLeftBorder, nTopBorder, nRightBorder, nBottomBorder);
3104 aRet.AdjustWidth(nLeftBorder + nRightBorder);
3105 aRet.AdjustHeight(nTopBorder + nBottomBorder);
3106
3108 aRet.setWidth( std::max(aRet.Width(), nMinWidth) );
3109
3110 if (GetStyle() & WB_VSCROLL)
3111 aRet.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize());
3112
3113 return aRet;
3114}
3115
3117{
3118 pImpl->SetForceMakeVisible(bEnable);
3119}
3120
3122{
3123 return GetItem_Impl( pEntry, nX, ppTab );
3124}
3125
3127{
3128 SvLBoxTab* pDummyTab;
3129 return GetItem_Impl( pEntry, nX, &pDummyTab );
3130}
3131
3133{
3134 nFocusWidth = -1;
3135 SvLBoxTab* pTab = new SvLBoxTab( nTabPos, nFlags );
3136 aTabs.emplace_back( pTab );
3138 {
3139 sal_uInt16 nPos = aTabs.size() - 1;
3140 if( nPos >= nFirstSelTab && nPos <= nLastSelTab )
3142 else
3143 // string items usually have to be selected -- turn this off
3144 // explicitly
3146 }
3147}
3148
3149
3151{
3152 sal_uInt16 nCurTab = 0;
3153 sal_uInt16 nTabCount = aTabs.size();
3154 while( nCurTab < nTabCount )
3155 {
3156 SvLBoxTab* pTab = aTabs[nCurTab].get();
3157 if( pTab->nFlags & SvLBoxTabFlags::DYNAMIC )
3158 {
3159 rPos = nCurTab;
3160 return pTab;
3161 }
3162 nCurTab++;
3163 }
3164 return nullptr;
3165}
3166
3168{
3169 sal_uInt16 nDummy;
3170 return GetFirstDynamicTab( nDummy );
3171}
3172
3173SvLBoxTab* SvTreeListBox::GetTab( SvTreeListEntry const * pEntry, SvLBoxItem const * pItem) const
3174{
3175 sal_uInt16 nPos = pEntry->GetPos( pItem );
3176 return aTabs[ nPos ].get();
3177}
3178
3180{
3181 aTabs.clear();
3182}
3183
3184
3186{
3187 Size aSize = pImpl->GetOutputSize();
3188 return aSize;
3189}
3190
3192{
3193 aScrolledHdl.Call( this );
3194}
3195
3196void SvTreeListBox::ImplInvalidate( const vcl::Region* pRegion, InvalidateFlags nInvalidateFlags )
3197{
3198 if (!pImpl)
3199 return;
3200 if( nFocusWidth == -1 )
3201 // to make sure that the control doesn't show the wrong focus rectangle
3202 // after painting
3203 pImpl->RecalcFocusRect();
3204 Control::ImplInvalidate( pRegion, nInvalidateFlags );
3205 pImpl->Invalidate();
3206}
3207
3208void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
3209{
3210
3212 if( nStart > nEnd )
3213 std::swap(nStart, nEnd);
3214 // select all tabs that lie within the area
3216 nFirstSelTab = nStart;
3217 nLastSelTab = nEnd;
3218 pImpl->RecalcFocusRect();
3219}
3220
3222{
3223 if (!aPopupMenuHdl.Call(rCEvt))
3224 pImpl->Command(rCEvt);
3225 //pass at least alt press/release to parent impl
3227 Control::Command(rCEvt);
3228}
3229
3231{
3232 sal_uInt16 nTabCount = aTabs.size();
3233 for( sal_uInt16 nPos = 0; nPos < nTabCount; nPos++ )
3234 {
3235 SvLBoxTab* pTab = aTabs[ nPos ].get();
3236 if( pTab->nFlags & nFlagMask )
3237 {
3238 rPos = nPos;
3239 return pTab;
3240 }
3241 }
3242 rPos = 0xffff;
3243 return nullptr;
3244}
3245
3246void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos )
3247{
3248 sal_uInt16 nPos = static_cast<sal_uInt16>(aTabs.size());
3249 while( nPos )
3250 {
3251 --nPos;
3252 SvLBoxTab* pTab = aTabs[ nPos ].get();
3253 if( pTab->nFlags & nFlagMask )
3254 {
3255 rTabPos = nPos;
3256 return;
3257 }
3258 }
3259 rTabPos = 0xffff;
3260}
3261
3263{
3264 if (aTooltipHdl.IsSet())
3265 {
3267 if (SvTreeListEntry* entry = GetEntry(pos))
3268 {
3269 const OUString tooltip = aTooltipHdl.Call(entry);
3270 if (!tooltip.isEmpty())
3271 {
3274 Help::ShowQuickHelp(this, screenRect, tooltip);
3275 return;
3276 }
3277 }
3278 }
3279
3280 if( !pImpl->RequestHelp( rHEvt ) )
3281 Control::RequestHelp( rHEvt );
3282}
3283
3284sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText)
3285{
3286 OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
3287 OUString aRight = pRightText ? pRightText->GetText() : OUString();
3288 pImpl->UpdateStringSorter();
3289 return pImpl->m_pStringSorter->compare(aLeft, aRight);
3290}
3291
3292IMPL_LINK( SvTreeListBox, DefaultCompare, const SvSortData&, rData, sal_Int32 )
3293{
3294 const SvTreeListEntry* pLeft = rData.pLeft;
3295 const SvTreeListEntry* pRight = rData.pRight;
3296 const SvLBoxString* pLeftText = static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String));
3297 const SvLBoxString* pRightText = static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String));
3298 return DefaultCompare(pLeftText, pRightText);
3299}
3300
3302 SvTreeListEntry* pEntry2, sal_uInt32 nPos )
3303{
3304 SolarMutexGuard aSolarGuard;
3305
3306 if( nActionId == SvListAction::CLEARING )
3308
3309 SvListView::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
3310 switch( nActionId )
3311 {
3313 {
3314 SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry1->GetFirstItem( SvLBoxItemType::ContextBmp ) );
3315 if ( !pBmpItem )
3316 break;
3317 const Image& rBitmap1( pBmpItem->GetBitmap1() );
3318 const Image& rBitmap2( pBmpItem->GetBitmap2() );
3319 short nMaxWidth = short( std::max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) );
3320 nMaxWidth = pImpl->UpdateContextBmpWidthVector( pEntry1, nMaxWidth );
3321 if( nMaxWidth > nContextBmpWidthMax )
3322 {
3323 nContextBmpWidthMax = nMaxWidth;
3324 SetTabs();
3325 }
3326 if (get_width_request() == -1)
3327 queue_resize();
3328 }
3329 break;
3330
3332 SetUpdateMode( false );
3333 break;
3334
3336 // after a selection: show first entry and also keep the selection
3337 MakeVisible( pModel->First(), true );
3338 SetUpdateMode( true );
3339 break;
3340
3342 if( IsUpdateMode() )
3344 break;
3345
3346 default: break;
3347 }
3348}
3349
3351{
3352 return GetEntry( Point() );
3353}
3354
3356{
3357 SvTreeListEntry* pNext = NextVisible( pEntry );
3358 if( pNext )
3359 {
3360 Point aPos( GetEntryPosition(pNext) );
3361 const Size& rSize = pImpl->GetOutputSize();
3362 if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
3363 return nullptr;
3364 }
3365 return pNext;
3366}
3367
3368
3370{
3372 {
3373 nEntryHeight = 0; // _together_ with true of 1. par (bFont) of InitSettings() a zero-height
3374 // forces complete recalc of heights!
3375 InitSettings();
3376 Invalidate();
3377 }
3378 else
3379 Control::DataChanged( rDCEvt );
3380}
3381
3383{
3386
3388
3390 ImplInitStyle();
3391}
3392
3394{
3395 SetPointFont(rRenderContext, GetPointFont(*GetOutDev()));
3396
3397 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
3398 rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
3399 rRenderContext.SetTextFillColor();
3400 rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
3401
3402 // always try to re-create default-SvLBoxButtonData
3405}
3406
3408{
3409 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
3410 vcl::Font aFont = rStyleSettings.GetFieldFont();
3411 SetPointFont(*GetOutDev(), aFont);
3413
3414 SetTextColor(rStyleSettings.GetFieldTextColor());
3416
3417 SetBackground(rStyleSettings.GetFieldColor());
3418
3419 // always try to re-create default-SvLBoxButtonData
3422}
3423
3424css::uno::Reference< XAccessible > SvTreeListBox::CreateAccessible()
3425{
3427 DBG_ASSERT( pParent, "SvTreeListBox::CreateAccessible - accessible parent not found" );
3428
3429 css::uno::Reference< XAccessible > xAccessible;
3430 if ( pParent )
3431 {
3432 css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
3433 if ( xAccParent.is() )
3434 {
3435 // need to be done here to get the vclxwindow later on in the accessible
3436 css::uno::Reference< css::awt::XVclWindowPeer > xHoldAlive(GetComponentInterface());
3437 xAccessible = pImpl->m_aFactoryAccess.getFactory().createAccessibleTreeListBox( *this, xAccParent );
3438 }
3439 }
3440 return xAccessible;
3441}
3442
3443void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const
3444{
3445 assert(pEntry && "SvTreeListBox::FillAccessibleEntryStateSet: invalid entry");
3446
3447 if ( pEntry->HasChildrenOnDemand() || pEntry->HasChildren() )
3448 {
3449 rStateSet |= AccessibleStateType::EXPANDABLE;
3450 if ( IsExpanded( pEntry ) )
3451 rStateSet |= AccessibleStateType::EXPANDED;
3452 }
3453
3455 rStateSet |= AccessibleStateType::CHECKED;
3456 if ( IsEntryVisible( pEntry ) )
3457 rStateSet |= AccessibleStateType::VISIBLE;
3458 if ( IsSelected( pEntry ) )
3459 rStateSet |= AccessibleStateType::SELECTED;
3460 if ( IsEnabled() )
3461 {
3462 rStateSet |= AccessibleStateType::ENABLED;
3463 rStateSet |= AccessibleStateType::FOCUSABLE;
3464 rStateSet |= AccessibleStateType::SELECTABLE;
3465 SvViewDataEntry* pViewDataNewCur = GetViewDataEntry(pEntry);
3466 if (pViewDataNewCur && pViewDataNewCur->HasFocus())
3467 rStateSet |= AccessibleStateType::FOCUSED;
3468 }
3469}
3470
3472{
3473 assert(pEntry);
3474
3475 //want to count the real column number in the list box.
3476 sal_uInt16 iRealItemCount = 0;
3477 for (size_t i = 0; i < pEntry->ItemCount(); ++i)
3478 {
3479 const SvLBoxItem& rItem = pEntry->GetItem(i);
3480 if (rItem.GetType() == SvLBoxItemType::String &&
3481 !static_cast<const SvLBoxString&>(rItem).GetText().isEmpty())
3482 {
3483 iRealItemCount++;
3484 }
3485 }
3486 // No idea why <= 1; that was in AccessibleListBoxEntry::getAccessibleDescription
3487 // since the "Integrate branch of IAccessible2" commit
3488 if (iRealItemCount <= 1)
3489 {
3490 return {};
3491 }
3492 else
3493 {
3494 return SearchEntryTextWithHeadTitle(pEntry);
3495 }
3496}
3497
3499{
3500 Point aPos = GetEntryPosition( pEntry );
3501 tools::Rectangle aRect = GetFocusRect( pEntry, aPos.Y() );
3502 return aRect;
3503}
3504
3506{
3507 CallEventListeners(nEvent, pData);
3508}
3509
3511{
3512 nMinWidthInChars = nChars;
3513 queue_resize();
3514}
3515
3516bool SvTreeListBox::set_property(const OUString &rKey, const OUString &rValue)
3517{
3518 if (rKey == "min-width-chars")
3519 {
3520 set_min_width_in_chars(rValue.toInt32());
3521 }
3522 else if (rKey == "enable-tree-lines")
3523 {
3524 auto nStyle = GetStyle();
3525 nStyle &= ~(WB_HASLINES | WB_HASLINESATROOT);
3526 if (toBool(rValue))
3527 nStyle |= (WB_HASLINES | WB_HASLINESATROOT);
3528 SetStyle(nStyle);
3529 }
3530 else if (rKey == "show-expanders")
3531 {
3532 auto nStyle = GetStyle();
3533 nStyle &= ~(WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3534 if (toBool(rValue))
3535 nStyle |= (WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3536 SetStyle(nStyle);
3537 }
3538 else if (rKey == "enable-search")
3539 {
3540 SetQuickSearch(toBool(rValue));
3541 }
3542 else if (rKey == "activate-on-single-click")
3543 {
3545 }
3546 else if (rKey == "hover-selection")
3547 {
3548 SetHoverSelection(toBool(rValue));
3549 }
3550 else if (rKey == "reorderable")
3551 {
3552 if (toBool(rValue))
3554 }
3555 else
3556 return Control::set_property(rKey, rValue);
3557 return true;
3558}
3559
3561{
3562 Control::EnableRTL(bEnable);
3563 pImpl->m_aHorSBar->EnableRTL(bEnable);
3564 pImpl->m_aVerSBar->EnableRTL(bEnable);
3565 pImpl->m_aScrBarBox->EnableRTL(bEnable);
3566}
3567
3569{
3571}
3572
3573/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawImageFlags
static bool toBool(std::string_view rValue)
Definition: builder.cxx:92
void SetActivateHdl(const Link< Accelerator &, void > &rLink)
Definition: accel.hxx:87
void InsertItem(sal_uInt16 nItemId, const vcl::KeyCode &rKeyCode)
Definition: accel.cxx:233
const StyleSettings & GetStyleSettings() const
static bool InsertAccel(Accelerator *pAccel)
Insert accelerator.
Definition: svapp.cxx:1323
static void RemoveAccel(Accelerator const *pAccel)
Remove accelerator.
Definition: svapp.cxx:1332
static vcl::Window * GetFocusWindow()
Get the currently focused window.
Definition: svapp.cxx:1038
bool IsBright() const
CommandEventId GetCommand() const
Definition: ctrl.hxx:80
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:256
virtual void Resize() override
Definition: ctrl.cxx:77
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:68
virtual void SetText(const OUString &rStr) override
Definition: ctrl.cxx:98
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:293
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: ctrl.cxx:61
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
Definition: decoview.cxx:768
Definition: edit.hxx:56
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: edit.cxx:225
virtual void SetText(const OUString &rStr) override
Definition: edit.cxx:2551
const OUString & GetSavedValue() const
Definition: edit.hxx:209
virtual void SetSelection(const Selection &rSelection)
Definition: edit.cxx:2400
virtual void LoseFocus() override
Definition: edit.cxx:1889
void SaveValue()
Definition: edit.hxx:208
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: edit.cxx:1702
virtual OUString GetText() const override
Definition: edit.cxx:2570
const Point & GetMousePosPixel() const
Definition: event.hxx:207
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:35
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
Definition: idle.cxx:34
Definition: image.hxx:40
Size GetSizePixel() const
Definition: Image.cxx:88
void setTristateVal(ButtonValue nTristate)
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
const Point & GetOrigin() const
Definition: mapmod.cxx:183
const Point & GetPosPixel() const
Definition: event.hxx:123
bool IsLeft() const
Definition: event.hxx:149
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
const vcl::Font & GetFont() const
Definition: outdev.hxx:529
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:56
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
const Wallpaper & GetBackground() const
Definition: outdev.hxx:523
void SetLineColor()
Definition: line.cxx:37
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void SetFillColor()
Definition: fill.cxx:29
const MapMode & GetMapMode() const
Definition: outdev.hxx:1557
const Color & GetTextColor() const
Definition: outdev.hxx:1003
void SetTextFillColor()
Definition: text.cxx:734
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:897
void SetBackground()
Definition: background.cxx:27
void Pop()
Definition: stack.cxx:91
bool DrawNativeControl(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, const OUString &aCaption, const Color &rBackgroundColor=COL_AUTO)
Request rendering of a particular control and/or part.
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
const Color & GetFillColor() const
Definition: outdev.hxx:515
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetFieldTextColor() const
const Color & GetFieldColor() const
const Color & GetDeactiveColor() const
const vcl::Font & GetFieldFont() const
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetHighlightTextColor() const
static const Image & GetDefaultCollapsedNodeImage()
Definition: svimpbox.cxx:3114
static const Image & GetDefaultExpandedNodeImage()
Definition: svimpbox.cxx:3107
DECL_LINK(ReturnHdl_Impl, Accelerator &, void)
VclPtr< Edit > pEdit
Definition: treelistbox.cxx:67
Link< SvInplaceEdit2 &, void > aCallBackHdl
Definition: treelistbox.cxx:63
OUString GetText() const
bool bAlreadyInCallBack
Definition: treelistbox.cxx:69
bool KeyInput(const KeyEvent &rKEvt)
SvInplaceEdit2(vcl::Window *pParent, const Point &rPos, const Size &rSize, const OUString &rData, const Link< SvInplaceEdit2 &, void > &rNotifyEditEnd, const Selection &)
bool EditingCanceled() const
Definition: treelistbox.cxx:83
void CallCallBackHdl_Impl()
DECL_LINK(Timeout_Impl, Timer *, void)
Accelerator aAccEscape
Definition: treelistbox.cxx:65
Accelerator aAccReturn
Definition: treelistbox.cxx:64
DECL_LINK(EscapeHdl_Impl, Accelerator &, void)
void StopEditing(bool bCancel)
OUString const & GetSavedValue() const
const VclPtr< Edit > & GetEditWidget() const
Definition: treelistbox.cxx:88
static SvButtonState ConvertToButtonState(SvItemStateFlags nItemFlags)
Definition: svlbitm.cxx:103
bool HasDefaultImages() const
Definition: svlbitm.cxx:157
SvTreeListEntry * GetActEntry() const
Definition: svlbitm.cxx:121
void SetDefaultImages(const Control *pControlForSettings)
Definition: svlbitm.cxx:133
void ClickHdl(SvTreeListEntry *)
Definition: svlbitm.cxx:353
void SetStateChecked()
Definition: svlbitm.hxx:206
void SetStateUnchecked()
Definition: svlbitm.hxx:212
SvItemStateFlags GetButtonFlags() const
Definition: svlbitm.hxx:180
void SetStateTristate()
Definition: svlbitm.hxx:217
const Image & GetBitmap2() const
Definition: svlbitm.hxx:281
void SetBitmap2(const Image &rImage)
Definition: svlbitm.hxx:270
void SetBitmap1(const Image &rImage)
Definition: svlbitm.hxx:265
const Image & GetBitmap1() const
Definition: svlbitm.hxx:275
virtual void InitViewData(SvTreeListBox *pView, SvTreeListEntry *pEntry, SvViewDataItem *pViewData=nullptr)=0
int GetHeight(const SvTreeListBox *pView, const SvTreeListEntry *pEntry) const
bool isEnable() const
virtual SvLBoxItemType GetType() const =0
virtual void Paint(const Point &rPos, SvTreeListBox &rOutDev, vcl::RenderContext &rRenderContext, const SvViewDataEntry *pView, const SvTreeListEntry &rEntry)=0
int GetWidth(const SvTreeListBox *pView, const SvTreeListEntry *pEntry) const
virtual int CalcWidth(const SvTreeListBox *pView) const
virtual ~SvLBoxItem()
const OUString & GetText() const
Definition: svlbitm.hxx:133
virtual void InitViewData(SvTreeListBox *pView, SvTreeListEntry *pEntry, SvViewDataItem *pViewData=nullptr) override
Definition: svlbitm.cxx:281
void SetText(const OUString &rText)
Definition: svlbitm.hxx:137
bool IsEditable() const
tools::Long GetPos() const
tools::Long nPos
tools::Long CalcOffset(tools::Long nItemLength, tools::Long nTabWidth)
bool IsDynamic() const
SvLBoxTabFlags nFlags
bool SelectListEntry(SvTreeListEntry *pEntry, bool bSelect)
Definition: treelist.cxx:884
bool IsSelected(const SvTreeListEntry *pEntry) const
Definition: treelist.cxx:1310
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uInt32 nPos)
Definition: treelist.cxx:1230
SvTreeListEntry * NextVisible(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:234
virtual void ModelHasCleared()
Definition: treelist.cxx:1085
void ExpandListEntry(SvTreeListEntry *pParent)
Definition: treelist.cxx:846
std::unique_ptr< SvTreeList > pModel
Definition: treelist.hxx:210
void CollapseListEntry(SvTreeListEntry *pParent)
Definition: treelist.cxx:865
bool IsEntryVisible(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:272
sal_uInt32 GetSelectionCount() const
Definition: treelist.cxx:1029
SvTreeListEntry * NextSelected(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:254
SvTreeListEntry * LastVisible() const
Definition: treelist.hxx:240
void dispose()
Definition: treelist.cxx:1019
SvTreeListEntry * FirstSelected() const
Definition: treelist.hxx:251
const SvViewDataEntry * GetViewData(const SvTreeListEntry *pEntry) const
Definition: treelist.cxx:1327
bool IsExpanded(SvTreeListEntry *pEntry) const
Definition: treelist.cxx:1283
void SetFont(const vcl::Font &rFont)
static VCL_DLLPRIVATE void RemoveBoxFromDDList_Impl(const SvTreeListBox &rB)
sal_uInt16 nCurEntrySelPos
virtual void StartDrag(sal_Int8 nAction, const Point &rPosPixel) override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Creates and returns the accessible object of the Box.
void SetEntryWidth(short nWidth)
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt, SvTreeListBox *pSourceView)
void DeselectHdl()
SvTreeListEntry * GetEntryFromPath(const ::std::deque< sal_Int32 > &_rPath) const
void SetUpdateMode(bool)
SvTreeListEntry * pTargetEntry
sal_Int32 DefaultCompare(const SvLBoxString *pLeftText, const SvLBoxString *pRightText)
void ScrollToAbsPos(tools::Long nPos)
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uInt32 nPos) override
sal_Int8 mnClicksToToggle
VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry *pEntry)
VCL_DLLPRIVATE void SetExpandedNodeBmp(const Image &)
void NotifyScrolled()
void SetDefaultExpandedEntryBmp(const Image &rBmp)
Image aCurInsertedExpBmp
virtual void Resize() override
SvLBoxItem * GetItem(SvTreeListEntry *, tools::Long nX, SvLBoxTab **ppTab)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
sal_uInt16 nFirstSelTab
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uInt32 nPos=TREELIST_APPEND, void *pUserData=nullptr)
void SetCheckButtonState(SvTreeListEntry *, SvButtonState)
virtual bool set_property(const OUString &rKey, const OUString &rValue) override
VCL_DLLPRIVATE SvLBoxItem * GetItem_Impl(SvTreeListEntry *, tools::Long nX, SvLBoxTab **ppTab)
void AddTab(tools::Long nPos, SvLBoxTabFlags nFlags)
SvTreeListEntry * GetNextEntryInView(SvTreeListEntry *) const
Link< const CommandEvent &, bool > aPopupMenuHdl
void FillAccessibleEntryStateSet(SvTreeListEntry *pEntry, sal_Int64 &rStateSet) const
Fills the StateSet of one entry.
void RemoveEntry(SvTreeListEntry const *pEntry)
Removes the entry along with all of its descendants.
SvTreeListEntry * FirstChild(SvTreeListEntry *pParent) const
void SetDragDropMode(DragDropMode)
virtual void Command(const CommandEvent &rCEvt) override
virtual void RequestingChildren(SvTreeListEntry *pParent)
virtual void DragFinished(sal_Int8 nDropAction)
tools::Long getPreferredDimensions(std::vector< tools::Long > &rWidths) const
VCL_DLLPRIVATE void ImplInitStyle()
Link< SvTreeListBox *, void > aDeselectHdl
virtual Size GetOptimalSize() const override
void ImplEditEntry(SvTreeListEntry *pEntry)
void EnableInplaceEditing(bool bEnable)
virtual void InitEntry(SvTreeListEntry *, const OUString &, const Image &, const Image &)
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
virtual void StateChanged(StateChangedType eType) override
void SetActivateOnSingleClick(bool bEnable)
void SetDefaultCollapsedEntryBmp(const Image &rBmp)
Image aPrevInsertedColBmp
virtual vcl::StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const override
returns the current entry in the list of searchable strings.
VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect, const SvTreeListEntry &rEntry)
void EditedText(const OUString &)
void SetHoverSelection(bool bEnable)
std::unique_ptr< SvTreeListBoxImpl > mpImpl
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
SvTreeListEntry * CloneEntry(SvTreeListEntry *pSource)
Link< SvTreeListBox *, void > aExpandedHdl
virtual DragDropMode NotifyStartDrag()
SvLBoxTab * GetFirstTab(SvLBoxTabFlags nFlagMask, sal_uInt16 &rTabPos)
DragDropMode nDragDropMode
virtual void LoseFocus() override
VCL_DLLPRIVATE void SetCollapsedNodeBmp(const Image &)
void MakeVisible(SvTreeListEntry *pEntry)
SvTreeListEntry * Next(SvTreeListEntry *pEntry) const
tools::Rectangle GetBoundingRect(const SvTreeListEntry *pEntry)
Calculate and return the bounding rectangle of an entry.
Link< svtree_measure_args, Size > aCustomMeasureHdl
static const Image & GetDefaultExpandedNodeImage()
Returns the default image which clients should use for expanded nodes, to have a consistent user inte...
void SetSpaceBetweenEntries(short nSpace)
Point GetEntryPosition(const SvTreeListEntry *) const
SvTreeListEntry * GetEntry(SvTreeListEntry *pParent, sal_uInt32 nPos) const
void InvalidateEntry(SvTreeListEntry *)
void SetCheckButtonData(SvLBoxButtonData *)
virtual OUString GetEntryText(SvTreeListEntry *pEntry) const
bool CheckDragAndDropMode(SvTreeListBox const *pSource, sal_Int8)
TriState NotifyMoving(SvTreeListEntry *pTarget, const SvTreeListEntry *pEntry, SvTreeListEntry *&rpNewParent, sal_uInt32 &rNewChildPos)
sal_uInt16 nLastSelTab
const Image & GetDefaultExpandedEntryBmp() const
void SetEntryHeight(short nHeight)
void SetCollapsedEntryBmp(SvTreeListEntry *_pEntry, const Image &_rImage)
SvTreeListEntry * pHdlEntry
Size GetOutputSizePixel() const
VCL_DLLPRIVATE void InitTreeView()
bool Collapse(SvTreeListEntry *pParent)
SvTreeListEntry * pEdEntry
bool Select(SvTreeListEntry *pEntry, bool bSelect=true)
virtual void SelectEntry(vcl::StringEntryIdentifier _entry) override
selects a given entry
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
void SetupDragOrigin()
This sets the global variables used to determine the in-process drag source.
void EnableSelectionAsDropTarget(bool bEnable=true)
void SetExpandedEntryBmp(SvTreeListEntry *_pEntry, const Image &_rImage)
Image aPrevInsertedExpBmp
virtual void KeyInput(const KeyEvent &rKEvt) override
void AdjustEntryHeightAndRecalc()
SvViewDataItem * GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *)
const Image & GetDefaultCollapsedEntryBmp() const
VCL_DLLPRIVATE Image const & GetExpandedNodeBmp() const
bool mbContextBmpExpanded
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
virtual bool EditingEntry(SvTreeListEntry *pEntry)
bool MoveSelectionCopyFallbackPossible(SvTreeListBox *pSource, SvTreeListEntry *pTarget, bool bAllowCopyFallback)
virtual void ModelHasInsertedTree(SvTreeListEntry *pEntry) override
void set_min_width_in_chars(sal_Int32 nChars)
void OnCurrentEntryChanged()
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void CallImplEventListeners(VclEventId nEvent, void *pData)
virtual void CalcEntryHeight(SvTreeListEntry const *pEntry)
void FillEntryPath(SvTreeListEntry *pEntry, ::std::deque< sal_Int32 > &_rPath) const
void SetSublistOpenWithLeftRight()
SvLBoxButtonData * pCheckButtonData
void CancelTextEditing()
void SetForceMakeVisible(bool bEnable)
void ModelHasEntryInvalidated(SvTreeListEntry *pEntry) override
static const Image & GetCollapsedEntryBmp(const SvTreeListEntry *_pEntry)
bool IsEditingActive() const
VCL_DLLPRIVATE bool HandleKeyInput(const KeyEvent &rKEvt)
Handles the given key event.
sal_Int32 nMinWidthInChars
void EditText(const OUString &, const tools::Rectangle &, const Selection &)
short GetEntryHeight() const
VCL_DLLPRIVATE void AdjustEntryHeight()
virtual FactoryFunction GetUITestFactory() const override
SvTreeListEntry * GetFirstEntryInView() const
virtual ~SvTreeListBox() override
SelectionMode eSelMode
virtual void SetTabs()
void SetHighlightRange(sal_uInt16 nFirstTab=0, sal_uInt16 nLastTab=0xffff)
rtl::Reference< TransferDataContainer > m_xTransferHelper
void EditItemText(SvTreeListEntry *pEntry, SvLBoxString *pItem, const Selection &)
virtual void ModelIsMoving(SvTreeListEntry *pSource) override
virtual void GetFocus() override
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
void SetNoAutoCurEntry(bool b)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
virtual void ModelHasInserted(SvTreeListEntry *pEntry) override
VCL_DLLPRIVATE void ImpEntryInserted(SvTreeListEntry *pEntry)
void UnsetDropTarget()
void EditEntry(SvTreeListEntry *pEntry)
Image aCurInsertedColBmp
void SetSelectionMode(SelectionMode)
tools::Long mnCheckboxItemWidth
void ImplShowTargetEmphasis(SvTreeListEntry *pEntry, bool bShow)
std::vector< std::unique_ptr< SvLBoxTab > > aTabs
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
SvTreeListEntry * GetCurEntry() const
virtual void ImplInvalidate(const vcl::Region *rRegion, InvalidateFlags nFlags) override
short nContextBmpWidthMax
Link< SvTreeListBox *, bool > aExpandingHdl
virtual OUString GetEntryAccessibleDescription(SvTreeListEntry *pEntry) const
void SetNodeDefaultImages()
Sets default bitmaps for collapsed and expanded nodes.
friend class SvImpLBox
SvViewDataEntry * GetViewDataEntry(SvTreeListEntry const *pEntry) const
bool CopySelection(SvTreeListBox *pSource, SvTreeListEntry *pTarget)
void EnableCheckButton(SvLBoxButtonData *)
void CheckButtonHdl()
void RemoveSelection()
VCL_DLLPRIVATE bool PosOverBody(const Point &rPos) const
SvLBoxTab * GetFirstDynamicTab() const
TriState NotifyCopying(SvTreeListEntry *pTarget, const SvTreeListEntry *pEntry, SvTreeListEntry *&rpNewParent, sal_uInt32 &rNewChildPos)
void SetCurEntry(SvTreeListEntry *_pEntry)
virtual vcl::StringEntryIdentifier NextEntry(vcl::StringEntryIdentifier _currentEntry, OUString &_out_entryText) const override
returns the next entry in the list.
void RecalcViewData()
virtual void EnableRTL(bool bEnable=true) override
void EndEditing(bool bCancel=false)
SvTreeListEntry * First() const
DragDropMode GetDragDropMode() const
void SetDragHelper(const rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
std::unique_ptr< SvInplaceEdit2 > pEdCtrl
Link< SvTreeListEntry *, OUString > aTooltipHdl
virtual void MouseMove(const MouseEvent &rMEvt) override
static const Image & GetExpandedEntryBmp(const SvTreeListEntry *_pEntry)
static VCL_DLLPRIVATE void AddBoxToDDList_Impl(const SvTreeListBox &rB)
SvTreeListBox(vcl::Window *pParent, WinBits nWinStyle=0)
VCL_DLLPRIVATE Size MeasureCustomEntry(vcl::RenderContext &rRenderContext, const SvTreeListEntry &rEntry) const
void GetLastTab(SvLBoxTabFlags nFlagMask, sal_uInt16 &rTabPos)
virtual void ModelHasCleared() override
Link< SvTreeListBox *, void > aScrolledHdl
void SetQuickSearch(bool bEnable)
SvTreeFlags nTreeFlags
SelectionMode GetSelectionMode() const
void ExpandedHdl()
VclPtr< Edit > GetEditWidget() const
void ScrollOutputArea(short nDeltaEntries)
virtual tools::Rectangle GetFocusRect(const SvTreeListEntry *, tools::Long nLine)
virtual void RequestHelp(const HelpEvent &rHEvt) override
std::unique_ptr< SvImpLBox > pImpl
Link< SvTreeListBox *, bool > aDoubleClickHdl
DragDropMode nOldDragMode
Link< svtree_render_args, void > aCustomRenderHdl
virtual void ModelIsRemoving(SvTreeListEntry *pEntry) override
std::pair< tools::Long, tools::Long > GetItemPos(SvTreeListEntry *pEntry, sal_uInt16 nTabIdx)
SvButtonState GetCheckButtonState(SvTreeListEntry *) const
VCL_DLLPRIVATE void PaintEntry1(SvTreeListEntry &, tools::Long nLine, vcl::RenderContext &rRenderContext)
virtual bool EditedEntry(SvTreeListEntry *pEntry, const OUString &rNewText)
static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry *pEntry)
bool ExpandingHdl()
void SelectAll(bool bSelect)
SvTreeListBoxFlags nImpFlags
sal_uInt32 GetLevelChildCount(SvTreeListEntry *pParent) const
short nEntryHeightOffs
virtual void InitViewData(SvViewDataEntry *, SvTreeListEntry *pEntry) override
Link< sal_Int8, void > GetDragFinishedHdl() const
sal_Int8 mnDragAction
SvLBoxItem * pEdItem
void SetEntryText(SvTreeListEntry *, const OUString &)
static const Image & GetDefaultCollapsedNodeImage()
Returns the default image which clients should use for expanded nodes, to have a consistent user inte...
virtual sal_uInt32 Insert(SvTreeListEntry *pEnt, SvTreeListEntry *pPar, sal_uInt32 nPos=TREELIST_APPEND)
sal_uInt32 SelectChildren(SvTreeListEntry *pParent, bool bSelect)
SvTreeList * GetModel() const
bool Expand(SvTreeListEntry *pParent)
SvLBoxTab * GetTab(SvTreeListEntry const *, SvLBoxItem const *) const
Link< SvTreeListBox *, void > aSelectHdl
bool DoubleClickHdl()
sal_IntPtr GetTabPos(const SvTreeListEntry *, const SvLBoxTab *) const
std::optional< Color > const & GetTextColor() const
SvTreeListEntry * NextSibling() const
SvTreeListEntries m_Children
const SvLBoxItem * GetFirstItem(SvLBoxItemType eType) const
void * GetUserData() const
bool HasChildren() const
size_t ItemCount() const
size_t GetPos(const SvLBoxItem *pItem) const
SvTLEntryFlags GetFlags() const
sal_uInt32 GetExtraIndent() const
bool HasChildrenOnDemand() const
const SvLBoxItem & GetItem(size_t nPos) const
void EnableChildrenOnDemand(bool bEnable=true)
void SetFlags(SvTLEntryFlags nFlags)
SvTreeListEntry * pParent
void AddItem(std::unique_ptr< SvLBoxItem > pItem)
SvTLEntryFlags nEntryFlags
void SetUserData(void *pPtr)
void SetSortMode(SvSortMode eMode)
Definition: treelist.hxx:195
static sal_uInt32 GetRelPos(const SvTreeListEntry *pChild)
Definition: treelist.cxx:828
void SetCompareHdl(const Link< const SvSortData &, sal_Int32 > &rLink)
Definition: treelist.hxx:198
void InvalidateEntry(SvTreeListEntry *)
Definition: treelist.cxx:1004
View-dependent data for a tree list entry created in the virtual function SvTreeListBox::CreateViewDa...
bool HasFocus() const
bool IsDragTarget() const
const SvViewDataItem & GetItem(size_t nPos) const
void Init(size_t nSize)
bool IsHighlighted() const
void SetPriority(TaskPriority ePriority)
Definition: scheduler.cxx:606
void Stop()
Definition: scheduler.cxx:599
Definition: timer.hxx:27
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
void disposeAndClear()
Definition: vclptr.hxx:200
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
bool isDisposed() const
const Color & GetColor() const
Definition: wall.hxx:71
void SetColor(const Color &rColor)
Definition: wall.cxx:156
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
void SetSize(const Size &)
constexpr Point TopLeft() const
void SetPos(const Point &rPoint)
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
constexpr tools::Long Right() const
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
void SetTransparent(bool bTransparent)
Definition: font/font.cxx:125
void SetFillColor(const Color &)
Definition: font/font.cxx:115
void SetColor(const Color &)
Definition: font/font.cxx:107
bool IsTransparent() const
Definition: font/font.cxx:900
const Color & GetColor() const
Definition: font/font.cxx:898
const Color & GetFillColor() const
Definition: font/font.cxx:899
bool IsMod1() const
Definition: keycod.hxx:56
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2806
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
void SetStyle(WinBits nStyle)
Definition: window.cxx:1962
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2967
virtual void GetFocus()
Definition: window.cxx:1841
vcl::Window * GetParent() const
Definition: window2.cxx:1123
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1869
void PaintImmediately()
Definition: paint.cxx:1268
bool IsMouseCaptured() const
Definition: mouse.cxx:481
bool IsChild(const vcl::Window *pWindow) const
Definition: stacking.cxx:1107
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1002
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2424
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1923
void HideFocus()
Definition: window2.cxx:95
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1353
void GrabFocus()
Definition: window.cxx:2976
bool IsUpdateMode() const
Definition: window2.cxx:1199
bool HasFocus() const
Definition: window.cxx:2981
vcl::Window * GetAccessibleParentWindow() const
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
WinBits GetStyle() const
Definition: window2.cxx:979
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2187
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1805
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
vcl::Font GetPointFont(vcl::RenderContext const &rRenderContext) const
Definition: window.cxx:2180
const MapMode & GetMapMode() const
Definition: window3.cxx:99
void SetTextFillColor()
Definition: window3.cxx:97
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
const vcl::Font & GetFont() const
Definition: window3.cxx:58
SAL_DLLPRIVATE float approximate_char_width() const
Definition: window3.cxx:61
void Hide()
Definition: window.hxx:879
virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3145
void ReleaseMouse()
Definition: mouse.cxx:469
virtual void ShowFocus(const tools::Rectangle &rRect)
Definition: window2.cxx:53
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
virtual Size GetSizePixel() const
Definition: window.cxx:2402
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual void LoseFocus()
Definition: window.cxx:1855
virtual void ImplInvalidate(const vcl::Region *pRegion, InvalidateFlags nFlags)
Definition: paint.cxx:780
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2173
sal_Int32 get_width_request() const
Definition: window2.cxx:1951
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1283
virtual OUString GetText() const
Definition: window.cxx:3055
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:651
void SetType(WindowType nType)
Definition: window2.cxx:994
virtual bool set_property(const OUString &rKey, const OUString &rValue)
Definition: window2.cxx:1478
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2812
bool IsEnabled() const
Definition: window2.cxx:1148
void SetTextColor(const Color &rColor)
Definition: window3.cxx:108
void SetBackground()
Definition: window3.cxx:100
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define TREELIST_APPEND
int nCount
#define DBG_ASSERT(sCon, aError)
DrawSymbolFlags
Definition: decoview.hxx:35
sal_Int32 nState
DocumentType eType
#define SELECTION_MAX
TriState
TRISTATE_INDET
TRISTATE_TRUE
#define SELECTION_MIN
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
void * p
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
constexpr sal_uInt16 KEY_ESCAPE
Definition: keycodes.hxx:120
SvLinkSource * pOwner
sal_uInt16 nPos
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
aStr
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
NONE
size
int i
@ eSymbol
Definition: ppdparser.hxx:44
long Long
const void * StringEntryIdentifier
double mnWidth
sal_Int8 mnAction
Definition: transfer.hxx:95
Point maPosPixel
Definition: transfer.hxx:93
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
Definition: transfer.hxx:117
sal_Int8 mnAction
Definition: transfer.hxx:118
vcl::QuickSelectionEngine m_aQuickSelectionEngine
SvTreeListBoxImpl(SvTreeListBox &_rBox)
SvItemStateFlags
Definition: svlbitm.hxx:48
@ REPAINT
All repaint events should go in here.
#define DND_ACTION_COPYMOVE
Definition: transfer.hxx:69
#define DND_ACTION_MOVE
Definition: transfer.hxx:68
#define DND_ACTION_COPY
Definition: transfer.hxx:67
#define DND_ACTION_LINK
Definition: transfer.hxx:70
#define DND_ACTION_NONE
Definition: transfer.hxx:66
SvListAction
Definition: treelist.hxx:35
#define SVLBOX_ACC_RETURN
Definition: treelistbox.cxx:58
#define NODE_AND_CHECK_BUTTONS
#define TAB_STARTPOS
IMPL_LINK_NOARG(SvInplaceEdit2, ReturnHdl_Impl, Accelerator &, void)
#define SVLBOX_ACC_ESCAPE
Definition: treelistbox.cxx:59
#define TABFLAGS_CHECKBTN
static VclPtr< SvTreeListBox > g_pDDTarget
Definition: treelistbox.cxx:56
#define CHECK_BUTTONS
#define TABFLAGS_TEXT
#define TABFLAGS_CONTEXTBMP
#define NODE_BUTTONS
static VclPtr< SvTreeListBox > g_pDDSource
Definition: treelistbox.cxx:55
#define NO_BUTTONS
#define SV_LBOX_DEFAULT_INDENT_PIXEL
IMPL_LINK(SvTreeListBox, CloneHdl_Impl, SvTreeListEntry *, pEntry, SvTreeListEntry *)
#define SV_ENTRYHEIGHTOFFS_PIXEL
Definition: treelistbox.hxx:81
#define SV_TAB_BORDER
Definition: treelistbox.hxx:79
SvButtonState
Definition: treelistbox.hxx:52
SvTreeFlags
Definition: treelistbox.hxx:84
SvLBoxTabFlags
Definition: treelistbox.hxx:59
SvTreeListBoxFlags
DragDropMode
SvTLEntryFlags
unsigned char sal_uInt8
signed char sal_Int8
SymbolType
Definition: vclenum.hxx:74
SelectionMode
Definition: vclenum.hxx:26
VclEventId
Definition: vclevent.hxx:38
StateChangedType
Definition: window.hxx:291
InvalidateFlags
Definition: window.hxx:186
@ Children
The child windows are invalidated, too.
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_HIDESELECTION
Definition: wintypes.hxx:228
WinBits const WB_HASBUTTONS
Definition: wintypes.hxx:223
WinBits const WB_HASLINESATROOT
Definition: wintypes.hxx:225
WinBits const WB_HASLINES
Definition: wintypes.hxx:224
WinBits const WB_HASBUTTONSATROOT
Definition: wintypes.hxx:226
WinBits const WB_SORT
Definition: wintypes.hxx:158
WinBits const WB_VSCROLL
Definition: wintypes.hxx:178
WinBits const WB_CLIPCHILDREN
Definition: wintypes.hxx:112
WinBits const WB_LEFT
Definition: wintypes.hxx:146
size_t pos