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
656namespace
657{
658int lcl_GetMultiLineHeight(EditEngine* pEditEngine)
659{
660 int nHeight = 0;
661 int nParagraphs = pEditEngine->GetParagraphCount();
662 if (nParagraphs > 1 || (nParagraphs > 0 && pEditEngine->GetLineCount(0) > 1))
663 {
664 for (int nPara = 0; nPara < nParagraphs; nPara++)
665 {
666 nHeight += pEditEngine->GetLineCount(nPara) * pEditEngine->GetLineHeight(nPara);
667 }
668 }
669
670 return nHeight;
671}
672}
673
674void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData,
675 bool bLogicText)
676{
677 ScModule* pScMod = SC_MOD();
679 const ScViewOptions& rOpts = mrViewData.GetOptions();
680 bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive();
681 bool bNoBackgroundAndGrid = bIsTiledRendering
683 comphelper::LibreOfficeKit::Compat::scNoGridBackground);
684
685 SCTAB nTab = aOutputData.nTab;
686 SCCOL nX1 = aOutputData.nX1;
687 SCROW nY1 = aOutputData.nY1;
688 SCCOL nX2 = aOutputData.nX2;
689 SCROW nY2 = aOutputData.nY2;
690 tools::Long nScrX = aOutputData.nScrX;
691 tools::Long nScrY = aOutputData.nScrY;
692
693 const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig();
694 Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID, false ).nColor );
695 if ( aGridColor == COL_TRANSPARENT )
696 {
697 // use view options' grid color only if color config has "automatic" color
698 aGridColor = rOpts.GetGridColor();
699 }
700
701 aOutputData.SetSyntaxMode ( mrViewData.IsSyntaxMode() );
702 aOutputData.SetGridColor ( aGridColor );
703 aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) );
704 aOutputData.SetShowFormulas ( rOpts.GetOption( VOPT_FORMULAS ) );
705 aOutputData.SetShowSpellErrors ( rDoc.GetDocOptions().IsAutoSpell() );
706 aOutputData.SetMarkClipped ( rOpts.GetOption( VOPT_CLIPMARKS ) );
707
708 aOutputData.SetUseStyleColor( true ); // always set in table view
709
710 aOutputData.SetViewShell( mrViewData.GetViewShell() );
711
712 bool bGrid = rOpts.GetOption( VOPT_GRID ) && mrViewData.GetShowGrid();
713 bool bGridFirst = !rOpts.GetOption( VOPT_GRID_ONTOP );
714
715 bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ) && !bIsTiledRendering;
716
717 bool bPageMode = mrViewData.IsPagebreakMode();
718 if (bPageMode) // after FindChanged
719 {
720 // SetPagebreakMode also initializes bPrinted Flags
722 }
723
724 EditView* pEditView = nullptr;
725 bool bEditMode = mrViewData.HasEditView(eWhich);
726 if ( bEditMode && mrViewData.GetRefTabNo() == nTab )
727 {
728 SCCOL nEditCol;
729 SCROW nEditRow;
730 mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow );
731 SCCOL nEditEndCol = mrViewData.GetEditEndCol();
732 SCROW nEditEndRow = mrViewData.GetEditEndRow();
733
734 if ( nEditEndCol >= nX1 && nEditCol <= nX2 && nEditEndRow >= nY1 && nEditRow <= nY2 )
735 aOutputData.SetEditCell( nEditCol, nEditRow );
736 else
737 bEditMode = false;
738 }
739
740 const MapMode aOriginalMode = rDevice.GetMapMode();
741
742 // define drawing layer map mode and paint rectangle
743 MapMode aDrawMode = GetDrawMapMode();
744 if (bIsTiledRendering)
745 {
746 // FIXME this shouldn't be necessary once we change the entire Calc to
747 // work in the logic coordinates (ideally 100ths of mm - so that it is
748 // the same as editeng and drawinglayer), and get rid of all the
749 // SetMapMode's and other unnecessary fun we have with pixels
750 // See also ScGridWindow::GetDrawMapMode() for the rest of this hack
751 aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode));
752 }
753 tools::Rectangle aDrawingRectLogic;
754 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
755 bool bLokRTL = bLayoutRTL && bIsTiledRendering;
756 std::unique_ptr<ScLokRTLContext> pLokRTLCtxt(
757 bLokRTL ?
758 new ScLokRTLContext(aOutputData, o3tl::convert(aOriginalMode.GetOrigin().X(), o3tl::Length::twip, o3tl::Length::px)) :
759 nullptr);
760
761 {
762 // get drawing pixel rect
763 tools::Rectangle aDrawingRectPixel(
764 bLokRTL ? Point(-(nScrX + aOutputData.GetScrW()), nScrY) : Point(nScrX, nScrY),
765 Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
766
767 // correct for border (left/right)
768 if(rDoc.MaxCol() == nX2 && !bLokRTL)
769 {
770 if(bLayoutRTL)
771 {
772 aDrawingRectPixel.SetLeft( 0 );
773 }
774 else
775 {
776 aDrawingRectPixel.SetRight( GetOutputSizePixel().getWidth() );
777 }
778 }
779
780 // correct for border (bottom)
781 if(rDoc.MaxRow() == nY2)
782 {
783 aDrawingRectPixel.SetBottom( GetOutputSizePixel().getHeight() );
784 }
785
786 // get logic positions
787 aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
788 }
789
790 bool bInPlaceEditing = bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo());
791 vcl::Cursor* pInPlaceCrsr = nullptr;
792 bool bInPlaceVisCursor = false;
793 if (bInPlaceEditing)
794 {
795 // toggle the cursor off if it's on to ensure the cursor invert
796 // background logic remains valid after the background is cleared on
797 // the next cursor flash
798 pInPlaceCrsr = pEditView->GetCursor();
799 bInPlaceVisCursor = pInPlaceCrsr && pInPlaceCrsr->IsVisible();
800 if (bInPlaceVisCursor)
801 pInPlaceCrsr->Hide();
802 }
803
804 OutputDevice* pContentDev = &rDevice; // device for document content, used by overlay manager
805 SdrPaintWindow* pTargetPaintWindow = nullptr; // #i74769# work with SdrPaintWindow directly
806
807 {
808 // init redraw
809 ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
810
811 if(pTabViewShell)
812 {
813 MapMode aCurrentMapMode(pContentDev->GetMapMode());
814 pContentDev->SetMapMode(aDrawMode);
815 SdrView* pDrawView = pTabViewShell->GetScDrawView();
816
817 if(pDrawView)
818 {
819 // #i74769# Use new BeginDrawLayers() interface
820 vcl::Region aDrawingRegion(aDrawingRectLogic);
821 pTargetPaintWindow = pDrawView->BeginDrawLayers(pContentDev, aDrawingRegion);
822 OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
823
824 if (!bIsTiledRendering)
825 {
826 // #i74769# get target device from SdrPaintWindow, this may be the prerender
827 // device now, too.
828 pContentDev = &(pTargetPaintWindow->GetTargetOutputDevice());
829 aOutputData.SetContentDevice(pContentDev);
830 }
831 }
832
833 pContentDev->SetMapMode(aCurrentMapMode);
834 }
835 }
836
837 // app-background / document edge (area) (Pixel)
838 if ( !bIsTiledRendering && ( nX2 == rDoc.MaxCol() || nY2 == rDoc.MaxRow() ) )
839 {
840 // save MapMode and set to pixel
841 MapMode aCurrentMapMode(pContentDev->GetMapMode());
842 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
843
845 pContentDev->SetFillColor( rColorCfg.GetColorValue(svtools::APPBACKGROUND).nColor );
846 pContentDev->SetLineColor();
847 if ( nX2==rDoc.MaxCol() )
848 {
849 tools::Rectangle aDrawRect( aPixRect );
850 if ( bLayoutRTL )
851 aDrawRect.SetRight( nScrX - 1 );
852 else
853 aDrawRect.SetLeft( nScrX + aOutputData.GetScrW() );
854 if (aDrawRect.Right() >= aDrawRect.Left())
855 pContentDev->DrawRect( aDrawRect );
856 }
857 if ( nY2==rDoc.MaxRow() )
858 {
859 tools::Rectangle aDrawRect( aPixRect );
860 aDrawRect.SetTop( nScrY + aOutputData.GetScrH() );
861 if ( nX2==rDoc.MaxCol() )
862 {
863 // no double painting of the corner
864 if ( bLayoutRTL )
865 aDrawRect.SetLeft( nScrX );
866 else
867 aDrawRect.SetRight( nScrX + aOutputData.GetScrW() - 1 );
868 }
869 if (aDrawRect.Bottom() >= aDrawRect.Top())
870 pContentDev->DrawRect( aDrawRect );
871 }
872
873 // restore MapMode
874 pContentDev->SetMapMode(aCurrentMapMode);
875 }
876
877 if ( rDoc.HasBackgroundDraw( nTab, aDrawingRectLogic ) )
878 {
879 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
880 aOutputData.DrawClear();
881
882 // drawing background
883
884 pContentDev->SetMapMode(aDrawMode);
885 DrawRedraw( aOutputData, SC_LAYER_BACK );
886 }
887 else
888 aOutputData.SetSolidBackground(!bNoBackgroundAndGrid);
889
890 aOutputData.DrawDocumentBackground();
891
892 if (bGridFirst && (bGrid || bPage))
893 {
894 // Draw lines in background color cover over lok client grid lines in merged cell areas if bNoBackgroundAndGrid is set.
895 if (bNoBackgroundAndGrid)
896 aOutputData.DrawGrid(*pContentDev, false /* bGrid */, false /* bPage */, true /* bMergeCover */);
897 else
898 aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
899 }
900
901 aOutputData.DrawBackground(*pContentDev);
902
903 if (!bGridFirst && (bGrid || bPage) && !bNoBackgroundAndGrid)
904 aOutputData.DrawGrid(*pContentDev, bGrid, bPage);
905
906 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
907
908 //tdf#128258 - draw a dotted line before hidden columns/rows
909 DrawHiddenIndicator(nX1,nY1,nX2,nY2, *pContentDev);
910
911 if ( bPageMode )
912 {
913 // DrawPagePreview draws complete lines/page numbers, must always be clipped
914 if ( aOutputData.SetChangedClip() )
915 {
916 DrawPagePreview(nX1,nY1,nX2,nY2, *pContentDev);
917 pContentDev->SetClipRegion();
918 }
919 }
920
921 aOutputData.DrawShadow();
922 aOutputData.DrawFrame(*pContentDev);
923
924 aOutputData.DrawSparklines(*pContentDev);
925
926 // Show Note Mark
927 if ( rOpts.GetOption( VOPT_NOTES ) )
928 aOutputData.DrawNoteMarks(*pContentDev);
929
930 if ( rOpts.GetOption( VOPT_FORMULAS_MARKS ) )
931 aOutputData.DrawFormulaMarks(*pContentDev);
932
933 if ( !bLogicText )
934 aOutputData.DrawStrings(); // in pixel MapMode
935
936 // edit cells and printer-metrics text must be before the buttons
937 // (DataPilot buttons contain labels in UI font)
938
940 if ( bLogicText )
941 aOutputData.DrawStrings(true); // in logic MapMode if bLogicText is set
942 aOutputData.DrawEdit(true);
943
944 // the buttons are painted in absolute coordinates
945 if (bIsTiledRendering)
946 {
947 // Tiled offset nScrX, nScrY
948 MapMode aMap( MapUnit::MapPixel );
949 Point aOrigin = aOriginalMode.GetOrigin();
950 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px) + nScrX);
951 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px) + nScrY);
952 aMap.SetOrigin(aOrigin);
953 pContentDev->SetMapMode(aMap);
954 }
955 else
956 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
957
958 // Autofilter- and Pivot-Buttons
959 DrawButtons(nX1, nX2, rTableInfo, pContentDev, pLokRTLCtxt.get()); // Pixel
960
961 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
962
963 aOutputData.DrawClipMarks();
964
965 // In any case, Scenario / ChangeTracking must happen after DrawGrid, also for !bGridFirst
966
969
970 SCTAB nTabCount = rDoc.GetTableCount();
971 const std::vector<ScHighlightEntry> &rHigh = mrViewData.GetView()->GetHighlightRanges();
972 bool bHasScenario = ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) );
973 bool bHasChange = ( rDoc.GetChangeTrack() != nullptr );
974
975 if ( bHasChange || bHasScenario || !rHigh.empty() )
976 {
978
979 if ( bHasChange )
980 aOutputData.DrawChangeTrack();
981
982 if ( bHasScenario )
983 lcl_DrawScenarioFrames( pContentDev, mrViewData, eWhich, nX1,nY1,nX2,nY2 );
984
985 lcl_DrawHighlight( aOutputData, mrViewData, rHigh );
986 }
987
988 // Drawing foreground
989
990 pContentDev->SetMapMode(aDrawMode);
991
992 // Bitmaps and buttons are in absolute pixel coordinates.
993 const MapMode aOrig = pContentDev->GetMapMode();
994 if (bIsTiledRendering)
995 {
996 Point aOrigin = aOriginalMode.GetOrigin();
997 tools::Long nXOffset = bLayoutRTL ?
998 (-o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px) + aOutputData.GetScrW()) :
1000 Size aPixelOffset(nXOffset, o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px));
1001 pContentDev->SetPixelOffset(aPixelOffset);
1003 }
1004
1005 DrawRedraw( aOutputData, SC_LAYER_FRONT );
1006 DrawRedraw( aOutputData, SC_LAYER_INTERN );
1007 DrawSdrGrid( aDrawingRectLogic, pContentDev );
1008
1009 if (bIsTiledRendering)
1010 {
1011 pContentDev->SetPixelOffset(Size());
1012 pContentDev->SetMapMode(aOrig);
1013 }
1014
1015 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
1016
1017 if ( mrViewData.IsRefMode() && nTab >= mrViewData.GetRefStartZ() && nTab <= mrViewData.GetRefEndZ() )
1018 {
1019 Color aRefColor( rColorCfg.GetColorValue(svtools::CALCREFERENCE).nColor );
1022 aRefColor, false );
1023 }
1024
1025 // range finder
1026
1028 if (pHdl)
1029 {
1030 ScDocShell* pDocSh = mrViewData.GetDocShell();
1031 ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
1032 if ( pRangeFinder && !pRangeFinder->IsHidden() &&
1033 pRangeFinder->GetDocName() == pDocSh->GetTitle() )
1034 {
1035 sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
1036 for (sal_uInt16 i=0; i<nCount; i++)
1037 {
1038 ScRangeFindData& rData = pRangeFinder->GetObject(i);
1039
1040 ScRange aRef = rData.aRef;
1041 aRef.PutInOrder();
1042 if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
1043 aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
1044 aRef.aEnd.Col(), aRef.aEnd.Row(),
1045 rData.nColor,
1046 true );
1047 }
1048 }
1049 }
1050
1051 {
1052 // end redraw
1053 ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
1054
1055 if(pTabViewShell)
1056 {
1057 MapMode aCurrentMapMode(pContentDev->GetMapMode());
1058 pContentDev->SetMapMode(aDrawMode);
1059
1060 if (bIsTiledRendering)
1061 {
1062 Point aOrigin = aOriginalMode.GetOrigin();
1063 if (bLayoutRTL)
1064 aOrigin.setX(-o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1065 + aOutputData.nScrX + aOutputData.GetScrW());
1066 else
1067 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1068 + aOutputData.nScrX);
1069
1070 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1071 + aOutputData.nScrY);
1072 const double twipFactor = 15 * 1.76388889; // 26.45833335
1073 aOrigin = Point(aOrigin.getX() * twipFactor,
1074 aOrigin.getY() * twipFactor);
1075 MapMode aNew = rDevice.GetMapMode();
1076 aNew.SetOrigin(aOrigin);
1077 rDevice.SetMapMode(aNew);
1078 }
1079
1080 SdrView* pDrawView = pTabViewShell->GetScDrawView();
1081
1082 if(pDrawView)
1083 {
1084 // #i74769# work with SdrPaintWindow directly
1085 pDrawView->EndDrawLayers(*pTargetPaintWindow, true);
1086 }
1087
1088 pContentDev->SetMapMode(aCurrentMapMode);
1089 }
1090 }
1091
1092 // paint in-place editing
1093 if (bIsTiledRendering)
1094 {
1095 ScTabViewShell* pThisViewShell = mrViewData.GetViewShell();
1096 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1097
1098 while (pViewShell)
1099 {
1100 bool bEnterLoop = bIsTiledRendering || pViewShell != pThisViewShell;
1101 if (bEnterLoop && pViewShell->GetDocId() == pThisViewShell->GetDocId())
1102 {
1103 ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1104 if (pTabViewShell)
1105 {
1106 ScViewData& rOtherViewData = pTabViewShell->GetViewData();
1107 ScSplitPos eOtherWhich = rOtherViewData.GetEditActivePart();
1108
1109 bool bOtherEditMode = rOtherViewData.HasEditView(eOtherWhich);
1110 SCCOL nCol1 = rOtherViewData.GetEditStartCol();
1111 SCROW nRow1 = rOtherViewData.GetEditStartRow();
1112 SCCOL nCol2 = rOtherViewData.GetEditEndCol();
1113 SCROW nRow2 = rOtherViewData.GetEditEndRow();
1114 bOtherEditMode = bOtherEditMode
1115 && ( nCol2 >= nX1 && nCol1 <= nX2 && nRow2 >= nY1 && nRow1 <= nY2 );
1116 if (bOtherEditMode && rOtherViewData.GetRefTabNo() == nTab)
1117 {
1118 EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich);
1119 if (pOtherEditView)
1120 {
1121 tools::Long nScreenX = aOutputData.nScrX;
1122 tools::Long nScreenY = aOutputData.nScrY;
1123
1124 rDevice.SetLineColor();
1125 rDevice.SetFillColor(pOtherEditView->GetBackgroundColor());
1126 Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
1127 Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
1128
1129 if (bIsTiledRendering)
1130 {
1131 EditEngine* pEditEngine = pOtherEditView->GetEditEngine();
1132 if (pEditEngine)
1133 aEnd.AdjustY(lcl_GetMultiLineHeight(pEditEngine));
1134 }
1135
1136 if (bLokRTL)
1137 {
1138 // Transform the cell range X coordinates such that the edit cell area is
1139 // horizontally mirrored w.r.t the (combined-)tile.
1140 aStart.setX(pLokRTLCtxt->docToTilePos(aStart.X()));
1141 aEnd.setX(pLokRTLCtxt->docToTilePos(aEnd.X()));
1142 }
1143
1144 // don't overwrite grid
1145 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1146 aEnd.AdjustX( -(2 * nLayoutSign) );
1147 aEnd.AdjustY( -2 );
1148
1149 tools::Rectangle aBackground(aStart, aEnd);
1150 if (bLokRTL)
1151 aBackground.Normalize();
1152
1153 // Need to draw the background in absolute coords.
1154 Point aOrigin = aOriginalMode.GetOrigin();
1155 aOrigin.setX(
1157 + nScreenX);
1158 aOrigin.setY(
1160 + nScreenY);
1161 aBackground += aOrigin;
1162 rDevice.SetMapMode(aDrawMode);
1163
1164 static const double twipFactor = 15 * 1.76388889; // 26.45833335
1165 // keep into account the zoom factor
1166 aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1167 (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1168
1169 MapMode aNew = rDevice.GetMapMode();
1170 aNew.SetOrigin(aOrigin);
1171 rDevice.SetMapMode(aNew);
1172
1173 // paint the background
1174 rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
1175 tools::Rectangle aBGAbs(aBackground);
1176
1177 tools::Rectangle aEditRect(aBackground);
1178 tools::Long nOffsetX = 0, nOffsetY = 0;
1179 // Get top-left offset because of margin and indent.
1180 lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, nTab), mrViewData, rDoc);
1181 aEditRect.AdjustLeft(nOffsetX + 1);
1182 aEditRect.AdjustRight(1);
1183 aEditRect.AdjustTop(nOffsetY + 1);
1184 aEditRect.AdjustBottom(1);
1185
1186 // EditView has an 'output area' which is used to clip the 'paint area' we provide below.
1187 // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1188 // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1189 // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1190 OutputDevice& rOtherWin = pOtherEditView->GetOutputDevice();
1191 const tools::Rectangle aOrigOutputArea(pOtherEditView->GetOutputArea()); // Not in pixels.
1192 const MapMode aOrigMapMode = rOtherWin.GetMapMode();
1193 rOtherWin.SetMapMode(rDevice.GetMapMode());
1194
1195 // Avoid sending wrong cursor/selection messages by the 'other' view, as the output-area is going
1196 // to be tweaked temporarily to match the current view's zoom.
1197 SuppressEditViewMessagesGuard aGuard(*pOtherEditView);
1198
1199 aEditRect = rDevice.PixelToLogic(aEditRect);
1200 if (bIsTiledRendering)
1201 pOtherEditView->SetOutputArea(aEditRect);
1202 else
1203 aEditRect.Intersection(pOtherEditView->GetOutputArea());
1204 pOtherEditView->Paint(aEditRect, &rDevice);
1205
1206 // EditView will do the cursor notifications correctly if we're in
1207 // print-twips messaging mode.
1208 if (bIsTiledRendering && !comphelper::LibreOfficeKit::isCompatFlagSet(
1209 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1210 {
1211 // Now we need to get relative cursor position within the editview.
1212 // This is for sending the pixel-aligned twips position of the cursor to the specific views with
1213 // the same given zoom level.
1214 tools::Rectangle aCursorRect = pOtherEditView->GetEditCursor();
1215 Point aCursPos = OutputDevice::LogicToLogic(aCursorRect.TopLeft(),
1216 MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
1217
1218 const MapMode& rDevMM = rDevice.GetMapMode();
1219 MapMode aMM(MapUnit::MapTwip);
1220 aMM.SetScaleX(rDevMM.GetScaleX());
1221 aMM.SetScaleY(rDevMM.GetScaleY());
1222
1223 aBGAbs.AdjustLeft(1);
1224 aBGAbs.AdjustTop(1);
1225 aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
1226 aCursorRect.setWidth(0);
1227 aCursorRect.Move(aCursPos.getX(), 0);
1228 // Sends view cursor position to views of all matching zooms if needed (avoids duplicates).
1229 InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), aMM.GetScaleY());
1230 }
1231
1232 // Rollback the mapmode and 'output area'.
1233 rOtherWin.SetMapMode(aOrigMapMode);
1234 if (!bIsTiledRendering)
1235 pOtherEditView->SetOutputArea(aOrigOutputArea);
1236 rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1237 }
1238 }
1239 }
1240 }
1241
1242 pViewShell = SfxViewShell::GetNext(*pViewShell);
1243 }
1244
1245 }
1246
1247 // In-place editing - when the user is typing, we need to paint the text
1248 // using the editeng.
1249 // It's being done after EndDrawLayers() to get it outside the overlay
1250 // buffer and on top of everything.
1251 if (bInPlaceEditing)
1252 {
1253 // get the coordinates of the area we need to clear (overpaint by
1254 // the background)
1257 SCCOL nCol2 = mrViewData.GetEditEndCol();
1258 SCROW nRow2 = mrViewData.GetEditEndRow();
1259 rDevice.SetLineColor();
1260 rDevice.SetFillColor(pEditView->GetBackgroundColor());
1261 Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich );
1262 Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich );
1263
1264 if (bLokRTL)
1265 {
1266 // Transform the cell range X coordinates such that the edit cell area is
1267 // horizontally mirrored w.r.t the (combined-)tile.
1268 aStart.setX(pLokRTLCtxt->docToTilePos(aStart.X()));
1269 aEnd.setX(pLokRTLCtxt->docToTilePos(aEnd.X()));
1270 }
1271
1272 // don't overwrite grid
1273 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1274 aEnd.AdjustX( -(2 * nLayoutSign) );
1275 aEnd.AdjustY( -2 );
1276
1277 // set the correct mapmode
1278 tools::Rectangle aBackground(aStart, aEnd);
1279 if (bLokRTL)
1280 aBackground.Normalize();
1281 tools::Rectangle aBGAbs(aBackground);
1282
1283 if (bIsTiledRendering)
1284 {
1285 // Need to draw the background in absolute coords.
1286 Point aOrigin = aOriginalMode.GetOrigin();
1287 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1288 + nScrX);
1289 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1290 + nScrY);
1291 aBackground += aOrigin;
1292 rDevice.SetMapMode(aDrawMode);
1293 }
1294 else
1296
1297 if (bIsTiledRendering)
1298 {
1299 Point aOrigin = aOriginalMode.GetOrigin();
1300 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1301 + nScrX);
1302 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1303 + nScrY);
1304 static const double twipFactor = 15 * 1.76388889; // 26.45833335
1305 // keep into account the zoom factor
1306 aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1307 (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1308 MapMode aNew = rDevice.GetMapMode();
1309 aNew.SetOrigin(aOrigin);
1310 rDevice.SetMapMode(aNew);
1311 }
1312
1313 // paint the editeng text
1314 if (bIsTiledRendering)
1315 {
1316 // EditView has an 'output area' which is used to clip the paint area we provide below.
1317 // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1318 // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1319 // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1320 const MapMode aOrigMapMode = GetMapMode();
1321 SetMapMode(rDevice.GetMapMode());
1322
1323 // Avoid sending wrong cursor/selection messages by the current view, as the output-area is going
1324 // to be tweaked temporarily to match other view's zoom. (This does not affect the manual
1325 // cursor-messaging done in the non print-twips mode)
1326 SuppressEditViewMessagesGuard aGuard(*pEditView);
1327
1328 // EditView will do the cursor notifications correctly if we're in
1329 // print-twips messaging mode.
1331 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1332 {
1333 // Now we need to get relative cursor position within the editview.
1334 // This is for sending the pixel-aligned twips position of the cursor to the specific views with
1335 // the same given zoom level.
1336 tools::Rectangle aCursorRect = pEditView->GetEditCursor();
1337 Point aCursPos = o3tl::toTwips(aCursorRect.TopLeft(), o3tl::Length::mm100);
1338
1339 const MapMode& rDevMM = rDevice.GetMapMode();
1340 MapMode aMM(MapUnit::MapTwip);
1341 aMM.SetScaleX(rDevMM.GetScaleX());
1342 aMM.SetScaleY(rDevMM.GetScaleY());
1343
1344 aBGAbs.AdjustLeft(1);
1345 aBGAbs.AdjustTop(1);
1346 aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
1347 aCursorRect.setWidth(0);
1348 aCursorRect.Move(aCursPos.getX(), 0);
1349 // Sends view cursor position to views of all matching zooms if needed (avoids duplicates).
1350 InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), aMM.GetScaleY());
1351 }
1352
1353 // Rollback the mapmode and 'output area'.
1354 SetMapMode(aOrigMapMode);
1355 }
1356 else
1357 {
1358 // paint the background
1359 tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground));
1360 //tdf#100925, rhbz#1283420, Draw some text here, to get
1361 //X11CairoTextRender::getCairoContext called, so that the forced read
1362 //from the underlying X Drawable gets it to sync.
1363 rDevice.DrawText(aLogicRect.BottomLeft(), " ");
1364 rDevice.DrawRect(aLogicRect);
1365
1366 tools::Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
1367 pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
1368 }
1369
1370 rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1371
1372 // restore the cursor it was originally visible
1373 if (bInPlaceVisCursor)
1374 pInPlaceCrsr->Show();
1375 }
1376
1378 {
1379 // flush OverlayManager before changing the MapMode
1381
1382 // set MapMode for text edit
1384 }
1385 else
1386 rDevice.SetMapMode(aDrawMode);
1387
1388 if (mpNoteMarker)
1389 mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
1390
1391 if (bPage && bInitialPageBreaks)
1392 SetupInitialPageBreaks(rDoc, nTab);
1393}
1394
1395
1397{
1398 // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
1399 // is enabled, breaks should be visible. If the document is opened the first
1400 // time, the breaks are not calculated yet, so for this initialization
1401 // a timer will be triggered here.
1402 std::set<SCCOL> aColBreaks;
1403 std::set<SCROW> aRowBreaks;
1404 rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
1405 rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
1406 if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
1407 {
1408 maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
1410 }
1411 bInitialPageBreaks = false;
1412}
1413
1414namespace
1415{
1416 template<typename IndexType>
1417 void lcl_getBoundingRowColumnforTile(ScViewData& rViewData,
1418 tools::Long nTileStartPosPx, tools::Long nTileEndPosPx,
1419 sal_Int32& nTopLeftTileOffset, sal_Int32& nTopLeftTileOrigin,
1420 sal_Int32& nTopLeftTileIndex, sal_Int32& nBottomRightTileIndex)
1421 {
1422 const bool bColumnHeader = std::is_same<IndexType, SCCOL>::value;
1423
1424 SCTAB nTab = rViewData.GetTabNo();
1425
1426 IndexType nStartIndex = -1;
1427 IndexType nEndIndex = -1;
1428 tools::Long nStartPosPx = 0;
1429 tools::Long nEndPosPx = 0;
1430
1431 ScPositionHelper& rPositionHelper =
1432 bColumnHeader ? rViewData.GetLOKWidthHelper() : rViewData.GetLOKHeightHelper();
1433 const auto& rStartNearest = rPositionHelper.getNearestByPosition(nTileStartPosPx);
1434 const auto& rEndNearest = rPositionHelper.getNearestByPosition(nTileEndPosPx);
1435
1436 ScBoundsProvider aBoundsProvider(rViewData, nTab, bColumnHeader);
1437 aBoundsProvider.Compute(rStartNearest, rEndNearest, nTileStartPosPx, nTileEndPosPx);
1438 aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex;
1439 aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx);
1440
1441 nTopLeftTileOffset = nTileStartPosPx - nStartPosPx;
1442 nTopLeftTileOrigin = nStartPosPx;
1443 nTopLeftTileIndex = nStartIndex;
1444 nBottomRightTileIndex = nEndIndex;
1445 }
1446
1447 void lcl_RTLAdjustTileColOffset(ScViewData& rViewData, sal_Int32& nTileColOffset,
1448 tools::Long nTileEndPx, sal_Int32 nEndCol, SCTAB nTab,
1449 const ScDocument& rDoc, double fPPTX)
1450 {
1451 auto GetColWidthPx = [&rDoc, nTab, fPPTX](SCCOL nCol) {
1452 const sal_uInt16 nSize = rDoc.GetColWidth(nCol, nTab);
1453 const tools::Long nSizePx = ScViewData::ToPixel(nSize, fPPTX);
1454 return nSizePx;
1455 };
1456
1457 ScPositionHelper rHelper = rViewData.GetLOKWidthHelper();
1458 tools::Long nEndColPos = rHelper.computePosition(nEndCol, GetColWidthPx);
1459
1460 nTileColOffset += (nEndColPos - nTileEndPx - nTileColOffset);
1461 }
1462
1463 class ScLOKProxyObjectContact final : public sdr::contact::ObjectContactOfPageView
1464 {
1465 private:
1466 ScDrawView* mpScDrawView;
1467
1468 public:
1469 explicit ScLOKProxyObjectContact(
1470 ScDrawView* pDrawView,
1471 SdrPageWindow& rPageWindow,
1472 const char* pDebugName) :
1473 ObjectContactOfPageView(rPageWindow, pDebugName),
1474 mpScDrawView(pDrawView)
1475 {
1476 }
1477
1478 virtual bool supportsGridOffsets() const override { return true; }
1479
1481 basegfx::B2DVector& rTarget,
1482 const sdr::contact::ViewObjectContact& rClient) const override
1483 {
1484 if (!mpScDrawView)
1485 return;
1486
1487 SdrPageView* pPageView(mpScDrawView->GetSdrPageView());
1488 if (!pPageView)
1489 return;
1490
1491 SdrPageWindow* pSdrPageWindow = nullptr;
1492 if (pPageView->PageWindowCount() > 0)
1493 pSdrPageWindow = pPageView->GetPageWindow(0);
1494 if (!pSdrPageWindow)
1495 return;
1496
1497 sdr::contact::ObjectContact& rObjContact(pSdrPageWindow->GetObjectContact());
1498
1499 SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1500 if (pTargetSdrObject)
1501 rTarget = pTargetSdrObject->GetViewContact().GetViewObjectContact(rObjContact).getGridOffset();
1502 }
1503 };
1504
1505 class ScLOKDrawView : public FmFormView
1506 {
1507 public:
1508 ScLOKDrawView(OutputDevice* pOut, ScViewData& rData) :
1509 FmFormView(*rData.GetDocument().GetDrawLayer(), pOut),
1510 mpScDrawView(rData.GetScDrawView())
1511 {
1512 }
1513
1515 SdrPageWindow& rPageWindow, const char* pDebugName) const override
1516 {
1517 if (!mpScDrawView)
1518 return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1519
1520 return new ScLOKProxyObjectContact(mpScDrawView, rPageWindow, pDebugName);
1521 }
1522
1523 private:
1524 ScDrawView* mpScDrawView;
1525 };
1526} // anonymous namespace
1527
1529 int nOutputWidth, int nOutputHeight,
1530 int nTilePosX, int nTilePosY,
1531 tools::Long nTileWidth, tools::Long nTileHeight )
1532{
1533 Fraction origZoomX = mrViewData.GetZoomX();
1534 Fraction origZoomY = mrViewData.GetZoomY();
1535
1536 // Output size is in pixels while tile position and size are in logical units (twips).
1537
1538 // Assumption: always paint the whole sheet i.e. "visible" range is always
1539 // from (0,0) to last data position.
1540
1541 // Tile geometry is independent of the zoom level, but the output size is
1542 // dependent of the zoom level. Determine the correct zoom level before
1543 // we start.
1544
1545 // FIXME the painting works using a mixture of drawing with coordinates in
1546 // pixels and in logic coordinates; it should be cleaned up to use logic
1547 // coords only, and avoid all the SetMapMode()'s.
1548 // Similarly to Writer, we should set the mapmode once on the rDevice, and
1549 // not care about any zoom settings.
1550
1551 Fraction aFracX(o3tl::convert(nOutputWidth, o3tl::Length::px, o3tl::Length::twip), nTileWidth);
1552 Fraction aFracY(o3tl::convert(nOutputHeight, o3tl::Length::px, o3tl::Length::twip), nTileHeight);
1553
1554 const bool bChangeZoom = (aFracX != origZoomX || aFracY != origZoomY);
1555
1556 // page break zoom, and aLogicMode in ScViewData
1557 // FIXME: there are issues when SetZoom is called conditionally.
1558 mrViewData.SetZoom(aFracX, aFracY, true);
1559 if (bChangeZoom)
1560 {
1561 if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1562 pDrawView->resetGridOffsetsForAllSdrPageViews();
1563 }
1564
1565 const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
1566 const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
1567 const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight;
1568 const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
1569
1570 SCTAB nTab = mrViewData.GetTabNo();
1572
1573 const double fPPTX = mrViewData.GetPPTX();
1574 const double fPPTY = mrViewData.GetPPTY();
1575
1576 // find approximate col/row offsets of nearby.
1577 sal_Int32 nTopLeftTileRowOffset = 0;
1578 sal_Int32 nTopLeftTileColOffset = 0;
1579 sal_Int32 nTopLeftTileRowOrigin = 0;
1580 sal_Int32 nTopLeftTileColOrigin = 0;
1581
1582 sal_Int32 nTopLeftTileRow = 0;
1583 sal_Int32 nTopLeftTileCol = 0;
1584 sal_Int32 nBottomRightTileRow = 0;
1585 sal_Int32 nBottomRightTileCol = 0;
1586
1587 lcl_getBoundingRowColumnforTile<SCROW>(mrViewData,
1588 fTilePosYPixel, fTileBottomPixel,
1589 nTopLeftTileRowOffset, nTopLeftTileRowOrigin,
1590 nTopLeftTileRow, nBottomRightTileRow);
1591
1592 lcl_getBoundingRowColumnforTile<SCCOL>(mrViewData,
1593 fTilePosXPixel, fTileRightPixel,
1594 nTopLeftTileColOffset, nTopLeftTileColOrigin,
1595 nTopLeftTileCol, nBottomRightTileCol);
1596
1597 // Enlarge
1598 nBottomRightTileCol++;
1599 nBottomRightTileRow++;
1600
1601 if (nBottomRightTileCol > rDoc.MaxCol())
1602 nBottomRightTileCol = rDoc.MaxCol();
1603
1604 if (nBottomRightTileRow > MAXTILEDROW)
1605 nBottomRightTileRow = MAXTILEDROW;
1606
1607 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
1608
1609 if (bLayoutRTL)
1610 {
1611 lcl_RTLAdjustTileColOffset(mrViewData, nTopLeftTileColOffset,
1612 fTileRightPixel, nBottomRightTileCol, nTab,
1613 rDoc, fPPTX);
1614 }
1615
1616 // size of the document including drawings, charts, etc.
1617 SCCOL nEndCol = 0;
1618 SCROW nEndRow = 0;
1619 rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
1620
1621 if (nEndCol < nBottomRightTileCol)
1622 nEndCol = nBottomRightTileCol;
1623
1624 if (nEndRow < nBottomRightTileRow)
1625 nEndRow = nBottomRightTileRow;
1626
1627 nTopLeftTileCol = std::max<sal_Int32>(nTopLeftTileCol, 0);
1628 nTopLeftTileRow = std::max<sal_Int32>(nTopLeftTileRow, 0);
1629 nTopLeftTileColOrigin = o3tl::convert(nTopLeftTileColOrigin, o3tl::Length::px, o3tl::Length::twip);
1630 nTopLeftTileRowOrigin = o3tl::convert(nTopLeftTileRowOrigin, o3tl::Length::px, o3tl::Length::twip);
1631
1632 // Checkout -> 'rDoc.ExtendMerge' ... if we miss merged cells.
1633
1634 // Origin must be the offset of the first col and row
1635 // containing our top-left pixel.
1636 const MapMode aOriginalMode = rDevice.GetMapMode();
1637 MapMode aAbsMode = aOriginalMode;
1638 const Point aOrigin(-nTopLeftTileColOrigin, -nTopLeftTileRowOrigin);
1639 aAbsMode.SetOrigin(aOrigin);
1640 rDevice.SetMapMode(aAbsMode);
1641
1642 ScTableInfo aTabInfo(nEndRow + 3);
1643 rDoc.FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
1644 nBottomRightTileCol, nBottomRightTileRow,
1645 nTab, fPPTX, fPPTY, false, false);
1646
1647// FIXME: is this called some
1648// Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich );
1649
1650 ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
1651 -nTopLeftTileColOffset,
1652 -nTopLeftTileRowOffset,
1653 nTopLeftTileCol, nTopLeftTileRow,
1654 nBottomRightTileCol, nBottomRightTileRow,
1655 fPPTX, fPPTY, nullptr, nullptr);
1656
1657 // setup the SdrPage so that drawinglayer works correctly
1658 ScDrawLayer* pModel = rDoc.GetDrawLayer();
1659 if (pModel)
1660 {
1661 bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
1662 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1663 if (!mpLOKDrawView)
1664 {
1665 mpLOKDrawView.reset(bPrintTwipsMsgs ?
1666 new ScLOKDrawView(
1667 &rDevice,
1668 mrViewData) :
1669 new FmFormView(
1670 *pModel,
1671 &rDevice));
1672 }
1673
1674 mpLOKDrawView->SetNegativeX(bLayoutRTL);
1675 mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel().GetPage(nTab));
1676 aOutputData.SetDrawView(mpLOKDrawView.get());
1677 aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
1678 }
1679
1680 // draw the content
1681 DrawContent(rDevice, aTabInfo, aOutputData, true);
1682 rDevice.SetMapMode(aOriginalMode);
1683
1684 // Paint the chart(s) in edit mode.
1685 LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
1686 nTilePosX, nTilePosY, nTileWidth, nTileHeight, bLayoutRTL);
1687
1688 rDevice.SetMapMode(aOriginalMode);
1689
1690 // Flag drawn formula cells "unchanged".
1691 rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
1692 rDoc.PrepareFormulaCalc();
1693
1694 mrViewData.SetZoom(origZoomX, origZoomY, true);
1695 if (bChangeZoom)
1696 {
1697 if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1698 pDrawView->resetGridOffsetsForAllSdrPageViews();
1699 }
1700
1701 if (bLayoutRTL)
1702 {
1703 Bitmap aCellBMP = rDevice.GetBitmap(Point(0, 0), Size(nOutputWidth, nOutputHeight));
1704 aCellBMP.Mirror(BmpMirrorFlags::Horizontal);
1705 rDevice.DrawBitmap(Point(0, 0), Size(nOutputWidth, nOutputHeight), aCellBMP);
1706 }
1707}
1708
1710{
1711 tools::Rectangle aRectangle;
1712 tools::Rectangle* pResultRectangle;
1713 if (!pRectangle)
1714 pResultRectangle = nullptr;
1715 else
1716 {
1717 aRectangle = *pRectangle;
1718 // When dragging shapes the map mode is disabled.
1719 if (IsMapModeEnabled())
1720 {
1721 if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
1722 {
1723 aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
1724 }
1725 }
1726 else
1727 aRectangle = PixelToLogic(aRectangle, MapMode(MapUnit::MapTwip));
1728 pResultRectangle = &aRectangle;
1729 }
1730
1731 // Trim invalidation rectangle overlapping negative X region in RTL mode.
1732 if (pResultRectangle && pResultRectangle->Left() < 0
1734 {
1735 pResultRectangle->SetLeft(0);
1736 if (pResultRectangle->Right() < 0)
1737 pResultRectangle->SetRight(0);
1738 }
1739
1740 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1741 SfxLokHelper::notifyInvalidation(pViewShell, pResultRectangle);
1742}
1743
1744void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
1745{
1746 ScTabView* pTabView = mrViewData.GetView();
1747 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1748 ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
1749
1750 if (pInputHandler && pInputHandler->IsInputMode())
1751 {
1752 // we need to switch off the editeng
1754 pViewShell->UpdateInputHandler();
1755 }
1756
1757 if (nType == LOK_SETTEXTSELECTION_RESET)
1758 {
1759 pTabView->DoneBlockMode();
1760 return;
1761 }
1762
1763 // obtain the current selection
1765
1766 SCCOL nCol1, nCol2;
1767 SCROW nRow1, nRow2;
1768 SCTAB nTab1, nTab2;
1769
1770 bool bWasEmpty = false;
1771 if (aRangeList.empty())
1772 {
1773 nCol1 = nCol2 = mrViewData.GetCurX();
1774 nRow1 = nRow2 = mrViewData.GetCurY();
1775 bWasEmpty = true;
1776 }
1777 else
1778 aRangeList.Combine().GetVars(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
1779
1780 // convert the coordinates to column/row
1781 SCCOL nNewPosX;
1782 SCROW nNewPosY;
1783 SCTAB nTab = mrViewData.GetTabNo();
1784 mrViewData.GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY);
1785
1786 // change the selection
1787 switch (nType)
1788 {
1789 case LOK_SETTEXTSELECTION_START:
1790 if (nNewPosX != nCol1 || nNewPosY != nRow1 || bWasEmpty)
1791 {
1792 pTabView->SetCursor(nNewPosX, nNewPosY);
1793 pTabView->DoneBlockMode();
1794 pTabView->InitBlockMode(nNewPosX, nNewPosY, nTab, true);
1795 pTabView->MarkCursor(nCol2, nRow2, nTab);
1796 }
1797 break;
1798 case LOK_SETTEXTSELECTION_END:
1799 if (nNewPosX != nCol2 || nNewPosY != nRow2 || bWasEmpty)
1800 {
1801 pTabView->SetCursor(nCol1, nRow1);
1802 pTabView->DoneBlockMode();
1803 pTabView->InitBlockMode(nCol1, nRow1, nTab, true);
1804 pTabView->MarkCursor(nNewPosX, nNewPosY, nTab);
1805 }
1806 break;
1807 default:
1808 assert(false);
1809 break;
1810 }
1811}
1812
1814{
1815 // called at the end of painting, and from timer after background text width calculation
1816
1817 if (!bNeedsRepaint)
1818 return;
1819
1820 bNeedsRepaint = false;
1821 if (aRepaintPixel.IsEmpty())
1822 Invalidate();
1823 else
1826
1827 // selection function in status bar might also be invalid
1828 SfxBindings& rBindings = mrViewData.GetBindings();
1829 rBindings.Invalidate( SID_STATUS_SUM );
1830 rBindings.Invalidate( SID_ATTR_SIZE );
1831 rBindings.Invalidate( SID_TABLE_CELL );
1832}
1833
1835{
1837 SCTAB nTab = mrViewData.GetTabNo();
1838 const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1840 if (aColorValue.bIsVisible) {
1841 rRenderContext.SetLineColor(aColorValue.nColor);
1842 LineInfo aLineInfo(LineStyle::Dash, 2);
1843 aLineInfo.SetDashCount(0);
1844 aLineInfo.SetDotCount(1);
1845 aLineInfo.SetDistance(15);
1846 // round caps except when running VCL_PLUGIN=gen due to a performance issue
1847 // https://bugs.documentfoundation.org/show_bug.cgi?id=128258#c14
1849 aLineInfo.SetLineCap(css::drawing::LineCap_ROUND);
1850 aLineInfo.SetDotLen(1);
1851 for (int i=nX1; i<nX2; i++) {
1852 if (rDoc.ColHidden(i,nTab) && (i<rDoc.MaxCol() ? !rDoc.ColHidden(i+1,nTab) : true)) {
1853 Point aStart = mrViewData.GetScrPos(i, nY1, eWhich, true );
1854 Point aEnd = mrViewData.GetScrPos(i, nY2, eWhich, true );
1855 rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
1856 }
1857 }
1858 for (int i=nY1; i<nY2; i++) {
1859 if (rDoc.RowHidden(i,nTab) && (i<rDoc.MaxRow() ? !rDoc.RowHidden(i+1,nTab) : true)) {
1860 Point aStart = mrViewData.GetScrPos(nX1, i, eWhich, true );
1861 Point aEnd = mrViewData.GetScrPos(nX2, i, eWhich, true );
1862 rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
1863 }
1864 }
1865 } //visible
1866}
1867
1868void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
1869{
1871 if (!pPageData)
1872 return;
1873
1875 SCTAB nTab = mrViewData.GetTabNo();
1876 Size aWinSize = GetOutputSizePixel();
1877 const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1879 Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor );
1880
1881 OUString aPageStr = ScResId( STR_PGNUM );
1882 if ( nPageScript == SvtScriptType::NONE )
1883 {
1884 // get script type of translated "Page" string only once
1885 nPageScript = rDoc.GetStringScriptType( aPageStr );
1886 if (nPageScript == SvtScriptType::NONE)
1888 }
1889
1890 vcl::Font aFont;
1891 std::unique_ptr<ScEditEngineDefaulter> pEditEng;
1892 const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
1893 if ( nPageScript == SvtScriptType::LATIN )
1894 {
1895 // use single font and call DrawText directly
1896 rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
1897 aFont.SetColor( COL_LIGHTGRAY );
1898 // font size is set as needed
1899 }
1900 else
1901 {
1902 // use EditEngine to draw mixed-script string
1903 pEditEng.reset(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true ));
1904 pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
1905 auto pEditDefaults = std::make_unique<SfxItemSet>( pEditEng->GetEmptyItemSet() );
1906 rDefPattern.FillEditItemSet( pEditDefaults.get() );
1907 pEditDefaults->Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
1908 pEditEng->SetDefaults( std::move(pEditDefaults) );
1909 }
1910
1911 sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
1912 for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
1913 {
1914 ScPrintRangeData& rData = pPageData->GetData(nPos);
1915 ScRange aRange = rData.GetPrintRange();
1916 if ( aRange.aStart.Col() <= nX2+1 && aRange.aEnd.Col()+1 >= nX1 &&
1917 aRange.aStart.Row() <= nY2+1 && aRange.aEnd.Row()+1 >= nY1 )
1918 {
1919 // 3 pixel frame around the print area
1920 // (middle pixel on the grid lines)
1921
1922 rRenderContext.SetLineColor();
1923 if (rData.IsAutomatic())
1924 rRenderContext.SetFillColor( aAutomatic );
1925 else
1926 rRenderContext.SetFillColor( aManual );
1927
1928 Point aStart = mrViewData.GetScrPos(
1929 aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
1930 Point aEnd = mrViewData.GetScrPos(
1931 aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, true );
1932 aStart.AdjustX( -2 );
1933 aStart.AdjustY( -2 );
1934
1935 // Prevent overflows:
1936 if ( aStart.X() < -10 ) aStart.setX( -10 );
1937 if ( aStart.Y() < -10 ) aStart.setY( -10 );
1938 if ( aEnd.X() > aWinSize.Width() + 10 )
1939 aEnd.setX( aWinSize.Width() + 10 );
1940 if ( aEnd.Y() > aWinSize.Height() + 10 )
1941 aEnd.setY( aWinSize.Height() + 10 );
1942
1943 rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
1944 rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
1945 rRenderContext.DrawRect( tools::Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
1946 rRenderContext.DrawRect( tools::Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
1947
1948 // Page breaks
1950
1951 size_t nColBreaks = rData.GetPagesX();
1952 const SCCOL* pColEnd = rData.GetPageEndX();
1953 size_t nColPos;
1954 for (nColPos=0; nColPos+1<nColBreaks; nColPos++)
1955 {
1956 SCCOL nBreak = pColEnd[nColPos]+1;
1957 if ( nBreak >= nX1 && nBreak <= nX2+1 )
1958 {
1960 if (rDoc.HasColBreak(nBreak, nTab) & ScBreakType::Manual)
1961 rRenderContext.SetFillColor( aManual );
1962 else
1963 rRenderContext.SetFillColor( aAutomatic );
1964 Point aBreak = mrViewData.GetScrPos(
1965 nBreak, aRange.aStart.Row(), eWhich, true );
1966 rRenderContext.DrawRect( tools::Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
1967 }
1968 }
1969
1970 size_t nRowBreaks = rData.GetPagesY();
1971 const SCROW* pRowEnd = rData.GetPageEndY();
1972 size_t nRowPos;
1973 for (nRowPos=0; nRowPos+1<nRowBreaks; nRowPos++)
1974 {
1975 SCROW nBreak = pRowEnd[nRowPos]+1;
1976 if ( nBreak >= nY1 && nBreak <= nY2+1 )
1977 {
1979 if (rDoc.HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
1980 rRenderContext.SetFillColor( aManual );
1981 else
1982 rRenderContext.SetFillColor( aAutomatic );
1983 Point aBreak = mrViewData.GetScrPos(
1984 aRange.aStart.Col(), nBreak, eWhich, true );
1985 rRenderContext.DrawRect( tools::Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
1986 }
1987 }
1988
1989 // Page numbers
1990
1991 SCROW nPrStartY = aRange.aStart.Row();
1992 for (nRowPos=0; nRowPos<nRowBreaks; nRowPos++)
1993 {
1994 SCROW nPrEndY = pRowEnd[nRowPos];
1995 if ( nPrEndY >= nY1 && nPrStartY <= nY2 )
1996 {
1997 SCCOL nPrStartX = aRange.aStart.Col();
1998 for (nColPos=0; nColPos<nColBreaks; nColPos++)
1999 {
2000 SCCOL nPrEndX = pColEnd[nColPos];
2001 if ( nPrEndX >= nX1 && nPrStartX <= nX2 )
2002 {
2003 Point aPageStart = mrViewData.GetScrPos(
2004 nPrStartX, nPrStartY, eWhich, true );
2005 Point aPageEnd = mrViewData.GetScrPos(
2006 nPrEndX+1,nPrEndY+1, eWhich, true );
2007
2008 tools::Long nPageNo = rData.GetFirstPage();
2009 if ( rData.IsTopDown() )
2010 nPageNo += static_cast<tools::Long>(nColPos)*nRowBreaks+nRowPos;
2011 else
2012 nPageNo += static_cast<tools::Long>(nRowPos)*nColBreaks+nColPos;
2013
2014 OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo));
2015
2016 if ( pEditEng )
2017 {
2018 // find right font size with EditEngine
2019 tools::Long nHeight = 100;
2020 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
2021 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
2022 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
2023 pEditEng->SetTextCurrentDefaults( aThisPageStr );
2024 Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
2025
2026 // 40% of width or 60% of height
2027 tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
2028 tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
2029 nHeight = std::min(nSizeX,nSizeY);
2030 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
2031 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
2032 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
2033
2034 // centered output with EditEngine
2035 Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
2036 Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
2037 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
2038 pEditEng->Draw(rRenderContext, aPos);
2039 }
2040 else
2041 {
2042 // find right font size for DrawText
2043 aFont.SetFontSize( Size( 0,100 ) );
2044 rRenderContext.SetFont( aFont );
2045
2046 Size aSize100(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
2047 if (aSize100.Width() && aSize100.Height())
2048 {
2049 // 40% of width or 60% of height
2050 tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
2051 tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
2052 aFont.SetFontSize( Size( 0,std::min(nSizeX,nSizeY) ) );
2053 rRenderContext.SetFont( aFont );
2054 }
2055
2056 // centered output with DrawText
2057 Size aTextSize(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
2058 Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
2059 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
2060 rRenderContext.DrawText( aPos, aThisPageStr );
2061 }
2062 }
2063 nPrStartX = nPrEndX + 1;
2064 }
2065 }
2066 nPrStartY = nPrEndY + 1;
2067 }
2068 }
2069 }
2070}
2071
2072void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev, const ScLokRTLContext* pLokRTLContext)
2073{
2074 aComboButton.SetOutputDevice( pContentDev );
2075
2077 ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc);
2078
2079 SCCOL nCol;
2080 SCROW nRow;
2081 SCSIZE nArrY;
2082 SCSIZE nQuery;
2083 SCTAB nTab = mrViewData.GetTabNo();
2084 ScDBData* pDBData = nullptr;
2085 std::unique_ptr<ScQueryParam> pQueryParam;
2086
2087 RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
2088 sal_uInt16 nArrCount = rTabInfo.mnArrCount;
2089
2090 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2091
2092 Point aOldPos = aComboButton.GetPosPixel(); // store state for MouseDown/Up
2093 Size aOldSize = aComboButton.GetSizePixel();
2094
2095 for (nArrY=1; nArrY+1<nArrCount; nArrY++)
2096 {
2097 if ( pRowInfo[nArrY].bAutoFilter && pRowInfo[nArrY].bChanged )
2098 {
2099 RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2100
2101 nRow = pThisRowInfo->nRowNo;
2102
2103 for (nCol=nX1; nCol<=nX2; nCol++)
2104 {
2105 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
2106 //if several columns merged on a row, there should be only one auto button at the end of the columns.
2107 //if several rows merged on a column, the button may be in the middle, so "!pInfo->bVOverlapped" should not be used
2108 if ( pInfo->bAutoFilter && !pInfo->bHOverlapped )
2109 {
2110 if (!pQueryParam)
2111 pQueryParam.reset(new ScQueryParam);
2112
2113 bool bNewData = true;
2114 if (pDBData)
2115 {
2116 SCCOL nStartCol;
2117 SCROW nStartRow;
2118 SCCOL nEndCol;
2119 SCROW nEndRow;
2120 SCTAB nAreaTab;
2121 pDBData->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
2122 if ( nCol >= nStartCol && nCol <= nEndCol &&
2123 nRow >= nStartRow && nRow <= nEndRow )
2124 bNewData = false;
2125 }
2126 if (bNewData)
2127 {
2128 pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2129 if (pDBData)
2130 pDBData->GetQueryParam( *pQueryParam );
2131 else
2132 {
2133 // can also be part of DataPilot table
2134 }
2135 }
2136
2137 // pQueryParam can only include MAXQUERY entries
2138
2139 bool bArrowState = false;
2140 if (pQueryParam->bInplace)
2141 {
2142 SCSIZE nCount = pQueryParam->GetEntryCount();
2143 for (nQuery = 0; nQuery < nCount; ++nQuery)
2144 {
2145 // Do no restrict to EQUAL here
2146 // (Column head should become blue also when ">1")
2147 const ScQueryEntry& rEntry = pQueryParam->GetEntry(nQuery);
2148 if (rEntry.bDoQuery && rEntry.nField == nCol)
2149 {
2150 bArrowState = true;
2151 break;
2152 }
2153 }
2154 }
2155
2156 tools::Long nSizeX;
2157 tools::Long nSizeY;
2158 SCCOL nStartCol= nCol;
2159 SCROW nStartRow = nRow;
2160 //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.
2161 //should first get the start pos of the merge area, then get the nSizeX through the start pos.
2162 rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
2163 mrViewData.GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX
2164 nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY());
2165 Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
2166 if (pLokRTLContext)
2167 aScrPos.setX(pLokRTLContext->docToTilePos(aScrPos.X()));
2168
2169 aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
2170 aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
2171 aCellBtn.setDrawBaseButton(false);
2172 aCellBtn.setDrawPopupButton(true);
2173 aCellBtn.setHasHiddenMember(bArrowState);
2174 aCellBtn.draw();
2175 }
2176 }
2177 }
2178
2179 if ( pRowInfo[nArrY].bPivotButton && pRowInfo[nArrY].bChanged )
2180 {
2181 RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2182 nRow = pThisRowInfo->nRowNo;
2183 for (nCol=nX1; nCol<=nX2; nCol++)
2184 {
2185 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
2186 if (pInfo->bHOverlapped || pInfo->bVOverlapped)
2187 continue;
2188
2189 Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
2190 tools::Long nSizeX;
2191 tools::Long nSizeY;
2192 mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
2193 tools::Long nPosX = aScrPos.X();
2194 tools::Long nPosY = aScrPos.Y();
2195 // bLayoutRTL is handled in setBoundingBox
2196
2197 OUString aStr = rDoc.GetString(nCol, nRow, nTab);
2198 aCellBtn.setText(aStr);
2199 aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
2200 aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
2201 aCellBtn.setDrawBaseButton(pInfo->bPivotButton);
2202 aCellBtn.setDrawPopupButton(pInfo->bPivotPopupButton);
2203 aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
2204 aCellBtn.draw();
2205 }
2206 }
2207
2208 if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
2209 {
2211 aComboButton.SetPosPixel( aRect.TopLeft() );
2213 pContentDev->SetClipRegion(vcl::Region(aRect));
2215 pContentDev->SetClipRegion(); // always called from Draw() without clip region
2216 aComboButton.SetPosPixel( aOldPos ); // restore old state
2217 aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
2218 }
2219 }
2220
2221 pQueryParam.reset();
2223}
2224
2226{
2228 SCTAB nTab = mrViewData.GetTabNo();
2229 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2230 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2231
2232 ScDDComboBoxButton aButton( GetOutDev() ); // for optimal size
2233 Size aBtnSize = aButton.GetSizePixel();
2234
2235 SCCOL nCol = rButtonPos.Col();
2236 SCROW nRow = rButtonPos.Row();
2237
2238 tools::Long nCellSizeX; // width of this cell, including merged
2239 tools::Long nDummy;
2240 mrViewData.GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
2241
2242 // for height, only the cell's row is used, excluding merged cells
2243 tools::Long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), mrViewData.GetPPTY() );
2244 tools::Long nAvailable = nCellSizeX;
2245
2246 // left edge of next cell if there is a non-hidden next column
2247 SCCOL nNextCol = nCol + 1;
2248 const ScMergeAttr* pMerge = rDoc.GetAttr( nCol,nRow,nTab, ATTR_MERGE );
2249 if ( pMerge->GetColMerge() > 1 )
2250 nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area
2251 while ( nNextCol <= rDoc.MaxCol() && rDoc.ColHidden(nNextCol, nTab) )
2252 ++nNextCol;
2253 bool bNextCell = ( nNextCol <= rDoc.MaxCol() );
2254 if ( bNextCell )
2255 nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), mrViewData.GetPPTX() );
2256
2257 if ( nAvailable < aBtnSize.Width() )
2258 aBtnSize.setWidth( nAvailable );
2259 if ( nCellSizeY < aBtnSize.Height() )
2260 aBtnSize.setHeight( nCellSizeY );
2261
2262 Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich, true );
2263 aPos.AdjustX(nCellSizeX * nLayoutSign ); // start of next cell
2264 if (!bNextCell)
2265 aPos.AdjustX( -(aBtnSize.Width() * nLayoutSign) ); // right edge of cell if next cell not available
2266 aPos.AdjustY(nCellSizeY - aBtnSize.Height() );
2267 // X remains at the left edge
2268
2269 if ( bLayoutRTL )
2270 aPos.AdjustX( -(aBtnSize.Width()-1) ); // align right edge of button with cell border
2271
2272 return tools::Rectangle( aPos, aBtnSize );
2273}
2274
2276{
2278 ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2279 ScQueryParam aQueryParam;
2280
2281 if ( pDBData )
2282 pDBData->GetQueryParam( aQueryParam );
2283 else
2284 {
2285 OSL_FAIL("Auto filter button without DBData");
2286 }
2287
2288 bool bSimpleQuery = true;
2289 bool bColumnFound = false;
2290 SCSIZE nQuery;
2291
2292 if ( !aQueryParam.bInplace )
2293 bSimpleQuery = false;
2294
2295 // aQueryParam can only include MAXQUERY entries
2296
2297 SCSIZE nCount = aQueryParam.GetEntryCount();
2298 for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
2299 if ( aQueryParam.GetEntry(nQuery).bDoQuery )
2300 {
2301 if (aQueryParam.GetEntry(nQuery).nField == nCol)
2302 bColumnFound = true;
2303
2304 if (nQuery > 0)
2305 if (aQueryParam.GetEntry(nQuery).eConnect != SC_AND)
2306 bSimpleQuery = false;
2307 }
2308
2309 return ( bSimpleQuery && bColumnFound );
2310}
2311
2312void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelRects ) const
2313{
2314 GetPixelRectsFor( mrViewData.GetMarkData(), rPixelRects );
2315}
2316
2317void ScGridWindow::GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle >& rRects) const
2318{
2319 GetRectsAnyFor(mrViewData.GetMarkData(), rRects, true);
2320}
2321
2324 ::std::vector< tools::Rectangle >& rPixelRects ) const
2325{
2326 GetRectsAnyFor(rMarkData, rPixelRects, false);
2327}
2328
2330 ::std::vector< tools::Rectangle >& rRects,
2331 bool bInPrintTwips) const
2332{
2334 SCTAB nTab = mrViewData.GetTabNo();
2335 double nPPTX = mrViewData.GetPPTX();
2336 double nPPTY = mrViewData.GetPPTY();
2337 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2338 // LOK clients needs exact document coordinates, so don't horizontally mirror them.
2339 tools::Long nLayoutSign = (!comphelper::LibreOfficeKit::isActive() && bLayoutRTL) ? -1 : 1;
2340
2341 ScMarkData aMultiMark( rMarkData );
2342 aMultiMark.SetMarking( false );
2343
2344 if (!aMultiMark.IsMultiMarked())
2345 {
2346 // simple range case - simplify calculation
2347 const ScRange& aSimpleRange = aMultiMark.GetMarkArea();
2348
2349 aMultiMark.MarkToMulti();
2350 if ( !aMultiMark.IsMultiMarked() )
2351 return;
2352
2353 SCCOL nX1 = aSimpleRange.aStart.Col();
2354 SCROW nY1 = aSimpleRange.aStart.Row();
2355 SCCOL nX2 = aSimpleRange.aEnd.Col();
2356 SCROW nY2 = aSimpleRange.aEnd.Row();
2357
2358 PutInOrder( nX1, nX2 );
2359 PutInOrder( nY1, nY2 );
2360
2361 SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2362 SCROW nPosY = mrViewData.GetPosY( eVWhich );
2363 // is the selection visible at all?
2364 if (nX2 < nPosX || nY2 < nPosY)
2365 return;
2366
2367 Point aScrStartPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2368 mrViewData.GetScrPos(nX1, nY1, eWhich);
2369
2370 tools::Long nStartX = aScrStartPos.X();
2371 tools::Long nStartY = aScrStartPos.Y();
2372
2373 Point aScrEndPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX2, nY2) :
2374 mrViewData.GetScrPos(nX2, nY2, eWhich);
2375
2376 tools::Long nWidthTwips = rDoc.GetColWidth(nX2, nTab);
2377 const tools::Long nWidth = bInPrintTwips ?
2378 nWidthTwips : ScViewData::ToPixel(nWidthTwips, nPPTX);
2379 tools::Long nEndX = aScrEndPos.X() + (nWidth - 1) * nLayoutSign;
2380
2381 sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY2, nTab );
2382 const tools::Long nHeight = bInPrintTwips ?
2383 nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2384 tools::Long nEndY = aScrEndPos.Y() + nHeight - 1;
2385
2386 ScInvertMerger aInvert( &rRects );
2387 aInvert.AddRect( tools::Rectangle( nStartX, nStartY, nEndX, nEndY ) );
2388
2389 return;
2390 }
2391
2392 aMultiMark.MarkToMulti();
2393 if ( !aMultiMark.IsMultiMarked() )
2394 return;
2395 const ScRange& aMultiRange = aMultiMark.GetMultiMarkArea();
2396 SCCOL nX1 = aMultiRange.aStart.Col();
2397 SCROW nY1 = aMultiRange.aStart.Row();
2398 SCCOL nX2 = aMultiRange.aEnd.Col();
2399 SCROW nY2 = aMultiRange.aEnd.Row();
2400
2401 PutInOrder( nX1, nX2 );
2402 PutInOrder( nY1, nY2 );
2403
2404 SCCOL nTestX2 = nX2;
2405 SCROW nTestY2 = nY2;
2406
2407 rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
2408
2409 SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2410 SCROW nPosY = mrViewData.GetPosY( eVWhich );
2411 // is the selection visible at all?
2412 if (nTestX2 < nPosX || nTestY2 < nPosY)
2413 return;
2414 SCCOL nRealX1 = nX1;
2415 if (nX1 < nPosX)
2416 nX1 = nPosX;
2417 if (nY1 < nPosY)
2418 nY1 = nPosY;
2419
2421 {
2422 // limit the selection to only what is visible on the screen
2423 SCCOL nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich);
2424 if (nXRight > rDoc.MaxCol())
2425 nXRight = rDoc.MaxCol();
2426
2427 SCROW nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich);
2428 if (nYBottom > rDoc.MaxRow())
2429 nYBottom = rDoc.MaxRow();
2430
2431 // is the selection visible at all?
2432 if (nX1 > nXRight || nY1 > nYBottom)
2433 return;
2434
2435 if (nX2 > nXRight)
2436 nX2 = nXRight;
2437 if (nY2 > nYBottom)
2438 nY2 = nYBottom;
2439 }
2440 else
2441 {
2442 SCCOL nMaxTiledCol;
2443 SCROW nMaxTiledRow;
2444 rDoc.GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
2445
2446 if (nX2 > nMaxTiledCol)
2447 nX2 = nMaxTiledCol;
2448 if (nY2 > nMaxTiledRow)
2449 nY2 = nMaxTiledRow;
2450 }
2451
2452 ScInvertMerger aInvert( &rRects );
2453
2454 Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2455 mrViewData.GetScrPos(nX1, nY1, eWhich);
2456 tools::Long nScrY = aScrPos.Y();
2457 bool bWasHidden = false;
2458 for (SCROW nY=nY1; nY<=nY2; nY++)
2459 {
2460 bool bFirstRow = ( nY == nPosY ); // first visible row?
2461 bool bDoHidden = false; // repeat hidden ?
2462 sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY,nTab );
2463 bool bDoRow = ( nHeightTwips != 0 );
2464 if (bDoRow)
2465 {
2466 if (bWasHidden) // test hidden merge
2467 {
2468 bDoHidden = true;
2469 bDoRow = true;
2470 }
2471
2472 bWasHidden = false;
2473 }
2474 else
2475 {
2476 bWasHidden = true;
2477 if (nY==nY2)
2478 bDoRow = true; // last cell of the block
2479 }
2480
2481 if ( bDoRow )
2482 {
2483 SCCOL nLoopEndX = nX2;
2484 if (nX2 < nX1) // the rest of the merge
2485 {
2486 SCCOL nStartX = nX1;
2487 while ( rDoc.GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
2488 --nStartX;
2489 if (nStartX <= nX2)
2490 nLoopEndX = nX1;
2491 }
2492
2493 const tools::Long nHeight = bInPrintTwips ?
2494 nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2495 tools::Long nEndY = nScrY + nHeight - 1;
2496 tools::Long nScrX = aScrPos.X();
2497 for (SCCOL nX=nX1; nX<=nLoopEndX; nX++)
2498 {
2499 tools::Long nWidth = rDoc.GetColWidth(nX, nTab);
2500 if (!bInPrintTwips)
2501 nWidth = ScViewData::ToPixel(nWidth, nPPTX);
2502
2503 if ( nWidth > 0 )
2504 {
2505 tools::Long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign;
2506
2507 SCROW nThisY = nY;
2508 const ScPatternAttr* pPattern = rDoc.GetPattern( nX, nY, nTab );
2509 const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2510 if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) )
2511 {
2512 while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 &&
2513 (rDoc.RowHidden(nThisY-1, nTab) || bFirstRow) )
2514 {
2515 --nThisY;
2516 pPattern = rDoc.GetPattern( nX, nThisY, nTab );
2517 pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2518 }
2519 }
2520
2521 // only the rest of the merged is seen ?
2522 SCCOL nThisX = nX;
2523 if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 )
2524 {
2525 while ( pMergeFlag->IsHorOverlapped() )
2526 {
2527 --nThisX;
2528 pPattern = rDoc.GetPattern( nThisX, nThisY, nTab );
2529 pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2530 }
2531 }
2532
2533 if ( aMultiMark.IsCellMarked( nThisX, nThisY, true ) )
2534 {
2535 if ( !pMergeFlag->IsOverlapped() )
2536 {
2537 const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE);
2538 if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0)
2539 {
2540 const SCCOL nEndColMerge = nThisX + pMerge->GetColMerge();
2541 const SCROW nEndRowMerge = nThisY + pMerge->GetRowMerge();
2542 Point aEndPos = bInPrintTwips ?
2543 mrViewData.GetPrintTwipsPos(nEndColMerge, nEndRowMerge) :
2544 mrViewData.GetScrPos(nEndColMerge, nEndRowMerge, eWhich);
2545 if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY )
2546 {
2547 aInvert.AddRect( tools::Rectangle( nScrX,nScrY,
2548 aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) );
2549 }
2550 }
2551 else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY )
2552 {
2553 aInvert.AddRect( tools::Rectangle( nScrX,nScrY,nEndX,nEndY ) );
2554 }
2555 }
2556 }
2557
2558 nScrX = nEndX + nLayoutSign;
2559 }
2560 }
2561 nScrY = nEndY + 1;
2562 }
2563 }
2564}
2565
2567{
2568 Window::DataChanged(rDCEvt);
2569
2570 if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) ||
2571 (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
2572 (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
2573 (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
2574 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2575 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
2576 return;
2577
2578 if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == mrViewData.GetActivePart() )
2580
2581 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2582 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
2583 {
2584 if ( eWhich == mrViewData.GetActivePart() ) // only once for the view
2585 {
2586 ScTabView* pView = mrViewData.GetView();
2587
2588 pView->RecalcPPT();
2589
2590 // RepeatResize in case scroll bar sizes have changed
2591 pView->RepeatResize();
2592 pView->UpdateAllOverlays();
2593
2594 // invalidate cell attribs in input handler, in case the
2595 // EditEngine BackgroundColor has to be changed
2596 if ( mrViewData.IsActive() )
2597 {
2598 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
2599 if (pHdl)
2600 pHdl->ForgetLastPattern();
2601 }
2602 }
2603 }
2604
2605 Invalidate();
2606}
2607
2609{
2610 bInitialPageBreaks = true;
2611}
2612
2613IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
2614{
2615 if (pTimer != &maShowPageBreaksTimer)
2616 return;
2617
2618 const ScViewOptions& rOpts = mrViewData.GetOptions();
2619 const bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
2620 // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page
2621 // breaks is enabled, breaks should be visible. If the document is
2622 // opened the first time or a tab is activated the first time, the
2623 // breaks are not calculated yet, so this initialization is done here.
2624 if (bPage)
2625 {
2626 const SCTAB nCurrentTab = mrViewData.GetTabNo();
2627 ScDocument& rDoc = mrViewData.GetDocument();
2628 const Size aPageSize = rDoc.GetPageSize(nCurrentTab);
2629 // Do not attempt to calculate a page size here if it is empty if
2630 // that involves counting pages.
2631 // An earlier implementation did
2632 // ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
2633 // rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
2634 // which resulted in tremendous waiting times after having loaded
2635 // larger documents i.e. imported from CSV, in which UI is entirely
2636 // blocked. All time is spent under ScPrintFunc::CountPages() in
2637 // ScTable::ExtendPrintArea() in the loop that calls
2638 // MaybeAddExtraColumn() to do stuff for each text string content
2639 // cell (each row in each column). Maybe that can be optimized, or
2640 // obtaining page size without that overhead would be possible, but
2641 // as is calling that from here is a no-no so this is a quick
2642 // disable things.
2643 if (!aPageSize.IsEmpty())
2644 {
2645 ScDocShell* pDocSh = mrViewData.GetDocShell();
2646 const bool bModified = pDocSh->IsModified();
2647 // Even setting the same size sets page size valid, so
2648 // UpdatePageBreaks() actually does something.
2649 rDoc.SetPageSize( nCurrentTab, aPageSize);
2650 rDoc.UpdatePageBreaks(nCurrentTab);
2651 pDocSh->PostPaint(0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab, PaintPartFlags::Grid);
2652 pDocSh->SetModified(bModified);
2653 }
2654 }
2655}
2656
2657
2658/* 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
sal_Int32 GetParagraphCount() const
static rtl::Reference< SfxItemPool > CreatePool()
sal_uInt32 GetLineHeight(sal_Int32 nParagraph)
sal_Int32 GetLineCount(sal_Int32 nParagraph) const
tools::Rectangle GetEditCursor() const
void SetOutputArea(const tools::Rectangle &rRect)
Color const & GetBackgroundColor() const
OutputDevice & GetOutputDevice() const
vcl::Cursor * GetCursor() const
EditEngine * GetEditEngine() 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
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) 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:303
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
Definition: dbdata.cxx:427
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:77
void setDrawPopupButton(bool b)
Definition: dpcontrol.cxx:72
void setPopupLeft(bool b)
Definition: dpcontrol.cxx:87
void setBoundingBox(const Point &rPos, const Size &rSize, bool bLayoutRTL)
Definition: dpcontrol.cxx:56
void setText(const OUString &rText)
Definition: dpcontrol.cxx:51
void setDrawBaseButton(bool b)
Definition: dpcontrol.cxx:67
bool IsAutoSpell() const
Definition: docoptio.hxx:53
void UpdateFontList()
Definition: docsh3.cxx:456
virtual void SetModified(bool=true) override
Definition: docsh.cxx:2968
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:4138
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:438
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4228
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4187
bool ValidRow(SCROW nRow) const
Definition: document.hxx:900
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6348
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5687
void MarkScenario(SCTAB nSrcTab, SCTAB nDestTab, ScMarkData &rDestMark, bool bResetMark=true, ScScenarioFlags nNeededBits=ScScenarioFlags::NONE) const
Definition: documen3.cxx:861
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
Definition: documen3.cxx:328
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6181
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
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:2488
bool HasScenarioRange(SCTAB nTab, const ScRange &rRange) const
Definition: documen3.cxx:873
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4426
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:704
SC_DLLPUBLIC void GetScenarioData(SCTAB nTab, OUString &rComment, Color &rColor, ScScenarioFlags &rFlags) const
Definition: documen3.cxx:474
SC_DLLPUBLIC void ExtendTotalMerge(ScRange &rRange) const
Definition: document.cxx:5737
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4441
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1083
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4496
void ExtendHidden(SCCOL &rX1, SCROW &rY1, SCCOL &rX2, SCROW &rY2, SCTAB nTab)
Definition: document.cxx:4781
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4418
void SetPageSize(SCTAB nTab, const Size &rSize)
Definition: document.cxx:6321
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:899
bool IsInInterpreter() const
Definition: document.hxx:2412
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5597
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4512
bool HasBackgroundDraw(SCTAB nTab, const tools::Rectangle &rMMRect) const
Definition: documen9.cxx:325
SC_DLLPUBLIC void GetAllRowBreaks(std::set< SCROW > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4411
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3548
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2494
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:998
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: documen8.cxx:114
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:217
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4789
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4824
Size GetPageSize(SCTAB nTab) const
Definition: document.cxx:6327
SC_DLLPUBLIC const ScDocOptions & GetDocOptions() const
Definition: documen3.cxx:1952
SC_DLLPUBLIC bool IsActiveScenario(SCTAB nTab) const
Definition: documen3.cxx:886
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:317
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:898
tools::Rectangle aInvertRect
Definition: gridwin.hxx:204
void LogicInvalidate(const tools::Rectangle *pRectangle) override
Definition: gridwin4.cxx:1709
SvtScriptType nPageScript
Definition: gridwin.hxx:186
void Draw(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode)
Definition: gridwin4.cxx:461
ScHSplitPos eHWhich
Definition: gridwin.hxx:154
void initiatePageBreaks()
Definition: gridwin4.cxx:2608
void CheckNeedsRepaint()
Definition: gridwin4.cxx:1813
sal_uInt16 nPaintCount
Definition: gridwin.hxx:198
void GetRectsAnyFor(const ScMarkData &rMarkData, ::std::vector< tools::Rectangle > &rRects, bool bInPrintTwips) const
Definition: gridwin4.cxx:2329
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:252
ScDDComboBoxButton aComboButton
Definition: gridwin.hxx:194
void DoInvertRect(const tools::Rectangle &rPixel)
Definition: gridwin4.cxx:302
void UpdateHeaderOverlay()
Definition: gridwin.cxx:6772
bool bAutoMarkVisible
Definition: gridwin.hxx:218
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
Definition: gridwin4.cxx:1744
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:2225
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: gridwin4.cxx:2566
void DrawRedraw(ScOutputData &rOutputData, SdrLayerID nLayer)
Definition: gridwin3.cxx:209
bool bIsInPaint
Definition: gridwin.hxx:216
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:674
tools::Rectangle aRepaintPixel
Definition: gridwin.hxx:199
std::shared_ptr< sc::SpellCheckContext > mpSpellCheckCxt
Definition: gridwin.hxx:150
ScVSplitPos eVWhich
Definition: gridwin.hxx:155
void SetupInitialPageBreaks(const ScDocument &rDoc, SCTAB nTab)
Definition: gridwin4.cxx:1396
sal_uInt16 nCursorHideCount
Definition: gridwin.hxx:166
void DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo &rTabInfo, OutputDevice *pContentDev, const ScLokRTLContext *pLokRTLContext)
Definition: gridwin4.cxx:2072
void DrawHiddenIndicator(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext &rRenderContext)
Definition: gridwin4.cxx:1834
std::vector< LOKCursorEntry > maLOKLastCursor
Definition: gridwin.hxx:148
bool bListValButton
Definition: gridwin.hxx:219
ScAddress aListValPos
Definition: gridwin.hxx:202
std::unique_ptr< ScNoteMarker, o3tl::default_delete< ScNoteMarker > > mpNoteMarker
Definition: gridwin.hxx:157
void flushOverlayManager()
Definition: gridwin.cxx:6961
bool bNeedsRepaint
Definition: gridwin.hxx:217
bool IsAutoFilterActive(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: gridwin4.cxx:2275
void GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle > &rRects) const
Definition: gridwin4.cxx:2317
ScViewData & mrViewData
Definition: gridwin.hxx:152
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:1528
void DrawPagePreview(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext &rRenderContext)
Definition: gridwin4.cxx:1868
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:2323
ScSplitPos eWhich
Definition: gridwin.hxx:153
ScAddress aAutoMarkPos
Definition: gridwin.hxx:201
virtual void PrePaint(vcl::RenderContext &rRenderContext) override
Definition: gridwin4.cxx:316
bool bInitialPageBreaks
Definition: gridwin.hxx:220
Timer maShowPageBreaksTimer
Definition: gridwin.hxx:208
void GetSelectionRects(::std::vector< tools::Rectangle > &rPixelRects) const
Definition: gridwin4.cxx:2312
bool UpdateVisibleRange()
Definition: gridwin2.cxx:612
VisibleRange maVisibleRange
Definition: gridwin.hxx:137
std::unique_ptr< FmFormView > mpLOKDrawView
LibreOfficeKit needs a persistent FmFormView for tiled rendering, otherwise the invalidations from dr...
Definition: gridwin.hxx:116
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: gridwin4.cxx:385
bool IsInputMode() const
Definition: inputhdl.hxx:186
void ForgetLastPattern()
Definition: inputhdl.cxx:2337
ScRangeFindList * GetRangeFindList()
Definition: inputhdl.hxx:253
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:2242
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
void SetEditCell(SCCOL nCol, SCROW nRow)
Definition: output.cxx:272
void DrawClipMarks()
Definition: output.cxx:2611
SCCOL nX1
Definition: output.hxx:189
void DrawStrings(bool bPixelToLogic=false)
Definition: output2.cxx:1470
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
void DrawSparklines(vcl::RenderContext &rRenderContext)
Definition: output.cxx:2306
void SetShowNullValues(bool bSet)
Definition: output.cxx:252
bool SetChangedClip()
Definition: output.cxx:1772
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:2377
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:4292
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:2005
void SetDrawView(FmFormView *pNew)
Definition: output.hxx:320
void SetPagebreakMode(ScPageBreakData *pPageData)
Definition: output.cxx:587
void SetContentDevice(OutputDevice *pContentDev)
Definition: output.cxx:226
void DrawFormulaMarks(vcl::RenderContext &rRenderContext)
Definition: output.cxx:2457
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
size_t GetPagesX() const
Definition: pagedata.hxx:49
const SCCOL * GetPageEndX() const
Definition: pagedata.hxx:50
const SCROW * GetPageEndY() const
Definition: pagedata.hxx:52
bool IsTopDown() const
Definition: pagedata.hxx:57
size_t GetPagesY() const
Definition: pagedata.hxx:51
bool IsAutomatic() const
Definition: pagedata.hxx:59
const ScRange & GetPrintRange() const
Definition: pagedata.hxx:44
tools::Long GetFirstPage() const
Definition: pagedata.hxx:55
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:674
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:337
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:3056
ScViewData & GetViewData()
Definition: tabview.hxx:341
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:363
ScDrawView * GetScDrawView()
Definition: tabview.hxx:349
void RecalcPPT()
Definition: tabview3.cxx:2799
void UpdateAllOverlays()
Definition: tabview2.cxx:1035
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:763
ScPageBreakData * GetPageBreakData()
Definition: tabview.hxx:336
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:4146
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:4025
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:89
Color const & GetGridColor(OUString *pStrName=nullptr) const
Definition: viewopti.cxx:119
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 SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT 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)
tools::Rectangle & Intersection(const tools::Rectangle &rRect)
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:854
constexpr SdrLayerID SC_LAYER_FRONT(0)
constexpr SdrLayerID SC_LAYER_INTERN(2)
constexpr SdrLayerID SC_LAYER_BACK(1)
ScScenarioFlags
Definition: global.hxx:225
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:2613
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
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
ScRange aRef
Definition: rfindlst.hxx:30
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:49
@ VOPT_NULLVALS
Definition: viewopti.hxx:33
@ VOPT_GRID_ONTOP
Definition: viewopti.hxx:43
@ VOPT_FORMULAS_MARKS
Definition: viewopti.hxx:36
@ VOPT_GRID
Definition: viewopti.hxx:42
@ VOPT_FORMULAS
Definition: viewopti.hxx:32
@ VOPT_NOTES
Definition: viewopti.hxx:35
@ VOPT_PAGEBREAKS
Definition: viewopti.hxx:46
ScUpdateMode
Definition: viewutil.hxx:39
oslFileHandle & pOut