LibreOffice Module sc (master)  1
olinewin.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 #include <sal/config.h>
21 
22 #include <string_view>
23 
24 #include <vcl/image.hxx>
25 #include <vcl/taskpanelist.hxx>
26 #include <vcl/settings.hxx>
27 
28 #include <olinewin.hxx>
29 #include <olinetab.hxx>
30 #include <document.hxx>
31 #include <dbfunc.hxx>
32 #include <bitmaps.hlst>
33 
36 
37 const size_t SC_OL_NOLEVEL = static_cast< size_t >( -1 );
38 const size_t SC_OL_HEADERENTRY = static_cast< size_t >( -1 );
39 
41  Window( pParent ),
42  mrViewData( *pViewData ),
43  meWhich( eWhich ),
44  mbHoriz( eMode == SC_OUTLINE_HOR ),
45  mbMirrorEntries( false ), // updated in SetHeaderSize
46  mbMirrorLevels( false ), // updated in SetHeaderSize
47  maLineColor( COL_BLACK ),
48  mnHeaderSize( 0 ),
49  mnHeaderPos( 0 ),
50  mnMainFirstPos( 0 ),
51  mnMainLastPos( 0 ),
52  mbMTActive( false ),
53  mbMTPressed( false ),
54  mnFocusLevel( 0 ),
55  mnFocusEntry( SC_OL_HEADERENTRY ),
56  mbDontDrawFocus( false )
57 {
58  EnableRTL( false ); // mirroring is done manually
59 
60  InitSettings();
62  SetHeaderSize( 0 );
63 
64  // insert the window into task pane list for "F6 cycling"
65  if( SystemWindow* pSysWin = GetSystemWindow() )
66  if( TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
67  pTaskPaneList->AddWindow( this );
68 }
69 
71 {
72  disposeOnce();
73 }
74 
76 {
77  // remove the window from task pane list
78  if( SystemWindow* pSysWin = GetSystemWindow() )
79  if( TaskPaneList* pTaskPaneList = pSysWin->GetTaskPaneList() )
80  pTaskPaneList->RemoveWindow( this );
82 }
83 
85 {
86  bool bLayoutRTL = GetDoc().IsLayoutRTL( GetTab() );
87  mbMirrorEntries = bLayoutRTL && mbHoriz;
88  mbMirrorLevels = bLayoutRTL && !mbHoriz;
89 
90  bool bNew = (nNewSize != mnHeaderSize);
91  mnHeaderSize = nNewSize;
95  if ( bNew )
96  Invalidate();
97 }
98 
100 {
102  if ( nSize > 0 )
103  nSize += 2 * SC_OL_POSOFFSET + 1;
104  return nSize;
105 }
106 
108 {
109  HideFocus();
110  mbDontDrawFocus = true;
111 
112  tools::Long nStart = mnMainFirstPos;
113  tools::Long nEnd = mnMainLastPos;
114 
115  tools::Long nInvStart, nInvEnd;
116  if (nDiff < 0)
117  {
118  nStart -= nDiff;
119  nInvStart = nEnd + nDiff;
120  nInvEnd = nEnd;
121  }
122  else
123  {
124  nEnd -= nDiff;
125  nInvStart = nStart;
126  nInvEnd = nStart + nDiff;
127  }
128 
129  ScrollRel( nDiff, nStart, nEnd );
130  Invalidate( GetRectangle( 0, nInvStart, GetOutputSizeLevel() - 1, nInvEnd ) );
131 
132  // if focus becomes invisible, move it to next visible button
133  ImplMoveFocusToVisible( nDiff < 0 );
134 
135  mbDontDrawFocus = false;
136  ShowFocus();
137 }
138 
139 void ScOutlineWindow::ScrollRel( tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd )
140 {
141  tools::Rectangle aRect( GetRectangle( 0, nEntryStart, GetOutputSizeLevel() - 1, nEntryEnd ) );
142  if ( mbHoriz )
143  Scroll( nEntryDiff, 0, aRect );
144  else
145  Scroll( 0, nEntryDiff, aRect );
146 }
147 
148 // internal -------------------------------------------------------------------
149 
151 {
152  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
153  SetBackground( rStyleSettings.GetFaceColor() );
154  maLineColor = rStyleSettings.GetButtonTextColor();
155  Invalidate();
156 }
157 
159 {
160  const ScOutlineTable* pTable = GetDoc().GetOutlineTable( GetTab() );
161  if ( !pTable ) return nullptr;
162  return mbHoriz ? &pTable->GetColArray() : &pTable->GetRowArray();
163 }
164 
165 const ScOutlineEntry* ScOutlineWindow::GetOutlineEntry( size_t nLevel, size_t nEntry ) const
166 {
167  const ScOutlineArray* pArray = GetOutlineArray();
168  return pArray ? pArray->GetEntry( sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) ) : nullptr;
169 }
170 
171 bool ScOutlineWindow::IsHidden( SCCOLROW nColRowIndex ) const
172 {
173  return mbHoriz ?
174  GetDoc().ColHidden(static_cast<SCCOL>(nColRowIndex), GetTab()) :
175  GetDoc().RowHidden(static_cast<SCROW>(nColRowIndex), GetTab());
176 }
177 
178 bool ScOutlineWindow::IsFiltered( SCCOLROW nColRowIndex ) const
179 {
180  // columns cannot be filtered
181  return !mbHoriz && GetDoc().RowFiltered( static_cast<SCROW>(nColRowIndex), GetTab() );
182 }
183 
184 bool ScOutlineWindow::IsFirstVisible( SCCOLROW nColRowIndex ) const
185 {
186  bool bAllHidden = true;
187  for ( SCCOLROW nPos = 0; (nPos < nColRowIndex) && bAllHidden; ++nPos )
188  bAllHidden = IsHidden( nPos );
189  return bAllHidden;
190 }
191 
192 void ScOutlineWindow::GetVisibleRange( SCCOLROW& rnColRowStart, SCCOLROW& rnColRowEnd ) const
193 {
194  if ( mbHoriz )
195  {
196  rnColRowStart = mrViewData.GetPosX( WhichH( meWhich ) );
197  rnColRowEnd = rnColRowStart + mrViewData.VisibleCellsX( WhichH( meWhich ) );
198  }
199  else
200  {
201  rnColRowStart = mrViewData.GetPosY( WhichV( meWhich ) );
202  rnColRowEnd = rnColRowStart + mrViewData.VisibleCellsY( WhichV( meWhich ) );
203  }
204 
205  // include collapsed columns/rows in front of visible range
206  while ( (rnColRowStart > 0) && IsHidden( rnColRowStart - 1 ) )
207  --rnColRowStart;
208 }
209 
211 {
212  return mbHoriz ? Point( nEntryPos, nLevelPos ) : Point( nLevelPos, nEntryPos );
213 }
214 
216  tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd ) const
217 {
218  return tools::Rectangle( GetPoint( nLevelStart, nEntryStart ), GetPoint( nLevelEnd, nEntryEnd ) );
219 }
220 
222 {
223  Size aSize( GetOutputSizePixel() );
224  return mbHoriz ? aSize.Height() : aSize.Width();
225 }
226 
228 {
229  Size aSize( GetOutputSizePixel() );
230  return mbHoriz ? aSize.Width() : aSize.Height();
231 }
232 
234 {
235  const ScOutlineArray* pArray = GetOutlineArray();
236  size_t nLevelCount = pArray ? pArray->GetDepth() : 0;
237  return nLevelCount ? (nLevelCount + 1) : 0;
238 }
239 
241 {
242  // #i51970# must always return the *left* edge of the area used by a level
243  tools::Long nPos = static_cast< tools::Long >( SC_OL_POSOFFSET + nLevel * SC_OL_BITMAPSIZE );
244  return mbMirrorLevels ? (GetOutputSizeLevel() - nPos - SC_OL_BITMAPSIZE) : nPos;
245 }
246 
248 {
249  if( mbMirrorLevels ) nLevelPos = GetOutputSizeLevel() - nLevelPos - 1;
250  tools::Long nStart = SC_OL_POSOFFSET;
251  if ( nLevelPos < nStart ) return SC_OL_NOLEVEL;
252  size_t nLevel = static_cast< size_t >( (nLevelPos - nStart) / SC_OL_BITMAPSIZE );
253  return (nLevel < GetLevelCount()) ? nLevel : SC_OL_NOLEVEL;
254 }
255 
257 {
258  tools::Long nDocPos = mbHoriz ?
259  mrViewData.GetScrPos( static_cast<SCCOL>(nColRowIndex), 0, meWhich, true ).X() :
260  mrViewData.GetScrPos( 0, static_cast<SCROW>(nColRowIndex), meWhich, true ).Y();
261  return mnMainFirstPos + nDocPos;
262 }
263 
265 {
266  return mnHeaderPos + (mnHeaderSize - SC_OL_BITMAPSIZE) / 2;
267 }
268 
270  size_t nLevel, size_t nEntry,
271  tools::Long& rnStartPos, tools::Long& rnEndPos, tools::Long& rnImagePos ) const
272 {
273  const ScOutlineEntry* pEntry = GetOutlineEntry( nLevel, nEntry );
274  if ( !pEntry || !pEntry->IsVisible() )
275  return false;
276 
277  SCCOLROW nStart = pEntry->GetStart();
278  SCCOLROW nEnd = pEntry->GetEnd();
279 
280  tools::Long nEntriesSign = mbMirrorEntries ? -1 : 1;
281 
282  // --- common calculation ---
283 
284  rnStartPos = GetColRowPos( nStart );
285  rnEndPos = GetColRowPos( nEnd + 1 );
286 
287  bool bHidden = IsHidden( nStart );
288  rnImagePos = bHidden ?
289  (rnStartPos - ( SC_OL_BITMAPSIZE / 2 ) * nEntriesSign) :
290  rnStartPos + nEntriesSign;
291  tools::Long nCenter = (rnStartPos + rnEndPos - SC_OL_BITMAPSIZE * nEntriesSign +
292  ( mbMirrorEntries ? 1 : 0 )) / 2;
293  rnImagePos = mbMirrorEntries ? std::max( rnImagePos, nCenter ) : std::min( rnImagePos, nCenter );
294 
295  // --- refinements ---
296 
297  // do not cut leftmost/topmost image
298  if ( bHidden && IsFirstVisible( nStart ) )
299  rnImagePos = rnStartPos;
300 
301  // do not cover previous collapsed image
302  bool bDoNoCover = !bHidden && nEntry;
303  const ScOutlineEntry* pPrevEntry = bDoNoCover ? GetOutlineEntry(nLevel, nEntry - 1) : nullptr;
304  if (pPrevEntry)
305  {
306  SCCOLROW nPrevEnd = pPrevEntry->GetEnd();
307  if ( (nPrevEnd + 1 == nStart) && IsHidden( nPrevEnd ) )
308  {
309  if ( IsFirstVisible( pPrevEntry->GetStart() ) )
310  rnStartPos += SC_OL_BITMAPSIZE * nEntriesSign;
311  else
312  rnStartPos += ( SC_OL_BITMAPSIZE / 2 ) * nEntriesSign;
313  rnImagePos = rnStartPos;
314  }
315  }
316 
317  // restrict rnStartPos...rnEndPos to valid area
318  rnStartPos = std::max( rnStartPos, mnMainFirstPos );
319  rnEndPos = std::max( rnEndPos, mnMainFirstPos );
320 
321  if ( mbMirrorEntries )
322  rnImagePos -= SC_OL_BITMAPSIZE - 1; // start pos aligns with right edge of bitmap
323 
324  // --- all rows filtered? ---
325 
326  bool bVisible = true;
327  if ( !mbHoriz )
328  {
329  bVisible = false;
330  for ( SCCOLROW nRow = nStart; (nRow <= nEnd) && !bVisible; ++nRow )
331  bVisible = !IsFiltered( nRow );
332  }
333  return bVisible;
334 }
335 
336 bool ScOutlineWindow::GetImagePos( size_t nLevel, size_t nEntry, Point& rPos ) const
337 {
338  bool bRet = nLevel < GetLevelCount();
339  if ( bRet )
340  {
341  tools::Long nLevelPos = GetLevelPos( nLevel );
342  if ( nEntry == SC_OL_HEADERENTRY )
343  rPos = GetPoint( nLevelPos, GetHeaderEntryPos() );
344  else
345  {
346  tools::Long nStartPos, nEndPos, nImagePos;
347  bRet = GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos );
348  rPos = GetPoint( nLevelPos, nImagePos );
349  }
350  }
351  return bRet;
352 }
353 
354 bool ScOutlineWindow::IsButtonVisible( size_t nLevel, size_t nEntry ) const
355 {
356  bool bRet = false;
357  if ( nEntry == SC_OL_HEADERENTRY )
358  bRet = (mnHeaderSize > 0) && (nLevel < GetLevelCount());
359  else
360  {
361  const ScOutlineEntry* pEntry = GetOutlineEntry( nLevel, nEntry );
362  if ( pEntry && pEntry->IsVisible() )
363  {
364  SCCOLROW nStart, nEnd;
365  GetVisibleRange( nStart, nEnd );
366  bRet = (nStart <= pEntry->GetStart()) && (pEntry->GetStart() <= nEnd);
367  }
368  }
369  return bRet;
370 }
371 
372 bool ScOutlineWindow::ItemHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry, bool& rbButton ) const
373 {
374  const ScOutlineArray* pArray = GetOutlineArray();
375  if ( !pArray ) return false;
376 
377  SCCOLROW nStartIndex, nEndIndex;
378  GetVisibleRange( nStartIndex, nEndIndex );
379 
380  size_t nLevel = GetLevelFromPos( mbHoriz ? rPos.Y() : rPos.X() );
381  if ( nLevel == SC_OL_NOLEVEL )
382  return false;
383 
384  tools::Long nEntryMousePos = mbHoriz ? rPos.X() : rPos.Y();
385 
386  // --- level buttons ---
387 
388  if ( mnHeaderSize > 0 )
389  {
390  tools::Long nImagePos = GetHeaderEntryPos();
391  if ( (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos + SC_OL_BITMAPSIZE) )
392  {
393  rnLevel = nLevel;
394  rnEntry = SC_OL_HEADERENTRY;
395  rbButton = true;
396  return true;
397  }
398  }
399 
400  // --- expand/collapse buttons and expanded lines ---
401 
402  // search outline entries backwards
403  size_t nEntry = pArray->GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
404  while ( nEntry )
405  {
406  --nEntry;
407 
408  const ScOutlineEntry* pEntry = pArray->GetEntry( sal::static_int_cast<sal_uInt16>(nLevel),
409  sal::static_int_cast<sal_uInt16>(nEntry) );
410  SCCOLROW nStart = pEntry->GetStart();
411  SCCOLROW nEnd = pEntry->GetEnd();
412 
413  if ( (nEnd >= nStartIndex) && (nStart <= nEndIndex) )
414  {
415  tools::Long nStartPos, nEndPos, nImagePos;
416  if ( GetEntryPos( nLevel, nEntry, nStartPos, nEndPos, nImagePos ) )
417  {
418  rnLevel = nLevel;
419  rnEntry = nEntry;
420 
421  // button?
422  if ( (nStart >= nStartIndex) && (nImagePos <= nEntryMousePos) && (nEntryMousePos < nImagePos + SC_OL_BITMAPSIZE) )
423  {
424  rbButton = true;
425  return true;
426  }
427 
428  // line?
429  if ( mbMirrorEntries )
430  ::std::swap( nStartPos, nEndPos ); // in RTL mode, nStartPos is the larger value
431  if ( (nStartPos <= nEntryMousePos) && (nEntryMousePos <= nEndPos) )
432  {
433  rbButton = false;
434  return true;
435  }
436  }
437  }
438  }
439 
440  return false;
441 }
442 
443 bool ScOutlineWindow::ButtonHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry ) const
444 {
445  bool bButton;
446  bool bRet = ItemHit( rPos, rnLevel, rnEntry, bButton );
447  return bRet && bButton;
448 }
449 
450 bool ScOutlineWindow::LineHit( const Point& rPos, size_t& rnLevel, size_t& rnEntry ) const
451 {
452  bool bButton;
453  bool bRet = ItemHit( rPos, rnLevel, rnEntry, bButton );
454  return bRet && !bButton;
455 }
456 
457 void ScOutlineWindow::DoFunction( size_t nLevel, size_t nEntry ) const
458 {
459  ScDBFunc& rFunc = *mrViewData.GetView();
460  if ( nEntry == SC_OL_HEADERENTRY )
461  rFunc.SelectLevel( mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel) );
462  else
463  {
464  const ScOutlineEntry* pEntry = GetOutlineEntry( nLevel, nEntry );
465  if ( pEntry )
466  {
467  if ( pEntry->IsHidden() )
468  rFunc.ShowOutline( mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
469  else
470  rFunc.HideOutline( mbHoriz, sal::static_int_cast<sal_uInt16>(nLevel), sal::static_int_cast<sal_uInt16>(nEntry) );
471  }
472  }
473 }
474 
475 void ScOutlineWindow::DoExpand( size_t nLevel, size_t nEntry ) const
476 {
477  const ScOutlineEntry* pEntry = GetOutlineEntry( nLevel, nEntry );
478  if ( pEntry && pEntry->IsHidden() )
479  DoFunction( nLevel, nEntry );
480 }
481 
482 void ScOutlineWindow::DoCollapse( size_t nLevel, size_t nEntry ) const
483 {
484  const ScOutlineEntry* pEntry = GetOutlineEntry( nLevel, nEntry );
485  if ( pEntry && !pEntry->IsHidden() )
486  DoFunction( nLevel, nEntry );
487 }
488 
490 {
491  Window::Resize();
492  SetHeaderSize( mnHeaderSize ); // recalculates header/group positions
493  if ( !IsFocusButtonVisible() )
494  {
495  HideFocus();
496  ShowFocus(); // calculates valid position
497  }
498 }
499 
501 {
502  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
503  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
504  {
505  InitSettings();
506  Invalidate();
507  }
508  Window::DataChanged( rDCEvt );
509 }
510 
511 // drawing --------------------------------------------------------------------
512 
514 {
516  GetPoint( 0, mnMainFirstPos ),
518 }
519 
521  tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd )
522 {
523  DrawLine( GetPoint( nLevelStart, nEntryStart ), GetPoint( nLevelEnd, nEntryEnd ) );
524 }
525 
527  tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd )
528 {
529  DrawRect( GetRectangle( nLevelStart, nEntryStart, nLevelEnd, nEntryEnd ) );
530 }
531 
532 namespace
533 {
534  Image GetImage(const OUString& rId)
535  {
536  return Image(StockImage::Yes, rId);
537  }
538 }
539 
540 void ScOutlineWindow::DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString& rId)
541 {
542  const Image& rImage = GetImage(rId);
543  SetLineColor();
544  SetFillColor( GetBackground().GetColor() );
545  Point aPos( GetPoint( nLevelPos, nEntryPos ) );
546  DrawRect( tools::Rectangle( aPos, rImage.GetSizePixel() ) );
547  DrawImage( aPos, rImage );
548 }
549 
550 void ScOutlineWindow::DrawBorderRel( size_t nLevel, size_t nEntry, bool bPressed )
551 {
552  Point aPos;
553  if ( GetImagePos( nLevel, nEntry, aPos ) )
554  {
555  OUString sId = bPressed ? OUString(RID_BMP_PRESSED) : OUString(RID_BMP_NOTPRESSED);
556  bool bClip = (nEntry != SC_OL_HEADERENTRY);
557  if ( bClip )
559  DrawImage(aPos, GetImage(sId));
560  if ( bClip )
561  SetClipRegion();
562  }
563  mbMTPressed = bPressed;
564 }
565 
567 {
568  if ( !HasFocus() )
569  return;
570 
571  // first move to a visible position
572  ImplMoveFocusToVisible( true );
573 
574  if ( !IsFocusButtonVisible() )
575  return;
576 
577  Point aPos;
578  if ( GetImagePos( mnFocusLevel, mnFocusEntry, aPos ) )
579  {
580  aPos += Point( 1, 1 );
582  bool bClip = (mnFocusEntry != SC_OL_HEADERENTRY);
583  if ( bClip )
585  InvertTracking( maFocusRect, ShowTrackFlags::Small | ShowTrackFlags::TrackWindow );
586  if ( bClip )
587  SetClipRegion();
588  }
589 }
590 
592 {
593  if ( !maFocusRect.IsEmpty() )
594  {
595  bool bClip = (mnFocusEntry != SC_OL_HEADERENTRY);
596  if ( bClip )
598  InvertTracking( maFocusRect, ShowTrackFlags::Small | ShowTrackFlags::TrackWindow );
599  if ( bClip )
600  SetClipRegion();
602  }
603 }
604 
605 const std::u16string_view aLevelBmps[]=
606 {
607  u"" RID_BMP_LEVEL1,
608  u"" RID_BMP_LEVEL2,
609  u"" RID_BMP_LEVEL3,
610  u"" RID_BMP_LEVEL4,
611  u"" RID_BMP_LEVEL5,
612  u"" RID_BMP_LEVEL6,
613  u"" RID_BMP_LEVEL7,
614  u"" RID_BMP_LEVEL8
615 };
616 
617 void ScOutlineWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& /* rRect */ )
618 {
619  tools::Long nEntriesSign = mbMirrorEntries ? -1 : 1;
620  tools::Long nLevelsSign = mbMirrorLevels ? -1 : 1;
621 
622  Size aSize = GetOutputSizePixel();
623  tools::Long nLevelEnd = (mbHoriz ? aSize.Height() : aSize.Width()) - 1;
624  tools::Long nEntryEnd = (mbHoriz ? aSize.Width() : aSize.Height()) - 1;
625 
627  tools::Long nBorderPos = mbMirrorLevels ? 0 : nLevelEnd;
628  DrawLineRel( nBorderPos, 0, nBorderPos, nEntryEnd );
629 
630  const ScOutlineArray* pArray = GetOutlineArray();
631  if ( !pArray ) return;
632 
633  size_t nLevelCount = GetLevelCount();
634 
635  // --- draw header images ---
636 
637  if ( mnHeaderSize > 0 )
638  {
639  tools::Long nEntryPos = GetHeaderEntryPos();
640  for ( size_t nLevel = 0; nLevel < nLevelCount; ++nLevel )
641  DrawImageRel(GetLevelPos(nLevel), nEntryPos, OUString(aLevelBmps[nLevel]));
642 
644  tools::Long nLinePos = mnHeaderPos + (mbMirrorEntries ? 0 : (mnHeaderSize - 1));
645  DrawLineRel( 0, nLinePos, nLevelEnd, nLinePos );
646  }
647 
648  // --- draw lines & collapse/expand images ---
649 
651 
652  SCCOLROW nStartIndex, nEndIndex;
653  GetVisibleRange( nStartIndex, nEndIndex );
654 
655  for ( size_t nLevel = 0; nLevel + 1 < nLevelCount; ++nLevel )
656  {
657  tools::Long nLevelPos = GetLevelPos( nLevel );
658  tools::Long nEntryPos1 = 0, nEntryPos2 = 0, nImagePos = 0;
659 
660  size_t nEntryCount = pArray->GetCount( sal::static_int_cast<sal_uInt16>(nLevel) );
661  size_t nEntry;
662 
663  // first draw all lines in the current level
664  SetLineColor();
666  for ( nEntry = 0; nEntry < nEntryCount; ++nEntry )
667  {
668  const ScOutlineEntry* pEntry = pArray->GetEntry( sal::static_int_cast<sal_uInt16>(nLevel),
669  sal::static_int_cast<sal_uInt16>(nEntry) );
670  SCCOLROW nStart = pEntry->GetStart();
671  SCCOLROW nEnd = pEntry->GetEnd();
672 
673  // visible range?
674  bool bDraw = (nEnd >= nStartIndex) && (nStart <= nEndIndex);
675  // find output coordinates
676  if ( bDraw )
677  bDraw = GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
678  // draw, if not collapsed
679  if ( bDraw && !pEntry->IsHidden() )
680  {
681  if ( nStart >= nStartIndex )
682  nEntryPos1 += nEntriesSign;
683  nEntryPos2 -= 2 * nEntriesSign;
684  tools::Long nLinePos = nLevelPos;
685  if ( mbMirrorLevels )
686  nLinePos += SC_OL_BITMAPSIZE - 1; // align with right edge of bitmap
687  DrawRectRel( nLinePos, nEntryPos1, nLinePos + nLevelsSign, nEntryPos2 );
688 
689  if ( nEnd <= nEndIndex )
690  DrawRectRel( nLinePos, nEntryPos2 - nEntriesSign,
691  nLinePos + ( SC_OL_BITMAPSIZE / 3 ) * nLevelsSign, nEntryPos2 );
692  }
693  }
694 
695  // draw all images in the level from last to first
696  nEntry = nEntryCount;
697  while ( nEntry )
698  {
699  --nEntry;
700 
701  const ScOutlineEntry* pEntry = pArray->GetEntry( sal::static_int_cast<sal_uInt16>(nLevel),
702  sal::static_int_cast<sal_uInt16>(nEntry) );
703  SCCOLROW nStart = pEntry->GetStart();
704 
705  // visible range?
706  bool bDraw = (nStartIndex <= nStart) && (nStart <= nEndIndex + 1);
707  // find output coordinates
708  if ( bDraw )
709  bDraw = GetEntryPos( nLevel, nEntry, nEntryPos1, nEntryPos2, nImagePos );
710  // draw, if not hidden by higher levels
711  if ( bDraw )
712  {
713  OUString sImageId = pEntry->IsHidden() ? OUString(RID_BMP_PLUS) : OUString(RID_BMP_MINUS);
714  DrawImageRel(nLevelPos, nImagePos, sImageId);
715  }
716  }
717  }
718 
719  SetClipRegion();
720 
721  if ( !mbDontDrawFocus )
722  ShowFocus();
723 }
724 
725 // focus ----------------------------------------------------------------------
726 
729 static bool lcl_RotateValue( size_t& rnValue, size_t nMin, size_t nMax, bool bForward )
730 {
731  OSL_ENSURE( nMin <= nMax, "lcl_RotateValue - invalid range" );
732  OSL_ENSURE( nMax < static_cast< size_t >( -1 ), "lcl_RotateValue - range overflow" );
733  bool bWrap = false;
734  if ( bForward )
735  {
736  if ( rnValue < nMax )
737  ++rnValue;
738  else
739  {
740  rnValue = nMin;
741  bWrap = true;
742  }
743  }
744  else
745  {
746  if ( rnValue > nMin )
747  --rnValue;
748  else
749  {
750  rnValue = nMax;
751  bWrap = true;
752  }
753  }
754  return bWrap;
755 }
756 
758 {
760 }
761 
762 bool ScOutlineWindow::ImplMoveFocusByEntry( bool bForward, bool bFindVisible )
763 {
764  const ScOutlineArray* pArray = GetOutlineArray();
765  if ( !pArray )
766  return false;
767 
768  bool bWrapped = false;
769  size_t nEntryCount = pArray->GetCount( sal::static_int_cast<sal_uInt16>(mnFocusLevel) );
770  // #i29530# entry count may be decreased after changing active sheet
771  if( mnFocusEntry >= nEntryCount )
773  size_t nOldEntry = mnFocusEntry;
774 
775  do
776  {
778  {
779  // move from header to first or last entry
780  if ( nEntryCount > 0 )
781  mnFocusEntry = bForward ? 0 : (nEntryCount - 1);
782  /* wrapped, if forward from right header to first entry,
783  or if backward from left header to last entry */
784  // Header and entries are now always in consistent order,
785  // so there's no need to check for mirroring here.
786  if ( !nEntryCount || !bForward )
787  bWrapped = true;
788  }
789  else if ( lcl_RotateValue( mnFocusEntry, 0, nEntryCount - 1, bForward ) )
790  {
791  // lcl_RotateValue returns true -> wrapped the entry range -> move to header
793  /* wrapped, if forward from last entry to left header,
794  or if backward from first entry to right header */
795  if ( bForward )
796  bWrapped = true;
797  }
798  }
799  while ( bFindVisible && !IsFocusButtonVisible() && (nOldEntry != mnFocusEntry) );
800 
801  return bWrapped;
802 }
803 
805 {
806  const ScOutlineArray* pArray = GetOutlineArray();
807  if ( !pArray )
808  return false;
809 
810  bool bWrapped = false;
811  size_t nLevelCount = GetLevelCount();
812 
814  {
815  if ( nLevelCount > 0 )
816  bWrapped = lcl_RotateValue( mnFocusLevel, 0, nLevelCount - 1, bForward );
817  }
818  else
819  {
820  const ScOutlineEntry* pEntry = pArray->GetEntry(
822 
823  if ( pEntry )
824  {
825  SCCOLROW nStart = pEntry->GetStart();
826  SCCOLROW nEnd = pEntry->GetEnd();
827  size_t nNewLevel = mnFocusLevel;
828  size_t nNewEntry = 0;
829 
830  bool bFound = false;
831  if ( bForward && (mnFocusLevel + 2 < nLevelCount) )
832  {
833  // next level -> find first child entry
834  nNewLevel = mnFocusLevel + 1;
835  bFound = pArray->GetEntryIndexInRange(nNewLevel, nStart, nEnd, nNewEntry);
836  }
837  else if ( !bForward && (mnFocusLevel > 0) )
838  {
839  // previous level -> find parent entry
840  nNewLevel = mnFocusLevel - 1;
841  bFound = pArray->GetEntryIndex(nNewLevel, nStart, nNewEntry);
842  }
843 
844  if ( bFound && IsButtonVisible( nNewLevel, nNewEntry ) )
845  {
846  mnFocusLevel = nNewLevel;
847  mnFocusEntry = nNewEntry;
848  }
849  }
850  }
851 
852  return bWrapped;
853 }
854 
856 {
857  bool bRet = false;
858  size_t nOldLevel = mnFocusLevel;
859  size_t nOldEntry = mnFocusEntry;
860 
861  do
862  {
863  /* one level up, if backward from left header,
864  or one level down, if forward from right header */
865  if ( (!bForward) && (mnFocusEntry == SC_OL_HEADERENTRY) )
866  bRet |= ImplMoveFocusByLevel( bForward );
867  // move to next/previous entry
868  bool bWrapInLevel = ImplMoveFocusByEntry( bForward, false );
869  bRet |= bWrapInLevel;
870  /* one level up, if wrapped backward to right header,
871  or one level down, if wrapped forward to right header */
872  if ( bForward && bWrapInLevel )
873  bRet |= ImplMoveFocusByLevel( bForward );
874  }
875  while ( !IsFocusButtonVisible() && ((nOldLevel != mnFocusLevel) || (nOldEntry != mnFocusEntry)) );
876 
877  return bRet;
878 }
879 
881 {
882  // first try to find an entry in the same level
883  if ( !IsFocusButtonVisible() )
884  ImplMoveFocusByEntry( bForward, true );
885  // then try to find any other entry
886  if ( !IsFocusButtonVisible() )
887  ImplMoveFocusByTabOrder( bForward );
888 }
889 
891 {
892  HideFocus();
893  ImplMoveFocusByEntry( bForward, true );
894  ShowFocus();
895 }
896 
898 {
899  HideFocus();
900  ImplMoveFocusByLevel( bForward );
901  ShowFocus();
902 }
903 
905 {
906  HideFocus();
907  ImplMoveFocusByTabOrder( bForward );
908  ShowFocus();
909 }
910 
912 {
913  Window::GetFocus();
914  ShowFocus();
915 }
916 
918 {
919  HideFocus();
920  Window::LoseFocus();
921 }
922 
923 // mouse ----------------------------------------------------------------------
924 
925 void ScOutlineWindow::StartMouseTracking( size_t nLevel, size_t nEntry )
926 {
927  mbMTActive = true;
928  mnMTLevel = nLevel;
929  mnMTEntry = nEntry;
930  DrawBorderRel( nLevel, nEntry, true );
931 }
932 
934 {
935  if ( mbMTPressed )
936  DrawBorderRel( mnMTLevel, mnMTEntry, false );
937  mbMTActive = false;
938 }
939 
941 {
942  if ( IsMouseTracking() )
943  {
944  size_t nLevel, nEntry;
945  bool bHit = false;
946 
947  if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry ) )
948  bHit = (nLevel == mnMTLevel) && (nEntry == mnMTEntry);
949 
950  if ( bHit != mbMTPressed )
952  }
953 }
954 
956 {
957  if ( IsMouseTracking() )
958  {
960 
961  size_t nLevel, nEntry;
962  if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry ) )
963  if ( (nLevel == mnMTLevel) && (nEntry == mnMTEntry) )
964  DoFunction( nLevel, nEntry );
965  }
966 }
967 
969 {
970  size_t nLevel, nEntry;
971  bool bHit = ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry );
972  if ( bHit )
973  StartMouseTracking( nLevel, nEntry );
974  else if ( rMEvt.GetClicks() == 2 )
975  {
976  bHit = LineHit( rMEvt.GetPosPixel(), nLevel, nEntry );
977  if ( bHit )
978  DoFunction( nLevel, nEntry );
979  }
980 
981  // if an item has been hit and window is focused, move focus to this item
982  if ( bHit && HasFocus() )
983  {
984  HideFocus();
985  mnFocusLevel = nLevel;
986  mnFocusEntry = nEntry;
987  ShowFocus();
988  }
989 }
990 
991 // keyboard -------------------------------------------------------------------
992 
994 {
995  const vcl::KeyCode& rKCode = rKEvt.GetKeyCode();
996  bool bNoMod = !rKCode.GetModifier();
997  bool bShift = (rKCode.GetModifier() == KEY_SHIFT);
998  bool bCtrl = (rKCode.GetModifier() == KEY_MOD1);
999 
1000  sal_uInt16 nCode = rKCode.GetCode();
1001  bool bUpDownKey = (nCode == KEY_UP) || (nCode == KEY_DOWN);
1002  bool bLeftRightKey = (nCode == KEY_LEFT) || (nCode == KEY_RIGHT);
1003 
1004  // TAB key
1005  if ( (nCode == KEY_TAB) && (bNoMod || bShift) )
1006  // move forward without SHIFT key
1007  MoveFocusByTabOrder( bNoMod ); // TAB uses logical order, regardless of mirroring
1008 
1009  // LEFT/RIGHT/UP/DOWN keys
1010  else if ( bNoMod && (bUpDownKey || bLeftRightKey) )
1011  {
1012  bool bForward = (nCode == KEY_DOWN) || (nCode == KEY_RIGHT);
1013  if ( mbHoriz == bLeftRightKey )
1014  // move inside level with LEFT/RIGHT in horizontal and with UP/DOWN in vertical
1015  MoveFocusByEntry( bForward != mbMirrorEntries );
1016  else
1017  // move to next/prev level with LEFT/RIGHT in vertical and with UP/DOWN in horizontal
1018  MoveFocusByLevel( bForward != mbMirrorLevels );
1019  }
1020 
1021  // CTRL + number
1022  else if ( bCtrl && (nCode >= KEY_1) && (nCode <= KEY_9) )
1023  {
1024  size_t nLevel = static_cast< size_t >( nCode - KEY_1 );
1025  if ( nLevel < GetLevelCount() )
1026  DoFunction( nLevel, SC_OL_HEADERENTRY );
1027  }
1028 
1029  // other key codes
1030  else switch ( rKCode.GetFullCode() )
1031  {
1032  case KEY_ADD: DoExpand( mnFocusLevel, mnFocusEntry ); break;
1034  case KEY_SPACE:
1036  default: Window::KeyInput( rKEvt );
1037  }
1038 }
1039 
1040 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetClipRegion()
Size GetSizePixel() const
bool mbMirrorEntries
true = Horizontal orientation.
Definition: olinewin.hxx:38
const Wallpaper & GetBackground() const
size_t mnMTLevel
Last position of main area in entry direction.
Definition: olinewin.hxx:47
bool bVisible
bool IsButtonVisible(size_t nLevel, size_t nEntry) const
Returns true, if the button of the specified entry is visible in the window.
Definition: olinewin.cxx:354
SystemWindow * GetSystemWindow() const
ScVSplitPos WhichV(ScSplitPos ePos)
Definition: viewdata.hxx:709
constexpr sal_uInt16 KEY_MOD1
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
bool mbMirrorLevels
true = mirror the order of entries (including header)
Definition: olinewin.hxx:39
SC_DLLPUBLIC bool IsHidden() const
Definition: olinetab.hxx:49
const ScOutlineArray * GetOutlineArray() const
Returns the outline array of the corresponding document.
Definition: olinewin.cxx:158
void ScrollPixel(tools::Long nDiff)
Scrolls the window content by the specified amount of pixels.
Definition: olinewin.cxx:107
virtual void dispose() override
Definition: olinewin.cxx:75
bool mbHoriz
Which area in split window.
Definition: olinewin.hxx:37
void DrawLineRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the line.
Definition: olinewin.cxx:520
void SetHeaderSize(tools::Long nNewSize)
Sets the size of the header area (width/height dep.
Definition: olinewin.cxx:84
SC_DLLPUBLIC SCCOLROW GetEnd() const
Definition: olinetab.cxx:42
void InvertTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags)
const size_t SC_OL_HEADERENTRY
Definition: olinewin.cxx:38
size_t mnFocusLevel
Focus rectangle on screen.
Definition: olinewin.hxx:53
long Long
tools::Long GetColRowPos(SCCOLROW nColRowIndex) const
Returns the start coordinate of the specified column/row in the window.
Definition: olinewin.cxx:256
const StyleSettings & GetStyleSettings() const
ScHSplitPos WhichH(ScSplitPos ePos)
Definition: viewdata.hxx:703
const Color & GetFaceColor() const
void ScrollRel(tools::Long nEntryDiff, tools::Long nEntryStart, tools::Long nEntryEnd)
Scrolls the specified range of the window in entry-relative direction.
Definition: olinewin.cxx:139
bool ImplMoveFocusByEntry(bool bForward, bool bFindVisible)
Calculates index of next/previous focus button in the current level (no paint).
Definition: olinewin.cxx:762
ScOutlineEntry * GetEntry(size_t nLevel, size_t nIndex)
Definition: olinetab.cxx:442
sal_uInt16 GetCode() const
bool ImplMoveFocusByTabOrder(bool bForward)
Calculates position of focus button in tab order.
Definition: olinewin.cxx:855
DataChangedEventType GetType() const
bool IsHidden(SCCOLROW nColRowIndex) const
Returns true, if the column/row is hidden.
Definition: olinewin.cxx:171
void DoCollapse(size_t nLevel, size_t nEntry) const
Collapses the specified entry (does nothing with header entries).
Definition: olinewin.cxx:482
virtual void Resize() override
Definition: olinewin.cxx:489
bool IsMouseTracking() const
Returns whether mouse tracking mode is active.
Definition: olinewin.hxx:181
size_t mnMTEntry
Mouse tracking: Level of active button.
Definition: olinewin.hxx:48
constexpr sal_uInt16 KEY_SPACE
void EndMouseTracking()
Ends mouse tracking.
Definition: olinewin.cxx:933
virtual void dispose() override
constexpr sal_uInt16 KEY_ADD
const tools::Long SC_OL_POSOFFSET
Definition: olinewin.cxx:35
Color maLineColor
true = mirror the order of levels, including the border
Definition: olinewin.hxx:41
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1342
void DrawBorderRel(size_t nLevel, size_t nEntry, bool bPressed)
Draws a pressed or unpressed border.
Definition: olinewin.cxx:550
constexpr sal_uInt16 KEY_UP
ScSplitPos
Definition: viewdata.hxx:44
void ShowOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
Definition: dbfunc3.cxx:265
bool GetEntryIndex(size_t nLevel, SCCOLROW nPos, size_t &rnIndex) const
Definition: olinetab.cxx:495
constexpr sal_uInt16 KEY_9
bool IsEmpty() const
sal_uInt16 GetClicks() const
void SetBackground()
bool LineHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is over the line of an expanded group.
Definition: olinewin.cxx:450
bool GetEntryIndexInRange(size_t nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, size_t &rnIndex) const
Definition: olinetab.cxx:515
tools::Long GetDepthSize() const
Returns the width/height the window needs to show all levels.
Definition: olinewin.cxx:99
bool GetImagePos(size_t nLevel, size_t nEntry, Point &rPos) const
Calculates the absolute position of the image of the specified outline entry.
Definition: olinewin.cxx:336
void SetEntryAreaClipRegion()
Sets a clip region for the window area without header.
Definition: olinewin.cxx:513
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
void DrawRectRel(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd)
Converts coordinates to real window points and draws the rectangle.
Definition: olinewin.cxx:526
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
Definition: viewdata.cxx:2622
constexpr sal_uInt16 KEY_1
tools::Long mnMainFirstPos
Position of the header area in entry direction.
Definition: olinewin.hxx:44
size_t GetDepth() const
Definition: olinetab.hxx:110
AllSettingsFlags GetFlags() const
size_t mnFocusEntry
Level of focused button.
Definition: olinewin.hxx:54
Point GetPoint(tools::Long nLevelPos, tools::Long nEntryPos) const
Returns the point in the window of the specified position.
Definition: olinewin.cxx:210
bool ButtonHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry) const
Returns true, if rPos is inside of a button.
Definition: olinewin.cxx:443
virtual void LoseFocus() override
Definition: olinewin.cxx:917
void DoFunction(size_t nLevel, size_t nEntry) const
Performs an action with the specified item.
Definition: olinewin.cxx:457
ScViewData & mrViewData
Definition: olinewin.hxx:35
sal_uInt16 GetModifier() const
bool mbMTActive
Mouse tracking: Entry index of active button.
Definition: olinewin.hxx:49
void GetVisibleRange(SCCOLROW &rnColRowStart, SCCOLROW &rnColRowEnd) const
Returns the currently visible column/row range.
Definition: olinewin.cxx:192
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1356
void DrawLine(const Point &rStartPt, const Point &rEndPt)
sal_uInt16 nCode
tools::Long GetHeaderEntryPos() const
Returns the entry position of header images.
Definition: olinewin.cxx:264
void DrawRect(const tools::Rectangle &rRect)
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Definition: viewdata.cxx:2627
bool IsFiltered(SCCOLROW nColRowIndex) const
Returns true, if the column/row is filtered.
Definition: olinewin.cxx:178
constexpr sal_uInt16 KEY_DOWN
void SetLineColor()
void MoveFocusByEntry(bool bForward)
Focuses next/previous button in the current level.
Definition: olinewin.cxx:890
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4435
void HideFocus()
Erases the focus rectangle from the focused button.
Definition: olinewin.cxx:591
virtual void GetFocus() override
Definition: olinewin.cxx:911
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
Definition: viewdata.cxx:2314
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:968
SC_DLLPUBLIC SCCOLROW GetStart() const
Definition: olinetab.hxx:42
size_t GetLevelFromPos(tools::Long nLevelPos) const
Returns the level of the passed pixel position.
Definition: olinewin.cxx:247
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4489
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: olinewin.cxx:500
const ScOutlineArray & GetRowArray() const
Definition: olinetab.hxx:160
tools::Long GetOutputSizeLevel() const
Returns the window size for the level coordinate.
Definition: olinewin.cxx:221
const ScOutlineArray & GetColArray() const
Definition: olinetab.hxx:158
size_t GetCount(size_t nLevel) const
Definition: olinetab.cxx:470
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
tools::Rectangle maFocusRect
Mouse tracking: Button currently drawn pressed?
Definition: olinewin.hxx:52
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:940
void SetFillColor()
tools::Long Width() const
float u
size_t GetLevelCount() const
Returns the count of levels of the outline array.
Definition: olinewin.cxx:233
tools::Long mnMainLastPos
First position of main area in entry direction.
Definition: olinewin.hxx:45
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: olinewin.cxx:617
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
void SelectLevel(bool bColumns, sal_uInt16 nLevel, bool bRecord=true)
Definition: dbfunc3.cxx:231
ScDocument & GetDoc() const
Returns the calc document.
Definition: olinewin.hxx:81
tools::Long mnHeaderPos
Size of the header area in entry direction.
Definition: olinewin.hxx:43
const tools::Long SC_OL_BITMAPSIZE
Definition: olinewin.cxx:34
virtual ~ScOutlineWindow() override
Definition: olinewin.cxx:70
void ShowFocus()
Draws the focus rectangle into the focused button.
Definition: olinewin.cxx:566
constexpr sal_uInt16 KEY_RETURN
ScOutlineWindow(vcl::Window *pParent, ScOutlineMode eMode, ScViewData *pViewData, ScSplitPos eWhich)
Do not redraw focus in next Paint().
Definition: olinewin.cxx:40
ScDBFunc * GetView() const
Definition: viewdata.cxx:853
ScOutlineMode
Definition: olinewin.hxx:28
constexpr sal_uInt16 KEY_RIGHT
const size_t SC_OL_NOLEVEL
Definition: olinewin.cxx:37
bool mbDontDrawFocus
Entry index of focused button.
Definition: olinewin.hxx:55
bool IsFirstVisible(SCCOLROW nColRowIndex) const
Returns true, if all columns/rows before nColRowIndex are hidden.
Definition: olinewin.cxx:184
const vcl::KeyCode & GetKeyCode() const
bool mbMTPressed
Mouse tracking active?
Definition: olinewin.hxx:50
bool ImplMoveFocusByLevel(bool bForward)
Calculates position of focus button in next/previous level (no paint).
Definition: olinewin.cxx:804
bool IsFocusButtonVisible() const
Returns true, if the focused button is visible in the window.
Definition: olinewin.cxx:757
tools::Rectangle GetRectangle(tools::Long nLevelStart, tools::Long nEntryStart, tools::Long nLevelEnd, tools::Long nEntryEnd) const
Returns the rectangle in the window of the specified position.
Definition: olinewin.cxx:215
constexpr sal_uInt16 KEY_SUBTRACT
void HideOutline(bool bColumns, sal_uInt16 nLevel, sal_uInt16 nEntry, bool bRecord=true, bool bPaint=true)
Definition: dbfunc3.cxx:285
tools::Long mnHeaderSize
Line color for expanded groups.
Definition: olinewin.hxx:42
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
void InitSettings()
Initializes color and image settings.
Definition: olinewin.cxx:150
const Color & GetButtonTextColor() const
void DrawImageRel(tools::Long nLevelPos, tools::Long nEntryPos, const OUString &rId)
Draws the specified image unpressed.
Definition: olinewin.cxx:540
virtual void EnableRTL(bool bEnable=true) override
SC_DLLPUBLIC ScOutlineTable * GetOutlineTable(SCTAB nTab, bool bCreate=false)
Definition: documen3.cxx:735
tools::Long Height() const
tools::Long GetLevelPos(size_t nLevel) const
Returns the pixel position of the specified level.
Definition: olinewin.cxx:240
ScSplitPos meWhich
View data containing the document.
Definition: olinewin.hxx:36
void StartMouseTracking(size_t nLevel, size_t nEntry)
Starts mouse tracking after click on a button.
Definition: olinewin.cxx:925
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
SCTAB GetTab() const
Returns the current sheet index.
Definition: olinewin.hxx:83
const Point & GetPosPixel() const
sal_uInt16 GetFullCode() const
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:984
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4419
void MoveFocusByTabOrder(bool bForward)
Focuses next/previous button in tab order.
Definition: olinewin.cxx:904
OUString sId
const std::u16string_view aLevelBmps[]
Definition: olinewin.cxx:605
void MoveFocusByLevel(bool bForward)
Focuses button in next/previous level.
Definition: olinewin.cxx:897
void DoExpand(size_t nLevel, size_t nEntry) const
Expands the specified entry (does nothing with header entries).
Definition: olinewin.cxx:475
tools::Long GetOutputSizeEntry() const
Returns the window size for the entry coordinate.
Definition: olinewin.cxx:227
constexpr sal_uInt16 KEY_LEFT
const ScOutlineEntry * GetOutlineEntry(size_t nLevel, size_t nEntry) const
Returns the specified outline entry.
Definition: olinewin.cxx:165
constexpr sal_uInt16 KEY_SHIFT
bool GetEntryPos(size_t nLevel, size_t nEntry, tools::Long &rnStartPos, tools::Long &rnEndPos, tools::Long &rnImagePos) const
Calculates the coordinates the outline entry takes in the window.
Definition: olinewin.cxx:269
bool HasFocus() const
virtual void KeyInput(const KeyEvent &rKEvt) override
Definition: olinewin.cxx:993
static bool lcl_RotateValue(size_t &rnValue, size_t nMin, size_t nMax, bool bForward)
Increments or decrements a value and wraps at the specified limits.
Definition: olinewin.cxx:729
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: olinewin.cxx:955
SC_DLLPUBLIC bool IsVisible() const
Definition: olinetab.hxx:54
sal_uInt16 nPos
constexpr sal_uInt16 KEY_TAB
void ImplMoveFocusToVisible(bool bForward)
If the focused entry is invisible, tries to move to visible position.
Definition: olinewin.cxx:880
bool ItemHit(const Point &rPos, size_t &rnLevel, size_t &rnEntry, bool &rbButton) const
Returns true, if rPos is inside of a button or over the line of an expanded group.
Definition: olinewin.cxx:372