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 ( !bLogicText )
931 aOutputData.DrawStrings(); // in pixel MapMode
932
933 // edit cells and printer-metrics text must be before the buttons
934 // (DataPilot buttons contain labels in UI font)
935
937 if ( bLogicText )
938 aOutputData.DrawStrings(true); // in logic MapMode if bLogicText is set
939 aOutputData.DrawEdit(true);
940
941 // the buttons are painted in absolute coordinates
942 if (bIsTiledRendering)
943 {
944 // Tiled offset nScrX, nScrY
945 MapMode aMap( MapUnit::MapPixel );
946 Point aOrigin = aOriginalMode.GetOrigin();
947 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px) + nScrX);
948 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px) + nScrY);
949 aMap.SetOrigin(aOrigin);
950 pContentDev->SetMapMode(aMap);
951 }
952 else
953 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
954
955 // Autofilter- and Pivot-Buttons
956 DrawButtons(nX1, nX2, rTableInfo, pContentDev, pLokRTLCtxt.get()); // Pixel
957
958 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
959
960 aOutputData.DrawClipMarks();
961
962 // In any case, Scenario / ChangeTracking must happen after DrawGrid, also for !bGridFirst
963
966
967 SCTAB nTabCount = rDoc.GetTableCount();
968 const std::vector<ScHighlightEntry> &rHigh = mrViewData.GetView()->GetHighlightRanges();
969 bool bHasScenario = ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) );
970 bool bHasChange = ( rDoc.GetChangeTrack() != nullptr );
971
972 if ( bHasChange || bHasScenario || !rHigh.empty() )
973 {
975
976 if ( bHasChange )
977 aOutputData.DrawChangeTrack();
978
979 if ( bHasScenario )
980 lcl_DrawScenarioFrames( pContentDev, mrViewData, eWhich, nX1,nY1,nX2,nY2 );
981
982 lcl_DrawHighlight( aOutputData, mrViewData, rHigh );
983 }
984
985 // Drawing foreground
986
987 pContentDev->SetMapMode(aDrawMode);
988
989 // Bitmaps and buttons are in absolute pixel coordinates.
990 const MapMode aOrig = pContentDev->GetMapMode();
991 if (bIsTiledRendering)
992 {
993 Point aOrigin = aOriginalMode.GetOrigin();
994 tools::Long nXOffset = bLayoutRTL ?
995 (-o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px) + aOutputData.GetScrW()) :
997 Size aPixelOffset(nXOffset, o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px));
998 pContentDev->SetPixelOffset(aPixelOffset);
1000 }
1001
1002 DrawRedraw( aOutputData, SC_LAYER_FRONT );
1003 DrawRedraw( aOutputData, SC_LAYER_INTERN );
1004 DrawSdrGrid( aDrawingRectLogic, pContentDev );
1005
1006 if (bIsTiledRendering)
1007 {
1008 pContentDev->SetPixelOffset(Size());
1009 pContentDev->SetMapMode(aOrig);
1010 }
1011
1012 pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
1013
1014 if ( mrViewData.IsRefMode() && nTab >= mrViewData.GetRefStartZ() && nTab <= mrViewData.GetRefEndZ() )
1015 {
1016 Color aRefColor( rColorCfg.GetColorValue(svtools::CALCREFERENCE).nColor );
1019 aRefColor, false );
1020 }
1021
1022 // range finder
1023
1025 if (pHdl)
1026 {
1027 ScDocShell* pDocSh = mrViewData.GetDocShell();
1028 ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList();
1029 if ( pRangeFinder && !pRangeFinder->IsHidden() &&
1030 pRangeFinder->GetDocName() == pDocSh->GetTitle() )
1031 {
1032 sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count());
1033 for (sal_uInt16 i=0; i<nCount; i++)
1034 {
1035 ScRangeFindData& rData = pRangeFinder->GetObject(i);
1036
1037 ScRange aRef = rData.aRef;
1038 aRef.PutInOrder();
1039 if ( aRef.aStart.Tab() >= nTab && aRef.aEnd.Tab() <= nTab )
1040 aOutputData.DrawRefMark( aRef.aStart.Col(), aRef.aStart.Row(),
1041 aRef.aEnd.Col(), aRef.aEnd.Row(),
1042 rData.nColor,
1043 true );
1044 }
1045 }
1046 }
1047
1048 {
1049 // end redraw
1050 ScTabViewShell* pTabViewShell = mrViewData.GetViewShell();
1051
1052 if(pTabViewShell)
1053 {
1054 MapMode aCurrentMapMode(pContentDev->GetMapMode());
1055 pContentDev->SetMapMode(aDrawMode);
1056
1057 if (bIsTiledRendering)
1058 {
1059 Point aOrigin = aOriginalMode.GetOrigin();
1060 if (bLayoutRTL)
1061 aOrigin.setX(-o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1062 + aOutputData.nScrX + aOutputData.GetScrW());
1063 else
1064 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1065 + aOutputData.nScrX);
1066
1067 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1068 + aOutputData.nScrY);
1069 const double twipFactor = 15 * 1.76388889; // 26.45833335
1070 aOrigin = Point(aOrigin.getX() * twipFactor,
1071 aOrigin.getY() * twipFactor);
1072 MapMode aNew = rDevice.GetMapMode();
1073 aNew.SetOrigin(aOrigin);
1074 rDevice.SetMapMode(aNew);
1075 }
1076
1077 SdrView* pDrawView = pTabViewShell->GetScDrawView();
1078
1079 if(pDrawView)
1080 {
1081 // #i74769# work with SdrPaintWindow directly
1082 pDrawView->EndDrawLayers(*pTargetPaintWindow, true);
1083 }
1084
1085 pContentDev->SetMapMode(aCurrentMapMode);
1086 }
1087 }
1088
1089 // paint in-place editing
1090 if (bIsTiledRendering)
1091 {
1092 ScTabViewShell* pThisViewShell = mrViewData.GetViewShell();
1093 SfxViewShell* pViewShell = SfxViewShell::GetFirst();
1094
1095 while (pViewShell)
1096 {
1097 bool bEnterLoop = bIsTiledRendering || pViewShell != pThisViewShell;
1098 if (bEnterLoop && pViewShell->GetDocId() == pThisViewShell->GetDocId())
1099 {
1100 ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
1101 if (pTabViewShell)
1102 {
1103 ScViewData& rOtherViewData = pTabViewShell->GetViewData();
1104 ScSplitPos eOtherWhich = rOtherViewData.GetEditActivePart();
1105
1106 bool bOtherEditMode = rOtherViewData.HasEditView(eOtherWhich);
1107 SCCOL nCol1 = rOtherViewData.GetEditStartCol();
1108 SCROW nRow1 = rOtherViewData.GetEditStartRow();
1109 SCCOL nCol2 = rOtherViewData.GetEditEndCol();
1110 SCROW nRow2 = rOtherViewData.GetEditEndRow();
1111 bOtherEditMode = bOtherEditMode
1112 && ( nCol2 >= nX1 && nCol1 <= nX2 && nRow2 >= nY1 && nRow1 <= nY2 );
1113 if (bOtherEditMode && rOtherViewData.GetRefTabNo() == nTab)
1114 {
1115 EditView* pOtherEditView = rOtherViewData.GetEditView(eOtherWhich);
1116 if (pOtherEditView)
1117 {
1118 tools::Long nScreenX = aOutputData.nScrX;
1119 tools::Long nScreenY = aOutputData.nScrY;
1120
1121 rDevice.SetLineColor();
1122 rDevice.SetFillColor(pOtherEditView->GetBackgroundColor());
1123 Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eOtherWhich );
1124 Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich );
1125
1126 if (bIsTiledRendering)
1127 {
1128 EditEngine* pEditEngine = pOtherEditView->GetEditEngine();
1129 if (pEditEngine)
1130 aEnd.AdjustY(lcl_GetMultiLineHeight(pEditEngine));
1131 }
1132
1133 if (bLokRTL)
1134 {
1135 // Transform the cell range X coordinates such that the edit cell area is
1136 // horizontally mirrored w.r.t the (combined-)tile.
1137 aStart.setX(pLokRTLCtxt->docToTilePos(aStart.X()));
1138 aEnd.setX(pLokRTLCtxt->docToTilePos(aEnd.X()));
1139 }
1140
1141 // don't overwrite grid
1142 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1143 aEnd.AdjustX( -(2 * nLayoutSign) );
1144 aEnd.AdjustY( -2 );
1145
1146 tools::Rectangle aBackground(aStart, aEnd);
1147 if (bLokRTL)
1148 aBackground.Normalize();
1149
1150 // Need to draw the background in absolute coords.
1151 Point aOrigin = aOriginalMode.GetOrigin();
1152 aOrigin.setX(
1154 + nScreenX);
1155 aOrigin.setY(
1157 + nScreenY);
1158 aBackground += aOrigin;
1159 rDevice.SetMapMode(aDrawMode);
1160
1161 static const double twipFactor = 15 * 1.76388889; // 26.45833335
1162 // keep into account the zoom factor
1163 aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1164 (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1165
1166 MapMode aNew = rDevice.GetMapMode();
1167 aNew.SetOrigin(aOrigin);
1168 rDevice.SetMapMode(aNew);
1169
1170 // paint the background
1171 rDevice.DrawRect(rDevice.PixelToLogic(aBackground));
1172 tools::Rectangle aBGAbs(aBackground);
1173
1174 tools::Rectangle aEditRect(aBackground);
1175 tools::Long nOffsetX = 0, nOffsetY = 0;
1176 // Get top-left offset because of margin and indent.
1177 lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, nTab), mrViewData, rDoc);
1178 aEditRect.AdjustLeft(nOffsetX + 1);
1179 aEditRect.AdjustTop(nOffsetY + 1);
1180
1181 // EditView has an 'output area' which is used to clip the 'paint area' we provide below.
1182 // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1183 // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1184 // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1185 OutputDevice& rOtherWin = pOtherEditView->GetOutputDevice();
1186 const tools::Rectangle aOrigOutputArea(pOtherEditView->GetOutputArea()); // Not in pixels.
1187 const MapMode aOrigMapMode = rOtherWin.GetMapMode();
1188 rOtherWin.SetMapMode(rDevice.GetMapMode());
1189
1190 // Avoid sending wrong cursor/selection messages by the 'other' view, as the output-area is going
1191 // to be tweaked temporarily to match the current view's zoom.
1192 SuppressEditViewMessagesGuard aGuard(*pOtherEditView);
1193
1194 aEditRect = rDevice.PixelToLogic(aEditRect);
1195 if (bIsTiledRendering)
1196 pOtherEditView->SetOutputArea(aEditRect);
1197 else
1198 aEditRect.Intersection(pOtherEditView->GetOutputArea());
1199 pOtherEditView->Paint(aEditRect, &rDevice);
1200
1201 // EditView will do the cursor notifications correctly if we're in
1202 // print-twips messaging mode.
1203 if (bIsTiledRendering && !comphelper::LibreOfficeKit::isCompatFlagSet(
1204 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1205 {
1206 // Now we need to get relative cursor position within the editview.
1207 // This is for sending the pixel-aligned twips position of the cursor to the specific views with
1208 // the same given zoom level.
1209 tools::Rectangle aCursorRect = pOtherEditView->GetEditCursor();
1210 Point aCursPos = OutputDevice::LogicToLogic(aCursorRect.TopLeft(),
1211 MapMode(MapUnit::Map100thMM), MapMode(MapUnit::MapTwip));
1212
1213 const MapMode& rDevMM = rDevice.GetMapMode();
1214 MapMode aMM(MapUnit::MapTwip);
1215 aMM.SetScaleX(rDevMM.GetScaleX());
1216 aMM.SetScaleY(rDevMM.GetScaleY());
1217
1218 aBGAbs.AdjustLeft(1);
1219 aBGAbs.AdjustTop(1);
1220 aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
1221 aCursorRect.setWidth(0);
1222 aCursorRect.Move(aCursPos.getX(), 0);
1223 // Sends view cursor position to views of all matching zooms if needed (avoids duplicates).
1224 InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), aMM.GetScaleY());
1225 }
1226
1227 // Rollback the mapmode and 'output area'.
1228 rOtherWin.SetMapMode(aOrigMapMode);
1229 if (!bIsTiledRendering)
1230 pOtherEditView->SetOutputArea(aOrigOutputArea);
1231 rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1232 }
1233 }
1234 }
1235 }
1236
1237 pViewShell = SfxViewShell::GetNext(*pViewShell);
1238 }
1239
1240 }
1241
1242 // In-place editing - when the user is typing, we need to paint the text
1243 // using the editeng.
1244 // It's being done after EndDrawLayers() to get it outside the overlay
1245 // buffer and on top of everything.
1246 if (bInPlaceEditing)
1247 {
1248 // get the coordinates of the area we need to clear (overpaint by
1249 // the background)
1252 SCCOL nCol2 = mrViewData.GetEditEndCol();
1253 SCROW nRow2 = mrViewData.GetEditEndRow();
1254 rDevice.SetLineColor();
1255 rDevice.SetFillColor(pEditView->GetBackgroundColor());
1256 Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich );
1257 Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich );
1258
1259 if (bLokRTL)
1260 {
1261 // Transform the cell range X coordinates such that the edit cell area is
1262 // horizontally mirrored w.r.t the (combined-)tile.
1263 aStart.setX(pLokRTLCtxt->docToTilePos(aStart.X()));
1264 aEnd.setX(pLokRTLCtxt->docToTilePos(aEnd.X()));
1265 }
1266
1267 // don't overwrite grid
1268 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
1269 aEnd.AdjustX( -(2 * nLayoutSign) );
1270 aEnd.AdjustY( -2 );
1271
1272 // set the correct mapmode
1273 tools::Rectangle aBackground(aStart, aEnd);
1274 if (bLokRTL)
1275 aBackground.Normalize();
1276 tools::Rectangle aBGAbs(aBackground);
1277
1278 if (bIsTiledRendering)
1279 {
1280 // Need to draw the background in absolute coords.
1281 Point aOrigin = aOriginalMode.GetOrigin();
1282 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1283 + nScrX);
1284 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1285 + nScrY);
1286 aBackground += aOrigin;
1287 rDevice.SetMapMode(aDrawMode);
1288 }
1289 else
1291
1292 if (bIsTiledRendering)
1293 {
1294 Point aOrigin = aOriginalMode.GetOrigin();
1295 aOrigin.setX(o3tl::convert(aOrigin.getX(), o3tl::Length::twip, o3tl::Length::px)
1296 + nScrX);
1297 aOrigin.setY(o3tl::convert(aOrigin.getY(), o3tl::Length::twip, o3tl::Length::px)
1298 + nScrY);
1299 static const double twipFactor = 15 * 1.76388889; // 26.45833335
1300 // keep into account the zoom factor
1301 aOrigin = Point((aOrigin.getX() * twipFactor) / static_cast<double>(aDrawMode.GetScaleX()),
1302 (aOrigin.getY() * twipFactor) / static_cast<double>(aDrawMode.GetScaleY()));
1303 MapMode aNew = rDevice.GetMapMode();
1304 aNew.SetOrigin(aOrigin);
1305 rDevice.SetMapMode(aNew);
1306 }
1307
1308 // paint the editeng text
1309 if (bIsTiledRendering)
1310 {
1311 tools::Rectangle aEditRect(aBackground);
1312 tools::Long nOffsetX = 0, nOffsetY = 0;
1313 // Get top-left offset because of margin and indent.
1314 lcl_GetEditAreaTLOffset(nOffsetX, nOffsetY, ScAddress(nCol1, nRow1, mrViewData.GetTabNo()), mrViewData, rDoc);
1315 aEditRect.AdjustLeft(nOffsetX + 1);
1316 aEditRect.AdjustTop(nOffsetY + 1);
1317
1318 // EditView has an 'output area' which is used to clip the paint area we provide below.
1319 // So they need to be in the same coordinates/units. This is tied to the mapmode of the gridwin
1320 // attached to the EditView, so we have to change its mapmode too (temporarily). We save the
1321 // original mapmode and 'output area' and roll them back when we finish painting to rDevice.
1322 const MapMode aOrigMapMode = GetMapMode();
1323 SetMapMode(rDevice.GetMapMode());
1324
1325 // Avoid sending wrong cursor/selection messages by the current view, as the output-area is going
1326 // to be tweaked temporarily to match other view's zoom. (This does not affect the manual
1327 // cursor-messaging done in the non print-twips mode)
1328 SuppressEditViewMessagesGuard aGuard(*pEditView);
1329
1330 // EditView will do the cursor notifications correctly if we're in
1331 // print-twips messaging mode.
1333 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs))
1334 {
1335 // Now we need to get relative cursor position within the editview.
1336 // This is for sending the pixel-aligned twips position of the cursor to the specific views with
1337 // the same given zoom level.
1338 tools::Rectangle aCursorRect = pEditView->GetEditCursor();
1339 Point aCursPos = o3tl::toTwips(aCursorRect.TopLeft(), o3tl::Length::mm100);
1340
1341 const MapMode& rDevMM = rDevice.GetMapMode();
1342 MapMode aMM(MapUnit::MapTwip);
1343 aMM.SetScaleX(rDevMM.GetScaleX());
1344 aMM.SetScaleY(rDevMM.GetScaleY());
1345
1346 aBGAbs.AdjustLeft(1);
1347 aBGAbs.AdjustTop(1);
1348 aCursorRect = GetOutDev()->PixelToLogic(aBGAbs, aMM);
1349 aCursorRect.setWidth(0);
1350 aCursorRect.Move(aCursPos.getX(), 0);
1351 // Sends view cursor position to views of all matching zooms if needed (avoids duplicates).
1352 InvalidateLOKViewCursor(aCursorRect, aMM.GetScaleX(), aMM.GetScaleY());
1353 }
1354
1355 // Rollback the mapmode and 'output area'.
1356 SetMapMode(aOrigMapMode);
1357 }
1358 else
1359 {
1360 // paint the background
1361 tools::Rectangle aLogicRect(rDevice.PixelToLogic(aBackground));
1362 //tdf#100925, rhbz#1283420, Draw some text here, to get
1363 //X11CairoTextRender::getCairoContext called, so that the forced read
1364 //from the underlying X Drawable gets it to sync.
1365 rDevice.DrawText(aLogicRect.BottomLeft(), " ");
1366 rDevice.DrawRect(aLogicRect);
1367
1368 tools::Rectangle aEditRect(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()));
1369 pEditView->Paint(rDevice.PixelToLogic(aEditRect), &rDevice);
1370 }
1371
1372 rDevice.SetMapMode(MapMode(MapUnit::MapPixel));
1373
1374 // restore the cursor it was originally visible
1375 if (bInPlaceVisCursor)
1376 pInPlaceCrsr->Show();
1377 }
1378
1380 {
1381 // flush OverlayManager before changing the MapMode
1383
1384 // set MapMode for text edit
1386 }
1387 else
1388 rDevice.SetMapMode(aDrawMode);
1389
1390 if (mpNoteMarker)
1391 mpNoteMarker->Draw(); // Above the cursor, in drawing map mode
1392
1393 if (bPage && bInitialPageBreaks)
1394 SetupInitialPageBreaks(rDoc, nTab);
1395}
1396
1397
1399{
1400 // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page breaks
1401 // is enabled, breaks should be visible. If the document is opened the first
1402 // time, the breaks are not calculated yet, so for this initialization
1403 // a timer will be triggered here.
1404 std::set<SCCOL> aColBreaks;
1405 std::set<SCROW> aRowBreaks;
1406 rDoc.GetAllColBreaks(aColBreaks, nTab, true, false);
1407 rDoc.GetAllRowBreaks(aRowBreaks, nTab, true, false);
1408 if (aColBreaks.size() == 0 || aRowBreaks.size() == 0)
1409 {
1410 maShowPageBreaksTimer.SetPriority(TaskPriority::DEFAULT_IDLE);
1412 }
1413 bInitialPageBreaks = false;
1414}
1415
1416namespace
1417{
1418 template<typename IndexType>
1419 void lcl_getBoundingRowColumnforTile(ScViewData& rViewData,
1420 tools::Long nTileStartPosPx, tools::Long nTileEndPosPx,
1421 sal_Int32& nTopLeftTileOffset, sal_Int32& nTopLeftTileOrigin,
1422 sal_Int32& nTopLeftTileIndex, sal_Int32& nBottomRightTileIndex)
1423 {
1424 const bool bColumnHeader = std::is_same<IndexType, SCCOL>::value;
1425
1426 SCTAB nTab = rViewData.GetTabNo();
1427
1428 IndexType nStartIndex = -1;
1429 IndexType nEndIndex = -1;
1430 tools::Long nStartPosPx = 0;
1431 tools::Long nEndPosPx = 0;
1432
1433 ScPositionHelper& rPositionHelper =
1434 bColumnHeader ? rViewData.GetLOKWidthHelper() : rViewData.GetLOKHeightHelper();
1435 const auto& rStartNearest = rPositionHelper.getNearestByPosition(nTileStartPosPx);
1436 const auto& rEndNearest = rPositionHelper.getNearestByPosition(nTileEndPosPx);
1437
1438 ScBoundsProvider aBoundsProvider(rViewData, nTab, bColumnHeader);
1439 aBoundsProvider.Compute(rStartNearest, rEndNearest, nTileStartPosPx, nTileEndPosPx);
1440 aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex;
1441 aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx);
1442
1443 nTopLeftTileOffset = nTileStartPosPx - nStartPosPx;
1444 nTopLeftTileOrigin = nStartPosPx;
1445 nTopLeftTileIndex = nStartIndex;
1446 nBottomRightTileIndex = nEndIndex;
1447 }
1448
1449 void lcl_RTLAdjustTileColOffset(ScViewData& rViewData, sal_Int32& nTileColOffset,
1450 tools::Long nTileEndPx, sal_Int32 nEndCol, SCTAB nTab,
1451 const ScDocument& rDoc, double fPPTX)
1452 {
1453 auto GetColWidthPx = [&rDoc, nTab, fPPTX](SCCOL nCol) {
1454 const sal_uInt16 nSize = rDoc.GetColWidth(nCol, nTab);
1455 const tools::Long nSizePx = ScViewData::ToPixel(nSize, fPPTX);
1456 return nSizePx;
1457 };
1458
1459 ScPositionHelper rHelper = rViewData.GetLOKWidthHelper();
1460 tools::Long nEndColPos = rHelper.computePosition(nEndCol, GetColWidthPx);
1461
1462 nTileColOffset += (nEndColPos - nTileEndPx - nTileColOffset);
1463 }
1464
1465 class ScLOKProxyObjectContact final : public sdr::contact::ObjectContactOfPageView
1466 {
1467 private:
1468 ScDrawView* mpScDrawView;
1469
1470 public:
1471 explicit ScLOKProxyObjectContact(
1472 ScDrawView* pDrawView,
1473 SdrPageWindow& rPageWindow,
1474 const char* pDebugName) :
1475 ObjectContactOfPageView(rPageWindow, pDebugName),
1476 mpScDrawView(pDrawView)
1477 {
1478 }
1479
1480 virtual bool supportsGridOffsets() const override { return true; }
1481
1483 basegfx::B2DVector& rTarget,
1484 const sdr::contact::ViewObjectContact& rClient) const override
1485 {
1486 if (!mpScDrawView)
1487 return;
1488
1489 SdrPageView* pPageView(mpScDrawView->GetSdrPageView());
1490 if (!pPageView)
1491 return;
1492
1493 SdrPageWindow* pSdrPageWindow = nullptr;
1494 if (pPageView->PageWindowCount() > 0)
1495 pSdrPageWindow = pPageView->GetPageWindow(0);
1496 if (!pSdrPageWindow)
1497 return;
1498
1499 sdr::contact::ObjectContact& rObjContact(pSdrPageWindow->GetObjectContact());
1500
1501 SdrObject* pTargetSdrObject(rClient.GetViewContact().TryToGetSdrObject());
1502 if (pTargetSdrObject)
1503 rTarget = pTargetSdrObject->GetViewContact().GetViewObjectContact(rObjContact).getGridOffset();
1504 }
1505 };
1506
1507 class ScLOKDrawView : public FmFormView
1508 {
1509 public:
1510 ScLOKDrawView(OutputDevice* pOut, ScViewData& rData) :
1511 FmFormView(*rData.GetDocument().GetDrawLayer(), pOut),
1512 mpScDrawView(rData.GetScDrawView())
1513 {
1514 }
1515
1517 SdrPageWindow& rPageWindow, const char* pDebugName) const override
1518 {
1519 if (!mpScDrawView)
1520 return SdrView::createViewSpecificObjectContact(rPageWindow, pDebugName);
1521
1522 return new ScLOKProxyObjectContact(mpScDrawView, rPageWindow, pDebugName);
1523 }
1524
1525 private:
1526 ScDrawView* mpScDrawView;
1527 };
1528} // anonymous namespace
1529
1531 int nOutputWidth, int nOutputHeight,
1532 int nTilePosX, int nTilePosY,
1533 tools::Long nTileWidth, tools::Long nTileHeight )
1534{
1535 Fraction origZoomX = mrViewData.GetZoomX();
1536 Fraction origZoomY = mrViewData.GetZoomY();
1537
1538 // Output size is in pixels while tile position and size are in logical units (twips).
1539
1540 // Assumption: always paint the whole sheet i.e. "visible" range is always
1541 // from (0,0) to last data position.
1542
1543 // Tile geometry is independent of the zoom level, but the output size is
1544 // dependent of the zoom level. Determine the correct zoom level before
1545 // we start.
1546
1547 // FIXME the painting works using a mixture of drawing with coordinates in
1548 // pixels and in logic coordinates; it should be cleaned up to use logic
1549 // coords only, and avoid all the SetMapMode()'s.
1550 // Similarly to Writer, we should set the mapmode once on the rDevice, and
1551 // not care about any zoom settings.
1552
1553 Fraction aFracX(o3tl::convert(nOutputWidth, o3tl::Length::px, o3tl::Length::twip), nTileWidth);
1554 Fraction aFracY(o3tl::convert(nOutputHeight, o3tl::Length::px, o3tl::Length::twip), nTileHeight);
1555
1556 const bool bChangeZoom = (aFracX != origZoomX || aFracY != origZoomY);
1557
1558 // page break zoom, and aLogicMode in ScViewData
1559 // FIXME: there are issues when SetZoom is called conditionally.
1560 mrViewData.SetZoom(aFracX, aFracY, true);
1561 if (bChangeZoom)
1562 {
1563 if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1564 pDrawView->resetGridOffsetsForAllSdrPageViews();
1565 }
1566
1567 const double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth;
1568 const double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight;
1569 const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight;
1570 const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth;
1571
1572 SCTAB nTab = mrViewData.GetTabNo();
1574
1575 const double fPPTX = mrViewData.GetPPTX();
1576 const double fPPTY = mrViewData.GetPPTY();
1577
1578 // find approximate col/row offsets of nearby.
1579 sal_Int32 nTopLeftTileRowOffset = 0;
1580 sal_Int32 nTopLeftTileColOffset = 0;
1581 sal_Int32 nTopLeftTileRowOrigin = 0;
1582 sal_Int32 nTopLeftTileColOrigin = 0;
1583
1584 sal_Int32 nTopLeftTileRow = 0;
1585 sal_Int32 nTopLeftTileCol = 0;
1586 sal_Int32 nBottomRightTileRow = 0;
1587 sal_Int32 nBottomRightTileCol = 0;
1588
1589 lcl_getBoundingRowColumnforTile<SCROW>(mrViewData,
1590 fTilePosYPixel, fTileBottomPixel,
1591 nTopLeftTileRowOffset, nTopLeftTileRowOrigin,
1592 nTopLeftTileRow, nBottomRightTileRow);
1593
1594 lcl_getBoundingRowColumnforTile<SCCOL>(mrViewData,
1595 fTilePosXPixel, fTileRightPixel,
1596 nTopLeftTileColOffset, nTopLeftTileColOrigin,
1597 nTopLeftTileCol, nBottomRightTileCol);
1598
1599 // Enlarge
1600 nBottomRightTileCol++;
1601 nBottomRightTileRow++;
1602
1603 if (nBottomRightTileCol > rDoc.MaxCol())
1604 nBottomRightTileCol = rDoc.MaxCol();
1605
1606 if (nBottomRightTileRow > MAXTILEDROW)
1607 nBottomRightTileRow = MAXTILEDROW;
1608
1609 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
1610
1611 if (bLayoutRTL)
1612 {
1613 lcl_RTLAdjustTileColOffset(mrViewData, nTopLeftTileColOffset,
1614 fTileRightPixel, nBottomRightTileCol, nTab,
1615 rDoc, fPPTX);
1616 }
1617
1618 // size of the document including drawings, charts, etc.
1619 SCCOL nEndCol = 0;
1620 SCROW nEndRow = 0;
1621 rDoc.GetTiledRenderingArea(nTab, nEndCol, nEndRow);
1622
1623 if (nEndCol < nBottomRightTileCol)
1624 nEndCol = nBottomRightTileCol;
1625
1626 if (nEndRow < nBottomRightTileRow)
1627 nEndRow = nBottomRightTileRow;
1628
1629 nTopLeftTileCol = std::max<sal_Int32>(nTopLeftTileCol, 0);
1630 nTopLeftTileRow = std::max<sal_Int32>(nTopLeftTileRow, 0);
1631 nTopLeftTileColOrigin = o3tl::convert(nTopLeftTileColOrigin, o3tl::Length::px, o3tl::Length::twip);
1632 nTopLeftTileRowOrigin = o3tl::convert(nTopLeftTileRowOrigin, o3tl::Length::px, o3tl::Length::twip);
1633
1634 // Checkout -> 'rDoc.ExtendMerge' ... if we miss merged cells.
1635
1636 // Origin must be the offset of the first col and row
1637 // containing our top-left pixel.
1638 const MapMode aOriginalMode = rDevice.GetMapMode();
1639 MapMode aAbsMode = aOriginalMode;
1640 const Point aOrigin(-nTopLeftTileColOrigin, -nTopLeftTileRowOrigin);
1641 aAbsMode.SetOrigin(aOrigin);
1642 rDevice.SetMapMode(aAbsMode);
1643
1644 ScTableInfo aTabInfo(nEndRow + 3);
1645 rDoc.FillInfo(aTabInfo, nTopLeftTileCol, nTopLeftTileRow,
1646 nBottomRightTileCol, nBottomRightTileRow,
1647 nTab, fPPTX, fPPTY, false, false);
1648
1649// FIXME: is this called some
1650// Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich );
1651
1652 ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab,
1653 -nTopLeftTileColOffset,
1654 -nTopLeftTileRowOffset,
1655 nTopLeftTileCol, nTopLeftTileRow,
1656 nBottomRightTileCol, nBottomRightTileRow,
1657 fPPTX, fPPTY, nullptr, nullptr);
1658
1659 // setup the SdrPage so that drawinglayer works correctly
1660 ScDrawLayer* pModel = rDoc.GetDrawLayer();
1661 if (pModel)
1662 {
1663 bool bPrintTwipsMsgs = comphelper::LibreOfficeKit::isCompatFlagSet(
1664 comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
1665 mpLOKDrawView.reset(bPrintTwipsMsgs ?
1666 new ScLOKDrawView(
1667 &rDevice,
1668 mrViewData) :
1669 new FmFormView(
1670 *pModel,
1671 &rDevice));
1672
1673 mpLOKDrawView->SetNegativeX(bLayoutRTL);
1674 mpLOKDrawView->ShowSdrPage(mpLOKDrawView->GetModel()->GetPage(nTab));
1675 aOutputData.SetDrawView(mpLOKDrawView.get());
1676 aOutputData.SetSpellCheckContext(mpSpellCheckCxt.get());
1677 }
1678
1679 // draw the content
1680 DrawContent(rDevice, aTabInfo, aOutputData, true);
1681 rDevice.SetMapMode(aOriginalMode);
1682
1683 // Paint the chart(s) in edit mode.
1684 LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
1685 nTilePosX, nTilePosY, nTileWidth, nTileHeight, bLayoutRTL);
1686
1687 rDevice.SetMapMode(aOriginalMode);
1688
1689 // Flag drawn formula cells "unchanged".
1690 rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab));
1691 rDoc.PrepareFormulaCalc();
1692
1693 mrViewData.SetZoom(origZoomX, origZoomY, true);
1694 if (bChangeZoom)
1695 {
1696 if (ScDrawView* pDrawView = mrViewData.GetScDrawView())
1697 pDrawView->resetGridOffsetsForAllSdrPageViews();
1698 }
1699
1700 if (bLayoutRTL)
1701 {
1702 Bitmap aCellBMP = rDevice.GetBitmap(Point(0, 0), Size(nOutputWidth, nOutputHeight));
1703 aCellBMP.Mirror(BmpMirrorFlags::Horizontal);
1704 rDevice.DrawBitmap(Point(0, 0), Size(nOutputWidth, nOutputHeight), aCellBMP);
1705 }
1706}
1707
1709{
1710 tools::Rectangle aRectangle;
1711 tools::Rectangle* pResultRectangle;
1712 if (!pRectangle)
1713 pResultRectangle = nullptr;
1714 else
1715 {
1716 aRectangle = *pRectangle;
1717 // When dragging shapes the map mode is disabled.
1718 if (IsMapModeEnabled())
1719 {
1720 if (GetMapMode().GetMapUnit() == MapUnit::Map100thMM)
1721 {
1722 aRectangle = o3tl::convert(aRectangle, o3tl::Length::mm100, o3tl::Length::twip);
1723 }
1724 }
1725 else
1726 aRectangle = PixelToLogic(aRectangle, MapMode(MapUnit::MapTwip));
1727 pResultRectangle = &aRectangle;
1728 }
1729
1730 // Trim invalidation rectangle overlapping negative X region in RTL mode.
1731 if (pResultRectangle && pResultRectangle->Left() < 0
1733 {
1734 pResultRectangle->SetLeft(0);
1735 if (pResultRectangle->Right() < 0)
1736 pResultRectangle->SetRight(0);
1737 }
1738
1739 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1740 SfxLokHelper::notifyInvalidation(pViewShell, pResultRectangle);
1741}
1742
1743void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
1744{
1745 ScTabView* pTabView = mrViewData.GetView();
1746 ScTabViewShell* pViewShell = mrViewData.GetViewShell();
1747 ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell);
1748
1749 if (pInputHandler && pInputHandler->IsInputMode())
1750 {
1751 // we need to switch off the editeng
1753 pViewShell->UpdateInputHandler();
1754 }
1755
1756 if (nType == LOK_SETTEXTSELECTION_RESET)
1757 {
1758 pTabView->DoneBlockMode();
1759 return;
1760 }
1761
1762 // obtain the current selection
1764
1765 SCCOL nCol1, nCol2;
1766 SCROW nRow1, nRow2;
1767 SCTAB nTab1, nTab2;
1768
1769 bool bWasEmpty = false;
1770 if (aRangeList.empty())
1771 {
1772 nCol1 = nCol2 = mrViewData.GetCurX();
1773 nRow1 = nRow2 = mrViewData.GetCurY();
1774 bWasEmpty = true;
1775 }
1776 else
1777 aRangeList.Combine().GetVars(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2);
1778
1779 // convert the coordinates to column/row
1780 SCCOL nNewPosX;
1781 SCROW nNewPosY;
1782 SCTAB nTab = mrViewData.GetTabNo();
1783 mrViewData.GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY);
1784
1785 // change the selection
1786 switch (nType)
1787 {
1788 case LOK_SETTEXTSELECTION_START:
1789 if (nNewPosX != nCol1 || nNewPosY != nRow1 || bWasEmpty)
1790 {
1791 pTabView->SetCursor(nNewPosX, nNewPosY);
1792 pTabView->DoneBlockMode();
1793 pTabView->InitBlockMode(nNewPosX, nNewPosY, nTab, true);
1794 pTabView->MarkCursor(nCol2, nRow2, nTab);
1795 }
1796 break;
1797 case LOK_SETTEXTSELECTION_END:
1798 if (nNewPosX != nCol2 || nNewPosY != nRow2 || bWasEmpty)
1799 {
1800 pTabView->SetCursor(nCol1, nRow1);
1801 pTabView->DoneBlockMode();
1802 pTabView->InitBlockMode(nCol1, nRow1, nTab, true);
1803 pTabView->MarkCursor(nNewPosX, nNewPosY, nTab);
1804 }
1805 break;
1806 default:
1807 assert(false);
1808 break;
1809 }
1810}
1811
1813{
1814 // called at the end of painting, and from timer after background text width calculation
1815
1816 if (!bNeedsRepaint)
1817 return;
1818
1819 bNeedsRepaint = false;
1820 if (aRepaintPixel.IsEmpty())
1821 Invalidate();
1822 else
1825
1826 // selection function in status bar might also be invalid
1827 SfxBindings& rBindings = mrViewData.GetBindings();
1828 rBindings.Invalidate( SID_STATUS_SUM );
1829 rBindings.Invalidate( SID_ATTR_SIZE );
1830 rBindings.Invalidate( SID_TABLE_CELL );
1831}
1832
1834{
1836 SCTAB nTab = mrViewData.GetTabNo();
1837 const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1839 if (aColorValue.bIsVisible) {
1840 rRenderContext.SetLineColor(aColorValue.nColor);
1841 LineInfo aLineInfo(LineStyle::Dash, 2);
1842 aLineInfo.SetDashCount(0);
1843 aLineInfo.SetDotCount(1);
1844 aLineInfo.SetDistance(15);
1845 // round caps except when running VCL_PLUGIN=gen due to a performance issue
1846 // https://bugs.documentfoundation.org/show_bug.cgi?id=128258#c14
1848 aLineInfo.SetLineCap(css::drawing::LineCap_ROUND);
1849 aLineInfo.SetDotLen(1);
1850 for (int i=nX1; i<nX2; i++) {
1851 if (rDoc.ColHidden(i,nTab) && (i<rDoc.MaxCol() ? !rDoc.ColHidden(i+1,nTab) : true)) {
1852 Point aStart = mrViewData.GetScrPos(i, nY1, eWhich, true );
1853 Point aEnd = mrViewData.GetScrPos(i, nY2, eWhich, true );
1854 rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
1855 }
1856 }
1857 for (int i=nY1; i<nY2; i++) {
1858 if (rDoc.RowHidden(i,nTab) && (i<rDoc.MaxRow() ? !rDoc.RowHidden(i+1,nTab) : true)) {
1859 Point aStart = mrViewData.GetScrPos(nX1, i, eWhich, true );
1860 Point aEnd = mrViewData.GetScrPos(nX2, i, eWhich, true );
1861 rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
1862 }
1863 }
1864 } //visible
1865}
1866
1867void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
1868{
1870 if (!pPageData)
1871 return;
1872
1874 SCTAB nTab = mrViewData.GetTabNo();
1875 Size aWinSize = GetOutputSizePixel();
1876 const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
1878 Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor );
1879
1880 OUString aPageStr = ScResId( STR_PGNUM );
1881 if ( nPageScript == SvtScriptType::NONE )
1882 {
1883 // get script type of translated "Page" string only once
1884 nPageScript = rDoc.GetStringScriptType( aPageStr );
1885 if (nPageScript == SvtScriptType::NONE)
1887 }
1888
1889 vcl::Font aFont;
1890 std::unique_ptr<ScEditEngineDefaulter> pEditEng;
1891 const ScPatternAttr& rDefPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
1892 if ( nPageScript == SvtScriptType::LATIN )
1893 {
1894 // use single font and call DrawText directly
1895 rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
1896 aFont.SetColor( COL_LIGHTGRAY );
1897 // font size is set as needed
1898 }
1899 else
1900 {
1901 // use EditEngine to draw mixed-script string
1902 pEditEng.reset(new ScEditEngineDefaulter( EditEngine::CreatePool().get(), true ));
1903 pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
1904 auto pEditDefaults = std::make_unique<SfxItemSet>( pEditEng->GetEmptyItemSet() );
1905 rDefPattern.FillEditItemSet( pEditDefaults.get() );
1906 pEditDefaults->Put( SvxColorItem( COL_LIGHTGRAY, EE_CHAR_COLOR ) );
1907 pEditEng->SetDefaults( std::move(pEditDefaults) );
1908 }
1909
1910 sal_uInt16 nCount = sal::static_int_cast<sal_uInt16>( pPageData->GetCount() );
1911 for (sal_uInt16 nPos=0; nPos<nCount; nPos++)
1912 {
1913 ScPrintRangeData& rData = pPageData->GetData(nPos);
1914 ScRange aRange = rData.GetPrintRange();
1915 if ( aRange.aStart.Col() <= nX2+1 && aRange.aEnd.Col()+1 >= nX1 &&
1916 aRange.aStart.Row() <= nY2+1 && aRange.aEnd.Row()+1 >= nY1 )
1917 {
1918 // 3 pixel frame around the print area
1919 // (middle pixel on the grid lines)
1920
1921 rRenderContext.SetLineColor();
1922 if (rData.IsAutomatic())
1923 rRenderContext.SetFillColor( aAutomatic );
1924 else
1925 rRenderContext.SetFillColor( aManual );
1926
1927 Point aStart = mrViewData.GetScrPos(
1928 aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
1929 Point aEnd = mrViewData.GetScrPos(
1930 aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, true );
1931 aStart.AdjustX( -2 );
1932 aStart.AdjustY( -2 );
1933
1934 // Prevent overflows:
1935 if ( aStart.X() < -10 ) aStart.setX( -10 );
1936 if ( aStart.Y() < -10 ) aStart.setY( -10 );
1937 if ( aEnd.X() > aWinSize.Width() + 10 )
1938 aEnd.setX( aWinSize.Width() + 10 );
1939 if ( aEnd.Y() > aWinSize.Height() + 10 )
1940 aEnd.setY( aWinSize.Height() + 10 );
1941
1942 rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
1943 rRenderContext.DrawRect( tools::Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
1944 rRenderContext.DrawRect( tools::Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
1945 rRenderContext.DrawRect( tools::Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
1946
1947 // Page breaks
1949
1950 size_t nColBreaks = rData.GetPagesX();
1951 const SCCOL* pColEnd = rData.GetPageEndX();
1952 size_t nColPos;
1953 for (nColPos=0; nColPos+1<nColBreaks; nColPos++)
1954 {
1955 SCCOL nBreak = pColEnd[nColPos]+1;
1956 if ( nBreak >= nX1 && nBreak <= nX2+1 )
1957 {
1959 if (rDoc.HasColBreak(nBreak, nTab) & ScBreakType::Manual)
1960 rRenderContext.SetFillColor( aManual );
1961 else
1962 rRenderContext.SetFillColor( aAutomatic );
1963 Point aBreak = mrViewData.GetScrPos(
1964 nBreak, aRange.aStart.Row(), eWhich, true );
1965 rRenderContext.DrawRect( tools::Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
1966 }
1967 }
1968
1969 size_t nRowBreaks = rData.GetPagesY();
1970 const SCROW* pRowEnd = rData.GetPageEndY();
1971 size_t nRowPos;
1972 for (nRowPos=0; nRowPos+1<nRowBreaks; nRowPos++)
1973 {
1974 SCROW nBreak = pRowEnd[nRowPos]+1;
1975 if ( nBreak >= nY1 && nBreak <= nY2+1 )
1976 {
1978 if (rDoc.HasRowBreak(nBreak, nTab) & ScBreakType::Manual)
1979 rRenderContext.SetFillColor( aManual );
1980 else
1981 rRenderContext.SetFillColor( aAutomatic );
1982 Point aBreak = mrViewData.GetScrPos(
1983 aRange.aStart.Col(), nBreak, eWhich, true );
1984 rRenderContext.DrawRect( tools::Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
1985 }
1986 }
1987
1988 // Page numbers
1989
1990 SCROW nPrStartY = aRange.aStart.Row();
1991 for (nRowPos=0; nRowPos<nRowBreaks; nRowPos++)
1992 {
1993 SCROW nPrEndY = pRowEnd[nRowPos];
1994 if ( nPrEndY >= nY1 && nPrStartY <= nY2 )
1995 {
1996 SCCOL nPrStartX = aRange.aStart.Col();
1997 for (nColPos=0; nColPos<nColBreaks; nColPos++)
1998 {
1999 SCCOL nPrEndX = pColEnd[nColPos];
2000 if ( nPrEndX >= nX1 && nPrStartX <= nX2 )
2001 {
2002 Point aPageStart = mrViewData.GetScrPos(
2003 nPrStartX, nPrStartY, eWhich, true );
2004 Point aPageEnd = mrViewData.GetScrPos(
2005 nPrEndX+1,nPrEndY+1, eWhich, true );
2006
2007 tools::Long nPageNo = rData.GetFirstPage();
2008 if ( rData.IsTopDown() )
2009 nPageNo += static_cast<tools::Long>(nColPos)*nRowBreaks+nRowPos;
2010 else
2011 nPageNo += static_cast<tools::Long>(nRowPos)*nColBreaks+nColPos;
2012
2013 OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo));
2014
2015 if ( pEditEng )
2016 {
2017 // find right font size with EditEngine
2018 tools::Long nHeight = 100;
2019 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
2020 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
2021 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
2022 pEditEng->SetTextCurrentDefaults( aThisPageStr );
2023 Size aSize100( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
2024
2025 // 40% of width or 60% of height
2026 tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
2027 tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
2028 nHeight = std::min(nSizeX,nSizeY);
2029 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT ) );
2030 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) );
2031 pEditEng->SetDefaultItem( SvxFontHeightItem( nHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) );
2032
2033 // centered output with EditEngine
2034 Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
2035 Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
2036 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
2037 pEditEng->Draw(rRenderContext, aPos);
2038 }
2039 else
2040 {
2041 // find right font size for DrawText
2042 aFont.SetFontSize( Size( 0,100 ) );
2043 rRenderContext.SetFont( aFont );
2044 Size aSize100(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
2045
2046 // 40% of width or 60% of height
2047 tools::Long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
2048 tools::Long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
2049 aFont.SetFontSize( Size( 0,std::min(nSizeX,nSizeY) ) );
2050 rRenderContext.SetFont( aFont );
2051
2052 // centered output with DrawText
2053 Size aTextSize(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
2054 Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
2055 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
2056 rRenderContext.DrawText( aPos, aThisPageStr );
2057 }
2058 }
2059 nPrStartX = nPrEndX + 1;
2060 }
2061 }
2062 nPrStartY = nPrEndY + 1;
2063 }
2064 }
2065 }
2066}
2067
2068void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev, const ScLokRTLContext* pLokRTLContext)
2069{
2070 aComboButton.SetOutputDevice( pContentDev );
2071
2073 ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc);
2074
2075 SCCOL nCol;
2076 SCROW nRow;
2077 SCSIZE nArrY;
2078 SCSIZE nQuery;
2079 SCTAB nTab = mrViewData.GetTabNo();
2080 ScDBData* pDBData = nullptr;
2081 std::unique_ptr<ScQueryParam> pQueryParam;
2082
2083 RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
2084 sal_uInt16 nArrCount = rTabInfo.mnArrCount;
2085
2086 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2087
2088 Point aOldPos = aComboButton.GetPosPixel(); // store state for MouseDown/Up
2089 Size aOldSize = aComboButton.GetSizePixel();
2090
2091 for (nArrY=1; nArrY+1<nArrCount; nArrY++)
2092 {
2093 if ( pRowInfo[nArrY].bAutoFilter && pRowInfo[nArrY].bChanged )
2094 {
2095 RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2096
2097 nRow = pThisRowInfo->nRowNo;
2098
2099 for (nCol=nX1; nCol<=nX2; nCol++)
2100 {
2101 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
2102 //if several columns merged on a row, there should be only one auto button at the end of the columns.
2103 //if several rows merged on a column, the button may be in the middle, so "!pInfo->bVOverlapped" should not be used
2104 if ( pInfo->bAutoFilter && !pInfo->bHOverlapped )
2105 {
2106 if (!pQueryParam)
2107 pQueryParam.reset(new ScQueryParam);
2108
2109 bool bNewData = true;
2110 if (pDBData)
2111 {
2112 SCCOL nStartCol;
2113 SCROW nStartRow;
2114 SCCOL nEndCol;
2115 SCROW nEndRow;
2116 SCTAB nAreaTab;
2117 pDBData->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
2118 if ( nCol >= nStartCol && nCol <= nEndCol &&
2119 nRow >= nStartRow && nRow <= nEndRow )
2120 bNewData = false;
2121 }
2122 if (bNewData)
2123 {
2124 pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2125 if (pDBData)
2126 pDBData->GetQueryParam( *pQueryParam );
2127 else
2128 {
2129 // can also be part of DataPilot table
2130 }
2131 }
2132
2133 // pQueryParam can only include MAXQUERY entries
2134
2135 bool bArrowState = false;
2136 if (pQueryParam->bInplace)
2137 {
2138 SCSIZE nCount = pQueryParam->GetEntryCount();
2139 for (nQuery = 0; nQuery < nCount; ++nQuery)
2140 {
2141 // Do no restrict to EQUAL here
2142 // (Column head should become blue also when ">1")
2143 const ScQueryEntry& rEntry = pQueryParam->GetEntry(nQuery);
2144 if (rEntry.bDoQuery && rEntry.nField == nCol)
2145 {
2146 bArrowState = true;
2147 break;
2148 }
2149 }
2150 }
2151
2152 tools::Long nSizeX;
2153 tools::Long nSizeY;
2154 SCCOL nStartCol= nCol;
2155 SCROW nStartRow = nRow;
2156 //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.
2157 //should first get the start pos of the merge area, then get the nSizeX through the start pos.
2158 rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
2159 mrViewData.GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX
2160 nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY());
2161 Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
2162 if (pLokRTLContext)
2163 aScrPos.setX(pLokRTLContext->docToTilePos(aScrPos.X()));
2164
2165 aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
2166 aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
2167 aCellBtn.setDrawBaseButton(false);
2168 aCellBtn.setDrawPopupButton(true);
2169 aCellBtn.setHasHiddenMember(bArrowState);
2170 aCellBtn.draw();
2171 }
2172 }
2173 }
2174
2175 if ( pRowInfo[nArrY].bPivotButton && pRowInfo[nArrY].bChanged )
2176 {
2177 RowInfo* pThisRowInfo = &pRowInfo[nArrY];
2178 nRow = pThisRowInfo->nRowNo;
2179 for (nCol=nX1; nCol<=nX2; nCol++)
2180 {
2181 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
2182 if (pInfo->bHOverlapped || pInfo->bVOverlapped)
2183 continue;
2184
2185 Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich );
2186 tools::Long nSizeX;
2187 tools::Long nSizeY;
2188 mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
2189 tools::Long nPosX = aScrPos.X();
2190 tools::Long nPosY = aScrPos.Y();
2191 // bLayoutRTL is handled in setBoundingBox
2192
2193 OUString aStr = rDoc.GetString(nCol, nRow, nTab);
2194 aCellBtn.setText(aStr);
2195 aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
2196 aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
2197 aCellBtn.setDrawBaseButton(pInfo->bPivotButton);
2198 aCellBtn.setDrawPopupButton(pInfo->bPivotPopupButton);
2199 aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
2200 aCellBtn.draw();
2201 }
2202 }
2203
2204 if ( !comphelper::LibreOfficeKit::isActive() && bListValButton && pRowInfo[nArrY].nRowNo == aListValPos.Row() && pRowInfo[nArrY].bChanged )
2205 {
2207 aComboButton.SetPosPixel( aRect.TopLeft() );
2209 pContentDev->SetClipRegion(vcl::Region(aRect));
2211 pContentDev->SetClipRegion(); // always called from Draw() without clip region
2212 aComboButton.SetPosPixel( aOldPos ); // restore old state
2213 aComboButton.SetSizePixel( aOldSize ); // for MouseUp/Down (AutoFilter)
2214 }
2215 }
2216
2217 pQueryParam.reset();
2219}
2220
2222{
2224 SCTAB nTab = mrViewData.GetTabNo();
2225 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2226 tools::Long nLayoutSign = bLayoutRTL ? -1 : 1;
2227
2228 ScDDComboBoxButton aButton( GetOutDev() ); // for optimal size
2229 Size aBtnSize = aButton.GetSizePixel();
2230
2231 SCCOL nCol = rButtonPos.Col();
2232 SCROW nRow = rButtonPos.Row();
2233
2234 tools::Long nCellSizeX; // width of this cell, including merged
2235 tools::Long nDummy;
2236 mrViewData.GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy );
2237
2238 // for height, only the cell's row is used, excluding merged cells
2239 tools::Long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), mrViewData.GetPPTY() );
2240 tools::Long nAvailable = nCellSizeX;
2241
2242 // left edge of next cell if there is a non-hidden next column
2243 SCCOL nNextCol = nCol + 1;
2244 const ScMergeAttr* pMerge = rDoc.GetAttr( nCol,nRow,nTab, ATTR_MERGE );
2245 if ( pMerge->GetColMerge() > 1 )
2246 nNextCol = nCol + pMerge->GetColMerge(); // next cell after the merged area
2247 while ( nNextCol <= rDoc.MaxCol() && rDoc.ColHidden(nNextCol, nTab) )
2248 ++nNextCol;
2249 bool bNextCell = ( nNextCol <= rDoc.MaxCol() );
2250 if ( bNextCell )
2251 nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), mrViewData.GetPPTX() );
2252
2253 if ( nAvailable < aBtnSize.Width() )
2254 aBtnSize.setWidth( nAvailable );
2255 if ( nCellSizeY < aBtnSize.Height() )
2256 aBtnSize.setHeight( nCellSizeY );
2257
2258 Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich, true );
2259 aPos.AdjustX(nCellSizeX * nLayoutSign ); // start of next cell
2260 if (!bNextCell)
2261 aPos.AdjustX( -(aBtnSize.Width() * nLayoutSign) ); // right edge of cell if next cell not available
2262 aPos.AdjustY(nCellSizeY - aBtnSize.Height() );
2263 // X remains at the left edge
2264
2265 if ( bLayoutRTL )
2266 aPos.AdjustX( -(aBtnSize.Width()-1) ); // align right edge of button with cell border
2267
2268 return tools::Rectangle( aPos, aBtnSize );
2269}
2270
2272{
2274 ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA );
2275 ScQueryParam aQueryParam;
2276
2277 if ( pDBData )
2278 pDBData->GetQueryParam( aQueryParam );
2279 else
2280 {
2281 OSL_FAIL("Auto filter button without DBData");
2282 }
2283
2284 bool bSimpleQuery = true;
2285 bool bColumnFound = false;
2286 SCSIZE nQuery;
2287
2288 if ( !aQueryParam.bInplace )
2289 bSimpleQuery = false;
2290
2291 // aQueryParam can only include MAXQUERY entries
2292
2293 SCSIZE nCount = aQueryParam.GetEntryCount();
2294 for (nQuery = 0; nQuery < nCount && bSimpleQuery; ++nQuery)
2295 if ( aQueryParam.GetEntry(nQuery).bDoQuery )
2296 {
2297 if (aQueryParam.GetEntry(nQuery).nField == nCol)
2298 bColumnFound = true;
2299
2300 if (nQuery > 0)
2301 if (aQueryParam.GetEntry(nQuery).eConnect != SC_AND)
2302 bSimpleQuery = false;
2303 }
2304
2305 return ( bSimpleQuery && bColumnFound );
2306}
2307
2308void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelRects ) const
2309{
2310 GetPixelRectsFor( mrViewData.GetMarkData(), rPixelRects );
2311}
2312
2313void ScGridWindow::GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle >& rRects) const
2314{
2315 GetRectsAnyFor(mrViewData.GetMarkData(), rRects, true);
2316}
2317
2320 ::std::vector< tools::Rectangle >& rPixelRects ) const
2321{
2322 GetRectsAnyFor(rMarkData, rPixelRects, false);
2323}
2324
2326 ::std::vector< tools::Rectangle >& rRects,
2327 bool bInPrintTwips) const
2328{
2330 SCTAB nTab = mrViewData.GetTabNo();
2331 double nPPTX = mrViewData.GetPPTX();
2332 double nPPTY = mrViewData.GetPPTY();
2333 bool bLayoutRTL = rDoc.IsLayoutRTL( nTab );
2334 // LOK clients needs exact document coordinates, so don't horizontally mirror them.
2335 tools::Long nLayoutSign = (!comphelper::LibreOfficeKit::isActive() && bLayoutRTL) ? -1 : 1;
2336
2337 ScMarkData aMultiMark( rMarkData );
2338 aMultiMark.SetMarking( false );
2339
2340 if (!aMultiMark.IsMultiMarked())
2341 {
2342 // simple range case - simplify calculation
2343 const ScRange& aSimpleRange = aMultiMark.GetMarkArea();
2344
2345 aMultiMark.MarkToMulti();
2346 if ( !aMultiMark.IsMultiMarked() )
2347 return;
2348
2349 SCCOL nX1 = aSimpleRange.aStart.Col();
2350 SCROW nY1 = aSimpleRange.aStart.Row();
2351 SCCOL nX2 = aSimpleRange.aEnd.Col();
2352 SCROW nY2 = aSimpleRange.aEnd.Row();
2353
2354 PutInOrder( nX1, nX2 );
2355 PutInOrder( nY1, nY2 );
2356
2357 SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2358 SCROW nPosY = mrViewData.GetPosY( eVWhich );
2359 // is the selection visible at all?
2360 if (nX2 < nPosX || nY2 < nPosY)
2361 return;
2362
2363 Point aScrStartPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2364 mrViewData.GetScrPos(nX1, nY1, eWhich);
2365
2366 tools::Long nStartX = aScrStartPos.X();
2367 tools::Long nStartY = aScrStartPos.Y();
2368
2369 Point aScrEndPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX2, nY2) :
2370 mrViewData.GetScrPos(nX2, nY2, eWhich);
2371
2372 tools::Long nWidthTwips = rDoc.GetColWidth(nX2, nTab);
2373 const tools::Long nWidth = bInPrintTwips ?
2374 nWidthTwips : ScViewData::ToPixel(nWidthTwips, nPPTX);
2375 tools::Long nEndX = aScrEndPos.X() + (nWidth - 1) * nLayoutSign;
2376
2377 sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY2, nTab );
2378 const tools::Long nHeight = bInPrintTwips ?
2379 nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2380 tools::Long nEndY = aScrEndPos.Y() + nHeight - 1;
2381
2382 ScInvertMerger aInvert( &rRects );
2383 aInvert.AddRect( tools::Rectangle( nStartX, nStartY, nEndX, nEndY ) );
2384
2385 return;
2386 }
2387
2388 aMultiMark.MarkToMulti();
2389 if ( !aMultiMark.IsMultiMarked() )
2390 return;
2391 const ScRange& aMultiRange = aMultiMark.GetMultiMarkArea();
2392 SCCOL nX1 = aMultiRange.aStart.Col();
2393 SCROW nY1 = aMultiRange.aStart.Row();
2394 SCCOL nX2 = aMultiRange.aEnd.Col();
2395 SCROW nY2 = aMultiRange.aEnd.Row();
2396
2397 PutInOrder( nX1, nX2 );
2398 PutInOrder( nY1, nY2 );
2399
2400 SCCOL nTestX2 = nX2;
2401 SCROW nTestY2 = nY2;
2402
2403 rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab );
2404
2405 SCCOL nPosX = mrViewData.GetPosX( eHWhich );
2406 SCROW nPosY = mrViewData.GetPosY( eVWhich );
2407 // is the selection visible at all?
2408 if (nTestX2 < nPosX || nTestY2 < nPosY)
2409 return;
2410 SCCOL nRealX1 = nX1;
2411 if (nX1 < nPosX)
2412 nX1 = nPosX;
2413 if (nY1 < nPosY)
2414 nY1 = nPosY;
2415
2417 {
2418 // limit the selection to only what is visible on the screen
2419 SCCOL nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich);
2420 if (nXRight > rDoc.MaxCol())
2421 nXRight = rDoc.MaxCol();
2422
2423 SCROW nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich);
2424 if (nYBottom > rDoc.MaxRow())
2425 nYBottom = rDoc.MaxRow();
2426
2427 // is the selection visible at all?
2428 if (nX1 > nXRight || nY1 > nYBottom)
2429 return;
2430
2431 if (nX2 > nXRight)
2432 nX2 = nXRight;
2433 if (nY2 > nYBottom)
2434 nY2 = nYBottom;
2435 }
2436 else
2437 {
2438 SCCOL nMaxTiledCol;
2439 SCROW nMaxTiledRow;
2440 rDoc.GetTiledRenderingArea(nTab, nMaxTiledCol, nMaxTiledRow);
2441
2442 if (nX2 > nMaxTiledCol)
2443 nX2 = nMaxTiledCol;
2444 if (nY2 > nMaxTiledRow)
2445 nY2 = nMaxTiledRow;
2446 }
2447
2448 ScInvertMerger aInvert( &rRects );
2449
2450 Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) :
2451 mrViewData.GetScrPos(nX1, nY1, eWhich);
2452 tools::Long nScrY = aScrPos.Y();
2453 bool bWasHidden = false;
2454 for (SCROW nY=nY1; nY<=nY2; nY++)
2455 {
2456 bool bFirstRow = ( nY == nPosY ); // first visible row?
2457 bool bDoHidden = false; // repeat hidden ?
2458 sal_uInt16 nHeightTwips = rDoc.GetRowHeight( nY,nTab );
2459 bool bDoRow = ( nHeightTwips != 0 );
2460 if (bDoRow)
2461 {
2462 if (bWasHidden) // test hidden merge
2463 {
2464 bDoHidden = true;
2465 bDoRow = true;
2466 }
2467
2468 bWasHidden = false;
2469 }
2470 else
2471 {
2472 bWasHidden = true;
2473 if (nY==nY2)
2474 bDoRow = true; // last cell of the block
2475 }
2476
2477 if ( bDoRow )
2478 {
2479 SCCOL nLoopEndX = nX2;
2480 if (nX2 < nX1) // the rest of the merge
2481 {
2482 SCCOL nStartX = nX1;
2483 while ( rDoc.GetAttr(nStartX,nY,nTab,ATTR_MERGE_FLAG)->IsHorOverlapped() )
2484 --nStartX;
2485 if (nStartX <= nX2)
2486 nLoopEndX = nX1;
2487 }
2488
2489 const tools::Long nHeight = bInPrintTwips ?
2490 nHeightTwips : ScViewData::ToPixel(nHeightTwips, nPPTY);
2491 tools::Long nEndY = nScrY + nHeight - 1;
2492 tools::Long nScrX = aScrPos.X();
2493 for (SCCOL nX=nX1; nX<=nLoopEndX; nX++)
2494 {
2495 tools::Long nWidth = rDoc.GetColWidth(nX, nTab);
2496 if (!bInPrintTwips)
2497 nWidth = ScViewData::ToPixel(nWidth, nPPTX);
2498
2499 if ( nWidth > 0 )
2500 {
2501 tools::Long nEndX = nScrX + ( nWidth - 1 ) * nLayoutSign;
2502
2503 SCROW nThisY = nY;
2504 const ScPatternAttr* pPattern = rDoc.GetPattern( nX, nY, nTab );
2505 const ScMergeFlagAttr* pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2506 if ( pMergeFlag->IsVerOverlapped() && ( bDoHidden || bFirstRow ) )
2507 {
2508 while ( pMergeFlag->IsVerOverlapped() && nThisY > 0 &&
2509 (rDoc.RowHidden(nThisY-1, nTab) || bFirstRow) )
2510 {
2511 --nThisY;
2512 pPattern = rDoc.GetPattern( nX, nThisY, nTab );
2513 pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2514 }
2515 }
2516
2517 // only the rest of the merged is seen ?
2518 SCCOL nThisX = nX;
2519 if ( pMergeFlag->IsHorOverlapped() && nX == nPosX && nX > nRealX1 )
2520 {
2521 while ( pMergeFlag->IsHorOverlapped() )
2522 {
2523 --nThisX;
2524 pPattern = rDoc.GetPattern( nThisX, nThisY, nTab );
2525 pMergeFlag = &pPattern->GetItem(ATTR_MERGE_FLAG);
2526 }
2527 }
2528
2529 if ( aMultiMark.IsCellMarked( nThisX, nThisY, true ) )
2530 {
2531 if ( !pMergeFlag->IsOverlapped() )
2532 {
2533 const ScMergeAttr* pMerge = &pPattern->GetItem(ATTR_MERGE);
2534 if (pMerge->GetColMerge() > 0 || pMerge->GetRowMerge() > 0)
2535 {
2536 const SCCOL nEndColMerge = nThisX + pMerge->GetColMerge();
2537 const SCROW nEndRowMerge = nThisY + pMerge->GetRowMerge();
2538 Point aEndPos = bInPrintTwips ?
2539 mrViewData.GetPrintTwipsPos(nEndColMerge, nEndRowMerge) :
2540 mrViewData.GetScrPos(nEndColMerge, nEndRowMerge, eWhich);
2541 if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY )
2542 {
2543 aInvert.AddRect( tools::Rectangle( nScrX,nScrY,
2544 aEndPos.X()-nLayoutSign,aEndPos.Y()-1 ) );
2545 }
2546 }
2547 else if ( nEndX * nLayoutSign >= nScrX * nLayoutSign && nEndY >= nScrY )
2548 {
2549 aInvert.AddRect( tools::Rectangle( nScrX,nScrY,nEndX,nEndY ) );
2550 }
2551 }
2552 }
2553
2554 nScrX = nEndX + nLayoutSign;
2555 }
2556 }
2557 nScrY = nEndY + 1;
2558 }
2559 }
2560}
2561
2563{
2564 Window::DataChanged(rDCEvt);
2565
2566 if ( !((rDCEvt.GetType() == DataChangedEventType::PRINTER) ||
2567 (rDCEvt.GetType() == DataChangedEventType::DISPLAY) ||
2568 (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
2569 (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
2570 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2571 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) )
2572 return;
2573
2574 if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == mrViewData.GetActivePart() )
2576
2577 if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
2578 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
2579 {
2580 if ( eWhich == mrViewData.GetActivePart() ) // only once for the view
2581 {
2582 ScTabView* pView = mrViewData.GetView();
2583
2584 pView->RecalcPPT();
2585
2586 // RepeatResize in case scroll bar sizes have changed
2587 pView->RepeatResize();
2588 pView->UpdateAllOverlays();
2589
2590 // invalidate cell attribs in input handler, in case the
2591 // EditEngine BackgroundColor has to be changed
2592 if ( mrViewData.IsActive() )
2593 {
2594 ScInputHandler* pHdl = SC_MOD()->GetInputHdl();
2595 if (pHdl)
2596 pHdl->ForgetLastPattern();
2597 }
2598 }
2599 }
2600
2601 Invalidate();
2602}
2603
2605{
2606 bInitialPageBreaks = true;
2607}
2608
2609IMPL_LINK(ScGridWindow, InitiatePageBreaksTimer, Timer*, pTimer, void)
2610{
2611 if (pTimer != &maShowPageBreaksTimer)
2612 return;
2613
2614 const ScViewOptions& rOpts = mrViewData.GetOptions();
2615 const bool bPage = rOpts.GetOption(VOPT_PAGEBREAKS);
2616 // tdf#124983, if option LibreOfficeDev Calc/View/Visual Aids/Page
2617 // breaks is enabled, breaks should be visible. If the document is
2618 // opened the first time or a tab is activated the first time, the
2619 // breaks are not calculated yet, so this initialization is done here.
2620 if (bPage)
2621 {
2622 const SCTAB nCurrentTab = mrViewData.GetTabNo();
2623 ScDocument& rDoc = mrViewData.GetDocument();
2624 const Size aPageSize = rDoc.GetPageSize(nCurrentTab);
2625 // Do not attempt to calculate a page size here if it is empty if
2626 // that involves counting pages.
2627 // An earlier implementation did
2628 // ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nCurrentTab);
2629 // rDoc.SetPageSize(nCurrentTab, rDoc.GetPageSize(nCurrentTab));
2630 // which resulted in tremendous waiting times after having loaded
2631 // larger documents i.e. imported from CSV, in which UI is entirely
2632 // blocked. All time is spent under ScPrintFunc::CountPages() in
2633 // ScTable::ExtendPrintArea() in the loop that calls
2634 // MaybeAddExtraColumn() to do stuff for each text string content
2635 // cell (each row in each column). Maybe that can be optimized, or
2636 // obtaining page size without that overhead would be possible, but
2637 // as is calling that from here is a no-no so this is a quick
2638 // disable things.
2639 if (!aPageSize.IsEmpty())
2640 {
2641 ScDocShell* pDocSh = mrViewData.GetDocShell();
2642 const bool bModified = pDocSh->IsModified();
2643 // Even setting the same size sets page size valid, so
2644 // UpdatePageBreaks() actually does something.
2645 rDoc.SetPageSize( nCurrentTab, aPageSize);
2646 rDoc.UpdatePageBreaks(nCurrentTab);
2647 pDocSh->PostPaint(0, 0, nCurrentTab, rDoc.MaxCol(), rDoc.MaxRow(), nCurrentTab, PaintPartFlags::Grid);
2648 pDocSh->SetModified(bModified);
2649 }
2650 }
2651}
2652
2653
2654/* 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:300
SC_DLLPUBLIC void GetQueryParam(ScQueryParam &rQueryParam) const
Definition: dbdata.cxx:424
void SetSizePixel(const Size &rNewSize)
Definition: cbutton.hxx:45
void Draw(const Point &rAt, const Size &rSize)
Definition: cbuttonw.cxx:49
const Point & GetPosPixel() const
Definition: cbutton.hxx:43
void SetPosPixel(const Point &rNewPos)
Definition: cbutton.hxx:42
void SetOutputDevice(OutputDevice *pOutputDevice)
Definition: cbuttonw.cxx:38
void SetOptSizePixel()
Definition: cbuttonw.cxx:43
const Size & GetSizePixel() const
Definition: cbutton.hxx:46
This class takes care of physically drawing field button controls inside data pilot tables.
Definition: dpcontrol.hxx:36
void setHasHiddenMember(bool b)
Definition: dpcontrol.cxx: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:2950
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
void ResetChanged(const ScRange &rRange)
Definition: document.cxx:4135
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:438
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:897
SC_DLLPUBLIC sal_uInt16 GetRowHeight(SCROW nRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4225
SC_DLLPUBLIC sal_uInt16 GetColWidth(SCCOL nCol, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: document.cxx:4184
bool ValidRow(SCROW nRow) const
Definition: document.hxx:899
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6337
SC_DLLPUBLIC bool ExtendMerge(SCCOL nStartCol, SCROW nStartRow, SCCOL &rEndCol, SCROW &rEndRow, SCTAB nTab, bool bRefresh=false)
Definition: document.cxx:5676
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:891
const ScDBData * GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, ScDBDataPortion ePortion) const
Definition: documen3.cxx:328
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6170
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:892
void FillInfo(ScTableInfo &rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode, const ScMarkData *pMarkData=nullptr)
Definition: fillinfo.cxx:354
void PrepareFormulaCalc()
Call this before any operations that might trigger one or more formula cells to get calculated.
Definition: document.cxx: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:4423
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:693
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:5726
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4438
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1082
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4493
void ExtendHidden(SCCOL &rX1, SCROW &rY1, SCCOL &rX2, SCROW &rY2, SCTAB nTab)
Definition: document.cxx:4770
SC_DLLPUBLIC void GetAllColBreaks(std::set< SCCOL > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4415
void SetPageSize(SCTAB nTab, const Size &rSize)
Definition: document.cxx:6310
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:898
bool IsInInterpreter() const
Definition: document.hxx:2405
SC_DLLPUBLIC void ExtendOverlapped(SCCOL &rStartCol, SCROW &rStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab) const
Definition: document.cxx:5586
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4509
bool HasBackgroundDraw(SCTAB nTab, const tools::Rectangle &rMMRect) const
Definition: documen9.cxx:343
SC_DLLPUBLIC void GetAllRowBreaks(std::set< SCROW > &rBreaks, SCTAB nTab, bool bPage, bool bManual) const
Definition: document.cxx:4408
SC_DLLPUBLIC OUString GetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const ScInterpreterContext *pContext=nullptr) const
Definition: document.cxx:3545
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
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:4778
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4813
Size GetPageSize(SCTAB nTab) const
Definition: document.cxx:6316
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:203
void LogicInvalidate(const tools::Rectangle *pRectangle) override
Definition: gridwin4.cxx:1708
SvtScriptType nPageScript
Definition: gridwin.hxx:185
void Draw(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode)
Definition: gridwin4.cxx:461
ScHSplitPos eHWhich
Definition: gridwin.hxx:153
void initiatePageBreaks()
Definition: gridwin4.cxx:2604
void CheckNeedsRepaint()
Definition: gridwin4.cxx:1812
sal_uInt16 nPaintCount
Definition: gridwin.hxx:197
void GetRectsAnyFor(const ScMarkData &rMarkData, ::std::vector< tools::Rectangle > &rRects, bool bInPrintTwips) const
Definition: gridwin4.cxx:2325
MapMode GetDrawMapMode(bool bForce=false)
MapMode for the drawinglayer objects.
Definition: gridwin3.cxx:252
ScDDComboBoxButton aComboButton
Definition: gridwin.hxx:193
void DoInvertRect(const tools::Rectangle &rPixel)
Definition: gridwin4.cxx:302
void UpdateHeaderOverlay()
Definition: gridwin.cxx:6749
bool bAutoMarkVisible
Definition: gridwin.hxx:217
void SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
Update the cell selection according to what handles have been dragged.
Definition: gridwin4.cxx:1743
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:2221
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: gridwin4.cxx:2562
void DrawRedraw(ScOutputData &rOutputData, SdrLayerID nLayer)
Definition: gridwin3.cxx:209
bool bIsInPaint
Definition: gridwin.hxx:215
void DrawContent(OutputDevice &rDevice, const ScTableInfo &rTableInfo, ScOutputData &aOutputData, bool bLogicText)
Draw content of the gridwindow; shared between the desktop and the tiled rendering.
Definition: gridwin4.cxx:674
tools::Rectangle aRepaintPixel
Definition: gridwin.hxx:198
std::shared_ptr< sc::SpellCheckContext > mpSpellCheckCxt
Definition: gridwin.hxx:149
ScVSplitPos eVWhich
Definition: gridwin.hxx:154
void SetupInitialPageBreaks(const ScDocument &rDoc, SCTAB nTab)
Definition: gridwin4.cxx:1398
sal_uInt16 nCursorHideCount
Definition: gridwin.hxx:165
void DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo &rTabInfo, OutputDevice *pContentDev, const ScLokRTLContext *pLokRTLContext)
Definition: gridwin4.cxx:2068
void DrawHiddenIndicator(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext &rRenderContext)
Definition: gridwin4.cxx:1833
std::vector< LOKCursorEntry > maLOKLastCursor
Definition: gridwin.hxx:147
bool bListValButton
Definition: gridwin.hxx:218
ScAddress aListValPos
Definition: gridwin.hxx:201
std::unique_ptr< ScNoteMarker, o3tl::default_delete< ScNoteMarker > > mpNoteMarker
Definition: gridwin.hxx:156
void flushOverlayManager()
Definition: gridwin.cxx:6938
bool bNeedsRepaint
Definition: gridwin.hxx:216
bool IsAutoFilterActive(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: gridwin4.cxx:2271
void GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle > &rRects) const
Definition: gridwin4.cxx:2313
ScViewData & mrViewData
Definition: gridwin.hxx:151
void DrawSdrGrid(const tools::Rectangle &rDrawingRect, OutputDevice *pContentDev)
Definition: gridwin3.cxx:234
void PaintTile(VirtualDevice &rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, tools::Long nTileWidth, tools::Long nTileHeight)
Definition: gridwin4.cxx:1530
void DrawPagePreview(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext &rRenderContext)
Definition: gridwin4.cxx:1867
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:2319
ScSplitPos eWhich
Definition: gridwin.hxx:152
ScAddress aAutoMarkPos
Definition: gridwin.hxx:200
virtual void PrePaint(vcl::RenderContext &rRenderContext) override
Definition: gridwin4.cxx:316
bool bInitialPageBreaks
Definition: gridwin.hxx:219
Timer maShowPageBreaksTimer
Definition: gridwin.hxx:207
void GetSelectionRects(::std::vector< tools::Rectangle > &rPixelRects) const
Definition: gridwin4.cxx:2308
bool UpdateVisibleRange()
Definition: gridwin2.cxx:612
VisibleRange maVisibleRange
Definition: gridwin.hxx:136
std::unique_ptr< FmFormView > mpLOKDrawView
LibreOfficeKit needs a persistent FmFormView for tiled rendering, otherwise the invalidations from dr...
Definition: gridwin.hxx:115
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: gridwin4.cxx:385
bool IsInputMode() const
Definition: inputhdl.hxx:186
void ForgetLastPattern()
Definition: inputhdl.cxx:2327
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:2529
SCCOL nX1
Definition: output.hxx:189
void DrawStrings(bool bPixelToLogic=false)
Definition: output2.cxx:1469
void SetViewShell(ScTabViewShell *pSh)
Definition: output.hxx:318
void SetSyntaxMode(bool bNewMode)
Definition: output.cxx:284
void SetMirrorWidth(tools::Long nNew)
Definition: output.cxx:237
SCCOL nX2
Definition: output.hxx:191
void SetSolidBackground(bool bSet)
Definition: output.hxx:322
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:4290
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
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:666
void InitBlockMode(SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bTestNeg=false, bool bCols=false, bool bRows=false, bool bForceNeg=false)
Definition: tabview2.cxx:353
void DoneBlockMode(bool bContinue=false)
Definition: tabview2.cxx:409
const std::vector< ScHighlightEntry > & GetHighlightRanges() const
Definition: tabview.hxx:331
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:3059
ScViewData & GetViewData()
Definition: tabview.hxx:335
SC_DLLPUBLIC void SetCursor(SCCOL nPosX, SCROW nPosY, bool bNew=false)
Definition: tabview3.cxx:363
ScDrawView * GetScDrawView()
Definition: tabview.hxx:343
void RecalcPPT()
Definition: tabview3.cxx:2802
void UpdateAllOverlays()
Definition: tabview2.cxx:1035
void RepeatResize(bool bUpdateFix=true)
Definition: tabview.cxx:762
ScPageBreakData * GetPageBreakData()
Definition: tabview.hxx:330
Point GetPrintTwipsPos(SCCOL nCol, SCROW nRow) const
returns the position (top-left corner) of the requested cell in print twips coordinates.
Definition: viewdata.cxx:2551
bool IsMinimized() const
Definition: viewdata.cxx:3175
SCCOL GetEditEndCol() const
Definition: viewdata.hxx:607
SCROW GetEditEndRow() const
Definition: viewdata.hxx:608
static void AddPixelsWhile(tools::Long &rScrY, tools::Long nEndPixels, SCROW &rPosY, SCROW nEndRow, double nPPTY, const ScDocument *pDoc, SCTAB nTabNo)
while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row heights converted with nPPTY to rSc...
Definition: viewdata.cxx:4142
bool GetMergeSizePixel(SCCOL nX, SCROW nY, tools::Long &rSizeXPix, tools::Long &rSizeYPix) const
Definition: viewdata.cxx:2727
const ScViewOptions & GetOptions() const
Definition: viewdata.hxx:554
bool GetShowGrid() const
Definition: viewdata.hxx:463
bool IsSyntaxMode() const
Definition: viewdata.hxx:558
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3141
const Fraction & GetZoomY() const
Definition: viewdata.hxx:460
SCROW GetEditStartRow() const
Definition: viewdata.hxx:606
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScDocument & GetDocument() const
Definition: viewdata.hxx:380
ScPositionHelper & GetLOKHeightHelper()
Definition: viewdata.hxx:411
SCROW GetPosY(ScVSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1416
SCCOL GetRefStartX() const
Definition: viewdata.hxx:532
SCCOL GetEditStartCol() const
Definition: viewdata.hxx:605
double GetPPTY() const
Definition: viewdata.hxx:469
const MapMode & GetLogicMode(ScSplitPos eWhich)
Definition: viewdata.cxx:3015
ScSplitPos GetEditActivePart() const
Definition: viewdata.hxx:602
ScDocShell * GetDocShell() const
Definition: viewdata.hxx:354
ScGridWindow * GetActiveWin()
Definition: viewdata.cxx:3157
void GetPosFromPixel(tools::Long nClickX, tools::Long nClickY, ScSplitPos eWhich, SCCOL &rPosX, SCROW &rPosY, bool bTestMerge=true, bool bRepair=false, SCTAB nForTab=-1)
Definition: viewdata.cxx:2780
ScTabViewShell * GetViewShell() const
Definition: viewdata.hxx:357
static tools::Long ToPixel(sal_uInt16 nTwips, double nFactor)
Definition: viewdata.hxx:700
ScDBFunc * GetView() const
Definition: viewdata.cxx:863
SCROW VisibleCellsY(ScVSplitPos eWhichY) const
Definition: viewdata.cxx:2712
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
Definition: viewdata.cxx:2279
SCROW GetRefEndY() const
Definition: viewdata.hxx:536
Point GetScrPos(SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, bool bAllowNeg=false, SCTAB nForTab=-1) const
Definition: viewdata.cxx:2375
SCTAB GetRefStartZ() const
Definition: viewdata.hxx:534
ScPositionHelper & GetLOKWidthHelper()
Definition: viewdata.hxx:410
bool IsActive() const
Definition: viewdata.hxx:382
void SetZoom(const Fraction &rNewX, const Fraction &rNewY, std::vector< SCTAB > &tabs)
Definition: viewdata.cxx:1035
SCCOL GetRefEndX() const
Definition: viewdata.hxx:535
SCROW GetRefStartY() const
Definition: viewdata.hxx:533
SCCOL VisibleCellsX(ScHSplitPos eWhichX) const
Definition: viewdata.cxx:2707
SCTAB GetRefEndZ() const
Definition: viewdata.hxx:537
const Fraction & GetZoomX() const
Definition: viewdata.hxx:459
SCTAB GetRefTabNo() const
Definition: viewdata.hxx:392
bool IsPagebreakMode() const
Definition: viewdata.hxx:425
void SetScenButSize(const Size &rNew)
Definition: viewdata.hxx:666
bool IsRefMode() const
Definition: viewdata.hxx:530
double GetPPTX() const
Definition: viewdata.hxx:468
bool IsOle() const
Definition: viewdata.cxx:4021
SfxBindings & GetBindings()
Definition: viewdata.cxx:3129
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:582
SCROW GetCurY() const
Definition: viewdata.hxx:402
ScDrawView * GetScDrawView()
Definition: viewdata.cxx:3169
SCCOL GetCurX() const
Definition: viewdata.hxx:401
SCCOL GetPosX(ScHSplitPos eWhich, SCTAB nForTab=-1) const
Definition: viewdata.cxx:1402
bool GetOption(ScViewOption eOpt) const
Definition: viewopti.hxx:88
Color const & GetGridColor(OUString *pStrName=nullptr) const
Definition: viewopti.cxx:118
void disposeAndReset(reference_type *pBody)
const sdr::contact::ObjectContact & GetObjectContact() const
void EndDrawLayers(SdrPaintWindow &rPaintWindow, bool bPaintFormLayer)
SdrPageView * GetSdrPageView() const
void PrePaint()
SdrPaintWindow * BeginDrawLayers(OutputDevice *pOut, const vcl::Region &rReg, bool bDisableIntersect=false)
OutputDevice & GetTargetOutputDevice()
virtual sdr::contact::ObjectContact * createViewSpecificObjectContact(SdrPageWindow &rPageWindow, const char *pDebugName) const
void Invalidate(sal_uInt16 nId)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
static void notifyInvalidation(SfxViewShell const *pThisView, tools::Rectangle const *)
static void notifyOtherView(const SfxViewShell *pThisView, SfxViewShell const *pOtherView, int nType, std::string_view rKey, const OString &rPayload)
bool IsModified() const
OUString GetTitle(sal_uInt16 nMaxLen=0) const
ViewShellDocId GetDocId() const override
static SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
bool IsEmpty() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const vcl::Font & GetAppFont() const
void SetPriority(TaskPriority ePriority)
virtual void Start(bool bStartTimer=true) override
reference_type * get() const
virtual bool supportsGridOffsets() const
virtual void calculateGridOffsetForViewOjectContact(basegfx::B2DVector &rTarget, const ViewObjectContact &rClient) const
virtual SdrObject * TryToGetSdrObject() const
ViewContact & GetViewContact() const
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
void setWidth(tools::Long n)
constexpr void SetRight(tools::Long v)
constexpr Size GetSize() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
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:2609
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:48
@ VOPT_NULLVALS
Definition: viewopti.hxx:33
@ VOPT_GRID_ONTOP
Definition: viewopti.hxx:42
@ VOPT_GRID
Definition: viewopti.hxx:41
@ VOPT_FORMULAS
Definition: viewopti.hxx:32
@ VOPT_NOTES
Definition: viewopti.hxx:35
@ VOPT_PAGEBREAKS
Definition: viewopti.hxx:45
ScUpdateMode
Definition: viewutil.hxx:39
oslFileHandle & pOut