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 = COL_LIGHTBLUE; // color of filtered row numbers
232  aNormFont.SetColor( aTextColor );
233  aAutoFilterFont.SetColor(aAFilterTextColor);
234  if ( bHighContrast )
235  aBoldFont.SetColor( aTextColor );
236  else
237  aBoldFont.SetColor( aSelTextColor );
238 
239  if (bAutoFilterSet)
240  SetTextColor(aAFilterTextColor);
241  else
242  SetTextColor((bBoldSet && !bHighContrast) ? aSelTextColor : aTextColor);
243 
244  Color aSelLineColor = rStyleSettings.GetHighlightColor();
245  aSelLineColor.Merge( COL_BLACK, 0xe0 ); // darken just a little bit
246 
247  bool bLayoutRTL = IsLayoutRTL();
248  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
249  bool bMirrored = IsMirrored();
250 
251  OUString aString;
252  sal_uInt16 nBarSize;
253  Point aScrPos;
254  Size aTextSize;
255 
256  if (bVertical)
257  nBarSize = static_cast<sal_uInt16>(GetSizePixel().Width());
258  else
259  nBarSize = static_cast<sal_uInt16>(GetSizePixel().Height());
260 
261  SCCOLROW nPos = GetPos();
262 
263  tools::Long nPStart = bVertical ? rRect.Top() : rRect.Left();
264  tools::Long nPEnd = bVertical ? rRect.Bottom() : rRect.Right();
265 
266  tools::Long nTransStart = nPEnd + 1;
267  tools::Long nTransEnd = 0;
268 
269  tools::Long nInitScrPos = 0;
270  if ( bLayoutRTL )
271  {
272  tools::Long nTemp = nPStart; // swap nPStart / nPEnd
273  nPStart = nPEnd;
274  nPEnd = nTemp;
275  nTemp = nTransStart; // swap nTransStart / nTransEnd
276  nTransStart = nTransEnd;
277  nTransEnd = nTemp;
278  if ( bVertical ) // start loops from the end
279  nInitScrPos = GetSizePixel().Height() - 1;
280  else
281  nInitScrPos = GetSizePixel().Width() - 1;
282  }
283 
284  // complete the painting of the outer lines
285  // first find the end of the last cell
286 
287  tools::Long nLineEnd = nInitScrPos - nLayoutSign;
288 
289  for (SCCOLROW i=nPos; i<nSize; i++)
290  {
291  sal_uInt16 nSizePix = GetEntrySize( i );
292  if (nSizePix)
293  {
294  nLineEnd += nSizePix * nLayoutSign;
295 
296  if ( bMarkRange && i >= nMarkStart && i <= nMarkEnd )
297  {
298  tools::Long nLineStart = nLineEnd - ( nSizePix - 1 ) * nLayoutSign;
299  if ( nLineStart * nLayoutSign < nTransStart * nLayoutSign )
300  nTransStart = nLineStart;
301  if ( nLineEnd * nLayoutSign > nTransEnd * nLayoutSign )
302  nTransEnd = nLineEnd;
303  }
304 
305  if ( nLineEnd * nLayoutSign > nPEnd * nLayoutSign )
306  {
307  nLineEnd = nPEnd;
308  break;
309  }
310  }
311  else
312  {
313  SCCOLROW nHidden = GetHiddenCount(i);
314  if (nHidden > 0)
315  i += nHidden - 1;
316  }
317  }
318 
319  // background is different for entry area and behind the entries
320 
321  tools::Rectangle aFillRect;
322  GetOutDev()->SetLineColor();
323 
324  if ( nLineEnd * nLayoutSign >= nInitScrPos * nLayoutSign )
325  {
326  GetOutDev()->SetFillColor( rStyleSettings.GetFaceColor() );
327  if ( bVertical )
328  aFillRect = tools::Rectangle( 0, nInitScrPos, nBarSize-1, nLineEnd );
329  else
330  aFillRect = tools::Rectangle( nInitScrPos, 0, nLineEnd, nBarSize-1 );
331  GetOutDev()->DrawRect( aFillRect );
332  }
333 
334  if ( nLineEnd * nLayoutSign < nPEnd * nLayoutSign )
335  {
336  GetOutDev()->SetFillColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::APPBACKGROUND).nColor );
337  if ( bVertical )
338  aFillRect = tools::Rectangle( 0, nLineEnd+nLayoutSign, nBarSize-1, nPEnd );
339  else
340  aFillRect = tools::Rectangle( nLineEnd+nLayoutSign, 0, nPEnd, nBarSize-1 );
341  GetOutDev()->DrawRect( aFillRect );
342  }
343 
344  if ( nLineEnd * nLayoutSign >= nPStart * nLayoutSign )
345  {
346  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign )
347  {
348  if (bVertical)
349  aFillRect = tools::Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
350  else
351  aFillRect = tools::Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
352 
353  if ( bHighContrast )
354  {
355  if ( bDark )
356  {
357  // solid grey background for dark face color is drawn before lines
358  GetOutDev()->SetLineColor();
360  GetOutDev()->DrawRect( aFillRect );
361  }
362  }
363  else
364  {
365  // background for selection
366  GetOutDev()->SetLineColor();
367  GetOutDev()->SetFillColor( rStyleSettings.GetHighlightColor() );
368  GetOutDev()->DrawRect( aFillRect );
369  }
370  }
371 
372  GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() );
373  if (bVertical)
374  {
375  tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
376  GetOutDev()->DrawLine( Point( nDarkPos, nPStart ), Point( nDarkPos, nLineEnd ) );
377  }
378  else
379  GetOutDev()->DrawLine( Point( nPStart, nBarSize-1 ), Point( nLineEnd, nBarSize-1 ) );
380 
381  // line in different color for selection
382  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && !bHighContrast )
383  {
384  GetOutDev()->SetLineColor( aSelLineColor );
385  if (bVertical)
386  {
387  tools::Long nDarkPos = bMirrored ? 0 : nBarSize-1;
388  GetOutDev()->DrawLine( Point( nDarkPos, nTransStart ), Point( nDarkPos, nTransEnd ) );
389  }
390  else
391  GetOutDev()->DrawLine( Point( nTransStart, nBarSize-1 ), Point( nTransEnd, nBarSize-1 ) );
392  }
393  }
394 
395  // tdf#89841 Use blue row numbers when Autofilter selected
396  std::vector<sc::ColRowSpan> aSpans;
397  if (bVertical && pTabView)
398  {
399  SCTAB nTab = pTabView->GetViewData().GetTabNo();
401 
402  ScDBData* pDBData = rDoc.GetAnonymousDBData(nTab);
403  if (pDBData && pDBData->HasAutoFilter())
404  {
405  SCSIZE nSelected = 0;
406  SCSIZE nTotal = 0;
407  pDBData->GetFilterSelCount(nSelected, nTotal);
408  if (nTotal > nSelected)
409  {
410  ScRange aRange;
411  pDBData->GetArea(aRange);
412  SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
413  SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
414  if (pDBData->HasHeader())
415  nStartRow++;
416  aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
417  }
418  }
419 
420  ScDBCollection* pDocColl = rDoc.GetDBCollection();
421  if (!pDocColl->empty())
422  {
423  ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
424  for (const auto& rxDB : rDBs)
425  {
426  if (rxDB->GetTab() == nTab && rxDB->HasAutoFilter())
427  {
428  SCSIZE nSelected = 0;
429  SCSIZE nTotal = 0;
430  rxDB->GetFilterSelCount(nSelected, nTotal);
431  if (nTotal > nSelected)
432  {
433  ScRange aRange;
434  rxDB->GetArea(aRange);
435  SCCOLROW nStartRow = static_cast<SCCOLROW>(aRange.aStart.Row());
436  SCCOLROW nEndRow = static_cast<SCCOLROW>(aRange.aEnd.Row());
437  if (rxDB->HasHeader())
438  nStartRow++;
439  aSpans.push_back(sc::ColRowSpan(nStartRow, nEndRow));
440  }
441  }
442  }
443  }
444  }
445 
446  // loop through entries several times to avoid changing the line color too often
447  // and to allow merging of lines
448 
449  ScGridMerger aGrid( GetOutDev(), 1, 1 );
450 
451  // start at SC_HDRPAINT_BOTTOM instead of 0 - selection doesn't get different
452  // borders, light border at top isn't used anymore
453  // use SC_HDRPAINT_SEL_BOTTOM for different color
454 
455  for (sal_uInt16 nPass = SC_HDRPAINT_SEL_BOTTOM; nPass < SC_HDRPAINT_COUNT; nPass++)
456  {
457  // set line color etc. before entry loop
458  switch ( nPass )
459  {
461  // same as non-selected for high contrast
462  GetOutDev()->SetLineColor( bHighContrast ? rStyleSettings.GetDarkShadowColor() : aSelLineColor );
463  break;
464  case SC_HDRPAINT_BOTTOM:
465  GetOutDev()->SetLineColor( rStyleSettings.GetDarkShadowColor() );
466  break;
467  case SC_HDRPAINT_TEXT:
468  // DrawSelectionBackground is used only for high contrast on light background
469  if ( nTransEnd * nLayoutSign >= nTransStart * nLayoutSign && bHighContrast && !bDark )
470  {
471  // Transparent selection background is drawn after lines, before text.
472  // Use DrawSelectionBackground to make sure there is a visible
473  // difference. The case of a dark face color, where DrawSelectionBackground
474  // would just paint over the lines, is handled separately (bDark).
475  // Otherwise, GetHighlightColor is used with 80% transparency.
476  // The window's background color (SetBackground) has to be the background
477  // of the cell area, for the contrast comparison in DrawSelectionBackground.
478 
479  tools::Rectangle aTransRect;
480  if (bVertical)
481  aTransRect = tools::Rectangle( 0, nTransStart, nBarSize-1, nTransEnd );
482  else
483  aTransRect = tools::Rectangle( nTransStart, 0, nTransEnd, nBarSize-1 );
484  SetBackground( rStyleSettings.GetFaceColor() );
485  DrawSelectionBackground( aTransRect, 0, true, false );
486  SetBackground();
487  }
488  break;
489  }
490 
491  SCCOLROW nCount=0;
492  tools::Long nScrPos=nInitScrPos;
493  do
494  {
495  if (bVertical)
496  aScrPos = Point( 0, nScrPos );
497  else
498  aScrPos = Point( nScrPos, 0 );
499 
500  SCCOLROW nEntryNo = nCount + nPos;
501  if ( nEntryNo >= nSize ) // rDoc.MaxCol()/rDoc.MaxRow()
502  nScrPos = nPEnd + nLayoutSign; // beyond nPEnd -> stop
503  else
504  {
505  sal_uInt16 nSizePix = GetEntrySize( nEntryNo );
506 
507  if (nSizePix == 0)
508  {
509  SCCOLROW nHidden = GetHiddenCount(nEntryNo);
510  if (nHidden > 0)
511  nCount += nHidden - 1;
512  }
513  else if ((nScrPos+nSizePix*nLayoutSign)*nLayoutSign >= nPStart*nLayoutSign)
514  {
515  Point aEndPos(aScrPos);
516  if (bVertical)
517  aEndPos = Point( aScrPos.X()+nBarSize-1, aScrPos.Y()+(nSizePix-1)*nLayoutSign );
518  else
519  aEndPos = Point( aScrPos.X()+(nSizePix-1)*nLayoutSign, aScrPos.Y()+nBarSize-1 );
520 
521  bool bMark = bMarkRange && nEntryNo >= nMarkStart && nEntryNo <= nMarkEnd;
522  bool bNextToMark = bMarkRange && nEntryNo + 1 >= nMarkStart && nEntryNo <= nMarkEnd;
523 
524  switch ( nPass )
525  {
527  case SC_HDRPAINT_BOTTOM:
528  if ( nPass == ( bNextToMark ? SC_HDRPAINT_SEL_BOTTOM : SC_HDRPAINT_BOTTOM ) )
529  {
530  if (bVertical)
531  aGrid.AddHorLine(/* here we work in pixels */ true, aScrPos.X(), aEndPos.X(), aEndPos.Y());
532  else
533  aGrid.AddVerLine(/* here we work in pixels */ true, aEndPos.X(), aScrPos.Y(), aEndPos.Y());
534 
535  // thick bottom for hidden rows
536  // (drawn directly, without aGrid)
537  if ( nEntryNo+1 < nSize )
538  if ( GetEntrySize(nEntryNo+1)==0 )
539  {
540  if (bVertical)
541  GetOutDev()->DrawLine( Point(aScrPos.X(),aEndPos.Y()-nLayoutSign),
542  Point(aEndPos.X(),aEndPos.Y()-nLayoutSign) );
543  else
544  GetOutDev()->DrawLine( Point(aEndPos.X()-nLayoutSign,aScrPos.Y()),
545  Point(aEndPos.X()-nLayoutSign,aEndPos.Y()) );
546  }
547  }
548  break;
549 
550  case SC_HDRPAINT_TEXT:
551  if ( nSizePix > 1 ) // minimal check for small columns/rows
552  {
553  if (bVertical)
554  {
555  bool bAutoFilterPos = false;
556  for (const auto& rSpan : aSpans)
557  {
558  if (nEntryNo >= rSpan.mnStart && nEntryNo <= rSpan.mnEnd)
559  {
560  bAutoFilterPos = true;
561  break;
562  }
563  }
564 
565  if (bMark != bBoldSet || bAutoFilterPos != bAutoFilterSet)
566  {
567  if (bMark)
569  else if (bAutoFilterPos)
571  else
573  bBoldSet = bMark;
574  bAutoFilterSet = bAutoFilterPos && !bMark;
575  }
576  }
577  else
578  {
579  if (bMark != bBoldSet)
580  {
581  if (bMark)
583  else
585  bBoldSet = bMark;
586  }
587  }
588 
589  aString = GetEntryText( nEntryNo );
590  aTextSize.setWidth( GetTextWidth( aString ) );
591  aTextSize.setHeight( GetTextHeight() );
592 
593  Point aTxtPos(aScrPos);
594  if (bVertical)
595  {
596  aTxtPos.AdjustX((nBarSize-aTextSize.Width())/2 );
597  aTxtPos.AdjustY((nSizePix*nLayoutSign-aTextSize.Height())/2 );
598  if ( bMirrored )
599  aTxtPos.AdjustX(1 ); // dark border is left instead of right
600  }
601  else
602  {
603  aTxtPos.AdjustX((nSizePix*nLayoutSign-aTextSize.Width()+1)/2 );
604  aTxtPos.AdjustY((nBarSize-aTextSize.Height())/2 );
605  }
606  GetOutDev()->DrawText( aTxtPos, aString );
607  }
608  break;
609  }
610 
611  // when selecting the complete row/column:
612  // InvertRect( Rectangle( aScrPos, aEndPos ) );
613  }
614  nScrPos += nSizePix * nLayoutSign; // also if before the visible area
615  }
616  ++nCount;
617  }
618  while ( nScrPos * nLayoutSign <= nPEnd * nLayoutSign );
619 
620  aGrid.Flush();
621  }
622 }
623 
624 SCCOLROW ScHeaderControl::GetMousePos( const MouseEvent& rMEvt, bool& rBorder ) const
625 {
626  bool bFound = false;
627  SCCOLROW nPos = GetPos();
628  SCCOLROW nHitNo = nPos;
629  SCCOLROW nEntryNo = 1 + nPos;
630  tools::Long nScrPos;
631  tools::Long nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
632  tools::Long nDif;
633  Size aSize = GetOutputSizePixel();
634  tools::Long nWinSize = bVertical ? aSize.Height() : aSize.Width();
635 
636  bool bLayoutRTL = IsLayoutRTL();
637  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
638  tools::Long nEndPos = bLayoutRTL ? -1 : nWinSize;
639 
640  nScrPos = GetScrPos( nPos ) - nLayoutSign;
641  do
642  {
643  if (nEntryNo > nSize)
644  nScrPos = nEndPos + nLayoutSign;
645  else
646  nScrPos += GetEntrySize( nEntryNo - 1 ) * nLayoutSign;
647 
648  nDif = nMousePos - nScrPos;
649  if (nDif >= -2 && nDif <= 2)
650  {
651  bFound = true;
652  nHitNo=nEntryNo-1;
653  }
654  else if (nDif * nLayoutSign >= 0 && nEntryNo < nSize)
655  nHitNo = nEntryNo;
656  ++nEntryNo;
657  }
658  while ( nScrPos * nLayoutSign < nEndPos * nLayoutSign && nDif * nLayoutSign > 0 );
659 
660  rBorder = bFound;
661  return nHitNo;
662 }
663 
665 {
666  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
667  if (!pViewSh)
668  return false;
669 
670  ScViewData& rViewData = pViewSh->GetViewData();
671  sal_uInt16 nTab = rViewData.GetTabNo();
672  ScDocument& rDoc = rViewData.GetDocument();
673  const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab);
674  bool bSelectAllowed = true;
675  if ( pProtect && pProtect->isProtected() )
676  {
677  // This sheet is protected. Check if a context menu is allowed on this cell.
678  bool bCellsProtected = false;
679  if (bVertical)
680  {
681  // row header
682  SCROW nRPos = static_cast<SCROW>(nPos);
683  bCellsProtected = rDoc.HasAttrib(0, nRPos, nTab, rDoc.MaxCol(), nRPos, nTab, HasAttrFlags::Protected);
684  }
685  else
686  {
687  // column header
688  SCCOL nCPos = static_cast<SCCOL>(nPos);
689  bCellsProtected = rDoc.HasAttrib(nCPos, 0, nTab, nCPos, rDoc.MaxRow(), nTab, HasAttrFlags::Protected);
690  }
691 
692  bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
693  bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
694 
695  if (bCellsProtected)
696  bSelectAllowed = bSelProtected;
697  else
698  bSelectAllowed = bSelUnprotected;
699  }
700  return bSelectAllowed;
701 }
702 
704 {
705  if (IsDisabled())
706  return;
707 
708  bIgnoreMove = false;
709  SelectWindow();
710 
711  bool bIsBorder;
712  SCCOLROW nHitNo = GetMousePos( rMEvt, bIsBorder );
713  if (!IsSelectionAllowed(nHitNo))
714  return;
715  if ( ! rMEvt.IsLeft() )
716  return;
717  if ( SC_MOD()->IsFormulaMode() )
718  {
719  if( !pTabView )
720  return;
721  SCTAB nTab = pTabView->GetViewData().GetTabNo();
722  if( !rMEvt.IsShift() )
723  pTabView->DoneRefMode( rMEvt.IsMod1() );
724  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
725  ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
726  if( !bVertical )
727  {
728  pTabView->InitRefMode( nHitNo, 0, nTab, SC_REFTYPE_REF );
729  pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
730  }
731  else
732  {
733  pTabView->InitRefMode( 0, nHitNo, nTab, SC_REFTYPE_REF );
734  pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
735  }
736  bInRefMode = true;
737  return;
738  }
739  if ( bIsBorder && ResizeAllowed() )
740  {
741  nDragNo = nHitNo;
742  sal_uInt16 nClicks = rMEvt.GetClicks();
743  if ( nClicks && nClicks%2==0 )
744  {
746  SetPointer( PointerStyle::Arrow );
747  }
748  else
749  {
750  if (bVertical)
751  nDragStart = rMEvt.GetPosPixel().Y();
752  else
753  nDragStart = rMEvt.GetPosPixel().X();
755  // tdf#140833 launch help tip to show after the double click time has expired
756  // so under gtk the popover isn't active when the double click is processed
757  // by gtk because under load on wayland the double click is getting handled
758  // by something else and getting sent to the window underneath our window
760  DrawInvert( nDragPos );
761 
762  StartTracking();
763  bDragging = true;
764  bDragMoved = false;
765  }
766  }
767  else
768  {
769  pSelEngine->SetWindow( this );
771  if (bVertical)
772  {
773  aVis.SetLeft( LONG_MIN );
774  aVis.SetRight( LONG_MAX );
775  }
776  else
777  {
778  aVis.SetTop( LONG_MIN );
779  aVis.SetBottom( LONG_MAX );
780  }
781  pSelEngine->SetVisibleArea( aVis );
782 
783  SetMarking( true ); // must precede SelMouseButtonDown
784  pSelEngine->SelMouseButtonDown( rMEvt );
785 
786  // In column/row headers a simple click already is a selection.
787  // -> Call SelMouseMove to ensure CreateAnchor is called (and DestroyAnchor
788  // if the next click is somewhere else with Control key).
789  pSelEngine->SelMouseMove( rMEvt );
790 
791  if (IsMouseCaptured())
792  {
793  // tracking instead of CaptureMouse, so it can be cancelled cleanly
795  ReleaseMouse();
796  StartTracking();
797  }
798  }
799 }
800 
802 {
803  if ( IsDisabled() )
804  return;
805 
806  if ( SC_MOD()->IsFormulaMode() )
807  {
808  SC_MOD()->EndReference();
809  bInRefMode = false;
810  return;
811  }
812 
813  SetMarking( false );
814  bIgnoreMove = false;
815 
816  if ( bDragging )
817  {
818  DrawInvert( nDragPos );
819  ReleaseMouse();
820  HideDragHelp();
821  bDragging = false;
822 
823  tools::Long nScrPos = GetScrPos( nDragNo );
824  tools::Long nMousePos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
825  bool bLayoutRTL = IsLayoutRTL();
826  tools::Long nNewWidth = bLayoutRTL ? ( nScrPos - nMousePos + 1 )
827  : ( nMousePos + 2 - nScrPos );
828 
829  if ( nNewWidth < 0 /* && !IsSelected(nDragNo) */ )
830  {
831  SCCOLROW nStart = 0;
832  SCCOLROW nEnd = nDragNo;
833  while (nNewWidth < 0)
834  {
835  nStart = nDragNo;
836  if (nDragNo>0)
837  {
838  --nDragNo;
839  nNewWidth += GetEntrySize( nDragNo );
840  }
841  else
842  nNewWidth = 0;
843  }
844  HideEntries( nStart, nEnd );
845  }
846  else
847  {
848  if (bDragMoved)
849  SetEntrySize( nDragNo, static_cast<sal_uInt16>(nNewWidth) );
850  }
851  }
852  else
853  {
854  pSelEngine->SelMouseButtonUp( rMEvt );
855  ReleaseMouse();
856  }
857 }
858 
860 {
861  if ( IsDisabled() )
862  {
863  SetPointer( PointerStyle::Arrow );
864  return;
865  }
866 
867  if ( bInRefMode && rMEvt.IsLeft() && SC_MOD()->IsFormulaMode() )
868  {
869  if( !pTabView )
870  return;
871  bool bTmp;
872  SCCOLROW nHitNo = GetMousePos( rMEvt, bTmp );
873  SCTAB nTab = pTabView->GetViewData().GetTabNo();
874  ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
875  ScDocument& rDoc = pViewSh->GetViewData().GetDocument();
876  if( !bVertical )
877  pTabView->UpdateRef( nHitNo, rDoc.MaxRow(), nTab );
878  else
879  pTabView->UpdateRef( rDoc.MaxCol(), nHitNo, nTab );
880 
881  return;
882  }
883 
884  if ( bDragging )
885  {
886  tools::Long nNewPos = bVertical ? rMEvt.GetPosPixel().Y() : rMEvt.GetPosPixel().X();
887  if ( nNewPos != nDragPos )
888  {
889  DrawInvert( nDragPos );
890  nDragPos = nNewPos;
891  ShowDragHelp();
892  DrawInvert( nDragPos );
893 
894  if (nDragPos <= nDragStart-SC_DRAG_MIN || nDragPos >= nDragStart+SC_DRAG_MIN)
895  bDragMoved = true;
896  }
897  }
898  else
899  {
900  bool bIsBorder;
901  (void)GetMousePos( rMEvt, bIsBorder );
902 
903  if ( bIsBorder && rMEvt.GetButtons()==0 && ResizeAllowed() )
904  SetPointer( bVertical ? PointerStyle::VSizeBar : PointerStyle::HSizeBar );
905  else
906  SetPointer( PointerStyle::Arrow );
907 
908  if (!bIgnoreMove)
909  pSelEngine->SelMouseMove( rMEvt );
910  }
911 }
912 
914 {
915  // Distribute the tracking events to the various MouseEvents, because
916  // SelectionEngine does not know anything about Tracking
917 
918  if ( rTEvt.IsTrackingCanceled() )
919  StopMarking();
920  else if ( rTEvt.IsTrackingEnded() )
921  MouseButtonUp( rTEvt.GetMouseEvent() );
922  else
923  MouseMove( rTEvt.GetMouseEvent() );
924 }
925 
927 {
928  CommandEventId nCmd = rCEvt.GetCommand();
929  if ( nCmd == CommandEventId::ContextMenu )
930  {
931  StopMarking(); // finish selection / dragging
932 
933  // execute popup menu
934 
935  ScTabViewShell* pViewSh = dynamic_cast< ScTabViewShell *>( SfxViewShell::Current() );
936  if ( pViewSh )
937  {
938  if ( rCEvt.IsMouseEvent() )
939  {
940  // #i18735# select the column/row under the mouse pointer
941  ScViewData& rViewData = pViewSh->GetViewData();
942 
943  SelectWindow(); // also deselects drawing objects, stops draw text edit
944  if ( rViewData.HasEditView( rViewData.GetActivePart() ) )
945  SC_MOD()->InputEnterHandler(); // always end edit mode
946 
947  MouseEvent aMEvt( rCEvt.GetMousePosPixel() );
948  bool bBorder;
949  SCCOLROW nPos = GetMousePos( aMEvt, 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 EMPTY_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:3108
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:813
ScAddress aStart
Definition: address.hxx:499
SCCOLROW nDragNo
Definition: hdrcont.hxx:58
tools::Long nWidth
Definition: hdrcont.hxx:47
void GetFilterSelCount(SCSIZE &nSelected, SCSIZE &nTotal)
Definition: dbdata.cxx:959
#define EMPTY_OUSTRING
Definition: global.hxx:213
virtual bool IsDisabled() const
Definition: hdrcont.cxx:1090
void * nTipVisible
Definition: hdrcont.hxx:61
SC_DLLPUBLIC ScDBData * GetAnonymousDBData(SCTAB nTab)
Definition: document.cxx:307
SCROW Row() const
Definition: address.hxx:261
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:1687
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:386
void SetWeight(FontWeight)
bool IsShift() const
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:572
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
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:500
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
virtual void dispose() override
bool IsSelectionAllowed(SCCOLROW nPos) const
Definition: hdrcont.cxx:664
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:5206
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:801
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:871
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:913
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:953
constexpr void SetLeft(tools::Long v)
const Color & GetDarkShadowColor() const
SCCOLROW nMarkEnd
Definition: hdrcont.hxx:54
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
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:1512
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)
SCCOLROW GetMousePos(const MouseEvent &rMEvt, bool &rBorder) const
Definition: hdrcont.cxx:624
#define SC_MOD()
Definition: scmod.hxx:250
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:926
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
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:703
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:315
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:859
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
tools::Long nBigWidth
Definition: hdrcont.hxx:49
SC_DLLPUBLIC const ScTableProtection * GetTabProtection(SCTAB nTab) const
Definition: documen3.cxx:1923
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo