LibreOffice Module vcl (master)  1
treelistbox.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 /*
21  TODO:
22  - delete anchor in SelectionEngine when selecting manually
23  - SelectAll( false ) => only repaint the deselected entries
24 */
25 
28 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
29 #include <vcl/svapp.hxx>
30 #include <vcl/accel.hxx>
31 #include <vcl/builder.hxx>
32 #include <vcl/toolkit/edit.hxx>
33 #include <vcl/settings.hxx>
34 #include <vcl/commandevent.hxx>
35 #include <vcl/uitest/uiobject.hxx>
36 #include <sot/formats.hxx>
38 #include <rtl/instance.hxx>
39 #include <comphelper/string.hxx>
40 #include <sal/log.hxx>
41 #include <tools/debug.hxx>
42 
43 #include <vcl/toolkit/svlbitm.hxx>
46 #include <svimpbox.hxx>
47 
48 #include <set>
49 #include <string.h>
50 #include <vector>
51 
52 using namespace css::accessibility;
53 
54 // Drag&Drop
57 
58 #define SVLBOX_ACC_RETURN 1
59 #define SVLBOX_ACC_ESCAPE 2
60 
62 {
64  Accelerator aAccReturn;
65  Accelerator aAccEscape;
68  bool bCanceled;
70 
71  void CallCallBackHdl_Impl();
72  DECL_LINK( Timeout_Impl, Timer *, void );
73  DECL_LINK( ReturnHdl_Impl, Accelerator&, void );
74  DECL_LINK( EscapeHdl_Impl, Accelerator&, void );
75 
76 public:
77  SvInplaceEdit2( vcl::Window* pParent, const Point& rPos, const Size& rSize,
78  const OUString& rData, const Link<SvInplaceEdit2&,void>& rNotifyEditEnd,
79  const Selection& );
80  ~SvInplaceEdit2();
81  bool KeyInput( const KeyEvent& rKEvt );
82  void LoseFocus();
83  bool EditingCanceled() const { return bCanceled; }
84  OUString GetText() const;
85  OUString const & GetSavedValue() const;
86  void StopEditing( bool bCancel );
87  void Hide();
88 };
89 
90 // ***************************************************************
91 
92 namespace {
93 
94 class MyEdit_Impl : public Edit
95 {
97 public:
98  MyEdit_Impl( vcl::Window* pParent, SvInplaceEdit2* pOwner );
99  virtual ~MyEdit_Impl() override { disposeOnce(); }
100  virtual void dispose() override { pOwner = nullptr; Edit::dispose(); }
101  virtual void KeyInput( const KeyEvent& rKEvt ) override;
102  virtual void LoseFocus() override;
103 };
104 
105 }
106 
107 MyEdit_Impl::MyEdit_Impl( vcl::Window* pParent, SvInplaceEdit2* _pOwner ) :
108 
109  Edit( pParent, WB_LEFT ),
110 
111  pOwner( _pOwner )
112 
113 {
114 }
115 
116 void MyEdit_Impl::KeyInput( const KeyEvent& rKEvt )
117 {
118  if( !pOwner->KeyInput( rKEvt ))
119  Edit::KeyInput( rKEvt );
120 }
121 
122 void MyEdit_Impl::LoseFocus()
123 {
124  if (pOwner)
125  pOwner->LoseFocus();
126 }
127 
129 (
130  vcl::Window* pParent, const Point& rPos,
131  const Size& rSize,
132  const OUString& rData,
133  const Link<SvInplaceEdit2&,void>& rNotifyEditEnd,
134  const Selection& rSelection
135 ) :
136 
137  aCallBackHdl ( rNotifyEditEnd ),
138  bCanceled ( false ),
139  bAlreadyInCallBack ( false )
140 
141 {
142 
143  pEdit = VclPtr<MyEdit_Impl>::Create( pParent, this );
144 
145  vcl::Font aFont( pParent->GetFont() );
146  aFont.SetTransparent( false );
147  Color aColor( pParent->GetBackground().GetColor() );
148  aFont.SetFillColor(aColor );
149  pEdit->SetFont( aFont );
150  pEdit->SetBackground( pParent->GetBackground() );
151  pEdit->SetPosPixel( rPos );
152  pEdit->SetSizePixel( rSize );
153  pEdit->SetText( rData );
154  pEdit->SetSelection( rSelection );
155  pEdit->SaveValue();
156 
157  aAccReturn.InsertItem( SVLBOX_ACC_RETURN, vcl::KeyCode(KEY_RETURN) );
158  aAccEscape.InsertItem( SVLBOX_ACC_ESCAPE, vcl::KeyCode(KEY_ESCAPE) );
159 
160  aAccReturn.SetActivateHdl( LINK( this, SvInplaceEdit2, ReturnHdl_Impl) );
161  aAccEscape.SetActivateHdl( LINK( this, SvInplaceEdit2, EscapeHdl_Impl) );
162  Application::InsertAccel( &aAccReturn );
163  Application::InsertAccel( &aAccEscape );
164 
165  pEdit->Show();
166  pEdit->GrabFocus();
167 }
168 
170 {
171  if( !bAlreadyInCallBack )
172  {
175  }
177 }
178 
179 OUString const & SvInplaceEdit2::GetSavedValue() const
180 {
181  return pEdit->GetSavedValue();
182 }
183 
185 {
186  pEdit->Hide();
187 }
188 
189 
190 IMPL_LINK_NOARG(SvInplaceEdit2, ReturnHdl_Impl, Accelerator&, void)
191 {
192  bCanceled = false;
193  CallCallBackHdl_Impl();
194 }
195 
196 IMPL_LINK_NOARG(SvInplaceEdit2, EscapeHdl_Impl, Accelerator&, void)
197 {
198  bCanceled = true;
199  CallCallBackHdl_Impl();
200 }
201 
202 bool SvInplaceEdit2::KeyInput( const KeyEvent& rKEvt )
203 {
204  vcl::KeyCode aCode = rKEvt.GetKeyCode();
205  sal_uInt16 nCode = aCode.GetCode();
206 
207  switch ( nCode )
208  {
209  case KEY_ESCAPE:
210  bCanceled = true;
212  return true;
213 
214  case KEY_RETURN:
215  bCanceled = false;
217  return true;
218  }
219  return false;
220 }
221 
222 void SvInplaceEdit2::StopEditing( bool bCancel )
223 {
224  if ( !bAlreadyInCallBack )
225  {
226  bCanceled = bCancel;
228  }
229 }
230 
232 {
233  if ( !bAlreadyInCallBack
235  )
236  {
237  bCanceled = false;
239  aIdle.SetInvokeHandler(LINK(this,SvInplaceEdit2,Timeout_Impl));
240  aIdle.SetDebugName( "svtools::SvInplaceEdit2 aIdle" );
241  aIdle.Start();
242  }
243 }
244 
245 IMPL_LINK_NOARG(SvInplaceEdit2, Timeout_Impl, Timer *, void)
246 {
247  CallCallBackHdl_Impl();
248 }
249 
251 {
252  aIdle.Stop();
253  if ( !bAlreadyInCallBack )
254  {
255  bAlreadyInCallBack = true;
258  pEdit->Hide();
259  aCallBackHdl.Call( *this );
260  }
261 }
262 
263 OUString SvInplaceEdit2::GetText() const
264 {
265  return pEdit->GetText();
266 }
267 
268 // ***************************************************************
269 // class SvLBoxTab
270 // ***************************************************************
271 
272 
274 {
275  nPos = 0;
277 }
278 
280 {
281  nPos = nPosition;
282  nFlags = nTabFlags;
283 }
284 
286 {
287  nPos = rTab.nPos;
288  nFlags = rTab.nFlags;
289 }
290 
292 {
293 }
294 
295 
297 {
298  tools::Long nOffset = 0;
300  {
301  nOffset = nTabWidth - nItemWidth;
302  if( nOffset < 0 )
303  nOffset = 0;
304  }
306  {
308  {
309  // correct implementation of centering
310  nOffset = ( nTabWidth - nItemWidth ) / 2;
311  if( nOffset < 0 )
312  nOffset = 0;
313  }
314  else
315  {
316  // historically grown, wrong calculation of tabs which is needed by
317  // Abo-Tabbox, Tools/Options/Customize etc.
318  nItemWidth++;
319  nOffset = -( nItemWidth / 2 );
320  }
321  }
322  return nOffset;
323 }
324 
325 // ***************************************************************
326 // class SvLBoxItem
327 // ***************************************************************
328 
329 
331  : mbDisabled(false)
332 {
333 }
334 
336 {
337 }
338 
339 int SvLBoxItem::GetWidth(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
340 {
341  const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
342  int nWidth = pViewData->mnWidth;
343  if (nWidth == -1)
344  {
345  nWidth = CalcWidth(pView);
346  const_cast<SvViewDataItem*>(pViewData)->mnWidth = nWidth;
347  }
348  return nWidth;
349 }
350 
351 int SvLBoxItem::GetHeight(const SvTreeListBox* pView, const SvTreeListEntry* pEntry) const
352 {
353  const SvViewDataItem* pViewData = pView->GetViewDataItem( pEntry, this );
354  return pViewData->mnHeight;
355 }
356 
357 int SvLBoxItem::GetWidth(const SvTreeListBox* pView, const SvViewDataEntry* pData, sal_uInt16 nItemPos)
358 {
359  const SvViewDataItem& rIData = pData->GetItem(nItemPos);
360  int nWidth = rIData.mnWidth;
361  if (nWidth == -1)
362  {
363  nWidth = CalcWidth(pView);
364  const_cast<SvViewDataItem&>(rIData).mnWidth = nWidth;
365  }
366  return nWidth;
367 }
368 
369 int SvLBoxItem::GetHeight(const SvViewDataEntry* pData, sal_uInt16 nItemPos)
370 {
371  const SvViewDataItem& rIData = pData->GetItem(nItemPos);
372  return rIData.mnHeight;
373 }
374 
375 int SvLBoxItem::CalcWidth(const SvTreeListBox* /*pView*/) const
376 {
377  return 0;
378 }
379 
381 {
383 
385 
386  explicit SvTreeListBoxImpl(SvTreeListBox& _rBox) :
387  m_bDoingQuickSelection(false),
388  m_aQuickSelectionEngine(_rBox) {}
389 };
390 
392  Control(pParent, nWinStyle | WB_CLIPCHILDREN),
393  DropTargetHelper(this),
394  DragSourceHelper(this),
395  mpImpl(new SvTreeListBoxImpl(*this)),
396  mbContextBmpExpanded(false),
397  mbAlternatingRowColors(false),
398  mbUpdateAlternatingRows(false),
399  mbQuickSearch(false),
400  mbActivateOnSingleClick(false),
401  mbHoverSelection(false),
402  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  const 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  const 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  tools::Long nStartPos = TAB_STARTPOS;
1411  tools::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  tools::Long nCheckWidth = 0;
1417  nCheckWidth = mnCheckboxItemWidth;
1418  tools::Long nCheckWidthDIV2 = nCheckWidth / 2;
1419 
1420  tools::Long nContextWidth = nContextBmpWidthMax;
1421  tools::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  tools::Long nThumb = pImpl->m_aVerSBar->GetThumbPos();
1964  tools::Long nMax = pImpl->m_aVerSBar->GetRange().Max();
1965 
1966  if( nDeltaEntries < 0 )
1967  {
1968  // move window up
1969  nDeltaEntries *= -1;
1970  tools::Long nVis = pImpl->m_aVerSBar->GetVisibleSize();
1971  tools::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  tools::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  // tdf#116675 clicking on an entry should toggle its checkbox
2292  if (rMEvt.IsLeft() && (nTreeFlags & SvTreeFlags::CHKBTN))
2293  {
2294  const Point aPnt = rMEvt.GetPosPixel();
2295  SvTreeListEntry* pEntry = GetEntry(aPnt);
2296  if (pEntry && pEntry->m_Items.size() > 0)
2297  {
2298  SvLBoxItem* pItem = GetItem(pEntry, aPnt.X());
2299  // if the checkbox button was clicked, that will be toggled later, do not toggle here
2300  // anyway users probably don't want to toggle the checkbox by clickink on another button
2301  if (!pItem || pItem->GetType() != SvLBoxItemType::Button)
2302  {
2303  SvLBoxButton* pItemCheckBox
2304  = static_cast<SvLBoxButton*>(pEntry->GetFirstItem(SvLBoxItemType::Button));
2305  if (pItemCheckBox)
2306  {
2307  pItemCheckBox->ClickHdl(pEntry);
2308  InvalidateEntry(pEntry);
2309  }
2310  }
2311  }
2312  }
2313 
2314  pImpl->MouseButtonUp( rMEvt );
2315 }
2316 
2318 {
2319  pImpl->MouseMove( rMEvt );
2320 }
2321 
2322 void SvTreeListBox::SetUpdateMode( bool bUpdate )
2323 {
2324  pImpl->SetUpdateMode( bUpdate );
2325  mbUpdateAlternatingRows = bUpdate;
2327 }
2328 
2330 {
2331  if( nOffsLogic != nEntryHeightOffs )
2332  {
2334  nEntryHeightOffs = nOffsLogic;
2335  nEntryHeight = nEntryHeight + nOffsLogic;
2337  pImpl->SetEntryHeight();
2338  }
2339 }
2340 
2342 {
2343  pImpl->SetCurEntry( pEntry );
2344 }
2345 
2347 {
2348  return pImpl->GetExpandedNodeBmp( );
2349 }
2350 
2352 {
2353  return pImpl->GetEntryPosition( pEntry );
2354 }
2355 
2357 {
2358  pImpl->MakeVisible(pEntry);
2359 }
2360 
2361 void SvTreeListBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop )
2362 {
2363  pImpl->MakeVisible( pEntry, bMoveToTop );
2364 }
2365 
2367 {
2368 
2369  // reinitialize the separate items of the entries
2370  sal_uInt16 nCount = pEntry->ItemCount();
2371  for( sal_uInt16 nIdx = 0; nIdx < nCount; nIdx++ )
2372  {
2373  SvLBoxItem& rItem = pEntry->GetItem( nIdx );
2374  rItem.InitViewData( this, pEntry );
2375  }
2376 
2377  // repaint
2378  pImpl->InvalidateEntry( pEntry );
2379 }
2380 
2381 void SvTreeListBox::EditItemText(SvTreeListEntry* pEntry, SvLBoxString* pItem, const Selection& rSelection)
2382 {
2383  assert(pEntry && pItem);
2384  if( IsSelected( pEntry ))
2385  {
2386  pImpl->ShowCursor( false );
2387  SelectListEntry( pEntry, false );
2388  pImpl->InvalidateEntry(pEntry);
2389  SelectListEntry( pEntry, true );
2390  pImpl->ShowCursor( true );
2391  }
2392  pEdEntry = pEntry;
2393  pEdItem = pItem;
2394  SvLBoxTab* pTab = GetTab( pEntry, pItem );
2395  DBG_ASSERT(pTab,"EditItemText:Tab not found");
2396 
2397  auto nItemHeight( pItem->GetHeight(this, pEntry) );
2398  Point aPos = GetEntryPosition( pEntry );
2399  aPos.AdjustY(( nEntryHeight - nItemHeight ) / 2 );
2400  aPos.setX( GetTabPos( pEntry, pTab ) );
2401  tools::Long nOutputWidth = pImpl->GetOutputSize().Width();
2402  Size aSize( nOutputWidth - aPos.X(), nItemHeight );
2403  sal_uInt16 nPos = std::find_if( aTabs.begin(), aTabs.end(),
2404  [pTab](const std::unique_ptr<SvLBoxTab>& p) { return p.get() == pTab; })
2405  - aTabs.begin();
2406  if( nPos+1 < static_cast<sal_uInt16>(aTabs.size()) )
2407  {
2408  SvLBoxTab* pRightTab = aTabs[ nPos + 1 ].get();
2409  tools::Long nRight = GetTabPos( pEntry, pRightTab );
2410  if( nRight <= nOutputWidth )
2411  aSize.setWidth( nRight - aPos.X() );
2412  }
2413  Point aOrigin( GetMapMode().GetOrigin() );
2414  aPos += aOrigin; // convert to win coordinates
2415  aSize.AdjustWidth( -(aOrigin.X()) );
2416  tools::Rectangle aRect( aPos, aSize );
2417  EditText( pItem->GetText(), aRect, rSelection );
2418 }
2419 
2421 {
2422  pImpl->m_aEditClickPos = Point( -1, -1 );
2423  ImplEditEntry( pEntry );
2424 }
2425 
2427 {
2428  if( IsEditingActive() )
2429  EndEditing();
2430  if( !pEntry )
2431  pEntry = GetCurEntry();
2432  if( !pEntry )
2433  return;
2434 
2435  tools::Long nClickX = pImpl->m_aEditClickPos.X();
2436  bool bIsMouseTriggered = nClickX >= 0;
2437 
2438  SvLBoxString* pItem = nullptr;
2439  sal_uInt16 nCount = pEntry->ItemCount();
2440  tools::Long nTabPos, nNextTabPos = 0;
2441  for( sal_uInt16 i = 0 ; i < nCount ; i++ )
2442  {
2443  SvLBoxItem& rTmpItem = pEntry->GetItem( i );
2444  if (rTmpItem.GetType() != SvLBoxItemType::String)
2445  continue;
2446 
2447  SvLBoxTab* pTab = GetTab( pEntry, &rTmpItem );
2448  nNextTabPos = -1;
2449  if( i < nCount - 1 )
2450  {
2451  SvLBoxItem& rNextItem = pEntry->GetItem( i + 1 );
2452  SvLBoxTab* pNextTab = GetTab( pEntry, &rNextItem );
2453  nNextTabPos = pNextTab->GetPos();
2454  }
2455 
2456  if( pTab && pTab->IsEditable() )
2457  {
2458  nTabPos = pTab->GetPos();
2459  if( !bIsMouseTriggered || (nClickX > nTabPos && (nNextTabPos == -1 || nClickX < nNextTabPos ) ) )
2460  {
2461  pItem = static_cast<SvLBoxString*>( &rTmpItem );
2462  break;
2463  }
2464  }
2465  }
2466 
2467  if( pItem && EditingEntry( pEntry ) )
2468  {
2470  SelectAll( false );
2471  MakeVisible( pEntry );
2472  EditItemText( pEntry, pItem, aSel );
2473  }
2474 }
2475 
2476 void SvTreeListBox::EditedText( const OUString& rStr )
2477 
2478 {
2479  if(pEdEntry) // we have to check if this entry is null that means that it is removed while editing
2480  {
2481  if( EditedEntry( pEdEntry, rStr ) )
2482  {
2483  static_cast<SvLBoxString*>(pEdItem)->SetText( rStr );
2484  pModel->InvalidateEntry( pEdEntry );
2485  }
2486  if( GetSelectionCount() == 0 )
2487  Select( pEdEntry );
2489  SetCurEntry( pEdEntry );
2490  }
2491 }
2492 
2494 {
2495  // scroll
2496  if( rPos.Y() < 12 )
2497  {
2499  ScrollOutputArea( +1 );
2500  }
2501  else
2502  {
2503  Size aSize( pImpl->GetOutputSize() );
2504  if( rPos.Y() > aSize.Height() - 12 )
2505  {
2507  ScrollOutputArea( -1 );
2508  }
2509  }
2510 
2511  SvTreeListEntry* pTarget = pImpl->GetEntry( rPos );
2512  // when dropping in a vacant space, use the last entry
2513  if( !pTarget )
2514  return LastVisible();
2515  else if( (GetDragDropMode() & DragDropMode::ENABLE_TOP) &&
2516  pTarget == First() && rPos.Y() < 6 )
2517  return nullptr;
2518 
2519  return pTarget;
2520 }
2521 
2522 
2523 SvTreeListEntry* SvTreeListBox::GetEntry( const Point& rPos, bool bHit ) const
2524 {
2525  SvTreeListEntry* pEntry = pImpl->GetEntry( rPos );
2526  if( pEntry && bHit )
2527  {
2528  tools::Long nLine = pImpl->GetEntryLine( pEntry );
2529  if( !(pImpl->EntryReallyHit( pEntry, rPos, nLine)) )
2530  return nullptr;
2531  }
2532  return pEntry;
2533 }
2534 
2536 {
2537  return pImpl ? pImpl->GetCurEntry() : nullptr;
2538 }
2539 
2541 {
2542  const WinBits nWindowStyle = GetStyle();
2543 
2545  if (nWindowStyle & WB_SORT)
2546  {
2549  }
2550  else
2551  {
2554  }
2555  pImpl->SetStyle(nWindowStyle);
2556  pImpl->Resize();
2557  Invalidate();
2558 }
2559 
2561 {
2562  DBG_ASSERT(pEntry,"InvalidateEntry:No Entry");
2563  if (pEntry)
2564  {
2565  GetModel()->InvalidateEntry(pEntry);
2566  }
2567 }
2568 
2570 {
2571  tools::Rectangle aRect; // multi purpose
2572 
2573  bool bHorSBar = pImpl->HasHorScrollBar();
2574 
2575  pImpl->UpdateContextBmpWidthMax(&rEntry);
2576 
2578  SetTabs();
2579 
2580  short nTempEntryHeight = GetEntryHeight();
2581  tools::Long nWidth = pImpl->GetOutputSize().Width();
2582 
2583  // Did we turn on the scrollbar within PreparePaints? If yes, we have to set
2584  // the ClipRegion anew.
2585  if (!bHorSBar && pImpl->HasHorScrollBar())
2586  rRenderContext.SetClipRegion(vcl::Region(pImpl->GetClipRegionRect()));
2587 
2588  Point aEntryPos(rRenderContext.GetMapMode().GetOrigin());
2589  aEntryPos.setX( aEntryPos.X() * -1 ); // conversion document coordinates
2590  tools::Long nMaxRight = nWidth + aEntryPos.X() - 1;
2591 
2592  Color aBackupTextColor(rRenderContext.GetTextColor());
2593  vcl::Font aBackupFont(rRenderContext.GetFont());
2594  Color aBackupColor = rRenderContext.GetFillColor();
2595 
2596  bool bCurFontIsSel = false;
2597  // if a ClipRegion was set from outside, we don't have to reset it
2598  const WinBits nWindowStyle = GetStyle();
2599  const bool bHideSelection = (nWindowStyle & WB_HIDESELECTION) !=0 && !HasFocus();
2600  const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
2601 
2602  vcl::Font aHighlightFont(rRenderContext.GetFont());
2603  const Color aHighlightTextColor(rSettings.GetHighlightTextColor());
2604  aHighlightFont.SetColor(aHighlightTextColor);
2605 
2606  Size aRectSize(0, nTempEntryHeight);
2607 
2608  SvViewDataEntry* pViewDataEntry = GetViewDataEntry( &rEntry );
2609 
2610  const size_t nTabCount = aTabs.size();
2611  const size_t nItemCount = rEntry.ItemCount();
2612  size_t nCurTab = 0;
2613  size_t nCurItem = 0;
2614 
2615  while (nCurTab < nTabCount && nCurItem < nItemCount)
2616  {
2617  SvLBoxTab* pTab = aTabs[nCurTab].get();
2618  const size_t nNextTab = nCurTab + 1;
2619  SvLBoxTab* pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2620  SvLBoxItem& rItem = rEntry.GetItem(nCurItem);
2621 
2622  SvLBoxTabFlags nFlags = pTab->nFlags;
2623  Size aSize(rItem.GetWidth(this, pViewDataEntry, nCurItem),
2624  SvLBoxItem::GetHeight(pViewDataEntry, nCurItem));
2625  tools::Long nTabPos = GetTabPos(&rEntry, pTab);
2626 
2627  tools::Long nNextTabPos;
2628  if (pNextTab)
2629  nNextTabPos = GetTabPos(&rEntry, pNextTab);
2630  else
2631  {
2632  nNextTabPos = nMaxRight;
2633  if (nTabPos > nMaxRight)
2634  nNextTabPos += 50;
2635  }
2636 
2637  tools::Long nX;
2638  if( pTab->nFlags & SvLBoxTabFlags::ADJUST_RIGHT )
2639  // avoid cutting the right edge off the tab separation
2640  nX = nTabPos + pTab->CalcOffset(aSize.Width(), (nNextTabPos - SV_TAB_BORDER - 1) - nTabPos);
2641  else
2642  nX = nTabPos + pTab->CalcOffset(aSize.Width(), nNextTabPos - nTabPos);
2643 
2644  aEntryPos.setX( nX );
2645  aEntryPos.setY( nLine );
2646 
2647  // set background pattern/color
2648 
2649  Wallpaper aWallpaper = rRenderContext.GetBackground();
2650 
2651  bool bSelTab = bool(nFlags & SvLBoxTabFlags::SHOW_SELECTION);
2652 
2653  if (pViewDataEntry->IsHighlighted() && bSelTab)
2654  {
2655  Color aNewWallColor = rSettings.GetHighlightColor();
2656  // if the face color is bright then the deactivate color is also bright
2657  // -> so you can't see any deactivate selection
2658  if (bHideSelection && !rSettings.GetFaceColor().IsBright()
2659  && aWallpaper.GetColor().IsBright() != rSettings.GetDeactiveColor().IsBright())
2660  {
2661  aNewWallColor = rSettings.GetDeactiveColor();
2662  }
2663  // set font color to highlight
2664  if (!bCurFontIsSel)
2665  {
2666  rRenderContext.SetTextColor(aHighlightTextColor);
2667  rRenderContext.SetFont(aHighlightFont);
2668  bCurFontIsSel = true;
2669  }
2670  aWallpaper.SetColor(aNewWallColor);
2671  }
2672  else // no selection
2673  {
2674  if (bCurFontIsSel || rEntry.GetTextColor())
2675  {
2676  bCurFontIsSel = false;
2677  if (const auto & xCustomTextColor = rEntry.GetTextColor())
2678  rRenderContext.SetTextColor(*xCustomTextColor);
2679  else
2680  rRenderContext.SetTextColor(aBackupTextColor);
2681  rRenderContext.SetFont(aBackupFont);
2682  }
2683  else
2684  {
2685  aWallpaper.SetColor(rEntry.GetBackColor());
2686  }
2687  }
2688 
2689  // draw background
2691  {
2692  // only draw the area that is used by the item
2693  aRectSize.setWidth( aSize.Width() );
2694  aRect.SetPos(aEntryPos);
2695  aRect.SetSize(aRectSize);
2696  }
2697  else
2698  {
2699  // draw from the current to the next tab
2700  if (nCurTab != 0)
2701  aRect.SetLeft( nTabPos );
2702  else
2703  // if we're in the 0th tab, always draw from column 0 --
2704  // else we get problems with centered tabs
2705  aRect.SetLeft( 0 );
2706  aRect.SetTop( nLine );
2707  aRect.SetBottom( nLine + nTempEntryHeight - 1 );
2708  if (pNextTab)
2709  {
2710  tools::Long nRight;
2711  nRight = GetTabPos(&rEntry, pNextTab) - 1;
2712  if (nRight > nMaxRight)
2713  nRight = nMaxRight;
2714  aRect.SetRight( nRight );
2715  }
2716  else
2717  {
2718  aRect.SetRight( nMaxRight );
2719  }
2720  }
2721  // A custom selection that starts at a tab position > 0, do not fill
2722  // the background of the 0th item, else e.g. we might not be able to
2723  // realize tab listboxes with lines.
2724  if (!(nCurTab == 0 && (nTreeFlags & SvTreeFlags::USESEL) && nFirstSelTab))
2725  {
2726  Color aBackgroundColor = aWallpaper.GetColor();
2727  if (aBackgroundColor != COL_TRANSPARENT)
2728  {
2729  rRenderContext.SetFillColor(aBackgroundColor);
2730  // this case may occur for smaller horizontal resizes
2731  if (aRect.Left() < aRect.Right())
2732  rRenderContext.DrawRect(aRect);
2733  }
2734  }
2735  // draw item
2736  // center vertically
2737  aEntryPos.AdjustY((nTempEntryHeight - aSize.Height()) / 2 );
2738 
2739  rItem.Paint(aEntryPos, *this, rRenderContext, pViewDataEntry, rEntry);
2740 
2741  // division line between tabs
2742  if (pNextTab && rItem.GetType() == SvLBoxItemType::String &&
2743  // not at the right edge of the window!
2744  aRect.Right() < nMaxRight)
2745  {
2746  aRect.SetLeft( aRect.Right() - SV_TAB_BORDER );
2747  rRenderContext.DrawRect(aRect);
2748  }
2749 
2750  rRenderContext.SetFillColor(aBackupColor);
2751 
2752  nCurItem++;
2753  nCurTab++;
2754  }
2755 
2756  if (pViewDataEntry->IsDragTarget())
2757  {
2758  rRenderContext.Push();
2759  rRenderContext.SetLineColor(rSettings.GetDeactiveColor());
2760  rRenderContext.SetFillColor(rSettings.GetDeactiveColor());
2761  rRenderContext.DrawRect(tools::Rectangle(Point(0, nLine), Size(nWidth, 2)));
2762  rRenderContext.Pop();
2763  }
2764 
2765  if (bCurFontIsSel || rEntry.GetTextColor())
2766  {
2767  rRenderContext.SetTextColor(aBackupTextColor);
2768  rRenderContext.SetFont(aBackupFont);
2769  }
2770 
2771  sal_uInt16 nFirstDynTabPos(0);
2772  SvLBoxTab* pFirstDynamicTab = GetFirstDynamicTab(nFirstDynTabPos);
2773  tools::Long nDynTabPos = GetTabPos(&rEntry, pFirstDynamicTab);
2774  nDynTabPos += pImpl->m_nNodeBmpTabDistance;
2775  nDynTabPos += pImpl->m_nNodeBmpWidth / 2;
2776  nDynTabPos += 4; // 4 pixels of buffer, so the node bitmap is not too close
2777  // to the next tab
2778 
2779  if( !((!(rEntry.GetFlags() & SvTLEntryFlags::NO_NODEBMP)) &&
2780  (nWindowStyle & WB_HASBUTTONS) && pFirstDynamicTab &&
2781  (rEntry.HasChildren() || rEntry.HasChildrenOnDemand())))
2782  return;
2783 
2784  // find first tab and check if the node bitmap extends into it
2785  sal_uInt16 nNextTab = nFirstDynTabPos;
2786  SvLBoxTab* pNextTab;
2787  do
2788  {
2789  nNextTab++;
2790  pNextTab = nNextTab < nTabCount ? aTabs[nNextTab].get() : nullptr;
2791  } while (pNextTab && pNextTab->IsDynamic());
2792 
2793  if (pNextTab && (GetTabPos( &rEntry, pNextTab ) <= nDynTabPos))
2794  return;
2795 
2796  if (!((nWindowStyle & WB_HASBUTTONSATROOT) || pModel->GetDepth(&rEntry) > 0))
2797  return;
2798 
2799  Point aPos(GetTabPos(&rEntry, pFirstDynamicTab), nLine);
2800  aPos.AdjustX(pImpl->m_nNodeBmpTabDistance );
2801 
2802  const Image* pImg = nullptr;
2803 
2804  if (IsExpanded(&rEntry))
2805  pImg = &pImpl->GetExpandedNodeBmp();
2806  else
2807  {
2808  if ((!rEntry.HasChildren()) && rEntry.HasChildrenOnDemand() &&
2809  (!(rEntry.GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) &&
2810  pImpl->GetDontKnowNodeBmp().GetSizePixel().Width())
2811  {
2812  pImg = &pImpl->GetDontKnowNodeBmp( );
2813  }
2814  else
2815  {
2816  pImg = &pImpl->GetCollapsedNodeBmp( );
2817  }
2818  }
2819  aPos.AdjustY((nTempEntryHeight - pImg->GetSizePixel().Height()) / 2 );
2820 
2822  if (!IsEnabled())
2823  nStyle |= DrawImageFlags::Disable;
2824 
2825  //native
2826  bool bNativeOK = false;
2828  {
2829  ImplControlValue aControlValue;
2830  tools::Rectangle aCtrlRegion(aPos, pImg->GetSizePixel());
2832 
2833  if (IsEnabled())
2834  nState |= ControlState::ENABLED;
2835 
2836  if (IsExpanded(&rEntry))
2837  aControlValue.setTristateVal(ButtonValue::On); //expanded node
2838  else
2839  {
2840  if ((!rEntry.HasChildren()) && rEntry.HasChildrenOnDemand() &&
2841  (!(rEntry.GetFlags() & SvTLEntryFlags::HAD_CHILDREN)) &&
2842  pImpl->GetDontKnowNodeBmp().GetSizePixel().Width())
2843  {
2844  aControlValue.setTristateVal( ButtonValue::DontKnow ); //don't know
2845  }
2846  else
2847  {
2848  aControlValue.setTristateVal( ButtonValue::Off ); //collapsed node
2849  }
2850  }
2851 
2852  bNativeOK = rRenderContext.DrawNativeControl(ControlType::ListNode, ControlPart::Entire, aCtrlRegion, nState, aControlValue, OUString());
2853  }
2854 
2855  if (!bNativeOK)
2856  {
2857  rRenderContext.DrawImage(aPos, *pImg ,nStyle);
2858  }
2859 }
2860 
2861 void SvTreeListBox::DrawCustomEntry(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect, const SvTreeListEntry& rEntry)
2862 {
2863  aCustomRenderHdl.Call(std::tuple<vcl::RenderContext&, const tools::Rectangle&, const SvTreeListEntry&>(rRenderContext, rRect, rEntry));
2864 }
2865 
2867 {
2868  return aCustomMeasureHdl.Call(std::pair<vcl::RenderContext&, const SvTreeListEntry&>(rRenderContext, rEntry));
2869 }
2870 
2872 {
2873  pImpl->UpdateContextBmpWidthMax( pEntry );
2874 
2875  Size aSize;
2876  tools::Rectangle aRect;
2877  aRect.SetTop( nLine );
2878  aSize.setHeight( GetEntryHeight() );
2879 
2880  tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2881  nRealWidth -= GetMapMode().GetOrigin().X();
2882 
2883  sal_uInt16 nCurTab;
2885  tools::Long nTabPos = 0;
2886  if( pTab )
2887  nTabPos = GetTabPos( pEntry, pTab );
2888  tools::Long nNextTabPos;
2889  if( pTab && nCurTab < aTabs.size() - 1 )
2890  {
2891  SvLBoxTab* pNextTab = aTabs[ nCurTab + 1 ].get();
2892  nNextTabPos = GetTabPos( pEntry, pNextTab );
2893  }
2894  else
2895  {
2896  nNextTabPos = nRealWidth;
2897  if( nTabPos > nRealWidth )
2898  nNextTabPos += 50;
2899  }
2900 
2901  bool bUserSelection = bool( nTreeFlags & SvTreeFlags::USESEL );
2902  if( !bUserSelection )
2903  {
2904  if( pTab && nCurTab < pEntry->ItemCount() )
2905  {
2906  const SvLBoxItem& rItem = pEntry->GetItem( nCurTab );
2907  aSize.setWidth(rItem.GetWidth(this, pEntry));
2908  if( !aSize.Width() )
2909  aSize.setWidth( 15 );
2910  tools::Long nX = nTabPos; //GetTabPos( pEntry, pTab );
2911  // alignment
2912  nX += pTab->CalcOffset( aSize.Width(), nNextTabPos - nTabPos );
2913  aRect.SetLeft( nX );
2914  // make sure that first and last letter aren't cut off slightly
2915  aRect.SetSize( aSize );
2916  if( aRect.Left() > 0 )
2917  aRect.AdjustLeft( -1 );
2918  aRect.AdjustRight( 1 );
2919  }
2920  }
2921  else
2922  {
2923  // if SelTab != 0, we have to calculate also
2924  if( nFocusWidth == -1 || nFirstSelTab )
2925  {
2926  SvLBoxTab* pLastTab = nullptr; // default to select whole width
2927 
2928  sal_uInt16 nLastTab;
2930  nLastTab++;
2931  if( nLastTab < aTabs.size() ) // is there another one?
2932  pLastTab = aTabs[ nLastTab ].get();
2933 
2934  aSize.setWidth( pLastTab ? pLastTab->GetPos() : 0x0fffffff );
2935  nFocusWidth = static_cast<short>(aSize.Width());
2936  if( pTab )
2937  nFocusWidth = nFocusWidth - static_cast<short>(nTabPos); //pTab->GetPos();
2938  }
2939  else
2940  {
2941  aSize.setWidth( nFocusWidth );
2942  if( pTab )
2943  {
2944  if( nCurTab )
2945  aSize.AdjustWidth(nTabPos );
2946  else
2947  aSize.AdjustWidth(pTab->GetPos() ); // Tab0 always from the leftmost position
2948  }
2949  }
2950  // if selection starts with 0th tab, draw from column 0 on
2951  if( nCurTab != 0 )
2952  {
2953  aRect.SetLeft( nTabPos );
2954  aSize.AdjustWidth( -nTabPos );
2955  }
2956  aRect.SetSize( aSize );
2957  }
2958  // adjust right edge because of clipping
2959  if( aRect.Right() >= nRealWidth )
2960  {
2961  aRect.SetRight( nRealWidth-1 );
2962  nFocusWidth = static_cast<short>(aRect.GetWidth());
2963  }
2964  return aRect;
2965 }
2966 
2967 sal_IntPtr SvTreeListBox::GetTabPos(const SvTreeListEntry* pEntry, const SvLBoxTab* pTab)
2968 {
2969  assert(pTab);
2970  sal_IntPtr nPos = pTab->GetPos();
2971  if( pTab->IsDynamic() )
2972  {
2973  sal_uInt16 nDepth = pModel->GetDepth( pEntry );
2974  nDepth = nDepth * static_cast<sal_uInt16>(nIndent);
2975  nPos += static_cast<sal_IntPtr>(nDepth);
2976  }
2977  return nPos + (pEntry->GetExtraIndent() * nIndent);
2978 }
2979 
2981  SvLBoxTab** ppTab )
2982 {
2983  SvLBoxItem* pItemClicked = nullptr;
2984  sal_uInt16 nTabCount = aTabs.size();
2985  sal_uInt16 nItemCount = pEntry->ItemCount();
2986  SvLBoxTab* pTab = aTabs.front().get();
2987  SvLBoxItem* pItem = &pEntry->GetItem(0);
2988  sal_uInt16 nNextItem = 1;
2989  nX -= GetMapMode().GetOrigin().X();
2990  tools::Long nRealWidth = pImpl->GetOutputSize().Width();
2991  nRealWidth -= GetMapMode().GetOrigin().X();
2992 
2993  while( true )
2994  {
2995  SvLBoxTab* pNextTab=nNextItem<nTabCount ? aTabs[nNextItem].get() : nullptr;
2996  tools::Long nStart = GetTabPos( pEntry, pTab );
2997 
2998  tools::Long nNextTabPos;
2999  if( pNextTab )
3000  nNextTabPos = GetTabPos( pEntry, pNextTab );
3001  else
3002  {
3003  nNextTabPos = nRealWidth;
3004  if( nStart > nRealWidth )
3005  nNextTabPos += 50;
3006  }
3007 
3008  auto nItemWidth(pItem->GetWidth(this, pEntry));
3009  nStart += pTab->CalcOffset(nItemWidth, nNextTabPos - nStart);
3010  auto nLen = nItemWidth;
3011  if( pNextTab )
3012  {
3013  tools::Long nTabWidth = GetTabPos( pEntry, pNextTab ) - nStart;
3014  if( nTabWidth < nLen )
3015  nLen = nTabWidth;
3016  }
3017 
3018  if( nX >= nStart && nX < (nStart+nLen ) )
3019  {
3020  pItemClicked = pItem;
3021  if( ppTab )
3022  {
3023  *ppTab = pTab;
3024  break;
3025  }
3026  }
3027  if( nNextItem >= nItemCount || nNextItem >= nTabCount)
3028  break;
3029  pTab = aTabs[ nNextItem ].get();
3030  pItem = &pEntry->GetItem( nNextItem );
3031  nNextItem++;
3032  }
3033  return pItemClicked;
3034 }
3035 
3036 tools::Long SvTreeListBox::getPreferredDimensions(std::vector<tools::Long> &rWidths) const
3037 {
3038  tools::Long nHeight = 0;
3039  rWidths.clear();
3040  SvTreeListEntry* pEntry = First();
3041  while (pEntry)
3042  {
3043  sal_uInt16 nCount = pEntry->ItemCount();
3044  sal_uInt16 nCurPos = 0;
3045  if (nCount > rWidths.size())
3046  rWidths.resize(nCount);
3047  while (nCurPos < nCount)
3048  {
3049  SvLBoxItem& rItem = pEntry->GetItem( nCurPos );
3050  auto nWidth = rItem.GetWidth(this, pEntry);
3051  if (nWidth)
3052  {
3053  nWidth += SV_TAB_BORDER * 2;
3054  if (nWidth > rWidths[nCurPos])
3055  rWidths[nCurPos] = nWidth;
3056  }
3057  ++nCurPos;
3058  }
3059  pEntry = Next( pEntry );
3060  nHeight += GetEntryHeight();
3061  }
3062  return nHeight;
3063 }
3064 
3066 {
3067  std::vector<tools::Long> aWidths;
3068  Size aRet(0, getPreferredDimensions(aWidths));
3069  for (tools::Long aWidth : aWidths)
3070  aRet.AdjustWidth(aWidth );
3071  if (GetStyle() & WB_BORDER)
3072  {
3075  }
3077  aRet.setWidth( std::max(aRet.Width(), nMinWidth) );
3078 
3079  if (GetStyle() & WB_VSCROLL)
3080  aRet.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize());
3081 
3082  return aRet;
3083 }
3084 
3086 {
3088  {
3089  mbAlternatingRowColors = bEnable;
3090  return;
3091  }
3092 
3093  if( bEnable )
3094  {
3095  SvTreeListEntry* pEntry = pModel->First();
3096  for(size_t i = 0; pEntry; ++i)
3097  {
3098  pEntry->SetBackColor( i % 2 == 0 ? GetBackground().GetColor() : GetSettings().GetStyleSettings().GetAlternatingRowColor());
3099  SvTreeListEntry *pNextEntry = nullptr;
3100  if( IsExpanded( pEntry ) )
3101  pNextEntry = pModel->FirstChild( pEntry );
3102  else
3103  pNextEntry = pEntry->NextSibling();
3104 
3105  if( !pNextEntry )
3106  pEntry = pModel->Next( pEntry );
3107  else
3108  pEntry = pNextEntry;
3109  }
3110  }
3111  else if( mbAlternatingRowColors )
3112  for(SvTreeListEntry* pEntry = pModel->First(); pEntry; pEntry = pModel->Next(pEntry))
3113  pEntry->SetBackColor( GetBackground().GetColor() );
3114 
3115  mbAlternatingRowColors = bEnable;
3116  pImpl->UpdateAll(true);
3117 }
3118 
3120 {
3121  pImpl->SetForceMakeVisible(bEnable);
3122 }
3123 
3125 {
3126  return GetItem_Impl( pEntry, nX, ppTab );
3127 }
3128 
3130 {
3131  SvLBoxTab* pDummyTab;
3132  return GetItem_Impl( pEntry, nX, &pDummyTab );
3133 }
3134 
3136 {
3137  nFocusWidth = -1;
3138  SvLBoxTab* pTab = new SvLBoxTab( nTabPos, nFlags );
3139  aTabs.emplace_back( pTab );
3141  {
3142  sal_uInt16 nPos = aTabs.size() - 1;
3143  if( nPos >= nFirstSelTab && nPos <= nLastSelTab )
3145  else
3146  // string items usually have to be selected -- turn this off
3147  // explicitly
3149  }
3150 }
3151 
3152 
3154 {
3155  sal_uInt16 nCurTab = 0;
3156  sal_uInt16 nTabCount = aTabs.size();
3157  while( nCurTab < nTabCount )
3158  {
3159  SvLBoxTab* pTab = aTabs[nCurTab].get();
3160  if( pTab->nFlags & SvLBoxTabFlags::DYNAMIC )
3161  {
3162  rPos = nCurTab;
3163  return pTab;
3164  }
3165  nCurTab++;
3166  }
3167  return nullptr;
3168 }
3169 
3171 {
3172  sal_uInt16 nDummy;
3173  return GetFirstDynamicTab( nDummy );
3174 }
3175 
3176 SvLBoxTab* SvTreeListBox::GetTab( SvTreeListEntry const * pEntry, SvLBoxItem const * pItem) const
3177 {
3178  sal_uInt16 nPos = pEntry->GetPos( pItem );
3179  return aTabs[ nPos ].get();
3180 }
3181 
3183 {
3184  aTabs.clear();
3185 }
3186 
3187 
3189 {
3190  Size aSize = pImpl->GetOutputSize();
3191  return aSize;
3192 }
3193 
3195 {
3196  aScrolledHdl.Call( this );
3197 }
3198 
3200 {
3201  if (!pImpl)
3202  return;
3203  if( nFocusWidth == -1 )
3204  // to make sure that the control doesn't show the wrong focus rectangle
3205  // after painting
3206  pImpl->RecalcFocusRect();
3207  Control::Invalidate( nInvalidateFlags );
3208  pImpl->Invalidate();
3209 }
3210 
3211 void SvTreeListBox::Invalidate( const tools::Rectangle& rRect, InvalidateFlags nInvalidateFlags )
3212 {
3213  if( nFocusWidth == -1 )
3214  // to make sure that the control doesn't show the wrong focus rectangle
3215  // after painting
3216  pImpl->RecalcFocusRect();
3217  Control::Invalidate( rRect, nInvalidateFlags );
3218 }
3219 
3220 
3221 void SvTreeListBox::SetHighlightRange( sal_uInt16 nStart, sal_uInt16 nEnd)
3222 {
3223 
3225  if( nStart > nEnd )
3226  std::swap(nStart, nEnd);
3227  // select all tabs that lie within the area
3229  nFirstSelTab = nStart;
3230  nLastSelTab = nEnd;
3231  pImpl->RecalcFocusRect();
3232 }
3233 
3235 {
3236  if (!aPopupMenuHdl.Call(rCEvt))
3237  pImpl->Command(rCEvt);
3238  //pass at least alt press/release to parent impl
3240  Control::Command(rCEvt);
3241 }
3242 
3243 SvLBoxTab* SvTreeListBox::GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rPos )
3244 {
3245  sal_uInt16 nTabCount = aTabs.size();
3246  for( sal_uInt16 nPos = 0; nPos < nTabCount; nPos++ )
3247  {
3248  SvLBoxTab* pTab = aTabs[ nPos ].get();
3249  if( pTab->nFlags & nFlagMask )
3250  {
3251  rPos = nPos;
3252  return pTab;
3253  }
3254  }
3255  rPos = 0xffff;
3256  return nullptr;
3257 }
3258 
3259 void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos )
3260 {
3261  sal_uInt16 nPos = static_cast<sal_uInt16>(aTabs.size());
3262  while( nPos )
3263  {
3264  --nPos;
3265  SvLBoxTab* pTab = aTabs[ nPos ].get();
3266  if( pTab->nFlags & nFlagMask )
3267  {
3268  rTabPos = nPos;
3269  return;
3270  }
3271  }
3272  rTabPos = 0xffff;
3273 }
3274 
3276 {
3277  if (aTooltipHdl.IsSet() && aTooltipHdl.Call(rHEvt))
3278  return;
3279 
3280  if( !pImpl->RequestHelp( rHEvt ) )
3281  Control::RequestHelp( rHEvt );
3282 }
3283 
3284 sal_Int32 SvTreeListBox::DefaultCompare(const SvLBoxString* pLeftText, const SvLBoxString* pRightText)
3285 {
3286  OUString aLeft = pLeftText ? pLeftText->GetText() : OUString();
3287  OUString aRight = pRightText ? pRightText->GetText() : OUString();
3288  pImpl->UpdateStringSorter();
3289  return pImpl->m_pStringSorter->compare(aLeft, aRight);
3290 }
3291 
3292 IMPL_LINK( SvTreeListBox, DefaultCompare, const SvSortData&, rData, sal_Int32 )
3293 {
3294  const SvTreeListEntry* pLeft = rData.pLeft;
3295  const SvTreeListEntry* pRight = rData.pRight;
3296  const SvLBoxString* pLeftText = static_cast<const SvLBoxString*>(pLeft->GetFirstItem(SvLBoxItemType::String));
3297  const SvLBoxString* pRightText = static_cast<const SvLBoxString*>(pRight->GetFirstItem(SvLBoxItemType::String));
3298  return DefaultCompare(pLeftText, pRightText);
3299 }
3300 
3302  SvTreeListEntry* pEntry2, sal_uLong nPos )
3303 {
3304  SolarMutexGuard aSolarGuard;
3305 
3306  if( nActionId == SvListAction::CLEARING )
3308 
3309  SvListView::ModelNotification( nActionId, pEntry1, pEntry2, nPos );
3310  switch( nActionId )
3311  {
3313  {
3314  SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry1->GetFirstItem( SvLBoxItemType::ContextBmp ) );
3315  if ( !pBmpItem )
3316  break;
3317  const Image& rBitmap1( pBmpItem->GetBitmap1() );
3318  const Image& rBitmap2( pBmpItem->GetBitmap2() );
3319  short nMaxWidth = short( std::max( rBitmap1.GetSizePixel().Width(), rBitmap2.GetSizePixel().Width() ) );
3320  nMaxWidth = pImpl->UpdateContextBmpWidthVector( pEntry1, nMaxWidth );
3321  if( nMaxWidth > nContextBmpWidthMax )
3322  {
3323  nContextBmpWidthMax = nMaxWidth;
3324  SetTabs();
3325  }
3326  if (get_width_request() == -1)
3327  queue_resize();
3328  }
3329  break;
3330 
3332  SetUpdateMode( false );
3333  break;
3334 
3336  // after a selection: show first entry and also keep the selection
3337  MakeVisible( pModel->First(), true );
3338  SetUpdateMode( true );
3339  break;
3340 
3341  case SvListAction::CLEARED:
3342  if( IsUpdateMode() )
3343  PaintImmediately();
3344  break;
3345 
3346  default: break;
3347  }
3348 }
3349 
3351 {
3352  return GetEntry( Point() );
3353 }
3354 
3356 {
3357  SvTreeListEntry* pNext = NextVisible( pEntry );
3358  if( pNext )
3359  {
3360  Point aPos( GetEntryPosition(pNext) );
3361  const Size& rSize = pImpl->GetOutputSize();
3362  if( aPos.Y() < 0 || aPos.Y() >= rSize.Height() )
3363  return nullptr;
3364  }
3365  return pNext;
3366 }
3367 
3368 
3370 {
3372  {
3373  nEntryHeight = 0; // _together_ with true of 1. par (bFont) of InitSettings() a zero-height
3374  // forces complete recalc of heights!
3375  InitSettings();
3376  Invalidate();
3377  }
3378  else
3379  Control::DataChanged( rDCEvt );
3380 }
3381 
3383 {
3384  if( eType == StateChangedType::Enable )
3386 
3387  Control::StateChanged( eType );
3388 
3389  if ( eType == StateChangedType::Style )
3390  ImplInitStyle();
3391 }
3392 
3394 {
3395  SetPointFont(rRenderContext, GetPointFont(*this));
3396 
3397  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
3398  rRenderContext.SetTextColor(rStyleSettings.GetFieldTextColor());
3399  rRenderContext.SetTextFillColor();
3400  rRenderContext.SetBackground(rStyleSettings.GetFieldColor());
3401 
3402  // always try to re-create default-SvLBoxButtonData
3405 }
3406 
3408 {
3409  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
3410  vcl::Font aFont = rStyleSettings.GetFieldFont();
3411  SetPointFont(*this, aFont);
3413 
3414  SetTextColor(rStyleSettings.GetFieldTextColor());
3415  SetTextFillColor();
3416 
3417  SetBackground(rStyleSettings.GetFieldColor());
3418 
3419  // always try to re-create default-SvLBoxButtonData
3422 }
3423 
3424 css::uno::Reference< XAccessible > SvTreeListBox::CreateAccessible()
3425 {
3427  DBG_ASSERT( pParent, "SvTreeListBox::CreateAccessible - accessible parent not found" );
3428 
3429  css::uno::Reference< XAccessible > xAccessible;
3430  if ( pParent )
3431  {
3432  css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible();
3433  if ( xAccParent.is() )
3434  {
3435  // need to be done here to get the vclxwindow later on in the accessible
3436  css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface());
3437  xAccessible = pImpl->m_aFactoryAccess.getFactory().createAccessibleTreeListBox( *this, xAccParent );
3438  }
3439  }
3440  return xAccessible;
3441 }
3442 
3444 {
3445  assert(pEntry && "SvTreeListBox::FillAccessibleEntryStateSet: invalid entry");
3446 
3447  if ( pEntry->HasChildrenOnDemand() || pEntry->HasChildren() )
3448  {
3449  rStateSet.AddState( AccessibleStateType::EXPANDABLE );
3450  if ( IsExpanded( pEntry ) )
3451  rStateSet.AddState( sal_Int16(AccessibleStateType::EXPANDED) );
3452  }
3453 
3454  if ( GetCheckButtonState( pEntry ) == SvButtonState::Checked )
3455  rStateSet.AddState( AccessibleStateType::CHECKED );
3456  if ( IsEntryVisible( pEntry ) )
3457  rStateSet.AddState( AccessibleStateType::VISIBLE );
3458  if ( IsSelected( pEntry ) )
3459  rStateSet.AddState( AccessibleStateType::SELECTED );
3460  if ( IsEnabled() )
3461  {
3462  rStateSet.AddState( AccessibleStateType::ENABLED );
3463  rStateSet.AddState( AccessibleStateType::FOCUSABLE );
3464  rStateSet.AddState( AccessibleStateType::SELECTABLE );
3465  SvViewDataEntry* pViewDataNewCur = GetViewDataEntry(pEntry);
3466  if (pViewDataNewCur && pViewDataNewCur->HasFocus())
3467  rStateSet.AddState( AccessibleStateType::FOCUSED );
3468  }
3469 }
3470 
3472 {
3473  Point aPos = GetEntryPosition( pEntry );
3474  tools::Rectangle aRect = GetFocusRect( pEntry, aPos.Y() );
3475  return aRect;
3476 }
3477 
3479 {
3480  CallEventListeners(nEvent, pData);
3481 }
3482 
3484 {
3485  nMinWidthInChars = nChars;
3486  queue_resize();
3487 }
3488 
3489 bool SvTreeListBox::set_property(const OString &rKey, const OUString &rValue)
3490 {
3491  if (rKey == "min-width-chars")
3492  {
3493  set_min_width_in_chars(rValue.toInt32());
3494  }
3495  else if (rKey == "enable-tree-lines")
3496  {
3497  auto nStyle = GetStyle();
3498  nStyle &= ~(WB_HASLINES | WB_HASLINESATROOT);
3499  if (toBool(rValue))
3500  nStyle |= (WB_HASLINES | WB_HASLINESATROOT);
3501  SetStyle(nStyle);
3502  }
3503  else if (rKey == "show-expanders")
3504  {
3505  auto nStyle = GetStyle();
3506  nStyle &= ~(WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3507  if (toBool(rValue))
3508  nStyle |= (WB_HASBUTTONS | WB_HASBUTTONSATROOT);
3509  SetStyle(nStyle);
3510  }
3511  else if (rKey == "rules-hint")
3512  {
3514  }
3515  else if (rKey == "enable-search")
3516  {
3517  SetQuickSearch(toBool(rValue));
3518  }
3519  else if (rKey == "activate-on-single-click")
3520  {
3522  }
3523  else if (rKey == "hover-selection")
3524  {
3525  SetHoverSelection(toBool(rValue));
3526  }
3527  else if (rKey == "reorderable")
3528  {
3529  if (toBool(rValue))
3531  }
3532  else
3533  return Control::set_property(rKey, rValue);
3534  return true;
3535 }
3536 
3538 {
3539  return TreeListUIObject::create;
3540 }
3541 
3542 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static bool toBool(std::string_view rValue)
Definition: builder.cxx:80
virtual void ModelHasInserted(SvTreeListEntry *pEntry) override
void AddItem(std::unique_ptr< SvLBoxItem > pItem)
Point TopLeft() const
Size GetSizePixel() const
Definition: Image.cxx:86
const Color & GetTextColor() const
Definition: outdev.hxx:1132
bool CheckDragAndDropMode(SvTreeListBox const *pSource, sal_Int8)
void SetPos(const Point &rPoint)
The child windows are invalidated, too.
Link< svtree_measure_args, Size > aCustomMeasureHdl
virtual void ModelIsMoving(SvTreeListEntry *pSource) override
Image const & GetExpandedNodeBmp() const
void dispose()
Definition: treelist.cxx:1037
SAL_DLLPRIVATE float approximate_char_width() const
Definition: text.cxx:916
void SetFillColor(const Color &)
Definition: font/font.cxx:88
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:642
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
SvListAction
Definition: treelist.hxx:35
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
void SetNoAutoCurEntry(bool b)
void setWidth(tools::Long nWidth)
virtual void DragFinished(sal_Int8 nDropAction)
#define DND_ACTION_COPY
Definition: transfer.hxx: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
signed char sal_Int8
SvTreeList * GetModel() const
bool IsEditingActive() const
SvTLEntryFlags GetFlags() const
WinBits const WB_HASBUTTONSATROOT
vcl::Window * GetAccessibleParentWindow() const
void SetSortMode(SvSortMode eMode)
Definition: treelist.hxx:197
OUString const & GetSavedValue() const
VCL_DLLPRIVATE void AdjustEntryHeight()
#define SVLBOX_ACC_RETURN
Definition: treelistbox.cxx:58
void AdjustEntryHeightAndRecalc()
sal_uIntPtr sal_uLong
long Long
void disposeAndClear()
Definition: vclptr.hxx:200
virtual void StateChanged(StateChangedType eType) override
const StyleSettings & GetStyleSettings() const
const Color & GetFaceColor() const
virtual tools::Rectangle GetFocusRect(const SvTreeListEntry *, tools::Long nLine)
VCL_DLLPRIVATE void ImplInitStyle()
bool ExpandingHdl()
virtual void StateChanged(StateChangedType nStateChange) override
Definition: ctrl.cxx:260
SvTreeListEntry * GetFirstEntryInView() const
const Image & GetDefaultExpandedEntryBmp() const
SvItemStateFlags
Definition: svlbitm.hxx:47
void SetFlags(SvTLEntryFlags nFlags)
bool HasDefaultImages() const
Definition: svlbitm.cxx:156
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual Size GetSizePixel() const
Definition: window.cxx:2397
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:189
SvLBoxTab * GetFirstDynamicTab() const
virtual DragDropMode NotifyStartDrag()
SvLBoxTab * GetFirstTab(SvLBoxTabFlags nFlagMask, sal_uInt16 &rTabPos)
SvTreeListEntry * GetActEntry() const
Definition: svlbitm.cxx:120
tools::Long mnCheckboxItemWidth
SvTreeListBoxImpl(SvTreeListBox &_rBox)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: edit.cxx:222
void FillAccessibleEntryStateSet(SvTreeListEntry *pEntry,::utl::AccessibleStateSetHelper &rStateSet) const
Fills the StateSet of one entry.
static const Image & GetDefaultCollapsedNodeImage()
Definition: svimpbox.cxx:3095
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:1681
#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
tools::Long GetWidth() const
bool IsDynamic() const
void RemoveSelection()
DataChangedEventType GetType() const
Definition: event.hxx:356
void SetEntryText(SvTreeListEntry *, const OUString &)
void SetCurEntry(SvTreeListEntry *_pEntry)
Link< const CommandEvent &, bool > aPopupMenuHdl
short nContextBmpWidthMax
bool mbUpdateAlternatingRows
const OUString & GetText() const
Definition: svlbitm.hxx:133
virtual void InitViewData(SvTreeListBox *pView, SvTreeListEntry *pEntry, SvViewDataItem *pViewData=nullptr)=0
WinBits const WB_VSCROLL
SelectionMode GetSelectionMode() const
virtual void RequestHelp(const HelpEvent &rHEvt) override
virtual int CalcWidth(const SvTreeListBox *pView) const
static const Image & GetExpandedEntryBmp(const SvTreeListEntry *_pEntry)
void SetBitmap2(const Image &rImage)
Definition: svlbitm.hxx:270
bool DoubleClickHdl()
IMPL_LINK_NOARG(SvInplaceEdit2, ReturnHdl_Impl, Accelerator &, void)
void SetType(WindowType nType)
Definition: window2.cxx:968
View-dependent data for a tree list entry created in the virtual function SvTreeListBox::CreateViewDa...
void PaintImmediately()
Definition: paint.cxx:1288
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)
#define TABFLAGS_TEXT
static VclPtr< SvTreeListBox > g_pDDTarget
Definition: treelistbox.cxx:56
SvTreeListBox(vcl::Window *pParent, WinBits nWinStyle=0)
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
const vcl::Font & GetFieldFont() const
static VCL_DLLPRIVATE void RemoveBoxFromDDList_Impl(const SvTreeListBox &rB)
const Color & GetFieldTextColor() const
void SetRight(tools::Long v)
static const Image & GetDefaultExpandedNodeImage()
Definition: svimpbox.cxx:3088
#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
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)
void SetDragHelper(const rtl::Reference< TransferDataContainer > &rHelper, sal_uInt8 eDNDConstants)
#define NODE_AND_CHECK_BUTTONS
void SetBackground()
rtl::Reference< TransferDataContainer > m_xTransferHelper
virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate=true)
Definition: window.cxx:3114
SvViewDataItem * GetViewDataItem(SvTreeListEntry const *, SvLBoxItem const *)
virtual Size GetOptimalSize() const override
void ScrollOutputArea(short nDeltaEntries)
virtual void GetFocus() override
void SetStateTristate()
Definition: svlbitm.hxx:217
void SetForceMakeVisible(bool bEnable)
tools::Long Left() const
DragDropMode
virtual void ModelIsRemoving(SvTreeListEntry *pEntry) override
void SetLeft(tools::Long v)
SvLBoxButtonData * pCheckButtonData
bool mbContextBmpExpanded
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
virtual bool EditingEntry(SvTreeListEntry *pEntry)
virtual void InitViewData(SvViewDataEntry *, SvTreeListEntry *pEntry) override
SvTreeListEntry * FirstSelected() const
Definition: treelist.hxx:253
const vcl::Font & GetFont() const
Definition: outdev.hxx:648
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:357
SvTreeListEntry * NextSibling() const
virtual void Start() override
Activates the timer task.
Definition: idle.cxx:34
virtual FactoryFunction GetUITestFactory() const override
Link< SvTreeListBox *, bool > aDoubleClickHdl
void SetCollapsedEntryBmp(SvTreeListEntry *_pEntry, const Image &_rImage)
VclEventId
Definition: vclevent.hxx:37
void SetBackColor(const Color &rColor)
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1327
void EndEditing(bool bCancel=false)
void EnableSelectionAsDropTarget(bool bEnable=true)
Image aCurInsertedExpBmp
static const Image & GetDefaultExpandedNodeImage()
Returns the default image which clients should use for expanded nodes, to have a consistent user inte...
virtual void SelectEntry(vcl::StringEntryIdentifier _entry) override
selects a given entry
virtual OUString GetText() const
Definition: window.cxx:3033
const void * StringEntryIdentifier
void SetCheckButtonData(SvLBoxButtonData *)
WinBits const WB_HASLINESATROOT
Definition: edit.hxx:55
void SetExpandedNodeBmp(const Image &)
void RecalcViewData()
void CallImplEventListeners(VclEventId nEvent, void *pData)
void SetAlternatingRowColors(const bool bEnable)
void NotifyScrolled()
vcl::QuickSelectionEngine m_aQuickSelectionEngine
sal_uInt16 nCode
TRISTATE_INDET
short GetEntryHeight() const
Link< SvTreeListBox *, void > aDeselectHdl
#define MOUSE_LEFT
Definition: event.hxx:99
VCL_DLLPRIVATE bool PosOverBody(const Point &rPos) const
void EnableInplaceEditing(bool bEnable)
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:51
#define TAB_STARTPOS
DragDropMode nOldDragMode
void SetHoverSelection(bool bEnable)
sal_IntPtr GetTabPos(const SvTreeListEntry *, const SvLBoxTab *)
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)
void SetLineColor()
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Accelerator aAccReturn
Definition: treelistbox.cxx:64
void OnCurrentEntryChanged()
tools::Long getPreferredDimensions(std::vector< tools::Long > &rWidths) const
SelectionMode eSelMode
bool IsChild(const vcl::Window *pWindow) const
Definition: stacking.cxx:1110
size_t ItemCount() const
sal_uLong GetLevelChildCount(SvTreeListEntry *pParent) const
sal_uInt16 nLastSelTab
SvTreeListEntry * CloneEntry(SvTreeListEntry *pSource)
static VCL_DLLPRIVATE void AddBoxToDDList_Impl(const SvTreeListBox &rB)
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt, SvTreeListBox *pSourceView)
#define DBG_ASSERT(sCon, aError)
void SetStateUnchecked()
Definition: svlbitm.hxx:212
void SetEntryWidth(short nWidth)
int i
DragDropMode nDragDropMode
bool IsEditable() const
void CheckButtonHdl()
static OUString SearchEntryTextWithHeadTitle(SvTreeListEntry *pEntry)
void SetSublistOpenWithLeftRight()
static bool InsertAccel(Accelerator *pAccel)
Insert accelerator.
Definition: svapp.cxx:1319
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:198
OUString GetText() const
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1164
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
Definition: mouse.cxx:659
void SetUpdateMode(bool bUpdate)
Definition: window.cxx:2945
SvTreeListEntry * GetNextEntryInView(SvTreeListEntry *) const
Link< SvTreeListBox *, void > aExpandedHdl
virtual OUString GetText() const override
Definition: edit.cxx:2574
void CallEventListeners(VclEventId nEvent, void *pData=nullptr)
Definition: ctrl.cxx:297
bool IsSelected(const SvTreeListEntry *pEntry) const
Definition: treelist.cxx: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()
tools::Long Width() const
void * GetUserData() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx: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)
SvLBoxItem * GetItem(SvTreeListEntry *, tools::Long nX, SvLBoxTab **ppTab)
Link< SvTreeListBox *, void > aSelectHdl
Link< sal_Int8, void > GetDragFinishedHdl() const
SvButtonState
Definition: treelistbox.hxx:57
bool MoveSelectionCopyFallbackPossible(SvTreeListBox *pSource, SvTreeListEntry *pTarget, bool bAllowCopyFallback)
SvTLEntryFlags nEntryFlags
All repaint events should go in here.
virtual void ModelHasMoved(SvTreeListEntry *pSource) override
bool IsMouseCaptured() const
Definition: mouse.cxx: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.
void SetTop(tools::Long v)
virtual SvTreeListEntry * InsertEntry(const OUString &rText, SvTreeListEntry *pParent=nullptr, bool bChildrenOnDemand=false, sal_uLong nPos=TREELIST_APPEND, void *pUserData=nullptr)
void SetBottom(tools::Long v)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: ctrl.cxx:59
size_t GetPos(const SvLBoxItem *pItem) const
static sal_uLong GetRelPos(const SvTreeListEntry *pChild)
Definition: treelist.cxx:831
const AllSettings & GetSettings() const
Definition: outdev.hxx:417
#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:1445
#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:666
bool Expand(SvTreeListEntry *pParent)
virtual void LoseFocus()
Definition: window.cxx:1851
void SelectAll(bool bSelect)
static VclPtr< SvTreeListBox > g_pDDSource
Definition: treelistbox.cxx:55
Point GetEntryPosition(const SvTreeListEntry *) const
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: edit.cxx:1710
virtual void ShowFocus(const tools::Rectangle &rRect)
Definition: window2.cxx:49
vcl::Window * GetParent() const
Definition: window2.cxx:1097
WinBits const WB_LEFT
void SetStyle(WinBits nStyle)
Definition: window.cxx:1958
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 *)
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2169
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:1801
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:1042
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:665
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
virtual void ModelHasCleared() override
virtual void Resize() override
Definition: ctrl.cxx:74
Size GetOutputSizePixel() const
void SetActivateOnSingleClick(bool bEnable)
TriState NotifyMoving(SvTreeListEntry *pTarget, const SvTreeListEntry *pEntry, SvTreeListEntry *&rpNewParent, sal_uLong &rNewChildPos)
void ClickHdl(SvTreeListEntry *)
Definition: svlbitm.cxx:353
void Stop()
Definition: scheduler.cxx:601
static std::unique_ptr< UIObject > create(vcl::Window *pWindow)
SvTreeListEntry * pEdEntry
Definition: ctrl.hxx:33
short nEntryHeightOffs
virtual void GetFocus()
Definition: window.cxx:1837
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
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:903
sal_Int32 get_width_request() const
Definition: window2.cxx:1910
bool bAlreadyInCallBack
Definition: treelistbox.cxx:69
const OUString & GetSavedValue() const
Definition: edit.hxx:209
VCL_DLLPRIVATE void SetEntryHeight(SvTreeListEntry const *pEntry)
sal_Int8 mnDragAction
bool IsLeft() const
Definition: event.hxx:146
bool IsTransparent() const
Definition: font/font.cxx:667
SvTreeListEntry * GetEntry(SvTreeListEntry *pParent, sal_uLong nPos) const
void SetDefaultImages(const Control *pControlForSettings)
Definition: svlbitm.cxx:132
double mnWidth
tools::Long AdjustWidth(tools::Long n)
Definition: image.hxx:39
VCL_DLLPRIVATE void CheckBoxInserted(SvTreeListEntry *pEntry)
bool IsMod1() const
Definition: keycod.hxx:58
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
Definition: vclptr.hxx:127
void InvalidateEntry(SvTreeListEntry *)
SvButtonState GetCheckButtonState(SvTreeListEntry *) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:892
tools::Long Height() 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:1021
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
VCL_DLLPRIVATE SvLBoxItem * GetItem_Impl(SvTreeListEntry *, tools::Long nX, SvLBoxTab **ppTab)
const Point & GetPosPixel() const
Definition: event.hxx:120
const Point & GetOrigin() const
Definition: mapmod.cxx:170
tools::Long nPos
void FillEntryPath(SvTreeListEntry *pEntry,::std::deque< sal_Int32 > &_rPath) const
void EditEntry(SvTreeListEntry *pEntry)
tools::Long AdjustHeight(tools::Long n)
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
Definition: transfer2.cxx:298
VCL_DLLPRIVATE void DrawCustomEntry(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect, const SvTreeListEntry &rEntry)
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void setHeight(tools::Long nHeight)
bool EditingCanceled() const
Definition: treelistbox.cxx:83
WinBits const WB_HASBUTTONS
#define SELECTION_MAX
bool IsEnabled() const
Definition: window2.cxx:1122
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
#define SAL_WARN(area, stream)
virtual void ModelHasRemoved(SvTreeListEntry *pEntry) override
Link< svtree_render_args, void > aCustomRenderHdl
const Image & GetDefaultCollapsedEntryBmp() const
WinBits GetStyle() const
Definition: window2.cxx:953
Definition: timer.hxx:26
tools::Long GetPos() const
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
VCL_DLLPRIVATE void PaintEntry1(SvTreeListEntry &, tools::Long nLine, vcl::RenderContext &rRenderContext)
virtual void ModelHasCleared()
Definition: treelist.cxx:1103
void EditText(const OUString &, const tools::Rectangle &, const Selection &)
virtual vcl::StringEntryIdentifier CurrentEntry(OUString &_out_entryText) const override
returns the current entry in the list of searchable strings.
void dispose()
SvLBoxTabFlags
Definition: treelistbox.hxx:63
virtual void Command(const CommandEvent &rCEvt)
Definition: window.cxx:1919
sal_Int8 mnAction
Definition: transfer.hxx:91
SvTreeFlags nTreeFlags
vcl::Font GetPointFont(vcl::RenderContext const &rRenderContext) const
Definition: window.cxx:2176
TriState
virtual void MouseMove(const MouseEvent &rMEvt) override
tools::Long CalcOffset(tools::Long nItemLength, tools::Long nTabWidth)
bool HasFocus() const
Definition: window.cxx:2959
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)
virtual void RequestHelp(const HelpEvent &rHEvt)
Definition: window.cxx:1865
void ScrollToAbsPos(tools::Long nPos)
static tools::Long GetBorderSize()
void SetupDragOrigin()
This sets the global variables used to determine the in-process drag source.
WinBits const WB_CLIPCHILDREN
void SetCollapsedNodeBmp(const Image &)
sal_Int32 nState
DrawImageFlags
Definition: outdev.hxx:170
aStr
void SetStateChecked()
Definition: svlbitm.hxx:206
static void RemoveAccel(Accelerator const *pAccel)
Remove accelerator.
Definition: svapp.cxx:1328
tools::Long Right() const
void SetDefaultExpandedEntryBmp(const Image &rBmp)
void SetQuickSearch(bool bEnable)
Link< SvTreeListBox *, void > aScrolledHdl
SvTreeListEntry * pParent
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
std::unique_ptr< SvInplaceEdit2 > pEdCtrl
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:30
TriState NotifyCopying(SvTreeListEntry *pTarget, const SvTreeListEntry *pEntry, SvTreeListEntry *&rpNewParent, sal_uLong &rNewChildPos)
sal_uInt16 nPos
const Color & GetFillColor() const
Definition: outdev.hxx:634
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 AddTab(tools::Long nPos, SvLBoxTabFlags nFlags)