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