LibreOffice Module sc (master)  1
gridwin4.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 <memory>
21 #include <scitems.hxx>
22 #include <editeng/eeitem.hxx>
23 
24 #include <svtools/colorcfg.hxx>
25 #include <editeng/colritem.hxx>
26 #include <editeng/editview.hxx>
27 #include <editeng/fhgtitem.hxx>
28 #include <sfx2/bindings.hxx>
29 #include <sfx2/printer.hxx>
30 #include <vcl/cursor.hxx>
31 #include <vcl/settings.hxx>
32 #include <o3tl/unit_conversion.hxx>
33 #include <osl/diagnose.h>
34 
35 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
36 #include <comphelper/lok.hxx>
37 #include <sfx2/lokhelper.hxx>
38 
39 #include <svx/svdview.hxx>
40 #include <svx/svdpagv.hxx>
41 #include <svx/sdrpagewindow.hxx>
45 #include <tabvwsh.hxx>
46 
47 #include <gridwin.hxx>
48 #include <viewdata.hxx>
49 #include <output.hxx>
50 #include <document.hxx>
51 #include <attrib.hxx>
52 #include <patattr.hxx>
53 #include <dbdata.hxx>
54 #include <docoptio.hxx>
55 #include <notemark.hxx>
56 #include <dbfunc.hxx>
57 #include <scmod.hxx>
58 #include <inputhdl.hxx>
59 #include <rfindlst.hxx>
60 #include <hiranges.hxx>
61 #include <pagedata.hxx>
62 #include <docpool.hxx>
63 #include <globstr.hrc>
64 #include <scresid.hxx>
65 #include <docsh.hxx>
66 #include <cbutton.hxx>
67 #include <invmerge.hxx>
68 #include <editutil.hxx>
69 #include <inputopt.hxx>
70 #include <fillinfo.hxx>
71 #include <dpcontrol.hxx>
72 #include <queryparam.hxx>
73 #include <queryentry.hxx>
74 #include <markdata.hxx>
75 #include <sc.hrc>
76 #include <vcl/virdev.hxx>
77 #include <svx/sdrpaintwindow.hxx>
78 #include <drwlayer.hxx>
79 #include <columnspanset.hxx>
80 #include <docfunc.hxx>
81 #include <printfun.hxx>
82 
83 static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& rVisible )
84 {
85  if ( rRect.Top() < rVisible.Top()-1 ) rRect.SetTop( rVisible.Top()-1 );
86  if ( rRect.Bottom() > rVisible.Bottom()+1 ) rRect.SetBottom( rVisible.Bottom()+1 );
87 
88  // The header row must be drawn also when the inner rectangle is not visible,
89  // that is why there is no return value anymore.
90  // When it is far away, then lcl_DrawOneFrame is not even called.
91 }
92 
93 static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& rInnerPixel,
94  const OUString& rTitle, const Color& rColor, bool bTextBelow,
95  double nPPTX, double nPPTY, const Fraction& rZoomY,
96  ScDocument& rDoc, ScViewData& rButtonViewData, bool bLayoutRTL )
97 {
98  // rButtonViewData is only used to set the button size,
99 
100  tools::Rectangle aInner = rInnerPixel;
101  if ( bLayoutRTL )
102  {
103  aInner.SetLeft( rInnerPixel.Right() );
104  aInner.SetRight( rInnerPixel.Left() );
105  }
106 
107  tools::Rectangle aVisible( Point(0,0), pDev->GetOutputSizePixel() );
108  lcl_LimitRect( aInner, aVisible );
109 
110  tools::Rectangle aOuter = aInner;
111  tools::Long nHor = static_cast<tools::Long>( SC_SCENARIO_HSPACE * nPPTX );
112  tools::Long nVer = static_cast<tools::Long>( SC_SCENARIO_VSPACE * nPPTY );
113  aOuter.AdjustLeft( -nHor );
114  aOuter.AdjustRight(nHor );
115  aOuter.AdjustTop( -nVer );
116  aOuter.AdjustBottom(nVer );
117 
118  // use ScPatternAttr::GetFont only for font size
119  vcl::Font aAttrFont;
121  GetFont(aAttrFont,SC_AUTOCOL_BLACK,pDev,&rZoomY);
122 
123  // everything else from application font
124  vcl::Font aAppFont = pDev->GetSettings().GetStyleSettings().GetAppFont();
125  aAppFont.SetFontSize( aAttrFont.GetFontSize() );
126 
127  aAppFont.SetAlignment( ALIGN_TOP );
128  pDev->SetFont( aAppFont );
129 
130  Size aTextSize( pDev->GetTextWidth( rTitle ), pDev->GetTextHeight() );
131 
132  if ( bTextBelow )
133  aOuter.AdjustBottom(aTextSize.Height() );
134  else
135  aOuter.AdjustTop( -(aTextSize.Height()) );
136 
137  pDev->SetLineColor();
138  pDev->SetFillColor( rColor );
139  // left, top, right, bottom
140  pDev->DrawRect( tools::Rectangle( aOuter.Left(), aOuter.Top(), aInner.Left(), aOuter.Bottom() ) );
141  pDev->DrawRect( tools::Rectangle( aOuter.Left(), aOuter.Top(), aOuter.Right(), aInner.Top() ) );
142  pDev->DrawRect( tools::Rectangle( aInner.Right(), aOuter.Top(), aOuter.Right(), aOuter.Bottom() ) );
143  pDev->DrawRect( tools::Rectangle( aOuter.Left(), aInner.Bottom(), aOuter.Right(), aOuter.Bottom() ) );
144 
145  tools::Long nButtonY = bTextBelow ? aInner.Bottom() : aOuter.Top();
146 
147  ScDDComboBoxButton aComboButton(pDev);
148  aComboButton.SetOptSizePixel();
149  tools::Long nBWidth = tools::Long(aComboButton.GetSizePixel().Width() * rZoomY);
150  tools::Long nBHeight = nVer + aTextSize.Height() + 1;
151  Size aButSize( nBWidth, nBHeight );
152  tools::Long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1;
153  aComboButton.Draw( Point(nButtonPos, nButtonY), aButSize );
154  rButtonViewData.SetScenButSize( aButSize );
155 
156  tools::Long nTextStart = bLayoutRTL ? aInner.Right() - aTextSize.Width() + 1 : aInner.Left();
157 
158  bool bWasClip = false;
159  vcl::Region aOldClip;
160  bool bClip = ( aTextSize.Width() > aOuter.Right() - nBWidth - aInner.Left() );
161  if ( bClip )
162  {
163  if (pDev->IsClipRegion())
164  {
165  bWasClip = true;
166  aOldClip = pDev->GetActiveClipRegion();
167  }
168  tools::Long nClipStartX = bLayoutRTL ? aOuter.Left() + nBWidth : aInner.Left();
169  tools::Long nClipEndX = bLayoutRTL ? aInner.Right() : aOuter.Right() - nBWidth;
170  pDev->SetClipRegion( vcl::Region(tools::Rectangle( nClipStartX, nButtonY + nVer/2,
171  nClipEndX, nButtonY + nVer/2 + aTextSize.Height())) );
172  }
173 
174  pDev->DrawText( Point( nTextStart, nButtonY + nVer/2 ), rTitle );
175 
176  if ( bClip )
177  {
178  if ( bWasClip )
179  pDev->SetClipRegion(aOldClip);
180  else
181  pDev->SetClipRegion();
182  }
183 
184  pDev->SetFillColor();
185  pDev->SetLineColor( COL_BLACK );
186  pDev->DrawRect( aInner );
187  pDev->DrawRect( aOuter );
188 }
189 
190 static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData& rViewData, ScSplitPos eWhich,
191  SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 )
192 {
193  ScDocument& rDoc = rViewData.GetDocument();
194  SCTAB nTab = rViewData.GetTabNo();
195  SCTAB nTabCount = rDoc.GetTableCount();
196  if ( nTab+1 >= nTabCount || !rDoc.IsScenario(nTab+1) || rDoc.IsScenario(nTab) )
197  return;
198 
199  if ( nX1 > 0 ) --nX1;
200  if ( nY1>=2 ) nY1 -= 2; // Hack: Header row affects two cells
201  else if ( nY1 > 0 ) --nY1;
202  if ( nX2 < rDoc.MaxCol() ) ++nX2;
203  if ( nY2 < rDoc.MaxRow()-1 ) nY2 += 2; // Hack: Header row affects two cells
204  else if ( nY2 < rDoc.MaxRow() ) ++nY2;
205  ScRange aViewRange( nX1,nY1,nTab, nX2,nY2,nTab );
206 
208 
209  ScMarkData aMarks(rDoc.GetSheetLimits());
210  for (SCTAB i=nTab+1; i<nTabCount && rDoc.IsScenario(i); i++)
211  rDoc.MarkScenario( i, nTab, aMarks, false, ScScenarioFlags::ShowFrame );
212  ScRangeListRef xRanges = new ScRangeList;
213  aMarks.FillRangeListWithMarks( xRanges.get(), false );
214 
215  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
216  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
217 
218  for (size_t j = 0, n = xRanges->size(); j < n; ++j)
219  {
220  ScRange aRange = (*xRanges)[j];
221  // Always extend scenario frame to merged cells where no new non-covered cells
222  // are framed
223  rDoc.ExtendTotalMerge( aRange );
224 
226 
227  if ( aRange.Intersects( aViewRange ) )
228  {
229  Point aStartPos = rViewData.GetScrPos(
230  aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
231  Point aEndPos = rViewData.GetScrPos(
232  aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich, true );
233  // on the grid:
234  aStartPos.AdjustX( -nLayoutSign );
235  aStartPos.AdjustY( -1 );
236  aEndPos.AdjustX( -nLayoutSign );
237  aEndPos.AdjustY( -1 );
238 
239  bool bTextBelow = ( aRange.aStart.Row() == 0 );
240 
241  OUString aCurrent;
242  Color aColor( COL_LIGHTGRAY );
243  for (SCTAB nAct=nTab+1; nAct<nTabCount && rDoc.IsScenario(nAct); nAct++)
244  if ( rDoc.IsActiveScenario(nAct) && rDoc.HasScenarioRange(nAct,aRange) )
245  {
246  OUString aDummyComment;
247  ScScenarioFlags nDummyFlags;
248  rDoc.GetName( nAct, aCurrent );
249  rDoc.GetScenarioData( nAct, aDummyComment, aColor, nDummyFlags );
250  }
251 
252  if (aCurrent.isEmpty())
253  aCurrent = ScResId( STR_EMPTYDATA );
254 
256 
257  lcl_DrawOneFrame( pDev, tools::Rectangle( aStartPos, aEndPos ),
258  aCurrent, aColor, bTextBelow,
259  rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomY(),
260  rDoc, rViewData, bLayoutRTL );
261  }
262  }
263 }
264 
265 static void lcl_DrawHighlight( ScOutputData& rOutputData, const ScViewData& rViewData,
266  const std::vector<ScHighlightEntry>& rHighlightRanges )
267 {
268  SCTAB nTab = rViewData.GetTabNo();
269  for ( const auto& rHighlightRange : rHighlightRanges)
270  {
271  ScRange aRange = rHighlightRange.aRef;
272  if ( nTab >= aRange.aStart.Tab() && nTab <= aRange.aEnd.Tab() )
273  {
274  rOutputData.DrawRefMark(
275  aRange.aStart.Col(), aRange.aStart.Row(),
276  aRange.aEnd.Col(), aRange.aEnd.Row(),
277  rHighlightRange.aColor, false );
278  }
279  }
280 }
281 
282 // Calculates top-left offset to be applied based on margins and indent.
283 static void lcl_GetEditAreaTLOffset(tools::Long& nOffsetX, tools::Long& nOffsetY, const ScAddress& rAddr,
284  const ScViewData& rViewData, ScDocument& rDoc)
285 {
288  tools::Long nIndent = 0;
289  tools::Long nDummy = 0;
290  ScEditUtil aEUtil(&rDoc, rAddr.Col(), rAddr.Row(), rAddr.Tab(),
291  Point(0, 0), nullptr, rViewData.GetPPTX(),
292  rViewData.GetPPTY(), Fraction(1.0), Fraction(1.0),
293  false /* bPrintTwips */);
294  const ScPatternAttr* pPattern = rDoc.GetPattern(rAddr);
295  nIndent = aEUtil.GetIndent(pPattern);
296  aEUtil.GetMargins(pPattern, nLeftMargin, nTopMargin, nDummy, nDummy);
297  nOffsetX = nIndent + nLeftMargin;
298  nOffsetY = nTopMargin;
299 }
300 
302 {
303  if ( rPixel == aInvertRect )
304  aInvertRect = tools::Rectangle(); // Cancel
305  else
306  {
307  OSL_ENSURE( aInvertRect.IsEmpty(), "DoInvertRect no pairs" );
308 
309  aInvertRect = rPixel; // Mark new rectangle
310  }
311 
312  UpdateHeaderOverlay(); // uses aInvertRect
313 }
314 
316 {
317  // forward PrePaint to DrawingLayer
318  ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
319 
320  if(pTabViewShell)
321  {
322  SdrView* pDrawView = pTabViewShell->GetScDrawView();
323 
324  if (pDrawView)
325  {
326  pDrawView->PrePaint();
327  }
328  }
329 }
330 
332  const Fraction aScaleX, const Fraction aScaleY)
333 {
334  // Don't see the need for a map as there will be only a few zoom levels
335  // and as of now X and Y zooms in online are the same.
336  for (auto& rEntry : maLOKLastCursor)
337  {
338  if (aScaleX == rEntry.aScaleX && aScaleY == rEntry.aScaleY)
339  {
340  if (rCursorRect == rEntry.aRect)
341  return false; // No change
342 
343  // Update and allow invalidate.
344  rEntry.aRect = rCursorRect;
345  return true;
346  }
347  }
348 
349  maLOKLastCursor.push_back(LOKCursorEntry{aScaleX, aScaleY, rCursorRect});
350  return true;
351 }
352 
354  const Fraction aScaleX, const Fraction aScaleY)
355 {
356  if (!NeedLOKCursorInvalidation(rCursorRect, aScaleX, aScaleY))
357  return;
358 
359  ScTabViewShell* pThisViewShell = mrViewData.GetViewShell();
360  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
361 
362  while (pViewShell)
363  {
364  if (pViewShell != pThisViewShell && pViewShell->GetDocId() == pThisViewShell->GetDocId())
365  {
366  ScTabViewShell* pOtherViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
367  if (pOtherViewShell)
368  {
369  ScViewData& rOtherViewData = pOtherViewShell->GetViewData();
370  Fraction aZoomX = rOtherViewData.GetZoomX();
371  Fraction aZoomY = rOtherViewData.GetZoomY();
372  if (aZoomX == aScaleX && aZoomY == aScaleY)
373  {
374  SfxLokHelper::notifyOtherView(pThisViewShell, pOtherViewShell,
375  LOK_CALLBACK_INVALIDATE_VIEW_CURSOR, "rectangle", rCursorRect.toString());
376  }
377  }
378  }
379 
380  pViewShell = SfxViewShell::GetNext(*pViewShell);
381  }
382 }
383 
384 void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect )
385 {
387  if ( rDoc.IsInInterpreter() )
388  {
389  // Via Reschedule, interpreted cells do not trigger Invalidate again,
390  // otherwise for instance an error box would never appear (bug 36381).
391  // Later, through bNeedsRepaint everything is painted again.
392  if ( bNeedsRepaint )
393  {
395  aRepaintPixel = tools::Rectangle(); // multiple -> paint all
396  }
397  else
398  {
399  bNeedsRepaint = true;
400  aRepaintPixel = LogicToPixel(rRect); // only affected ranges
401  }
402  return;
403  }
404 
405  // #i117893# If GetSizePixel needs to call the resize handler, the resulting nested Paint call
406  // (possibly for a larger rectangle) has to be allowed. Call GetSizePixel before setting bIsInPaint.
407  GetSizePixel();
408 
409  if (bIsInPaint)
410  return;
411 
412  bIsInPaint = true;
413 
414  tools::Rectangle aPixRect = LogicToPixel( rRect );
415 
418 
419  SCTAB nTab = mrViewData.GetTabNo();
420 
421  double nPPTX = mrViewData.GetPPTX();
422  double nPPTY = mrViewData.GetPPTY();
423 
424  tools::Rectangle aMirroredPixel = aPixRect;
425  if ( rDoc.IsLayoutRTL( nTab ) )
426  {
427  // mirror and swap
428  tools::Long nWidth = GetSizePixel().Width();
429  aMirroredPixel.SetLeft( nWidth - 1 - aPixRect.Right() );
430  aMirroredPixel.SetRight( nWidth - 1 - aPixRect.Left() );
431  }
432 
433  tools::Long nScrX = ScViewData::ToPixel( rDoc.GetColWidth( nX1, nTab ), nPPTX );
434  while ( nScrX <= aMirroredPixel.Left() && nX1 < rDoc.MaxCol() )
435  {
436  ++nX1;
437  nScrX += ScViewData::ToPixel( rDoc.GetColWidth( nX1, nTab ), nPPTX );
438  }
439  SCCOL nX2 = nX1;
440  while ( nScrX <= aMirroredPixel.Right() && nX2 < rDoc.MaxCol() )
441  {
442  ++nX2;
443  nScrX += ScViewData::ToPixel( rDoc.GetColWidth( nX2, nTab ), nPPTX );
444  }
445 
446  tools::Long nScrY = 0;
447  ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, rDoc.MaxRow(), nPPTY, &rDoc, nTab);
448  SCROW nY2 = nY1;
449  if (nScrY <= aPixRect.Bottom() && nY2 < rDoc.MaxRow())
450  {
451  ++nY2;
452  ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, rDoc.MaxRow(), nPPTY, &rDoc, nTab);
453  }
454 
455  Draw( nX1,nY1,nX2,nY2, ScUpdateMode::Marks ); // don't continue with painting
456 
457  bIsInPaint = false;
458 }
459 
460 void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode )
461 {
463 
464  // let's ignore the normal Draw() attempts when doing the tiled rendering,
465  // all the rendering should go through PaintTile() in that case.
466  // TODO revisit if we can actually turn this into an assert(), and clean
467  // up the callers
469  return;
470 
471  ScModule* pScMod = SC_MOD();
472  bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg();
473 
474  if (mrViewData.IsMinimized())
475  return;
476 
477  PutInOrder( nX1, nX2 );
478  PutInOrder( nY1, nY2 );
479 
480  OSL_ENSURE( rDoc.ValidCol(nX2) && rDoc.ValidRow(nY2), "GridWin Draw area too big" );
481 
483 
484  if (nX2 < maVisibleRange.mnCol1 || nY2 < maVisibleRange.mnRow1)
485  return;
486  // invisible
487  if (nX1 < maVisibleRange.mnCol1)
488  nX1 = maVisibleRange.mnCol1;
489  if (nY1 < maVisibleRange.mnRow1)
490  nY1 = maVisibleRange.mnRow1;
491 
492  if (nX1 > maVisibleRange.mnCol2 || nY1 > maVisibleRange.mnRow2)
493  return;
494 
495  if (nX2 > maVisibleRange.mnCol2)
496  nX2 = maVisibleRange.mnCol2;
497  if (nY2 > maVisibleRange.mnRow2)
498  nY2 = maVisibleRange.mnRow2;
499 
500  if ( eMode != ScUpdateMode::Marks && nX2 < maVisibleRange.mnCol2)
501  nX2 = maVisibleRange.mnCol2; // to continue painting
502 
503  // point of no return
504 
505  ++nPaintCount; // mark that painting is in progress
506 
507  SCTAB nTab = mrViewData.GetTabNo();
508  rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab );
509 
510  Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich );
511  tools::Long nMirrorWidth = GetSizePixel().Width();
512  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
513  if ( bLayoutRTL )
514  {
515  tools::Long nEndPixel = mrViewData.GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X();
516  nMirrorWidth = aScrPos.X() - nEndPixel;
517  aScrPos.setX( nEndPixel + 1 );
518  }
519 
520  tools::Long nScrX = aScrPos.X();
521  tools::Long nScrY = aScrPos.Y();
522 
523  SCCOL nCurX = mrViewData.GetCurX();
524  SCROW nCurY = mrViewData.GetCurY();
525  SCCOL nCurEndX = nCurX;
526  SCROW nCurEndY = nCurY;
527  rDoc.ExtendMerge( nCurX, nCurY, nCurEndX, nCurEndY, nTab );
528  bool bCurVis = nCursorHideCount==0 &&
529  ( nCurEndX+1 >= nX1 && nCurX <= nX2+1 && nCurEndY+1 >= nY1 && nCurY <= nY2+1 );
530 
531  // AutoFill Handles
532  if ( !bCurVis && nCursorHideCount==0 && bAutoMarkVisible && aAutoMarkPos.Tab() == nTab &&
533  ( aAutoMarkPos.Col() != nCurX || aAutoMarkPos.Row() != nCurY ) )
534  {
535  SCCOL nHdlX = aAutoMarkPos.Col();
536  SCROW nHdlY = aAutoMarkPos.Row();
537  rDoc.ExtendMerge( nHdlX, nHdlY, nHdlX, nHdlY, nTab );
538  // left and top is unaffected
539 
541  }
542 
543  double nPPTX = mrViewData.GetPPTX();
544  double nPPTY = mrViewData.GetPPTY();
545 
546  const ScViewOptions& rOpts = mrViewData.GetOptions();
547 
548  // data block
549 
550  ScTableInfo aTabInfo;
551  rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab,
552  nPPTX, nPPTY, false, rOpts.GetOption(VOPT_FORMULAS),
553  &mrViewData.GetMarkData() );
554 
555  Fraction aZoomX = mrViewData.GetZoomX();
556  Fraction aZoomY = mrViewData.GetZoomY();
557  ScOutputData aOutputData( GetOutDev(), OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
558  nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
559  &aZoomX, &aZoomY );
560 
561  aOutputData.SetMirrorWidth( nMirrorWidth ); // needed for RTL
562  aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
563 
564  ScopedVclPtr< VirtualDevice > xFmtVirtDev;
565  bool bLogicText = bTextWysiwyg; // call DrawStrings in logic MapMode?
566 
567  if ( bTextWysiwyg )
568  {
569  // use printer for text formatting
570 
571  OutputDevice* pFmtDev = rDoc.GetPrinter();
573  aOutputData.SetFmtDevice( pFmtDev );
574  }
575  else if ( aZoomX != aZoomY && mrViewData.IsOle() )
576  {
577  // #i45033# For OLE inplace editing with different zoom factors,
578  // use a virtual device with 1/100th mm as text formatting reference
579 
581  xFmtVirtDev->SetMapMode(MapMode(MapUnit::Map100thMM));
582  aOutputData.SetFmtDevice( xFmtVirtDev.get() );
583 
584  bLogicText = true; // use logic MapMode
585  }
586 
587  DrawContent(*GetOutDev(), aTabInfo, aOutputData, bLogicText);
588 
589  // If something was inverted during the Paint (selection changed from Basic Macro)
590  // then this is now mixed up and has to be repainted
591  OSL_ENSURE(nPaintCount, "Wrong nPaintCount");
592  --nPaintCount;
593  if (!nPaintCount)
595 
596  // Flag drawn formula cells "unchanged".
597  rDoc.ResetChanged(ScRange(nX1, nY1, nTab, nX2, nY2, nTab));
598  rDoc.PrepareFormulaCalc();
599 }
600 
601 namespace {
602 
603 class SuppressEditViewMessagesGuard
604 {
605 public:
606  SuppressEditViewMessagesGuard(EditView& rEditView) :
607  mrEditView(rEditView),
608  mbOrigSuppressFlag(rEditView.IsSuppressLOKMessages())
609  {
610  if (!mbOrigSuppressFlag)
611  mrEditView.SuppressLOKMessages(true);
612  }
613 
614  ~SuppressEditViewMessagesGuard()
615  {
616  if (mrEditView.IsSuppressLOKMessages() != mbOrigSuppressFlag)
617  mrEditView.SuppressLOKMessages(mbOrigSuppressFlag);
618  }
619 
620 private:
621  EditView& mrEditView;
622  const bool mbOrigSuppressFlag;
623 };
624 
625 }
626 
627 void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData,
628  bool bLogicText)
629 {
630  ScModule* pScMod = SC_MOD();
632  const ScViewOptions& rOpts = mrViewData.GetOptions();
633  bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
634  bool bNoBackgroundAndGrid = bIsTiledRendering
636  comphelper::LibreOfficeKit::Compat::scNoGridBackground);
637 
638  SCTAB nTab = aOutputData.nTab;
639  SCCOL nX1 = aOutputData.nX1;
640  SCROW nY1 = aOutputData.nY1;
641  SCCOL nX2 = aOutputData.nX2;
642  SCROW nY2 = aOutputData.nY2;
643  tools::Long nScrX = aOutputData.nScrX;
644  tools::Long nScrY = aOutputData.nScrY;
645 
646  const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig();
647  Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID, false ).nColor );
648  if ( aGridColor == COL_TRANSPARENT )
649  {
650  // use view options' grid color only if color config has "automatic" color
651  aGridColor = rOpts.GetGridColor();
652  }
653 
654  aOutputData.SetSyntaxMode ( mrViewData.IsSyntaxMode() );
655  aOutputData.SetGridColor ( aGridColor );
656  aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) );
657  aOutputData.SetShowFormulas ( rOpts.GetOption( VOPT_FORMULAS ) );
658  aOutputData.SetShowSpellErrors ( rDoc.GetDocOptions().IsAutoSpell() );
659  aOutputData.SetMarkClipped ( rOpts.GetOption( VOPT_CLIPMARKS ) );
660 
661  aOutputData.SetUseStyleColor( true ); // always set in table view
662 
663  aOutputData.SetViewShell( mrViewData.GetViewShell() );
664 
665  bool bGrid = rOpts.GetOption( VOPT_GRID ) && mrViewData.GetShowGrid();
666  bool bGridFirst = !rOpts.GetOption( VOPT_GRID_ONTOP );
667 
668  bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ) && !bIsTiledRendering;
669 
670  bool bPageMode = mrViewData.IsPagebreakMode();
671  if (bPageMode) // after FindChanged
672  {
673  // SetPagebreakMode also initializes bPrinted Flags
675  }
676 
677  EditView* pEditView = nullptr;
678  bool bEditMode = mrViewData.HasEditView(eWhich);
679  if ( bEditMode && mrViewData.GetRefTabNo() == nTab )
680  {
681  SCCOL nEditCol;
682  SCROW nEditRow;
683  mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow );
684  SCCOL nEditEndCol = mrViewData.GetEditEndCol();
685  SCROW nEditEndRow = mrViewData.GetEditEndRow();
686 
687  if ( nEditEndCol >= nX1 && nEditCol <= nX2 && nEditEndRow >= nY1 && nEditRow <= nY2 )
688  aOutputData.SetEditCell( nEditCol, nEditRow );
689  else
690  bEditMode = false;
691  }
692 
693  const MapMode aOriginalMode = rDevice.GetMapMode();
694 
695  // define drawing layer map mode and paint rectangle
696  MapMode aDrawMode = GetDrawMapMode();
697  if (bIsTiledRendering)
698  {
699  // FIXME this shouldn't be necessary once we change the entire Calc to
700  // work in the logic coordinates (ideally 100ths of mm - so that it is
701  // the same as editeng and drawinglayer), and get rid of all the
702  // SetMapMode's and other unnecessary fun we have with pixels
703  // See also ScGridWindow::GetDrawMapMode() for the rest of this hack
704  aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
705  }
706  tools::Rectangle aDrawingRectLogic;
707  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
708 
709  {
710  // get drawing pixel rect
711  tools::Rectangle aDrawingRectPixel(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
712 
713  // correct for border (left/right)
714  if(rDoc.MaxCol() == nX2)
715  {
716  if(bLayoutRTL)
717  {
718  aDrawingRectPixel.SetLeft( 0 );
719  }
720  else
721  {
722  aDrawingRectPixel.SetRight( GetOutputSizePixel().getWidth() );
723  }
724  }
725 
726  // correct for border (bottom)
727  if(rDoc.MaxRow() == nY2)
728  {
729  aDrawingRectPixel.SetBottom( GetOutputSizePixel().getHeight() );
730  }
731 
732  // get logic positions
733  aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
734  }
735 
736  bool bInPlaceEditing = bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo());
737  vcl::Cursor* pInPlaceCrsr = nullptr;
738  bool bInPlaceVisCursor = false;
739  if (bInPlaceEditing)
740  {
741  // toggle the cursor off if it's on to ensure the cursor invert
742  // background logic remains valid after the background is cleared on
743  // the next cursor flash
744  pInPlaceCrsr = pEditView->GetCursor();
745  bInPlaceVisCursor = pInPlaceCrsr && pInPlaceCrsr->IsVisible();
746  if (bInPlaceVisCursor)
747  pInPlaceCrsr->Hide();
748  }
749 
750  OutputDevice* pContentDev = &rDevice; // device for document content, used by overlay manager
751  SdrPaintWindow* pTargetPaintWindow = nullptr; // #i74769# work with SdrPaintWindow directly
752 
753  {
754  // init redraw
755  ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
756 
757  if(pTabViewShell)
758  {
759  MapMode aCurrentMapMode(pContentDev->GetMapMode());
760  pContentDev->SetMapMode(aDrawMode);
761  SdrView* pDrawView = pTabViewShell->GetScDrawView();
762 
763  if(pDrawView)
764  {
765  // #i74769# Use new BeginDrawLayers() interface
766  vcl::Region aDrawingRegion(aDrawingRectLogic);
767  pTargetPaintWindow = pDrawView->BeginDrawLayers(pContentDev, aDrawingRegion);
768  OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
769 
770  if (!bIsTiledRendering)
771  {
772  // #i74769# get target device from SdrPaintWindow, this may be the prerender
773  // device now, too.
774  pContentDev = &(pTargetPaintWindow->GetTargetOutputDevice());
775  aOutputData.SetContentDevice(pContentDev);
776  }
777  }
778 
779  pContentDev->SetMapMode(aCurrentMapMode);
780  }
781  }
782 
783  // edge (area) (Pixel)
784  if ( nX2==rDoc.MaxCol() || nY2==rDoc.MaxRow() )
785  {
786  // save MapMode and set to pixel
787  MapMode aCurrentMapMode(pContentDev->GetMapMode());
788  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
789 
790  tools::Rectangle aPixRect( Point(), GetOutputSizePixel() );
791  pContentDev->SetFillColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor );
792  pContentDev->SetLineColor();
793  if ( nX2==rDoc.MaxCol() )
794  {
795  tools::Rectangle aDrawRect( aPixRect );
796  if ( bLayoutRTL )
797  aDrawRect.SetRight( nScrX - 1 );
798  else
799  aDrawRect.SetLeft( nScrX + aOutputData.GetScrW() );
800  if (aDrawRect.Right() >= aDrawRect.Left())
801  pContentDev->DrawRect( aDrawRect );
802  }
803  if ( nY2==rDoc.MaxRow() )
804  {
805  tools::Rectangle aDrawRect( aPixRect );
806  aDrawRect.SetTop( nScrY + aOutputData.GetScrH() );
807  if ( nX2==rDoc.MaxCol() )
808  {
809  // no double painting of the corner
810  if ( bLayoutRTL )
811  aDrawRect.SetLeft( nScrX );
812  else
813  aDrawRect.SetRight( nScrX + aOutputData.GetScrW() - 1 );
814  }
815  if (aDrawRect.Bottom() >= aDrawRect.Top())
816  pContentDev->DrawRect( aDrawRect );
817  }
818 
819  // restore MapMode
820  pContentDev->SetMapMode(aCurrentMapMode);
821  }
822 
823  if ( rDoc.HasBackgroundDraw( nTab, aDrawingRectLogic ) )
824  {
825  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
826  aOutputData.DrawClear();
827 
828  // drawing background
829 
830  pContentDev->SetMapMode(aDrawMode);
831  DrawRedraw( aOutputData, SC_LAYER_BACK );
832  }
833  else
834  aOutputData.SetSolidBackground(!bNoBackgroundAndGrid);
835 
836  aOutputData.DrawDocumentBackground();
837 
838  if (bGridFirst && (bGrid || bPage))
839  {
840  // Draw lines in background color cover over lok client grid lines in merged cell areas if bNoBackgroundAndGrid is set.
841  if (bNoBackgroundAndGrid)
842  aOutputData.DrawGrid(*pContentDev, false /* bGrid */, false /* bPage */, true /* bMergeCover */);
843  else
844  aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
845  }
846 
847  aOutputData.DrawBackground(*pContentDev);
848 
849  if (!bGridFirst && (bGrid || bPage) && !bNoBackgroundAndGrid)
850  aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
851 
852  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
853 
854  if ( bPageMode )
855  {
856  // DrawPagePreview draws complete lines/page numbers, must always be clipped
857  if ( aOutputData.SetChangedClip() )
858  {
859  DrawPagePreview(nX1,nY1,nX2,nY2, *pContentDev);
860  pContentDev->SetClipRegion();
861  }
862  }
863 
864  aOutputData.DrawShadow();
865  aOutputData.DrawFrame(*pContentDev);
866 
867  // Show Note Mark
868  if ( rOpts.GetOption( VOPT_NOTES ) )
869  aOutputData.DrawNoteMarks(*pContentDev);
870 
871  if ( !bLogicText )
872  aOutputData.DrawStrings(); // in pixel MapMode
873 
874  // edit cells and printer-metrics text must be before the buttons
875  // (DataPilot buttons contain labels in UI font)
876 
877  pContentDev->SetMapMode(mrViewData.GetLogicMode(eWhich));
878  if ( bLogicText )
879  aOutputData.DrawStrings(true); // in logic MapMode if bLogicText is set
880  aOutputData.DrawEdit(true);
881 
882  // the buttons are painted in absolute coordinates
883  if (bIsTiledRendering)
884  {
885  // Tiled offset nScrX, nScrY
886  MapMode aMap( MapUnit::MapPixel );
887  Point aOrigin = aOriginalMode.GetOrigin();
888  aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px) + nScrX);
889  aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px) + nScrY);
890  aMap.SetOrigin(aOrigin);
891  pContentDev->SetMapMode(aMap);
892  }
893  else
894  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
895 
896  // Autofilter- and Pivot-Buttons
897 
898  DrawButtons(nX1, nX2, rTableInfo, pContentDev); // Pixel
899 
900  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
901 
902  aOutputData.DrawClipMarks();
903 
904  // In any case, Scenario / ChangeTracking must happen after DrawGrid, also for !bGridFirst
905 
908 
909  SCTAB nTabCount = rDoc.GetTableCount();
910  const std::vector<ScHighlightEntry> &rHigh = mrViewData.GetView()->GetHighlightRanges();
911  bool bHasScenario = ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) );
912  bool bHasChange = ( rDoc.GetChangeTrack() != nullptr );
913 
914  if ( bHasChange || bHasScenario || !rHigh.empty() )
915  {
917 
918  if ( bHasChange )
919  aOutputData.DrawChangeTrack();
920 
921  if ( bHasScenario )
922  lcl_DrawScenarioFrames( pContentDev, mrViewData, eWhich, nX1,nY1,nX2,nY2 );
923 
924  lcl_DrawHighlight( aOutputData, mrViewData, rHigh );
925  }
926 
927  // Drawing foreground
928 
929  pContentDev->SetMapMode(aDrawMode);
930 
931  // Bitmaps and buttons are in absolute pixel coordinates.
932  const MapMode aOrig = pContentDev->GetMapMode();
933  if (bIsTiledRendering)
934  {
935  Point aOrigin = aOriginalMode.GetOrigin();
936  Size aPixelOffset(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px),
938  pContentDev->SetPixelOffset(aPixelOffset);
940  }
941 
942  DrawRedraw( aOutputData, SC_LAYER_FRONT );
943  DrawRedraw( aOutputData, SC_LAYER_INTERN );
944  DrawSdrGrid( aDrawingRectLogic, pContentDev );
945 
946  if (bIsTiledRendering)
947  {
948  pContentDev->SetPixelOffset(Size());
949  pContentDev->SetMapMode(aOrig);
950  }
951 
952  pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
953 
954  if ( mrViewData.IsRefMode() && nTab >= mrViewData.GetRefStartZ() && nTab <= mrViewData.GetRefEndZ() )
955  {
956  Color aRefColor( rColorCfg.GetColorValue(svtools::CALCREFERENCE).nColor );
959  aRefColor, false );
960  }
961 
962  // range finder
963 
964  ScInputHandler* pHdl = pScMod->GetInputHdl( mrViewData.GetViewShell() );
965  if (pHdl)
966  {
967  ScDocShell* pDocSh = mrViewData.GetDocShell();
968  ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
969  if ( pRangeFinder && !pRangeFinder->IsHidden() &&
970  pRangeFinder->GetDocName() == pDocSh->GetTitle() )
971  {
972  sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
973  for (sal_uInt16 i=0; i<nCount; i++)
974  {
975  ScRangeFindData& rData = pRangeFinder->GetObject(i);
976 
977  ScRange aRef = rData.aRef;
978  aRef.PutInOrder();
979  if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
980  aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
981  aRef.aEnd.Col(), aRef.aEnd.Row(),
982  rData.nColor,
983  true );
984  }
985  }
986  }
987 
988  {
989  // end redraw
990  ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
991 
992  if(pTabViewShell)
993  {
994  MapMode aCurrentMapMode(pContentDev->GetMapMode());
995  pContentDev->SetMapMode(aDrawMode);
996 
997  if (bIsTiledRendering)
998  {
999  Point aOrigin = aOriginalMode.GetOrigin();
1000  aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1001  + aOutputData.nScrX);
1002  aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1003  + aOutputData.nScrY);
1004  const double twipFactor = 15 * 1.76388889; // 26.45833335
1005  aOrigin = Point(aOrigin.getX() * twipFactor,
1006  aOrigin.getY() * twipFactor);
1007  MapMode aNew = rDevice.GetMapMode();
1008  aNew.SetOrigin(aOrigin);
1009  rDevice.SetMapMode(aNew);
1010  }
1011 
1012  SdrView* pDrawView = pTabViewShell->GetScDrawView();
1013 
1014  if(pDrawView)
1015  {
1016  // #i74769# work with SdrPaintWindow directly
1017  pDrawView->EndDrawLayers(*pTargetPaintWindow, true);
1018  }
1019 
1020  pContentDev->SetMapMode(aCurrentMapMode);
1021  }
1022  }
1023 
1024  // paint in-place editing on other views
1025  if (bIsTiledRendering)
1026  {
1027  ScTabViewShell* pThisViewShell = mrViewData.GetViewShell();
1028  SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1029 
1030  while (pViewShell)
1031  {
1032  if (pViewShell != pThisViewShell && pViewShell->GetDocId() == pThisViewShell->GetDocId())
1033  {
1034  ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1035  if (pTabViewShell)
1036  {
1037  ScViewData& rOtherViewData = pTabViewShell->GetViewData();
1038  ScSplitPos eOtherWhich = rOtherViewData.GetEditActivePart();
1039 
1040  bool bOtherEditMode = rOtherViewData.HasEditView(eOtherWhich);
1041  SCCOL nCol1 = rOtherViewData.GetEditStartCol();
1042  SCROW nRow1 = rOtherViewData.GetEditStartRow();
1043  SCCOL nCol2 = rOtherViewData.GetEditEndCol();
1044  SCROW nRow2 = rOtherViewData.GetEditEndRow();
1045  bOtherEditMode = bOtherEditMode
1046  && ( nCol2 >= nX1 && nCol1 <= nX2 && nRow2 >= nY1 && nRow1 <= nY2 );
1047  if (bOtherEditMode && rOtherViewData.GetRefTabNo() == nTab)
1048  {
1049  EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich);
1050  if (pOtherEditView)
1051  {
1052  tools::Long nScreenX = aOutputData.nScrX;
1053  tools::Long nScreenY = aOutputData.nScrY;
1054 
1055  rDevice.SetLineColor();
1056  rDevice.SetFillColor(pOtherEditView->GetBackgroundColor());
1057  Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
1058  Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
1059 
1060  // don't overwrite grid
1061  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1062  aEnd.AdjustX( -(2 * nLayoutSign) );
1063  aEnd.AdjustY( -2 );
1064 
1065  tools::Rectangle aBackground(aStart, aEnd);
1066 
1067  // Need to draw the background in absolute coords.
1068  Point aOrigin = aOriginalMode.GetOrigin();
1069  aOrigin.setX(
1071  + nScreenX);
1072  aOrigin.setY(
1074  + nScreenY);
1075  aBackground += aOrigin;
1076  rDevice.SetMapMode(aDrawMode);
1077 
1078  static const double twipFactor = 15 * 1.76388889; // 26.45833335
1079  // keep into account the zoom factor
1080  aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1081  (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1082 
1083  MapMode aNew = rDevice.GetMapMode();
1084  aNew.SetOrigin(aOrigin);
1085  rDevice.SetMapMode(aNew);
1086 
1087  // paint the background
1088  rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
1089 
1090  tools::Rectangle aEditRect(aBackground);
1091  tools::Long nOffsetX = 0, nOffsetY = 0;
1092  // Get top-left offset because of margin and indent.
1093  lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, nTab), mrViewData, rDoc);
1094  aEditRect.AdjustLeft(nOffsetX + 1);
1095  aEditRect.AdjustTop(nOffsetY + 1);
1096 
1097  // EditView has an 'output area' which is used to clip the 'paint area' we provide below.
1098  // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1099  // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1100  // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1101  OutputDevice& rOtherWin = pOtherEditView->GetOutputDevice();
1102  const tools::Rectangle aOrigOutputArea(pOtherEditView->GetOutputArea()); // Not in pixels.
1103  const MapMode aOrigMapMode = rOtherWin.GetMapMode();
1104  rOtherWin.SetMapMode(rDevice.GetMapMode());
1105 
1106  // Avoid sending wrong cursor/selection messages by the 'other' view, as the output-area is going
1107  // to be tweaked temporarily to match the current view's zoom.
1108  SuppressEditViewMessagesGuard aGuard(*pOtherEditView);
1109 
1110  pOtherEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
1111  pOtherEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
1112 
1113  // Rollback the mapmode and 'output area'.
1114  rOtherWin.SetMapMode(aOrigMapMode);
1115  pOtherEditView->SetOutputArea(aOrigOutputArea);
1116  rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1117  }
1118  }
1119  }
1120  }
1121 
1122  pViewShell = SfxViewShell::GetNext(*pViewShell);
1123  }
1124 
1125  }
1126 
1127  // In-place editing - when the user is typing, we need to paint the text
1128  // using the editeng.
1129  // It's being done after EndDrawLayers() to get it outside the overlay
1130  // buffer and on top of everything.
1131  if (bInPlaceEditing)
1132  {
1133  // get the coordinates of the area we need to clear (overpaint by
1134  // the background)
1135  SCCOL nCol1 = mrViewData.GetEditStartCol();
1136  SCROW nRow1 = mrViewData.GetEditStartRow();
1137  SCCOL nCol2 = mrViewData.GetEditEndCol();
1138  SCROW nRow2 = mrViewData.GetEditEndRow();
1139  rDevice.SetLineColor();
1140  rDevice.SetFillColor(pEditView->GetBackgroundColor());
1141  Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich );
1142  Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich );
1143 
1144  // don't overwrite grid
1145  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1146  aEnd.AdjustX( -(2 * nLayoutSign) );
1147  aEnd.AdjustY( -2 );
1148 
1149  // set the correct mapmode
1150  tools::Rectangle aBackground(aStart, aEnd);
1151  tools::Rectangle aBGAbs(aStart, aEnd);
1152 
1153  if (bIsTiledRendering)
1154  {
1155  // Need to draw the background in absolute coords.
1156  Point aOrigin = aOriginalMode.GetOrigin();
1157  aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1158  + nScrX);
1159  aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1160  + nScrY);
1161  aBackground += aOrigin;
1162  rDevice.SetMapMode(aDrawMode);
1163  }
1164  else
1165  rDevice.SetMapMode(mrViewData.GetLogicMode());
1166 
1167  if (bIsTiledRendering)
1168  {
1169  Point aOrigin = aOriginalMode.GetOrigin();
1170  aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1171  + nScrX);
1172  aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1173  + nScrY);
1174  static const double twipFactor = 15 * 1.76388889; // 26.45833335
1175  // keep into account the zoom factor
1176  aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1177  (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1178  MapMode aNew = rDevice.GetMapMode();
1179  aNew.SetOrigin(aOrigin);
1180  rDevice.SetMapMode(aNew);
1181  }
1182 
1183  // paint the background
1184  tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground));
1185  //tdf#100925, rhbz#1283420, Draw some text here, to get
1186  //X11CairoTextRender::getCairoContext called, so that the forced read
1187  //from the underlying X Drawable gets it to sync.
1188  rDevice.DrawText(aLogicRect.BottomLeft(), " ");
1189  rDevice.DrawRect(aLogicRect);
1190 
1191  // paint the editeng text
1192  if (bIsTiledRendering)
1193  {
1194  tools::Rectangle aEditRect(aBackground);
1195  tools::Long nOffsetX = 0, nOffsetY = 0;
1196  // Get top-left offset because of margin and indent.
1197  lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, mrViewData.GetTabNo()), mrViewData, rDoc);
1198  aEditRect.AdjustLeft(nOffsetX + 1);
1199  aEditRect.AdjustTop(nOffsetY + 1);
1200 
1201  // EditView has an 'output area' which is used to clip the paint area we provide below.
1202  // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1203  // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1204  // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1205  const tools::Rectangle aOrigOutputArea(pEditView->GetOutputArea()); // Not in pixels.
1206  const MapMode aOrigMapMode = GetMapMode();
1207  SetMapMode(rDevice.GetMapMode());
1208 
1209  // Avoid sending wrong cursor/selection messages by the current view, as the output-area is going
1210  // to be tweaked temporarily to match other view's zoom. (This does not affect the manual
1211  // cursor-messaging done in the non print-twips mode)
1212  SuppressEditViewMessagesGuard aGuard(*pEditView);
1213 
1214  pEditView->SetOutputArea(rDevice.PixelToLogic(aEditRect));
1215  pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
1216 
1217  // EditView will do the cursor notifications correctly if we're in
1218  // print-twips messaging mode.
1219  if (!comphelper::LibreOfficeKit::isCompatFlagSet(
1220  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1221  {
1222  // Now we need to get relative cursor position within the editview.
1223  // This is for sending the pixel-aligned twips position of the cursor to the specific views with
1224  // the same given zoom level.
1225  tools::Rectangle aCursorRect = pEditView->GetEditCursor();
1226  Point aCursPos = OutputDevice::LogicToLogic(aCursorRect.TopLeft(),
1227  MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
1228 
1229  const MapMode& rDevMM = rDevice.GetMapMode();
1230  MapMode aMM(MapUnit::MapTwip);
1231  aMM.SetScaleX(rDevMM.GetScaleX());
1232  aMM.SetScaleY(rDevMM.GetScaleY());
1233 
1234  aBGAbs.AdjustLeft(1);
1235  aBGAbs.AdjustTop(1);
1236  aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
1237  aCursorRect.setWidth(0);
1238  aCursorRect.Move(aCursPos.getX(), 0);
1239  // Sends view cursor position to views of all matching zooms if needed (avoids duplicates).
1240  InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), aMM.GetScaleY());
1241  }
1242 
1243  // Rollback the mapmode and 'output area'.
1244  SetMapMode(aOrigMapMode);
1245  pEditView->SetOutputArea(aOrigOutputArea);
1246  }
1247  else
1248  {
1249  tools::Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
1250  pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
1251  }
1252 
1253  rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1254 
1255  // restore the cursor it was originally visible
1256  if (bInPlaceVisCursor)
1257  pInPlaceCrsr->Show();
1258  }
1259 
1261  {
1262  // flush OverlayManager before changing the MapMode
1264 
1265  // set MapMode for text edit
1266  rDevice.SetMapMode(mrViewData.GetLogicMode());
1267  }
1268  else
1269  rDevice.SetMapMode(aDrawMode);
1270 
1271  if (mpNoteMarker)
1272  mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
1273 
1274  if (bPage && bInitialPageBreaks)
1275  SetupInitialPageBreaks(rDoc, nTab);
1276 }
1277 
1278 
1280 {
1281  // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
1282  // is enabled, breaks should be visible. If the document is opened the first
1283  // time, the breaks are not calculated yet, so for this initialization
1284  // a timer will be triggered here.
1285  std::set<SCCOL> aColBreaks;
1286  std::set<SCROW> aRowBreaks;
1287  rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
1288  rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
1289  if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
1290  {
1291  maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
1293  }
1294  bInitialPageBreaks = false;
1295 }
1296 
1297 namespace
1298 {
1299  template<typename IndexType>
1300  void lcl_getBoundingRowColumnforTile(ScViewData& rViewData,
1301  tools::Long nTileStartPosPx, tools::Long nTileEndPosPx,
1302  sal_Int32& nTopLeftTileOffset, sal_Int32& nTopLeftTileOrigin,
1303  sal_Int32& nTopLeftTileIndex, sal_Int32& nBottomRightTileIndex)
1304  {
1305  const bool bColumnHeader = std::is_same<IndexType, SCCOL>::value;
1306 
1307  SCTAB nTab = rViewData.GetTabNo();
1308 
1309  IndexType nStartIndex = -1;
1310  IndexType nEndIndex = -1;
1311  tools::Long nStartPosPx = 0;
1312  tools::Long nEndPosPx = 0;
1313 
1314  ScPositionHelper& rPositionHelper =
1315  bColumnHeader ? rViewData.GetLOKWidthHelper() : rViewData.GetLOKHeightHelper();
1316  const auto& rStartNearest = rPositionHelper.getNearestByPosition(nTileStartPosPx);
1317  const auto& rEndNearest = rPositionHelper.getNearestByPosition(nTileEndPosPx);
1318 
1319  ScBoundsProvider aBoundsProvider(rViewData, nTab, bColumnHeader);
1320  aBoundsProvider.Compute(rStartNearest, rEndNearest, nTileStartPosPx, nTileEndPosPx);
1321  aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex;
1322  aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx);
1323 
1324  nTopLeftTileOffset = nTileStartPosPx - nStartPosPx;
1325  nTopLeftTileOrigin = nStartPosPx;
1326  nTopLeftTileIndex = nStartIndex;
1327  nBottomRightTileIndex = nEndIndex;
1328  }
1329 
1330  class ScLOKProxyObjectContact final : public sdr::contact::ObjectContactOfPageView
1331  {
1332  private:
1333  ScDrawView* mpScDrawView;
1334 
1335  public:
1336  explicit ScLOKProxyObjectContact(
1337  ScDrawView* pDrawView,
1338  SdrPageWindow& rPageWindow,
1339  const char* pDebugName) :
1340  ObjectContactOfPageView(rPageWindow, pDebugName),
1341  mpScDrawView(pDrawView)
1342  {
1343  }
1344 
1345  virtual bool supportsGridOffsets() const override { return true; }
1346 
1348  basegfx::B2DVector& rTarget,
1349  const sdr::contact::ViewObjectContact& rClient) const override
1350  {
1351  if (!mpScDrawView)
1352  return;
1353 
1354  SdrPageView* pPageView(mpScDrawView->GetSdrPageView());
1355  if (!pPageView)
1356  return;
1357 
1358  SdrPageWindow* pSdrPageWindow = pPageView->GetPageWindow(0);
1359  if (!pSdrPageWindow)
1360  return;
1361 
1362  sdr::contact::ObjectContact& rObjContact(pSdrPageWindow->GetObjectContact());
1363 
1364  SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1365  if (pTargetSdrObject)
1366  rTarget = pTargetSdrObject->GetViewContact().GetViewObjectContact(rObjContact).getGridOffset();
1367  }
1368  };
1369 
1370  class ScLOKDrawView : public FmFormView
1371  {
1372  public:
1373  ScLOKDrawView(OutputDevice* pOut, ScViewData& rData) :
1374  FmFormView(*rData.GetDocument().GetDrawLayer(), pOut),
1375  mpScDrawView(rData.GetScDrawView())
1376  {
1377  }
1378 
1380  SdrPageWindow& rPageWindow, const char* pDebugName) const override
1381  {
1382  if (!mpScDrawView)
1383  return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1384 
1385  return new ScLOKProxyObjectContact(mpScDrawView, rPageWindow, pDebugName);
1386  }
1387 
1388  private:
1389  ScDrawView* mpScDrawView;
1390  };
1391 } // anonymous namespace
1392 
1394  int nOutputWidth, int nOutputHeight,
1395  int nTilePosX, int nTilePosY,
1396  tools::Long nTileWidth, tools::Long nTileHeight )
1397 {
1398  Fraction origZoomX = mrViewData.GetZoomX();
1399  Fraction origZoomY = mrViewData.GetZoomY();
1400 
1401  // Output size is in pixels while tile position and size are in logical units (twips).
1402 
1403  // Assumption: always paint the whole sheet i.e. "visible" range is always
1404  // from (0,0) to last data position.
1405 
1406  // Tile geometry is independent of the zoom level, but the output size is
1407  // dependent of the zoom level. Determine the correct zoom level before
1408  // we start.
1409 
1410  // FIXME the painting works using a mixture of drawing with coordinates in
1411  // pixels and in logic coordinates; it should be cleaned up to use logic
1412  // coords only, and avoid all the SetMapMode()'s.
1413  // Similarly to Writer, we should set the mapmode once on the rDevice, and
1414  // not care about any zoom settings.
1415 
1416  Fraction aFracX(o3tl::convert(nOutputWidth, o3tl::Length::px, o3tl::Length::twip), nTileWidth);
1417  Fraction aFracY(o3tl::convert(nOutputHeight, o3tl::Length::px, o3tl::Length::twip), nTileHeight);
1418 
1419  const bool bChangeZoom = (aFracX != origZoomX || aFracY != origZoomY);
1420 
1421  // page break zoom, and aLogicMode in ScViewData
1422  // FIXME: there are issues when SetZoom is called conditionally.
1423  mrViewData.SetZoom(aFracX, aFracY, true);
1424  if (bChangeZoom)
1425  {
1426  if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1427  pDrawView->resetGridOffsetsForAllSdrPageViews();
1428  }
1429 
1430  const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
1431  const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
1432  const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight;
1433  const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
1434 
1435  SCTAB nTab = mrViewData.GetTabNo();
1436  ScDocument& rDoc = mrViewData.GetDocument();
1437 
1438  const double fPPTX = mrViewData.GetPPTX();
1439  const double fPPTY = mrViewData.GetPPTY();
1440 
1441  // find approximate col/row offsets of nearby.
1442  sal_Int32 nTopLeftTileRowOffset = 0;
1443  sal_Int32 nTopLeftTileColOffset = 0;
1444  sal_Int32 nTopLeftTileRowOrigin = 0;
1445  sal_Int32 nTopLeftTileColOrigin = 0;
1446 
1447  sal_Int32 nTopLeftTileRow = 0;
1448  sal_Int32 nTopLeftTileCol = 0;
1449  sal_Int32 nBottomRightTileRow = 0;
1450  sal_Int32 nBottomRightTileCol = 0;
1451 
1452  lcl_getBoundingRowColumnforTile<SCROW>(mrViewData,
1453  fTilePosYPixel, fTileBottomPixel,
1454  nTopLeftTileRowOffset, nTopLeftTileRowOrigin,
1455  nTopLeftTileRow, nBottomRightTileRow);
1456 
1457  lcl_getBoundingRowColumnforTile<SCCOL>(mrViewData,
1458  fTilePosXPixel, fTileRightPixel,
1459  nTopLeftTileColOffset, nTopLeftTileColOrigin,
1460  nTopLeftTileCol, nBottomRightTileCol);
1461 
1462  // Enlarge
1463  nBottomRightTileCol++;
1464  nBottomRightTileRow++;
1465 
1466  if (nBottomRightTileCol > rDoc.MaxCol())
1467  nBottomRightTileCol = rDoc.MaxCol();
1468 
1469  if (nBottomRightTileRow > MAXTILEDROW)
1470  nBottomRightTileRow = MAXTILEDROW;
1471 
1472  // size of the document including drawings, charts, etc.
1473  SCCOL nEndCol = 0;
1474  SCROW nEndRow = 0;
1475  rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
1476 
1477  if (nEndCol < nBottomRightTileCol)
1478  nEndCol = nBottomRightTileCol;
1479 
1480  if (nEndRow < nBottomRightTileRow)
1481  nEndRow = nBottomRightTileRow;
1482 
1483  nTopLeftTileCol = std::max<sal_Int32>(nTopLeftTileCol, 0);
1484  nTopLeftTileRow = std::max<sal_Int32>(nTopLeftTileRow, 0);
1485  nTopLeftTileColOrigin = o3tl::convert(nTopLeftTileColOrigin, o3tl::Length::px, o3tl::Length::twip);
1486  nTopLeftTileRowOrigin = o3tl::convert(nTopLeftTileRowOrigin, o3tl::Length::px, o3tl::Length::twip);
1487 
1488  // Checkout -> 'rDoc.ExtendMerge' ... if we miss merged cells.
1489 
1490  // Origin must be the offset of the first col and row
1491  // containing our top-left pixel.
1492  const MapMode aOriginalMode = rDevice.GetMapMode();
1493  MapMode aAbsMode = aOriginalMode;
1494  const Point aOrigin(-nTopLeftTileColOrigin, -nTopLeftTileRowOrigin);
1495  aAbsMode.SetOrigin(aOrigin);
1496  rDevice.SetMapMode(aAbsMode);
1497 
1498  ScTableInfo aTabInfo(nEndRow + 3);
1499  rDoc.FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
1500  nBottomRightTileCol, nBottomRightTileRow,
1501  nTab, fPPTX, fPPTY, false, false);
1502 
1503 // FIXME: is this called some
1504 // Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich );
1505 
1506  ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
1507  -nTopLeftTileColOffset,
1508  -nTopLeftTileRowOffset,
1509  nTopLeftTileCol, nTopLeftTileRow,
1510  nBottomRightTileCol, nBottomRightTileRow,
1511  fPPTX, fPPTY, nullptr, nullptr);
1512 
1513  // setup the SdrPage so that drawinglayer works correctly
1514  ScDrawLayer* pModel = rDoc.GetDrawLayer();
1515  if (pModel)
1516  {
1517  bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
1518  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1519  mpLOKDrawView.reset(bPrintTwipsMsgs ?
1520  new ScLOKDrawView(
1521  &rDevice,
1522  mrViewData) :
1523  new FmFormView(
1524  *pModel,
1525  &rDevice));
1526  mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));
1527  aOutputData.SetDrawView(mpLOKDrawView.get());
1528  aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
1529  }
1530 
1531  // draw the content
1532  DrawContent(rDevice, aTabInfo, aOutputData, true);
1533  rDevice.SetMapMode(aOriginalMode);
1534 
1535  // Flag drawn formula cells "unchanged".
1536  rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
1537  rDoc.PrepareFormulaCalc();
1538 
1539  mrViewData.SetZoom(origZoomX, origZoomY, true);
1540  if (bChangeZoom)
1541  {
1542  if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1543  pDrawView->resetGridOffsetsForAllSdrPageViews();
1544  }
1545 }
1546 
1548 {
1549  tools::Rectangle aRectangle;
1550  tools::Rectangle* pResultRectangle;
1551  if (!pRectangle)
1552  pResultRectangle = nullptr;
1553  else
1554  {
1555  aRectangle = *pRectangle;
1556  // When dragging shapes the map mode is disabled.
1557  if (IsMapModeEnabled())
1558  {
1559  if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
1560  {
1561  aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
1562  }
1563  }
1564  else
1565  aRectangle = PixelToLogic(aRectangle, MapMode(MapUnit::MapTwip));
1566  pResultRectangle = &aRectangle;
1567  }
1568 
1569  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1570  SfxLokHelper::notifyInvalidation(pViewShell, pResultRectangle);
1571 }
1572 
1573 void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
1574 {
1575  ScTabView* pTabView = mrViewData.GetView();
1576  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1577  ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
1578 
1579  if (pInputHandler && pInputHandler->IsInputMode())
1580  {
1581  // we need to switch off the editeng
1583  pViewShell->UpdateInputHandler();
1584  }
1585 
1586  if (nType == LOK_SETTEXTSELECTION_RESET)
1587  {
1588  pTabView->DoneBlockMode();
1589  return;
1590  }
1591 
1592  // obtain the current selection
1594 
1595  SCCOL nCol1, nCol2;
1596  SCROW nRow1, nRow2;
1597  SCTAB nTab1, nTab2;
1598 
1599  bool bWasEmpty = false;
1600  if (aRangeList.empty())
1601  {
1602  nCol1 = nCol2 = mrViewData.GetCurX();
1603  nRow1 = nRow2 = mrViewData.GetCurY();
1604  bWasEmpty = true;
1605  }
1606  else
1607  aRangeList.Combine().GetVars(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
1608 
1609  // convert the coordinates to column/row
1610  SCCOL nNewPosX;
1611  SCROW nNewPosY;
1612  SCTAB nTab = mrViewData.GetTabNo();
1613  mrViewData.GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY);
1614 
1615  // change the selection
1616  switch (nType)
1617  {
1618  case LOK_SETTEXTSELECTION_START:
1619  if (nNewPosX != nCol1 || nNewPosY != nRow1 || bWasEmpty)
1620  {
1621  pTabView->SetCursor(nNewPosX, nNewPosY);
1622  pTabView->DoneBlockMode();
1623  pTabView->InitBlockMode(nNewPosX, nNewPosY, nTab, true);
1624  pTabView->MarkCursor(nCol2, nRow2, nTab);
1625  }
1626  break;
1627  case LOK_SETTEXTSELECTION_END:
1628  if (nNewPosX != nCol2 || nNewPosY != nRow2 || bWasEmpty)
1629  {
1630  pTabView->SetCursor(nCol1, nRow1);
1631  pTabView->DoneBlockMode();
1632  pTabView->InitBlockMode(nCol1, nRow1, nTab, true);
1633  pTabView->MarkCursor(nNewPosX, nNewPosY, nTab);
1634  }
1635  break;
1636  default:
1637  assert(false);
1638  break;
1639  }
1640 }
1641 
1643 {
1644  // called at the end of painting, and from timer after background text width calculation
1645 
1646  if (!bNeedsRepaint)
1647  return;
1648 
1649  bNeedsRepaint = false;
1650  if (aRepaintPixel.IsEmpty())
1651  Invalidate();
1652  else
1655 
1656  // selection function in status bar might also be invalid
1657  SfxBindings& rBindings = mrViewData.GetBindings();
1658  rBindings.Invalidate( SID_STATUS_SUM );
1659  rBindings.Invalidate( SID_ATTR_SIZE );
1660  rBindings.Invalidate( SID_TABLE_CELL );
1661 }
1662 
1663 void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
1664 {
1666  if (!pPageData)
1667  return;
1668 
1669  ScDocument& rDoc = mrViewData.GetDocument();
1670  SCTAB nTab = mrViewData.GetTabNo();
1671  Size aWinSize = GetOutputSizePixel();
1672  const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1674  Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor );
1675 
1676  OUString aPageStr = ScResId( STR_PGNUM );
1677  if ( nPageScript == SvtScriptType::NONE )
1678  {
1679  // get script type of translated "Page" string only once
1680  nPageScript = rDoc.GetStringScriptType( aPageStr );
1681  if (nPageScript == SvtScriptType::NONE)
1683  }
1684 
1685  vcl::Font aFont;
1686  std::unique_ptr<ScEditEngineDefaulter> pEditEng;
1687  const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
1688  if ( nPageScript == SvtScriptType::LATIN )
1689  {
1690  // use single font and call DrawText directly
1691  rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
1692  aFont.SetColor( COL_LIGHTGRAY );
1693  // font size is set as needed
1694  }
1695  else
1696  {
1697  // use EditEngine to draw mixed-script string
1698  pEditEng.reset(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true ));
1699  pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
1700  auto pEditDefaults = std::make_unique<SfxItemSet>( pEditEng->GetEmptyItemSet() );
1701  rDefPattern.FillEditItemSet( pEditDefaults.get() );
1702  pEditDefaults->Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
1703  pEditEng->SetDefaults( std::move(pEditDefaults) );
1704  }
1705 
1706  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
1707  for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
1708  {
1709  ScPrintRangeData& rData = pPageData->GetData(nPos);
1710  ScRange aRange = rData.GetPrintRange();
1711  if ( aRange.aStart.Col() <= nX2+1 && aRange.aEnd.Col()+1 >= nX1 &&
1712  aRange.aStart.Row() <= nY2+1 && aRange.aEnd.Row()+1 >= nY1 )
1713  {
1714  // 3 pixel frame around the print area
1715  // (middle pixel on the grid lines)
1716 
1717  rRenderContext.SetLineColor();
1718  if (rData.IsAutomatic())
1719  rRenderContext.SetFillColor( aAutomatic );
1720  else
1721  rRenderContext.SetFillColor( aManual );
1722 
1723  Point aStart = mrViewData.GetScrPos(
1724  aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
1725  Point aEnd = mrViewData.GetScrPos(
1726  aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, true );
1727  aStart.AdjustX( -2 );
1728  aStart.AdjustY( -2 );
1729 
1730  // Prevent overflows:
1731  if ( aStart.X() < -10 ) aStart.setX( -10 );
1732  if ( aStart.Y() < -10 ) aStart.setY( -10 );
1733  if ( aEnd.X() > aWinSize.Width() + 10 )
1734  aEnd.setX( aWinSize.Width() + 10 );
1735  if ( aEnd.Y() > aWinSize.Height() + 10 )
1736  aEnd.setY( aWinSize.Height() + 10 );
1737 
1738  rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
1739  rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
1740  rRenderContext.DrawRect( tools::Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
1741  rRenderContext.DrawRect( tools::Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
1742 
1743  // Page breaks
1745 
1746  size_t nColBreaks = rData.GetPagesX();
1747  const SCCOL* pColEnd = rData.GetPageEndX();
1748  size_t nColPos;
1749  for (nColPos=0; nColPos+1<nColBreaks; nColPos++)
1750  {
1751  SCCOL nBreak = pColEnd[nColPos]+1;
1752  if ( nBreak >= nX1 && nBreak <= nX2+1 )
1753  {
1755  if (rDoc.HasColBreak(nBreak, nTab) & ScBreakType::Manual)
1756  rRenderContext.SetFillColor( aManual );
1757  else
1758  rRenderContext.SetFillColor( aAutomatic );
1759  Point aBreak = mrViewData.GetScrPos(
1760  nBreak, aRange.aStart.Row(), eWhich, true );
1761  rRenderContext.DrawRect( tools::Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
1762  }
1763  }
1764 
1765  size_t nRowBreaks = rData.GetPagesY();
1766  const SCROW* pRowEnd = rData.GetPageEndY();
1767  size_t nRowPos;
1768  for (nRowPos=0; nRowPos+1<nRowBreaks; nRowPos++)
1769  {
1770  SCROW nBreak = pRowEnd[nRowPos]+1;
1771  if ( nBreak >= nY1 && nBreak <= nY2+1 )
1772  {
1774  if (rDoc.HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
1775  rRenderContext.SetFillColor( aManual );
1776  else
1777  rRenderContext.SetFillColor( aAutomatic );
1778  Point aBreak = mrViewData.GetScrPos(
1779  aRange.aStart.Col(), nBreak, eWhich, true );
1780  rRenderContext.DrawRect( tools::Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
1781  }
1782  }
1783 
1784  // Page numbers
1785 
1786  SCROW nPrStartY = aRange.aStart.Row();
1787  for (nRowPos=0; nRowPos<nRowBreaks; nRowPos++)
1788  {
1789  SCROW nPrEndY = pRowEnd[nRowPos];
1790  if ( nPrEndY >= nY1 && nPrStartY <= nY2 )
1791  {
1792  SCCOL nPrStartX = aRange.aStart.Col();
1793  for (nColPos=0; nColPos<nColBreaks; nColPos++)
1794  {
1795  SCCOL nPrEndX = pColEnd[nColPos];
1796  if ( nPrEndX >= nX1 && nPrStartX <= nX2 )
1797  {
1798  Point aPageStart = mrViewData.GetScrPos(
1799  nPrStartX, nPrStartY, eWhich, true );
1800  Point aPageEnd = mrViewData.GetScrPos(
1801  nPrEndX+1,nPrEndY+1, eWhich, true );
1802 
1803  tools::Long nPageNo = rData.GetFirstPage();
1804  if ( rData.IsTopDown() )
1805  nPageNo += static_cast<tools::Long>(nColPos)*nRowBreaks+nRowPos;
1806  else
1807  nPageNo += static_cast<tools::Long>(nRowPos)*nColBreaks+nColPos;
1808 
1809  OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo));
1810 
1811  if ( pEditEng )
1812  {
1813  // find right font size with EditEngine
1814  tools::Long nHeight = 100;
1815  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
1816  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
1817  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
1818  pEditEng->SetTextCurrentDefaults( aThisPageStr );
1819  Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
1820 
1821  // 40% of width or 60% of height
1822  tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
1823  tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
1824  nHeight = std::min(nSizeX,nSizeY);
1825  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
1826  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
1827  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
1828 
1829  // centered output with EditEngine
1830  Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
1831  Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
1832  (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
1833  pEditEng->Draw(rRenderContext, aPos);
1834  }
1835  else
1836  {
1837  // find right font size for DrawText
1838  aFont.SetFontSize( Size( 0,100 ) );
1839  rRenderContext.SetFont( aFont );
1840  Size aSize100(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
1841 
1842  // 40% of width or 60% of height
1843  tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
1844  tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
1845  aFont.SetFontSize( Size( 0,std::min(nSizeX,nSizeY) ) );
1846  rRenderContext.SetFont( aFont );
1847 
1848  // centered output with DrawText
1849  Size aTextSize(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
1850  Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
1851  (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
1852  rRenderContext.DrawText( aPos, aThisPageStr );
1853  }
1854  }
1855  nPrStartX = nPrEndX + 1;
1856  }
1857  }
1858  nPrStartY = nPrEndY + 1;
1859  }
1860  }
1861  }
1862 }
1863 
1864 void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev)
1865 {
1866  aComboButton.SetOutputDevice( pContentDev );
1867 
1868  ScDocument& rDoc = mrViewData.GetDocument();
1869  ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc);
1870 
1871  SCCOL nCol;
1872  SCROW nRow;
1873  SCSIZE nArrY;
1874  SCSIZE nQuery;
1875  SCTAB nTab = mrViewData.GetTabNo();
1876  ScDBData* pDBData = nullptr;
1877  std::unique_ptr<ScQueryParam> pQueryParam;
1878 
1879  RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
1880  sal_uInt16 nArrCount = rTabInfo.mnArrCount;
1881 
1882  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
1883 
1884  Point aOldPos = aComboButton.GetPosPixel(); // store state for MouseDown/Up
1885  Size aOldSize = aComboButton.GetSizePixel();
1886 
1887  for (nArrY=1; nArrY+1<nArrCount; nArrY++)
1888  {
1889  if ( pRowInfo[nArrY].bAutoFilter && pRowInfo[nArrY].bChanged )
1890  {
1891  RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1892 
1893  nRow = pThisRowInfo->nRowNo;
1894 
1895  for (nCol=nX1; nCol<=nX2; nCol++)
1896  {
1897  CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
1898  //if several columns merged on a row, there should be only one auto button at the end of the columns.
1899  //if several rows merged on a column, the button may be in the middle, so "!pInfo->bVOverlapped" should not be used
1900  if ( pInfo->bAutoFilter && !pInfo->bHOverlapped )
1901  {
1902  if (!pQueryParam)
1903  pQueryParam.reset(new ScQueryParam);
1904 
1905  bool bNewData = true;
1906  if (pDBData)
1907  {
1908  SCCOL nStartCol;
1909  SCROW nStartRow;
1910  SCCOL nEndCol;
1911  SCROW nEndRow;
1912  SCTAB nAreaTab;
1913  pDBData->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
1914  if ( nCol >= nStartCol && nCol <= nEndCol &&
1915  nRow >= nStartRow && nRow <= nEndRow )
1916  bNewData = false;
1917  }
1918  if (bNewData)
1919  {
1920  pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
1921  if (pDBData)
1922  pDBData->GetQueryParam( *pQueryParam );
1923  else
1924  {
1925  // can also be part of DataPilot table
1926  }
1927  }
1928 
1929  // pQueryParam can only include MAXQUERY entries
1930 
1931  bool bArrowState = false;
1932  if (pQueryParam->bInplace)
1933  {
1934  SCSIZE nCount = pQueryParam->GetEntryCount();
1935  for (nQuery = 0; nQuery < nCount; ++nQuery)
1936  {
1937  // Do no restrict to EQUAL here
1938  // (Column head should become blue also when ">1")
1939  const ScQueryEntry& rEntry = pQueryParam->GetEntry(nQuery);
1940  if (rEntry.bDoQuery && rEntry.nField == nCol)
1941  {
1942  bArrowState = true;
1943  break;
1944  }
1945  }
1946  }
1947 
1948  tools::Long nSizeX;
1949  tools::Long nSizeY;
1950  SCCOL nStartCol= nCol;
1951  SCROW nStartRow = nRow;
1952  //if address(nCol,nRow) is not the start pos of the merge area, the value of the nSizeX will be incorrect, it will be the length of the cell.
1953  //should first get the start pos of the merge area, then get the nSizeX through the start pos.
1954  rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
1955  mrViewData.GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX
1956  nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY());
1957  Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
1958 
1959  aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
1960  aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
1961  aCellBtn.setDrawBaseButton(false);
1962  aCellBtn.setDrawPopupButton(true);
1963  aCellBtn.setHasHiddenMember(bArrowState);
1964  aCellBtn.draw();
1965  }
1966  }
1967  }
1968 
1969  if ( pRowInfo[nArrY].bPivotButton && pRowInfo[nArrY].bChanged )
1970  {
1971  RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1972  nRow = pThisRowInfo->nRowNo;
1973  for (nCol=nX1; nCol<=nX2; nCol++)
1974  {
1975  CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
1976  if (pInfo->bHOverlapped || pInfo->bVOverlapped)
1977  continue;
1978 
1979  Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
1980  tools::Long nSizeX;
1981  tools::Long nSizeY;
1982  mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
1983  tools::Long nPosX = aScrPos.X();
1984  tools::Long nPosY = aScrPos.Y();
1985  // bLayoutRTL is handled in setBoundingBox
1986 
1987  OUString aStr = rDoc.GetString(nCol, nRow, nTab);
1988  aCellBtn.setText(aStr);
1989  aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
1990  aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
1991  aCellBtn.setDrawBaseButton(pInfo->bPivotButton);
1992  aCellBtn.setDrawPopupButton(pInfo->bPivotPopupButton);
1993  aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
1994  aCellBtn.draw();
1995  }
1996  }
1997 
1998  if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
1999  {
2001  aComboButton.SetPosPixel( aRect.TopLeft() );
2002  aComboButton.SetSizePixel( aRect.GetSize() );
2003  pContentDev->SetClipRegion(vcl::Region(aRect));
2004  aComboButton.Draw();
2005  pContentDev->SetClipRegion(); // always called from Draw() without clip region
2006  aComboButton.SetPosPixel( aOldPos ); // restore old state
2007  aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
2008  }
2009  }
2010 
2011  pQueryParam.reset();
2013 }
2014 
2016 {
2017  ScDocument& rDoc = mrViewData.GetDocument();
2018  SCTAB nTab = mrViewData.GetTabNo();
2019  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2020  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2021 
2022  ScDDComboBoxButton aButton( GetOutDev() ); // for optimal size
2023  Size aBtnSize = aButton.GetSizePixel();
2024 
2025  SCCOL nCol = rButtonPos.Col();
2026  SCROW nRow = rButtonPos.Row();
2027 
2028  tools::Long nCellSizeX; // width of this cell, including merged
2029  tools::Long nDummy;
2030  mrViewData.GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
2031 
2032  // for height, only the cell's row is used, excluding merged cells
2033  tools::Long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), mrViewData.GetPPTY() );
2034  tools::Long nAvailable = nCellSizeX;
2035 
2036  // left edge of next cell if there is a non-hidden next column
2037  SCCOL nNextCol = nCol + 1;
2038  const ScMergeAttr* pMerge = rDoc.GetAttr( nCol,nRow,nTab, ATTR_MERGE );
2039  if ( pMerge->GetColMerge() > 1 )
2040  nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area
2041  while ( nNextCol <= rDoc.MaxCol() && rDoc.ColHidden(nNextCol, nTab) )
2042  ++nNextCol;
2043  bool bNextCell = ( nNextCol <= rDoc.MaxCol() );
2044  if ( bNextCell )
2045  nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), mrViewData.GetPPTX() );
2046 
2047  if ( nAvailable < aBtnSize.Width() )
2048  aBtnSize.setWidth( nAvailable );
2049  if ( nCellSizeY < aBtnSize.Height() )
2050  aBtnSize.setHeight( nCellSizeY );
2051 
2052  Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich, true );
2053  aPos.AdjustX(nCellSizeX * nLayoutSign ); // start of next cell
2054  if (!bNextCell)
2055  aPos.AdjustX( -(aBtnSize.Width() * nLayoutSign) ); // right edge of cell if next cell not available
2056  aPos.AdjustY(nCellSizeY - aBtnSize.Height() );
2057  // X remains at the left edge
2058 
2059  if ( bLayoutRTL )
2060  aPos.AdjustX( -(aBtnSize.Width()-1) ); // align right edge of button with cell border
2061 
2062  return tools::Rectangle( aPos, aBtnSize );
2063 }
2064 
2066 {
2067  ScDocument& rDoc = mrViewData.GetDocument();
2068  ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2069  ScQueryParam aQueryParam;
2070 
2071  if ( pDBData )
2072  pDBData->GetQueryParam( aQueryParam );
2073  else
2074  {
2075  OSL_FAIL("Auto filter button without DBData");
2076  }
2077 
2078  bool bSimpleQuery = true;
2079  bool bColumnFound = false;
2080  SCSIZE nQuery;
2081 
2082  if ( !aQueryParam.bInplace )
2083  bSimpleQuery = false;
2084 
2085  // aQueryParam can only include MAXQUERY entries
2086 
2087  SCSIZE nCount = aQueryParam.GetEntryCount();
2088  for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
2089  if ( aQueryParam.GetEntry(nQuery).bDoQuery )
2090  {
2091  if (aQueryParam.GetEntry(nQuery).nField == nCol)
2092  bColumnFound = true;
2093 
2094  if (nQuery > 0)
2095  if (aQueryParam.GetEntry(nQuery).eConnect != SC_AND)
2096  bSimpleQuery = false;
2097  }
2098 
2099  return ( bSimpleQuery && bColumnFound );
2100 }
2101 
2102 void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelRects ) const
2103 {
2104  GetPixelRectsFor( mrViewData.GetMarkData(), rPixelRects );
2105 }
2106 
2107 void ScGridWindow::GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle >& rRects) const
2108 {
2109  GetRectsAnyFor(mrViewData.GetMarkData(), rRects, true);
2110 }
2111 
2114  ::std::vector< tools::Rectangle >& rPixelRects ) const
2115 {
2116  GetRectsAnyFor(rMarkData, rPixelRects, false);
2117 }
2118 
2120  ::std::vector< tools::Rectangle >& rRects,
2121  bool bInPrintTwips) const
2122 {
2123  ScDocument& rDoc = mrViewData.GetDocument();
2124  SCTAB nTab = mrViewData.GetTabNo();
2125  double nPPTX = mrViewData.GetPPTX();
2126  double nPPTY = mrViewData.GetPPTY();
2127  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2128  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2129 
2130  ScMarkData aMultiMark( rMarkData );
2131  aMultiMark.SetMarking( false );
2132 
2133  if (!aMultiMark.IsMultiMarked())
2134  {
2135  // simple range case - simplify calculation
2136  ScRange aSimpleRange;
2137  aMultiMark.GetMarkArea( aSimpleRange );
2138 
2139  aMultiMark.MarkToMulti();
2140  if ( !aMultiMark.IsMultiMarked() )
2141  return;
2142 
2143  SCCOL nX1 = aSimpleRange.aStart.Col();
2144  SCROW nY1 = aSimpleRange.aStart.Row();
2145  SCCOL nX2 = aSimpleRange.aEnd.Col();
2146  SCROW nY2 = aSimpleRange.aEnd.Row();
2147 
2148  PutInOrder( nX1, nX2 );
2149  PutInOrder( nY1, nY2 );
2150 
2151  SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2152  SCROW nPosY = mrViewData.GetPosY( eVWhich );
2153  // is the selection visible at all?
2154  if (nX2 < nPosX || nY2 < nPosY)
2155  return;
2156 
2157  Point aScrStartPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2158  mrViewData.GetScrPos(nX1, nY1, eWhich);
2159 
2160  tools::Long nStartX = aScrStartPos.X();
2161  tools::Long nStartY = aScrStartPos.Y();
2162 
2163  Point aScrEndPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX2, nY2) :
2164  mrViewData.GetScrPos(nX2, nY2, eWhich);
2165 
2166  tools::Long nWidthTwips = rDoc.GetColWidth(nX2, nTab);
2167  const tools::Long nWidth = bInPrintTwips ?
2168  nWidthTwips : ScViewData::ToPixel(nWidthTwips, nPPTX);
2169  tools::Long nEndX = aScrEndPos.X() + (nWidth - 1) * nLayoutSign;
2170 
2171  sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY2, nTab );
2172  const tools::Long nHeight = bInPrintTwips ?
2173  nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2174  tools::Long nEndY = aScrEndPos.Y() + nHeight - 1;
2175 
2176  ScInvertMerger aInvert( &rRects );
2177  aInvert.AddRect( tools::Rectangle( nStartX, nStartY, nEndX, nEndY ) );
2178 
2179  return;
2180  }
2181 
2182  aMultiMark.MarkToMulti();
2183  if ( !aMultiMark.IsMultiMarked() )
2184  return;
2185  ScRange aMultiRange;
2186  aMultiMark.GetMultiMarkArea( aMultiRange );
2187  SCCOL nX1 = aMultiRange.aStart.Col();
2188  SCROW nY1 = aMultiRange.aStart.Row();
2189  SCCOL nX2 = aMultiRange.aEnd.Col();
2190  SCROW nY2 = aMultiRange.aEnd.Row();
2191 
2192  PutInOrder( nX1, nX2 );
2193  PutInOrder( nY1, nY2 );
2194 
2195  SCCOL nTestX2 = nX2;
2196  SCROW nTestY2 = nY2;
2197 
2198  rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
2199 
2200  SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2201  SCROW nPosY = mrViewData.GetPosY( eVWhich );
2202  // is the selection visible at all?
2203  if (nTestX2 < nPosX || nTestY2 < nPosY)
2204  return;
2205  SCCOL nRealX1 = nX1;
2206  if (nX1 < nPosX)
2207  nX1 = nPosX;
2208  if (nY1 < nPosY)
2209  nY1 = nPosY;
2210 
2212  {
2213  // limit the selection to only what is visible on the screen
2214  SCCOL nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich);
2215  if (nXRight > rDoc.MaxCol())
2216  nXRight = rDoc.MaxCol();
2217 
2218  SCROW nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich);
2219  if (nYBottom > rDoc.MaxRow())
2220  nYBottom = rDoc.MaxRow();
2221 
2222  // is the selection visible at all?
2223  if (nX1 > nXRight || nY1 > nYBottom)
2224  return;
2225 
2226  if (nX2 > nXRight)
2227  nX2 = nXRight;
2228  if (nY2 > nYBottom)
2229  nY2 = nYBottom;
2230  }
2231  else
2232  {
2233  SCCOL nMaxTiledCol;
2234  SCROW nMaxTiledRow;
2235  rDoc.GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
2236 
2237  if (nX2 > nMaxTiledCol)
2238  nX2 = nMaxTiledCol;
2239  if (nY2 > nMaxTiledRow)
2240  nY2 = nMaxTiledRow;
2241  }
2242 
2243  ScInvertMerger aInvert( &rRects );
2244 
2245  Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2246  mrViewData.GetScrPos(nX1, nY1, eWhich);
2247  tools::Long nScrY = aScrPos.Y();
2248  bool bWasHidden = false;
2249  for (SCROW nY=nY1; nY<=nY2; nY++)
2250  {
2251  bool bFirstRow = ( nY == nPosY ); // first visible row?
2252  bool bDoHidden = false; // repeat hidden ?
2253  sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY,nTab );
2254  bool bDoRow = ( nHeightTwips != 0 );
2255  if (bDoRow)
2256  {
2257  if (bWasHidden) // test hidden merge
2258  {
2259  bDoHidden = true;
2260  bDoRow = true;
2261  }
2262 
2263  bWasHidden = false;
2264  }
2265  else
2266  {
2267  bWasHidden = true;
2268  if (nY==nY2)
2269  bDoRow = true; // last cell of the block
2270  }
2271 
2272  if ( bDoRow )
2273  {
2274  SCCOL nLoopEndX = nX2;
2275  if (nX2 < nX1) // the rest of the merge
2276  {
2277  SCCOL nStartX = nX1;
2278  while ( rDoc.GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
2279  --nStartX;
2280  if (nStartX <= nX2)
2281  nLoopEndX = nX1;
2282  }
2283 
2284  const tools::Long nHeight = bInPrintTwips ?
2285  nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2286  tools::Long nEndY = nScrY + nHeight - 1;
2287  tools::Long nScrX = aScrPos.X();
2288  for (SCCOL nX=nX1; nX<=nLoopEndX; nX++)
2289  {
2290  tools::Long nWidth = rDoc.GetColWidth(nX, nTab);
2291  if (!bInPrintTwips)
2292  nWidth = ScViewData::ToPixel(nWidth, nPPTX);
2293 
2294  if ( nWidth > 0 )
2295  {
2296  tools::Long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign;
2297 
2298  SCROW nThisY = nY;
2299  const ScPatternAttr* pPattern = rDoc.GetPattern( nX, nY, nTab );
2300  const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2301  if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) )
2302  {
2303  while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 &&
2304  (rDoc.RowHidden(nThisY-1, nTab) || bFirstRow) )
2305  {
2306  --nThisY;
2307  pPattern = rDoc.GetPattern( nX, nThisY, nTab );
2308  pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2309  }
2310  }
2311 
2312  // only the rest of the merged is seen ?
2313  SCCOL nThisX = nX;
2314  if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 )
2315  {
2316  while ( pMergeFlag->IsHorOverlapped() )
2317  {
2318  --nThisX;
2319  pPattern = rDoc.GetPattern( nThisX, nThisY, nTab );
2320  pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2321  }
2322  }
2323 
2324  if ( aMultiMark.IsCellMarked( nThisX, nThisY, true ) )
2325  {
2326  if ( !pMergeFlag->IsOverlapped() )
2327  {
2328  const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE);
2329  if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0)
2330  {
2331  const SCCOL nEndColMerge = nThisX + pMerge->GetColMerge();
2332  const SCROW nEndRowMerge = nThisY + pMerge->GetRowMerge();
2333  Point aEndPos = bInPrintTwips ?
2334  mrViewData.GetPrintTwipsPos(nEndColMerge, nEndRowMerge) :
2335  mrViewData.GetScrPos(nEndColMerge, nEndRowMerge, eWhich);
2336  if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY )
2337  {
2338  aInvert.AddRect( tools::Rectangle( nScrX,nScrY,
2339  aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) );
2340  }
2341  }
2342  else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY )
2343  {
2344  aInvert.AddRect( tools::Rectangle( nScrX,nScrY,nEndX,nEndY ) );
2345  }
2346  }
2347  }
2348 
2349  nScrX = nEndX + nLayoutSign;
2350  }
2351  }
2352  nScrY = nEndY + 1;
2353  }
2354  }
2355 }
2356 
2358 {
2359  Window::DataChanged(rDCEvt);
2360 
2361  if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) ||
2362  (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
2363  (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
2364  (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
2365  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2366  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
2367  return;
2368 
2369  if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == mrViewData.GetActivePart() )
2371 
2372  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2373  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
2374  {
2375  if ( eWhich == mrViewData.GetActivePart() ) // only once for the view
2376  {
2377  ScTabView* pView = mrViewData.GetView();
2378 
2379  pView->RecalcPPT();
2380 
2381  // RepeatResize in case scroll bar sizes have changed
2382  pView->RepeatResize();
2383  pView->UpdateAllOverlays();
2384 
2385  // invalidate cell attribs in input handler, in case the
2386  // EditEngine BackgroundColor has to be changed
2387  if ( mrViewData.IsActive() )
2388  {
2389  ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
2390  if (pHdl)
2391  pHdl->ForgetLastPattern();
2392  }
2393  }
2394  }
2395 
2396  Invalidate();
2397 }
2398 
2400 {
2401  bInitialPageBreaks = true;
2402 }
2403 
2404 IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
2405 {
2406  if (pTimer != &maShowPageBreaksTimer)
2407  return;
2408 
2409  const ScViewOptions& rOpts = mrViewData.GetOptions();
2410  const bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
2411  // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page
2412  // breaks is enabled, breaks should be visible. If the document is
2413  // opened the first time or a tab is activated the first time, the
2414  // breaks are not calculated yet, so this initialization is done here.
2415  if (bPage)
2416  {
2417  const SCTAB nCurrentTab = mrViewData.GetTabNo();
2418  ScDocument& rDoc = mrViewData.GetDocument();
2419  const Size aPageSize = rDoc.GetPageSize(nCurrentTab);
2420  // Do not attempt to calculate a page size here if it is empty if
2421  // that involves counting pages.
2422  // An earlier implementation did
2423  // ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
2424  // rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
2425  // which resulted in tremendous waiting times after having loaded
2426  // larger documents i.e. imported from CSV, in which UI is entirely
2427  // blocked. All time is spent under ScPrintFunc::CountPages() in
2428  // ScTable::ExtendPrintArea() in the loop that calls
2429  // MaybeAddExtraColumn() to do stuff for each text string content
2430  // cell (each row in each column). Maybe that can be optimized, or
2431  // obtaining page size without that overhead would be possible, but
2432  // as is calling that from here is a no-no so this is a quick
2433  // disable things.
2434  if (!aPageSize.IsEmpty())
2435  {
2436  ScDocShell* pDocSh = mrViewData.GetDocShell();
2437  const bool bModified = pDocSh->IsModified();
2438  // Even setting the same size sets page size valid, so
2439  // UpdatePageBreaks() actually does something.
2440  rDoc.SetPageSize( nCurrentTab, aPageSize);
2441  rDoc.UpdatePageBreaks(nCurrentTab);
2442  pDocSh->PostPaint(0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab, PaintPartFlags::Grid);
2443  pDocSh->SetModified(bModified);
2444  }
2445  }
2446 }
2447 
2448 
2449 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long nScrY
Definition: output.hxx:185
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3109
void SetClipRegion()
const Fraction & GetScaleX() const
void SetSyntaxMode(bool bNewMode)
Definition: output.cxx:280
void InvalidateLOKViewCursor(const tools::Rectangle &rCursorRect, const Fraction aScaleX, const Fraction aScaleY)
Definition: gridwin4.cxx:353
std::unique_ptr< RowInfo[]> mpRowInfo
Definition: fillinfo.hxx:195
bool IsHidden() const
Definition: rfindlst.hxx:58
void FillInfo(ScTableInfo &rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode, const ScMarkData *pMarkData=nullptr)
Definition: fillinfo.cxx:347
constexpr double nPPTY
SCCOL GetColMerge() const
Definition: attrib.hxx:68
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6235
void SetOutputDevice(OutputDevice *pOutputDevice)
Definition: cbuttonw.cxx:38
void DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo &rTabInfo, OutputDevice *pContentDev)
Definition: gridwin4.cxx:1864
void SetPixelOffset(const Size &rOffset)
std::unique_ptr< ScNoteMarker, o3tl::default_delete< ScNoteMarker > > mpNoteMarker
Definition: gridwin.hxx:152
OutputDevice & GetOutputDevice() const
void ExtendHidden(SCCOL &rX1, SCROW &rY1, SCCOL &rX2, SCROW &rY2, SCTAB nTab)
Definition: document.cxx:4725
void SetFontSize(const Size &)
bool HasScenarioRange(SCTAB nTab, const ScRange &rRange) const
Definition: documen3.cxx:867
static void notifyInvalidation(SfxViewShell const *pThisView, tools::Rectangle const *)
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:353
ScAddress aStart
Definition: address.hxx:499
void DrawFrame(vcl::RenderContext &rRenderContext)
Definition: output.cxx:1385
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:42
SCROW GetRefEndY() const
Definition: viewdata.hxx:526
IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer *, pTimer, void)
Definition: gridwin4.cxx:2404
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
void SetShowNullValues(bool bSet)
Definition: output.cxx:248
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
bool bPivotButton
Definition: fillinfo.hxx:163
bool IsInInterpreter() const
Definition: document.hxx:2329
ScDDComboBoxButton aComboButton
Definition: gridwin.hxx:189
This class takes care of physically drawing field button controls inside data pilot tables...
Definition: dpcontrol.hxx:35
void flushOverlayManager()
Definition: gridwin.cxx:6950
void initiatePageBreaks()
Definition: gridwin4.cxx:2399
static void lcl_DrawScenarioFrames(OutputDevice *pDev, ScViewData &rViewData, ScSplitPos eWhich, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2)
Definition: gridwin4.cxx:190
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:252
SCROW Row() const
Definition: address.hxx:261
void setWidth(tools::Long nWidth)
void SetUseStyleColor(bool bSet)
Definition: output.hxx:323
OUString GetTitle(sal_uInt16 nMaxLen=0) const
void GetRectsAnyFor(const ScMarkData &rMarkData,::std::vector< tools::Rectangle > &rRects, bool bInPrintTwips) const
Definition: gridwin4.cxx:2119
void MarkToMulti()
Definition: markdata.cxx:223
tools::Rectangle GetListValButtonRect(const ScAddress &rButtonPos)
Definition: gridwin4.cxx:2015
void DrawClipMarks()
Definition: output.cxx:2475
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
const Fraction & GetZoomX() const
Definition: viewdata.hxx:458
void LogicInvalidate(const tools::Rectangle *pRectangle) override
Definition: gridwin4.cxx:1547
virtual SdrObject * TryToGetSdrObject() const
std::vector< LOKCursorEntry > maLOKLastCursor
Definition: gridwin.hxx:143
constexpr tools::Long Left() const
SC_DLLPUBLIC bool IsActiveScenario(SCTAB nTab) const
Definition: documen3.cxx:880
const std::vector< ScHighlightEntry > & GetHighlightRanges() const
Definition: tabview.hxx:329
bool bHOverlapped
Definition: fillinfo.hxx:160
ScScenarioFlags
Definition: global.hxx:223
tools::Long const nLeftMargin
SCCOL nX1
Definition: output.hxx:189
bool IsInputMode() const
Definition: inputhdl.hxx:185
Point GetPrintTwipsPos(SCCOL nCol, SCROW nRow) const
returns the position (top-left corner) of the requested cell in print twips coordinates.
Definition: viewdata.cxx:2528
bool Intersects(const ScRange &rRange) const
Definition: address.hxx:748
SCROW GetRefStartY() const
Definition: viewdata.hxx:523
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:772
std::unique_ptr< FmFormView > mpLOKDrawView
LibreOfficeKit needs a persistent FmFormView for tiled rendering, otherwise the invalidations from dr...
Definition: gridwin.hxx:111
long Long
virtual void calculateGridOffsetForViewOjectContact(basegfx::B2DVector &rTarget, const ViewObjectContact &rClient) const
constexpr::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
const SCCOL * GetPageEndX() const
Definition: pagedata.hxx:50
const StyleSettings & GetStyleSettings() const
SCROW GetCurY() const
Definition: viewdata.hxx:401
svtools::ColorConfig & GetColorConfig()
Definition: scmod.cxx:814
bool IsOverlapped() const
Definition: attrib.hxx:101
void DrawRefMark(SCCOL nRefStartX, SCROW nRefStartY, SCCOL nRefEndX, SCROW nRefEndY, const Color &rColor, bool bHandle)
Draws reference mark and returns its properties.
Definition: output.cxx:2013
SCSIZE mnArrCount
Definition: fillinfo.hxx:196
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
#define SC_SCENARIO_VSPACE
Definition: output.hxx:55
sal_Int64 n
ScViewData & mrViewData
Definition: gridwin.hxx:147
ViewShellDocId GetDocId() const override
virtual Size GetSizePixel() const
void DrawChangeTrack()
Definition: output.cxx:2258
void AddRect(const tools::Rectangle &rRect)
Definition: invmerge.cxx:123
ScPrintRangeData & GetData(size_t i)
Definition: pagedata.cxx:60
Timer maShowPageBreaksTimer
Definition: gridwin.hxx:203
const ContentProperties & rData
double GetPPTX() const
Definition: viewdata.hxx:467
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:572
const MapMode & GetMapMode() const
void SetOptSizePixel()
Definition: cbuttonw.cxx:43
SCTAB GetTabNo() const
Definition: viewdata.hxx:394
constexpr SdrLayerID SC_LAYER_BACK(1)
static void lcl_GetEditAreaTLOffset(tools::Long &nOffsetX, tools::Long &nOffsetY, const ScAddress &rAddr, const ScViewData &rViewData, ScDocument &rDoc)
Definition: gridwin4.cxx:283
bool IsSyntaxMode() const
Definition: viewdata.hxx:548
SCCOLROW nField
Definition: queryentry.hxx:61
ScRange Combine() const
Definition: rangelst.cxx:1119
DataChangedEventType GetType() const
ScAddress aEnd
Definition: address.hxx:500
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:397
static void UpdateInputLine()
Definition: tabview3.cxx:3031
void SetSolidBackground(bool bSet)
Definition: output.hxx:322
ScDocument & GetDocument() const
Definition: viewdata.hxx:379
void SetShowFormulas(bool bSet)
Definition: output.cxx:253
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
Definition: gridwin4.cxx:1573
const tools::Rectangle & GetOutputArea() const
void UpdateAllOverlays()
Definition: tabview2.cxx:1000
void SetMarkClipped(bool bSet)
Definition: output.cxx:243
constexpr::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
void SetSizePixel(const Size &rNewSize)
Definition: cbutton.hxx:45
void Invalidate(sal_uInt16 nId)
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:363
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1400
void SetMapMode()
SCROW GetEditEndRow() const
Definition: viewdata.hxx:598
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT(EE_CHAR_START+2)
SCROW nRowNo
Definition: fillinfo.hxx:182
SC_DLLPUBLIC SvtScriptType GetStringScriptType(const OUString &rString)
Definition: documen6.cxx:76
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4378
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4180
void SetContentDevice(OutputDevice *pContentDev)
Definition: output.cxx:222
SCROW nY2
Definition: output.hxx:192
ScSplitPos
Definition: viewdata.hxx:44
void DrawPagePreview(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext &rRenderContext)
Definition: gridwin4.cxx:1663
bool IsCellMarked(SCCOL nCol, SCROW nRow, bool bNoSimple=false) const
Definition: markdata.cxx:284
bool bIsInPaint
Definition: gridwin.hxx:211
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6075
void GetMarkArea(ScRange &rRange) const
Definition: markdata.cxx:111
constexpr tools::Long Width() const
HashMap_OWString_Interface aMap
const SCROW * GetPageEndY() const
Definition: pagedata.hxx:52
static rtl::Reference< SfxItemPool > CreatePool()
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: documen8.cxx:115
tools::Rectangle aInvertRect
Definition: gridwin.hxx:199
void disposeAndReset(VirtualDevice *pBody)
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:690
bool IsOle() const
Definition: viewdata.cxx:3971
void DrawSdrGrid(const tools::Rectangle &rDrawingRect, OutputDevice *pContentDev)
Definition: gridwin3.cxx:234
bool IsAutoFilterActive(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: gridwin4.cxx:2065
ScPageBreakData * GetPageBreakData()
Definition: tabview.hxx:328
void SetFmtDevice(OutputDevice *pRDev)
Definition: output.hxx:317
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:878
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
const Fraction & GetScaleY() const
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
vcl::Cursor * GetCursor() const
OutputDevice & GetTargetOutputDevice()
void Draw(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode)
Definition: gridwin4.cxx:460
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
Definition: viewdata.cxx:2684
bool IsMultiMarked() const
Definition: markdata.hxx:82
void DrawContent(OutputDevice &rDevice, const ScTableInfo &rTableInfo, ScOutputData &aOutputData, bool bLogicText)
Draw content of the gridwindow; shared between the desktop and the tiled rendering.
Definition: gridwin4.cxx:627
int nCount
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
SC_DLLPUBLIC SCSIZE GetEntryCount() const
Definition: queryparam.cxx:111
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3522
AllSettingsFlags GetFlags() const
bool isCompatFlagSet(Compat flag)
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:116
void CheckNeedsRepaint()
Definition: gridwin4.cxx:1642
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:653
SCTAB Tab() const
Definition: address.hxx:270
void SetDrawView(FmFormView *pNew)
Definition: output.hxx:320
void GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle > &rRects) const
Definition: gridwin4.cxx:2107
void RecalcPPT()
Definition: tabview3.cxx:2774
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
void PrepareFormulaCalc()
Call this before any operations that might trigger one or more formula cells to get calculated...
Definition: document.cxx:2469
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1414
size_t GetCount() const
Definition: pagedata.hxx:73
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
const Fraction & GetZoomY() const
Definition: viewdata.hxx:459
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4754
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3137
ScViewData & GetViewData()
Definition: tabview.hxx:333
ScAddress aListValPos
Definition: gridwin.hxx:197
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2411
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4733
ScVSplitPos eVWhich
Definition: gridwin.hxx:150
void DrawRect(const tools::Rectangle &rRect)
bool GetTextWysiwyg() const
Definition: inputopt.hxx:63
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
constexpr bool IsEmpty() const
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Definition: viewdata.cxx:2689
void PutInOrder(T &nStart, T &nEnd)
Definition: address.hxx:961
bool empty() const
Definition: rangelst.hxx:88
constexpr void SetLeft(tools::Long v)
void SetEditCell(SCCOL nCol, SCROW nRow)
Definition: output.cxx:268
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1947
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
bool bAutoFilter
Definition: fillinfo.hxx:162
constexpr double nPPTX
bool IsModified() const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1064
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:877
void SetLineColor()
T * get() const
bool IsVerOverlapped() const
Definition: attrib.hxx:100
virtual void PrePaint(vcl::RenderContext &rRenderContext) override
Definition: gridwin4.cxx:315
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4464
void SetScaleX(const Fraction &rScaleX)
static void GetFont(vcl::Font &rFont, const SfxItemSet &rItemSet, ScAutoFontColorMode eAutoMode, const OutputDevice *pOutDev=nullptr, const Fraction *pScale=nullptr, const SfxItemSet *pCondSet=nullptr, SvtScriptType nScript=SvtScriptType::NONE, const Color *pBackConfigColor=nullptr, const Color *pTextConfigColor=nullptr)
Static helper function to fill a font object from the passed item set.
Definition: patattr.cxx:215
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
Point LogicToPixel(const Point &rLogicPt) const
bool IsEmpty() const
SCCOL nX2
Definition: output.hxx:191
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:527
int i
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
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
Definition: viewdata.cxx:2376
bool IsClipRegion() const
bool bChanged
Definition: fillinfo.hxx:188
bool bFilterActive
Definition: fillinfo.hxx:165
tools::Long GetFirstPage() const
Definition: pagedata.hxx:55
SfxBindings & GetBindings()
Definition: viewdata.cxx:3097
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4370
void GetPosFromPixel(tools::Long nClickX, tools::Long nClickY, ScSplitPos eWhich, SCCOL &rPosX, SCROW &rPosY, bool bTestMerge=true, bool bRepair=false, SCTAB nForTab=-1)
Definition: viewdata.cxx:2757
sal_Int16 SCCOL
Definition: types.hxx:21
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:880
const MapMode & GetMapMode() const
bool HasBackgroundDraw(SCTAB nTab, const tools::Rectangle &rMMRect) const
Definition: documen9.cxx:343
bool bInitialPageBreaks
Definition: gridwin.hxx:215
#define SC_MOD()
Definition: scmod.hxx:250
ScSplitPos GetEditActivePart() const
Definition: viewdata.hxx:592
SC_DLLPUBLIC void GetTiledRenderingArea(SCTAB nTab, SCCOL &rEndCol, SCROW &rEndRow) const
Return the number of columns / rows that should be visible for the tiled rendering.
Definition: documen2.cxx:668
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:879
void SetOrigin(const Point &rOrigin)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: gridwin4.cxx:384
bool SetChangedClip()
Definition: output.cxx:1776
const ScRange & GetPrintRange() const
Definition: pagedata.hxx:44
constexpr tools::Long Right() const
void SetFillColor()
const AllSettings & GetSettings() const
size_t size() const
Definition: rangelst.hxx:89
virtual void Start(bool bStartTimer=true) override
void setLocalRendering(bool bLocalRendering=true)
void DrawBackground(vcl::RenderContext &rRenderContext)
Definition: output.cxx:1021
void MarkScenario(SCTAB nSrcTab, SCTAB nDestTab, ScMarkData &rDestMark, bool bResetMark=true, ScScenarioFlags nNeededBits=ScScenarioFlags::NONE) const
Definition: documen3.cxx:855
bool IsActive() const
Definition: viewdata.hxx:381
void DrawDocumentBackground()
Definition: output.cxx:814
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
void SetScaleY(const Fraction &rScaleY)
const Size & GetFontSize() const
constexpr tools::Long Top() const
bool bVOverlapped
Definition: fillinfo.hxx:161
void DrawStrings(bool bPixelToLogic=false)
Definition: output2.cxx:1514
SCROW nY1
Definition: output.hxx:190
sal_uInt16 nCursorHideCount
Definition: gridwin.hxx:161
constexpr void SetRight(tools::Long v)
const AllSettings & GetSettings() const
Size GetOutputSizePixel() const
constexpr void SetBottom(tools::Long v)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: gridwin4.cxx:2357
void GetVars(SCCOL &nCol1, SCROW &nRow1, SCTAB &nTab1, SCCOL &nCol2, SCROW &nRow2, SCTAB &nTab2) const
Definition: address.hxx:692
void ResetChanged(const ScRange &rRange)
Definition: document.cxx:4090
Point PixelToLogic(const Point &rDevicePt) const
sal_uInt16 nPaintCount
Definition: gridwin.hxx:193
void GetPixelRectsFor(const ScMarkData &rMarkData,::std::vector< tools::Rectangle > &rPixelRects) const
convert rMarkData into pixel rectangles for this view
Definition: gridwin4.cxx:2113
SCCOL GetRefEndX() const
Definition: viewdata.hxx:525
vcl::Font GetFont(vcl::Font const &rFont, DrawModeFlags nDrawMode, StyleSettings const &rStyleSettings)
const sdr::contact::ObjectContact & GetObjectContact() const
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
bool UpdateVisibleRange()
Definition: gridwin2.cxx:614
void GetArea(SCTAB &rTab, SCCOL &rCol1, SCROW &rRow1, SCCOL &rCol2, SCROW &rRow2) const
Definition: dbdata.cxx:300
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5582
tools::Long nScrX
Definition: output.hxx:184
constexpr void SetTop(tools::Long v)
void DrawClear()
Definition: output.cxx:1325
void SetGridColor(const Color &rColor)
Definition: output.cxx:238
ScSplitPos eWhich
Definition: gridwin.hxx:148
SCCOL Col() const
Definition: address.hxx:266
bool bNeedsRepaint
Definition: gridwin.hxx:212
SCTAB nTab
Definition: output.hxx:183
void SetupInitialPageBreaks(const ScDocument &rDoc, SCTAB nTab)
Definition: gridwin4.cxx:1279
void SetColor(const Color &)
ScDBFunc * GetView() const
Definition: viewdata.cxx:861
constexpr Point TopLeft() const
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
SCCOL GetRefStartX() const
Definition: viewdata.hxx:522
MapUnit GetMapUnit()
void SetAlignment(TextAlign)
constexpr tools::Long Bottom() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void PaintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight)
Definition: gridwin4.cxx:1393
SC_DLLPUBLIC void GetScenarioData(SCTAB nTab, OUString &rComment, Color &rColor, ScScenarioFlags &rFlags) const
Definition: documen3.cxx:468
bool IsHorOverlapped() const
Definition: attrib.hxx:99
void SetPosPixel(const Point &rNewPos)
Definition: cbutton.hxx:42
sal_uLong Count() const
Definition: rfindlst.hxx:50
SCTAB GetRefStartZ() const
Definition: viewdata.hxx:524
bool IsMapModeEnabled() const
ScRange aRef
Definition: rfindlst.hxx:30
void DrawGrid(vcl::RenderContext &rRenderContext, bool bGrid, bool bPage, bool bMergeCover=false)
Definition: output.cxx:292
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
void DrawRedraw(ScOutputData &rOutputData, SdrLayerID nLayer)
Definition: gridwin3.cxx:209
sal_Int32 SCROW
Definition: types.hxx:17
ALIGN_TOP
void PutInOrder()
Definition: address.cxx:1574
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:849
VisibleRange maVisibleRange
Definition: gridwin.hxx:132
void SetShowSpellErrors(bool bSet)
Definition: output.cxx:258
constexpr Size GetSize() const
double GetPPTY() const
Definition: viewdata.hxx:468
bool ValidRow(SCROW nRow) const
Definition: document.hxx:881
tools::Long const nTopMargin
const Point & GetPosPixel() const
Definition: cbutton.hxx:43
bool bPivotPopupButton
Definition: fillinfo.hxx:164
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
void Draw(const Point &rAt, const Size &rSize)
Definition: cbuttonw.cxx:49
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:432
ScDrawView * GetScDrawView()
Definition: tabview.hxx:341
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CTL(EE_CHAR_START+20)
ScUpdateMode
Definition: viewutil.hxx:39
void PrePaint()
bool IsAutomatic() const
Definition: pagedata.hxx:59
constexpr tools::Long Height() const
SCCOL GetEditStartCol() const
Definition: viewdata.hxx:595
void setWidth(tools::Long n)
void SetFont(const vcl::Font &rNewFont)
static void lcl_LimitRect(tools::Rectangle &rRect, const tools::Rectangle &rVisible)
Definition: gridwin4.cxx:83
bool GetShowGrid() const
Definition: viewdata.hxx:462
virtual vcl::Region GetActiveClipRegion() const
constexpr SdrLayerID SC_LAYER_FRONT(0)
tools::Long GetTextHeight() const
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4393
SvtScriptType nPageScript
Definition: gridwin.hxx:181
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
::OutputDevice const * GetOutDev() const
constexpr SdrLayerID SC_LAYER_INTERN(2)
virtual bool supportsGridOffsets() const
void SetViewShell(ScTabViewShell *pSh)
Definition: output.hxx:318
void SetSpellCheckContext(const sc::SpellCheckContext *pCxt)
Definition: output.cxx:217
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:544
const value_type & getNearestByPosition(tools::Long nPos) const
Definition: viewdata.cxx:221
void Paint(const tools::Rectangle &rRect, OutputDevice *pTargetDevice=nullptr)
SCCOL GetEditEndCol() const
Definition: viewdata.hxx:597
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Definition: scmod.cxx:774
static void lcl_DrawOneFrame(vcl::RenderContext *pDev, const tools::Rectangle &rInnerPixel, const OUString &rTitle, const Color &rColor, bool bTextBelow, double nPPTX, double nPPTY, const Fraction &rZoomY, ScDocument &rDoc, ScViewData &rButtonViewData, bool bLayoutRTL)
Definition: gridwin4.cxx:93
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
bool IsAutoSpell() const
Definition: docoptio.hxx:53
bool GetMergeSizePixel(SCCOL nX, SCROW nY, tools::Long &rSizeXPix, tools::Long &rSizeYPix) const
Definition: viewdata.cxx:2704
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
Definition: dbdata.cxx:424
const Point & GetOrigin() const
size_t GetPagesX() const
Definition: pagedata.hxx:49
const SCROW MAXTILEDROW
Definition: address.hxx:75
ScQueryConnect eConnect
Definition: queryentry.hxx:63
static void AddPixelsWhile(tools::Long &rScrY, tools::Long nEndPixels, SCROW &rPosY, SCROW nEndRow, double nPPTY, const ScDocument *pDoc, SCTAB nTabNo)
while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row heights converted with nPPTY to rSc...
Definition: viewdata.cxx:4092
SC_DLLPUBLIC void ExtendTotalMerge(ScRange &rRange) const
Definition: document.cxx:5632
ScPositionHelper & GetLOKWidthHelper()
Definition: viewdata.hxx:409
void DrawNoteMarks(vcl::RenderContext &rRenderContext)
Definition: output.cxx:2323
CALCPAGEBREAKMANUAL
const Size & GetSizePixel() const
Definition: cbutton.hxx:46
bool IsTopDown() const
Definition: pagedata.hxx:57
tools::Long GetScrH() const
Definition: output.hxx:335
void SetMarking(bool bFlag)
Definition: markdata.hxx:102
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:986
Color const & GetGridColor(OUString *pStrName=nullptr) const
Definition: viewopti.cxx:118
bool IsVisible() const
SdrPageView * GetSdrPageView() const
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4448
const vcl::Font & GetAppFont() const
Size GetOutputSizePixel() const
void SetOutputArea(const tools::Rectangle &rRect)
void setHeight(tools::Long nHeight)
ScAddress aAutoMarkPos
Definition: gridwin.hxx:196
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, std::vector< SCTAB > &tabs)
Definition: viewdata.cxx:1033
tools::Long GetScrW() const
Definition: output.hxx:334
ViewContact & GetViewContact() const
void SetMirrorWidth(tools::Long nNew)
Definition: output.cxx:233
void UpdateFontList()
Definition: docsh3.cxx:456
ScRangeFindData & GetObject(sal_uLong nIndex)
Definition: rfindlst.hxx:53
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
SCTAB GetRefTabNo() const
Definition: viewdata.hxx:391
tools::Rectangle GetEditCursor() const
VirtualDevice * get() const
ScRangeList GetMarkedRanges() const
Definition: markdata.cxx:464
virtual void SetModified(bool=true) override
Definition: docsh.cxx:2930
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr TypedWhichId< SvxFontHeightItem > EE_CHAR_FONTHEIGHT_CJK(EE_CHAR_START+19)
void SetPriority(TaskPriority ePriority)
SCROW GetRowMerge() const
Definition: attrib.hxx:69
void GetMultiMarkArea(ScRange &rRange) const
Definition: markdata.cxx:116
ScInputHandler * GetInputHdl(ScTabViewShell *pViewSh=nullptr, bool bUseRef=true)
Input-Handler.
Definition: scmod.cxx:1305
void DoInvertRect(const tools::Rectangle &rPixel)
Definition: gridwin4.cxx:301
const MapMode & GetLogicMode(ScSplitPos eWhich)
Definition: viewdata.cxx:2983
Size GetPageSize(SCTAB nTab) const
Definition: document.cxx:6214
CellInfo * pCellInfo
Definition: fillinfo.hxx:179
tools::Rectangle aRepaintPixel
Definition: gridwin.hxx:194
SC_DLLPUBLIC void GetAllRowBreaks(std::set< SCROW > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4363
const OUString & GetDocName() const
Definition: rfindlst.hxx:57
ScPositionHelper & GetLOKHeightHelper()
Definition: viewdata.hxx:410
void DrawEdit(bool bPixelToLogic)
Definition: output2.cxx:4320
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
Definition: documen3.cxx:322
void DrawShadow()
Definition: output.cxx:1179
void SetPageSize(SCTAB nTab, const Size &rSize)
Definition: document.cxx:6208
void SetScenButSize(const Size &rNew)
Definition: viewdata.hxx:656
ScRangeFindList * GetRangeFindList()
Definition: inputhdl.hxx:252
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5492
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4139
bool IsPagebreakMode() const
Definition: viewdata.hxx:424
bool NeedLOKCursorInvalidation(const tools::Rectangle &rCursorRect, const Fraction aScaleX, const Fraction aScaleY)
Definition: gridwin4.cxx:331
void MarkCursor(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bCols=false, bool bRows=false, bool bCellSelection=false)
Definition: tabview2.cxx:449
size_t GetPagesY() const
Definition: pagedata.hxx:51
rtl::OString toString() const
ScHSplitPos eHWhich
Definition: gridwin.hxx:149
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)
bool IsRefMode() const
Definition: viewdata.hxx:520
void SetMapMode()
void GetSelectionRects(::std::vector< tools::Rectangle > &rPixelRects) const
Definition: gridwin4.cxx:2102
bool bListValButton
Definition: gridwin.hxx:214
aStr
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:213
bool bAutoMarkVisible
Definition: gridwin.hxx:213
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:33
Color const & GetBackgroundColor() const
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
Definition: viewdata.cxx:2280
bool IsMinimized() const
Definition: viewdata.cxx:3143
void UpdateHeaderOverlay()
Definition: gridwin.cxx:6824
void InitBlockMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bTestNeg=false, bool bCols=false, bool bRows=false, bool bForceNeg=false)
Definition: tabview2.cxx:353
std::shared_ptr< sc::SpellCheckContext > mpSpellCheckCxt
Definition: gridwin.hxx:145
void ForgetLastPattern()
Definition: inputhdl.cxx:2310
sal_uInt16 nPos
static void notifyOtherView(const SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, std::string_view rKey, const OString &rPayload)
sal_Int16 SCTAB
Definition: types.hxx:22
void SetPagebreakMode(ScPageBreakData *pPageData)
Definition: output.cxx:585
SCCOL GetCurX() const
Definition: viewdata.hxx:400
SCROW GetEditStartRow() const
Definition: viewdata.hxx:596
void FillEditItemSet(SfxItemSet *pEditSet, const SfxItemSet *pCondSet=nullptr) const
Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSe...
Definition: patattr.cxx:775
#define SC_SCENARIO_HSPACE
Definition: output.hxx:54
static void lcl_DrawHighlight(ScOutputData &rOutputData, const ScViewData &rViewData, const std::vector< ScHighlightEntry > &rHighlightRanges)
Definition: gridwin4.cxx:265