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 mbAlternatingRowColors(false),
393 mbUpdateAlternatingRows(false),
394 mbQuickSearch(false),
395 mbActivateOnSingleClick(false),
396 mbHoverSelection(false),
397 mbSelectingByHover(false),
398 mnClicksToToggle(0), //at default clicking on a row won't toggle its default checkbox
399 eSelMode(SelectionMode::NONE),
400 nMinWidthInChars(0),
401 mnDragAction(DND_ACTION_COPYMOVE | DND_ACTION_LINK),
402 mbCenterAndClipText(false)
403{
405 pTargetEntry = nullptr;
407 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
408 pHdlEntry = nullptr;
412
413 InitTreeView();
414 pImpl->SetModel( pModel.get() );
415
417}
418
420{
421 if (pModel)
422 pModel->Clear(); // Model calls SvTreeListBox::ModelHasCleared()
423}
424
426{
427 return CloneEntry(pEntry);
428}
429
430sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry, SvTreeListEntry* pParent, sal_uInt32 nPos )
431{
432 sal_uInt32 nInsPos = pModel->Insert( pEntry, pParent, nPos );
433 pEntry->SetBackColor( GetBackground().GetColor() );
435 return nInsPos;
436}
437
438sal_uInt32 SvTreeListBox::Insert( SvTreeListEntry* pEntry,sal_uInt32 nRootPos )
439{
440 sal_uInt32 nInsPos = pModel->Insert( pEntry, nRootPos );
441 pEntry->SetBackColor( GetBackground().GetColor() );
443 return nInsPos;
444}
445
447{
448 return !aExpandingHdl.IsSet() || aExpandingHdl.Call( this );
449}
450
452{
453 aExpandedHdl.Call( this );
454}
455
457{
458 aSelectHdl.Call( this );
459}
460
462{
463 aDeselectHdl.Call( this );
464}
465
467{
468 return !aDoubleClickHdl.IsSet() || aDoubleClickHdl.Call(this);
469}
470
472{
473 if ( pSource != this )
474 return false; // no drop
475
477 return false; // D&D locked within list
478
479 if( DND_ACTION_MOVE == nAction )
480 {
482 return false; // no local move
483 }
484 else
485 return false; // no local copy
486
487 return true;
488}
489
490
491/*
492 NotifyMoving/Copying
493 ====================
494
495 default behavior:
496
497 1. target doesn't have children
498 - entry becomes sibling of target. entry comes after target
499 (->Window: below the target)
500 2. target is an expanded parent
501 - entry inserted at the beginning of the target childlist
502 3. target is a collapsed parent
503 - entry is inserted at the end of the target childlist
504*/
506 SvTreeListEntry* pTarget, // D&D dropping position in GetModel()
507 const SvTreeListEntry* pEntry, // entry that we want to move, from
508 // GetSourceListBox()->GetModel()
509 SvTreeListEntry*& rpNewParent, // new target parent
510 sal_uInt32& rNewChildPos) // position in childlist of target parent
511{
512 DBG_ASSERT(pEntry,"NotifyMoving:SourceEntry?");
513 if( !pTarget )
514 {
515 rpNewParent = nullptr;
516 rNewChildPos = 0;
517 return TRISTATE_TRUE;
518 }
519 if ( !pTarget->HasChildren() && !pTarget->HasChildrenOnDemand() )
520 {
521 // case 1
522 rpNewParent = GetParent( pTarget );
523 rNewChildPos = SvTreeList::GetRelPos( pTarget ) + 1;
524 rNewChildPos += nCurEntrySelPos;
526 }
527 else
528 {
529 // cases 2 & 3
530 rpNewParent = pTarget;
531 if( IsExpanded(pTarget))
532 rNewChildPos = 0;
533 else
534 rNewChildPos = TREELIST_APPEND;
535 }
536 return TRISTATE_TRUE;
537}
538
540 SvTreeListEntry* pTarget, // D&D dropping position in GetModel()
541 const SvTreeListEntry* pEntry, // entry that we want to move, from
542 // GetSourceListBox()->GetModel()
543 SvTreeListEntry*& rpNewParent, // new target parent
544 sal_uInt32& rNewChildPos) // position in childlist of target parent
545{
546 return NotifyMoving(pTarget,pEntry,rpNewParent,rNewChildPos);
547}
548
550{
551 return pModel->FirstChild(pParent);
552}
553
554// return: all entries copied
556{
557 nCurEntrySelPos = 0; // selection counter for NotifyMoving/Copying
558 bool bSuccess = true;
559 std::vector<SvTreeListEntry*> aList;
560 bool bClone = ( pSource->GetModel() != GetModel() );
561 Link<SvTreeListEntry*,SvTreeListEntry*> aCloneLink( pModel->GetCloneLink() );
562 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
563
564 // cache selection to simplify iterating over the selection when doing a D&D
565 // exchange within the same listbox
566 SvTreeListEntry* pSourceEntry = pSource->FirstSelected();
567 while ( pSourceEntry )
568 {
569 // children are copied automatically
570 pSource->SelectChildren( pSourceEntry, false );
571 aList.push_back( pSourceEntry );
572 pSourceEntry = pSource->NextSelected( pSourceEntry );
573 }
574
575 for (auto const& elem : aList)
576 {
577 pSourceEntry = elem;
578 SvTreeListEntry* pNewParent = nullptr;
579 sal_uInt32 nInsertionPos = TREELIST_APPEND;
580 TriState nOk = NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos);
581 if ( nOk )
582 {
583 if ( bClone )
584 {
585 sal_uInt32 nCloneCount = 0;
586 pSourceEntry = pModel->Clone(pSourceEntry, nCloneCount);
587 pModel->InsertTree(pSourceEntry, pNewParent, nInsertionPos);
588 }
589 else
590 {
591 sal_uInt32 nListPos = pModel->Copy(pSourceEntry, pNewParent, nInsertionPos);
592 pSourceEntry = GetEntry( pNewParent, nListPos );
593 }
594 }
595 else
596 bSuccess = false;
597
598 if (nOk == TRISTATE_INDET) // HACK: make visible moved entry
599 MakeVisible( pSourceEntry );
600 }
601 pModel->SetCloneLink( aCloneLink );
602 return bSuccess;
603}
604
605// return: all entries were moved
606bool SvTreeListBox::MoveSelectionCopyFallbackPossible( SvTreeListBox* pSource, SvTreeListEntry* pTarget, bool bAllowCopyFallback )
607{
608 nCurEntrySelPos = 0; // selection counter for NotifyMoving/Copying
609 bool bSuccess = true;
610 std::vector<SvTreeListEntry*> aList;
611 bool bClone = ( pSource->GetModel() != GetModel() );
612 Link<SvTreeListEntry*,SvTreeListEntry*> aCloneLink( pModel->GetCloneLink() );
613 if ( bClone )
614 pModel->SetCloneLink( LINK(this, SvTreeListBox, CloneHdl_Impl ));
615
616 SvTreeListEntry* pSourceEntry = pSource->FirstSelected();
617 while ( pSourceEntry )
618 {
619 // children are automatically moved
620 pSource->SelectChildren( pSourceEntry, false );
621 aList.push_back( pSourceEntry );
622 pSourceEntry = pSource->NextSelected( pSourceEntry );
623 }
624
625 for (auto const& elem : aList)
626 {
627 pSourceEntry = elem;
628 SvTreeListEntry* pNewParent = nullptr;
629 sal_uInt32 nInsertionPos = TREELIST_APPEND;
630 TriState nOk = NotifyMoving(pTarget,pSourceEntry,pNewParent,nInsertionPos);
631 TriState nCopyOk = nOk;
632 if ( !nOk && bAllowCopyFallback )
633 {
634 nInsertionPos = TREELIST_APPEND;
635 nCopyOk = NotifyCopying(pTarget,pSourceEntry,pNewParent,nInsertionPos);
636 }
637
638 if ( nOk || nCopyOk )
639 {
640 if ( bClone )
641 {
642 sal_uInt32 nCloneCount = 0;
643 pSourceEntry = pModel->Clone(pSourceEntry, nCloneCount);
644 pModel->InsertTree(pSourceEntry, pNewParent, nInsertionPos);
645 }
646 else
647 {
648 if ( nOk )
649 pModel->Move(pSourceEntry, pNewParent, nInsertionPos);
650 else
651 pModel->Copy(pSourceEntry, pNewParent, nInsertionPos);
652 }
653 }
654 else
655 bSuccess = false;
656
657 if (nOk == TRISTATE_INDET) // HACK: make moved entry visible
658 MakeVisible( pSourceEntry );
659 }
660 pModel->SetCloneLink( aCloneLink );
661 return bSuccess;
662}
663
665{
666 std::vector<const SvTreeListEntry*> aList;
667 // cache selection, as the implementation deselects everything on the first
668 // remove
669 SvTreeListEntry* pEntry = FirstSelected();
670 while ( pEntry )
671 {
672 aList.push_back( pEntry );
673 if ( pEntry->HasChildren() )
674 // remove deletes all children automatically
675 SelectChildren(pEntry, false);
676 pEntry = NextSelected( pEntry );
677 }
678
679 for (auto const& elem : aList)
680 pModel->Remove(elem);
681}
682
684{
685 pModel->Remove(pEntry);
686}
687
689{
690 SvTreeListEntry* pEntry = First();
691 while( pEntry )
692 {
693 sal_uInt16 nCount = pEntry->ItemCount();
694 sal_uInt16 nCurPos = 0;
695 while ( nCurPos < nCount )
696 {
697 SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
698 rItem.InitViewData( this, pEntry );
699 nCurPos++;
700 }
701 pEntry = Next( pEntry );
702 }
703}
704
706{
708 return;
709 if ( !bShow && !(nImpFlags & SvTreeListBoxFlags::TARGEMPH_VIS) )
710 return;
711 pImpl->PaintDDCursor( pEntry, bShow);
712 if( bShow )
714 else
716}
717
719{
720 if ( !mpImpl->m_bDoingQuickSelection )
721 mpImpl->m_aQuickSelectionEngine.Reset();
722}
723
724SvTreeListEntry* SvTreeListBox::GetEntry( SvTreeListEntry* pParent, sal_uInt32 nPos ) const
725{
726 return pModel->GetEntry(pParent, nPos);
727}
728
729SvTreeListEntry* SvTreeListBox::GetEntry( sal_uInt32 nRootPos ) const
730{
731 return pModel->GetEntry(nRootPos);
732}
733
734SvTreeListEntry* SvTreeListBox::GetEntryFromPath( const ::std::deque< sal_Int32 >& _rPath ) const
735{
736
737 SvTreeListEntry* pEntry = nullptr;
738 SvTreeListEntry* pParent = nullptr;
739 for (auto const& elem : _rPath)
740 {
741 pEntry = GetEntry( pParent, elem );
742 if ( !pEntry )
743 break;
744 pParent = pEntry;
745 }
746
747 return pEntry;
748}
749
750void SvTreeListBox::FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_Int32 >& _rPath ) const
751{
752
753 if ( !pEntry )
754 return;
755
756 SvTreeListEntry* pParentEntry = GetParent( pEntry );
757 while ( true )
758 {
759 sal_uInt32 i, nCount = GetLevelChildCount( pParentEntry );
760 for ( i = 0; i < nCount; ++i )
761 {
762 SvTreeListEntry* pTemp = GetEntry( pParentEntry, i );
763 DBG_ASSERT( pEntry, "invalid entry" );
764 if ( pEntry == pTemp )
765 {
766 _rPath.push_front( static_cast<sal_Int32>(i) );
767 break;
768 }
769 }
770
771 if ( pParentEntry )
772 {
773 pEntry = pParentEntry;
774 pParentEntry = GetParent( pParentEntry );
775 }
776 else
777 break;
778 }
779}
780
782{
783 return pModel->GetParent(pEntry);
784}
785
786sal_uInt32 SvTreeListBox::GetChildCount( SvTreeListEntry const * pParent ) const
787{
788 return pModel->GetChildCount(pParent);
789}
790
792{
793
794 //if _pParent is 0, then pEntry is the first child of the root.
795 SvTreeListEntry* pEntry = FirstChild( _pParent );
796
797 if( !pEntry )//there is only root, root don't have children
798 return 0;
799
800 if( !_pParent )//root and children of root
801 return pEntry->pParent->m_Children.size();
802
803 return _pParent->m_Children.size();
804}
805
807{
808 return const_cast<SvViewDataEntry*>(SvListView::GetViewData(pEntry));
809}
810
812{
813 return const_cast<SvViewDataItem*>(static_cast<const SvTreeListBox*>(this)->GetViewDataItem(pEntry, pItem));
814}
815
817{
818 const SvViewDataEntry* pEntryData = SvListView::GetViewData(pEntry);
819 assert(pEntryData && "Entry not in View");
820 sal_uInt16 nItemPos = pEntry->GetPos(pItem);
821 return &pEntryData->GetItem(nItemPos);
822}
823
825{
826 SvTreeListEntry* pInhEntry = pEntry;
827 SvViewDataEntry* pEntryData = pData;
828
829 pEntryData->Init(pInhEntry->ItemCount());
830 sal_uInt16 nCount = pInhEntry->ItemCount();
831 sal_uInt16 nCurPos = 0;
832 while( nCurPos < nCount )
833 {
834 SvLBoxItem& rItem = pInhEntry->GetItem( nCurPos );
835 SvViewDataItem& rItemData = pEntryData->GetItem(nCurPos);
836 rItem.InitViewData( this, pInhEntry, &rItemData );
837 nCurPos++;
838 }
839}
840
842{
843 sal_uInt16 nRefDepth;
844 SvTreeListEntry* pTemp;
845
846 SvTreeListEntry* pSelEntry = FirstSelected();
847 while( pSelEntry )
848 {
849 if ( !bEnable )
850 {
852 nRefDepth = pModel->GetDepth( pSelEntry );
853 pTemp = Next( pSelEntry );
854 while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
855 {
857 pTemp = Next( pTemp );
858 }
859 }
860 else
861 {
863 nRefDepth = pModel->GetDepth( pSelEntry );
864 pTemp = Next( pSelEntry );
865 while( pTemp && pModel->GetDepth( pTemp ) > nRefDepth )
866 {
868 pTemp = Next( pTemp );
869 }
870 }
871 pSelEntry = NextSelected( pSelEntry );
872 }
873}
874
875// ******************************************************************
876// InplaceEditing
877// ******************************************************************
878
880{
881 return pEdCtrl ? pEdCtrl->GetEditWidget() : nullptr;
882}
883
884void SvTreeListBox::EditText( const OUString& rStr, const tools::Rectangle& rRect,
885 const Selection& rSel )
886{
887 pEdCtrl.reset();
890 HideFocus();
891 pEdCtrl.reset( new SvInplaceEdit2(
892 this, rRect.TopLeft(), rRect.GetSize(), rStr,
893 LINK( this, SvTreeListBox, TextEditEndedHdl_Impl ),
894 rSel ) );
895}
896
897IMPL_LINK_NOARG(SvTreeListBox, TextEditEndedHdl_Impl, SvInplaceEdit2&, void)
898{
899 if ( nImpFlags & SvTreeListBoxFlags::EDTEND_CALLED ) // avoid nesting
900 return;
902 OUString aStr;
903 if ( !pEdCtrl->EditingCanceled() )
904 aStr = pEdCtrl->GetText();
905 else
906 aStr = pEdCtrl->GetSavedValue();
907 EditedText( aStr );
908 // Hide may only be called after the new text was put into the entry, so
909 // that we don't call the selection handler in the GetFocus of the listbox
910 // with the old entry text.
911 pEdCtrl->Hide();
912 nImpFlags &= ~SvTreeListBoxFlags::IN_EDT;
913 GrabFocus();
914}
915
917{
918 if ( pEdCtrl )
919 pEdCtrl->StopEditing( true );
921}
922
923void SvTreeListBox::EndEditing( bool bCancel )
924{
925 if( pEdCtrl )
926 pEdCtrl->StopEditing( bCancel );
928}
929
931{
932 // always accept the current entry if there is one
933 SvTreeListEntry* pEntry( GetCurEntry() );
934 if (pEntry)
935 {
936 _out_entryText = GetEntryText(pEntry);
937 return pEntry;
938 }
939
940 pEntry = FirstSelected();
941 if ( !pEntry )
942 pEntry = First();
943
944 if ( pEntry )
945 _out_entryText = GetEntryText( pEntry );
946
947 return pEntry;
948}
949
950vcl::StringEntryIdentifier SvTreeListBox::NextEntry(vcl::StringEntryIdentifier _pCurrentSearchEntry, OUString& _out_entryText) const
951{
952 SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pCurrentSearchEntry ) );
953
954 if ( ( ( GetChildCount( pEntry ) > 0 )
955 || ( pEntry->HasChildrenOnDemand() )
956 )
957 && !IsExpanded( pEntry )
958 )
959 {
960 SvTreeListEntry* pNextSiblingEntry = pEntry->NextSibling();
961 if ( !pNextSiblingEntry )
962 pEntry = Next( pEntry );
963 else
964 pEntry = pNextSiblingEntry;
965 }
966 else
967 {
968 pEntry = Next( pEntry );
969 }
970
971 if ( !pEntry )
972 pEntry = First();
973
974 if ( pEntry )
975 _out_entryText = GetEntryText( pEntry );
976
977 return pEntry;
978}
979
981{
982 SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
983 DBG_ASSERT( pEntry, "SvTreeListBox::SelectSearchEntry: invalid entry!" );
984 if ( !pEntry )
985 return;
986
987 SelectAll( false );
988 SetCurEntry( pEntry );
989 Select( pEntry );
990}
991
993{
994 if ( _rKEvt.GetKeyCode().IsMod1() )
995 return false;
996
997 if (mbQuickSearch)
998 {
999 mpImpl->m_bDoingQuickSelection = true;
1000 const bool bHandled = mpImpl->m_aQuickSelectionEngine.HandleKeyEvent( _rKEvt );
1001 mpImpl->m_bDoingQuickSelection = false;
1002 if ( bHandled )
1003 return true;
1004 }
1005
1006 return false;
1007}
1008
1009
1010//JP 28.3.2001: new Drag & Drop API
1012{
1014
1016 {
1018 }
1019 else if( nDragDropMode == DragDropMode::NONE )
1020 {
1021 SAL_WARN( "svtools.contnr", "SvTreeListBox::QueryDrop(): no target" );
1022 }
1023 else
1024 {
1025 SvTreeListEntry* pEntry = GetDropTarget( rEvt.maPosPixel );
1026 if( !IsDropFormatSupported( SotClipboardFormatId::TREELISTBOX ) )
1027 {
1028 SAL_WARN( "svtools.contnr", "SvTreeListBox::QueryDrop(): no format" );
1029 }
1030 else
1031 {
1032 DBG_ASSERT(g_pDDSource, "SvTreeListBox::QueryDrop(): SourceBox == 0");
1033 if (!( pEntry && g_pDDSource->GetModel() == GetModel()
1034 && DND_ACTION_MOVE == rEvt.mnAction
1036 {
1037 nRet = rEvt.mnAction;
1038 }
1039 }
1040
1041 // **** draw emphasis ****
1042 if( DND_ACTION_NONE == nRet )
1044 else if( pEntry != pTargetEntry || !(nImpFlags & SvTreeListBoxFlags::TARGEMPH_VIS) )
1045 {
1047 pTargetEntry = pEntry;
1049 }
1050 }
1051 return nRet;
1052}
1053
1055{
1056 assert(pSourceView);
1057 pSourceView->EnableSelectionAsDropTarget();
1058
1060 g_pDDTarget = this;
1061
1062 TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
1063
1064 sal_Int8 nRet;
1065 if( aData.HasFormat( SotClipboardFormatId::TREELISTBOX ))
1066 nRet = rEvt.mnAction;
1067 else
1068 nRet = DND_ACTION_NONE;
1069
1070 if( DND_ACTION_NONE != nRet )
1071 {
1072 nRet = DND_ACTION_NONE;
1073
1074 SvTreeListEntry* pTarget = pTargetEntry; // may be 0!
1075
1076 if( DND_ACTION_COPY == rEvt.mnAction )
1077 {
1078 if (CopySelection(g_pDDSource, pTarget))
1079 nRet = rEvt.mnAction;
1080 }
1081 else if( DND_ACTION_MOVE == rEvt.mnAction )
1082 {
1083 if (MoveSelectionCopyFallbackPossible( g_pDDSource, pTarget, false ))
1084 nRet = rEvt.mnAction;
1085 }
1086 else if( DND_ACTION_COPYMOVE == rEvt.mnAction )
1087 {
1089 nRet = rEvt.mnAction;
1090 }
1091 }
1092 return nRet;
1093}
1094
1096{
1097 return ExecuteDrop( rEvt, g_pDDSource );
1098}
1099
1105{
1106 g_pDDSource = this;
1107 g_pDDTarget = nullptr;
1108}
1109
1110void SvTreeListBox::StartDrag( sal_Int8, const Point& rPosPixel )
1111{
1112 if(!isDisposed())
1113 {
1114 // tdf#143114 do not start drag when a Button/Checkbox is in
1115 // drag-before-ButtonUp mode (CaptureMouse() active)
1116 if(pImpl->IsCaptureOnButtonActive())
1117 return;
1118 }
1119
1122 return;
1123
1124 ReleaseMouse();
1125
1126 SvTreeListEntry* pEntry = GetEntry( rPosPixel ); // GetDropTarget( rPos );
1127 if( !pEntry )
1128 {
1130 return;
1131 }
1132
1134
1135 if (!xContainer)
1136 {
1137 xContainer.set(new TransferDataContainer);
1138 // apparently some (unused) content is needed
1139 xContainer->CopyAnyData( SotClipboardFormatId::TREELISTBOX,
1140 "unused", SAL_N_ELEMENTS("unused") );
1141 }
1142
1145 {
1148 return;
1149 }
1150
1152
1153 bool bOldUpdateMode = Control::IsUpdateMode();
1154 Control::SetUpdateMode( true );
1156 Control::SetUpdateMode( bOldUpdateMode );
1157
1158 // Disallow using the selection and its children as drop targets.
1159 // Important: If the selection of the SourceListBox is changed in the
1160 // DropHandler, the entries have to be allowed as drop targets again:
1161 // (GetSourceListBox()->EnableSelectionAsDropTarget( true, true );)
1163
1164 xContainer->StartDrag(this, mnDragAction, GetDragFinishedHdl());
1165}
1166
1168{
1169 m_xTransferHelper = rHelper;
1170 mnDragAction = eDNDConstants;
1171}
1172
1174#ifndef UNX
1175nAction
1176#endif
1177)
1178{
1180
1181#ifndef UNX
1182 if ( (nAction == DND_ACTION_MOVE)
1183 && ( (g_pDDTarget && (g_pDDTarget->GetModel() != GetModel()))
1184 || !g_pDDTarget))
1185 {
1187 }
1188#endif
1189
1191 g_pDDSource = nullptr;
1192 g_pDDTarget = nullptr;
1194}
1195
1197{
1198 if (pTargetEntry)
1199 {
1201 pTargetEntry = nullptr;
1202 }
1203}
1204
1206{
1207 return DragDropMode(0xffff);
1208}
1209
1210// Handler and methods for Drag - finished handler.
1211// The with get GetDragFinishedHdl() get link can set on the
1212// TransferDataContainer. This link is a callback for the DragFinished
1213// call. AddBox method is called from the GetDragFinishedHdl() and the
1214// remove is called in link callback and in the destructor. So it can't
1215// called to a deleted object.
1216
1217namespace
1218{
1219 // void* to avoid loplugin:vclwidgets, we don't need ownership here
1220 std::set<const void*> gSortLBoxes;
1221}
1222
1224{
1225 gSortLBoxes.insert( &rB );
1226}
1227
1229{
1230 gSortLBoxes.erase( &rB );
1231}
1232
1233IMPL_LINK( SvTreeListBox, DragFinishHdl_Impl, sal_Int8, nAction, void )
1234{
1235 auto &rSortLBoxes = gSortLBoxes;
1236 auto it = rSortLBoxes.find(this);
1237 if( it != rSortLBoxes.end() )
1238 {
1239 DragFinished( nAction );
1240 rSortLBoxes.erase( it );
1241 }
1242}
1243
1245{
1246 AddBoxToDDList_Impl( *this );
1247 return LINK( const_cast<SvTreeListBox*>(this), SvTreeListBox, DragFinishHdl_Impl );
1248}
1249
1250/*
1251 Bugs/TODO
1252
1253 - calculate rectangle when editing in-place (bug with some fonts)
1254 - SetSpaceBetweenEntries: offset is not taken into account in SetEntryHeight
1255*/
1256
1257#define SV_LBOX_DEFAULT_INDENT_PIXEL 20
1258
1260{
1261 pCheckButtonData = nullptr;
1262 pEdEntry = nullptr;
1263 pEdItem = nullptr;
1264 nEntryHeight = 0;
1265 pEdCtrl = nullptr;
1266 nFirstSelTab = 0;
1267 nLastSelTab = 0;
1268 nFocusWidth = -1;
1270
1274 pImpl.reset( new SvImpLBox( this, GetModel(), GetStyle() ) );
1275
1276 mbContextBmpExpanded = true;
1278
1279 SetFont( GetFont() );
1281
1284 InitSettings();
1285 ImplInitStyle();
1286 SetTabs();
1287}
1288
1290{
1291 assert(pEntry);
1292 OUStringBuffer sRet;
1293
1294 sal_uInt16 nCount = pEntry->ItemCount();
1295 sal_uInt16 nCur = 0;
1296 while( nCur < nCount )
1297 {
1298 SvLBoxItem& rItem = pEntry->GetItem( nCur );
1299 if ( (rItem.GetType() == SvLBoxItemType::String) &&
1300 !static_cast<SvLBoxString&>( rItem ).GetText().isEmpty() )
1301 {
1302 sRet.append(static_cast<SvLBoxString&>( rItem ).GetText() + ",");
1303 }
1304 nCur++;
1305 }
1306
1307 if (!sRet.isEmpty())
1308 sRet.remove(sRet.getLength() - 1, 1);
1309 return sRet.makeStringAndClear();
1310}
1311
1313{
1314 disposeOnce();
1315}
1316
1318{
1319 if (IsMouseCaptured())
1320 ReleaseMouse();
1321
1322 if( pImpl )
1323 {
1324 pImpl->CallEventListeners( VclEventId::ObjectDying );
1325 pImpl.reset();
1326 }
1327 if( mpImpl )
1328 {
1329 ClearTabList();
1330
1331 pEdCtrl.reset();
1332
1334
1336
1337 if (this == g_pDDSource)
1338 g_pDDSource = nullptr;
1339 if (this == g_pDDTarget)
1340 g_pDDTarget = nullptr;
1341 mpImpl.reset();
1342 }
1343
1347}
1348
1350{
1351 pImpl->SetNoAutoCurEntry( b );
1352}
1353
1355{
1356 pImpl->m_bSubLstOpLR = true;
1357}
1358
1360{
1361 if( IsEditingActive() )
1362 EndEditing( true );
1363
1365
1366 pImpl->Resize();
1367 nFocusWidth = -1;
1368 pImpl->ShowCursor( false );
1369 pImpl->ShowCursor( true );
1370}
1371
1372/* Cases:
1373
1374 A) entries have bitmaps
1375 0. no buttons
1376 1. node buttons (can optionally also be on root items)
1377 2. node buttons (can optionally also be on root items) + CheckButton
1378 3. CheckButton
1379 B) entries don't have bitmaps (=>via WindowBits because of D&D!)
1380 0. no buttons
1381 1. node buttons (can optionally also be on root items)
1382 2. node buttons (can optionally also be on root items) + CheckButton
1383 3. CheckButton
1384*/
1385
1386#define NO_BUTTONS 0
1387#define NODE_BUTTONS 1
1388#define NODE_AND_CHECK_BUTTONS 2
1389#define CHECK_BUTTONS 3
1390
1391#define TABFLAGS_TEXT (SvLBoxTabFlags::DYNAMIC | \
1392 SvLBoxTabFlags::ADJUST_LEFT | \
1393 SvLBoxTabFlags::EDITABLE | \
1394 SvLBoxTabFlags::SHOW_SELECTION)
1395
1396#define TABFLAGS_CONTEXTBMP (SvLBoxTabFlags::DYNAMIC | SvLBoxTabFlags::ADJUST_CENTER)
1397
1398#define TABFLAGS_CHECKBTN (SvLBoxTabFlags::DYNAMIC | \
1399 SvLBoxTabFlags::ADJUST_CENTER)
1400
1401#define TAB_STARTPOS 2
1402
1403// take care of GetTextOffset when doing changes
1405{
1406 if( IsEditingActive() )
1407 EndEditing( true );
1409 nFocusWidth = -1;
1410 const WinBits nStyle( GetStyle() );
1411 bool bHasButtons = (nStyle & WB_HASBUTTONS)!=0;
1412 bool bHasButtonsAtRoot = (nStyle & (WB_HASLINESATROOT |
1414 tools::Long nStartPos = TAB_STARTPOS;
1415 tools::Long nNodeWidthPixel = GetExpandedNodeBmp().GetSizePixel().Width();
1416
1417 // pCheckButtonData->Width() knows nothing about the native checkbox width,
1418 // so we have mnCheckboxItemWidth which becomes valid when something is added.
1419 tools::Long nCheckWidth = 0;
1421 nCheckWidth = mnCheckboxItemWidth;
1422 tools::Long nCheckWidthDIV2 = nCheckWidth / 2;
1423
1424 tools::Long nContextWidth = nContextBmpWidthMax;
1425 tools::Long nContextWidthDIV2 = nContextWidth / 2;
1426
1427 ClearTabList();
1428
1429 int nCase = NO_BUTTONS;
1431 {
1432 if( bHasButtons )
1433 nCase = NODE_BUTTONS;
1434 }
1435 else
1436 {
1437 if( bHasButtons )
1438 nCase = NODE_AND_CHECK_BUTTONS;
1439 else
1440 nCase = CHECK_BUTTONS;
1441 }
1442
1443 switch( nCase )
1444 {
1445 case NO_BUTTONS :
1446 nStartPos += nContextWidthDIV2; // because of centering
1447 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1448 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1449 // only set a distance if there are bitmaps
1451 nStartPos += 5; // distance context bitmap to text
1452 AddTab( nStartPos, TABFLAGS_TEXT );
1453 break;
1454
1455 case NODE_BUTTONS :
1456 if( bHasButtonsAtRoot )
1457 nStartPos += ( nIndent + (nNodeWidthPixel/2) );
1458 else
1459 nStartPos += nContextWidthDIV2;
1460 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1461 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1462 // only set a distance if there are bitmaps
1464 nStartPos += 5; // distance context bitmap to text
1465 AddTab( nStartPos, TABFLAGS_TEXT );
1466 break;
1467
1469 if( bHasButtonsAtRoot )
1470 nStartPos += ( nIndent + nNodeWidthPixel );
1471 else
1472 nStartPos += nCheckWidthDIV2;
1473 AddTab( nStartPos, TABFLAGS_CHECKBTN );
1474 nStartPos += nCheckWidthDIV2; // right edge of CheckButton
1475 nStartPos += 3; // distance CheckButton to context bitmap
1476 nStartPos += nContextWidthDIV2; // center of context bitmap
1477 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1478 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1479 // only set a distance if there are bitmaps
1481 nStartPos += 5; // distance context bitmap to text
1482 AddTab( nStartPos, TABFLAGS_TEXT );
1483 break;
1484
1485 case CHECK_BUTTONS :
1486 nStartPos += nCheckWidthDIV2;
1487 AddTab( nStartPos, TABFLAGS_CHECKBTN );
1488 nStartPos += nCheckWidthDIV2; // right edge of CheckButton
1489 nStartPos += 3; // distance CheckButton to context bitmap
1490 nStartPos += nContextWidthDIV2; // center of context bitmap
1491 AddTab( nStartPos, TABFLAGS_CONTEXTBMP );
1492 nStartPos += nContextWidthDIV2; // right edge of context bitmap
1493 // only set a distance if there are bitmaps
1495 nStartPos += 5; // distance context bitmap to text
1496 AddTab( nStartPos, TABFLAGS_TEXT );
1497 break;
1498 }
1499 pImpl->NotifyTabsChanged();
1500}
1501
1503 const OUString& aStr, const Image& aCollEntryBmp, const Image& aExpEntryBmp)
1504{
1506 {
1507 pEntry->AddItem(std::make_unique<SvLBoxButton>(pCheckButtonData));
1508 }
1509
1510 pEntry->AddItem(std::make_unique<SvLBoxContextBmp>( aCollEntryBmp,aExpEntryBmp, mbContextBmpExpanded));
1511
1512 pEntry->AddItem(std::make_unique<SvLBoxString>(aStr));
1513}
1514
1516{
1517 assert(pEntry);
1518 SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String));
1519 if (pItem) // There may be entries without text items, e.g. in IconView
1520 return pItem->GetText();
1521 return {};
1522}
1523
1525{
1526 assert(pEntry);
1527 const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
1528 assert(pItem);
1529 return pItem->GetBitmap2( );
1530}
1531
1533{
1534 assert(pEntry);
1535 const SvLBoxContextBmp* pItem = static_cast<const SvLBoxContextBmp*>(pEntry->GetFirstItem(SvLBoxItemType::ContextBmp));
1536 assert(pItem);
1537 return pItem->GetBitmap1( );
1538}
1539
1540IMPL_LINK( SvTreeListBox, CheckButtonClick, SvLBoxButtonData *, pData, void )
1541{
1542 pHdlEntry = pData->GetActEntry();
1543 CheckButtonHdl();
1544}
1545
1547 const OUString& rText,
1548 SvTreeListEntry* pParent,
1549 bool bChildrenOnDemand, sal_uInt32 nPos,
1550 void* pUser
1551)
1552{
1554
1555 const Image& rDefExpBmp = pImpl->GetDefaultEntryExpBmp( );
1556 const Image& rDefColBmp = pImpl->GetDefaultEntryColBmp( );
1557
1558 aCurInsertedExpBmp = rDefExpBmp;
1559 aCurInsertedColBmp = rDefColBmp;
1560
1561 SvTreeListEntry* pEntry = new SvTreeListEntry;
1562 pEntry->SetUserData( pUser );
1563 InitEntry( pEntry, rText, rDefColBmp, rDefExpBmp );
1564 pEntry->EnableChildrenOnDemand( bChildrenOnDemand );
1565
1566 if( !pParent )
1567 Insert( pEntry, nPos );
1568 else
1569 Insert( pEntry, pParent, nPos );
1570
1571 aPrevInsertedExpBmp = rDefExpBmp;
1572 aPrevInsertedColBmp = rDefColBmp;
1573
1575
1576 return pEntry;
1577}
1578
1579void SvTreeListBox::SetEntryText(SvTreeListEntry* pEntry, const OUString& rStr)
1580{
1581 SvLBoxString* pItem = static_cast<SvLBoxString*>(pEntry->GetFirstItem(SvLBoxItemType::String));
1582 assert(pItem);
1583 pItem->SetText(rStr);
1584 pItem->InitViewData( this, pEntry );
1585 GetModel()->InvalidateEntry( pEntry );
1586}
1587
1589{
1591
1592 assert(pItem);
1593 pItem->SetBitmap2( aBmp );
1594
1596 CalcEntryHeight( pEntry );
1597 Size aSize = aBmp.GetSizePixel();
1598 short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) );
1599 if( nWidth > nContextBmpWidthMax )
1600 {
1601 nContextBmpWidthMax = nWidth;
1602 SetTabs();
1603 }
1604}
1605
1607{
1609
1610 assert(pItem);
1611 pItem->SetBitmap1( aBmp );
1612
1614 CalcEntryHeight( pEntry );
1615 Size aSize = aBmp.GetSizePixel();
1616 short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) );
1617 if( nWidth > nContextBmpWidthMax )
1618 {
1619 nContextBmpWidthMax = nWidth;
1620 SetTabs();
1621 }
1622}
1623
1625{
1626 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1627 if( pItem )
1628 {
1629 auto nWidth = pItem->GetWidth(this, pEntry);
1630 if( mnCheckboxItemWidth < nWidth )
1631 {
1632 mnCheckboxItemWidth = nWidth;
1634 }
1635 }
1636}
1637
1639{
1640
1641 SvTreeListEntry* pParent = pModel->GetParent( pEntry );
1642 if( pParent )
1643 {
1644 SvTLEntryFlags nFlags = pParent->GetFlags();
1646 pParent->SetFlags( nFlags );
1647 }
1648
1652 {
1653 Size aSize = GetCollapsedEntryBmp( pEntry ).GetSizePixel();
1654 if( aSize.Width() > nContextBmpWidthMax )
1655 {
1656 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1658 }
1659 aSize = GetExpandedEntryBmp( pEntry ).GetSizePixel();
1660 if( aSize.Width() > nContextBmpWidthMax )
1661 {
1662 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1664 }
1665 }
1666 CalcEntryHeight( pEntry );
1667
1669 return;
1670
1671 CheckBoxInserted(pEntry);
1672}
1673
1675{
1677 return;
1678
1679 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1680 if(!pItem)
1681 return ;
1682 switch( eState )
1683 {
1685 pItem->SetStateChecked();
1686 break;
1687
1689 pItem->SetStateUnchecked();
1690 break;
1691
1693 pItem->SetStateTristate();
1694 break;
1695 }
1696 InvalidateEntry( pEntry );
1697}
1698
1700{
1702 if( pEntry && ( nTreeFlags & SvTreeFlags::CHKBTN ) )
1703 {
1704 SvLBoxButton* pItem = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
1705 if(!pItem)
1707 SvItemStateFlags nButtonFlags = pItem->GetButtonFlags();
1708 eState = SvLBoxButtonData::ConvertToButtonState( nButtonFlags );
1709 }
1710 return eState;
1711}
1712
1714{
1715 if ( pCheckButtonData )
1716 pImpl->CallEventListeners( VclEventId::CheckboxToggle, static_cast<void*>(pCheckButtonData->GetActEntry()) );
1717}
1718
1719
1720// TODO: Currently all data is cloned so that they conform to the default tree
1721// view format. Actually, the model should be used as a reference here. This
1722// leads to us _not_ calling SvTreeListEntry::Clone, but only its base class
1723// SvTreeListEntry.
1724
1725
1727{
1728 OUString aStr;
1729 Image aCollEntryBmp;
1730 Image aExpEntryBmp;
1731
1732 SvLBoxString* pStringItem = static_cast<SvLBoxString*>(pSource->GetFirstItem(SvLBoxItemType::String));
1733 if( pStringItem )
1734 aStr = pStringItem->GetText();
1735 SvLBoxContextBmp* pBmpItem = static_cast<SvLBoxContextBmp*>(pSource->GetFirstItem(SvLBoxItemType::ContextBmp));
1736 if( pBmpItem )
1737 {
1738 aCollEntryBmp = pBmpItem->GetBitmap1( );
1739 aExpEntryBmp = pBmpItem->GetBitmap2( );
1740 }
1741 SvTreeListEntry* pClone = new SvTreeListEntry;
1742 InitEntry( pClone, aStr, aCollEntryBmp, aExpEntryBmp );
1743 pClone->SvTreeListEntry::Clone( pSource );
1744 pClone->EnableChildrenOnDemand( pSource->HasChildrenOnDemand() );
1745 pClone->SetUserData( pSource->GetUserData() );
1746
1747 return pClone;
1748}
1749
1751{
1752 return pImpl->GetDefaultEntryExpBmp( );
1753}
1754
1756{
1757 return pImpl->GetDefaultEntryColBmp( );
1758}
1759
1761{
1762 Size aSize = aBmp.GetSizePixel();
1763 if( aSize.Width() > nContextBmpWidthMax )
1764 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1765 SetTabs();
1766
1767 pImpl->SetDefaultEntryExpBmp( aBmp );
1768}
1769
1771{
1772 Size aSize = aBmp.GetSizePixel();
1773 if( aSize.Width() > nContextBmpWidthMax )
1774 nContextBmpWidthMax = static_cast<short>(aSize.Width());
1775 SetTabs();
1776
1777 pImpl->SetDefaultEntryColBmp( aBmp );
1778}
1779
1781{
1782 if( !pData )
1784 else
1785 {
1788 pData->SetLink( LINK(this, SvTreeListBox, CheckButtonClick));
1789 }
1790
1791 SetTabs();
1792 if( IsUpdateMode() )
1793 Invalidate();
1794}
1795
1797{
1798 if ( pData )
1800}
1801
1803{
1805}
1806
1808{
1810}
1811
1813{
1816 SetTabs();
1817}
1818
1820{
1821 return true;
1822}
1823
1824bool SvTreeListBox::EditedEntry( SvTreeListEntry* /*pEntry*/,const OUString& /*rNewText*/)
1825{
1826 return true;
1827}
1828
1830{
1831 if (bOn)
1833 else
1835}
1836
1838{
1839 // under OS/2, we get key up/down even while editing
1840 if( IsEditingActive() )
1841 return;
1842
1843 if( !pImpl->KeyInput( rKEvt ) )
1844 {
1845 bool bHandled = HandleKeyInput( rKEvt );
1846 if ( !bHandled )
1847 Control::KeyInput( rKEvt );
1848 }
1849}
1850
1852{
1853 if( !pParent->HasChildren() )
1854 InsertEntry( "<dummy>", pParent );
1855}
1856
1858{
1859 //If there is no item in the tree, draw focus.
1860 if( !First())
1861 {
1862 Invalidate();
1863 }
1864 pImpl->GetFocus();
1866
1867 SvTreeListEntry* pEntry = FirstSelected();
1868 if ( !pEntry )
1869 {
1870 pEntry = pImpl->GetCurEntry();
1871 }
1872 if (pImpl->m_pCursor)
1873 {
1874 if (pEntry != pImpl->m_pCursor)
1875 pEntry = pImpl->m_pCursor;
1876 }
1877 if ( pEntry )
1878 pImpl->CallEventListeners( VclEventId::ListboxTreeFocus, pEntry );
1879
1880}
1881
1883{
1884 // If there is no item in the tree, delete visual focus.
1885 if ( !First() )
1886 Invalidate();
1887 if ( pImpl )
1888 pImpl->LoseFocus();
1890}
1891
1893{
1894 pImpl->m_pCursor = nullptr; // else we crash in GetFocus when editing in-place
1895 pTargetEntry = nullptr;
1896 pEdCtrl.reset();
1897 pImpl->Clear();
1898 nFocusWidth = -1;
1899
1903
1905 nEntryHeight = 0;
1909
1911}
1912
1913bool SvTreeListBox::PosOverBody(const Point& rPos) const
1914{
1915 if (rPos.X() < 0 || rPos.Y() < 0)
1916 return false;
1917 Size aSize(GetSizePixel());
1918 if (rPos.X() > aSize.Width() || rPos.Y() > aSize.Height())
1919 return false;
1920 if (pImpl->m_aVerSBar->IsVisible())
1921 {
1922 tools::Rectangle aRect(pImpl->m_aVerSBar->GetPosPixel(), pImpl->m_aVerSBar->GetSizePixel());
1923 if (aRect.Contains(rPos))
1924 return false;
1925 }
1926 if (pImpl->m_aHorSBar->IsVisible())
1927 {
1928 tools::Rectangle aRect(pImpl->m_aHorSBar->GetPosPixel(), pImpl->m_aHorSBar->GetSizePixel());
1929 if (aRect.Contains(rPos))
1930 return false;
1931 }
1932 return true;
1933}
1934
1935void SvTreeListBox::ScrollOutputArea( short nDeltaEntries )
1936{
1937 if( !nDeltaEntries || !pImpl->m_aVerSBar->IsVisible() )
1938 return;
1939
1940 tools::Long nThumb = pImpl->m_aVerSBar->GetThumbPos();
1941 tools::Long nMax = pImpl->m_aVerSBar->GetRange().Max();
1942
1943 if( nDeltaEntries < 0 )
1944 {
1945 // move window up
1946 nDeltaEntries *= -1;
1947 tools::Long nVis = pImpl->m_aVerSBar->GetVisibleSize();
1948 tools::Long nTemp = nThumb + nVis;
1949 if( nDeltaEntries > (nMax - nTemp) )
1950 nDeltaEntries = static_cast<short>(nMax - nTemp);
1951 pImpl->PageDown( static_cast<sal_uInt16>(nDeltaEntries) );
1952 }
1953 else
1954 {
1955 if( nDeltaEntries > nThumb )
1956 nDeltaEntries = static_cast<short>(nThumb);
1957 pImpl->PageUp( static_cast<sal_uInt16>(nDeltaEntries) );
1958 }
1959 pImpl->SyncVerThumb();
1960}
1961
1963{
1964 pImpl->ScrollToAbsPos( nPos );
1965}
1966
1968{
1969 eSelMode = eSelectMode;
1970 pImpl->SetSelectionMode( eSelectMode );
1971}
1972
1974{
1975 nDragDropMode = nDDMode;
1976 pImpl->SetDragDropMode( nDDMode );
1977}
1978
1980{
1981 short nHeightMax=0;
1982 sal_uInt16 nCount = pEntry->ItemCount();
1983 sal_uInt16 nCur = 0;
1984 SvViewDataEntry* pViewData = GetViewDataEntry( pEntry );
1985 while( nCur < nCount )
1986 {
1987 auto nHeight = SvLBoxItem::GetHeight(pViewData, nCur);
1988 if( nHeight > nHeightMax )
1989 nHeightMax = nHeight;
1990 nCur++;
1991 }
1992
1993 if( nHeightMax > nEntryHeight )
1994 {
1995 nEntryHeight = nHeightMax;
1997 pImpl->SetEntryHeight();
1998 }
1999}
2000
2002{
2003 if( nHeight > nEntryHeight )
2004 {
2005 nEntryHeight = nHeight;
2006 if( nEntryHeight )
2008 else
2011 pImpl->SetEntryHeight();
2012 }
2013}
2014
2016{
2017 nEntryWidth = nWidth;
2018}
2019
2021{
2022 const Size aSize( rBmp.GetSizePixel() );
2023 if( aSize.Height() > nEntryHeight )
2024 {
2025 nEntryHeight = static_cast<short>(aSize.Height()) + nEntryHeightOffs;
2026 pImpl->SetEntryHeight();
2027 }
2028}
2029
2031{
2032 tools::Long nHeight = GetTextHeight();
2033 if( nHeight > nEntryHeight )
2034 {
2035 nEntryHeight = static_cast<short>(nHeight) + nEntryHeightOffs;
2036 pImpl->SetEntryHeight();
2037 }
2038}
2039
2041{
2042 pHdlEntry = pParent;
2043 bool bExpanded = false;
2044 SvTLEntryFlags nFlags;
2045
2046 if( pParent->HasChildrenOnDemand() )
2047 RequestingChildren( pParent );
2048 bool bExpandAllowed = pParent->HasChildren() && ExpandingHdl();
2049 // double check if the expander callback ended up removing all children
2050 if (pParent->HasChildren())
2051 {
2052 if (bExpandAllowed)
2053 {
2054 bExpanded = true;
2055 ExpandListEntry( pParent );
2056 pImpl->EntryExpanded( pParent );
2057 pHdlEntry = pParent;
2058 ExpandedHdl();
2060 }
2061 nFlags = pParent->GetFlags();
2064 pParent->SetFlags( nFlags );
2065 }
2066 else
2067 {
2068 nFlags = pParent->GetFlags();
2070 pParent->SetFlags( nFlags );
2071 GetModel()->InvalidateEntry( pParent ); // repaint
2072 }
2073
2074 // #i92103#
2075 if ( bExpanded )
2076 {
2077 pImpl->CallEventListeners( VclEventId::ItemExpanded, pParent );
2078 }
2079
2080 return bExpanded;
2081}
2082
2084{
2085 pHdlEntry = pParent;
2086 bool bCollapsed = false;
2087
2088 if( ExpandingHdl() )
2089 {
2090 bCollapsed = true;
2091 pImpl->CollapsingEntry( pParent );
2092 CollapseListEntry( pParent );
2093 pImpl->EntryCollapsed( pParent );
2094 pHdlEntry = pParent;
2095 ExpandedHdl();
2097 }
2098
2099 // #i92103#
2100 if ( bCollapsed )
2101 {
2102 pImpl->CallEventListeners( VclEventId::ItemCollapsed, pParent );
2103 }
2104
2105 return bCollapsed;
2106}
2107
2108bool SvTreeListBox::Select( SvTreeListEntry* pEntry, bool bSelect )
2109{
2110 DBG_ASSERT(pEntry,"Select: Null-Ptr");
2111 bool bRetVal = SelectListEntry( pEntry, bSelect );
2112 DBG_ASSERT(IsSelected(pEntry)==bSelect,"Select failed");
2113 if( bRetVal )
2114 {
2115 pImpl->EntrySelected( pEntry, bSelect );
2116 pHdlEntry = pEntry;
2117 if( bSelect )
2118 {
2119 SelectHdl();
2121 }
2122 else
2123 DeselectHdl();
2124 }
2125 return bRetVal;
2126}
2127
2128sal_uInt32 SvTreeListBox::SelectChildren( SvTreeListEntry* pParent, bool bSelect )
2129{
2130 pImpl->DestroyAnchor();
2131 sal_uInt32 nRet = 0;
2132 if( !pParent->HasChildren() )
2133 return 0;
2134 sal_uInt16 nRefDepth = pModel->GetDepth( pParent );
2135 SvTreeListEntry* pChild = FirstChild( pParent );
2136 do {
2137 nRet++;
2138 Select( pChild, bSelect );
2139 pChild = Next( pChild );
2140 } while( pChild && pModel->GetDepth( pChild ) > nRefDepth );
2141 return nRet;
2142}
2143
2144void SvTreeListBox::SelectAll( bool bSelect )
2145{
2146 pImpl->SelAllDestrAnch(
2147 bSelect,
2148 true, // delete anchor,
2149 true ); // even when using SelectionMode::Single, deselect the cursor
2150}
2151
2153{
2154 sal_uInt16 nRefDepth = pModel->GetDepth( pEntry );
2155 SvTreeListEntry* pTmp = pEntry;
2156 do
2157 {
2158 ImpEntryInserted( pTmp );
2159 pTmp = Next( pTmp );
2160 } while( pTmp && nRefDepth < pModel->GetDepth( pTmp ) );
2161 pImpl->TreeInserted( pEntry );
2162}
2163
2165{
2166 ImpEntryInserted( pEntry );
2167 pImpl->EntryInserted( pEntry );
2168}
2169
2171{
2172 pImpl->MovingEntry( pSource );
2173}
2174
2176{
2177 pImpl->EntryMoved( pSource );
2178}
2179
2181{
2182 if(pEdEntry == pEntry)
2183 pEdEntry = nullptr;
2184
2185 pImpl->RemovingEntry( pEntry );
2186}
2187
2189{
2190 if (pEntry == pHdlEntry)
2191 pHdlEntry = nullptr;
2192
2193 if (pEntry == pTargetEntry)
2194 pTargetEntry = nullptr;
2195
2196 pImpl->EntryRemoved();
2197}
2198
2200{
2201 AdjustEntryHeight( rBmp );
2202 pImpl->SetCollapsedNodeBmp( rBmp );
2203}
2204
2206{
2207 AdjustEntryHeight( rBmp );
2208 pImpl->SetExpandedNodeBmp( rBmp );
2209}
2210
2211
2213{
2214 vcl::Font aTempFont( rFont );
2215 vcl::Font aOrigFont( GetFont() );
2216 aTempFont.SetTransparent( true );
2217 if (aTempFont == aOrigFont)
2218 return;
2219 Control::SetFont( aTempFont );
2220
2221 aTempFont.SetColor(aOrigFont.GetColor());
2222 aTempFont.SetFillColor(aOrigFont.GetFillColor());
2223 aTempFont.SetTransparent(aOrigFont.IsTransparent());
2224
2225 if (aTempFont == aOrigFont)
2226 return;
2227
2229}
2230
2232{
2234 // always invalidate, else things go wrong in SetEntryHeight
2236}
2237
2239{
2240 Control::Paint(rRenderContext, rRect);
2242 SetTabs();
2243 pImpl->Paint(rRenderContext, rRect);
2244
2245 //Add visual focus draw
2246 if (First())
2247 return;
2248
2249 if (HasFocus())
2250 {
2251 tools::Long nHeight = rRenderContext.GetTextHeight();
2252 tools::Rectangle aRect(Point(0, 0), Size(GetSizePixel().Width(), nHeight));
2253 ShowFocus(aRect);
2254 }
2255 else
2256 {
2257 HideFocus();
2258 }
2259}
2260
2262{
2263 // tdf#143114 remember the *correct* starting entry
2264 pImpl->m_pCursorOld = (rMEvt.IsLeft() && (nTreeFlags & SvTreeFlags::CHKBTN) && mnClicksToToggle > 0)
2265 ? GetEntry(rMEvt.GetPosPixel())
2266 : nullptr;
2267
2268 pImpl->MouseButtonDown( rMEvt );
2269}
2270
2272{
2273 // tdf#116675 clicking on an entry should toggle its checkbox
2274 // tdf#143114 use the already created starting entry and if it exists
2275 if (nullptr != pImpl->m_pCursorOld)
2276 {
2277 const Point aPnt = rMEvt.GetPosPixel();
2278 SvTreeListEntry* pEntry = GetEntry(aPnt);
2279
2280 // compare if MouseButtonUp *is* on the same entry, regardless of scrolling
2281 // or other things
2282 if (pEntry && pEntry->m_Items.size() > 0 && 1 == mnClicksToToggle && pEntry == pImpl->m_pCursorOld)
2283 {
2284 SvLBoxItem* pItem = GetItem(pEntry, aPnt.X());
2285 // if the checkbox button was clicked, that will be toggled later, do not toggle here
2286 // anyway users probably don't want to toggle the checkbox by clickink on another button
2287 if (!pItem || pItem->GetType() != SvLBoxItemType::Button)
2288 {
2289 SvLBoxButton* pItemCheckBox
2290 = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
2291 if (pItemCheckBox && pItemCheckBox->isEnable() && GetItemPos(pEntry, 0).first < aPnt.X() - GetMapMode().GetOrigin().X())
2292 {
2293 pItemCheckBox->ClickHdl(pEntry);
2294 InvalidateEntry(pEntry);
2295 }
2296 }
2297 }
2298 }
2299
2300 pImpl->MouseButtonUp( rMEvt );
2301}
2302
2304{
2305 pImpl->MouseMove( rMEvt );
2306}
2307
2309{
2310 pImpl->SetUpdateMode( bUpdate );
2311 mbUpdateAlternatingRows = bUpdate;
2313}
2314
2316{
2317 if( nOffsLogic != nEntryHeightOffs )
2318 {
2320 nEntryHeightOffs = nOffsLogic;
2321 nEntryHeight = nEntryHeight + nOffsLogic;
2323 pImpl->SetEntryHeight();
2324 }
2325}
2326
2328{
2329 pImpl->SetCurEntry( pEntry );
2330}
2331
2333{
2334 return pImpl->GetExpandedNodeBmp( );
2335}
2336
2338{
2339 return pImpl->GetEntryPosition( pEntry );
2340}
2341
2343{
2344 pImpl->MakeVisible(pEntry);
2345}
2346
2347void SvTreeListBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
2348{
2349 pImpl->MakeVisible( pEntry, bMoveToTop );
2350}
2351
2353{
2354
2355 // reinitialize the separate items of the entries
2356 sal_uInt16 nCount = pEntry->ItemCount();
2357 for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ )
2358 {
2359 SvLBoxItem& rItem = pEntry->GetItem( nIdx );
2360 rItem.InitViewData( this, pEntry );
2361 }
2362
2363 // repaint
2364 pImpl->InvalidateEntry( pEntry );
2365}
2366
2368{
2369 assert(pEntry && pItem);
2370 if( IsSelected( pEntry ))
2371 {
2372 pImpl->ShowCursor( false );
2373 SelectListEntry( pEntry, false );
2374 pImpl->InvalidateEntry(pEntry);
2375 SelectListEntry( pEntry, true );
2376 pImpl->ShowCursor( true );
2377 }
2378 pEdEntry = pEntry;
2379 pEdItem = pItem;
2380 SvLBoxTab* pTab = GetTab( pEntry, pItem );
2381 DBG_ASSERT(pTab,"EditItemText:Tab not found");
2382
2383 auto nItemHeight( pItem->GetHeight(this, pEntry) );
2384 Point aPos = GetEntryPosition( pEntry );
2385 aPos.AdjustY(( nEntryHeight - nItemHeight ) / 2 );
2386 aPos.setX( GetTabPos( pEntry, pTab ) );
2387 tools::Long nOutputWidth = pImpl->GetOutputSize().Width();
2388 Size aSize( nOutputWidth - aPos.X(), nItemHeight );
2389 sal_uInt16 nPos = std::find_if( aTabs.begin(), aTabs.end(),
2390 [pTab](const std::unique_ptr<SvLBoxTab>& p) { return p.get() == pTab; })
2391 - aTabs.begin();
2392 if( nPos+1 < static_cast<sal_uInt16>(aTabs.size()) )
2393 {
2394 SvLBoxTab* pRightTab = aTabs[ nPos + 1 ].get();
2395 tools::Long nRight = GetTabPos( pEntry, pRightTab );
2396 if( nRight <= nOutputWidth )
2397 aSize.setWidth( nRight - aPos.X() );
2398 }
2399 Point aOrigin( GetMapMode().GetOrigin() );
2400 aPos += aOrigin; // convert to win coordinates
2401 aSize.AdjustWidth( -(aOrigin.X()) );
2402 tools::Rectangle aRect( aPos, aSize );
2403 EditText( pItem->GetText(), aRect, rSelection );
2404}
2405
2407{
2408 pImpl->m_aEditClickPos = Point( -1, -1 );
2409 ImplEditEntry( pEntry );
2410}
2411
2413{
2414 if( IsEditingActive() )
2415 EndEditing();
2416 if( !pEntry )
2417 pEntry = GetCurEntry();
2418 if( !pEntry )
2419 return;
2420
2421 tools::Long nClickX = pImpl->m_aEditClickPos.X();
2422 bool bIsMouseTriggered = nClickX >= 0;
2423
2424 SvLBoxString* pItem = nullptr;
2425 sal_uInt16 nCount = pEntry->ItemCount();
2426 tools::Long nTabPos, nNextTabPos = 0;
2427 for( sal_uInt16 i = 0 ; i < nCount ; i++ )
2428 {
2429 SvLBoxItem& rTmpItem = pEntry->GetItem( i );
2430 if (rTmpItem.GetType() != SvLBoxItemType::String)
2431 continue;
2432
2433 SvLBoxTab* pTab = GetTab( pEntry, &rTmpItem );
2434 nNextTabPos = -1;
2435 if( i < nCount - 1 )
2436 {
2437 SvLBoxItem& rNextItem = pEntry->GetItem( i + 1 );
2438 SvLBoxTab* pNextTab = GetTab( pEntry, &rNextItem );
2439 nNextTabPos = pNextTab->GetPos();
2440 }
2441
2442 if( pTab && pTab->IsEditable() )
2443 {
2444 nTabPos = pTab->GetPos();
2445 if( !bIsMouseTriggered || (nClickX > nTabPos && (nNextTabPos == -1 || nClickX < nNextTabPos ) ) )
2446 {
2447 pItem = static_cast<SvLBoxString*>( &rTmpItem );
2448 break;
2449 }
2450 }
2451 }
2452
2453 if( pItem && EditingEntry( pEntry ) )
2454 {
2456 SelectAll( false );
2457 MakeVisible( pEntry );
2458 EditItemText( pEntry, pItem, aSel );
2459 }
2460}
2461
2462void SvTreeListBox::EditedText( const OUString& rStr )
2463
2464{
2465 if(pEdEntry) // we have to check if this entry is null that means that it is removed while editing
2466 {
2467 if( EditedEntry( pEdEntry, rStr ) )
2468 {
2469 static_cast<SvLBoxString*>(pEdItem)->SetText( rStr );
2470 pModel->InvalidateEntry( pEdEntry );
2471 }
2472 if( GetSelectionCount() == 0 )
2473 Select( pEdEntry );
2476 }
2477}
2478
2480{
2481 // scroll
2482 if( rPos.Y() < 12 )
2483 {
2485 ScrollOutputArea( +1 );
2486 }
2487 else
2488 {
2489 Size aSize( pImpl->GetOutputSize() );
2490 if( rPos.Y() > aSize.Height() - 12 )
2491 {
2493 ScrollOutputArea( -1 );
2494 }
2495 }
2496
2497 SvTreeListEntry* pTarget = pImpl->GetEntry( rPos );
2498 // when dropping in a vacant space, use the last entry
2499 if( !pTarget )
2500 return LastVisible();
2502 pTarget == First() && rPos.Y() < 6 )
2503 return nullptr;
2504
2505 return pTarget;
2506}
2507
2508
2509SvTreeListEntry* SvTreeListBox::GetEntry( const Point& rPos, bool bHit ) const
2510{
2511 SvTreeListEntry* pEntry = pImpl->GetEntry( rPos );
2512 if( pEntry && bHit )
2513 {
2514 tools::Long nLine = pImpl->GetEntryLine( pEntry );
2515 if( !(pImpl->EntryReallyHit( pEntry, rPos, nLine)) )
2516 return nullptr;
2517 }
2518 return pEntry;
2519}
2520
2522{
2523 return pImpl ? pImpl->GetCurEntry() : nullptr;
2524}
2525
2527{
2528 const WinBits nWindowStyle = GetStyle();
2529
2531 if (nWindowStyle & WB_SORT)
2532 {
2535 }
2536 else
2537 {
2540 }
2541 pImpl->SetStyle(nWindowStyle);
2542 pImpl->Resize();
2543 Invalidate();
2544}
2545
2547{
2548 DBG_ASSERT(pEntry,"InvalidateEntry:No Entry");
2549 if (pEntry)
2550 {
2551 GetModel()->InvalidateEntry(pEntry);
2552 }
2553}
2554
2556{
2557 tools::Rectangle aRect; // multi purpose
2558
2559 bool bHorSBar = pImpl->HasHorScrollBar();
2560
2561 pImpl->UpdateContextBmpWidthMax(&rEntry);
2562
2564 SetTabs();
2565
2566 short nTempEntryHeight = GetEntryHeight();
2567 tools::Long nWidth = pImpl->GetOutputSize().Width();
2568
2569 // Did we turn on the scrollbar within PreparePaints? If yes, we have to set
2570 // the ClipRegion anew.
2571 if (!bHorSBar && pImpl->HasHorScrollBar())
2572 rRenderContext.SetClipRegion(vcl::Region(pImpl->GetClipRegionRect()));
2573
2574 Point aEntryPos(rRenderContext.GetMapMode().GetOrigin());
2575 aEntryPos.setX( aEntryPos.X() * -1 ); // conversion document coordinates
2576 tools::Long nMaxRight = nWidth + aEntryPos.X() - 1;
2577
2578 Color aBackupTextColor(rRenderContext.GetTextColor());
2579 vcl::Font aBackupFont(rRenderContext.GetFont());
2580 Color aBackupColor = rRenderContext.GetFillColor();
2581
2582 bool bCurFontIsSel = false;
2583 // if a ClipRegion was set from outside, we don't have to reset it
2584 const WinBits nWindowStyle = GetStyle();
2585 const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) !=0 && !HasFocus();
2586 const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
2587
2588 vcl::Font aHighlightFont(rRenderContext.GetFont());
2589 const Color aHighlightTextColor(rSettings.GetHighlightTextColor());
2590 aHighlightFont.SetColor(aHighlightTextColor);
2591
2592 Size aRectSize(0, nTempEntryHeight);
2593
2594 SvViewDataEntry* pViewDataEntry = GetViewDataEntry( &rEntry );
2595 const bool bSeparator(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
2596
2597 const size_t nTabCount = aTabs.size();
2598 const size_t nItemCount = rEntry.ItemCount();
2599 size_t nCurTab = 0;
2600 size_t nCurItem = 0;
2601
2602 while (nCurTab < nTabCount && nCurItem < nItemCount)
2603 {
2604 SvLBoxTab* pTab = aTabs[nCurTab].get();
2605 const size_t nNextTab = nCurTab + 1;
2606 SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2607 SvLBoxItem& rItem = rEntry.GetItem(nCurItem);
2608
2609 SvLBoxTabFlags nFlags = pTab->nFlags;
2610 Size aSize(rItem.GetWidth(this, pViewDataEntry, nCurItem),
2611 SvLBoxItem::GetHeight(pViewDataEntry, nCurItem));
2612 tools::Long nTabPos = GetTabPos(&rEntry, pTab);
2613
2614 tools::Long nNextTabPos;
2615 if (pNextTab)
2616 nNextTabPos = GetTabPos(&rEntry, pNextTab);
2617 else
2618 {
2619 nNextTabPos = nMaxRight;
2620 if (nTabPos > nMaxRight)
2621 nNextTabPos += 50;
2622 }
2623
2624 tools::Long nX;
2626 // avoid cutting the right edge off the tab separation
2627 nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos - SV_TAB_BORDER - 1) - nTabPos);
2628 else
2629 nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos);
2630
2631 aEntryPos.setX( nX );
2632 aEntryPos.setY( nLine );
2633
2634 // set background pattern/color
2635
2636 Wallpaper aWallpaper = rRenderContext.GetBackground();
2637
2638 bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION);
2639
2640 if (pViewDataEntry->IsHighlighted() && bSelTab)
2641 {
2642 Color aNewWallColor = rSettings.GetHighlightColor();
2643 // if the face color is bright then the deactivate color is also bright
2644 // -> so you can't see any deactivate selection
2645 if (bHideSelection && !rSettings.GetFaceColor().IsBright()
2646 && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright())
2647 {
2648 aNewWallColor = rSettings.GetDeactiveColor();
2649 }
2650 // set font color to highlight
2651 if (!bCurFontIsSel)
2652 {
2653 rRenderContext.SetTextColor(aHighlightTextColor);
2654 rRenderContext.SetFont(aHighlightFont);
2655 bCurFontIsSel = true;
2656 }
2657 aWallpaper.SetColor(aNewWallColor);
2658 }
2659 else // no selection
2660 {
2661 if (bCurFontIsSel || rEntry.GetTextColor())
2662 {
2663 bCurFontIsSel = false;
2664 if (const auto & xCustomTextColor = rEntry.GetTextColor())
2665 rRenderContext.SetTextColor(*xCustomTextColor);
2666 else
2667 rRenderContext.SetTextColor(aBackupTextColor);
2668 rRenderContext.SetFont(aBackupFont);
2669 }
2670 else
2671 {
2672 aWallpaper.SetColor(rEntry.GetBackColor());
2673 }
2674 }
2675
2676 // draw background
2678 {
2679 // only draw the area that is used by the item
2680 aRectSize.setWidth( aSize.Width() );
2681 aRect.SetPos(aEntryPos);
2682 aRect.SetSize(aRectSize);
2683 }
2684 else
2685 {
2686 // draw from the current to the next tab
2687 if (nCurTab != 0)
2688 aRect.SetLeft( nTabPos );
2689 else
2690 // if we're in the 0th tab, always draw from column 0 --
2691 // else we get problems with centered tabs
2692 aRect.SetLeft( 0 );
2693 aRect.SetTop( nLine );
2694 aRect.SetBottom( nLine + nTempEntryHeight - 1 );
2695 if (pNextTab)
2696 {
2697 tools::Long nRight;
2698 nRight = GetTabPos(&rEntry, pNextTab) - 1;
2699 if (nRight > nMaxRight)
2700 nRight = nMaxRight;
2701 aRect.SetRight( nRight );
2702 }
2703 else
2704 {
2705 aRect.SetRight( nMaxRight );
2706 }
2707 }
2708 // A custom selection that starts at a tab position > 0, do not fill
2709 // the background of the 0th item, else e.g. we might not be able to
2710 // realize tab listboxes with lines.
2711 if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
2712 {
2713 Color aBackgroundColor = aWallpaper.GetColor();
2714 if (aBackgroundColor != COL_TRANSPARENT)
2715 {
2716 rRenderContext.SetFillColor(aBackgroundColor);
2717 // this case may occur for smaller horizontal resizes
2718 if (aRect.Left() < aRect.Right())
2719 rRenderContext.DrawRect(aRect);
2720 }
2721 }
2722 // draw item
2723 // center vertically
2724 aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
2725
2726 rItem.Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry);
2727
2728 // division line between tabs (but not if this is a separator line)
2729 if (!bSeparator && pNextTab && rItem.GetType() == SvLBoxItemType::String &&
2730 // not at the right edge of the window!
2731 aRect.Right() < nMaxRight)
2732 {
2733 aRect.SetLeft( aRect.Right() - SV_TAB_BORDER );
2734 rRenderContext.DrawRect(aRect);
2735 }
2736
2737 rRenderContext.SetFillColor(aBackupColor);
2738
2739 nCurItem++;
2740 nCurTab++;
2741 }
2742
2743 if (pViewDataEntry->IsDragTarget())
2744 {
2745 rRenderContext.Push();
2746 rRenderContext.SetLineColor(rSettings.GetDeactiveColor());
2747 rRenderContext.SetFillColor(rSettings.GetDeactiveColor());
2748
2749 const bool bAsTree = GetStyle() & (WB_HASLINES | WB_HASLINESATROOT);
2750 if (bAsTree)
2751 {
2752 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine + nTempEntryHeight - 2), Size(nWidth, 2)));
2753 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2)));
2754 }
2755 else
2756 {
2757 rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2)));
2758 }
2759
2760 rRenderContext.Pop();
2761 }
2762
2763 if (bCurFontIsSel || rEntry.GetTextColor())
2764 {
2765 rRenderContext.SetTextColor(aBackupTextColor);
2766 rRenderContext.SetFont(aBackupFont);
2767 }
2768
2769 sal_uInt16 nFirstDynTabPos(0);
2770 SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab(nFirstDynTabPos);
2771 tools::Long nDynTabPos = GetTabPos(&rEntry, pFirstDynamicTab);
2772 nDynTabPos += pImpl->m_nNodeBmpTabDistance;
2773 nDynTabPos += pImpl->m_nNodeBmpWidth / 2;
2774 nDynTabPos += 4; // 4 pixels of buffer, so the node bitmap is not too close
2775 // to the next tab
2776
2777 if( !((!(rEntry.GetFlags() & SvTLEntryFlags::NO_NODEBMP)) &&
2778 (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab &&
2779 (rEntry.HasChildren() || rEntry.HasChildrenOnDemand())))
2780 return;
2781
2782 // find first tab and check if the node bitmap extends into it
2783 sal_uInt16 nNextTab = nFirstDynTabPos;
2784 SvLBoxTab* pNextTab;
2785 do
2786 {
2787 nNextTab++;
2788 pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2789 } while (pNextTab && pNextTab->IsDynamic());
2790
2791 if (pNextTab && (GetTabPos( &rEntry, pNextTab ) <= nDynTabPos))
2792 return;
2793
2794 if (!((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(&rEntry) > 0))
2795 return;
2796
2797 Point aPos(GetTabPos(&rEntry, pFirstDynamicTab), nLine);
2798 aPos.AdjustX(pImpl->m_nNodeBmpTabDistance );
2799
2800 const Image* pImg = nullptr;
2801
2802 const bool bExpanded = IsExpanded(&rEntry);
2803 if (bExpanded)
2804 pImg = &pImpl->GetExpandedNodeBmp();
2805 else
2806 pImg = &pImpl->GetCollapsedNodeBmp();
2807 const bool bDefaultImage = bExpanded ? *pImg == GetDefaultExpandedNodeImage()
2808 : *pImg == GetDefaultCollapsedNodeImage();
2809 aPos.AdjustY((nTempEntryHeight - pImg->GetSizePixel().Height()) / 2 );
2810
2811 if (!bDefaultImage)
2812 {
2813 // If it's a custom image then draw what was explicitly set to use
2815 if (!IsEnabled())
2816 nStyle |= DrawImageFlags::Disable;
2817 rRenderContext.DrawImage(aPos, *pImg, nStyle);
2818 }
2819 else
2820 {
2821 bool bNativeOK = false;
2822 // native
2824 {
2825 ImplControlValue aControlValue;
2826 tools::Rectangle aCtrlRegion(aPos, pImg->GetSizePixel());
2828
2829 if (IsEnabled())
2831
2832 if (bExpanded)
2833 aControlValue.setTristateVal(ButtonValue::On); //expanded node
2834 else
2835 {
2836 if ((!rEntry.HasChildren()) && rEntry.HasChildrenOnDemand() &&
2837 (!(rEntry.GetFlags() & SvTLEntryFlags::HAD_CHILDREN)))
2838 {
2839 aControlValue.setTristateVal( ButtonValue::DontKnow ); //don't know
2840 }
2841 else
2842 {
2843 aControlValue.setTristateVal( ButtonValue::Off ); //collapsed node
2844 }
2845 }
2846
2847 bNativeOK = rRenderContext.DrawNativeControl(ControlType::ListNode, ControlPart::Entire, aCtrlRegion, nState, aControlValue, OUString());
2848 }
2849 if (!bNativeOK)
2850 {
2851 DecorationView aDecoView(&rRenderContext);
2853 if (!IsEnabled())
2854 nSymbolStyle |= DrawSymbolFlags::Disable;
2855
2856 Color aCol = aBackupTextColor;
2857 if (pViewDataEntry->IsHighlighted())
2858 aCol = aHighlightTextColor;
2859
2861 aDecoView.DrawSymbol(tools::Rectangle(aPos, pImg->GetSizePixel()), eSymbol, aCol, nSymbolStyle);
2862 }
2863 }
2864}
2865
2867{
2868 aCustomRenderHdl.Call(std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&>(rRenderContext, rRect, rEntry));
2869}
2870
2872{
2873 return aCustomMeasureHdl.Call(std::pair<vcl::RenderContext&, const SvTreeListEntry&>(rRenderContext, rEntry));
2874}
2875
2877{
2878 pImpl->UpdateContextBmpWidthMax( pEntry );
2879
2880 Size aSize;
2881 tools::Rectangle aRect;
2882 aRect.SetTop( nLine );
2883 aSize.setHeight( GetEntryHeight() );
2884
2885 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2886 nRealWidth -= GetMapMode().GetOrigin().X();
2887
2888 sal_uInt16 nCurTab;
2890 tools::Long nTabPos = 0;
2891 if( pTab )
2892 nTabPos = GetTabPos( pEntry, pTab );
2893 tools::Long nNextTabPos;
2894 if( pTab && nCurTab < aTabs.size() - 1 )
2895 {
2896 SvLBoxTab* pNextTab = aTabs[ nCurTab + 1 ].get();
2897 nNextTabPos = GetTabPos( pEntry, pNextTab );
2898 }
2899 else
2900 {
2901 nNextTabPos = nRealWidth;
2902 if( nTabPos > nRealWidth )
2903 nNextTabPos += 50;
2904 }
2905
2906 bool bUserSelection = bool( nTreeFlags & SvTreeFlags::USESEL );
2907 if( !bUserSelection )
2908 {
2909 if( pTab && nCurTab < pEntry->ItemCount() )
2910 {
2911 const SvLBoxItem& rItem = pEntry->GetItem( nCurTab );
2912 aSize.setWidth(rItem.GetWidth(this, pEntry));
2913 if( !aSize.Width() )
2914 aSize.setWidth( 15 );
2915 tools::Long nX = nTabPos; //GetTabPos( pEntry, pTab );
2916 // alignment
2917 nX += pTab->CalcOffset( aSize.Width(), nNextTabPos - nTabPos );
2918 aRect.SetLeft( nX );
2919 // make sure that first and last letter aren't cut off slightly
2920 aRect.SetSize( aSize );
2921 if( aRect.Left() > 0 )
2922 aRect.AdjustLeft( -1 );
2923 aRect.AdjustRight( 1 );
2924 }
2925 }
2926 else
2927 {
2928 // if SelTab != 0, we have to calculate also
2929 if( nFocusWidth == -1 || nFirstSelTab )
2930 {
2931 SvLBoxTab* pLastTab = nullptr; // default to select whole width
2932
2933 sal_uInt16 nLastTab;
2935 nLastTab++;
2936 if( nLastTab < aTabs.size() ) // is there another one?
2937 pLastTab = aTabs[ nLastTab ].get();
2938
2939 aSize.setWidth( pLastTab ? pLastTab->GetPos() : 0x0fffffff );
2940 nFocusWidth = static_cast<short>(aSize.Width());
2941 if( pTab )
2942 nFocusWidth = nFocusWidth - static_cast<short>(nTabPos); //pTab->GetPos();
2943 }
2944 else
2945 {
2946 aSize.setWidth( nFocusWidth );
2947 if( pTab )
2948 {
2949 if( nCurTab )
2950 aSize.AdjustWidth(nTabPos );
2951 else
2952 aSize.AdjustWidth(pTab->GetPos() ); // Tab0 always from the leftmost position
2953 }
2954 }
2955 // if selection starts with 0th tab, draw from column 0 on
2956 if( nCurTab != 0 )
2957 {
2958 aRect.SetLeft( nTabPos );
2959 aSize.AdjustWidth( -nTabPos );
2960 }
2961 aRect.SetSize( aSize );
2962 }
2963 // adjust right edge because of clipping
2964 if( aRect.Right() >= nRealWidth )
2965 {
2966 aRect.SetRight( nRealWidth-1 );
2967 nFocusWidth = static_cast<short>(aRect.GetWidth());
2968 }
2969 return aRect;
2970}
2971
2972sal_IntPtr SvTreeListBox::GetTabPos(const SvTreeListEntry* pEntry, const SvLBoxTab* pTab) const
2973{
2974 assert(pTab);
2975 sal_IntPtr nPos = pTab->GetPos();
2976 if( pTab->IsDynamic() )
2977 {
2978 sal_uInt16 nDepth = pModel->GetDepth( pEntry );
2979 nDepth = nDepth * static_cast<sal_uInt16>(nIndent);
2980 nPos += static_cast<sal_IntPtr>(nDepth);
2981 }
2982 return nPos + (pEntry->GetExtraIndent() * nIndent);
2983}
2984
2986 SvLBoxTab** ppTab )
2987{
2988 SvLBoxItem* pItemClicked = nullptr;
2989 sal_uInt16 nTabCount = aTabs.size();
2990 sal_uInt16 nItemCount = pEntry->ItemCount();
2991 SvLBoxTab* pTab = aTabs.front().get();
2992 SvLBoxItem* pItem = &pEntry->GetItem(0);
2993 sal_uInt16 nNextItem = 1;
2994 nX -= GetMapMode().GetOrigin().X();
2995 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2996 nRealWidth -= GetMapMode().GetOrigin().X();
2997
2998 while( true )
2999 {
3000 SvLBoxTab* pNextTab=nNextItem<nTabCount ? aTabs[nNextItem].get() : nullptr;
3001 tools::Long nStart = GetTabPos( pEntry, pTab );
3002
3003 tools::Long nNextTabPos;
3004 if( pNextTab )
3005 nNextTabPos = GetTabPos( pEntry, pNextTab );
3006 else
3007 {
3008 nNextTabPos = nRealWidth;
3009 if( nStart > nRealWidth )
3010 nNextTabPos += 50;
3011 }
3012
3013 auto nItemWidth(pItem->GetWidth(this, pEntry));
3014 nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
3015 auto nLen = nItemWidth;
3016 if( pNextTab )
3017 {
3018 tools::Long nTabWidth = GetTabPos( pEntry, pNextTab ) - nStart;
3019 if( nTabWidth < nLen )
3020 nLen = nTabWidth;
3021 }
3022
3023 if( nX >= nStart && nX < (nStart+nLen ) )
3024 {
3025 pItemClicked = pItem;
3026 if( ppTab )
3027 {
3028 *ppTab = pTab;
3029 break;
3030 }
3031 }
3032 if( nNextItem >= nItemCount || nNextItem >= nTabCount)
3033 break;
3034 pTab = aTabs[ nNextItem ].get();
3035 pItem = &pEntry->GetItem( nNextItem );
3036 nNextItem++;
3037 }
3038 return pItemClicked;
3039}
3040
3041std::pair<tools::Long, tools::Long> SvTreeListBox::GetItemPos(SvTreeListEntry* pEntry, sal_uInt16 nTabIdx)
3042{
3043 sal_uInt16 nTabCount = aTabs.size();
3044 sal_uInt16 nItemCount = pEntry->ItemCount();
3045 if (nTabIdx >= nItemCount || nTabIdx >= nTabCount)
3046 return std::make_pair(-1, -1);
3047
3048 SvLBoxTab* pTab = aTabs.front().get();
3049 SvLBoxItem* pItem = &pEntry->GetItem(nTabIdx);
3050 sal_uInt16 nNextItem = nTabIdx + 1;
3051
3052 tools::Long nRealWidth = pImpl->GetOutputSize().Width();
3053 nRealWidth -= GetMapMode().GetOrigin().X();
3054
3055 SvLBoxTab* pNextTab = nNextItem < nTabCount ? aTabs[nNextItem].get() : nullptr;
3056 tools::Long nStart = GetTabPos(pEntry, pTab);
3057
3058 tools::Long nNextTabPos;
3059 if (pNextTab)
3060 nNextTabPos = GetTabPos(pEntry, pNextTab);
3061 else
3062 {
3063 nNextTabPos = nRealWidth;
3064 if (nStart > nRealWidth)
3065 nNextTabPos += 50;
3066 }
3067
3068 auto nItemWidth(pItem->GetWidth(this, pEntry));
3069 nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
3070 auto nLen = nItemWidth;
3071 if (pNextTab)
3072 {
3073 tools::Long nTabWidth = GetTabPos(pEntry, pNextTab) - nStart;
3074 if (nTabWidth < nLen)
3075 nLen = nTabWidth;
3076 }
3077 return std::make_pair(nStart, nLen);
3078}
3079
3080tools::Long SvTreeListBox::getPreferredDimensions(std::vector<tools::Long> &rWidths) const
3081{
3082 tools::Long nHeight = 0;
3083 rWidths.clear();
3084 SvTreeListEntry* pEntry = First();
3085 while (pEntry)
3086 {
3087 sal_uInt16 nCount = pEntry->ItemCount();
3088 sal_uInt16 nCurPos = 0;
3089 if (nCount > rWidths.size())
3090 rWidths.resize(nCount);
3091 while (nCurPos < nCount)
3092 {
3093 SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
3094 auto nWidth = rItem.GetWidth(this, pEntry);
3095 if (nWidth)
3096 {
3097 nWidth += SV_TAB_BORDER * 2;
3098 if (nWidth > rWidths[nCurPos])
3099 rWidths[nCurPos] = nWidth;
3100 }
3101 ++nCurPos;
3102 }
3103 pEntry = Next( pEntry );
3104 nHeight += GetEntryHeight();
3105 }
3106 return nHeight;
3107}
3108
3110{
3111 std::vector<tools::Long> aWidths;
3112 Size aRet(0, getPreferredDimensions(aWidths));
3113 for (tools::Long aWidth : aWidths)
3114 aRet.AdjustWidth(aWidth );
3115
3116 sal_Int32 nLeftBorder(0), nTopBorder(0), nRightBorder(0), nBottomBorder(0);
3117 GetBorder(nLeftBorder, nTopBorder, nRightBorder, nBottomBorder);
3118 aRet.AdjustWidth(nLeftBorder + nRightBorder);
3119 aRet.AdjustHeight(nTopBorder + nBottomBorder);
3120
3122 aRet.setWidth( std::max(aRet.Width(), nMinWidth) );
3123
3124 if (GetStyle() & WB_VSCROLL)
3125 aRet.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize());
3126
3127 return aRet;
3128}
3129
3131{
3133 {
3134 mbAlternatingRowColors = bEnable;
3135 return;
3136 }
3137
3138 if( bEnable )
3139 {
3140 SvTreeListEntry* pEntry = pModel->First();
3141 for(size_t i = 0; pEntry; ++i)
3142 {
3143 pEntry->SetBackColor( i % 2 == 0 ? GetBackground().GetColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor());
3144 SvTreeListEntry *pNextEntry = nullptr;
3145 if( IsExpanded( pEntry ) )
3146 pNextEntry = pModel->FirstChild( pEntry );
3147 else
3148 pNextEntry = pEntry->NextSibling();
3149
3150 if( !pNextEntry )
3151 pEntry = pModel->Next( pEntry );
3152 else
3153 pEntry = pNextEntry;
3154 }
3155 }
3156 else if( mbAlternatingRowColors )
3157 for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry))
3158 pEntry->SetBackColor( GetBackground().GetColor() );
3159
3160 mbAlternatingRowColors = bEnable;
3161 pImpl->UpdateAll(true);
3162}
3163
3165{
3166 pImpl->SetForceMakeVisible(bEnable);
3167}
3168
3170{
3171 return GetItem_Impl( pEntry, nX, ppTab );
3172}
3173
3175{
3176 SvLBoxTab* pDummyTab;
3177 return GetItem_Impl( pEntry, nX, &pDummyTab );
3178}
3179
3181{
3182 nFocusWidth = -1;
3183 SvLBoxTab* pTab = new SvLBoxTab( nTabPos, nFlags );
3184 aTabs.emplace_back( pTab );
3186 {
3187 sal_uInt16 nPos = aTabs.size() - 1;
3188 if( nPos >= nFirstSelTab && nPos <= nLastSelTab )
3190 else
3191 // string items usually have to be selected -- turn this off
3192 // explicitly
3194 }
3195}
3196
3197
3199{
3200 sal_uInt16 nCurTab = 0;
3201 sal_uInt16 nTabCount = aTabs.size();
3202 while( nCurTab < nTabCount )
3203 {
3204 SvLBoxTab* pTab = aTabs[nCurTab].get();
3205 if( pTab->nFlags & SvLBoxTabFlags::DYNAMIC )
3206 {
3207 rPos = nCurTab;
3208 return pTab;
3209 }
3210 nCurTab++;
3211 }
3212 return nullptr;
3213}
3214
3216{
3217 sal_uInt16 nDummy;
3218 return GetFirstDynamicTab( nDummy );
3219}
3220
3221SvLBoxTab* SvTreeListBox::GetTab( SvTreeListEntry const * pEntry, SvLBoxItem const * pItem) const
3222{
3223 sal_uInt16 nPos = pEntry->GetPos( pItem );
3224 return aTabs[ nPos ].get();
3225}
3226
3228{
3229 aTabs.clear();
3230}
3231
3232
3234{
3235 Size aSize = pImpl->GetOutputSize();
3236 return aSize;
3237}
3238
3240{
3241 aScrolledHdl.Call( this );
3242}
3243
3245{
3246 if (!pImpl)
3247 return;
3248 if( nFocusWidth == -1 )
3249 // to make sure that the control doesn't show the wrong focus rectangle
3250 // after painting
3251 pImpl->RecalcFocusRect();
3252 Control::Invalidate( nInvalidateFlags );
3253 pImpl->Invalidate();
3254}
3255
3256void SvTreeListBox::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nInvalidateFlags )
3257{
3258 if( nFocusWidth == -1 )
3259 // to make sure that the control doesn't show the wrong focus rectangle
3260 // after painting
3261 pImpl->RecalcFocusRect();
3262 Control::Invalidate( rRect, nInvalidateFlags );
3263}
3264
3265
3266void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
3267{
3268
3270 if( nStart > nEnd )
3271 std::swap(nStart, nEnd);
3272 // select all tabs that lie within the area
3274 nFirstSelTab = nStart;
3275 nLastSelTab = nEnd;
3276 pImpl->RecalcFocusRect();
3277}
3278
3280{
3281 if (!aPopupMenuHdl.Call(rCEvt))
3282 pImpl->Command(rCEvt);
3283 //pass at least alt press/release to parent impl
3285 Control::Command(rCEvt);
3286}
3287
3289{
3290 sal_uInt16 nTabCount = aTabs.size();
3291 for( sal_uInt16 nPos = 0; nPos < nTabCount; nPos++ )
3292 {
3293 SvLBoxTab* pTab = aTabs[ nPos ].get();
3294 if( pTab->nFlags & nFlagMask )
3295 {
3296 rPos = nPos;
3297 return pTab;
3298 }
3299 }
3300 rPos = 0xffff;
3301 return nullptr;
3302}
3303
3304void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos )
3305{
3306 sal_uInt16 nPos = static_cast<sal_uInt16>(aTabs.size());
3307 while( nPos )
3308 {
3309 --nPos;
3310 SvLBoxTab* pTab = aTabs[ nPos ].get();
3311 if( pTab->nFlags & nFlagMask )
3312 {
3313 rTabPos = nPos;
3314 return;
3315 }
3316 }
3317 rTabPos = 0xffff;
3318}
3319
3321{
3322 if (aTooltipHdl.IsSet())
3323 {
3325 if (SvTreeListEntry* entry = GetEntry(pos))
3326 {
3327 const OUString tooltip = aTooltipHdl.Call(entry);
3328 if (!tooltip.isEmpty())
3329 {
3332 Help::ShowQuickHelp(this, screenRect, tooltip);
3333 return;
3334 }
3335 }
3336 }
3337
3338 if( !pImpl->RequestHelp( rHEvt ) )
3339 Control::RequestHelp( rHEvt );
3340}
3341
3342sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText)
3343{
3344 OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
3345 OUString aRight = pRightText ? pRightText->GetText() : OUString();
3346 pImpl->UpdateStringSorter();
3347 return pImpl->m_pStringSorter->compare(aLeft, aRight);
3348}
3349
3350IMPL_LINK( SvTreeListBox, DefaultCompare, const SvSortData&, rData, sal_Int32 )
3351{
3352 const SvTreeListEntry* pLeft = rData.pLeft;
3353 const SvTreeListEntry* pRight = rData.pRight;
3354 const SvLBoxString* pLeftText = static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String));
3355 const SvLBoxString* pRightText = static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String));
3356 return DefaultCompare(pLeftText, pRightText);
3357}
3358
3360 SvTreeListEntry* pEntry2, sal_uInt32 nPos )
3361{
3362 SolarMutexGuard aSolarGuard;
3363
3364 if( nActionId == SvListAction::CLEARING )
3366
3367 SvListView::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
3368 switch( nActionId )
3369 {
3371 {
3372 SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry1->GetFirstItem( SvLBoxItemType::ContextBmp ) );
3373 if ( !pBmpItem )
3374 break;
3375 const Image& rBitmap1( pBmpItem->GetBitmap1() );
3376 const Image& rBitmap2( pBmpItem->GetBitmap2() );
3377 short nMaxWidth = short( std::max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) );
3378 nMaxWidth = pImpl->UpdateContextBmpWidthVector( pEntry1, nMaxWidth );
3379 if( nMaxWidth > nContextBmpWidthMax )
3380 {
3381 nContextBmpWidthMax = nMaxWidth;
3382 SetTabs();
3383 }
3384 if (get_width_request() == -1)
3385 queue_resize();
3386 }
3387 break;
3388
3390 SetUpdateMode( false );
3391 break;
3392
3394 // after a selection: show first entry and also keep the selection
3395 MakeVisible( pModel->First(), true );
3396 SetUpdateMode( true );
3397 break;
3398
3400 if( IsUpdateMode() )
3402 break;
3403
3404 default: break;
3405 }
3406}
3407
3409{
3410 return GetEntry( Point() );
3411}
3412
3414{
3415 SvTreeListEntry* pNext = NextVisible( pEntry );
3416 if( pNext )
3417 {
3418 Point aPos( GetEntryPosition(pNext) );
3419 const Size& rSize = pImpl->GetOutputSize();
3420 if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
3421 return nullptr;
3422 }
3423 return pNext;
3424}
3425
3426
3428{
3430 {
3431 nEntryHeight = 0; // _together_ with true of 1. par (bFont) of InitSettings() a zero-height
3432 // forces complete recalc of heights!
3433 InitSettings();
3434 Invalidate();
3435 }
3436 else
3437 Control::DataChanged( rDCEvt );
3438}
3439
3441{
3444
3446
3448 ImplInitStyle();
3449}
3450
3452{
3453 SetPointFont(rRenderContext, GetPointFont(*GetOutDev()));
3454
3455 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
3456 rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
3457 rRenderContext.SetTextFillColor();
3458 rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
3459
3460 // always try to re-create default-SvLBoxButtonData
3463}
3464
3466{
3467 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
3468 vcl::Font aFont = rStyleSettings.GetFieldFont();
3469 SetPointFont(*GetOutDev(), aFont);
3471
3472 SetTextColor(rStyleSettings.GetFieldTextColor());
3474
3475 SetBackground(rStyleSettings.GetFieldColor());
3476
3477 // always try to re-create default-SvLBoxButtonData
3480}
3481
3482css::uno::Reference< XAccessible > SvTreeListBox::CreateAccessible()
3483{
3485 DBG_ASSERT( pParent, "SvTreeListBox::CreateAccessible - accessible parent not found" );
3486
3487 css::uno::Reference< XAccessible > xAccessible;
3488 if ( pParent )
3489 {
3490 css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
3491 if ( xAccParent.is() )
3492 {
3493 // need to be done here to get the vclxwindow later on in the accessible
3494 css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface());
3495 xAccessible = pImpl->m_aFactoryAccess.getFactory().createAccessibleTreeListBox( *this, xAccParent );
3496 }
3497 }
3498 return xAccessible;
3499}
3500
3501void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, sal_Int64& rStateSet ) const
3502{
3503 assert(pEntry && "SvTreeListBox::FillAccessibleEntryStateSet: invalid entry");
3504
3505 if ( pEntry->HasChildrenOnDemand() || pEntry->HasChildren() )
3506 {
3507 rStateSet |= AccessibleStateType::EXPANDABLE;
3508 if ( IsExpanded( pEntry ) )
3509 rStateSet |= AccessibleStateType::EXPANDED;
3510 }
3511
3513 rStateSet |= AccessibleStateType::CHECKED;
3514 if ( IsEntryVisible( pEntry ) )
3515 rStateSet |= AccessibleStateType::VISIBLE;
3516 if ( IsSelected( pEntry ) )
3517 rStateSet |= AccessibleStateType::SELECTED;
3518 if ( IsEnabled() )
3519 {
3520 rStateSet |= AccessibleStateType::ENABLED;
3521 rStateSet |= AccessibleStateType::FOCUSABLE;
3522 rStateSet |= AccessibleStateType::SELECTABLE;
3523 SvViewDataEntry* pViewDataNewCur = GetViewDataEntry(pEntry);
3524 if (pViewDataNewCur && pViewDataNewCur->HasFocus())
3525 rStateSet |= AccessibleStateType::FOCUSED;
3526 }
3527}
3528
3530{
3531 assert(pEntry);
3532
3533 //want to count the real column number in the list box.
3534 sal_uInt16 iRealItemCount = 0;
3535 for (size_t i = 0; i < pEntry->ItemCount(); ++i)
3536 {
3537 const SvLBoxItem& rItem = pEntry->GetItem(i);
3538 if (rItem.GetType() == SvLBoxItemType::String &&
3539 !static_cast<const SvLBoxString&>(rItem).GetText().isEmpty())
3540 {
3541 iRealItemCount++;
3542 }
3543 }
3544 // No idea why <= 1; that was in AccessibleListBoxEntry::getAccessibleDescription
3545 // since the "Integrate branch of IAccessible2" commit
3546 if (iRealItemCount <= 1)
3547 {
3548 return {};
3549 }
3550 else
3551 {
3552 return SearchEntryTextWithHeadTitle(pEntry);
3553 }
3554}
3555
3557{
3558 Point aPos = GetEntryPosition( pEntry );
3559 tools::Rectangle aRect = GetFocusRect( pEntry, aPos.Y() );
3560 return aRect;
3561}
3562
3564{
3565 CallEventListeners(nEvent, pData);
3566}
3567
3569{
3570 nMinWidthInChars = nChars;
3571 queue_resize();
3572}
3573
3574bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue)
3575{
3576 if (rKey == "min-width-chars")
3577 {
3578 set_min_width_in_chars(rValue.toInt32());
3579 }
3580 else if (rKey == "enable-tree-lines")
3581 {
3582 auto nStyle = GetStyle();
3583 nStyle &= ~(WB_HASLINES | WB_HASLINESATROOT);
3584 if (toBool(rValue))
3585 nStyle |= (WB_HASLINES | WB_HASLINESATROOT);
3586 SetStyle(nStyle);
3587 }
3588 else if (rKey == "show-expanders")
3589 {
3590 auto nStyle = GetStyle();
3591 nStyle &= ~(WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3592 if (toBool(rValue))
3593 nStyle |= (WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3594 SetStyle(nStyle);
3595 }
3596 else if (rKey == "enable-search")
3597 {
3598 SetQuickSearch(toBool(rValue));
3599 }
3600 else if (rKey == "activate-on-single-click")
3601 {
3603 }
3604 else if (rKey == "hover-selection")
3605 {
3606 SetHoverSelection(toBool(rValue));
3607 }
3608 else if (rKey == "reorderable")
3609 {
3610 if (toBool(rValue))
3612 }
3613 else
3614 return Control::set_property(rKey, rValue);
3615 return true;
3616}
3617
3619{
3620 Control::EnableRTL(bEnable);
3621 pImpl->m_aHorSBar->EnableRTL(bEnable);
3622 pImpl->m_aVerSBar->EnableRTL(bEnable);
3623 pImpl->m_aScrBarBox->EnableRTL(bEnable);
3624}
3625
3627{
3629}
3630
3631/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawImageFlags
static bool toBool(std::string_view rValue)
Definition: builder.cxx:91
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:1442
static void RemoveAccel(Accelerator const *pAccel)
Remove accelerator.
Definition: svapp.cxx:1451
static vcl::Window * GetFocusWindow()
Get the currently focused window.
Definition: svapp.cxx:1161
bool IsBright() const
CommandEventId GetCommand() const
Definition: ctrl.hxx:82
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:257
virtual void Resize() override
Definition: ctrl.cxx:75
virtual void EnableRTL(bool bEnable=true) override
Definition: ctrl.cxx:66
virtual void SetText(const OUString &rStr) override
Definition: ctrl.cxx:96
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:294
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: ctrl.cxx:59
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:761
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
Definition: transfer2.cxx:296
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:2547
const OUString & GetSavedValue() const
Definition: edit.hxx:209
virtual void SetSelection(const Selection &rSelection)
Definition: edit.cxx:2396
virtual void LoseFocus() override
Definition: edit.cxx:1902
void SaveValue()
Definition: edit.hxx:208
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: edit.cxx:1712
virtual OUString GetText() const override
Definition: edit.cxx:2566
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:86
void setTristateVal(ButtonValue nTristate)
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:57
const Point & GetOrigin() const
Definition: mapmod.cxx:152
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:171
const vcl::Font & GetFont() const
Definition: outdev.hxx:530
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:56
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
const Wallpaper & GetBackground() const
Definition: outdev.hxx:524
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:1558
const Color & GetTextColor() const
Definition: outdev.hxx:1004
void SetTextFillColor()
Definition: text.cxx:734
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:33
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:92
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:289
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
const Color & GetFillColor() const
Definition: outdev.hxx:516
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:1325
virtual void ModelNotification(SvListAction nActionId, SvTreeListEntry *pEntry1, SvTreeListEntry *pEntry2, sal_uInt32 nPos)
Definition: treelist.cxx:1245
SvTreeListEntry * NextVisible(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:235
virtual void ModelHasCleared()
Definition: treelist.cxx:1100
void ExpandListEntry(SvTreeListEntry *pParent)
Definition: treelist.cxx:846
std::unique_ptr< SvTreeList > pModel
Definition: treelist.hxx:211
void CollapseListEntry(SvTreeListEntry *pParent)
Definition: treelist.cxx:865
bool IsEntryVisible(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:273
sal_uInt32 GetSelectionCount() const
Definition: treelist.cxx:1044
SvTreeListEntry * NextSelected(SvTreeListEntry *pEntry) const
Definition: treelist.hxx:255
SvTreeListEntry * LastVisible() const
Definition: treelist.hxx:241
void dispose()
Definition: treelist.cxx:1034
SvTreeListEntry * FirstSelected() const
Definition: treelist.hxx:252
const SvViewDataEntry * GetViewData(const SvTreeListEntry *pEntry) const
Definition: treelist.cxx:1342
bool IsExpanded(SvTreeListEntry *pEntry) const
Definition: treelist.cxx:1298
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)
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)
bool mbAlternatingRowColors
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)
virtual bool set_property(const OString &rKey, const OUString &rValue) override
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()
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE) override
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
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
void SetAlternatingRowColors(const bool bEnable)
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
bool mbUpdateAlternatingRows
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
void SetBackColor(const Color &rColor)
SvTreeListEntry * NextSibling() const
SvTreeListEntries m_Children
const Color & GetBackColor() const
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:196
static sal_uInt32 GetRelPos(const SvTreeListEntry *pChild)
Definition: treelist.cxx:828
void SetCompareHdl(const Link< const SvSortData &, sal_Int32 > &rLink)
Definition: treelist.hxx:199
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:597
void Stop()
Definition: scheduler.cxx:590
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:924
const Color & GetColor() const
Definition: font/font.cxx:922
const Color & GetFillColor() const
Definition: font/font.cxx:923
bool IsMod1() const
Definition: keycod.hxx:56
sal_uInt16 GetCode() const
Definition: keycod.hxx:49
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2808
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
void SetStyle(WinBits nStyle)
Definition: window.cxx:1964
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2972
virtual void GetFocus()
Definition: window.cxx:1843
vcl::Window * GetParent() const
Definition: window2.cxx:1121
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1871
void PaintImmediately()
Definition: paint.cxx:1268
bool IsMouseCaptured() const
Definition: mouse.cxx:481
bool IsChild(const vcl::Window *pWindow) const
Definition: stacking.cxx:1106
sal_uInt16 GetChildCount() const
Definition: stacking.cxx:1001
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1286
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Definition: window.cxx:2426
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1925
void HideFocus()
Definition: window2.cxx:95
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1351
void GrabFocus()
Definition: window.cxx:2981
bool IsUpdateMode() const
Definition: window2.cxx:1197
bool HasFocus() const
Definition: window.cxx:2986
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:977
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2189
virtual void KeyInput(const KeyEvent &rKEvt)
Definition: window.cxx:1807
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:2182
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:885
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3150
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:2404
virtual void DataChanged(const DataChangedEvent &rDCEvt)
Definition: event.cxx:36
virtual bool set_property(const OString &rKey, const OUString &rValue)
Definition: window2.cxx:1476
virtual void LoseFocus()
Definition: window.cxx:1857
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2175
sal_Int32 get_width_request() const
Definition: window2.cxx:1949
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1281
virtual OUString GetText() const
Definition: window.cxx:3060
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:673
void SetType(WindowType nType)
Definition: window2.cxx:992
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2814
bool IsEnabled() const
Definition: window2.cxx:1146
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
sal_uInt16 nCode
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:96
Point maPosPixel
Definition: transfer.hxx:94
const css::datatransfer::dnd::DropTargetDropEvent maDropEvent
Definition: transfer.hxx:118
sal_Int8 mnAction
Definition: transfer.hxx:119
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:70
#define DND_ACTION_MOVE
Definition: transfer.hxx:69
#define DND_ACTION_COPY
Definition: transfer.hxx:68
#define DND_ACTION_LINK
Definition: transfer.hxx:71
#define DND_ACTION_NONE
Definition: transfer.hxx:67
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:229
WinBits const WB_HASBUTTONS
Definition: wintypes.hxx:224
WinBits const WB_HASLINESATROOT
Definition: wintypes.hxx:226
WinBits const WB_HASLINES
Definition: wintypes.hxx:225
WinBits const WB_HASBUTTONSATROOT
Definition: wintypes.hxx:227
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