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