LibreOffice Module vcl (master)  1
imivctl1.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 #include <limits.h>
22 #include <osl/diagnose.h>
23 #include <tools/debug.hxx>
24 #include <vcl/wall.hxx>
25 #include <vcl/help.hxx>
26 #include <vcl/decoview.hxx>
27 #include <vcl/svapp.hxx>
28 #include <tools/poly.hxx>
29 #include <vcl/lineinfo.hxx>
30 #include <vcl/i18nhelp.hxx>
31 #include <vcl/mnemonic.hxx>
32 #include <vcl/settings.hxx>
33 #include <vcl/commandevent.hxx>
34 
35 #include <vcl/ivctrl.hxx>
36 #include "imivctl.hxx"
37 
38 #include <algorithm>
39 #include <memory>
40 #include <vcl/idle.hxx>
41 
42 static constexpr auto DRAWTEXT_FLAGS_ICON =
45 
46 #define DRAWTEXT_FLAGS_SMALLICON (DrawTextFlags::Left|DrawTextFlags::EndEllipsis|DrawTextFlags::Clip)
47 
48 #define EVENTID_SHOW_CURSOR (reinterpret_cast<void*>(1))
49 #define EVENTID_ADJUST_SCROLLBARS (reinterpret_cast<void*>(2))
50 
52  SvtIconChoiceCtrl* pCurView,
53  WinBits nWinStyle
54 ) :
55  bChooseWithCursor(false),
56  aVerSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_VSCROLL) ),
57  aHorSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_HSCROLL) ),
58  aScrBarBox( VclPtr<ScrollBarBox>::Create(pCurView) ),
59  aAutoArrangeIdle ( "svtools contnr SvxIconChoiceCtrl_Impl AutoArrange" ),
60  aDocRectChangedIdle ( "svtools contnr SvxIconChoiceCtrl_Impl DocRectChanged" ),
61  aVisRectChangedIdle ( "svtools contnr SvxIconChoiceCtrl_Impl VisRectChanged" ),
62  aCallSelectHdlIdle ( "svtools contnr SvxIconChoiceCtrl_Impl CallSelectHdl" ),
63  aImageSize( 32 * pCurView->GetDPIScaleFactor(), 32 * pCurView->GetDPIScaleFactor()),
64  pView(pCurView), nMaxVirtWidth(DEFAULT_MAX_VIRT_WIDTH), nMaxVirtHeight(DEFAULT_MAX_VIRT_HEIGHT),
65  nFlags(IconChoiceFlags::NONE), nUserEventAdjustScrBars(nullptr),
66  pCurHighlightFrame(nullptr), bHighlightFramePressed(false), pHead(nullptr), pCursor(nullptr),
67  pHdlEntry(nullptr),
68  pAnchor(nullptr), eTextMode(SvxIconChoiceCtrlTextMode::Short),
69  eSelectionMode(SelectionMode::Multiple), ePositionMode(SvxIconChoiceCtrlPositionMode::Free),
70  bUpdateMode(true)
71 {
72  SetStyle( nWinStyle );
73  pImpCursor.reset( new IcnCursor_Impl( this ) );
74  pGridMap.reset( new IcnGridMap_Impl( this ) );
75 
76  aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) );
77  aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) );
78 
81 
84  aAutoArrangeIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aAutoArrangeIdle" );
85 
88  aCallSelectHdlIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aCallSelectHdlIdle" );
89 
92  aDocRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aDocRectChangedIdle" );
93 
96  aVisRectChangedIdle.SetDebugName( "svtools::SvxIconChoiceCtrl_Impl aVisRectChangedIdle" );
97 
98  Clear( true );
99  Size gridSize(100,70);
100  if(pView->GetDPIScaleFactor() > 1)
101  {
102  gridSize.setHeight( gridSize.Height() * ( pView->GetDPIScaleFactor()) );
103  }
104  SetGrid(gridSize);
105 }
106 
108 {
109  Clear(false);
111  pImpCursor.reset();
112  pGridMap.reset();
114  m_pColumns.reset();
118 }
119 
120 void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor )
121 {
122  nSelectionCount = 0;
123  pCurHighlightFrame = nullptr;
125  ShowCursor( false );
126  bBoundRectsDirty = false;
127  nMaxBoundHeight = 0;
128 
129  pCursor = nullptr;
130  if( !bInCtor )
131  {
132  pImpCursor->Clear();
133  pGridMap->Clear();
136  Size aSize( pView->GetOutputSizePixel() );
137  nMaxVirtWidth = aSize.Width() - nVerSBarWidth;
138  if( nMaxVirtWidth <= 0 )
139  nMaxVirtWidth = DEFAULT_MAX_VIRT_WIDTH;
140  nMaxVirtHeight = aSize.Height() - nHorSBarHeight;
141  if( nMaxVirtHeight <= 0 )
143  maZOrderList.clear();
144  SetOrigin( Point() );
145  if( bUpdateMode )
147  }
149  maEntries.clear();
150  DocRectChanged();
151  VisRectChanged();
152 }
153 
155 {
156  nWinBits = nWinStyle;
158  if( nWinBits & (WB_SMALLICON | WB_DETAILS) )
160  if( nWinBits & WB_NOSELECTION )
162  if( !(nWinStyle & (WB_ALIGN_TOP | WB_ALIGN_LEFT)))
164  if( nWinStyle & WB_DETAILS )
165  {
166  if (!m_pColumns)
168  }
169 }
170 
171 IMPL_LINK( SvxIconChoiceCtrl_Impl, ScrollUpDownHdl, ScrollBar*, pScrollBar, void )
172 {
173  // arrow up: delta=-1; arrow down: delta=+1
174  Scroll( 0, pScrollBar->GetDelta() );
175 }
176 
177 IMPL_LINK( SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl, ScrollBar*, pScrollBar, void )
178 {
179  // arrow left: delta=-1; arrow right: delta=+1
180  Scroll( pScrollBar->GetDelta(), 0 );
181 }
182 
184 {
186  ShowCursor( false );
187  ShowCursor( true );
188 }
189 
190 void SvxIconChoiceCtrl_Impl::InsertEntry( std::unique_ptr<SvxIconChoiceCtrlEntry> pEntry1, size_t nPos)
191 {
192  auto pEntry = pEntry1.get();
193 
194  if ( nPos < maEntries.size() ) {
195  maEntries.insert( maEntries.begin() + nPos, std::move(pEntry1) );
196  } else {
197  maEntries.push_back( std::move(pEntry1) );
198  }
199 
200  if( pHead )
201  pEntry->SetBacklink( pHead->pblink );
202 
203  if( (nFlags & IconChoiceFlags::EntryListPosValid) && nPos >= maEntries.size() - 1 )
204  pEntry->nPos = maEntries.size() - 1;
205  else
207 
208  maZOrderList.push_back( pEntry );
209  pImpCursor->Clear();
210 
211  // If the UpdateMode is true, don't set all bounding rectangles to
212  // 'to be checked', but only the bounding rectangle of the new entry.
213  // Thus, don't call InvalidateBoundingRect!
214  pEntry->aRect.SetRight( LONG_MAX );
215  if( bUpdateMode )
216  {
217  FindBoundingRect( pEntry );
218  tools::Rectangle aOutputArea( GetOutputRect() );
219  pGridMap->OccupyGrids( pEntry );
220  if( !aOutputArea.IsOver( pEntry->aRect ) )
221  return; // is invisible
222  pView->Invalidate( pEntry->aRect );
223  }
224  else
225  InvalidateBoundingRect( pEntry->aRect );
226 }
227 
229 {
230  pImpCursor->Clear();
231  maEntries.erase(maEntries.begin() + nPos);
233 }
234 
236 {
237  std::unique_ptr< MnemonicGenerator > pAutoDeleteOwnGenerator;
238  if ( !_pGenerator )
239  {
240  _pGenerator = new MnemonicGenerator;
241  pAutoDeleteOwnGenerator.reset( _pGenerator );
242  }
243 
244  sal_uLong nEntryCount = GetEntryCount();
245  sal_uLong i;
246 
247  // insert texts in generator
248  for( i = 0; i < nEntryCount; ++i )
249  {
250  DBG_ASSERT( GetEntry( i ), "-SvxIconChoiceCtrl_Impl::CreateAutoMnemonics(): more expected than provided!" );
251 
252  _pGenerator->RegisterMnemonic( GetEntry( i )->GetText() );
253  }
254 
255  // exchange texts with generated mnemonics
256  for( i = 0; i < nEntryCount; ++i )
257  {
258  SvxIconChoiceCtrlEntry* pEntry = GetEntry( i );
259  OUString aTxt = pEntry->GetText();
260 
261  OUString aNewText = _pGenerator->CreateMnemonic( aTxt );
262  if( aNewText != aTxt )
263  pEntry->SetText( aNewText );
264  }
265 }
266 
268 {
269  Point aOrigin( pView->GetMapMode().GetOrigin() );
270  aOrigin *= -1;
271  return tools::Rectangle( aOrigin, aOutputSize );
272 }
273 
275 {
277  return;
278 
279  size_t nCount = maEntries.size();
280  for( size_t nCur = 0; nCur < nCount; nCur++ )
281  {
282  maEntries[ nCur ]->nPos = nCur;
283  }
285 }
286 
288  bool bAdd )
289 {
291  return;
292 
293  if( !bAdd )
294  {
296  {
298  DeselectAllBut( pEntry );
300  }
301  }
302  if( pEntry->IsSelected() == bSelect )
303  return;
304 
305  pHdlEntry = pEntry;
306  SvxIconViewFlags nEntryFlags = pEntry->GetFlags();
307  if( bSelect )
308  {
309  nEntryFlags |= SvxIconViewFlags::SELECTED;
310  pEntry->AssignFlags( nEntryFlags );
311  nSelectionCount++;
313  }
314  else
315  {
316  nEntryFlags &= ~SvxIconViewFlags::SELECTED;
317  pEntry->AssignFlags( nEntryFlags );
318  nSelectionCount--;
320  }
321  EntrySelected( pEntry, bSelect );
322 }
323 
325 {
326  // When using SingleSelection, make sure that the cursor is always placed
327  // over the (only) selected entry. (But only if a cursor exists.)
328  if (bSelect && pCursor &&
330  pEntry != pCursor)
331  {
332  SetCursor(pEntry);
333  }
334 
335  // Not when dragging though, else the loop in SelectRect doesn't work
336  // correctly!
338  ToTop(pEntry);
339  if (bUpdateMode)
340  {
341  if (pEntry == pCursor)
342  ShowCursor(false);
343  pView->Invalidate(CalcFocusRect(pEntry));
344  if (pEntry == pCursor)
345  ShowCursor(true);
346  }
347 
348  // #i101012# emit vcl event LISTBOX_SELECT only in case that the given entry is selected.
349  if (bSelect)
350  {
352  }
353 }
354 
356 {
359  const size_t nCount = maEntries.size();
360  for( size_t nCur = 0; nCur < nCount; nCur++ )
361  {
362  SvxIconChoiceCtrlEntry* pCur = maEntries[ nCur ].get();
364  if( pCur->IsPosLocked() )
365  {
366  // adapt (among others) VirtSize
367  if( !IsBoundingRectValid( pCur->aRect ) )
368  FindBoundingRect( pCur );
369  else
370  AdjustVirtSize( pCur->aRect );
371  }
372  else
373  InvalidateBoundingRect( pCur->aRect );
374  }
375 
376  if( !(nWinBits & (WB_NOVSCROLL | WB_NOHSCROLL)) )
377  {
378  Size aRealOutputSize( pView->GetOutputSizePixel() );
379  if( aVirtOutputSize.Width() < aRealOutputSize.Width() ||
380  aVirtOutputSize.Height() < aRealOutputSize.Height() )
381  {
383  aRealOutputSize, static_cast<sal_uInt16>(nGridDX), static_cast<sal_uInt16>(nGridDY) );
384  if( nGridCount < nCount )
385  {
386  if( nWinBits & WB_ALIGN_TOP )
387  nMaxVirtWidth = aRealOutputSize.Width() - nVerSBarWidth;
388  else // WB_ALIGN_LEFT
389  nMaxVirtHeight = aRealOutputSize.Height() - nHorSBarHeight;
390  }
391  }
392  }
393 
394  pImpCursor->Clear();
395  pGridMap->Clear();
396  VisRectChanged();
397 }
398 
400 {
401  long nHeightOffs = 0;
402  long nWidthOffs = 0;
403 
404  if( aVirtOutputSize.Width() < (rRect.Right()+LROFFS_WINBORDER) )
405  nWidthOffs = (rRect.Right()+LROFFS_WINBORDER) - aVirtOutputSize.Width();
406 
407  if( aVirtOutputSize.Height() < (rRect.Bottom()+TBOFFS_WINBORDER) )
408  nHeightOffs = (rRect.Bottom()+TBOFFS_WINBORDER) - aVirtOutputSize.Height();
409 
410  if( !(nWidthOffs || nHeightOffs) )
411  return;
412 
413  Range aRange;
414  aVirtOutputSize.AdjustWidth(nWidthOffs );
415  aRange.Max() = aVirtOutputSize.Width();
416  aHorSBar->SetRange( aRange );
417 
418  aVirtOutputSize.AdjustHeight(nHeightOffs );
419  aRange.Max() = aVirtOutputSize.Height();
420  aVerSBar->SetRange( aRange );
421 
422  pImpCursor->Clear();
423  pGridMap->OutputSizeChanged();
425  DocRectChanged();
426 }
427 
429 {
430  DBG_ASSERT(!pHead,"SvxIconChoiceCtrl_Impl::InitPredecessors() >> Already initialized");
431  size_t nCount = maEntries.size();
432  if( nCount )
433  {
434  SvxIconChoiceCtrlEntry* pPrev = maEntries[ 0 ].get();
435  for( size_t nCur = 1; nCur <= nCount; nCur++ )
436  {
438 
439  SvxIconChoiceCtrlEntry* pNext;
440  if( nCur == nCount )
441  pNext = maEntries[ 0 ].get();
442  else
443  pNext = maEntries[ nCur ].get();
444  pPrev->pflink = pNext;
445  pNext->pblink = pPrev;
446  pPrev = pNext;
447  }
448  pHead = maEntries[ 0 ].get();
449  }
450  else
451  pHead = nullptr;
452 }
453 
455 {
456  if( pHead )
457  {
458  size_t nCount = maEntries.size();
459  for( size_t nCur = 0; nCur < nCount; nCur++ )
460  {
461  SvxIconChoiceCtrlEntry* pCur = maEntries[ nCur ].get();
462  pCur->pflink = nullptr;
463  pCur->pblink = nullptr;
464  }
465  pHead = nullptr;
466  }
467 }
468 
469 void SvxIconChoiceCtrl_Impl::Arrange( bool bKeepPredecessors, long nSetMaxVirtWidth, long nSetMaxVirtHeight )
470 {
471  if ( nSetMaxVirtWidth != 0 )
472  nMaxVirtWidth = nSetMaxVirtWidth;
473  else
475 
476  if ( nSetMaxVirtHeight != 0 )
477  nMaxVirtHeight = nSetMaxVirtHeight;
478  else
480 
481  ImpArrange( bKeepPredecessors );
482 }
483 
484 void SvxIconChoiceCtrl_Impl::ImpArrange( bool bKeepPredecessors )
485 {
486  static Point aEmptyPoint;
487 
488  bool bOldUpdate = bUpdateMode;
489  tools::Rectangle aCurOutputArea( GetOutputRect() );
490  if( (nWinBits & WB_SMART_ARRANGE) && aCurOutputArea.TopLeft() != aEmptyPoint )
491  bUpdateMode = false;
494  ShowCursor( false );
495  ResetVirtSize();
496  if( !bKeepPredecessors )
498  bBoundRectsDirty = false;
499  SetOrigin( Point() );
500  VisRectChanged();
502  // TODO: the invalidation in the detail view should be more intelligent
503  //if( !(nWinBits & WB_DETAILS ))
506  if( (nWinBits & WB_SMART_ARRANGE) && aCurOutputArea.TopLeft() != aEmptyPoint )
507  {
508  MakeVisible( aCurOutputArea );
509  SetUpdateMode( bOldUpdate );
510  }
511  ShowCursor( true );
512 }
513 
515 {
516 #if defined(OV_DRAWGRID)
517  Color aOldColor (rRenderContext.GetLineColor());
518  Color aCOL_BLACK);
519  rRenderContext.SetLineColor( aColor );
520  Point aOffs(rRenderContext.GetMapMode().GetOrigin());
521  Size aXSize(GetOutputSizePixel());
522  {
523  Point aStart(LROFFS_WINBORDER, 0);
524  Point aEnd(LROFFS_WINBORDER, aXSize.Height());
525  aStart -= aOffs;
526  aEnd -= aOffs;
527  rRenderContext.DrawLine(aStart, aEnd);
528  }
529  {
530  Point aStart(0, TBOFFS_WINBORDER);
531  Point aEnd(aXSize.Width(), TBOFFS_WINBORDER);
532  aStart -= aOffs;
533  aEnd -= aOffs;
534  rRenderContext.DrawLine(aStart, aEnd);
535  }
536 
537  for (long nDX = nGridDX; nDX <= aXSize.Width(); nDX += nGridDX)
538  {
539  Point aStart( nDX+LROFFS_WINBORDER, 0 );
540  Point aEnd( nDX+LROFFS_WINBORDER, aXSize.Height());
541  aStart -= aOffs;
542  aEnd -= aOffs;
543  rRenderContext.DrawLine(aStart, aEnd);
544  }
545  for (long nDY = nGridDY; nDY <= aXSize.Height(); nDY += nGridDY)
546  {
547  Point aStart(0, nDY + TBOFFS_WINBORDER);
548  Point aEnd(aXSize.Width(), nDY + TBOFFS_WINBORDER);
549  aStart -= aOffs;
550  aEnd -= aOffs;
551  rRenderContext.DrawLine(aStart, aEnd);
552  }
553  rRenderContext.SetLineColor(aOldColor);
554 #endif
555 
556  if (!maEntries.size())
557  return;
558  if (!pCursor)
559  {
560  // set cursor to item with focus-flag
561  bool bfound = false;
562  for (sal_Int32 i = 0; i < pView->GetEntryCount() && !bfound; i++)
563  {
565  if (pEntry->IsFocused())
566  {
567  pCursor = pEntry;
568  bfound = true;
569  }
570  }
571 
572  if (!bfound)
573  pCursor = maEntries[ 0 ].get();
574  }
575 
576  size_t nCount = maZOrderList.size();
577  if (!nCount)
578  return;
579 
580  rRenderContext.Push(PushFlags::CLIPREGION);
581  rRenderContext.SetClipRegion(vcl::Region(rRect));
582 
583  std::vector< SvxIconChoiceCtrlEntry* > aNewZOrderList;
584  std::vector< SvxIconChoiceCtrlEntry* > aPaintedEntries;
585 
586  size_t nPos = 0;
587  while(nCount)
588  {
589  SvxIconChoiceCtrlEntry* pEntry = maZOrderList[nPos];
590  const tools::Rectangle& rBoundRect = GetEntryBoundRect(pEntry);
591  if (rRect.IsOver(rBoundRect))
592  {
593  PaintEntry(pEntry, rBoundRect.TopLeft(), rRenderContext);
594  // set entries to Top if they are being repainted
595  aPaintedEntries.push_back(pEntry);
596  }
597  else
598  aNewZOrderList.push_back(pEntry);
599 
600  nCount--;
601  nPos++;
602  }
603  maZOrderList = std::move( aNewZOrderList );
604  maZOrderList.insert(maZOrderList.end(), aPaintedEntries.begin(), aPaintedEntries.end());
605 
606  rRenderContext.Pop();
607 }
608 
610 {
611  const size_t nCount = maZOrderList.size();
612  if (!nCount)
613  return;
614 
615  tools::Rectangle aOutRect(GetOutputRect());
616  for (size_t nCur = 0; nCur < nCount; nCur++)
617  {
618  SvxIconChoiceCtrlEntry* pEntry = maZOrderList[nCur];
619  if (pEntry->GetFlags() & SvxIconViewFlags::SELECTED)
620  {
621  const tools::Rectangle& rBoundRect = GetEntryBoundRect(pEntry);
622  if (aOutRect.IsOver(rBoundRect))
623  pView->Invalidate(rBoundRect);
624  }
625  }
626 }
627 
629 {
631  Size aSize( pView->GetOutputSizePixel() );
632  aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1));
633 }
634 
636 {
637  bool bHandled = true;
638  bHighlightFramePressed = false;
639  bool bGotFocus = (!pView->HasFocus() && !(nWinBits & WB_NOPOINTERFOCUS));
640  if( !(nWinBits & WB_NOPOINTERFOCUS) )
641  pView->GrabFocus();
642 
643  Point aDocPos( rMEvt.GetPosPixel() );
644  if(aDocPos.X()>=aOutputSize.Width() || aDocPos.Y()>=aOutputSize.Height())
645  return false;
646  ToDocPos( aDocPos );
647  SvxIconChoiceCtrlEntry* pEntry = GetEntry( aDocPos, true );
648  if( pEntry )
649  MakeEntryVisible( pEntry, false );
650 
651  if( rMEvt.IsShift() && eSelectionMode != SelectionMode::Single )
652  {
653  if( pEntry )
654  SetCursor_Impl( pCursor, pEntry, rMEvt.IsMod1(), rMEvt.IsShift() );
655  return true;
656  }
657 
658  if( pAnchor && (rMEvt.IsShift() || rMEvt.IsMod1())) // keyboard selection?
659  {
660  DBG_ASSERT(eSelectionMode != SelectionMode::Single,"Invalid selection mode");
661  if( rMEvt.IsMod1() )
663 
664  if( rMEvt.IsShift() )
665  {
667  if( pEntry )
668  aRect.Union( GetEntryBoundRect( pEntry ) );
669  else
670  {
671  tools::Rectangle aTempRect( aDocPos, Size(1,1));
672  aRect.Union( aTempRect );
673  }
674  aCurSelectionRect = aRect;
676  }
677  else if( rMEvt.IsMod1() )
678  {
680  pAnchor = nullptr;
681  aCurSelectionRect.SetPos( aDocPos );
682  }
683 
684  if( !pEntry && !(nWinBits & WB_NODRAGSELECTION))
686  return true;
687  }
688  else
689  {
690  if( !pEntry )
691  {
693  {
694  if( !rMEvt.IsMod1() ) // Ctrl
695  {
696  if( !bGotFocus )
697  {
698  SetNoSelection();
700  }
701  }
702  else
704  aCurSelectionRect.SetPos( aDocPos );
706  }
707  else
708  bHandled = false;
709  return bHandled;
710  }
711  }
712  bool bSelected = pEntry->IsSelected();
713 
714  if( rMEvt.GetClicks() == 2 )
715  {
716  DeselectAllBut( pEntry );
717  SelectEntry( pEntry, true, false );
718  pHdlEntry = pEntry;
719  pView->ClickIcon();
720  }
721  else
722  {
723  // Inplace-Editing ?
724  if( rMEvt.IsMod2() ) // Alt?
725  {
726  }
728  {
729  DeselectAllBut( pEntry );
730  SetCursor( pEntry );
731  }
732  else if( eSelectionMode == SelectionMode::NONE )
733  {
734  if( rMEvt.IsLeft() && (nWinBits & WB_HIGHLIGHTFRAME) )
735  {
736  pCurHighlightFrame = nullptr; // force repaint of frame
737  bHighlightFramePressed = true;
738  SetEntryHighlightFrame( pEntry, true );
739  }
740  }
741  else
742  {
743  if( !rMEvt.GetModifier() && rMEvt.IsLeft() )
744  {
745  if( !bSelected )
746  {
747  DeselectAllBut( pEntry );
748  SetCursor( pEntry );
749  SelectEntry( pEntry, true, false );
750  }
751  else
752  {
753  // deselect only in the Up, if the Move happened via D&D!
755  }
756  }
757  else if( rMEvt.IsMod1() )
759  }
760  }
761  return bHandled;
762 }
763 
765 {
766  bool bHandled = false;
768  {
770  bHandled = true;
771  }
772 
773  Point aDocPos( rMEvt.GetPosPixel() );
774  ToDocPos( aDocPos );
775  SvxIconChoiceCtrlEntry* pDocEntry = GetEntry( aDocPos );
776  if( pDocEntry )
777  {
779  {
780  // Ctrl & MultiSelection
781  ToggleSelection( pDocEntry );
782  SetCursor( pDocEntry );
783  bHandled = true;
784  }
786  {
787  DeselectAllBut( pDocEntry );
788  SetCursor( pDocEntry );
789  SelectEntry( pDocEntry, true, false );
790  bHandled = true;
791  }
792  }
793 
795 
797  {
798  bHandled = true;
800  pCurHighlightFrame = nullptr; // force repaint of frame
801  bHighlightFramePressed = false;
802  SetEntryHighlightFrame( pEntry, true );
803 
805  pView->ClickIcon();
806 
807  // set focus on Icon
808  SvxIconChoiceCtrlEntry* pOldCursor = pCursor;
809  SetCursor_Impl( pOldCursor, pHdlEntry, false, false );
810 
811  pHdlEntry = nullptr;
812  }
813  return bHandled;
814 }
815 
817 {
818  const Point aDocPos( pView->PixelToLogic(rMEvt.GetPosPixel()) );
819 
820  if( pView->IsTracking() )
821  return false;
822  else if( nWinBits & WB_HIGHLIGHTFRAME )
823  {
824  SvxIconChoiceCtrlEntry* pEntry = GetEntry( aDocPos, true );
825  SetEntryHighlightFrame( pEntry, false );
826  }
827  else
828  return false;
829  return true;
830 }
831 
833  SvxIconChoiceCtrlEntry* pNewCursor, bool bMod1, bool bShift )
834 {
835  if( !pNewCursor )
836  return;
837 
838  SvxIconChoiceCtrlEntry* pFilterEntry = nullptr;
839  bool bDeselectAll = false;
841  {
842  if( !bMod1 && !bShift )
843  bDeselectAll = true;
844  else if( bShift && !bMod1 && !pAnchor )
845  {
846  bDeselectAll = true;
847  pFilterEntry = pOldCursor;
848  }
849  }
850  if( bDeselectAll )
851  DeselectAllBut( pFilterEntry );
852  ShowCursor( false );
853  MakeEntryVisible( pNewCursor );
854  SetCursor( pNewCursor );
855  if( bMod1 && !bShift )
856  {
857  if( pAnchor )
858  {
859  AddSelectedRect( pAnchor, pOldCursor );
860  pAnchor = nullptr;
861  }
862  }
863  else if( bShift )
864  {
865  if( !pAnchor )
866  pAnchor = pOldCursor;
867  if ( nWinBits & WB_ALIGN_LEFT )
868  SelectRange( pAnchor, pNewCursor, bool(nFlags & IconChoiceFlags::AddMode) );
869  else
870  SelectRect(pAnchor,pNewCursor, bool(nFlags & IconChoiceFlags::AddMode), &aSelectedRectList);
871  }
872  else
873  {
874  SelectEntry( pCursor, true, false );
877  }
878 }
879 
881 {
882  bool bMod2 = rKEvt.GetKeyCode().IsMod2();
883  sal_Unicode cChar = rKEvt.GetCharCode();
884  sal_uLong nPos = sal_uLong(-1);
885  if ( bMod2 && cChar && IsMnemonicChar( cChar, nPos ) )
886  {
887  // shortcut is clicked
888  SvxIconChoiceCtrlEntry* pNewCursor = GetEntry( nPos );
889  SvxIconChoiceCtrlEntry* pOldCursor = pCursor;
890  if ( pNewCursor != pOldCursor )
891  SetCursor_Impl( pOldCursor, pNewCursor, false, false );
892  return true;
893  }
894 
895  if ( bMod2 )
896  // no actions with <ALT>
897  return false;
898 
899  bool bKeyUsed = true;
900  bool bMod1 = rKEvt.GetKeyCode().IsMod1();
901  bool bShift = rKEvt.GetKeyCode().IsShift();
902 
904  {
905  bShift = false;
906  bMod1 = false;
907  }
908 
909  if( bMod1 )
911 
912  SvxIconChoiceCtrlEntry* pNewCursor;
913  SvxIconChoiceCtrlEntry* pOldCursor = pCursor;
914 
915  sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode();
916  switch( nCode )
917  {
918  case KEY_UP:
919  case KEY_PAGEUP:
920  if( pCursor )
921  {
923  if( nCode == KEY_UP )
924  pNewCursor = pImpCursor->GoUpDown(pCursor,false);
925  else
926  pNewCursor = pImpCursor->GoPageUpDown(pCursor,false);
927  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
928  if( !pNewCursor )
929  {
931  if( aRect.Top())
932  {
933  aRect.AdjustBottom( -(aRect.Top()) );
934  aRect.SetTop( 0 );
935  MakeVisible( aRect );
936  }
937  }
938 
939  if ( bChooseWithCursor && pNewCursor != nullptr )
940  {
941  pHdlEntry = pNewCursor;//GetCurEntry();
943  pView->ClickIcon();
944  pCurHighlightFrame = nullptr;
945  }
946  }
947  break;
948 
949  case KEY_DOWN:
950  case KEY_PAGEDOWN:
951  if( pCursor )
952  {
953  if( nCode == KEY_DOWN )
954  pNewCursor=pImpCursor->GoUpDown( pCursor,true );
955  else
956  pNewCursor=pImpCursor->GoPageUpDown( pCursor,true );
957  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
958 
959  if ( bChooseWithCursor && pNewCursor != nullptr)
960  {
961  pHdlEntry = pNewCursor;//GetCurEntry();
963  pView->ClickIcon();
964  pCurHighlightFrame = nullptr;
965  }
966  }
967  break;
968 
969  case KEY_RIGHT:
970  if( pCursor )
971  {
972  pNewCursor=pImpCursor->GoLeftRight(pCursor,true );
973  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
974  }
975  break;
976 
977  case KEY_LEFT:
978  if( pCursor )
979  {
981  pNewCursor = pImpCursor->GoLeftRight(pCursor,false );
982  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
983  if( !pNewCursor )
984  {
986  if( aRect.Left() )
987  {
988  aRect.AdjustRight( -(aRect.Left()) );
989  aRect.SetLeft( 0 );
990  MakeVisible( aRect );
991  }
992  }
993  }
994  break;
995 
996  case KEY_F2:
997  if( bMod1 || bShift )
998  bKeyUsed = false;
999  break;
1000 
1001  case KEY_F8:
1002  if( rKEvt.GetKeyCode().IsShift() )
1003  {
1006  else
1008  }
1009  else
1010  bKeyUsed = false;
1011  break;
1012 
1013  case KEY_SPACE:
1015  {
1016  if( !bMod1 )
1017  {
1018  //SelectAll( false );
1019  SetNoSelection();
1021 
1022  // click Icon with spacebar
1024  pView->ClickIcon();
1026  pCurHighlightFrame=nullptr;
1027  }
1028  else
1030  }
1031  break;
1032 
1033 #ifdef DBG_UTIL
1034  case KEY_F10:
1035  if( rKEvt.GetKeyCode().IsShift() )
1036  {
1037  if( pCursor )
1039  }
1040  if( rKEvt.GetKeyCode().IsMod1() )
1041  {
1042  if( pCursor )
1044  }
1045  break;
1046 #endif
1047 
1048  case KEY_ADD:
1049  case KEY_DIVIDE :
1050  case KEY_A:
1051  if( bMod1 && (eSelectionMode != SelectionMode::Single))
1052  SelectAll();
1053  else
1054  bKeyUsed = false;
1055  break;
1056 
1057  case KEY_SUBTRACT:
1058  case KEY_COMMA :
1059  if( bMod1 )
1060  SetNoSelection();
1061  else
1062  bKeyUsed = false;
1063  break;
1064 
1065  case KEY_RETURN:
1066  if( !bMod1 )
1067  bKeyUsed = false;
1068  break;
1069 
1070  case KEY_END:
1071  if( pCursor )
1072  {
1073  pNewCursor = maEntries.back().get();
1074  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
1075  }
1076  break;
1077 
1078  case KEY_HOME:
1079  if( pCursor )
1080  {
1081  pNewCursor = maEntries[ 0 ].get();
1082  SetCursor_Impl( pOldCursor, pNewCursor, bMod1, bShift );
1083  }
1084  break;
1085 
1086  default:
1087  bKeyUsed = false;
1088 
1089  }
1090  return bKeyUsed;
1091 }
1092 
1093 // recalculate TopLeft of scrollbars (but not their sizes!)
1094 void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeight )
1095 {
1096  // horizontal scrollbar
1097  Point aPos( 0, nRealHeight );
1098  aPos.AdjustY( -nHorSBarHeight );
1099 
1100  if( aHorSBar->GetPosPixel() != aPos )
1101  aHorSBar->SetPosPixel( aPos );
1102 
1103  // vertical scrollbar
1104  aPos.setX( nRealWidth ); aPos.setY( 0 );
1105  aPos.AdjustX( -nVerSBarWidth );
1106  aPos.AdjustX( 1 );
1107  aPos.AdjustY( -1 );
1108 
1109  if( aVerSBar->GetPosPixel() != aPos )
1110  aVerSBar->SetPosPixel( aPos );
1111 }
1112 
1114 {
1115  long nVirtHeight = aVirtOutputSize.Height();
1116  long nVirtWidth = aVirtOutputSize.Width();
1117 
1118  Size aOSize( pView->Control::GetOutputSizePixel() );
1119  long nRealHeight = aOSize.Height();
1120  long nRealWidth = aOSize.Width();
1121 
1122  PositionScrollBars( nRealWidth, nRealHeight );
1123 
1124  const MapMode& rMapMode = pView->GetMapMode();
1125  Point aOrigin( rMapMode.GetOrigin() );
1126 
1127  long nVisibleWidth;
1128  if( nRealWidth > nVirtWidth )
1129  nVisibleWidth = nVirtWidth + aOrigin.X();
1130  else
1131  nVisibleWidth = nRealWidth;
1132 
1133  long nVisibleHeight;
1134  if( nRealHeight > nVirtHeight )
1135  nVisibleHeight = nVirtHeight + aOrigin.Y();
1136  else
1137  nVisibleHeight = nRealHeight;
1138 
1139  bool bVerSBar = ( nWinBits & WB_VSCROLL ) != 0;
1140  bool bHorSBar = ( nWinBits & WB_HSCROLL ) != 0;
1141  bool bNoVerSBar = ( nWinBits & WB_NOVSCROLL ) != 0;
1142  bool bNoHorSBar = ( nWinBits & WB_NOHSCROLL ) != 0;
1143 
1144  sal_uInt16 nResult = 0;
1145  if( nVirtHeight )
1146  {
1147  // activate vertical scrollbar?
1148  if( !bNoVerSBar && (bVerSBar || ( nVirtHeight > nVisibleHeight)) )
1149  {
1150  nResult = 0x0001;
1151  nRealWidth -= nVerSBarWidth;
1152 
1153  if( nRealWidth > nVirtWidth )
1154  nVisibleWidth = nVirtWidth + aOrigin.X();
1155  else
1156  nVisibleWidth = nRealWidth;
1157  }
1158  // activate horizontal scrollbar?
1159  if( !bNoHorSBar && (bHorSBar || (nVirtWidth > nVisibleWidth)) )
1160  {
1161  nResult |= 0x0002;
1162  nRealHeight -= nHorSBarHeight;
1163 
1164  if( nRealHeight > nVirtHeight )
1165  nVisibleHeight = nVirtHeight + aOrigin.Y();
1166  else
1167  nVisibleHeight = nRealHeight;
1168 
1169  // do we need a vertical scrollbar after all?
1170  if( !(nResult & 0x0001) && // only if not already there
1171  ( !bNoVerSBar && ((nVirtHeight > nVisibleHeight) || bVerSBar)) )
1172  {
1173  nResult = 3; // both turned on
1174  nRealWidth -= nVerSBarWidth;
1175 
1176  if( nRealWidth > nVirtWidth )
1177  nVisibleWidth = nVirtWidth + aOrigin.X();
1178  else
1179  nVisibleWidth = nRealWidth;
1180  }
1181  }
1182  }
1183 
1184  // size vertical scrollbar
1185  long nThumb = aVerSBar->GetThumbPos();
1186  Size aSize( nVerSBarWidth, nRealHeight );
1187  aSize.AdjustHeight(2 );
1188  if( aSize != aVerSBar->GetSizePixel() )
1189  aVerSBar->SetSizePixel( aSize );
1190  aVerSBar->SetVisibleSize( nVisibleHeight );
1191  aVerSBar->SetPageSize( GetScrollBarPageSize( nVisibleHeight ));
1192 
1193  if( nResult & 0x0001 )
1194  {
1195  aVerSBar->SetThumbPos( nThumb );
1196  aVerSBar->Show();
1197  }
1198  else
1199  {
1200  aVerSBar->SetThumbPos( 0 );
1201  aVerSBar->Hide();
1202  }
1203 
1204  // size horizontal scrollbar
1205  nThumb = aHorSBar->GetThumbPos();
1206  aSize.setWidth( nRealWidth );
1207  aSize.setHeight( nHorSBarHeight );
1208  aSize.AdjustWidth( 1 );
1209  if( nResult & 0x0001 ) // vertical scrollbar?
1210  {
1211  aSize.AdjustWidth( 1 );
1212  nRealWidth++;
1213  }
1214  if( aSize != aHorSBar->GetSizePixel() )
1215  aHorSBar->SetSizePixel( aSize );
1216  aHorSBar->SetVisibleSize( nVisibleWidth );
1217  aHorSBar->SetPageSize( GetScrollBarPageSize(nVisibleWidth ));
1218  if( nResult & 0x0002 )
1219  {
1220  aHorSBar->SetThumbPos( nThumb );
1221  aHorSBar->Show();
1222  }
1223  else
1224  {
1225  aHorSBar->SetThumbPos( 0 );
1226  aHorSBar->Hide();
1227  }
1228 
1229  aOutputSize.setWidth( nRealWidth );
1230  if( nResult & 0x0002 ) // horizontal scrollbar ?
1231  nRealHeight++; // because lower border is clipped
1232  aOutputSize.setHeight( nRealHeight );
1233 
1234  if( (nResult & (0x0001|0x0002)) == (0x0001|0x0002) )
1235  aScrBarBox->Show();
1236  else
1237  aScrBarBox->Hide();
1238 }
1239 
1241 {
1242  InitScrollBarBox();
1244  pImpCursor->Clear();
1245  pGridMap->OutputSizeChanged();
1246 
1247  const Size& rSize = pView->Control::GetOutputSizePixel();
1248  PositionScrollBars( rSize.Width(), rSize.Height() );
1249  // The scrollbars are shown/hidden asynchronously, so derived classes can
1250  // do an Arrange during Resize, without the scrollbars suddenly turning
1251  // on and off again.
1252  // If an event is already underway, we don't need to send a new one, at least
1253  // as long as there is only one event type.
1254  if ( ! nUserEventAdjustScrBars )
1258 
1259  VisRectChanged();
1260 }
1261 
1263 {
1264  if( maZOrderList.empty() || !aHorSBar->IsVisible() )
1265  return false;
1266  const MapMode& rMapMode = pView->GetMapMode();
1267  Point aOrigin( rMapMode.GetOrigin() );
1268  if(!( nWinBits & WB_HSCROLL) && !aOrigin.X() )
1269  {
1270  long nWidth = aOutputSize.Width();
1271  const size_t nCount = maZOrderList.size();
1272  long nMostRight = 0;
1273  for( size_t nCur = 0; nCur < nCount; nCur++ )
1274  {
1275  SvxIconChoiceCtrlEntry* pEntry = maZOrderList[ nCur ];
1276  long nRight = GetEntryBoundRect(pEntry).Right();
1277  if( nRight > nWidth )
1278  return false;
1279  if( nRight > nMostRight )
1280  nMostRight = nRight;
1281  }
1282  aHorSBar->Hide();
1284  aVirtOutputSize.setWidth( nMostRight );
1285  aHorSBar->SetThumbPos( 0 );
1286  Range aRange;
1287  aRange.Max() = nMostRight - 1;
1288  aHorSBar->SetRange( aRange );
1289  if( aVerSBar->IsVisible() )
1290  {
1291  Size aSize( aVerSBar->GetSizePixel());
1292  aSize.AdjustHeight(nHorSBarHeight );
1293  aVerSBar->SetSizePixel( aSize );
1294  }
1295  return true;
1296  }
1297  return false;
1298 }
1299 
1301 {
1302  if( maZOrderList.empty() || !aVerSBar->IsVisible() )
1303  return false;
1304  const MapMode& rMapMode = pView->GetMapMode();
1305  Point aOrigin( rMapMode.GetOrigin() );
1306  if(!( nWinBits & WB_VSCROLL) && !aOrigin.Y() )
1307  {
1308  long nDeepest = 0;
1309  long nHeight = aOutputSize.Height();
1310  const size_t nCount = maZOrderList.size();
1311  for( size_t nCur = 0; nCur < nCount; nCur++ )
1312  {
1313  SvxIconChoiceCtrlEntry* pEntry = maZOrderList[ nCur ];
1314  long nBottom = GetEntryBoundRect(pEntry).Bottom();
1315  if( nBottom > nHeight )
1316  return false;
1317  if( nBottom > nDeepest )
1318  nDeepest = nBottom;
1319  }
1320  aVerSBar->Hide();
1322  aVirtOutputSize.setHeight( nDeepest );
1323  aVerSBar->SetThumbPos( 0 );
1324  Range aRange;
1325  aRange.Max() = nDeepest - 1;
1326  aVerSBar->SetRange( aRange );
1327  if( aHorSBar->IsVisible() )
1328  {
1329  Size aSize( aHorSBar->GetSizePixel());
1330  aSize.AdjustWidth(nVerSBarWidth );
1331  aHorSBar->SetSizePixel( aSize );
1332  }
1333  return true;
1334  }
1335  return false;
1336 }
1337 
1338 
1339 // hides scrollbars if they're unnecessary
1341 {
1343  if( CheckHorScrollBar() )
1345  if( aVerSBar->IsVisible() && aHorSBar->IsVisible() )
1346  aScrBarBox->Show();
1347  else
1348  aScrBarBox->Hide();
1349 }
1350 
1351 
1353 {
1355  if( pCursor )
1356  {
1358  ShowCursor( true );
1359  }
1360 }
1361 
1363 {
1364  if( pCursor )
1366  ShowCursor( false );
1367 
1368 // HideFocus ();
1369 // pView->Invalidate ( aFocus.aRect );
1370 
1372 }
1373 
1375 {
1376  if( bUpdate != bUpdateMode )
1377  {
1378  bUpdateMode = bUpdate;
1379  if( bUpdate )
1380  {
1381  AdjustScrollBars();
1382  pImpCursor->Clear();
1383  pGridMap->Clear();
1385  }
1386  }
1387 }
1388 
1389 // priorities of the emphasis: bSelected
1390 void SvxIconChoiceCtrl_Impl::PaintEmphasis(const tools::Rectangle& rTextRect, bool bSelected,
1391  vcl::RenderContext& rRenderContext)
1392 {
1393  Color aOldFillColor(rRenderContext.GetFillColor());
1394 
1395  bool bSolidTextRect = false;
1396 
1397  if (!bSelected)
1398  {
1399  const Color& rFillColor = rRenderContext.GetFont().GetFillColor();
1400  rRenderContext.SetFillColor(rFillColor);
1401  if (rFillColor != COL_TRANSPARENT)
1402  bSolidTextRect = true;
1403  }
1404 
1405  // draw text rectangle
1406  if (bSolidTextRect)
1407  {
1408  rRenderContext.DrawRect(rTextRect);
1409  }
1410 
1411  rRenderContext.SetFillColor(aOldFillColor);
1412 }
1413 
1414 
1416  IcnViewFieldType eItem, SvxIconChoiceCtrlEntry* pEntry, sal_uInt16 nPaintFlags,
1417  vcl::RenderContext& rRenderContext )
1418 {
1419  if (eItem == IcnViewFieldType::Text)
1420  {
1421  OUString aText = SvtIconChoiceCtrl::GetEntryText(pEntry);
1422 
1423  rRenderContext.DrawText(rRect, aText, nCurTextDrawFlags);
1424 
1425  if (pEntry->IsFocused())
1426  {
1427  tools::Rectangle aRect (CalcFocusRect(pEntry));
1428  ShowFocus(aRect);
1429  DrawFocusRect(rRenderContext);
1430  }
1431  }
1432  else
1433  {
1434  Point aPos(rRect.TopLeft());
1435  if (nPaintFlags & PAINTFLAG_HOR_CENTERED)
1436  aPos.AdjustX((rRect.GetWidth() - aImageSize.Width()) / 2 );
1437  if (nPaintFlags & PAINTFLAG_VER_CENTERED)
1438  aPos.AdjustY((rRect.GetHeight() - aImageSize.Height()) / 2 );
1439  SvtIconChoiceCtrl::DrawEntryImage(pEntry, aPos, rRenderContext);
1440  }
1441 }
1442 
1443 void SvxIconChoiceCtrl_Impl::PaintEntry(SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, vcl::RenderContext& rRenderContext)
1444 {
1445  bool bSelected = false;
1446 
1448  bSelected = pEntry->IsSelected();
1449 
1450  rRenderContext.Push(PushFlags::FONT | PushFlags::TEXTCOLOR);
1451 
1452  OUString aEntryText(SvtIconChoiceCtrl::GetEntryText(pEntry));
1453  tools::Rectangle aTextRect(CalcTextRect(pEntry, &rPos, &aEntryText));
1454  tools::Rectangle aBmpRect(CalcBmpRect(pEntry, &rPos));
1455 
1456  bool bShowSelection = (bSelected && (eSelectionMode != SelectionMode::NONE));
1457 
1458  bool bActiveSelection = (0 != (nWinBits & WB_NOHIDESELECTION)) || pView->HasFocus();
1459 
1460  if (bShowSelection)
1461  {
1462  const StyleSettings& rSettings = rRenderContext.GetSettings().GetStyleSettings();
1463  vcl::Font aNewFont(rRenderContext.GetFont());
1464 
1465  // font fill colors that are attributed "hard" need corresponding "hard"
1466  // attributed highlight colors
1467  if ((nWinBits & WB_NOHIDESELECTION) || pView->HasFocus())
1468  aNewFont.SetFillColor(rSettings.GetHighlightColor());
1469  else
1470  aNewFont.SetFillColor(rSettings.GetDeactiveColor());
1471 
1472  Color aWinCol = rSettings.GetWindowTextColor();
1473  if (!bActiveSelection && rSettings.GetFaceColor().IsBright() == aWinCol.IsBright())
1474  aNewFont.SetColor(rSettings.GetWindowTextColor());
1475  else
1476  aNewFont.SetColor(rSettings.GetHighlightTextColor());
1477 
1478  rRenderContext.SetFont(aNewFont);
1479 
1480  rRenderContext.SetFillColor(rRenderContext.GetBackground().GetColor());
1481  rRenderContext.DrawRect(CalcFocusRect(pEntry));
1482  rRenderContext.SetFillColor();
1483  }
1484 
1485  bool bResetClipRegion = false;
1486  if (!rRenderContext.IsClipRegion() && (aVerSBar->IsVisible() || aHorSBar->IsVisible()))
1487  {
1488  tools::Rectangle aOutputArea(GetOutputRect());
1489  if (aOutputArea.IsOver(aTextRect) || aOutputArea.IsOver(aBmpRect))
1490  {
1491  rRenderContext.SetClipRegion(vcl::Region(aOutputArea));
1492  bResetClipRegion = true;
1493  }
1494  }
1495 
1496  bool bLargeIconMode = WB_ICON == ( nWinBits & VIEWMODE_MASK );
1497  sal_uInt16 nBmpPaintFlags = PAINTFLAG_VER_CENTERED;
1498  if (bLargeIconMode)
1499  nBmpPaintFlags |= PAINTFLAG_HOR_CENTERED;
1500  sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED;
1501 
1502  PaintEmphasis(aTextRect, bSelected, rRenderContext);
1503 
1504  if ( bShowSelection )
1506  bActiveSelection ? 1 : 2, false, true, false);
1507 
1508 
1509  PaintItem(aBmpRect, IcnViewFieldType::Image, pEntry, nBmpPaintFlags, rRenderContext);
1510 
1511  PaintItem(aTextRect, IcnViewFieldType::Text, pEntry, nTextPaintFlags, rRenderContext);
1512 
1513  // draw highlight frame
1514  if (pEntry == pCurHighlightFrame)
1515  DrawHighlightFrame(rRenderContext, CalcFocusRect(pEntry));
1516 
1517  rRenderContext.Pop();
1518  if (bResetClipRegion)
1519  rRenderContext.SetClipRegion();
1520 }
1521 
1523 {
1524  ShowCursor( false );
1525  tools::Rectangle aBoundRect( GetEntryBoundRect( pEntry ));
1526  pView->Invalidate( aBoundRect );
1527  ToTop( pEntry );
1528  if( !IsAutoArrange() )
1529  {
1530  bool bAdjustVirtSize = false;
1531  if( rPos != aBoundRect.TopLeft() )
1532  {
1533  Point aGridOffs(
1534  pEntry->aGridRect.TopLeft() - pEntry->aRect.TopLeft() );
1535  pImpCursor->Clear();
1536  pGridMap->Clear();
1537  aBoundRect.SetPos( rPos );
1538  pEntry->aRect = aBoundRect;
1539  pEntry->aGridRect.SetPos( rPos + aGridOffs );
1540  bAdjustVirtSize = true;
1541  }
1542  if( bAdjustVirtSize )
1543  AdjustVirtSize( pEntry->aRect );
1544 
1545  pView->Invalidate( pEntry->aRect );
1546  pGridMap->OccupyGrids( pEntry );
1547  }
1548  else
1549  {
1550  SvxIconChoiceCtrlEntry* pPrev = FindEntryPredecessor( pEntry, rPos );
1551  SetEntryPredecessor( pEntry, pPrev );
1553  }
1554  ShowCursor( true );
1555 }
1556 
1558 {
1559  // block recursive calls via SelectEntry
1561  {
1563  DeselectAllBut( nullptr );
1565  }
1566 }
1567 
1569 {
1571  // search through z-order list from the end
1572  size_t nCount = maZOrderList.size();
1573  while( nCount )
1574  {
1575  nCount--;
1576  SvxIconChoiceCtrlEntry* pEntry = maZOrderList[ nCount ];
1577  if( pEntry->aRect.IsInside( rDocPos ) )
1578  {
1579  if( bHit )
1580  {
1581  tools::Rectangle aRect = CalcBmpRect( pEntry );
1582  aRect.AdjustTop( -3 );
1583  aRect.AdjustBottom(3 );
1584  aRect.AdjustLeft( -3 );
1585  aRect.AdjustRight(3 );
1586  if( aRect.IsInside( rDocPos ) )
1587  return pEntry;
1588  aRect = CalcTextRect( pEntry );
1589  if( aRect.IsInside( rDocPos ) )
1590  return pEntry;
1591  }
1592  else
1593  return pEntry;
1594  }
1595  }
1596  return nullptr;
1597 }
1598 
1600 {
1601  if ( bBound )
1602  {
1603  const tools::Rectangle& rRect = GetEntryBoundRect( pEntry );
1604  MakeVisible( rRect );
1605  }
1606  else
1607  {
1608  tools::Rectangle aRect = CalcBmpRect( pEntry );
1609  aRect.Union( CalcTextRect( pEntry ) );
1610  aRect.AdjustTop(TBOFFS_BOUND );
1611  aRect.AdjustBottom(TBOFFS_BOUND );
1612  aRect.AdjustLeft(LROFFS_BOUND );
1613  aRect.AdjustRight(LROFFS_BOUND );
1614  MakeVisible( aRect );
1615  }
1616 }
1617 
1619 {
1620  if( !IsBoundingRectValid( pEntry->aRect ))
1621  FindBoundingRect( pEntry );
1622  return pEntry->aRect;
1623 }
1624 
1626 {
1627  tools::Rectangle aBound = GetEntryBoundRect( pEntry );
1628  if( pPos )
1629  aBound.SetPos( *pPos );
1630  Point aPos( aBound.TopLeft() );
1631 
1632  switch( nWinBits & VIEWMODE_MASK )
1633  {
1634  case WB_ICON:
1635  {
1636  aPos.AdjustX(( aBound.GetWidth() - aImageSize.Width() ) / 2 );
1637  return tools::Rectangle( aPos, aImageSize );
1638  }
1639 
1640  case WB_SMALLICON:
1641  case WB_DETAILS:
1642  aPos.AdjustY(( aBound.GetHeight() - aImageSize.Height() ) / 2 );
1643  //TODO: determine horizontal distance to bounding rectangle
1644  return tools::Rectangle( aPos, aImageSize );
1645 
1646  default:
1647  OSL_FAIL("IconView: Viewmode not set");
1648  return aBound;
1649  }
1650 }
1651 
1653  const Point* pEntryPos, const OUString* pStr )
1654 {
1655  OUString aEntryText;
1656  if( !pStr )
1657  aEntryText = SvtIconChoiceCtrl::GetEntryText( pEntry );
1658  else
1659  aEntryText = *pStr;
1660 
1661  const tools::Rectangle aMaxTextRect( CalcMaxTextRect( pEntry ) );
1662  tools::Rectangle aBound( GetEntryBoundRect( pEntry ) );
1663  if( pEntryPos )
1664  aBound.SetPos( *pEntryPos );
1665 
1666  tools::Rectangle aTextRect = pView->GetTextRect( aMaxTextRect, aEntryText, nCurTextDrawFlags );
1667 
1668  Size aTextSize( aTextRect.GetSize() );
1669 
1670  Point aPos( aBound.TopLeft() );
1671  long nBoundWidth = aBound.GetWidth();
1672  long nBoundHeight = aBound.GetHeight();
1673 
1674  switch( nWinBits & VIEWMODE_MASK )
1675  {
1676  case WB_ICON:
1677  aPos.AdjustY(aImageSize.Height() );
1678  aPos.AdjustY(VER_DIST_BMP_STRING );
1679  aPos.AdjustX((nBoundWidth - aTextSize.Width()) / 2 );
1680  break;
1681 
1682  case WB_SMALLICON:
1683  case WB_DETAILS:
1684  aPos.AdjustX(aImageSize.Width() );
1685  aPos.AdjustX(HOR_DIST_BMP_STRING );
1686  aPos.AdjustY((nBoundHeight - aTextSize.Height()) / 2 );
1687  break;
1688  }
1689  return tools::Rectangle( aPos, aTextSize );
1690 }
1691 
1692 
1694 {
1695  long nStringWidth = GetItemSize( IcnViewFieldType::Text ).Width();
1696  long nWidth = 0;
1697 
1698  switch( nWinBits & VIEWMODE_MASK )
1699  {
1700  case WB_ICON:
1701  nWidth = std::max( nStringWidth, aImageSize.Width() );
1702  break;
1703 
1704  case WB_SMALLICON:
1705  case WB_DETAILS:
1706  nWidth = aImageSize.Width();
1707  nWidth += HOR_DIST_BMP_STRING;
1708  nWidth += nStringWidth;
1709  break;
1710  }
1711  return nWidth;
1712 }
1713 
1715 {
1716  long nStringHeight = GetItemSize(IcnViewFieldType::Text).Height();
1717  long nHeight = 0;
1718 
1719  switch( nWinBits & VIEWMODE_MASK )
1720  {
1721  case WB_ICON:
1722  nHeight = aImageSize.Height();
1723  nHeight += VER_DIST_BMP_STRING;
1724  nHeight += nStringHeight;
1725  break;
1726 
1727  case WB_SMALLICON:
1728  case WB_DETAILS:
1729  nHeight = std::max( aImageSize.Height(), nStringHeight );
1730  break;
1731  }
1732  if( nHeight > nMaxBoundHeight )
1733  {
1734  const_cast<SvxIconChoiceCtrl_Impl*>(this)->nMaxBoundHeight = nHeight;
1737  }
1738  return nHeight;
1739 }
1740 
1742 {
1743  return Size( CalcBoundingWidth(), CalcBoundingHeight() );
1744 }
1745 
1747 {
1748  nMaxBoundHeight = 0;
1749  maZOrderList.clear();
1750  size_t nCur;
1751  SvxIconChoiceCtrlEntry* pEntry;
1752  const size_t nCount = maEntries.size();
1753 
1754  if( !IsAutoArrange() || !pHead )
1755  {
1756  for( nCur = 0; nCur < nCount; nCur++ )
1757  {
1758  pEntry = maEntries[ nCur ].get();
1759  if( IsBoundingRectValid( pEntry->aRect ))
1760  {
1761  Size aBoundSize( pEntry->aRect.GetSize() );
1762  if( aBoundSize.Height() > nMaxBoundHeight )
1763  nMaxBoundHeight = aBoundSize.Height();
1764  }
1765  else
1766  FindBoundingRect( pEntry );
1767  maZOrderList.push_back( pEntry );
1768  }
1769  }
1770  else
1771  {
1772  nCur = 0;
1773  pEntry = pHead;
1774  while( nCur != nCount )
1775  {
1776  DBG_ASSERT(pEntry->pflink&&pEntry->pblink,"SvxIconChoiceCtrl_Impl::RecalcAllBoundingRect > Bad link(s)");
1777  if( IsBoundingRectValid( pEntry->aRect ))
1778  {
1779  Size aBoundSize( pEntry->aRect.GetSize() );
1780  if( aBoundSize.Height() > nMaxBoundHeight )
1781  nMaxBoundHeight = aBoundSize.Height();
1782  }
1783  else
1784  FindBoundingRect( pEntry );
1785  maZOrderList.push_back( pEntry );
1786  pEntry = pEntry->pflink;
1787  nCur++;
1788  }
1789  }
1790  AdjustScrollBars();
1791 }
1792 
1794 {
1795  DBG_ASSERT(!pEntry->IsPosLocked(),"Locked entry pos in FindBoundingRect");
1796  if( pEntry->IsPosLocked() && IsBoundingRectValid( pEntry->aRect) )
1797  {
1798  AdjustVirtSize( pEntry->aRect );
1799  return;
1800  }
1801  Size aSize( CalcBoundingSize() );
1802  Point aPos(pGridMap->GetGridRect(pGridMap->GetUnoccupiedGrid()).TopLeft());
1803  SetBoundingRect_Impl( pEntry, aPos, aSize );
1804 }
1805 
1807  const Size& /*rBoundingSize*/ )
1808 {
1809  tools::Rectangle aGridRect( rPos, Size(nGridDX, nGridDY) );
1810  pEntry->aGridRect = aGridRect;
1811  Center( pEntry );
1812  AdjustVirtSize( pEntry->aRect );
1813  pGridMap->OccupyGrids( pEntry );
1814 }
1815 
1816 
1818 {
1819  if( pEntry == pCursor )
1820  {
1822  !pCursor->IsSelected() )
1823  SelectEntry( pCursor, true );
1824  return;
1825  }
1826  ShowCursor( false );
1827  SvxIconChoiceCtrlEntry* pOldCursor = pCursor;
1828  pCursor = pEntry;
1829  if( pOldCursor )
1830  {
1831  pOldCursor->ClearFlags( SvxIconViewFlags::FOCUSED );
1833  SelectEntry( pOldCursor, false ); // deselect old cursor
1834  }
1835  if( pCursor )
1836  {
1837  ToTop( pCursor );
1840  SelectEntry( pCursor, true );
1841  ShowCursor( true );
1842  }
1843 }
1844 
1845 
1847 {
1848  if( !pCursor || !bShow || !pView->HasFocus() )
1849  {
1850  pView->HideFocus();
1851  return;
1852  }
1853  tools::Rectangle aRect ( CalcFocusRect( pCursor ) );
1854  /*pView->*/ShowFocus( aRect );
1855 }
1856 
1857 
1859 {
1861 }
1862 
1864 {
1865  tools::Rectangle aDocRect( Point(), aVirtOutputSize );
1866  tools::Rectangle aVisRect( GetOutputRect() );
1867  if( aVisRect.IsInside( aDocRect ))
1868  return false;
1869  Size aDocSize( aDocRect.GetSize() );
1870  Size aVisSize( aVisRect.GetSize() );
1871  bool bHor = aDocSize.Width() > aVisSize.Width();
1872  bool bVer = aDocSize.Height() > aVisSize.Height();
1873 
1874  long nScrollDX = 0, nScrollDY = 0;
1875 
1876  switch( rCmd.GetCommand() )
1877  {
1879  {
1880  pView->EndTracking();
1882  if( bHor )
1883  nScrollFlags |= StartAutoScrollFlags::Horz;
1884  if( bVer )
1885  nScrollFlags |= StartAutoScrollFlags::Vert;
1886  if( nScrollFlags != StartAutoScrollFlags::NONE )
1887  {
1888  pView->StartAutoScroll( nScrollFlags );
1889  return true;
1890  }
1891  }
1892  break;
1893 
1894  case CommandEventId::Wheel:
1895  {
1896  const CommandWheelData* pData = rCmd.GetWheelData();
1897  if( pData && (CommandWheelMode::SCROLL == pData->GetMode()) && !pData->IsHorz() )
1898  {
1899  sal_uLong nScrollLines = pData->GetScrollLines();
1900  if( nScrollLines == COMMAND_WHEEL_PAGESCROLL )
1901  {
1902  nScrollDY = GetScrollBarPageSize( aVisSize.Width() );
1903  if( pData->GetDelta() < 0 )
1904  nScrollDY *= -1;
1905  }
1906  else
1907  {
1908  nScrollDY = pData->GetNotchDelta() * static_cast<long>(nScrollLines);
1909  nScrollDY *= GetScrollBarLineSize();
1910  }
1911  }
1912  }
1913  break;
1914 
1916  {
1917  const CommandScrollData* pData = rCmd.GetAutoScrollData();
1918  if( pData )
1919  {
1920  nScrollDX = pData->GetDeltaX() * GetScrollBarLineSize();
1921  nScrollDY = pData->GetDeltaY() * GetScrollBarLineSize();
1922  }
1923  }
1924  break;
1925 
1926  default: break;
1927  }
1928 
1929  if( nScrollDX || nScrollDY )
1930  {
1931  aVisRect.AdjustTop( -nScrollDY );
1932  aVisRect.AdjustBottom( -nScrollDY );
1933  aVisRect.AdjustLeft( -nScrollDX );
1934  aVisRect.AdjustRight( -nScrollDX );
1935  MakeVisible( aVisRect );
1936  return true;
1937  }
1938  return false;
1939 }
1940 
1941 
1943 {
1944  // scroll mouse event?
1945  if( (rCEvt.GetCommand() == CommandEventId::Wheel) ||
1947  (rCEvt.GetCommand() == CommandEventId::AutoScroll) )
1948  {
1949  if( HandleScrollCommand( rCEvt ) )
1950  return;
1951  }
1952 }
1953 
1955 {
1956  if( maZOrderList.empty() || pEntry == maZOrderList.back())
1957  return;
1958 
1959  auto it = std::find(maZOrderList.begin(), maZOrderList.end(), pEntry);
1960  if (it != maZOrderList.end())
1961  {
1962  maZOrderList.erase( it );
1963  maZOrderList.push_back( pEntry );
1964  }
1965 }
1966 
1968 {
1969  if( rRect.Bottom() >= aVirtOutputSize.Height() )
1970  rRect.SetBottom( aVirtOutputSize.Height() - 1 );
1971  if( rRect.Right() >= aVirtOutputSize.Width() )
1972  rRect.SetRight( aVirtOutputSize.Width() - 1 );
1973  if( rRect.Top() < 0 )
1974  rRect.SetTop( 0 );
1975  if( rRect.Left() < 0 )
1976  rRect.SetLeft( 0 );
1977 }
1978 
1979 // rRect: area of the document (in document coordinates) that we want to make
1980 // visible
1981 // bScrBar == true: rectangle was calculated because of a scrollbar event
1982 
1983 void SvxIconChoiceCtrl_Impl::MakeVisible( const tools::Rectangle& rRect, bool bScrBar )
1984 {
1985  tools::Rectangle aVirtRect( rRect );
1986  ClipAtVirtOutRect( aVirtRect );
1987  Point aOrigin( pView->GetMapMode().GetOrigin() );
1988  // convert to document coordinate
1989  aOrigin *= -1;
1990  tools::Rectangle aOutputArea( GetOutputRect() );
1991  if( aOutputArea.IsInside( aVirtRect ) )
1992  return; // is already visible
1993 
1994  long nDy;
1995  if( aVirtRect.Top() < aOutputArea.Top() )
1996  {
1997  // scroll up (nDy < 0)
1998  nDy = aVirtRect.Top() - aOutputArea.Top();
1999  }
2000  else if( aVirtRect.Bottom() > aOutputArea.Bottom() )
2001  {
2002  // scroll down (nDy > 0)
2003  nDy = aVirtRect.Bottom() - aOutputArea.Bottom();
2004  }
2005  else
2006  nDy = 0;
2007 
2008  long nDx;
2009  if( aVirtRect.Left() < aOutputArea.Left() )
2010  {
2011  // scroll to the left (nDx < 0)
2012  nDx = aVirtRect.Left() - aOutputArea.Left();
2013  }
2014  else if( aVirtRect.Right() > aOutputArea.Right() )
2015  {
2016  // scroll to the right (nDx > 0)
2017  nDx = aVirtRect.Right() - aOutputArea.Right();
2018  }
2019  else
2020  nDx = 0;
2021 
2022  aOrigin.AdjustX(nDx );
2023  aOrigin.AdjustY(nDy );
2024  aOutputArea.SetPos( aOrigin );
2025  if( GetUpdateMode() )
2026  {
2027  HideDDIcon();
2029  ShowCursor( false );
2030  }
2031 
2032  // invert origin for SV (so we can scroll/paint using document coordinates)
2033  aOrigin *= -1;
2034  SetOrigin( aOrigin );
2035 
2036  bool bScrollable = pView->GetBackground().IsScrollable();
2037 
2038  if( bScrollable && GetUpdateMode() )
2039  {
2040  // scroll in reverse direction!
2041  pView->Control::Scroll( -nDx, -nDy, aOutputArea,
2043  }
2044  else
2046 
2047  if( aHorSBar->IsVisible() || aVerSBar->IsVisible() )
2048  {
2049  if( !bScrBar )
2050  {
2051  aOrigin *= -1;
2052  // correct thumbs
2053  if(aHorSBar->IsVisible() && aHorSBar->GetThumbPos() != aOrigin.X())
2054  aHorSBar->SetThumbPos( aOrigin.X() );
2055  if(aVerSBar->IsVisible() && aVerSBar->GetThumbPos() != aOrigin.Y())
2056  aVerSBar->SetThumbPos( aOrigin.Y() );
2057  }
2058  }
2059 
2060  if( GetUpdateMode() )
2061  ShowCursor( true );
2062 
2063  // check if we still need scrollbars
2064  CheckScrollBars();
2065  if( bScrollable && GetUpdateMode() )
2067 
2068  // If the requested area can not be made completely visible, the
2069  // Vis-Rect-Changed handler is called in any case. This case may occur e.g.
2070  // if only few pixels of the lower border are invisible, but a scrollbar has
2071  // a larger line size.
2072  VisRectChanged();
2073 }
2074 
2076 {
2078  return 1;
2079  return nSelectionCount;
2080 }
2081 
2083 {
2084  bool bSel;
2085  bSel = !pEntry->IsSelected();
2086  SelectEntry( pEntry, bSel, true );
2087 }
2088 
2090 {
2092 
2093  // TODO: work through z-order list, if necessary!
2094 
2095  size_t nCount = maEntries.size();
2096  for( size_t nCur = 0; nCur < nCount; nCur++ )
2097  {
2098  SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
2099  if( pEntry != pThisEntryNot && pEntry->IsSelected() )
2100  SelectEntry( pEntry, false, true );
2101  }
2102  pAnchor = nullptr;
2104 }
2105 
2107 {
2108  Size aMinSize( aImageSize );
2109  aMinSize.AdjustWidth(2 * LROFFS_BOUND );
2110  aMinSize.AdjustHeight(TBOFFS_BOUND ); // single offset is enough (FileDlg)
2111  OUString const aStrDummy( "XXX" );
2112  Size aTextSize( pView->GetTextWidth( aStrDummy ), pView->GetTextHeight() );
2113  if( nWinBits & WB_ICON )
2114  {
2115  aMinSize.AdjustHeight(VER_DIST_BMP_STRING );
2116  aMinSize.AdjustHeight(aTextSize.Height() );
2117  }
2118  else
2119  {
2120  aMinSize.AdjustWidth(HOR_DIST_BMP_STRING );
2121  aMinSize.AdjustWidth(aTextSize.Width() );
2122  }
2123  return aMinSize;
2124 }
2125 
2127 {
2128  Size aSize( rSize );
2129  Size aMinSize( GetMinGrid() );
2130  if( aSize.Width() < aMinSize.Width() )
2131  aSize.setWidth( aMinSize.Width() );
2132  if( aSize.Height() < aMinSize.Height() )
2133  aSize.setHeight( aMinSize.Height() );
2134 
2135  nGridDX = aSize.Width();
2136  // HACK: Detail mode is not yet fully implemented, this workaround makes it
2137  // fly with a single column
2138  if( nWinBits & WB_DETAILS )
2139  {
2140  const SvxIconChoiceCtrlColumnInfo* pCol = GetColumn( 0 );
2141  if( pCol )
2142  const_cast<SvxIconChoiceCtrlColumnInfo*>(pCol)->SetWidth( nGridDX );
2143  }
2144  nGridDY = aSize.Height();
2146 }
2147 
2148 // Calculates the maximum size that the text rectangle may use within its
2149 // bounding rectangle. In WB_ICON mode with SvxIconChoiceCtrlTextMode::Full, Bottom is set to
2150 // LONG_MAX.
2151 
2153 {
2154  tools::Rectangle aBoundRect;
2155  // avoid infinite recursion: don't calculate the bounding rectangle here
2156  if( IsBoundingRectValid( pEntry->aRect ) )
2157  aBoundRect = pEntry->aRect;
2158  else
2159  aBoundRect = pEntry->aGridRect;
2160 
2161  tools::Rectangle aBmpRect( const_cast<SvxIconChoiceCtrl_Impl*>(this)->CalcBmpRect(
2162  const_cast<SvxIconChoiceCtrlEntry*>(pEntry) ) );
2163  if( nWinBits & WB_ICON )
2164  {
2165  aBoundRect.SetTop( aBmpRect.Bottom() );
2166  aBoundRect.AdjustTop(VER_DIST_BMP_STRING );
2167  if( aBoundRect.Top() > aBoundRect.Bottom())
2168  aBoundRect.SetTop( aBoundRect.Bottom() );
2169  aBoundRect.AdjustLeft(LROFFS_BOUND );
2170  aBoundRect.AdjustLeft( 1 );
2171  aBoundRect.AdjustRight( -(LROFFS_BOUND) );
2172  aBoundRect.AdjustRight( -1 );
2173  if( aBoundRect.Left() > aBoundRect.Right())
2174  aBoundRect.SetLeft( aBoundRect.Right() );
2175  if( pEntry->GetTextMode() == SvxIconChoiceCtrlTextMode::Full )
2176  aBoundRect.SetBottom( LONG_MAX );
2177  }
2178  else
2179  {
2180  aBoundRect.SetLeft( aBmpRect.Right() );
2181  aBoundRect.AdjustLeft(HOR_DIST_BMP_STRING );
2182  aBoundRect.AdjustRight( -(LROFFS_BOUND) );
2183  if( aBoundRect.Left() > aBoundRect.Right() )
2184  aBoundRect.SetLeft( aBoundRect.Right() );
2185  long nHeight = aBoundRect.GetSize().Height();
2186  nHeight = nHeight - aDefaultTextSize.Height();
2187  nHeight /= 2;
2188  aBoundRect.AdjustTop(nHeight );
2189  aBoundRect.AdjustBottom( -nHeight );
2190  }
2191  return aBoundRect;
2192 }
2193 
2195 {
2196  long nDY = nGridDY;
2197  nDY -= aImageSize.Height();
2198  nDY -= VER_DIST_BMP_STRING;
2199  nDY -= 2 * TBOFFS_BOUND;
2200  if (nDY <= 0)
2201  nDY = 2;
2202 
2203  long nDX = nGridDX;
2204  nDX -= 2 * LROFFS_BOUND;
2205  nDX -= 2;
2206  if (nDX <= 0)
2207  nDX = 2;
2208 
2209  long nHeight = pView->GetTextHeight();
2210  if (nDY < nHeight)
2211  nDY = nHeight;
2212  if(pView->GetDPIScaleFactor() > 1)
2213  {
2214  nDY*=2;
2215  }
2216  aDefaultTextSize = Size(nDX, nDY);
2217 }
2218 
2219 
2221 {
2222  pEntry->aRect = pEntry->aGridRect;
2223  Size aSize( CalcBoundingSize() );
2224  if( nWinBits & WB_ICON )
2225  {
2226  // center horizontally
2227  long nBorder = pEntry->aGridRect.GetWidth() - aSize.Width();
2228  pEntry->aRect.AdjustLeft(nBorder / 2 );
2229  pEntry->aRect.AdjustRight( -(nBorder / 2) );
2230  }
2231  // center vertically
2232  pEntry->aRect.SetBottom( pEntry->aRect.Top() + aSize.Height() );
2233 }
2234 
2235 
2236 // The deltas are the offsets by which the view is moved on the document.
2237 // left, up: offsets < 0
2238 // right, down: offsets > 0
2239 void SvxIconChoiceCtrl_Impl::Scroll( long nDeltaX, long nDeltaY )
2240 {
2241  const MapMode& rMapMode = pView->GetMapMode();
2242  Point aOrigin( rMapMode.GetOrigin() );
2243  // convert to document coordinate
2244  aOrigin *= -1;
2245  aOrigin.AdjustY(nDeltaY );
2246  aOrigin.AdjustX(nDeltaX );
2247  tools::Rectangle aRect( aOrigin, aOutputSize );
2248  MakeVisible( aRect, true/*bScrollBar*/ );
2249 }
2250 
2251 
2253 {
2254  if (eItem == IcnViewFieldType::Text)
2255  return aDefaultTextSize;
2256  return aImageSize; // IcnViewFieldType::Image
2257 }
2258 
2260 {
2261  tools::Rectangle aTextRect( CalcTextRect( pEntry ) );
2262  tools::Rectangle aBoundRect( GetEntryBoundRect( pEntry ) );
2263  return tools::Rectangle(
2264  aBoundRect.Left(), aBoundRect.Top() - 1, aBoundRect.Right() - 1,
2265  aTextRect.Bottom() + 1);
2266 }
2267 
2268 // the hot spot is the inner 50% of the rectangle
2270 {
2271  tools::Rectangle aResult( rRect );
2272  aResult.Justify();
2273  Size aSize( rRect.GetSize() );
2274  long nDelta = aSize.Width() / 4;
2275  aResult.AdjustLeft(nDelta );
2276  aResult.AdjustRight( -nDelta );
2277  nDelta = aSize.Height() / 4;
2278  aResult.AdjustTop(nDelta );
2279  aResult.AdjustBottom( -nDelta );
2280  return aResult;
2281 }
2282 
2284  bool bAdd, std::vector<tools::Rectangle>* pOtherRects )
2285 {
2286  DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr");
2287  tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) );
2288  aRect.Union( GetEntryBoundRect( pEntry2 ) );
2289  SelectRect( aRect, bAdd, pOtherRects );
2290 }
2291 
2293  std::vector<tools::Rectangle>* pOtherRects )
2294 {
2295  aCurSelectionRect = rRect;
2296  if( maZOrderList.empty() )
2297  return;
2298 
2299  // set flag, so ToTop won't be called in Select
2300  bool bAlreadySelectingRect(nFlags & IconChoiceFlags::SelectingRect);
2302 
2305  const size_t nCount = maZOrderList.size();
2306 
2307  tools::Rectangle aRect( rRect );
2308  aRect.Justify();
2309  bool bCalcOverlap = (bAdd && pOtherRects && !pOtherRects->empty());
2310 
2311  bool bResetClipRegion = false;
2312  if( !pView->IsClipRegion() )
2313  {
2314  bResetClipRegion = true;
2316  }
2317 
2318  for( size_t nPos = 0; nPos < nCount; nPos++ )
2319  {
2321 
2322  if( !IsBoundingRectValid( pEntry->aRect ))
2323  FindBoundingRect( pEntry );
2324  tools::Rectangle aBoundRect( GetHotSpot( pEntry->aRect ) );
2325  bool bSelected = pEntry->IsSelected();
2326 
2327  bool bOverlaps;
2328  if( bCalcOverlap )
2329  bOverlaps = IsOver( pOtherRects, aBoundRect );
2330  else
2331  bOverlaps = false;
2332  bool bOver = aRect.IsOver( aBoundRect );
2333 
2334  if( bOver && !bOverlaps )
2335  {
2336  // is inside the new selection rectangle and outside of any old one
2337  // => select
2338  if( !bSelected )
2339  SelectEntry( pEntry, true, true );
2340  }
2341  else if( !bAdd )
2342  {
2343  // is outside of the selection rectangle
2344  // => deselect
2345  if( bSelected )
2346  SelectEntry( pEntry, false, true );
2347  }
2348  else if (bOverlaps)
2349  {
2350  // The entry is inside an old (=>span multiple rectangles with Ctrl)
2351  // selection rectangle.
2352 
2353  // There is still a bug here! The selection status of an entry in a
2354  // previous rectangle has to be restored, if it was touched by the
2355  // current selection rectangle but is not inside it any more.
2356  // For simplicity's sake, let's assume that all entries in the old
2357  // rectangles were correctly selected. It is wrong to just deselect
2358  // the intersection.
2359  // Possible solution: remember a snapshot of the selection before
2360  // spanning the rectangle.
2361  if( aBoundRect.IsOver( rRect))
2362  {
2363  // deselect intersection between old rectangles and current rectangle
2364  if( bSelected )
2365  SelectEntry( pEntry, false, true );
2366  }
2367  else
2368  {
2369  // select entry of an old rectangle
2370  if( !bSelected )
2371  SelectEntry( pEntry, true, true );
2372  }
2373  }
2374  else if( !bOver && bSelected )
2375  {
2376  // this entry is completely outside the rectangle => deselect it
2377  SelectEntry( pEntry, false, true );
2378  }
2379  }
2380 
2381  if( !bAlreadySelectingRect )
2383 
2385  if( bResetClipRegion )
2386  pView->SetClipRegion();
2387 }
2388 
2390  SvxIconChoiceCtrlEntry const * pStart,
2391  SvxIconChoiceCtrlEntry const * pEnd,
2392  bool bAdd )
2393 {
2394  sal_uLong nFront = GetEntryListPos( pStart );
2395  sal_uLong nBack = GetEntryListPos( pEnd );
2396  sal_uLong nFirst = std::min( nFront, nBack );
2397  sal_uLong nLast = std::max( nFront, nBack );
2398  sal_uLong i;
2399  SvxIconChoiceCtrlEntry* pEntry;
2400 
2401  if ( ! bAdd )
2402  {
2403  // deselect everything before the first entry if not in
2404  // adding mode
2405  for ( i=0; i<nFirst; i++ )
2406  {
2407  pEntry = GetEntry( i );
2408  if( pEntry->IsSelected() )
2409  SelectEntry( pEntry, false, true );
2410  }
2411  }
2412 
2413  // select everything between nFirst and nLast
2414  for ( i=nFirst; i<=nLast; i++ )
2415  {
2416  pEntry = GetEntry( i );
2417  if( ! pEntry->IsSelected() )
2418  SelectEntry( pEntry, true, true );
2419  }
2420 
2421  if ( ! bAdd )
2422  {
2423  // deselect everything behind the last entry if not in
2424  // adding mode
2425  sal_uLong nEnd = GetEntryCount();
2426  for ( ; i<nEnd; i++ )
2427  {
2428  pEntry = GetEntry( i );
2429  if( pEntry->IsSelected() )
2430  SelectEntry( pEntry, false, true );
2431  }
2432  }
2433 }
2434 
2435 bool SvxIconChoiceCtrl_Impl::IsOver( std::vector<tools::Rectangle>* pRectList, const tools::Rectangle& rBoundRect )
2436 {
2437  const sal_uInt16 nCount = pRectList->size();
2438  for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
2439  {
2440  tools::Rectangle& rRect = (*pRectList)[ nCur ];
2441  if( rBoundRect.IsOver( rRect ))
2442  return true;
2443  }
2444  return false;
2445 }
2446 
2448  SvxIconChoiceCtrlEntry* pEntry2 )
2449 {
2450  DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr");
2451  tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) );
2452  aRect.Union( GetEntryBoundRect( pEntry2 ) );
2453  AddSelectedRect( aRect );
2454 }
2455 
2457 {
2458  tools::Rectangle newRect = rRect;
2459  newRect.Justify();
2460  aSelectedRectList.push_back( newRect );
2461 }
2462 
2464 {
2465  aSelectedRectList.clear();
2466 }
2467 
2469 {
2470  aAutoArrangeIdle.Stop();
2471  Arrange( IsAutoArrange(), 0, 0 );
2472 }
2473 
2474 IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, VisRectChangedHdl, Timer *, void)
2475 {
2476  aVisRectChangedIdle.Stop();
2477 }
2478 
2479 IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, DocRectChangedHdl, Timer *, void)
2480 {
2481  aDocRectChangedIdle.Stop();
2482 }
2483 
2484 #ifdef DBG_UTIL
2486 {
2487  if( !pEntry )
2488  {
2489  if( eTextMode != eMode )
2490  {
2491  eTextMode = eMode;
2492  Arrange( true, 0, 0 );
2493  }
2494  }
2495  else
2496  {
2497  if( pEntry->eTextMode != eMode )
2498  {
2499  pEntry->eTextMode = eMode;
2500  InvalidateEntry( pEntry );
2501  pView->Invalidate( GetEntryBoundRect( pEntry ) );
2502  AdjustVirtSize( pEntry->aRect );
2503  }
2504  }
2505 }
2506 #endif
2507 
2508 // Draw my own focusrect, because the focusrect of the outputdevice has got the inverted color
2509 // of the background. But what will we see, if the backgroundcolor is gray ? - We will see
2510 // a gray focusrect on a gray background !!!
2511 
2513 {
2514  Color aBkgColor(pView->GetBackground().GetColor());
2515  Color aPenColor;
2516  sal_uInt16 nColor = ( aBkgColor.GetRed() + aBkgColor.GetGreen() + aBkgColor.GetBlue() ) / 3;
2517  if (nColor > 128)
2518  aPenColor = COL_BLACK;
2519  else
2520  aPenColor = COL_WHITE;
2521 
2522  aFocus.aPenColor = aPenColor;
2523  aFocus.aRect = rRect;
2524 }
2525 
2527 {
2528  rRenderContext.SetLineColor(aFocus.aPenColor);
2529  rRenderContext.SetFillColor();
2530  tools::Polygon aPolygon (aFocus.aRect);
2531 
2532  LineInfo aLineInfo(LineStyle::Dash);
2533 
2534  aLineInfo.SetDashLen(1);
2535  aLineInfo.SetDotLen(1);
2536  aLineInfo.SetDistance(1);
2537  aLineInfo.SetDotCount(1);
2538 
2539  rRenderContext.DrawPolyLine(aPolygon, aLineInfo);
2540 }
2541 
2543 {
2544  bool bRet = false;
2546  size_t nEntryCount = GetEntryCount();
2547  for ( size_t i = 0; i < nEntryCount; ++i )
2548  {
2549  if ( rI18nHelper.MatchMnemonic( GetEntry( i )->GetText(), cChar ) )
2550  {
2551  bRet = true;
2552  rPos = i;
2553  break;
2554  }
2555  }
2556 
2557  return bRet;
2558 }
2559 
2560 
2561 IMPL_LINK(SvxIconChoiceCtrl_Impl, UserEventHdl, void*, nId, void )
2562 {
2564  {
2565  nUserEventAdjustScrBars = nullptr;
2566  AdjustScrollBars();
2567  }
2568  else if( nId == EVENTID_SHOW_CURSOR )
2569  {
2570  ShowCursor( true );
2571  }
2572 }
2573 
2575 {
2577  {
2579  nUserEventAdjustScrBars = nullptr;
2580  }
2581 }
2582 
2584 {
2585  if( pEntry == pCursor )
2586  ShowCursor( false );
2587  pView->Invalidate( pEntry->aRect );
2588  Center( pEntry );
2589  pView->Invalidate( pEntry->aRect );
2590  if( pEntry == pCursor )
2591  ShowCursor( true );
2592 }
2593 
2595 {
2596  if( !GetSelectionCount() )
2597  return nullptr;
2598 
2600  {
2601  return pCurHighlightFrame;
2602  }
2603 
2604  size_t nCount = maEntries.size();
2605  if( !pHead )
2606  {
2607  for( size_t nCur = 0; nCur < nCount; nCur++ )
2608  {
2609  SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
2610  if( pEntry->IsSelected() )
2611  {
2612  return pEntry;
2613  }
2614  }
2615  }
2616  else
2617  {
2618  SvxIconChoiceCtrlEntry* pEntry = pHead;
2619  while( nCount-- )
2620  {
2621  if( pEntry->IsSelected() )
2622  {
2623  return pEntry;
2624  }
2625  pEntry = pEntry->pflink;
2626  if( nCount && pEntry == pHead )
2627  {
2628  OSL_FAIL("SvxIconChoiceCtrl_Impl::GetFirstSelectedEntry > infinite loop!");
2629  return nullptr;
2630  }
2631  }
2632  }
2633  return nullptr;
2634 }
2635 
2637 {
2638  size_t nCount = maEntries.size();
2639  for( size_t nCur = 0; nCur < nCount; nCur++ )
2640  {
2641  SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
2642  SelectEntry( pEntry, true/*bSelect*/, true );
2643  }
2645  pAnchor = nullptr;
2646 }
2647 
2648 
2649 
2650 
2652 {
2654  const_cast<SvxIconChoiceCtrl_Impl*>(this)->SetListPositions();
2655  return pEntry->nPos;
2656 }
2657 
2659 {
2660  const StyleSettings& rStyleSettings = pView->GetSettings().GetStyleSettings();
2661 
2662  // unit (from settings) is Point
2663  vcl::Font aFont( rStyleSettings.GetFieldFont() );
2664  aFont.SetColor( rStyleSettings.GetWindowTextColor() );
2665  pView->SetPointFont( aFont );
2667 
2668  pView->SetTextColor( rStyleSettings.GetFieldTextColor() );
2670 
2671  pView->SetBackground( rStyleSettings.GetFieldColor());
2672 
2673  long nScrBarSize = rStyleSettings.GetScrollBarSize();
2674  if( nScrBarSize == nHorSBarHeight && nScrBarSize == nVerSBarWidth )
2675  return;
2676 
2677  nHorSBarHeight = nScrBarSize;
2678  Size aSize( aHorSBar->GetSizePixel() );
2679  aSize.setHeight( nScrBarSize );
2680  aHorSBar->Hide();
2681  aHorSBar->SetSizePixel( aSize );
2682 
2683  nVerSBarWidth = nScrBarSize;
2684  aSize = aVerSBar->GetSizePixel();
2685  aSize.setWidth( nScrBarSize );
2686  aVerSBar->Hide();
2687  aVerSBar->SetSizePixel( aSize );
2688 
2689  Size aOSize( pView->Control::GetOutputSizePixel() );
2690  PositionScrollBars( aOSize.Width(), aOSize.Height() );
2691  AdjustScrollBars();
2692 }
2693 
2695 {
2696  if( eMode == ePositionMode )
2697  return;
2698 
2700  ePositionMode = eMode;
2701  size_t nCount = maEntries.size();
2702 
2704  {
2705  // when positioning moved entries "hard", there are problems with
2706  // unwanted overlaps, as these entries aren't taken into account in
2707  // Arrange.
2708  if( maEntries.size() )
2710  return;
2711  }
2712 
2714  {
2715  for( size_t nCur = 0; nCur < nCount; nCur++ )
2716  {
2717  SvxIconChoiceCtrlEntry* pEntry = maEntries[ nCur ].get();
2719  SetEntryPos(pEntry, GetEntryBoundRect( pEntry ).TopLeft());
2720  }
2721 
2722  if( maEntries.size() )
2724  }
2725 }
2726 
2728  SvxIconChoiceCtrlEntry* pPredecessor )
2729 {
2730  if( !IsAutoArrange() )
2731  return;
2732 
2733  if( pEntry == pPredecessor )
2734  return;
2735 
2736  sal_uLong nPos1 = GetEntryListPos( pEntry );
2737  if( !pHead )
2738  {
2739  if( pPredecessor )
2740  {
2741  sal_uLong nPos2 = GetEntryListPos( pPredecessor );
2742  if( nPos1 == (nPos2 + 1) )
2743  return; // is already the predecessor
2744  }
2745  else if( !nPos1 )
2746  return;
2747 
2748  InitPredecessors();
2749  }
2750 
2751  if( !pPredecessor && pHead == pEntry )
2752  return; // is already the first one
2753 
2754  bool bSetHead = false;
2755  if( !pPredecessor )
2756  {
2757  bSetHead = true;
2758  pPredecessor = pHead->pblink;
2759  }
2760  if( pEntry == pHead )
2761  {
2762  pHead = pHead->pflink;
2763  bSetHead = false;
2764  }
2765  if( pEntry != pPredecessor )
2766  {
2767  pEntry->Unlink();
2768  pEntry->SetBacklink( pPredecessor );
2769  }
2770  if( bSetHead )
2771  pHead = pEntry;
2773 }
2774 
2776  const Point& rPosTopLeft )
2777 {
2778  Point aPos( rPosTopLeft ); //TopLeft
2779  tools::Rectangle aCenterRect( CalcBmpRect( pEntry, &aPos ));
2780  Point aNewPos( aCenterRect.Center() );
2781  sal_uLong nGrid = GetPredecessorGrid( aNewPos );
2782  size_t nCount = maEntries.size();
2783  if( nGrid == ULONG_MAX )
2784  return nullptr;
2785  if( nGrid >= nCount )
2786  nGrid = nCount - 1;
2787  if( !pHead )
2788  return maEntries[ nGrid ].get();
2789 
2790  SvxIconChoiceCtrlEntry* pCur = pHead; // Grid 0
2791  // TODO: go through list from the end if nGrid > nCount/2
2792  for( sal_uLong nCur = 0; nCur < nGrid; nCur++ )
2793  pCur = pCur->pflink;
2794 
2795  return pCur;
2796 }
2797 
2799 {
2800  Point aPos( rPos );
2801  aPos.AdjustX( -(LROFFS_WINBORDER) );
2802  aPos.AdjustY( -(TBOFFS_WINBORDER) );
2803  long nMaxCol = aVirtOutputSize.Width() / nGridDX;
2804  if( nMaxCol )
2805  nMaxCol--;
2806  long nGridX = aPos.X() / nGridDX;
2807  if( nGridX > nMaxCol )
2808  nGridX = nMaxCol;
2809  long nGridY = aPos.Y() / nGridDY;
2810  long nGridsX = aOutputSize.Width() / nGridDX;
2811  sal_uLong nGrid = (nGridY * nGridsX) + nGridX;
2812  long nMiddle = (nGridX * nGridDX) + (nGridDX / 2);
2813  if( rPos.X() < nMiddle )
2814  {
2815  if( !nGrid )
2816  nGrid = ULONG_MAX;
2817  else
2818  nGrid--;
2819  }
2820  return nGrid;
2821 }
2822 
2824 {
2825  if ( !(rHEvt.GetMode() & HelpEventMode::QUICK ) )
2826  return false;
2827 
2828  Point aPos( pView->ScreenToOutputPixel(rHEvt.GetMousePosPixel() ) );
2829  aPos -= pView->GetMapMode().GetOrigin();
2830  SvxIconChoiceCtrlEntry* pEntry = GetEntry( aPos, true );
2831 
2832  if ( !pEntry )
2833  return false;
2834 
2835  OUString sQuickHelpText = pEntry->GetQuickHelpText();
2836  OUString aEntryText( SvtIconChoiceCtrl::GetEntryText( pEntry ) );
2837  tools::Rectangle aTextRect( CalcTextRect( pEntry, nullptr, &aEntryText ) );
2838  if ( ( !aTextRect.IsInside( aPos ) || aEntryText.isEmpty() ) && sQuickHelpText.isEmpty() )
2839  return false;
2840 
2841  tools::Rectangle aOptTextRect( aTextRect );
2842  aOptTextRect.SetBottom( LONG_MAX );
2843  DrawTextFlags nNewFlags = nCurTextDrawFlags;
2845  aOptTextRect = pView->GetTextRect( aOptTextRect, aEntryText, nNewFlags );
2846  if ( aOptTextRect != aTextRect || !sQuickHelpText.isEmpty() )
2847  {
2848  //aTextRect.Right() = aTextRect.Left() + aRealSize.Width() + 4;
2849  Point aPt( aOptTextRect.TopLeft() );
2850  aPt += pView->GetMapMode().GetOrigin();
2851  aPt = pView->OutputToScreenPixel( aPt );
2852  // subtract border of tooltip help
2853  aPt.AdjustY( -1 );
2854  aPt.AdjustX( -3 );
2855  aOptTextRect.SetPos( aPt );
2856  OUString sHelpText;
2857  if ( !sQuickHelpText.isEmpty() )
2858  sHelpText = sQuickHelpText;
2859  else
2860  sHelpText = aEntryText;
2861  Help::ShowQuickHelp( static_cast<vcl::Window*>(pView), aOptTextRect, sHelpText, QuickHelpFlags::Left | QuickHelpFlags::VCenter );
2862  }
2863 
2864  return true;
2865 }
2866 
2868 {
2869  if (!m_pColumns)
2871 
2873  m_pColumns->insert(std::make_pair(nIndex, std::unique_ptr<SvxIconChoiceCtrlColumnInfo>(pInfo)));
2874 
2875  // HACK: Detail mode is not yet fully implemented, this workaround makes it
2876  // fly with a single column
2877  if( !nIndex && (nWinBits & WB_DETAILS) )
2878  nGridDX = pInfo->GetWidth();
2879 
2880  if( GetUpdateMode() )
2881  Arrange( IsAutoArrange(), 0, 0 );
2882 }
2883 
2885 {
2886  if (!m_pColumns)
2887  return nullptr;
2888  auto const it = m_pColumns->find( nIndex );
2889  if (it == m_pColumns->end())
2890  return nullptr;
2891  return it->second.get();
2892 }
2893 
2895 {
2896  tools::Rectangle aBmpRect(rBmpRect);
2897  long nBorder = 2;
2898  if (aImageSize.Width() < 32)
2899  nBorder = 1;
2900  aBmpRect.AdjustRight(nBorder );
2901  aBmpRect.AdjustLeft( -nBorder );
2902  aBmpRect.AdjustBottom(nBorder );
2903  aBmpRect.AdjustTop( -nBorder );
2904 
2905  DecorationView aDecoView(&rRenderContext);
2906  DrawHighlightFrameStyle nDecoFlags;
2908  nDecoFlags = DrawHighlightFrameStyle::In;
2909  else
2910  nDecoFlags = DrawHighlightFrameStyle::Out;
2911  aDecoView.DrawHighlightFrame(aBmpRect, nDecoFlags);
2912 }
2913 
2915  bool bKeepHighlightFlags )
2916 {
2917  if( pEntry == pCurHighlightFrame )
2918  return;
2919 
2920  if( !bKeepHighlightFlags )
2921  bHighlightFramePressed = false;
2922 
2923  if (pCurHighlightFrame)
2924  {
2926  aInvalidationRect.expand(5);
2927  pCurHighlightFrame = nullptr;
2928  pView->Invalidate(aInvalidationRect);
2929  }
2930 
2931  pCurHighlightFrame = pEntry;
2932  if (pEntry)
2933  {
2934  tools::Rectangle aInvalidationRect(GetEntryBoundRect(pEntry));
2935  aInvalidationRect.expand(5);
2936  pView->Invalidate(aInvalidationRect);
2937  }
2938 }
2939 
2941 {
2942  // When single-click mode is active, the selection handler should be called
2943  // synchronously, as the selection is automatically taken away once the
2944  // mouse cursor doesn't touch the object any more. Else, we might run into
2945  // missing calls to Select if the object is selected from a mouse movement,
2946  // because when starting the timer, the mouse cursor might have already left
2947  // the object.
2948  // In special cases (=>SfxFileDialog!), synchronous calls can be forced via
2949  // WB_NOASYNCSELECTHDL.
2951  {
2952  pHdlEntry = nullptr;
2953  pView->ClickIcon();
2954  //pView->Select();
2955  }
2956  else
2958 }
2959 
2960 IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, CallSelectHdlHdl, Timer *, void)
2961 {
2962  pHdlEntry = nullptr;
2963  pView->ClickIcon();
2964  //pView->Select();
2965 }
2966 
2967 void SvxIconChoiceCtrl_Impl::SetOrigin( const Point& rPos )
2968 {
2969  MapMode aMapMode( pView->GetMapMode() );
2970  aMapMode.SetOrigin( rPos );
2971  pView->SetMapMode( aMapMode );
2972 }
2973 
2975 {
2976  pView->CallImplEventListeners( nEvent, pData );
2977 }
2978 
2979 
2980 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetEntryPos(SvxIconChoiceCtrlEntry *pEntry, const Point &rPos)
Definition: imivctl1.cxx:1522
virtual Point GetPosPixel() const
Definition: window.cxx:2860
Point TopLeft() const
void MakeVisible(const tools::Rectangle &rDocPos, bool bInScrollBarEvent=false)
Definition: imivctl1.cxx:1983
long Width() const
void SetEntryTextMode(SvxIconChoiceCtrlTextMode eMode, SvxIconChoiceCtrlEntry *pEntry)
Definition: ivctrl.cxx:243
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
Definition: text.cxx:782
void SetPos(const Point &rPoint)
tools::Rectangle aRect
Definition: imivctl.hxx:97
void DrawHighlightFrame(vcl::RenderContext &rRenderContext, const tools::Rectangle &rBmpRect)
Definition: imivctl1.cxx:2894
void SetFillColor(const Color &)
Definition: font/font.cxx:88
long GetWidth() const
const Wallpaper & GetBackground() const
Definition: outdev.hxx:637
void HideFocus()
Definition: window2.cxx:91
static bool IsOver(std::vector< tools::Rectangle > *pSelectedRectList, const tools::Rectangle &rEntryBoundRect)
Definition: imivctl1.cxx:2435
const Color & GetDeactiveColor() const
long GetHeight() const
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
void ShowFocus(tools::Rectangle const &rRect)
Definition: imivctl1.cxx:2512
SvxIconChoiceCtrl_Impl(const SvxIconChoiceCtrl_Impl &)=delete
std::unique_ptr< IcnGridMap_Impl > pGridMap
Definition: imivctl.hxx:130
void AssignFlags(SvxIconViewFlags _nFlags)
Definition: ivctrl.hxx:90
long AdjustWidth(long n)
StartAutoScrollFlags
Definition: window.hxx:299
void DeselectAllBut(SvxIconChoiceCtrlEntry const *)
Definition: imivctl1.cxx:2089
void FindBoundingRect(SvxIconChoiceCtrlEntry *pEntry)
Definition: imivctl1.cxx:1793
const Color & GetHighlightTextColor() const
std::unique_ptr< ContentProperties > pData
static void DrawSelectionBackground(vcl::RenderContext &rRenderContext, vcl::Window const &rWindow, const tools::Rectangle &rRect, sal_uInt16 nHighlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, Color *pSelectionTextColor=nullptr, long nCornerRadius=0, Color const *pPaintColor=nullptr)
Definition: paint.cxx:321
constexpr sal_uInt16 KEY_COMMA
Definition: keycodes.hxx:132
A thin wrapper around rtl::Reference to implement the acquire and dispose semantics we want for refer...
Definition: button.hxx:32
long Height() const
SvxIconChoiceCtrlEntry * GetEntry(const Point &rDocPos, bool bHit=false)
Definition: imivctl1.cxx:1568
#define WB_SMART_ARRANGE
Definition: ivctrl.hxx:169
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
std::unique_ptr< SvxIconChoiceCtrlColumnInfoMap > m_pColumns
Definition: imivctl.hxx:134
long AdjustLeft(long nHorzMoveDelta)
void DrawFocusRect(vcl::RenderContext &rRenderContext)
Definition: imivctl1.cxx:2526
sal_uIntPtr sal_uLong
void disposeAndClear()
Definition: vclptr.hxx:200
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Gets the application's settings.
Definition: svapp.cxx:715
constexpr sal_uInt16 KEY_A
Definition: keycodes.hxx:56
const Color & GetFaceColor() const
void AddSelectedRect(const tools::Rectangle &)
Definition: imivctl1.cxx:2456
Important idle events to be run before processing drawing events.
static void PaintEmphasis(const tools::Rectangle &rRect1, bool bSelected, vcl::RenderContext &rRenderContext)
Definition: imivctl1.cxx:1390
virtual Size GetSizePixel() const
Definition: window.cxx:2418
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1262
SvxIconChoiceCtrlPositionMode ePositionMode
Definition: imivctl.hxx:152
sal_Int16 nId
void SetBoundingRect_Impl(SvxIconChoiceCtrlEntry *pEntry, const Point &rPos, const Size &rBoundingSize)
Definition: imivctl1.cxx:1806
bool IsShift() const
Definition: event.hxx:155
bool IsOver(const tools::Rectangle &rRect) const
static tools::Rectangle GetHotSpot(const tools::Rectangle &rRect)
Definition: imivctl1.cxx:2269
sal_uLong GetPredecessorGrid(const Point &rDocPos) const
Definition: imivctl1.cxx:2798
ImplSVEvent * nUserEventAdjustScrBars
Definition: imivctl.hxx:139
void DrawPolyLine(const tools::Polygon &rPoly)
Render the given polygon as a line stroke.
Definition: polyline.cxx:33
long GetThumbPos() const
Definition: scrbar.hxx:122
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Post a user event to the default window.
Definition: svapp.cxx:1007
const MapMode & GetMapMode() const
Definition: outdev.hxx:1681
void SetTextFillColor()
Definition: text.cxx:700
sal_uInt16 GetCode() const
Definition: keycod.hxx:53
SelectionMode
Definition: vclenum.hxx:26
#define DEFAULT_MAX_VIRT_HEIGHT
Definition: imivctl.hxx:81
SvxIconChoiceCtrlEntry * pflink
Definition: ivctrl.hxx:82
std::vector< SvxIconChoiceCtrlEntry * > maZOrderList
Definition: imivctl.hxx:133
long GetNotchDelta() const
long GetWidth() const
Definition: ivctrl.hxx:138
void MakeEntryVisible(SvxIconChoiceCtrlEntry *pEntry, bool bBound=true)
Definition: imivctl1.cxx:1599
IcnViewFieldType
Definition: imivctl.hxx:86
WinBits const WB_VSCROLL
OUString CreateMnemonic(const OUString &rKey)
Definition: mnemonic.cxx:116
#define DEFAULT_MAX_VIRT_WIDTH
Definition: imivctl.hxx:80
const CommandWheelData * GetWheelData() const
bool IsSelected() const
Definition: ivctrl.hxx:123
const CommandScrollData * GetAutoScrollData() const
constexpr sal_uInt16 KEY_SPACE
Definition: keycodes.hxx:123
constexpr sal_uInt16 KEY_ADD
Definition: keycodes.hxx:127
void PaintImmediately()
Definition: paint.cxx:1284
long AdjustHeight(long n)
const vcl::I18nHelper & GetUILocaleI18nHelper() const
std::map< sal_uInt16, std::unique_ptr< SvxIconChoiceCtrlColumnInfo > > SvxIconChoiceCtrlColumnInfoMap
Definition: imivctl.hxx:105
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:244
bool MouseMove(const MouseEvent &)
Definition: imivctl1.cxx:816
friend class IcnCursor_Impl
Definition: imivctl.hxx:110
void SetMapMode()
Definition: map.cxx:655
const vcl::Font & GetFieldFont() const
#define WB_NOSELECTION
Definition: ivctrl.hxx:167
HelpEventMode GetMode() const
Definition: event.hxx:205
bool IsHorz() const
const Color & GetFieldTextColor() const
bool IsTracking() const
Definition: window2.cxx:312
bool GetUpdateMode() const
Definition: imivctl.hxx:286
sal_Int32 nSelectionCount
Definition: imivctl.hxx:151
constexpr sal_uInt16 KEY_UP
Definition: keycodes.hxx:111
const Color & GetHighlightColor() const
Size CalcBoundingSize() const
Definition: imivctl1.cxx:1741
#define WB_NOASYNCSELECTHDL
Definition: ivctrl.hxx:174
long AdjustBottom(long nVertMoveDelta)
long GetDeltaY() const
NONE
constexpr sal_uInt16 KEY_END
Definition: keycodes.hxx:115
tools::Rectangle GetOutputRect() const
Definition: imivctl1.cxx:267
bool IsAutoArrange() const
Definition: imivctl.hxx:229
WinBits const WB_NOPOINTERFOCUS
tools::Rectangle GetTextRect(const tools::Rectangle &rRect, const OUString &rStr, DrawTextFlags nStyle=DrawTextFlags::WordBreak, TextRectInfo *pInfo=nullptr, const vcl::ITextLayout *_pTextLayout=nullptr) const
Definition: text.cxx:1797
SvxIconChoiceCtrlEntry * pHdlEntry
Definition: imivctl.hxx:144
void CallEventListeners(VclEventId nEvent, void *pData)
Definition: imivctl1.cxx:2974
sal_uInt16 GetClicks() const
Definition: event.hxx:123
SvxIconChoiceCtrlEntry * pblink
Definition: ivctrl.hxx:81
sal_Int64 WinBits
void CallImplEventListeners(VclEventId nEvent, void *pData)
Definition: ivctrl.cxx:413
tools::Rectangle aRect
Definition: ivctrl.hxx:72
sal_uInt16 sal_Unicode
constexpr::Color COL_TRANSPARENT(0xFF, 0xFF, 0xFF, 0xFF)
long Right() const
VclPtr< ScrollBar > aHorSBar
Definition: imivctl.hxx:116
tools::Rectangle CalcFocusRect(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:2259
const OUString & GetQuickHelpText() const
Definition: ivctrl.hxx:117
bool MouseButtonUp(const MouseEvent &)
Definition: imivctl1.cxx:764
#define HOR_DIST_BMP_STRING
Definition: imivctl.hxx:75
const vcl::Font & GetFont() const
Definition: outdev.hxx:643
void SetEntryTextMode(SvxIconChoiceCtrlTextMode, SvxIconChoiceCtrlEntry *pEntry)
Definition: imivctl1.cxx:2485
void PositionScrollBars(long nRealWidth, long nRealHeight)
Definition: imivctl1.cxx:1094
void SetOrigin(const Point &)
Definition: imivctl1.cxx:2967
WinBits const WB_HSCROLL
void EndTracking(TrackingEventFlags nFlags=TrackingEventFlags::NONE)
Definition: window2.cxx:272
IMPL_LINK_NOARG(SvxIconChoiceCtrl_Impl, AutoArrangeHdl, Timer *, void)
Definition: imivctl1.cxx:2468
DrawTextFlags nCurTextDrawFlags
Definition: imivctl.hxx:138
int nCount
Color aPenColor
Definition: imivctl.hxx:98
void Hide()
Definition: window.hxx:936
SelectionMode eSelectionMode
Definition: imivctl.hxx:150
static bool IsBoundingRectValid(const tools::Rectangle &rRect)
Definition: imivctl.hxx:336
constexpr sal_uInt16 KEY_PAGEUP
Definition: keycodes.hxx:116
tools::Rectangle aCurSelectionRect
Definition: imivctl.hxx:118
constexpr sal_uInt16 KEY_F2
Definition: keycodes.hxx:84
virtual void Start() override
Activates the timer task.
Definition: idle.cxx:34
VclEventId
Definition: vclevent.hxx:39
SvxIconChoiceCtrlEntry * pAnchor
Definition: imivctl.hxx:145
void SetCursor_Impl(SvxIconChoiceCtrlEntry *pOldCursor, SvxIconChoiceCtrlEntry *pNewCursor, bool bMod1, bool bShift)
Definition: imivctl1.cxx:832
size_t GetEntryCount() const
Definition: imivctl.hxx:379
static long GetScrollBarPageSize(long nVisibleRange)
Definition: imivctl.hxx:173
void SetBackground(const Wallpaper &rWallpaper)
Definition: ivctrl.cxx:323
VclPtr< SvtIconChoiceCtrl > pView
Definition: imivctl.hxx:128
long Top() const
WinBits const WB_NOHIDESELECTION
void SetFlags(SvxIconViewFlags nMask)
Definition: ivctrl.hxx:89
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:88
tools::Rectangle CalcMaxTextRect(const SvxIconChoiceCtrlEntry *pEntry) const
Definition: imivctl1.cxx:2152
sal_uInt16 nCode
#define WB_NODRAGSELECTION
Definition: ivctrl.hxx:168
sal_Int32 GetEntryCount() const
Definition: ivctrl.cxx:249
void ImpArrange(bool bKeepPredecessors)
Definition: imivctl1.cxx:484
void AdjustVirtSize(const tools::Rectangle &)
Definition: imivctl1.cxx:399
void DrawHighlightFrame(const tools::Rectangle &rRect, DrawHighlightFrameStyle nStyle)
Definition: decoview.cxx:861
#define EVENTID_ADJUST_SCROLLBARS
Definition: imivctl1.cxx:49
void SetColumn(sal_uInt16 nIndex, const SvxIconChoiceCtrlColumnInfo &)
Definition: imivctl1.cxx:2867
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:32
tools::Rectangle aGridRect
Definition: ivctrl.hxx:73
IMPL_LINK(SvxIconChoiceCtrl_Impl, ScrollUpDownHdl, ScrollBar *, pScrollBar, void)
Definition: imivctl1.cxx:171
void SetDebugName(const char *pDebugName)
Definition: task.hxx:81
const Point & GetMousePosPixel() const
Definition: event.hxx:204
void ClearFlags(SvxIconViewFlags nMask)
Definition: ivctrl.hxx:88
double GetScrollLines() const
constexpr sal_uInt16 KEY_DOWN
Definition: keycodes.hxx:110
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
Remove user event based on event ID.
Definition: svapp.cxx:1035
#define WB_SMALLICON
Definition: ivctrl.hxx:163
void SetGrid(const Size &)
Definition: imivctl1.cxx:2126
SvxIconChoiceCtrlTextMode eTextMode
Definition: imivctl.hxx:149
#define TBOFFS_WINBORDER
Definition: imivctl.hxx:70
#define DRAWTEXT_FLAGS_SMALLICON
Definition: imivctl1.cxx:46
void SetLineColor()
IconChoiceFlags nFlags
Definition: imivctl.hxx:137
SvxIconChoiceCtrlEntry * pCurHighlightFrame
Definition: imivctl.hxx:140
void SetTop(long v)
SvxIconChoiceCtrlEntry * GetCurEntry() const
Definition: imivctl.hxx:298
long GetDeltaX() const
void EntrySelected(SvxIconChoiceCtrlEntry *pEntry, bool bSelect)
Definition: imivctl1.cxx:324
SvxIconViewFlags GetFlags() const
Definition: ivctrl.hxx:122
void Clear(bool bInCtor)
Definition: imivctl1.cxx:120
#define DBG_ASSERT(sCon, aError)
int i
bool IsClipRegion() const
Definition: outdev.hxx:669
static sal_uLong GetGridCount(const Size &rSizePixel, sal_uInt16 nGridWidth, sal_uInt16 nGridHeight)
Definition: imivctl2.cxx:664
std::unique_ptr< IcnCursor_Impl > pImpCursor
Definition: imivctl.hxx:129
bool IsMod2() const
Definition: event.hxx:159
constexpr sal_uInt16 KEY_HOME
Definition: keycodes.hxx:114
void SetVisibleSize(long nNewSize)
Definition: scrbar.cxx:1377
std::vector< std::unique_ptr< SvxIconChoiceCtrlEntry > > maEntries
Definition: imivctl.hxx:114
static void DrawEntryImage(SvxIconChoiceCtrlEntry const *pEntry, const Point &rPos, OutputDevice &rDev)
Definition: ivctrl.cxx:112
CommandWheelMode GetMode() const
void SetRange(const Range &rRange)
Definition: scrbar.cxx:1338
bool IsBright() const
const Color & GetColor() const
Definition: wall.cxx:204
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1160
void SetOrigin(const Point &rOrigin)
Definition: mapmod.cxx:102
void SetRight(long v)
static OUString GetEntryText(SvxIconChoiceCtrlEntry const *pEntry)
Definition: ivctrl.cxx:117
VclPtr< ScrollBar > aVerSBar
Definition: imivctl.hxx:115
bool MouseButtonDown(const MouseEvent &)
Definition: imivctl1.cxx:635
SvxIconChoiceCtrlEntry * GetFirstSelectedEntry() const
Definition: imivctl1.cxx:2594
void SetFillColor()
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
const Color & GetFieldColor() const
CommandEventId GetCommand() const
const Color & GetLineColor() const
Definition: outdev.hxx:624
SvxIconChoiceCtrlTextMode eTextMode
Definition: ivctrl.hxx:84
void SetTextColor(const Color &rColor)
Definition: text.cxx:665
long Bottom() const
SvxIconChoiceCtrlTextMode GetTextMode() const
Definition: ivctrl.hxx:121
SvxIconChoiceCtrlEntry * GetEntry(sal_Int32 nPos) const
Definition: ivctrl.cxx:254
constexpr sal_uInt16 KEY_PAGEDOWN
Definition: keycodes.hxx:117
long const nBorder
#define WB_NOVSCROLL
Definition: ivctrl.hxx:166
void SetPageSize(long nNewSize)
Definition: scrbar.hxx:125
bool IsInside(const Point &rPOINT) const
friend class IcnGridMap_Impl
Definition: imivctl.hxx:111
SvxIconViewFlags
Definition: ivctrl.hxx:34
void SetStyle(WinBits nWinStyle)
Definition: imivctl1.cxx:154
void Command(const CommandEvent &rCEvt)
Definition: imivctl1.cxx:1942
const AllSettings & GetSettings() const
Definition: outdev.hxx:420
Size GetOutputSizePixel() const
Definition: outdev.hxx:441
#define VIEWMODE_MASK
Definition: imivctl.hxx:83
DrawTextFlags
Definition: outdev.hxx:144
const Color & GetFillColor() const
Definition: font/font.cxx:665
sal_uInt16 GetModifier() const
Definition: event.hxx:153
void InvalidateEntry(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:2583
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2878
#define COMMAND_WHEEL_PAGESCROLL
void GrabFocus()
Definition: window.cxx:3034
bool MatchMnemonic(const OUString &rString, sal_Unicode cMnemonicChar) const
Definition: i18nhelp.cxx:141
constexpr sal_uInt16 KEY_F10
Definition: keycodes.hxx:92
long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:891
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
void PaintEntry(SvxIconChoiceCtrlEntry *, const Point &, vcl::RenderContext &rRenderContext)
Definition: imivctl1.cxx:1443
void SetBacklink(SvxIconChoiceCtrlEntry *pA)
Definition: ivctrl.hxx:93
long CalcBoundingWidth() const
Definition: imivctl1.cxx:1693
Size GetSize() const
const long LONG_MAX
long GetScrollBarLineSize() const
Definition: imivctl.hxx:177
float GetDPIScaleFactor() const
Definition: outdev.hxx:512
constexpr sal_uInt16 KEY_RETURN
Definition: keycodes.hxx:119
bool IsMnemonicChar(sal_Unicode cChar, sal_uLong &rPos) const
Definition: imivctl1.cxx:2542
void SetColor(const Color &)
Definition: font/font.cxx:80
#define WB_NOHSCROLL
Definition: ivctrl.hxx:165
bool RequestHelp(const HelpEvent &rHEvt)
Definition: imivctl1.cxx:2823
constexpr sal_uInt16 KEY_RIGHT
Definition: keycodes.hxx:113
void SetLineSize(long nNewSize)
Definition: scrbar.hxx:123
tools::Rectangle CalcTextRect(SvxIconChoiceCtrlEntry *, const Point *pPos=nullptr, const OUString *pStr=nullptr)
Definition: imivctl1.cxx:1652
#define LROFFS_BOUND
Definition: imivctl.hxx:72
VclPtr< ScrollBarBox > aScrBarBox
Definition: imivctl.hxx:117
Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1179
void RemoveEntry(size_t nPos)
Definition: imivctl1.cxx:228
void ToDocPos(Point &rPosPixel)
Definition: imivctl.hxx:182
const tools::Rectangle & GetEntryBoundRect(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:1618
long Max() const
void ClickIcon()
Definition: ivctrl.cxx:269
void ShowCursor(bool bShow)
Definition: imivctl1.cxx:1846
const vcl::KeyCode & GetKeyCode() const
Definition: event.hxx:54
IconChoiceFlags
Definition: imivctl.hxx:53
#define WB_DETAILS
Definition: ivctrl.hxx:164
SvxIconChoiceCtrlTextMode
Definition: ivctrl.hxx:47
SvxIconChoiceCtrlEntry * pCursor
Definition: imivctl.hxx:143
bool IsShift() const
Definition: keycod.hxx:58
SvxIconChoiceCtrlEntry * FindEntryPredecessor(SvxIconChoiceCtrlEntry *pEntry, const Point &)
Definition: imivctl1.cxx:2775
constexpr sal_uInt16 KEY_SUBTRACT
Definition: keycodes.hxx:128
long AdjustRight(long nHorzMoveDelta)
void Stop()
Definition: scheduler.cxx:593
void SetPointFont(const vcl::Font &rFont)
Definition: ivctrl.cxx:213
long GetDelta() const
void SetUpdateMode(bool bUpdate)
Definition: imivctl1.cxx:1374
tools::Rectangle & Union(const tools::Rectangle &rRect)
tools::Rectangle CalcBmpRect(SvxIconChoiceCtrlEntry *, const Point *pPos=nullptr)
Definition: imivctl1.cxx:1625
bool IsFocused() const
Definition: ivctrl.hxx:124
void SelectEntry(SvxIconChoiceCtrlEntry *, bool bSelect, bool bAddToSelection=false)
Definition: imivctl1.cxx:287
void SetFont(const vcl::Font &rNewFont)
void Scroll(long nDeltaX, long nDeltaY)
Definition: imivctl1.cxx:2239
bool IsVisible() const
Definition: window2.cxx:1102
#define PAINTFLAG_VER_CENTERED
Definition: imivctl.hxx:51
bool IsLeft() const
Definition: event.hxx:146
sal_Unicode GetCharCode() const
Definition: event.hxx:53
void SetScrollHdl(const Link< ScrollBar *, void > &rLink)
Definition: scrbar.hxx:133
bool IsMod1() const
Definition: keycod.hxx:60
#define WB_ICON
Definition: ivctrl.hxx:162
void SetBottom(long v)
#define WB_ALIGN_LEFT
Definition: ivctrl.hxx:171
bool IsScrollable() const
Definition: wall.cxx:335
void CreateAutoMnemonics(MnemonicGenerator *_pGenerator)
Definition: imivctl1.cxx:235
long AdjustTop(long nVertMoveDelta)
void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: imivctl1.cxx:514
void SetInvokeHandler(const Link< Timer *, void > &rLink)
Definition: timer.hxx:56
void expand(long nExpandBy)
const Point & GetPosPixel() const
Definition: event.hxx:120
constexpr::Color COL_WHITE(0xFF, 0xFF, 0xFF)
const Point & GetOrigin() const
Definition: mapmod.cxx:170
long Left() const
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:880
void StartAutoScroll(StartAutoScrollFlags nFlags)
Definition: window2.cxx:317
void SetEntryPredecessor(SvxIconChoiceCtrlEntry *pEntry, SvxIconChoiceCtrlEntry *pPredecessor)
Definition: imivctl1.cxx:2727
DrawHighlightFrameStyle
Definition: decoview.hxx:61
std::vector< tools::Rectangle > aSelectedRectList
Definition: imivctl.hxx:119
void InsertEntry(std::unique_ptr< SvxIconChoiceCtrlEntry >, size_t nPos)
Definition: imivctl1.cxx:190
void Arrange(bool bKeepPredecessors, long nSetMaxVirtWidth, long nSetMaxVirtHeight)
Definition: imivctl1.cxx:469
SvxIconChoiceCtrlEntry * pHead
Definition: imivctl.hxx:142
void Center(SvxIconChoiceCtrlEntry *pEntry) const
Definition: imivctl1.cxx:2220
#define LROFFS_WINBORDER
Definition: imivctl.hxx:69
void SetLeft(long v)
void ClipAtVirtOutRect(tools::Rectangle &rRect) const
Definition: imivctl1.cxx:1967
void SetEntryHighlightFrame(SvxIconChoiceCtrlEntry *pEntry, bool bKeepHighlightFlags)
Definition: imivctl1.cxx:2914
sal_Int32 GetEntryListPos(SvxIconChoiceCtrlEntry const *) const
Definition: imivctl1.cxx:2651
Definition: timer.hxx:26
void SetPriority(TaskPriority ePriority)
Definition: scheduler.cxx:600
bool IsRight() const
Definition: event.hxx:150
constexpr sal_uInt16 KEY_LEFT
Definition: keycodes.hxx:112
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2872
void SelectRange(SvxIconChoiceCtrlEntry const *pStart, SvxIconChoiceCtrlEntry const *pEnd, bool bAdd)
Definition: imivctl1.cxx:2389
void SetCursor(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:1817
#define VER_DIST_BMP_STRING
Definition: imivctl.hxx:76
void InvalidateBoundingRect(tools::Rectangle &rRect)
Definition: imivctl.hxx:331
long GetScrollBarSize() const
const SvxIconChoiceCtrlColumnInfo * GetColumn(sal_uInt16 nIndex) const
Definition: imivctl1.cxx:2884
void ToggleSelection(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:2082
Low, very idle cleanup tasks.
#define WB_ALIGN_TOP
Definition: ivctrl.hxx:170
const OUString & GetText() const
Definition: ivctrl.hxx:114
bool HasFocus() const
Definition: window.cxx:3039
void Push(PushFlags nFlags=PushFlags::ALL)
Definition: outdevstate.cxx:60
Size GetMinGrid() const
Definition: imivctl1.cxx:2106
static constexpr auto DRAWTEXT_FLAGS_ICON
Definition: imivctl1.cxx:42
void setWidth(long nWidth)
bool IsPosLocked() const
Definition: ivctrl.hxx:125
void RegisterMnemonic(const OUString &rKey)
Definition: mnemonic.cxx:76
constexpr sal_uInt16 KEY_DIVIDE
Definition: keycodes.hxx:130
#define WB_HIGHLIGHTFRAME
Definition: ivctrl.hxx:173
SvxIconChoiceCtrlPositionMode
Definition: ivctrl.hxx:53
void SetText(const OUString &rText)
Definition: ivctrl.hxx:113
void PaintItem(const tools::Rectangle &rRect, IcnViewFieldType eItem, SvxIconChoiceCtrlEntry *pEntry, sal_uInt16 nPaintFlags, vcl::RenderContext &rRenderContext)
Definition: imivctl1.cxx:1415
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1257
bool HandleScrollCommand(const CommandEvent &rCmd)
Definition: imivctl1.cxx:1863
bool KeyInput(const KeyEvent &)
Definition: imivctl1.cxx:880
const Color & GetWindowTextColor() const
#define PAINTFLAG_HOR_CENTERED
Definition: imivctl.hxx:50
void SetThumbPos(long nThumbPos)
Definition: scrbar.cxx:1363
void ToTop(SvxIconChoiceCtrlEntry *)
Definition: imivctl1.cxx:1954
Point Center() const
void SelectRect(SvxIconChoiceCtrlEntry *pEntry1, SvxIconChoiceCtrlEntry *pEntry2, bool bAdd, std::vector< tools::Rectangle > *pOtherRects)
Definition: imivctl1.cxx:2283
sal_uInt16 nPos
const Color & GetFillColor() const
Definition: outdev.hxx:629
const Size & GetItemSize(IcnViewFieldType) const
Definition: imivctl1.cxx:2252
long CalcBoundingHeight() const
Definition: imivctl1.cxx:1714
sal_Int32 GetSelectionCount() const
Definition: imivctl1.cxx:2075
#define TBOFFS_BOUND
Definition: imivctl.hxx:73
bool IsMod1() const
Definition: event.hxx:157
void SetPositionMode(SvxIconChoiceCtrlPositionMode)
Definition: imivctl1.cxx:2694
void RecalcAllBoundingRectsSmart()
Definition: imivctl1.cxx:1746
#define EVENTID_SHOW_CURSOR
Definition: imivctl1.cxx:48
bool IsMod2() const
Definition: keycod.hxx:62
WinBits const WB_DRAG
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2204
constexpr sal_uInt16 KEY_F8
Definition: keycodes.hxx:90
void setHeight(long nHeight)