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