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