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