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