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 its 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  sdr::contact::ObjectContact& mrRealObjectContact;
1334 
1335  public:
1336  explicit ScLOKProxyObjectContact(
1337  sdr::contact::ObjectContact& rRealOC,
1338  SdrPageWindow& rPageWindow,
1339  const char* pDebugName) :
1340  ObjectContactOfPageView(rPageWindow, pDebugName),
1341  mrRealObjectContact(rRealOC)
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  SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1352  if (pTargetSdrObject)
1353  rTarget = pTargetSdrObject->GetViewContact().GetViewObjectContact(mrRealObjectContact).getGridOffset();
1354  }
1355  };
1356 
1357  class ScLOKDrawView : public FmFormView
1358  {
1359  public:
1360  ScLOKDrawView(OutputDevice* pOut, ScViewData& rData) :
1361  FmFormView(*rData.GetDocument().GetDrawLayer(), pOut),
1362  pScDrawView(rData.GetScDrawView())
1363  {
1364  }
1365 
1367  SdrPageWindow& rPageWindow, const char* pDebugName) const override
1368  {
1369  if (!pScDrawView)
1370  return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1371 
1372  SdrPageView* pPageView(pScDrawView->GetSdrPageView());
1373  if (!pPageView)
1374  return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1375 
1376  SdrPageWindow* pSdrPageWindow = pPageView->GetPageWindow(0);
1377  if (!pSdrPageWindow)
1378  return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1379 
1380  return new ScLOKProxyObjectContact(pSdrPageWindow->GetObjectContact(), rPageWindow, pDebugName);
1381  }
1382 
1383  private:
1384  ScDrawView* pScDrawView;
1385  };
1386 } // anonymous namespace
1387 
1389  int nOutputWidth, int nOutputHeight,
1390  int nTilePosX, int nTilePosY,
1391  tools::Long nTileWidth, tools::Long nTileHeight )
1392 {
1393  Fraction origZoomX = mrViewData.GetZoomX();
1394  Fraction origZoomY = mrViewData.GetZoomY();
1395 
1396  // Output size is in pixels while tile position and size are in logical units (twips).
1397 
1398  // Assumption: always paint the whole sheet i.e. "visible" range is always
1399  // from (0,0) to last data position.
1400 
1401  // Tile geometry is independent of the zoom level, but the output size is
1402  // dependent of the zoom level. Determine the correct zoom level before
1403  // we start.
1404 
1405  // FIXME the painting works using a mixture of drawing with coordinates in
1406  // pixels and in logic coordinates; it should be cleaned up to use logic
1407  // coords only, and avoid all the SetMapMode()'s.
1408  // Similarly to Writer, we should set the mapmode once on the rDevice, and
1409  // not care about any zoom settings.
1410 
1411  Fraction aFracX(o3tl::convert(nOutputWidth, o3tl::Length::px, o3tl::Length::twip), nTileWidth);
1412  Fraction aFracY(o3tl::convert(nOutputHeight, o3tl::Length::px, o3tl::Length::twip), nTileHeight);
1413 
1414  const bool bChangeZoom = (aFracX != origZoomX || aFracY != origZoomY);
1415 
1416  // page break zoom, and aLogicMode in ScViewData
1417  // FIXME: there are issues when SetZoom is called conditionally.
1418  mrViewData.SetZoom(aFracX, aFracY, true);
1419  if (bChangeZoom)
1420  {
1421  if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1422  pDrawView->resetGridOffsetsForAllSdrPageViews();
1423  }
1424 
1425  const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
1426  const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
1427  const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight;
1428  const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
1429 
1430  SCTAB nTab = mrViewData.GetTabNo();
1431  ScDocument& rDoc = mrViewData.GetDocument();
1432 
1433  const double fPPTX = mrViewData.GetPPTX();
1434  const double fPPTY = mrViewData.GetPPTY();
1435 
1436  // find approximate col/row offsets of nearby.
1437  sal_Int32 nTopLeftTileRowOffset = 0;
1438  sal_Int32 nTopLeftTileColOffset = 0;
1439  sal_Int32 nTopLeftTileRowOrigin = 0;
1440  sal_Int32 nTopLeftTileColOrigin = 0;
1441 
1442  sal_Int32 nTopLeftTileRow = 0;
1443  sal_Int32 nTopLeftTileCol = 0;
1444  sal_Int32 nBottomRightTileRow = 0;
1445  sal_Int32 nBottomRightTileCol = 0;
1446 
1447  lcl_getBoundingRowColumnforTile<SCROW>(mrViewData,
1448  fTilePosYPixel, fTileBottomPixel,
1449  nTopLeftTileRowOffset, nTopLeftTileRowOrigin,
1450  nTopLeftTileRow, nBottomRightTileRow);
1451 
1452  lcl_getBoundingRowColumnforTile<SCCOL>(mrViewData,
1453  fTilePosXPixel, fTileRightPixel,
1454  nTopLeftTileColOffset, nTopLeftTileColOrigin,
1455  nTopLeftTileCol, nBottomRightTileCol);
1456 
1457  // Enlarge
1458  nBottomRightTileCol++;
1459  nBottomRightTileRow++;
1460 
1461  if (nBottomRightTileCol > rDoc.MaxCol())
1462  nBottomRightTileCol = rDoc.MaxCol();
1463 
1464  if (nBottomRightTileRow > MAXTILEDROW)
1465  nBottomRightTileRow = MAXTILEDROW;
1466 
1467  // size of the document including drawings, charts, etc.
1468  SCCOL nEndCol = 0;
1469  SCROW nEndRow = 0;
1470  rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
1471 
1472  if (nEndCol < nBottomRightTileCol)
1473  nEndCol = nBottomRightTileCol;
1474 
1475  if (nEndRow < nBottomRightTileRow)
1476  nEndRow = nBottomRightTileRow;
1477 
1478  nTopLeftTileCol = std::max<sal_Int32>(nTopLeftTileCol, 0);
1479  nTopLeftTileRow = std::max<sal_Int32>(nTopLeftTileRow, 0);
1480  nTopLeftTileColOrigin = o3tl::convert(nTopLeftTileColOrigin, o3tl::Length::px, o3tl::Length::twip);
1481  nTopLeftTileRowOrigin = o3tl::convert(nTopLeftTileRowOrigin, o3tl::Length::px, o3tl::Length::twip);
1482 
1483  // Checkout -> 'rDoc.ExtendMerge' ... if we miss merged cells.
1484 
1485  // Origin must be the offset of the first col and row
1486  // containing our top-left pixel.
1487  const MapMode aOriginalMode = rDevice.GetMapMode();
1488  MapMode aAbsMode = aOriginalMode;
1489  const Point aOrigin(-nTopLeftTileColOrigin, -nTopLeftTileRowOrigin);
1490  aAbsMode.SetOrigin(aOrigin);
1491  rDevice.SetMapMode(aAbsMode);
1492 
1493  ScTableInfo aTabInfo(nEndRow + 3);
1494  rDoc.FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
1495  nBottomRightTileCol, nBottomRightTileRow,
1496  nTab, fPPTX, fPPTY, false, false);
1497 
1498 // FIXME: is this called some
1499 // Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich );
1500 
1501  ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
1502  -nTopLeftTileColOffset,
1503  -nTopLeftTileRowOffset,
1504  nTopLeftTileCol, nTopLeftTileRow,
1505  nBottomRightTileCol, nBottomRightTileRow,
1506  fPPTX, fPPTY, nullptr, nullptr);
1507 
1508  // setup the SdrPage so that drawinglayer works correctly
1509  ScDrawLayer* pModel = rDoc.GetDrawLayer();
1510  if (pModel)
1511  {
1512  bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
1513  comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1514  mpLOKDrawView.reset(bPrintTwipsMsgs ?
1515  new ScLOKDrawView(
1516  &rDevice,
1517  mrViewData) :
1518  new FmFormView(
1519  *pModel,
1520  &rDevice));
1521  mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));
1522  aOutputData.SetDrawView(mpLOKDrawView.get());
1523  aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
1524  }
1525 
1526  // draw the content
1527  DrawContent(rDevice, aTabInfo, aOutputData, true);
1528  rDevice.SetMapMode(aOriginalMode);
1529 
1530  // Flag drawn formula cells "unchanged".
1531  rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
1532  rDoc.PrepareFormulaCalc();
1533 
1534  mrViewData.SetZoom(origZoomX, origZoomY, true);
1535  if (bChangeZoom)
1536  {
1537  if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1538  pDrawView->resetGridOffsetsForAllSdrPageViews();
1539  }
1540 }
1541 
1543 {
1544  tools::Rectangle aRectangle;
1545  tools::Rectangle* pResultRectangle;
1546  if (!pRectangle)
1547  pResultRectangle = nullptr;
1548  else
1549  {
1550  aRectangle = *pRectangle;
1551  // When dragging shapes the map mode is disabled.
1552  if (IsMapModeEnabled())
1553  {
1554  if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
1555  {
1556  aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
1557  }
1558  }
1559  else
1560  aRectangle = PixelToLogic(aRectangle, MapMode(MapUnit::MapTwip));
1561  pResultRectangle = &aRectangle;
1562  }
1563 
1564  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1565  SfxLokHelper::notifyInvalidation(pViewShell, pResultRectangle);
1566 }
1567 
1568 void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
1569 {
1570  ScTabView* pTabView = mrViewData.GetView();
1571  ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1572  ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
1573 
1574  if (pInputHandler && pInputHandler->IsInputMode())
1575  {
1576  // we need to switch off the editeng
1578  pViewShell->UpdateInputHandler();
1579  }
1580 
1581  if (nType == LOK_SETTEXTSELECTION_RESET)
1582  {
1583  pTabView->DoneBlockMode();
1584  return;
1585  }
1586 
1587  // obtain the current selection
1589 
1590  SCCOL nCol1, nCol2;
1591  SCROW nRow1, nRow2;
1592  SCTAB nTab1, nTab2;
1593 
1594  bool bWasEmpty = false;
1595  if (aRangeList.empty())
1596  {
1597  nCol1 = nCol2 = mrViewData.GetCurX();
1598  nRow1 = nRow2 = mrViewData.GetCurY();
1599  bWasEmpty = true;
1600  }
1601  else
1602  aRangeList.Combine().GetVars(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
1603 
1604  // convert the coordinates to column/row
1605  SCCOL nNewPosX;
1606  SCROW nNewPosY;
1607  SCTAB nTab = mrViewData.GetTabNo();
1608  mrViewData.GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY);
1609 
1610  // change the selection
1611  switch (nType)
1612  {
1613  case LOK_SETTEXTSELECTION_START:
1614  if (nNewPosX != nCol1 || nNewPosY != nRow1 || bWasEmpty)
1615  {
1616  pTabView->SetCursor(nNewPosX, nNewPosY);
1617  pTabView->DoneBlockMode();
1618  pTabView->InitBlockMode(nNewPosX, nNewPosY, nTab, true);
1619  pTabView->MarkCursor(nCol2, nRow2, nTab);
1620  }
1621  break;
1622  case LOK_SETTEXTSELECTION_END:
1623  if (nNewPosX != nCol2 || nNewPosY != nRow2 || bWasEmpty)
1624  {
1625  pTabView->SetCursor(nCol1, nRow1);
1626  pTabView->DoneBlockMode();
1627  pTabView->InitBlockMode(nCol1, nRow1, nTab, true);
1628  pTabView->MarkCursor(nNewPosX, nNewPosY, nTab);
1629  }
1630  break;
1631  default:
1632  assert(false);
1633  break;
1634  }
1635 }
1636 
1638 {
1639  // called at the end of painting, and from timer after background text width calculation
1640 
1641  if (!bNeedsRepaint)
1642  return;
1643 
1644  bNeedsRepaint = false;
1645  if (aRepaintPixel.IsEmpty())
1646  Invalidate();
1647  else
1650 
1651  // selection function in status bar might also be invalid
1652  SfxBindings& rBindings = mrViewData.GetBindings();
1653  rBindings.Invalidate( SID_STATUS_SUM );
1654  rBindings.Invalidate( SID_ATTR_SIZE );
1655  rBindings.Invalidate( SID_TABLE_CELL );
1656 }
1657 
1658 void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
1659 {
1661  if (!pPageData)
1662  return;
1663 
1664  ScDocument& rDoc = mrViewData.GetDocument();
1665  SCTAB nTab = mrViewData.GetTabNo();
1666  Size aWinSize = GetOutputSizePixel();
1667  const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1669  Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor );
1670 
1671  OUString aPageStr = ScResId( STR_PGNUM );
1672  if ( nPageScript == SvtScriptType::NONE )
1673  {
1674  // get script type of translated "Page" string only once
1675  nPageScript = rDoc.GetStringScriptType( aPageStr );
1676  if (nPageScript == SvtScriptType::NONE)
1678  }
1679 
1680  vcl::Font aFont;
1681  std::unique_ptr<ScEditEngineDefaulter> pEditEng;
1682  const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
1683  if ( nPageScript == SvtScriptType::LATIN )
1684  {
1685  // use single font and call DrawText directly
1686  rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
1687  aFont.SetColor( COL_LIGHTGRAY );
1688  // font size is set as needed
1689  }
1690  else
1691  {
1692  // use EditEngine to draw mixed-script string
1693  pEditEng.reset(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true ));
1694  pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
1695  auto pEditDefaults = std::make_unique<SfxItemSet>( pEditEng->GetEmptyItemSet() );
1696  rDefPattern.FillEditItemSet( pEditDefaults.get() );
1697  pEditDefaults->Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
1698  pEditEng->SetDefaults( std::move(pEditDefaults) );
1699  }
1700 
1701  sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
1702  for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
1703  {
1704  ScPrintRangeData& rData = pPageData->GetData(nPos);
1705  ScRange aRange = rData.GetPrintRange();
1706  if ( aRange.aStart.Col() <= nX2+1 && aRange.aEnd.Col()+1 >= nX1 &&
1707  aRange.aStart.Row() <= nY2+1 && aRange.aEnd.Row()+1 >= nY1 )
1708  {
1709  // 3 pixel frame around the print area
1710  // (middle pixel on the grid lines)
1711 
1712  rRenderContext.SetLineColor();
1713  if (rData.IsAutomatic())
1714  rRenderContext.SetFillColor( aAutomatic );
1715  else
1716  rRenderContext.SetFillColor( aManual );
1717 
1718  Point aStart = mrViewData.GetScrPos(
1719  aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
1720  Point aEnd = mrViewData.GetScrPos(
1721  aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, true );
1722  aStart.AdjustX( -2 );
1723  aStart.AdjustY( -2 );
1724 
1725  // Prevent overflows:
1726  if ( aStart.X() < -10 ) aStart.setX( -10 );
1727  if ( aStart.Y() < -10 ) aStart.setY( -10 );
1728  if ( aEnd.X() > aWinSize.Width() + 10 )
1729  aEnd.setX( aWinSize.Width() + 10 );
1730  if ( aEnd.Y() > aWinSize.Height() + 10 )
1731  aEnd.setY( aWinSize.Height() + 10 );
1732 
1733  rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
1734  rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
1735  rRenderContext.DrawRect( tools::Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
1736  rRenderContext.DrawRect( tools::Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
1737 
1738  // Page breaks
1740 
1741  size_t nColBreaks = rData.GetPagesX();
1742  const SCCOL* pColEnd = rData.GetPageEndX();
1743  size_t nColPos;
1744  for (nColPos=0; nColPos+1<nColBreaks; nColPos++)
1745  {
1746  SCCOL nBreak = pColEnd[nColPos]+1;
1747  if ( nBreak >= nX1 && nBreak <= nX2+1 )
1748  {
1750  if (rDoc.HasColBreak(nBreak, nTab) & ScBreakType::Manual)
1751  rRenderContext.SetFillColor( aManual );
1752  else
1753  rRenderContext.SetFillColor( aAutomatic );
1754  Point aBreak = mrViewData.GetScrPos(
1755  nBreak, aRange.aStart.Row(), eWhich, true );
1756  rRenderContext.DrawRect( tools::Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
1757  }
1758  }
1759 
1760  size_t nRowBreaks = rData.GetPagesY();
1761  const SCROW* pRowEnd = rData.GetPageEndY();
1762  size_t nRowPos;
1763  for (nRowPos=0; nRowPos+1<nRowBreaks; nRowPos++)
1764  {
1765  SCROW nBreak = pRowEnd[nRowPos]+1;
1766  if ( nBreak >= nY1 && nBreak <= nY2+1 )
1767  {
1769  if (rDoc.HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
1770  rRenderContext.SetFillColor( aManual );
1771  else
1772  rRenderContext.SetFillColor( aAutomatic );
1773  Point aBreak = mrViewData.GetScrPos(
1774  aRange.aStart.Col(), nBreak, eWhich, true );
1775  rRenderContext.DrawRect( tools::Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
1776  }
1777  }
1778 
1779  // Page numbers
1780 
1781  SCROW nPrStartY = aRange.aStart.Row();
1782  for (nRowPos=0; nRowPos<nRowBreaks; nRowPos++)
1783  {
1784  SCROW nPrEndY = pRowEnd[nRowPos];
1785  if ( nPrEndY >= nY1 && nPrStartY <= nY2 )
1786  {
1787  SCCOL nPrStartX = aRange.aStart.Col();
1788  for (nColPos=0; nColPos<nColBreaks; nColPos++)
1789  {
1790  SCCOL nPrEndX = pColEnd[nColPos];
1791  if ( nPrEndX >= nX1 && nPrStartX <= nX2 )
1792  {
1793  Point aPageStart = mrViewData.GetScrPos(
1794  nPrStartX, nPrStartY, eWhich, true );
1795  Point aPageEnd = mrViewData.GetScrPos(
1796  nPrEndX+1,nPrEndY+1, eWhich, true );
1797 
1798  tools::Long nPageNo = rData.GetFirstPage();
1799  if ( rData.IsTopDown() )
1800  nPageNo += static_cast<tools::Long>(nColPos)*nRowBreaks+nRowPos;
1801  else
1802  nPageNo += static_cast<tools::Long>(nRowPos)*nColBreaks+nColPos;
1803 
1804  OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo));
1805 
1806  if ( pEditEng )
1807  {
1808  // find right font size with EditEngine
1809  tools::Long nHeight = 100;
1810  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
1811  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
1812  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
1813  pEditEng->SetTextCurrentDefaults( aThisPageStr );
1814  Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
1815 
1816  // 40% of width or 60% of height
1817  tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
1818  tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
1819  nHeight = std::min(nSizeX,nSizeY);
1820  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
1821  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
1822  pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
1823 
1824  // centered output with EditEngine
1825  Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
1826  Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
1827  (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
1828  pEditEng->Draw(rRenderContext, aPos);
1829  }
1830  else
1831  {
1832  // find right font size for DrawText
1833  aFont.SetFontSize( Size( 0,100 ) );
1834  rRenderContext.SetFont( aFont );
1835  Size aSize100(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
1836 
1837  // 40% of width or 60% of height
1838  tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
1839  tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
1840  aFont.SetFontSize( Size( 0,std::min(nSizeX,nSizeY) ) );
1841  rRenderContext.SetFont( aFont );
1842 
1843  // centered output with DrawText
1844  Size aTextSize(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
1845  Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
1846  (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
1847  rRenderContext.DrawText( aPos, aThisPageStr );
1848  }
1849  }
1850  nPrStartX = nPrEndX + 1;
1851  }
1852  }
1853  nPrStartY = nPrEndY + 1;
1854  }
1855  }
1856  }
1857 }
1858 
1859 void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev)
1860 {
1861  aComboButton.SetOutputDevice( pContentDev );
1862 
1863  ScDocument& rDoc = mrViewData.GetDocument();
1864  ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc);
1865 
1866  SCCOL nCol;
1867  SCROW nRow;
1868  SCSIZE nArrY;
1869  SCSIZE nQuery;
1870  SCTAB nTab = mrViewData.GetTabNo();
1871  ScDBData* pDBData = nullptr;
1872  std::unique_ptr<ScQueryParam> pQueryParam;
1873 
1874  RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
1875  sal_uInt16 nArrCount = rTabInfo.mnArrCount;
1876 
1877  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
1878 
1879  Point aOldPos = aComboButton.GetPosPixel(); // store state for MouseDown/Up
1880  Size aOldSize = aComboButton.GetSizePixel();
1881 
1882  for (nArrY=1; nArrY+1<nArrCount; nArrY++)
1883  {
1884  if ( pRowInfo[nArrY].bAutoFilter && pRowInfo[nArrY].bChanged )
1885  {
1886  RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1887 
1888  nRow = pThisRowInfo->nRowNo;
1889 
1890  for (nCol=nX1; nCol<=nX2; nCol++)
1891  {
1892  CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
1893  //if several columns merged on a row, there should be only one auto button at the end of the columns.
1894  //if several rows merged on a column, the button may be in the middle, so "!pInfo->bVOverlapped" should not be used
1895  if ( pInfo->bAutoFilter && !pInfo->bHOverlapped )
1896  {
1897  if (!pQueryParam)
1898  pQueryParam.reset(new ScQueryParam);
1899 
1900  bool bNewData = true;
1901  if (pDBData)
1902  {
1903  SCCOL nStartCol;
1904  SCROW nStartRow;
1905  SCCOL nEndCol;
1906  SCROW nEndRow;
1907  SCTAB nAreaTab;
1908  pDBData->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
1909  if ( nCol >= nStartCol && nCol <= nEndCol &&
1910  nRow >= nStartRow && nRow <= nEndRow )
1911  bNewData = false;
1912  }
1913  if (bNewData)
1914  {
1915  pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
1916  if (pDBData)
1917  pDBData->GetQueryParam( *pQueryParam );
1918  else
1919  {
1920  // can also be part of DataPilot table
1921  }
1922  }
1923 
1924  // pQueryParam can only include MAXQUERY entries
1925 
1926  bool bArrowState = false;
1927  if (pQueryParam->bInplace)
1928  {
1929  SCSIZE nCount = pQueryParam->GetEntryCount();
1930  for (nQuery = 0; nQuery < nCount; ++nQuery)
1931  {
1932  // Do no restrict to EQUAL here
1933  // (Column head should become blue also when ">1")
1934  const ScQueryEntry& rEntry = pQueryParam->GetEntry(nQuery);
1935  if (rEntry.bDoQuery && rEntry.nField == nCol)
1936  {
1937  bArrowState = true;
1938  break;
1939  }
1940  }
1941  }
1942 
1943  tools::Long nSizeX;
1944  tools::Long nSizeY;
1945  SCCOL nStartCol= nCol;
1946  SCROW nStartRow = nRow;
1947  //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.
1948  //should first get the start pos of the merge area, then get the nSizeX through the start pos.
1949  rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
1950  mrViewData.GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX
1951  nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY());
1952  Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
1953 
1954  aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
1955  aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
1956  aCellBtn.setDrawBaseButton(false);
1957  aCellBtn.setDrawPopupButton(true);
1958  aCellBtn.setHasHiddenMember(bArrowState);
1959  aCellBtn.draw();
1960  }
1961  }
1962  }
1963 
1964  if ( pRowInfo[nArrY].bPivotButton && pRowInfo[nArrY].bChanged )
1965  {
1966  RowInfo* pThisRowInfo = &pRowInfo[nArrY];
1967  nRow = pThisRowInfo->nRowNo;
1968  for (nCol=nX1; nCol<=nX2; nCol++)
1969  {
1970  CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
1971  if (pInfo->bHOverlapped || pInfo->bVOverlapped)
1972  continue;
1973 
1974  Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
1975  tools::Long nSizeX;
1976  tools::Long nSizeY;
1977  mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
1978  tools::Long nPosX = aScrPos.X();
1979  tools::Long nPosY = aScrPos.Y();
1980  // bLayoutRTL is handled in setBoundingBox
1981 
1982  OUString aStr = rDoc.GetString(nCol, nRow, nTab);
1983  aCellBtn.setText(aStr);
1984  aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
1985  aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
1986  aCellBtn.setDrawBaseButton(pInfo->bPivotButton);
1987  aCellBtn.setDrawPopupButton(pInfo->bPivotPopupButton);
1988  aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
1989  aCellBtn.draw();
1990  }
1991  }
1992 
1993  if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
1994  {
1996  aComboButton.SetPosPixel( aRect.TopLeft() );
1997  aComboButton.SetSizePixel( aRect.GetSize() );
1998  pContentDev->SetClipRegion(vcl::Region(aRect));
1999  aComboButton.Draw();
2000  pContentDev->SetClipRegion(); // always called from Draw() without clip region
2001  aComboButton.SetPosPixel( aOldPos ); // restore old state
2002  aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
2003  }
2004  }
2005 
2006  pQueryParam.reset();
2008 }
2009 
2011 {
2012  ScDocument& rDoc = mrViewData.GetDocument();
2013  SCTAB nTab = mrViewData.GetTabNo();
2014  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2015  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2016 
2017  ScDDComboBoxButton aButton( GetOutDev() ); // for optimal size
2018  Size aBtnSize = aButton.GetSizePixel();
2019 
2020  SCCOL nCol = rButtonPos.Col();
2021  SCROW nRow = rButtonPos.Row();
2022 
2023  tools::Long nCellSizeX; // width of this cell, including merged
2024  tools::Long nDummy;
2025  mrViewData.GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
2026 
2027  // for height, only the cell's row is used, excluding merged cells
2028  tools::Long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), mrViewData.GetPPTY() );
2029  tools::Long nAvailable = nCellSizeX;
2030 
2031  // left edge of next cell if there is a non-hidden next column
2032  SCCOL nNextCol = nCol + 1;
2033  const ScMergeAttr* pMerge = rDoc.GetAttr( nCol,nRow,nTab, ATTR_MERGE );
2034  if ( pMerge->GetColMerge() > 1 )
2035  nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area
2036  while ( nNextCol <= rDoc.MaxCol() && rDoc.ColHidden(nNextCol, nTab) )
2037  ++nNextCol;
2038  bool bNextCell = ( nNextCol <= rDoc.MaxCol() );
2039  if ( bNextCell )
2040  nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), mrViewData.GetPPTX() );
2041 
2042  if ( nAvailable < aBtnSize.Width() )
2043  aBtnSize.setWidth( nAvailable );
2044  if ( nCellSizeY < aBtnSize.Height() )
2045  aBtnSize.setHeight( nCellSizeY );
2046 
2047  Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich, true );
2048  aPos.AdjustX(nCellSizeX * nLayoutSign ); // start of next cell
2049  if (!bNextCell)
2050  aPos.AdjustX( -(aBtnSize.Width() * nLayoutSign) ); // right edge of cell if next cell not available
2051  aPos.AdjustY(nCellSizeY - aBtnSize.Height() );
2052  // X remains at the left edge
2053 
2054  if ( bLayoutRTL )
2055  aPos.AdjustX( -(aBtnSize.Width()-1) ); // align right edge of button with cell border
2056 
2057  return tools::Rectangle( aPos, aBtnSize );
2058 }
2059 
2061 {
2062  ScDocument& rDoc = mrViewData.GetDocument();
2063  ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2064  ScQueryParam aQueryParam;
2065 
2066  if ( pDBData )
2067  pDBData->GetQueryParam( aQueryParam );
2068  else
2069  {
2070  OSL_FAIL("Auto filter button without DBData");
2071  }
2072 
2073  bool bSimpleQuery = true;
2074  bool bColumnFound = false;
2075  SCSIZE nQuery;
2076 
2077  if ( !aQueryParam.bInplace )
2078  bSimpleQuery = false;
2079 
2080  // aQueryParam can only include MAXQUERY entries
2081 
2082  SCSIZE nCount = aQueryParam.GetEntryCount();
2083  for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
2084  if ( aQueryParam.GetEntry(nQuery).bDoQuery )
2085  {
2086  if (aQueryParam.GetEntry(nQuery).nField == nCol)
2087  bColumnFound = true;
2088 
2089  if (nQuery > 0)
2090  if (aQueryParam.GetEntry(nQuery).eConnect != SC_AND)
2091  bSimpleQuery = false;
2092  }
2093 
2094  return ( bSimpleQuery && bColumnFound );
2095 }
2096 
2097 void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelRects ) const
2098 {
2099  GetPixelRectsFor( mrViewData.GetMarkData(), rPixelRects );
2100 }
2101 
2102 void ScGridWindow::GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle >& rRects) const
2103 {
2104  GetRectsAnyFor(mrViewData.GetMarkData(), rRects, true);
2105 }
2106 
2109  ::std::vector< tools::Rectangle >& rPixelRects ) const
2110 {
2111  GetRectsAnyFor(rMarkData, rPixelRects, false);
2112 }
2113 
2115  ::std::vector< tools::Rectangle >& rRects,
2116  bool bInPrintTwips) const
2117 {
2118  ScMarkData aMultiMark( rMarkData );
2119  aMultiMark.SetMarking( false );
2120  aMultiMark.MarkToMulti();
2121  ScDocument& rDoc = mrViewData.GetDocument();
2122  SCTAB nTab = mrViewData.GetTabNo();
2123 
2124  bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2125  tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2126  if ( !aMultiMark.IsMultiMarked() )
2127  return;
2128  ScRange aMultiRange;
2129  aMultiMark.GetMultiMarkArea( aMultiRange );
2130  SCCOL nX1 = aMultiRange.aStart.Col();
2131  SCROW nY1 = aMultiRange.aStart.Row();
2132  SCCOL nX2 = aMultiRange.aEnd.Col();
2133  SCROW nY2 = aMultiRange.aEnd.Row();
2134 
2135  PutInOrder( nX1, nX2 );
2136  PutInOrder( nY1, nY2 );
2137 
2138  SCCOL nTestX2 = nX2;
2139  SCROW nTestY2 = nY2;
2140 
2141  rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
2142 
2143  SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2144  SCROW nPosY = mrViewData.GetPosY( eVWhich );
2145  // is the selection visible at all?
2146  if (nTestX2 < nPosX || nTestY2 < nPosY)
2147  return;
2148  SCCOL nRealX1 = nX1;
2149  if (nX1 < nPosX)
2150  nX1 = nPosX;
2151  if (nY1 < nPosY)
2152  nY1 = nPosY;
2153 
2155  {
2156  // limit the selection to only what is visible on the screen
2157  SCCOL nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich);
2158  if (nXRight > rDoc.MaxCol())
2159  nXRight = rDoc.MaxCol();
2160 
2161  SCROW nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich);
2162  if (nYBottom > rDoc.MaxRow())
2163  nYBottom = rDoc.MaxRow();
2164 
2165  // is the selection visible at all?
2166  if (nX1 > nXRight || nY1 > nYBottom)
2167  return;
2168 
2169  if (nX2 > nXRight)
2170  nX2 = nXRight;
2171  if (nY2 > nYBottom)
2172  nY2 = nYBottom;
2173  }
2174  else
2175  {
2176  SCCOL nMaxTiledCol;
2177  SCROW nMaxTiledRow;
2178  rDoc.GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
2179 
2180  if (nX2 > nMaxTiledCol)
2181  nX2 = nMaxTiledCol;
2182  if (nY2 > nMaxTiledRow)
2183  nY2 = nMaxTiledRow;
2184  }
2185 
2186  double nPPTX = mrViewData.GetPPTX();
2187  double nPPTY = mrViewData.GetPPTY();
2188 
2189  ScInvertMerger aInvert( &rRects );
2190 
2191  Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2192  mrViewData.GetScrPos(nX1, nY1, eWhich);
2193  tools::Long nScrY = aScrPos.Y();
2194  bool bWasHidden = false;
2195  for (SCROW nY=nY1; nY<=nY2; nY++)
2196  {
2197  bool bFirstRow = ( nY == nPosY ); // first visible row?
2198  bool bDoHidden = false; // repeat hidden ?
2199  sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY,nTab );
2200  bool bDoRow = ( nHeightTwips != 0 );
2201  if (bDoRow)
2202  {
2203  if (bWasHidden) // test hidden merge
2204  {
2205  bDoHidden = true;
2206  bDoRow = true;
2207  }
2208 
2209  bWasHidden = false;
2210  }
2211  else
2212  {
2213  bWasHidden = true;
2214  if (nY==nY2)
2215  bDoRow = true; // last cell of the block
2216  }
2217 
2218  if ( bDoRow )
2219  {
2220  SCCOL nLoopEndX = nX2;
2221  if (nX2 < nX1) // the rest of the merge
2222  {
2223  SCCOL nStartX = nX1;
2224  while ( rDoc.GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
2225  --nStartX;
2226  if (nStartX <= nX2)
2227  nLoopEndX = nX1;
2228  }
2229 
2230  const tools::Long nHeight = bInPrintTwips ?
2231  nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2232  tools::Long nEndY = nScrY + nHeight - 1;
2233  tools::Long nScrX = aScrPos.X();
2234  for (SCCOL nX=nX1; nX<=nLoopEndX; nX++)
2235  {
2236  tools::Long nWidth = rDoc.GetColWidth(nX, nTab);
2237  if (!bInPrintTwips)
2238  nWidth = ScViewData::ToPixel(nWidth, nPPTX);
2239 
2240  if ( nWidth > 0 )
2241  {
2242  tools::Long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign;
2243 
2244  SCROW nThisY = nY;
2245  const ScPatternAttr* pPattern = rDoc.GetPattern( nX, nY, nTab );
2246  const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2247  if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) )
2248  {
2249  while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 &&
2250  (rDoc.RowHidden(nThisY-1, nTab) || bFirstRow) )
2251  {
2252  --nThisY;
2253  pPattern = rDoc.GetPattern( nX, nThisY, nTab );
2254  pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2255  }
2256  }
2257 
2258  // only the rest of the merged is seen ?
2259  SCCOL nThisX = nX;
2260  if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 )
2261  {
2262  while ( pMergeFlag->IsHorOverlapped() )
2263  {
2264  --nThisX;
2265  pPattern = rDoc.GetPattern( nThisX, nThisY, nTab );
2266  pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2267  }
2268  }
2269 
2270  if ( aMultiMark.IsCellMarked( nThisX, nThisY, true ) )
2271  {
2272  if ( !pMergeFlag->IsOverlapped() )
2273  {
2274  const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE);
2275  if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0)
2276  {
2277  const SCCOL nEndColMerge = nThisX + pMerge->GetColMerge();
2278  const SCROW nEndRowMerge = nThisY + pMerge->GetRowMerge();
2279  Point aEndPos = bInPrintTwips ?
2280  mrViewData.GetPrintTwipsPos(nEndColMerge, nEndRowMerge) :
2281  mrViewData.GetScrPos(nEndColMerge, nEndRowMerge, eWhich);
2282  if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY )
2283  {
2284  aInvert.AddRect( tools::Rectangle( nScrX,nScrY,
2285  aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) );
2286  }
2287  }
2288  else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY )
2289  {
2290  aInvert.AddRect( tools::Rectangle( nScrX,nScrY,nEndX,nEndY ) );
2291  }
2292  }
2293  }
2294 
2295  nScrX = nEndX + nLayoutSign;
2296  }
2297  }
2298  nScrY = nEndY + 1;
2299  }
2300  }
2301 }
2302 
2304 {
2305  Window::DataChanged(rDCEvt);
2306 
2307  if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) ||
2308  (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
2309  (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
2310  (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
2311  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2312  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
2313  return;
2314 
2315  if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == mrViewData.GetActivePart() )
2317 
2318  if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2319  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
2320  {
2321  if ( eWhich == mrViewData.GetActivePart() ) // only once for the view
2322  {
2323  ScTabView* pView = mrViewData.GetView();
2324 
2325  pView->RecalcPPT();
2326 
2327  // RepeatResize in case scroll bar sizes have changed
2328  pView->RepeatResize();
2329  pView->UpdateAllOverlays();
2330 
2331  // invalidate cell attribs in input handler, in case the
2332  // EditEngine BackgroundColor has to be changed
2333  if ( mrViewData.IsActive() )
2334  {
2335  ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
2336  if (pHdl)
2337  pHdl->ForgetLastPattern();
2338  }
2339  }
2340  }
2341 
2342  Invalidate();
2343 }
2344 
2346 {
2347  bInitialPageBreaks = true;
2348 }
2349 
2350 IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
2351 {
2352  if (pTimer == &maShowPageBreaksTimer)
2353  {
2354  const ScViewOptions& rOpts = mrViewData.GetOptions();
2355  const bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
2356  // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page
2357  // breaks is enabled, breaks should be visible. If the document is
2358  // opened the first time or a tab is activated the first time, the
2359  // breaks are not calculated yet, so this initialization is done here.
2360  if (bPage)
2361  {
2362  const SCTAB nCurrentTab = mrViewData.GetTabNo();
2363  ScDocument& rDoc = mrViewData.GetDocument();
2364  const Size aPageSize = rDoc.GetPageSize(nCurrentTab);
2365  // Do not attempt to calculate a page size here if it is empty if
2366  // that involves counting pages.
2367  // An earlier implementation did
2368  // ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
2369  // rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
2370  // which resulted in tremendous waiting times after having loaded
2371  // larger documents i.e. imported from CSV, in which UI is entirely
2372  // blocked. All time is spent under ScPrintFunc::CountPages() in
2373  // ScTable::ExtendPrintArea() in the loop that calls
2374  // MaybeAddExtraColumn() to do stuff for each text string content
2375  // cell (each row in each column). Maybe that can be optimized, or
2376  // obtaining page size without that overhead would be possible, but
2377  // as is calling that from here is a no-no so this is a quick
2378  // disable things.
2379  if (!aPageSize.IsEmpty())
2380  {
2381  ScDocShell* pDocSh = mrViewData.GetDocShell();
2382  const bool bModified = pDocSh->IsModified();
2383  // Even setting the same size sets page size valid, so
2384  // UpdatePageBreaks() actually does something.
2385  rDoc.SetPageSize( nCurrentTab, aPageSize);
2386  rDoc.UpdatePageBreaks(nCurrentTab);
2387  pDocSh->PostPaint(0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab, PaintPartFlags::Grid);
2388  pDocSh->SetModified(bModified);
2389  }
2390  }
2391  }
2392 }
2393 
2394 
2395 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long nScrY
Definition: output.hxx:185
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3108
void SetClipRegion()
const Fraction & GetScaleX() const
void SetSyntaxMode(bool bNewMode)
Definition: output.cxx:279
void InvalidateLOKViewCursor(const tools::Rectangle &rCursorRect, const Fraction aScaleX, const Fraction aScaleY)
Definition: gridwin4.cxx:353
std::unique_ptr< RowInfo[]> mpRowInfo
Definition: fillinfo.hxx:194
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:6247
void SetOutputDevice(OutputDevice *pOutputDevice)
Definition: cbuttonw.cxx:38
void DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo &rTabInfo, OutputDevice *pContentDev)
Definition: gridwin4.cxx:1859
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:4737
void SetFontSize(const Size &)
bool HasScenarioRange(SCTAB nTab, const ScRange &rRange) const
Definition: documen3.cxx:864
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:1383
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:2350
constexpr TypedWhichId< ScPatternAttr > ATTR_PATTERN(156)
void SetShowNullValues(bool bSet)
Definition: output.cxx:247
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:89
bool bPivotButton
Definition: fillinfo.hxx:162
bool IsInInterpreter() const
Definition: document.hxx:2323
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:6745
void initiatePageBreaks()
Definition: gridwin4.cxx:2345
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:2114
void MarkToMulti()
Definition: markdata.cxx:223
tools::Rectangle GetListValButtonRect(const ScAddress &rButtonPos)
Definition: gridwin4.cxx:2010
void DrawClipMarks()
Definition: output.cxx:2474
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:1542
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:877
const std::vector< ScHighlightEntry > & GetHighlightRanges() const
Definition: tabview.hxx:329
bool bHOverlapped
Definition: fillinfo.hxx:159
ScScenarioFlags
Definition: global.hxx:236
tools::Long const nLeftMargin
SCCOL nX1
Definition: output.hxx:189
bool IsInputMode() const
Definition: inputhdl.hxx:184
Point GetPrintTwipsPos(SCCOL nCol, SCROW nRow) const
returns the position (top-left corner) of the requested cell in print twips coordinates.
Definition: viewdata.cxx:2527
bool Intersects(const ScRange &rRange) const
Definition: address.cxx:1558
SCROW GetRefStartY() const
Definition: viewdata.hxx:523
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:771
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:815
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:2011
SCSIZE mnArrCount
Definition: fillinfo.hxx:195
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:2256
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:60
ScRange Combine() const
Definition: rangelst.cxx:1111
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:252
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
Definition: gridwin4.cxx:1568
const tools::Rectangle & GetOutputArea() const
void UpdateAllOverlays()
Definition: tabview2.cxx:1000
void SetMarkClipped(bool bSet)
Definition: output.cxx:242
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:181
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:4390
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4192
void SetContentDevice(OutputDevice *pContentDev)
Definition: output.cxx:221
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:1658
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:6087
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:3970
void DrawSdrGrid(const tools::Rectangle &rDrawingRect, OutputDevice *pContentDev)
Definition: gridwin3.cxx:234
bool IsAutoFilterActive(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: gridwin4.cxx:2060
ScPageBreakData * GetPageBreakData()
Definition: tabview.hxx:328
void SetFmtDevice(OutputDevice *pRDev)
Definition: output.hxx:317
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:872
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:2683
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:120
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3517
AllSettingsFlags GetFlags() const
bool isCompatFlagSet(Compat flag)
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:125
void CheckNeedsRepaint()
Definition: gridwin4.cxx:1637
void UpdateInputHandler(bool bForce=false, bool bStopEditing=true)
Definition: tabvwsha.cxx:654
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:2102
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:2464
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:4766
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3136
ScViewData & GetViewData()
Definition: tabview.hxx:333
ScAddress aListValPos
Definition: gridwin.hxx:197
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2405
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4745
ScVSplitPos eVWhich
Definition: gridwin.hxx:150
void DrawRect(const tools::Rectangle &rRect)
bool GetTextWysiwyg() const
Definition: inputopt.hxx:65
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:70
constexpr bool IsEmpty() const
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Definition: viewdata.cxx:2688
void PutInOrder(T &nStart, T &nEnd)
Definition: address.hxx:953
bool empty() const
Definition: rangelst.hxx:88
constexpr void SetLeft(tools::Long v)
void SetEditCell(SCCOL nCol, SCROW nRow)
Definition: output.cxx:267
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1947
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:356
bool bAutoFilter
Definition: fillinfo.hxx:161
constexpr double nPPTX
bool IsModified() const
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1058
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:871
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:4476
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:2375
bool IsClipRegion() const
bool bChanged
Definition: fillinfo.hxx:187
bool bFilterActive
Definition: fillinfo.hxx:164
tools::Long GetFirstPage() const
Definition: pagedata.hxx:55
SfxBindings & GetBindings()
Definition: viewdata.cxx:3096
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4382
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:2756
sal_Int16 SCCOL
Definition: types.hxx:21
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:874
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:667
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:873
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:1774
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:1019
void MarkScenario(SCTAB nSrcTab, SCTAB nDestTab, ScMarkData &rDestMark, bool bResetMark=true, ScScenarioFlags nNeededBits=ScScenarioFlags::NONE) const
Definition: documen3.cxx:852
bool IsActive() const
Definition: viewdata.hxx:381
void DrawDocumentBackground()
Definition: output.cxx:834
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:160
void DrawStrings(bool bPixelToLogic=false)
Definition: output2.cxx:1482
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:2303
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:4102
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:2108
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:618
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:5594
tools::Long nScrX
Definition: output.hxx:184
constexpr void SetTop(tools::Long v)
void DrawClear()
Definition: output.cxx:1323
void SetGridColor(const Color &rColor)
Definition: output.cxx:237
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:1388
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:291
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:1582
static SC_DLLPUBLIC SvtScriptType GetDefaultScriptType()
Definition: global.cxx:852
VisibleRange maVisibleRange
Definition: gridwin.hxx:132
void SetShowSpellErrors(bool bSet)
Definition: output.cxx:257
constexpr Size GetSize() const
double GetPPTY() const
Definition: viewdata.hxx:468
bool ValidRow(SCROW nRow) const
Definition: document.hxx:875
tools::Long const nTopMargin
const Point & GetPosPixel() const
Definition: cbutton.hxx:43
bool bPivotPopupButton
Definition: fillinfo.hxx:163
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:4405
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:216
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:775
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:2703
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:62
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:4091
SC_DLLPUBLIC void ExtendTotalMerge(ScRange &rRange) const
Definition: document.cxx:5644
ScPositionHelper & GetLOKWidthHelper()
Definition: viewdata.hxx:409
void DrawNoteMarks(vcl::RenderContext &rRenderContext)
Definition: output.cxx:2321
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
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4460
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:232
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:2931
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:1303
void DoInvertRect(const tools::Rectangle &rPixel)
Definition: gridwin4.cxx:301
const MapMode & GetLogicMode(ScSplitPos eWhich)
Definition: viewdata.cxx:2982
Size GetPageSize(SCTAB nTab) const
Definition: document.cxx:6226
CellInfo * pCellInfo
Definition: fillinfo.hxx:178
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:4375
const OUString & GetDocName() const
Definition: rfindlst.hxx:57
ScPositionHelper & GetLOKHeightHelper()
Definition: viewdata.hxx:410
void DrawEdit(bool bPixelToLogic)
Definition: output2.cxx:4289
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
Definition: documen3.cxx:322
void DrawShadow()
Definition: output.cxx:1177
void SetPageSize(SCTAB nTab, const Size &rSize)
Definition: document.cxx:6220
void SetScenButSize(const Size &rNew)
Definition: viewdata.hxx:656
ScRangeFindList * GetRangeFindList()
Definition: inputhdl.hxx:251
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5504
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4151
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:2097
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:2279
bool IsMinimized() const
Definition: viewdata.cxx:3142
void UpdateHeaderOverlay()
Definition: gridwin.cxx:6619
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:2250
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:605
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