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