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