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