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