LibreOffice Module sc (master)  1
hdrcont.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 <sfx2/dispatch.hxx>
21 #include <vcl/commandevent.hxx>
22 #include <vcl/help.hxx>
23 #include <vcl/settings.hxx>
24 #include <svtools/colorcfg.hxx>
25 #include <osl/diagnose.h>
26 
27 #include <tabvwsh.hxx>
28 #include <hdrcont.hxx>
29 #include <dbdata.hxx>
30 #include <scmod.hxx>
31 #include <inputopt.hxx>
32 #include <gridmerg.hxx>
33 #include <document.hxx>
34 #include <markdata.hxx>
35 #include <tabview.hxx>
36 #include <viewdata.hxx>
37 #include <columnspanset.hxx>
38 
39 #define SC_DRAG_MIN 2
40 
41 // passes in paint
42 // (selection left/right must be first because the continuous lines
43 // are partly overwritten later)
44 
45 #define SC_HDRPAINT_SEL_BOTTOM 4
46 #define SC_HDRPAINT_BOTTOM 5
47 #define SC_HDRPAINT_TEXT 6
48 #define SC_HDRPAINT_COUNT 7
49 
51  SCCOLROW nNewSize, bool bNewVertical, ScTabView* pTab ) :
52  Window ( pParent ),
53  pSelEngine ( pSelectionEngine ),
54  aShowHelpTimer("sc HeaderControl Popover Timer"),
55  bVertical ( bNewVertical ),
56  nSize ( nNewSize ),
57  nMarkStart ( 0 ),
58  nMarkEnd ( 0 ),
59  bMarkRange ( false ),
60  bDragging ( false ),
61  nDragNo ( 0 ),
62  nDragStart ( 0 ),
63  nDragPos ( 0 ),
64  nTipVisible ( nullptr ),
65  bDragMoved ( false ),
66  bIgnoreMove ( false ),
67  bInRefMode ( false ),
68  pTabView ( pTab )
69 {
70  // RTL: no default mirroring for this window, the spreadsheet itself
71  // is also not mirrored
72  // mirror the vertical window for correct border drawing
73  // table layout depends on sheet format, not UI setting, so the
74  // borders of the vertical window have to be handled manually, too.
75  EnableRTL( false );
76 
77  aNormFont = GetFont();
78  aNormFont.SetTransparent( true );
82 
84  bBoldSet = true;
85  bAutoFilterSet = false;
86 
87  Size aSize = LogicToPixel( Size(
88  GetTextWidth("8888"),
89  GetTextHeight() ) );
90  aSize.AdjustWidth(4 ); // place for highlight border
91  aSize.AdjustHeight(3 );
92  SetSizePixel( aSize );
93 
94  nWidth = nSmallWidth = aSize.Width();
95  nBigWidth = LogicToPixel( Size( GetTextWidth("8888888"), 0 ) ).Width() + 5;
96 
97  aShowHelpTimer.SetInvokeHandler(LINK(this, ScHeaderControl, ShowDragHelpHdl));
98  aShowHelpTimer.SetTimeout(GetSettings().GetMouseSettings().GetDoubleClickTime());
99 
100  SetBackground();
101 }
102 
104 {
107 }
108 
110 {
111  OSL_ENSURE( bVertical, "SetWidth works only on row headers" );
112  if ( nNew != nWidth )
113  {
114  Size aSize( nNew, GetSizePixel().Height() );
115  SetSizePixel( aSize );
116 
117  nWidth = nNew;
118 
119  Invalidate();
120  }
121 }
122 
124 {
125 }
126 
128 {
129  bool bLayoutRTL = IsLayoutRTL();
130  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
131 
132  tools::Rectangle aRect( Point(0,0), GetOutputSizePixel() );
133  if ( bVertical )
134  {
135  aRect.SetTop( GetScrPos( nStart )-nLayoutSign ); // extra pixel for line at top of selection
136  aRect.SetBottom( GetScrPos( nEnd+1 )-nLayoutSign );
137  }
138  else
139  {
140  aRect.SetLeft( GetScrPos( nStart )-nLayoutSign ); // extra pixel for line left of selection
141  aRect.SetRight( GetScrPos( nEnd+1 )-nLayoutSign );
142  }
143  Invalidate(aRect);
144 }
145 
146 void ScHeaderControl::SetMark( bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd )
147 {
148  bool bEnabled = SC_MOD()->GetInputOptions().GetMarkHeader();
149  if (!bEnabled)
150  bNewSet = false;
151 
152  bool bOldSet = bMarkRange;
153  SCCOLROW nOldStart = nMarkStart;
154  SCCOLROW nOldEnd = nMarkEnd;
155  PutInOrder( nNewStart, nNewEnd );
156  bMarkRange = bNewSet;
157  nMarkStart = nNewStart;
158  nMarkEnd = nNewEnd;
159 
160  // Paint
161 
162  if ( bNewSet )
163  {
164  if ( bOldSet )
165  {
166  if ( nNewStart == nOldStart )
167  {
168  if ( nNewEnd != nOldEnd )
169  DoPaint( std::min( nNewEnd, nOldEnd ) + 1, std::max( nNewEnd, nOldEnd ) );
170  }
171  else if ( nNewEnd == nOldEnd )
172  DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewStart, nOldStart ) - 1 );
173  else if ( nNewStart > nOldEnd || nNewEnd < nOldStart )
174  {
175  // two areas
176  DoPaint( nOldStart, nOldEnd );
177  DoPaint( nNewStart, nNewEnd );
178  }
179  else // somehow overlapping... (it is not often)
180  DoPaint( std::min( nNewStart, nOldStart ), std::max( nNewEnd, nOldEnd ) );
181  }
182  else
183  DoPaint( nNewStart, nNewEnd ); // completely new selection
184  }
185  else if ( bOldSet )
186  DoPaint( nOldStart, nOldEnd ); // cancel selection
187 }
188 
190 {
191  tools::Long nScrPos;
192 
194  if (nEntryNo >= nSize)
195  nScrPos = nMax;
196  else
197  {
198  nScrPos = 0;
199  for (SCCOLROW i=GetPos(); i<nEntryNo && nScrPos<nMax; i++)
200  {
201  sal_uInt16 nAdd = GetEntrySize(i);
202  if (nAdd)
203  nScrPos += nAdd;
204  else
205  {
206  SCCOLROW nHidden = GetHiddenCount(i);
207  if (nHidden > 0)
208  i += nHidden - 1;
209  }
210  }
211  }
212 
213  if ( IsLayoutRTL() )
214  nScrPos = nMax - nScrPos - 2;
215 
216  return nScrPos;
217 }
218 
219 void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect )
220 {
221  // It is important for VCL to have few calls, that is why the outer lines are
222  // grouped together
223 
224  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
225  bool bHighContrast = rStyleSettings.GetHighContrastMode();
226  bool bDark = rStyleSettings.GetFaceColor().IsDark();
227  // Use the same distinction for bDark as in Window::DrawSelectionBackground
228 
229  Color aTextColor = rStyleSettings.GetButtonTextColor();
230  Color aSelTextColor = rStyleSettings.GetHighlightTextColor();
231  Color aAFilterTextColor = rStyleSettings.GetButtonTextColor();
232  aAFilterTextColor.Merge(COL_LIGHTBLUE, bDark ? 150 : 10); // color of filtered row numbers
233  aNormFont.SetColor( aTextColor );
234  aAutoFilterFont.SetColor(aAFilterTextColor);
235  if ( bHighContrast )
236  aBoldFont.SetColor( aTextColor );
237  else
238  aBoldFont.SetColor( aSelTextColor );
239 
240  if (bAutoFilterSet)
241  SetTextColor(aAFilterTextColor);
242  else
243  SetTextColor((bBoldSet && !bHighContrast) ? aSelTextColor : aTextColor);
244 
245  Color aSelLineColor = rStyleSettings.GetHighlightColor();
246  aSelLineColor.Merge( COL_BLACK, 0xe0 ); // darken just a little bit
247 
248  bool bLayoutRTL = IsLayoutRTL();
249  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
250  bool bMirrored = IsMirrored();
251 
252  OUString aString;
253  sal_uInt16 nBarSize;
254  Point aScrPos;
255  Size aTextSize;
256 
257  if (bVertical)
258  nBarSize = static_cast<sal_uInt16>(GetSizePixel().Width());
259  else
260  nBarSize = static_cast<sal_uInt16>(GetSizePixel().Height());
261 
262  SCCOLROW nPos = GetPos();
263 
264  tools::Long nPStart = bVertical ? rRect.Top() : rRect.Left();
265  tools::Long nPEnd = bVertical ? rRect.Bottom() : rRect.Right();
266 
267  tools::Long nTransStart = nPEnd + 1;
268  tools::Long nTransEnd = 0;
269 
270  tools::Long nInitScrPos = 0;
271  if ( bLayoutRTL )
272  {
273  tools::Long nTemp = nPStart; // swap nPStart / nPEnd
274  nPStart = nPEnd;
275  nPEnd = nTemp;
276  nTemp = nTransStart; // swap nTransStart / nTransEnd
277  nTransStart = nTransEnd;
278  nTransEnd = nTemp;
279  if ( bVertical ) // start loops from the end
280  nInitScrPos = GetSizePixel().Height() - 1;
281  else
282  nInitScrPos = GetSizePixel().Width() - 1;
283  }
284 
285  // complete the painting of the outer lines
286  // first find the end of the last cell
287 
288  tools::Long nLineEnd = nInitScrPos - nLayoutSign;
289 
290  for (SCCOLROW i=nPos; i<nSize; i++)
291  {
292  sal_uInt16 nSizePix = GetEntrySize( i );
293  if (nSizePix)
294  {
295  nLineEnd += nSizePix * nLayoutSign;
296 
297  if ( bMarkRange && i >= nMarkStart && i <= nMarkEnd )
298  {
299  tools::Long nLineStart = nLineEnd - ( nSizePix - 1 ) * nLayoutSign;
300  if ( nLineStart * nLayoutSign < nTransStart * nLayoutSign )
301  nTransStart = nLineStart;
302  if ( nLineEnd * nLayoutSign > nTransEnd * nLayoutSign )
303  nTransEnd = nLineEnd;
304  }
305 
306  if ( nLineEnd * nLayoutSign > nPEnd * nLayoutSign )
307  {
308  nLineEnd = nPEnd;
309  break;
310  }
311  }
312  else
313  {
314  SCCOLROW nHidden = GetHiddenCount(i);
315  if (nHidden > 0)
316  i += nHidden - 1;
317  }
318  }
319 
320  // background is different for entry area and behind the entries
321 
322  tools::Rectangle aFillRect;
323  GetOutDev()->SetLineColor();
324 
325  if ( nLineEnd * nLayoutSign >= nInitScrPos * nLayoutSign )
326  {
327  GetOutDev()->SetFillColor( rStyleSettings.GetFaceColor() );
328  if ( bVertical )
329  aFillRect = tools::Rectangle( 0, nInitScrPos, nBarSize-1, nLineEnd );
330  else
331  aFillRect = tools::Rectangle( nInitScrPos, 0, nLineEnd, nBarSize-1 );
332  GetOutDev()->DrawRect( aFillRect );
333  }
334 
335  if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign )
336  {
337  GetOutDev()->SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor );
338  if ( bVertical )
339  aFillRect = tools::Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-1, nPEnd );
340  else
341  aFillRect = tools::Rectangle( nLineEnd+nLayoutSign, 0, nPEnd, nBarSize-1 );
342  GetOutDev()->DrawRect( aFillRect );
343  }
344 
345  if ( nLineEnd * nLayoutSign >= nPStart * nLayoutSign )
346  {
347  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign )
348  {
349  if (bVertical)
350  aFillRect = tools::Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
351  else
352  aFillRect = tools::Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
353 
354  if ( bHighContrast )
355  {
356  if ( bDark )
357  {
358  // solid grey background for dark face color is drawn before lines
359  GetOutDev()->SetLineColor();
361  GetOutDev()->DrawRect( aFillRect );
362  }
363  }
364  else
365  {
366  // background for selection
367  GetOutDev()->SetLineColor();
368  GetOutDev()->SetFillColor( rStyleSettings.GetHighlightColor() );
369  GetOutDev()->DrawRect( aFillRect );
370  }
371  }
372 
373  GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() );
374  if (bVertical)
375  {
376  tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
377  GetOutDev()->DrawLine( Point( nDarkPos, nPStart ), Point( nDarkPos, nLineEnd ) );
378  }
379  else
380  GetOutDev()->DrawLine( Point( nPStart, nBarSize-1 ), Point( nLineEnd, nBarSize-1 ) );
381 
382  // line in different color for selection
383  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
384  {
385  GetOutDev()->SetLineColor( aSelLineColor );
386  if (bVertical)
387  {
388  tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
389  GetOutDev()->DrawLine( Point( nDarkPos, nTransStart ), Point( nDarkPos, nTransEnd ) );
390  }
391  else
392  GetOutDev()->DrawLine( Point( nTransStart, nBarSize-1 ), Point( nTransEnd, nBarSize-1 ) );
393  }
394  }
395 
396  // tdf#89841 Use blue row numbers when Autofilter selected
397  std::vector<sc::ColRowSpan> aSpans;
398  if (bVertical && pTabView)
399  {
400  SCTAB nTab = pTabView->GetViewData().GetTabNo();
402 
403  ScDBData* pDBData = rDoc.GetAnonymousDBData(nTab);
404  if (pDBData && pDBData->HasAutoFilter())
405  {
406  SCSIZE nSelected = 0;
407  SCSIZE nTotal = 0;
408  pDBData->GetFilterSelCount(nSelected, nTotal);
409  if (nTotal > nSelected)
410  {
411  ScRange aRange;
412  pDBData->GetArea(aRange);
413  SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
414  SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
415  if (pDBData->HasHeader())
416  nStartRow++;
417  aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
418  }
419  }
420 
421  ScDBCollection* pDocColl = rDoc.GetDBCollection();
422  if (!pDocColl->empty())
423  {
424  ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
425  for (const auto& rxDB : rDBs)
426  {
427  if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
428  {
429  SCSIZE nSelected = 0;
430  SCSIZE nTotal = 0;
431  rxDB->GetFilterSelCount(nSelected, nTotal);
432  if (nTotal > nSelected)
433  {
434  ScRange aRange;
435  rxDB->GetArea(aRange);
436  SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
437  SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
438  if (rxDB->HasHeader())
439  nStartRow++;
440  aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
441  }
442  }
443  }
444  }
445  }
446 
447  // loop through entries several times to avoid changing the line color too often
448  // and to allow merging of lines
449 
450  ScGridMerger aGrid( GetOutDev(), 1, 1 );
451 
452  // start at SC_HDRPAINT_BOTTOM instead of 0 - selection doesn't get different
453  // borders, light border at top isn't used anymore
454  // use SC_HDRPAINT_SEL_BOTTOM for different color
455 
456  for (sal_uInt16 nPass = SC_HDRPAINT_SEL_BOTTOM; nPass < SC_HDRPAINT_COUNT; nPass++)
457  {
458  // set line color etc. before entry loop
459  switch ( nPass )
460  {
462  // same as non-selected for high contrast
463  GetOutDev()->SetLineColor( bHighContrast ? rStyleSettings.GetDarkShadowColor() : aSelLineColor );
464  break;
465  case SC_HDRPAINT_BOTTOM:
466  GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() );
467  break;
468  case SC_HDRPAINT_TEXT:
469  // DrawSelectionBackground is used only for high contrast on light background
470  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && bHighContrast && !bDark )
471  {
472  // Transparent selection background is drawn after lines, before text.
473  // Use DrawSelectionBackground to make sure there is a visible
474  // difference. The case of a dark face color, where DrawSelectionBackground
475  // would just paint over the lines, is handled separately (bDark).
476  // Otherwise, GetHighlightColor is used with 80% transparency.
477  // The window's background color (SetBackground) has to be the background
478  // of the cell area, for the contrast comparison in DrawSelectionBackground.
479 
480  tools::Rectangle aTransRect;
481  if (bVertical)
482  aTransRect = tools::Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
483  else
484  aTransRect = tools::Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
485  SetBackground( rStyleSettings.GetFaceColor() );
486  DrawSelectionBackground( aTransRect, 0, true, false );
487  SetBackground();
488  }
489  break;
490  }
491 
492  SCCOLROW nCount=0;
493  tools::Long nScrPos=nInitScrPos;
494  do
495  {
496  if (bVertical)
497  aScrPos = Point( 0, nScrPos );
498  else
499  aScrPos = Point( nScrPos, 0 );
500 
501  SCCOLROW nEntryNo = nCount + nPos;
502  if ( nEntryNo >= nSize ) // rDoc.MaxCol()/rDoc.MaxRow()
503  nScrPos = nPEnd + nLayoutSign; // beyond nPEnd -> stop
504  else
505  {
506  sal_uInt16 nSizePix = GetEntrySize( nEntryNo );
507 
508  if (nSizePix == 0)
509  {
510  SCCOLROW nHidden = GetHiddenCount(nEntryNo);
511  if (nHidden > 0)
512  nCount += nHidden - 1;
513  }
514  else if ((nScrPos+nSizePix*nLayoutSign)*nLayoutSign >= nPStart*nLayoutSign)
515  {
516  Point aEndPos(aScrPos);
517  if (bVertical)
518  aEndPos = Point( aScrPos.X()+nBarSize-1, aScrPos.Y()+(nSizePix-1)*nLayoutSign );
519  else
520  aEndPos = Point( aScrPos.X()+(nSizePix-1)*nLayoutSign, aScrPos.Y()+nBarSize-1 );
521 
522  bool bMark = bMarkRange && nEntryNo >= nMarkStart && nEntryNo <= nMarkEnd;
523  bool bNextToMark = bMarkRange && nEntryNo + 1 >= nMarkStart && nEntryNo <= nMarkEnd;
524 
525  switch ( nPass )
526  {
528  case SC_HDRPAINT_BOTTOM:
529  if ( nPass == ( bNextToMark ? SC_HDRPAINT_SEL_BOTTOM : SC_HDRPAINT_BOTTOM ) )
530  {
531  if (bVertical)
532  aGrid.AddHorLine(/* here we work in pixels */ true, aScrPos.X(), aEndPos.X(), aEndPos.Y());
533  else
534  aGrid.AddVerLine(/* here we work in pixels */ true, aEndPos.X(), aScrPos.Y(), aEndPos.Y());
535 
536  // thick bottom for hidden rows
537  // (drawn directly, without aGrid)
538  if ( nEntryNo+1 < nSize )
539  if ( GetEntrySize(nEntryNo+1)==0 )
540  {
541  if (bVertical)
542  GetOutDev()->DrawLine( Point(aScrPos.X(),aEndPos.Y()-nLayoutSign),
543  Point(aEndPos.X(),aEndPos.Y()-nLayoutSign) );
544  else
545  GetOutDev()->DrawLine( Point(aEndPos.X()-nLayoutSign,aScrPos.Y()),
546  Point(aEndPos.X()-nLayoutSign,aEndPos.Y()) );
547  }
548  }
549  break;
550 
551  case SC_HDRPAINT_TEXT:
552  if ( nSizePix > 1 ) // minimal check for small columns/rows
553  {
554  if (bVertical)
555  {
556  bool bAutoFilterPos = false;
557  for (const auto& rSpan : aSpans)
558  {
559  if (nEntryNo >= rSpan.mnStart && nEntryNo <= rSpan.mnEnd)
560  {
561  bAutoFilterPos = true;
562  break;
563  }
564  }
565 
566  if (bMark != bBoldSet || bAutoFilterPos != bAutoFilterSet)
567  {
568  if (bMark)
570  else if (bAutoFilterPos)
572  else
574  bBoldSet = bMark;
575  bAutoFilterSet = bAutoFilterPos && !bMark;
576  }
577  }
578  else
579  {
580  if (bMark != bBoldSet)
581  {
582  if (bMark)
584  else
586  bBoldSet = bMark;
587  }
588  }
589 
590  aString = GetEntryText( nEntryNo );
591  aTextSize.setWidth( GetTextWidth( aString ) );
592  aTextSize.setHeight( GetTextHeight() );
593 
594  Point aTxtPos(aScrPos);
595  if (bVertical)
596  {
597  aTxtPos.AdjustX((nBarSize-aTextSize.Width())/2 );
598  aTxtPos.AdjustY((nSizePix*nLayoutSign-aTextSize.Height())/2 );
599  if ( bMirrored )
600  aTxtPos.AdjustX(1 ); // dark border is left instead of right
601  }
602  else
603  {
604  aTxtPos.AdjustX((nSizePix*nLayoutSign-aTextSize.Width()+1)/2 );
605  aTxtPos.AdjustY((nBarSize-aTextSize.Height())/2 );
606  }
607  GetOutDev()->DrawText( aTxtPos, aString );
608  }
609  break;
610  }
611 
612  // when selecting the complete row/column:
613  // InvertRect( Rectangle( aScrPos, aEndPos ) );
614  }
615  nScrPos += nSizePix * nLayoutSign; // also if before the visible area
616  }
617  ++nCount;
618  }
619  while ( nScrPos * nLayoutSign <= nPEnd * nLayoutSign );
620 
621  aGrid.Flush();
622  }
623 }
624 
625 SCCOLROW ScHeaderControl::GetMousePos(const Point& rPos, bool& rBorder) const
626 {
627  bool bFound = false;
628  SCCOLROW nPos = GetPos();
629  SCCOLROW nHitNo = nPos;
630  SCCOLROW nEntryNo = 1 + nPos;
631  tools::Long nScrPos;
632  tools::Long nMousePos = bVertical ? rPos.Y() : rPos.X();
633  tools::Long nDif;
634  Size aSize = GetOutputSizePixel();
635  tools::Long nWinSize = bVertical ? aSize.Height() : aSize.Width();
636 
637  bool bLayoutRTL = IsLayoutRTL();
638  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
639  tools::Long nEndPos = bLayoutRTL ? -1 : nWinSize;
640 
641  nScrPos = GetScrPos( nPos ) - nLayoutSign;
642  do
643  {
644  if (nEntryNo > nSize)
645  nScrPos = nEndPos + nLayoutSign;
646  else
647  nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign;
648 
649  nDif = nMousePos - nScrPos;
650  if (nDif >= -2 && nDif <= 2)
651  {
652  bFound = true;
653  nHitNo=nEntryNo-1;
654  }
655  else if (nDif * nLayoutSign >= 0 && nEntryNo < nSize)
656  nHitNo = nEntryNo;
657  ++nEntryNo;
658  }
659  while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
660 
661  rBorder = bFound;
662  return nHitNo;
663 }
664 
666 {
667  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
668  if (!pViewSh)
669  return false;
670 
671  ScViewData& rViewData = pViewSh->GetViewData();
672  sal_uInt16 nTab = rViewData.GetTabNo();
673  ScDocument& rDoc = rViewData.GetDocument();
674  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
675  bool bSelectAllowed = true;
676  if ( pProtect && pProtect->isProtected() )
677  {
678  // This sheet is protected. Check if a context menu is allowed on this cell.
679  bool bCellsProtected = false;
680  if (bVertical)
681  {
682  // row header
683  SCROW nRPos = static_cast<SCROW>(nPos);
684  bCellsProtected = rDoc.HasAttrib(0, nRPos, nTab, rDoc.MaxCol(), nRPos, nTab, HasAttrFlags::Protected);
685  }
686  else
687  {
688  // column header
689  SCCOL nCPos = static_cast<SCCOL>(nPos);
690  bCellsProtected = rDoc.HasAttrib(nCPos, 0, nTab, nCPos, rDoc.MaxRow(), nTab, HasAttrFlags::Protected);
691  }
692 
693  bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
694  bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
695 
696  if (bCellsProtected)
697  bSelectAllowed = bSelProtected;
698  else
699  bSelectAllowed = bSelUnprotected;
700  }
701  return bSelectAllowed;
702 }
703 
705 {
706  if (IsDisabled())
707  return;
708 
709  bIgnoreMove = false;
710  SelectWindow();
711 
712  bool bIsBorder;
713  SCCOLROW nHitNo = GetMousePos(rMEvt.GetPosPixel(), bIsBorder);
714  if (!IsSelectionAllowed(nHitNo))
715  return;
716  if ( ! rMEvt.IsLeft() )
717  return;
718  if ( SC_MOD()->IsFormulaMode() )
719  {
720  if( !pTabView )
721  return;
722  SCTAB nTab = pTabView->GetViewData().GetTabNo();
723  if( !rMEvt.IsShift() )
724  pTabView->DoneRefMode( rMEvt.IsMod1() );
725  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
726  ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
727  if( !bVertical )
728  {
729  pTabView->InitRefMode( nHitNo, 0, nTab, SC_REFTYPE_REF );
730  pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
731  }
732  else
733  {
734  pTabView->InitRefMode( 0, nHitNo, nTab, SC_REFTYPE_REF );
735  pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
736  }
737  bInRefMode = true;
738  return;
739  }
740  if ( bIsBorder && ResizeAllowed() )
741  {
742  nDragNo = nHitNo;
743  sal_uInt16 nClicks = rMEvt.GetClicks();
744  if ( nClicks && nClicks%2==0 )
745  {
747  SetPointer( PointerStyle::Arrow );
748  }
749  else
750  {
751  if (bVertical)
752  nDragStart = rMEvt.GetPosPixel().Y();
753  else
754  nDragStart = rMEvt.GetPosPixel().X();
756  // tdf#140833 launch help tip to show after the double click time has expired
757  // so under gtk the popover isn't active when the double click is processed
758  // by gtk because under load on wayland the double click is getting handled
759  // by something else and getting sent to the window underneath our window
761  DrawInvert( nDragPos );
762 
763  StartTracking();
764  bDragging = true;
765  bDragMoved = false;
766  }
767  }
768  else
769  {
770  pSelEngine->SetWindow( this );
772  if (bVertical)
773  {
774  aVis.SetLeft( LONG_MIN );
775  aVis.SetRight( LONG_MAX );
776  }
777  else
778  {
779  aVis.SetTop( LONG_MIN );
780  aVis.SetBottom( LONG_MAX );
781  }
782  pSelEngine->SetVisibleArea( aVis );
783 
784  SetMarking( true ); // must precede SelMouseButtonDown
785  pSelEngine->SelMouseButtonDown( rMEvt );
786 
787  // In column/row headers a simple click already is a selection.
788  // -> Call SelMouseMove to ensure CreateAnchor is called (and DestroyAnchor
789  // if the next click is somewhere else with Control key).
790  pSelEngine->SelMouseMove( rMEvt );
791 
792  if (IsMouseCaptured())
793  {
794  // tracking instead of CaptureMouse, so it can be cancelled cleanly
796  ReleaseMouse();
797  StartTracking();
798  }
799  }
800 }
801 
803 {
804  if ( IsDisabled() )
805  return;
806 
807  if ( SC_MOD()->IsFormulaMode() )
808  {
809  SC_MOD()->EndReference();
810  bInRefMode = false;
811  return;
812  }
813 
814  SetMarking( false );
815  bIgnoreMove = false;
816 
817  if ( bDragging )
818  {
819  DrawInvert( nDragPos );
820  ReleaseMouse();
821  HideDragHelp();
822  bDragging = false;
823 
824  tools::Long nScrPos = GetScrPos( nDragNo );
825  tools::Long nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
826  bool bLayoutRTL = IsLayoutRTL();
827  tools::Long nNewWidth = bLayoutRTL ? ( nScrPos - nMousePos + 1 )
828  : ( nMousePos + 2 - nScrPos );
829 
830  if ( nNewWidth < 0 /* && !IsSelected(nDragNo) */ )
831  {
832  SCCOLROW nStart = 0;
833  SCCOLROW nEnd = nDragNo;
834  while (nNewWidth < 0)
835  {
836  nStart = nDragNo;
837  if (nDragNo>0)
838  {
839  --nDragNo;
840  nNewWidth += GetEntrySize( nDragNo );
841  }
842  else
843  nNewWidth = 0;
844  }
845  HideEntries( nStart, nEnd );
846  }
847  else
848  {
849  if (bDragMoved)
850  SetEntrySize( nDragNo, static_cast<sal_uInt16>(nNewWidth) );
851  }
852  }
853  else
854  {
855  pSelEngine->SelMouseButtonUp( rMEvt );
856  ReleaseMouse();
857  }
858 }
859 
861 {
862  if ( IsDisabled() )
863  {
864  SetPointer( PointerStyle::Arrow );
865  return;
866  }
867 
868  if ( bInRefMode && rMEvt.IsLeft() && SC_MOD()->IsFormulaMode() )
869  {
870  if( !pTabView )
871  return;
872  bool bTmp;
873  SCCOLROW nHitNo = GetMousePos(rMEvt.GetPosPixel(), bTmp);
874  SCTAB nTab = pTabView->GetViewData().GetTabNo();
875  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
876  ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
877  if( !bVertical )
878  pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
879  else
880  pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
881 
882  return;
883  }
884 
885  if ( bDragging )
886  {
887  tools::Long nNewPos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
888  if ( nNewPos != nDragPos )
889  {
890  DrawInvert( nDragPos );
891  nDragPos = nNewPos;
892  ShowDragHelp();
893  DrawInvert( nDragPos );
894 
895  if (nDragPos <= nDragStart-SC_DRAG_MIN || nDragPos >= nDragStart+SC_DRAG_MIN)
896  bDragMoved = true;
897  }
898  }
899  else
900  {
901  bool bIsBorder;
902  (void)GetMousePos(rMEvt.GetPosPixel(), bIsBorder);
903 
904  if ( bIsBorder && rMEvt.GetButtons()==0 && ResizeAllowed() )
905  SetPointer( bVertical ? PointerStyle::VSizeBar : PointerStyle::HSizeBar );
906  else
907  SetPointer( PointerStyle::Arrow );
908 
909  if (!bIgnoreMove)
910  pSelEngine->SelMouseMove( rMEvt );
911  }
912 }
913 
915 {
916  // Distribute the tracking events to the various MouseEvents, because
917  // SelectionEngine does not know anything about Tracking
918 
919  if ( rTEvt.IsTrackingCanceled() )
920  StopMarking();
921  else if ( rTEvt.IsTrackingEnded() )
922  MouseButtonUp( rTEvt.GetMouseEvent() );
923  else
924  MouseMove( rTEvt.GetMouseEvent() );
925 }
926 
928 {
929  CommandEventId nCmd = rCEvt.GetCommand();
930  if ( nCmd == CommandEventId::ContextMenu )
931  {
932  StopMarking(); // finish selection / dragging
933 
934  // execute popup menu
935 
936  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() );
937  if ( pViewSh )
938  {
939  if ( rCEvt.IsMouseEvent() )
940  {
941  // #i18735# select the column/row under the mouse pointer
942  ScViewData& rViewData = pViewSh->GetViewData();
943 
944  SelectWindow(); // also deselects drawing objects, stops draw text edit
945  if ( rViewData.HasEditView( rViewData.GetActivePart() ) )
946  SC_MOD()->InputEnterHandler(); // always end edit mode
947 
948  bool bBorder;
949  SCCOLROW nPos = GetMousePos(rCEvt.GetMousePosPixel(), bBorder );
950  if (!IsSelectionAllowed(nPos))
951  // Selecting this cell is not allowed, neither is context menu.
952  return;
953 
954  SCTAB nTab = rViewData.GetTabNo();
955  ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
956  ScRange aNewRange;
957  if ( bVertical )
958  aNewRange = ScRange( 0, sal::static_int_cast<SCROW>(nPos), nTab,
959  rDoc.MaxCol(), sal::static_int_cast<SCROW>(nPos), nTab );
960  else
961  aNewRange = ScRange( sal::static_int_cast<SCCOL>(nPos), 0, nTab,
962  sal::static_int_cast<SCCOL>(nPos), rDoc.MaxRow(), nTab );
963 
964  // see if any part of the range is already selected
965  ScRangeList aRanges;
966  rViewData.GetMarkData().FillRangeListWithMarks( &aRanges, false );
967  bool bSelected = aRanges.Intersects(aNewRange);
968 
969  // select the range if no part of it was selected
970  if ( !bSelected )
971  pViewSh->MarkRange( aNewRange );
972  }
973 
974  pViewSh->GetDispatcher()->ExecutePopup( bVertical ? OUString( "rowheader" ) : OUString( "colheader" ) );
975  }
976  }
977  else if ( nCmd == CommandEventId::StartDrag )
978  {
979  pSelEngine->Command( rCEvt );
980  }
981 }
982 
984 {
985  if ( bDragging )
986  {
987  DrawInvert( nDragPos );
988  HideDragHelp();
989  bDragging = false;
990  }
991 
992  SetMarking( false );
993  bIgnoreMove = true;
994 
995  // don't call pSelEngine->Reset, so selection across the parts of
996  // a split/frozen view is possible
997  if (IsMouseCaptured())
998  ReleaseMouse();
999 }
1000 
1001 IMPL_LINK_NOARG(ScHeaderControl, ShowDragHelpHdl, Timer*, void)
1002 {
1003  ShowDragHelp();
1004 }
1005 
1007 {
1008  aShowHelpTimer.Stop();
1009  if (!Help::IsQuickHelpEnabled())
1010  return;
1011 
1012  tools::Long nScrPos = GetScrPos( nDragNo );
1013  bool bLayoutRTL = IsLayoutRTL();
1014  tools::Long nVal = bLayoutRTL ? ( nScrPos - nDragPos + 1 )
1015  : ( nDragPos + 2 - nScrPos );
1016 
1017  OUString aHelpStr = GetDragHelp( nVal );
1018  Point aPos = OutputToScreenPixel( Point(0,0) );
1019  Size aSize = GetSizePixel();
1020 
1022 
1023  tools::Rectangle aRect;
1024  QuickHelpFlags nAlign;
1025  if (!bVertical)
1026  {
1027  // above
1028  aRect.SetLeft( aMousePos.X() );
1029  aRect.SetTop( aPos.Y() - 4 );
1030  nAlign = QuickHelpFlags::Bottom|QuickHelpFlags::Center;
1031  }
1032  else
1033  {
1034  // top right
1035  aRect.SetLeft( aPos.X() + aSize.Width() + 8 );
1036  aRect.SetTop( aMousePos.Y() - 2 );
1037  nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom;
1038  }
1039 
1040  aRect.SetRight( aRect.Left() );
1041  aRect.SetBottom( aRect.Top() );
1042 
1043  if (nTipVisible)
1045  nTipVisible = Help::ShowPopover(this, aRect, aHelpStr, nAlign);
1046 }
1047 
1049 {
1050  aShowHelpTimer.Stop();
1051  if (nTipVisible)
1052  {
1054  nTipVisible = nullptr;
1055  }
1056 }
1057 
1059 {
1060  // If the own QuickHelp is displayed, don't let RequestHelp remove it
1061 
1062  bool bOwn = bDragging && Help::IsQuickHelpEnabled();
1063  if (!bOwn)
1064  Window::RequestHelp(rHEvt);
1065 }
1066 
1067 // dummies for virtual methods
1068 
1070 {
1071  SCCOLROW nHidden = 0;
1072  while ( nEntryNo < nSize && GetEntrySize( nEntryNo ) == 0 )
1073  {
1074  ++nEntryNo;
1075  ++nHidden;
1076  }
1077  return nHidden;
1078 }
1079 
1081 {
1082  return false;
1083 }
1084 
1086 {
1087  return false;
1088 }
1089 
1091 {
1092  return false;
1093 }
1094 
1096 {
1097  return true;
1098 }
1099 
1101 {
1102 }
1103 
1105 {
1106 }
1107 
1109 {
1110  return OUString();
1111 }
1112 
1113 void ScHeaderControl::SetMarking( bool /* bSet */ )
1114 {
1115 }
1116 
1118 {
1119  rStart = nMarkStart;
1120  rEnd = nMarkEnd;
1121 }
1122 
1123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3135
tools::Long GetTextHeight() const
#define SC_HDRPAINT_BOTTOM
Definition: hdrcont.cxx:46
bool SelMouseButtonDown(const MouseEvent &rMEvt)
void InitRefMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScRefType eType)
Definition: tabview4.cxx:309
void HideDragHelp()
Definition: hdrcont.cxx:1048
void SetBackground()
#define HDR_SIZE_OPTIMUM
Definition: hdrcont.hxx:26
bool HasAutoFilter() const
Definition: dbdata.hxx:204
Point GetPointerPosPixel()
bool bIgnoreMove
Definition: hdrcont.hxx:64
ScHeaderControl(vcl::Window *pParent, SelectionEngine *pSelectionEngine, SCCOLROW nNewSize, bool bNewVertical, ScTabView *pTab)
Definition: hdrcont.cxx:50
SC_DLLPUBLIC ScDBCollection * GetDBCollection() const
Definition: document.hxx:825
ScAddress aStart
Definition: address.hxx:497
SCCOLROW nDragNo
Definition: hdrcont.hxx:58
tools::Long nWidth
Definition: hdrcont.hxx:47
void GetFilterSelCount(SCSIZE &nSelected, SCSIZE &nTotal)
Definition: dbdata.cxx:973
virtual bool IsDisabled() const
Definition: hdrcont.cxx:1090
void * nTipVisible
Definition: hdrcont.hxx:61
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:308
SCROW Row() const
Definition: address.hxx:274
void setWidth(tools::Long nWidth)
CommandEventId
void Merge(const Color &rMergeColor, sal_uInt8 cTransparency)
virtual void EnableRTL(bool bEnable=true)
virtual bool IsMirrored() const
Definition: hdrcont.cxx:1085
const Color & GetHighlightTextColor() const
bool HasHeader() const
Definition: dbdata.hxx:130
constexpr tools::Long Left() const
void MarkRange(const ScRange &rRange, bool bSetCursor=true, bool bContinue=false)
Definition: tabview3.cxx:1689
sheet protection state container
void AddVerLine(bool bWorksInPixels, tools::Long nX, tools::Long nY1, tools::Long nY2, bool bDashed=false)
Definition: gridmerg.cxx:140
void DoneRefMode(bool bContinue=false)
Definition: tabview4.cxx:159
long Long
const StyleSettings & GetStyleSettings() const
const Color & GetFaceColor() const
tools::Long GetScrPos(SCCOLROW nEntryNo) const
Definition: hdrcont.cxx:189
virtual void dispose() override
Definition: hdrcont.cxx:103
tools::Long nSmallWidth
Definition: hdrcont.hxx:48
virtual Size GetSizePixel() const
virtual void SetSizePixel(const Size &rNewSize)
void FillRangeListWithMarks(ScRangeList *pList, bool bClear, SCTAB nForTab=-1) const
Create a range list of marks.
Definition: markdata.cxx:372
void SetWeight(FontWeight)
bool IsShift() const
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:582
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
void SetMark(bool bNewSet, SCCOLROW nNewStart, SCCOLROW nNewEnd)
Definition: hdrcont.cxx:146
void GetMarkRange(SCCOLROW &rStart, SCCOLROW &rEnd) const
Definition: hdrcont.cxx:1117
ScAddress aEnd
Definition: address.hxx:498
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
virtual void dispose() override
bool IsSelectionAllowed(SCCOLROW nPos) const
Definition: hdrcont.cxx:665
SCCOLROW nSize
Definition: hdrcont.hxx:51
virtual void DrawInvert(tools::Long nDragPos)
Definition: hdrcont.cxx:1104
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5264
void ExecutePopup(const OUString &rResName, vcl::Window *pWin=nullptr, const Point *pPos=nullptr)
void SetTextColor(const Color &rColor)
const Color & GetHighlightColor() const
WEIGHT_BOLD
constexpr tools::Long Width() const
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:802
sal_uInt16 GetClicks() const
bool isOptionEnabled(Option eOption) const
SelectionEngine * pSelEngine
Definition: hdrcont.hxx:37
void StopMarking()
Definition: hdrcont.cxx:983
sal_uInt16 GetButtons() const
tools::Long nDragStart
Definition: hdrcont.hxx:59
virtual OUString GetDragHelp(tools::Long nVal)
Definition: hdrcont.cxx:1108
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:891
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
bool IsMouseEvent() const
int nCount
static SfxViewShell * Current()
static void * ShowPopover(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rText, QuickHelpFlags nStyle)
bool GetHighContrastMode() const
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: hdrcont.cxx:914
void DoPaint(SCCOLROW nStart, SCCOLROW nEnd)
Definition: hdrcont.cxx:127
void DrawLine(const Point &rStartPt, const Point &rEndPt)
ScViewData & GetViewData()
Definition: tabview.hxx:333
void DrawRect(const tools::Rectangle &rRect)
void AddHorLine(bool bWorksInPixels, tools::Long nX1, tools::Long nX2, tools::Long nY, bool bDashed=false)
Definition: gridmerg.cxx:96
void PutInOrder(T &nStart, T &nEnd)
Definition: address.hxx:150
constexpr void SetLeft(tools::Long v)
const Color & GetDarkShadowColor() const
SCCOLROW nMarkEnd
Definition: hdrcont.hxx:54
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:890
void SetLineColor()
virtual bool IsLayoutRTL() const
Definition: hdrcont.cxx:1080
Point LogicToPixel(const Point &rLogicPt) const
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: hdrcont.cxx:1058
static void HidePopover(vcl::Window const *pParent, void *nId)
SfxDispatcher * GetDispatcher() const
virtual void SetMarking(bool bSet)
Definition: hdrcont.cxx:1113
int i
virtual SCCOLROW GetHiddenCount(SCCOLROW nEntryNo) const
Definition: hdrcont.cxx:1069
void ShowDragHelp()
Definition: hdrcont.cxx:1006
bool empty() const
Definition: dbdata.cxx:1603
bool IsDark() const
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
sal_Int16 SCCOL
Definition: types.hxx:21
bool SelMouseMove(const MouseEvent &rMEvt)
#define SC_MOD()
Definition: scmod.hxx:249
static bool IsQuickHelpEnabled()
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
bool SelMouseButtonUp(const MouseEvent &rMEvt)
QuickHelpFlags
void SetWidth(tools::Long nNew)
Definition: hdrcont.cxx:109
IMPL_LINK_NOARG(ScHeaderControl, ShowDragHelpHdl, Timer *, void)
Definition: hdrcont.cxx:1001
constexpr tools::Long Right() const
void SetFillColor()
const AllSettings & GetSettings() const
CommandEventId GetCommand() const
virtual void Start(bool bStartTimer=true) override
SCCOLROW nMarkStart
Definition: hdrcont.hxx:53
virtual void Command(const CommandEvent &rCEvt) override
Definition: hdrcont.cxx:927
ScTabView * pTabView
Definition: hdrcont.hxx:79
constexpr tools::Long Top() const
bool IsMouseCaptured() const
constexpr void SetRight(tools::Long v)
constexpr void SetBottom(tools::Long v)
void SetTimeout(sal_uInt64 nTimeoutMs)
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
virtual SCCOLROW GetPos() const =0
constexpr void SetTop(tools::Long v)
virtual bool isProtected() const override
bool IsTrackingEnded() const
void SetWindow(vcl::Window *)
const long LONG_MAX
void SetColor(const Color &)
const Point & GetMousePosPixel() const
constexpr tools::Long Bottom() const
#define SC_HDRPAINT_COUNT
Definition: hdrcont.cxx:48
void ReleaseMouse()
void SetVisibleArea(const tools::Rectangle &rNewArea)
vcl::Font aNormFont
Definition: hdrcont.hxx:39
Stores global named database ranges.
Definition: dbdata.hxx:234
#define SC_HDRPAINT_SEL_BOTTOM
Definition: hdrcont.cxx:45
void SetPointer(PointerStyle)
sal_Int32 SCROW
Definition: types.hxx:17
virtual ~ScHeaderControl() override
Definition: hdrcont.cxx:123
virtual void HideEntries(SCCOLROW nStart, SCCOLROW nEnd)=0
vcl::Font aBoldFont
Definition: hdrcont.hxx:40
void Stop()
const Color & GetButtonTextColor() const
constexpr tools::Long Height() const
SCCOLROW GetMousePos(const Point &rPos, bool &rBorder) const
Definition: hdrcont.cxx:625
void SetTransparent(bool bTransparent)
virtual bool ResizeAllowed() const
Definition: hdrcont.cxx:1095
bool Command(const CommandEvent &rCEvt)
virtual sal_uInt16 GetEntrySize(SCCOLROW nEntryNo) const =0
::OutputDevice const * GetOutDev() const
bool IsLeft() const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:704
tools::Long AdjustWidth(tools::Long n)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
void SetInvokeHandler(const Link< Timer *, void > &rLink)
const vcl::Font & GetFont() const
const Point & GetPosPixel() const
tools::Long AdjustHeight(tools::Long n)
NamedDBs & getNamedDBs()
Definition: dbdata.hxx:316
Size GetOutputSizePixel() const
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_LIGHTBLUE
void setHeight(tools::Long nHeight)
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
void Flush()
Definition: gridmerg.cxx:184
vcl::Font aAutoFilterFont
Definition: hdrcont.hxx:41
tools::Long nDragPos
Definition: hdrcont.hxx:60
bool IsTrackingCanceled() const
void SetFont(const vcl::Font &rNewFont)
Point OutputToScreenPixel(const Point &rPos) const
bool bAutoFilterSet
Definition: hdrcont.hxx:43
void UpdateRef(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ)
Definition: tabview4.cxx:186
#define SC_HDRPAINT_TEXT
Definition: hdrcont.cxx:47
const MouseEvent & GetMouseEvent() const
#define SC_DRAG_MIN
Definition: hdrcont.cxx:39
Timer aShowHelpTimer
Definition: hdrcont.hxx:38
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: hdrcont.cxx:219
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: hdrcont.cxx:860
virtual void SetEntrySize(SCCOLROW nPos, sal_uInt16 nNewWidth)=0
sal_uInt16 nPos
virtual OUString GetEntryText(SCCOLROW nEntryNo) const =0
sal_Int16 SCTAB
Definition: types.hxx:22
bool IsMod1() const
virtual void SelectWindow()
Definition: hdrcont.cxx:1100
bool m_bDetectedRangeSegmentation false
tools::Long nBigWidth
Definition: hdrcont.hxx:49
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1922
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo