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