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