LibreOffice Module sc (master) 1
fillinfo.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 * This file is part of the LibreOffice project.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 *
10 * This file incorporates work covered by the following license notice:
11 *
12 * Licensed to the Apache Software Foundation (ASF) under one or more
13 * contributor license agreements. See the NOTICE file distributed
14 * with this work for additional information regarding copyright
15 * ownership. The ASF licenses this file to you under the Apache
16 * License, Version 2.0 (the "License"); you may not use this file
17 * except in compliance with the License. You may obtain a copy of
18 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 */
20
21#include <scitems.hxx>
22#include <editeng/boxitem.hxx>
23#include <editeng/lineitem.hxx>
24#include <editeng/shaditem.hxx>
25#include <editeng/brushitem.hxx>
26#include <svx/framelink.hxx>
27#include <osl/diagnose.h>
28
29#include <fillinfo.hxx>
30#include <document.hxx>
31#include <table.hxx>
32#include <attrib.hxx>
33#include <attarray.hxx>
34#include <markarr.hxx>
35#include <markdata.hxx>
36#include <patattr.hxx>
37#include <poolhelp.hxx>
38#include <docpool.hxx>
39#include <conditio.hxx>
40#include <stlpool.hxx>
41#include <cellvalue.hxx>
42#include <mtvcellfunc.hxx>
43
44#include <algorithm>
45#include <limits>
46#include <vector>
47#include <memory>
48
49// Similar as in output.cxx
50
51static void lcl_GetMergeRange( SCCOL nX, SCROW nY, SCSIZE nArrY,
52 const ScDocument* pDoc, RowInfo* pRowInfo,
53 SCCOL nX1, SCROW nY1, SCTAB nTab,
54 SCCOL& rStartX, SCROW& rStartY, SCCOL& rEndX, SCROW& rEndY )
55{
56 ScCellInfo* pInfo = &pRowInfo[nArrY].cellInfo(nX);
57
58 rStartX = nX;
59 rStartY = nY;
60 bool bHOver = pInfo->bHOverlapped;
61 bool bVOver = pInfo->bVOverlapped;
62 SCCOL nLastCol;
63 SCROW nLastRow;
64
65 while (bHOver) // nY constant
66 {
67 --rStartX;
68 if (rStartX >= nX1 && !pDoc->ColHidden(rStartX, nTab, nullptr, &nLastCol))
69 {
70 bHOver = pRowInfo[nArrY].cellInfo(rStartX).bHOverlapped;
71 bVOver = pRowInfo[nArrY].cellInfo(rStartX).bVOverlapped;
72 }
73 else
74 {
75 ScMF nOverlap = pDoc->GetAttr( rStartX, rStartY, nTab, ATTR_MERGE_FLAG )->GetValue();
76 bHOver = bool(nOverlap & ScMF::Hor);
77 bVOver = bool(nOverlap & ScMF::Ver);
78 }
79 }
80
81 while (bVOver)
82 {
83 --rStartY;
84
85 if (nArrY>0)
86 --nArrY; // local copy !
87
88 if (rStartX >= nX1 && rStartY >= nY1 &&
89 !pDoc->ColHidden(rStartX, nTab, nullptr, &nLastCol) &&
90 !pDoc->RowHidden(rStartY, nTab, nullptr, &nLastRow) &&
91 pRowInfo[nArrY].nRowNo == rStartY)
92 {
93 bVOver = pRowInfo[nArrY].cellInfo(rStartX).bVOverlapped;
94 }
95 else
96 {
97 ScMF nOverlap = pDoc->GetAttr(
98 rStartX, rStartY, nTab, ATTR_MERGE_FLAG )->GetValue();
99 bVOver = bool(nOverlap & ScMF::Ver);
100 }
101 }
102
103 const ScMergeAttr* pMerge;
104 if (rStartX >= nX1 && rStartY >= nY1 &&
105 !pDoc->ColHidden(rStartX, nTab, nullptr, &nLastCol) &&
106 !pDoc->RowHidden(rStartY, nTab, nullptr, &nLastRow) &&
107 pRowInfo[nArrY].nRowNo == rStartY)
108 {
109 pMerge = &pRowInfo[nArrY].cellInfo(rStartX).pPatternAttr->
111 }
112 else
113 pMerge = pDoc->GetAttr(rStartX,rStartY,nTab,ATTR_MERGE);
114
115 rEndX = rStartX + pMerge->GetColMerge() - 1;
116 rEndY = rStartY + pMerge->GetRowMerge() - 1;
117}
118
119namespace {
120
121class RowInfoFiller
122{
123 ScDocument& mrDoc;
124 SCTAB mnTab;
125 RowInfo* mpRowInfo;
126 SCCOL mnCol;
127 SCSIZE mnArrY;
128 SCCOL mnStartCol;
129 SCROW mnHiddenEndRow;
130 bool mbHiddenRow;
131
132 bool isHidden(size_t nRow)
133 {
134 SCROW nThisRow = static_cast<SCROW>(nRow);
135 if (nThisRow > mnHiddenEndRow)
136 mbHiddenRow = mrDoc.RowHidden(nThisRow, mnTab, nullptr, &mnHiddenEndRow);
137 return mbHiddenRow;
138 }
139
140 void alignArray(size_t nRow)
141 {
142 while (mpRowInfo[mnArrY].nRowNo < static_cast<SCROW>(nRow))
143 ++mnArrY;
144 }
145
146 void setInfo(size_t nRow, const ScRefCellValue& rCell)
147 {
148 alignArray(nRow);
149
150 RowInfo& rThisRowInfo = mpRowInfo[mnArrY];
151 if(mnCol >= mnStartCol-1)
152 rThisRowInfo.cellInfo(mnCol).maCell = rCell;
153 rThisRowInfo.basicCellInfo(mnCol).bEmptyCellText = false;
154 ++mnArrY;
155 }
156
157public:
158 RowInfoFiller(ScDocument& rDoc, SCTAB nTab, RowInfo* pRowInfo, SCCOL nCol, SCSIZE nArrY, SCCOL nStartCol) :
159 mrDoc(rDoc), mnTab(nTab), mpRowInfo(pRowInfo), mnCol(nCol), mnArrY(nArrY), mnStartCol(nStartCol),
160 mnHiddenEndRow(-1), mbHiddenRow(false) {}
161
162 void operator() (size_t nRow, double fVal)
163 {
164 if (!isHidden(nRow))
165 setInfo(nRow, ScRefCellValue(fVal));
166 }
167
168 void operator() (size_t nRow, const svl::SharedString& rStr)
169 {
170 if (!isHidden(nRow))
171 setInfo(nRow, ScRefCellValue(&rStr));
172 }
173
174 void operator() (size_t nRow, const EditTextObject* p)
175 {
176 if (!isHidden(nRow))
177 setInfo(nRow, ScRefCellValue(p));
178 }
179
180 void operator() (size_t nRow, const ScFormulaCell* p)
181 {
182 if (!isHidden(nRow))
183 setInfo(nRow, ScRefCellValue(const_cast<ScFormulaCell*>(p)));
184 }
185};
186
187bool isRotateItemUsed(const ScDocumentPool *pPool)
188{
189 return pPool->GetItemCount2( ATTR_ROTATE_VALUE ) > 0;
190}
191
192void initRowInfo(const ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow,
193 double fRowScale, SCROW nRow1, SCTAB nTab, SCROW& rYExtra, SCSIZE& rArrRow, SCROW& rRow2)
194{
195 sal_uInt16 nDocHeight = pDoc->GetSheetOptimalMinRowHeight(nTab);
196 SCROW nDocHeightEndRow = -1;
197 for (SCROW nSignedY=nRow1-1; nSignedY<=rYExtra; nSignedY++)
198 {
199 SCROW nY;
200 if (nSignedY >= 0)
201 nY = nSignedY;
202 else
203 nY = pDoc->MaxRow()+1; // invalid
204
205 if (nY > nDocHeightEndRow)
206 {
207 if (pDoc->ValidRow(nY))
208 nDocHeight = pDoc->GetRowHeight( nY, nTab, nullptr, &nDocHeightEndRow );
209 else
210 nDocHeight = pDoc->GetSheetOptimalMinRowHeight(nTab);
211 }
212
213 if ( rArrRow==0 || nDocHeight || nY > pDoc->MaxRow() )
214 {
215 RowInfo* pThisRowInfo = &pRowInfo[rArrRow];
216 // pThisRowInfo->pCellInfo is set below using allocCellInfo()
217
218 sal_uInt16 nHeight = static_cast<sal_uInt16>(
219 std::clamp(
220 nDocHeight * fRowScale, 1.0, double(std::numeric_limits<sal_uInt16>::max())));
221
222 pThisRowInfo->nRowNo = nY; //TODO: case < 0 ?
223 pThisRowInfo->nHeight = nHeight;
224 pThisRowInfo->bEmptyBack = true;
225 pThisRowInfo->bChanged = true;
226 pThisRowInfo->bAutoFilter = false;
227 pThisRowInfo->bPivotButton = false;
228 pThisRowInfo->bPivotToggle = false;
229 pThisRowInfo->nRotMaxCol = SC_ROTMAX_NONE;
230
231 ++rArrRow;
232 if (rArrRow >= nMaxRow)
233 {
234 OSL_FAIL("FillInfo: Range too big" );
235 rYExtra = nSignedY; // End
236 rRow2 = rYExtra - 1; // Adjust range
237 }
238 }
239 else
240 if (nSignedY == rYExtra) // hidden additional line?
241 ++rYExtra;
242 }
243}
244
245void initCellInfo(RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nStartCol, SCCOL nRotMax,
246 const SvxShadowItem* pDefShadow)
247{
248 for (SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow)
249 {
250 RowInfo& rThisRowInfo = pRowInfo[nArrRow];
251 // A lot of memory (and performance allocating and initializing it) can
252 // be saved if we do not allocate CellInfo for columns before nStartCol.
253 // But code in ScOutputData::SetCellRotation(), ScOutputData::DrawRotatedFrame()
254 // and ScOutputData::SetCellRotations() accesses those. That depends on
255 // nRotMaxCol being set to something else than none, and the value is already
256 // initialized here. So allocate all those cells starting from column 0 only if needed.
257 SCCOL nMinCol = rThisRowInfo.nRotMaxCol != SC_ROTMAX_NONE ? 0 : nStartCol;
258 rThisRowInfo.allocCellInfo( nMinCol, nRotMax + 1 );
259
260 for (SCCOL nCol = nMinCol-1; nCol <= nRotMax+1; ++nCol) // Preassign cell info
261 {
262 ScCellInfo& rInfo = rThisRowInfo.cellInfo(nCol);
263 rInfo.pShadowAttr = pDefShadow;
264 }
265 }
266}
267
268void initColWidths(RowInfo* pRowInfo, const ScDocument* pDoc, double fColScale, SCTAB nTab, SCCOL nCol2, SCCOL nRotMax)
269{
270 for (SCCOL nCol=nCol2+2; nCol<=nRotMax+1; nCol++) // Add remaining widths
271 {
272 if ( pDoc->ValidCol(nCol) )
273 {
274 if (!pDoc->ColHidden(nCol, nTab))
275 {
276 sal_uInt16 nThisWidth = static_cast<sal_uInt16>(pDoc->GetColWidth( nCol, nTab ) * fColScale);
277 if (!nThisWidth)
278 nThisWidth = 1;
279
280 pRowInfo[0].basicCellInfo(nCol).nWidth = nThisWidth;
281 }
282 }
283 }
284}
285
286bool handleConditionalFormat(ScConditionalFormatList& rCondFormList, const ScCondFormatIndexes& rCondFormats,
287 ScCellInfo* pInfo, ScTableInfo* pTableInfo, ScStyleSheetPool* pStlPool,
288 const ScAddress& rAddr, bool& bHidden, bool& bHideFormula, bool bTabProtect)
289{
290 bool bFound = false;
291 bool bAnyCondition = false;
292 for(const auto& rCondFormat : rCondFormats)
293 {
294 ScConditionalFormat* pCondForm = rCondFormList.GetFormat(rCondFormat);
295 if(!pCondForm)
296 continue;
297
298 ScCondFormatData aData = pCondForm->GetData(
299 pInfo->maCell, rAddr);
300 if (!aData.aStyleName.isEmpty())
301 {
302 SfxStyleSheetBase* pStyleSheet =
303 pStlPool->Find( aData.aStyleName, SfxStyleFamily::Para );
304 if ( pStyleSheet )
305 {
306 //TODO: cache Style-Sets !!!
307 pInfo->pConditionSet = &pStyleSheet->GetItemSet();
308 bAnyCondition = true;
309
310 // TODO: moggi: looks like there is a bug around bHidden and bHideFormula
311 // They are normally for the whole pattern and not for a single cell
312 // we need to check already here for protected cells
313 const ScProtectionAttr* pProtAttr;
314 if ( bTabProtect && (pProtAttr = pInfo->pConditionSet->GetItemIfSet( ATTR_PROTECTION )) )
315 {
316 bHidden = pProtAttr->GetHideCell();
317 bHideFormula = pProtAttr->GetHideFormula();
318
319 }
320 bFound = true;
321
322 }
323 // if style is not there, treat like no condition
324 }
325
326 if(aData.mxColorScale)
327 {
328 pInfo->mxColorScale = aData.mxColorScale;
329 bFound = true;
330 }
331
332 if(aData.pDataBar)
333 {
334 pInfo->pDataBar = aData.pDataBar.get();
335 pTableInfo->addDataBarInfo(std::move(aData.pDataBar));
336 bFound = true;
337 }
338
339 if(aData.pIconSet)
340 {
341 pInfo->pIconSet = aData.pIconSet.get();
342 pTableInfo->addIconSetInfo(std::move(aData.pIconSet));
343 bFound = true;
344 }
345
346 if (bFound)
347 break;
348 }
349
350 return bAnyCondition;
351}
352
353}
354
356 ScTableInfo& rTabInfo, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
357 SCTAB nTab, double fColScale, double fRowScale, bool bPageMode, bool bFormulaMode,
358 const ScMarkData* pMarkData )
359{
360 OSL_ENSURE( maTabs[nTab], "Table does not exist" );
361
362 bool bLayoutRTL = IsLayoutRTL( nTab );
363
364 ScDocumentPool* pPool = mxPoolHelper->GetDocPool();
365 ScStyleSheetPool* pStlPool = mxPoolHelper->GetStylePool();
366
367 RowInfo* pRowInfo = rTabInfo.mpRowInfo.get();
368
369 const SvxBrushItem* pDefBackground =
371 const ScMergeAttr* pDefMerge =
372 &pPool->GetDefaultItem( ATTR_MERGE );
373 const SvxShadowItem* pDefShadow =
374 &pPool->GetDefaultItem( ATTR_SHADOW );
375
376 SCSIZE nArrRow;
377 SCSIZE nArrCount;
378 bool bAnyMerged = false;
379 bool bAnyShadow = false;
380 bool bAnyCondition = false;
381 bool bAnyPreview = false;
382
383 bool bTabProtect = IsTabProtected(nTab);
384
385 // first only the entries for the entire column
386
387 nArrRow=0;
388 SCROW nYExtra = nRow2+1;
389 initRowInfo(this, pRowInfo, rTabInfo.mnArrCapacity, fRowScale, nRow1,
390 nTab, nYExtra, nArrRow, nRow2);
391 nArrCount = nArrRow; // incl. Dummys
392
393 // Rotated text...
394
395 // Is Attribute really used in document?
396 bool bAnyItem = isRotateItemUsed(pPool);
397
398 SCCOL nRotMax = nCol2;
399 if ( bAnyItem && HasAttrib( 0, nRow1, nTab, MaxCol(), nRow2+1, nTab,
401 {
402 //TODO: check Conditionals also for HasAttrFlags::Rotate ????
403
404 OSL_ENSURE( nArrCount>2, "nArrCount too small" );
405 FindMaxRotCol( nTab, &pRowInfo[1], nArrCount-1, nCol1, nCol2 );
406 // FindMaxRotCol sets nRotMaxCol
407
408 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
409 if (pRowInfo[nArrRow].nRotMaxCol != SC_ROTMAX_NONE && pRowInfo[nArrRow].nRotMaxCol > nRotMax)
410 nRotMax = pRowInfo[nArrRow].nRotMaxCol;
411 }
412
413 // Allocate cell information only after the test rotation
414 // to nRotMax due to nRotateDir Flag
415 initCellInfo(pRowInfo, nArrCount, nCol1, nRotMax, pDefShadow);
416
417 initColWidths(pRowInfo, this, fColScale, nTab, nCol2, nRotMax);
418
419 ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
420 if (pCondFormList)
421 pCondFormList->startRendering();
422
423 SCCOL nLastHiddenCheckedCol = -2;
424 bool bColHidden = false;
425 for (SCCOL nCol=-1; nCol<=nCol2+1; nCol++) // collect basic info also for all previous cols, and left & right + 1
426 {
427 if (ValidCol(nCol))
428 {
429 // #i58049#, #i57939# Hidden columns must be skipped here, or their attributes
430 // will disturb the output
431
432 if (nCol > nLastHiddenCheckedCol)
433 bColHidden = ColHidden(nCol, nTab, nullptr, &nLastHiddenCheckedCol);
434 // TODO: Optimize this loop.
435 if (!bColHidden)
436 {
437 sal_uInt16 nColWidth = GetColWidth( nCol, nTab, false ); // false=no need to check for hidden, checked above
438 sal_uInt16 nThisWidth = static_cast<sal_uInt16>(std::clamp(nColWidth * fColScale, 1.0, double(std::numeric_limits<sal_uInt16>::max())));
439
440 pRowInfo[0].basicCellInfo(nCol).nWidth = nThisWidth; //TODO: this should be enough
441
442 const ScAttrArray* pThisAttrArr; // Attribute
443 if (nCol < maTabs[nTab]->GetAllocatedColumnsCount())
444 {
445 ScColumn* pThisCol = &maTabs[nTab]->aCol[nCol]; // Column data
446
447 nArrRow = 1;
448 // Iterate between rows nY1 and nY2 and pick up non-empty
449 // cells that are not hidden.
450 RowInfoFiller aFunc(*this, nTab, pRowInfo, nCol, nArrRow, nCol1);
451 sc::ParseAllNonEmpty(pThisCol->maCells.begin(), pThisCol->maCells, nRow1, nRow2,
452 aFunc);
453
454 pThisAttrArr = pThisCol->pAttrArray.get();
455 }
456 else
457 pThisAttrArr = &maTabs[nTab]->aDefaultColData.AttrArray();
458
459 if (nCol+1 >= nCol1) // Attribute/Blockmark from nX1-1
460 {
461 nArrRow = 0;
462
463 SCROW nCurRow=nRow1; // single rows
464 if (nCurRow>0)
465 --nCurRow; // 1 more on top
466 else
467 nArrRow = 1;
468
469 SCROW nThisRow;
471 if ( pThisAttrArr->Count() )
472 (void) pThisAttrArr->Search( nCurRow, nIndex );
473 else
474 nIndex = 0;
475
476 do
477 {
478 const ScPatternAttr* pPattern = nullptr;
479 if ( pThisAttrArr->Count() )
480 {
481 nThisRow = pThisAttrArr->mvData[nIndex].nEndRow; // End of range
482 pPattern = pThisAttrArr->mvData[nIndex].pPattern;
483 }
484 else
485 {
486 nThisRow = MaxRow();
487 pPattern = GetDefPattern();
488 }
489
490 const SvxBrushItem* pBackground = &pPattern->GetItem(ATTR_BACKGROUND);
491 const SvxBoxItem* pLinesAttr = &pPattern->GetItem(ATTR_BORDER);
492
493 const SvxLineItem* pTLBRLine = &pPattern->GetItem( ATTR_BORDER_TLBR );
494 const SvxLineItem* pBLTRLine = &pPattern->GetItem( ATTR_BORDER_BLTR );
495
496 const SvxShadowItem* pShadowAttr = &pPattern->GetItem(ATTR_SHADOW);
497 if (pShadowAttr != pDefShadow)
498 bAnyShadow = true;
499
500 const ScMergeAttr* pMergeAttr = &pPattern->GetItem(ATTR_MERGE);
501 bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge );
502 ScMF nOverlap = pPattern->GetItemSet().
503 Get(ATTR_MERGE_FLAG).GetValue();
504 bool bHOverlapped(nOverlap & ScMF::Hor);
505 bool bVOverlapped(nOverlap & ScMF::Ver);
506 bool bAutoFilter(nOverlap & ScMF::Auto);
507 bool bPivotButton(nOverlap & ScMF::Button);
508 bool bScenario(nOverlap & ScMF::Scenario);
509 bool bPivotPopupButton(nOverlap & ScMF::ButtonPopup);
510 bool bFilterActive(nOverlap & ScMF::HiddenMember);
511 bool bPivotCollapseButton(nOverlap & ScMF::DpCollapse);
512 bool bPivotExpandButton(nOverlap & ScMF::DpExpand);
513 bool bPivotPopupButtonMulti(nOverlap & ScMF::ButtonPopup2);
514 if (bMerged||bHOverlapped||bVOverlapped)
515 bAnyMerged = true; // internal
516
517 bool bHidden, bHideFormula;
518 if (bTabProtect)
519 {
520 const ScProtectionAttr& rProtAttr = pPattern->GetItem(ATTR_PROTECTION);
521 bHidden = rProtAttr.GetHideCell();
522 bHideFormula = rProtAttr.GetHideFormula();
523 }
524 else
525 bHidden = bHideFormula = false;
526
527 const ScCondFormatIndexes& rCondFormats = pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
528 bool bContainsCondFormat = !rCondFormats.empty();
529
530 do
531 {
532 SCROW nLastHiddenRow = -1;
533 bool bRowHidden = RowHidden(nCurRow, nTab, nullptr, &nLastHiddenRow);
534 if ( nArrRow==0 || !bRowHidden )
535 {
536 if ( GetPreviewCellStyle( nCol, nCurRow, nTab ) != nullptr )
537 bAnyPreview = true;
538 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
539 if (pBackground != pDefBackground) // Column background == Default ?
540 pThisRowInfo->bEmptyBack = false;
541 if (bContainsCondFormat)
542 pThisRowInfo->bEmptyBack = false;
543 if (bAutoFilter)
544 pThisRowInfo->bAutoFilter = true;
545 if (bPivotButton || bPivotPopupButton || bPivotPopupButtonMulti)
546 pThisRowInfo->bPivotButton = true;
547 if (bPivotCollapseButton || bPivotExpandButton)
548 pThisRowInfo->bPivotToggle = true;
549
550 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
551 ScBasicCellInfo* pBasicInfo = &pThisRowInfo->basicCellInfo(nCol);
552 pInfo->pBackground = pBackground;
553 pInfo->pPatternAttr = pPattern;
554 pInfo->bMerged = bMerged;
555 pInfo->bHOverlapped = bHOverlapped;
556 pInfo->bVOverlapped = bVOverlapped;
557 pInfo->bAutoFilter = bAutoFilter;
558 pInfo->bPivotButton = bPivotButton;
559 pInfo->bPivotPopupButton = bPivotPopupButton;
560 pInfo->bPivotCollapseButton = bPivotCollapseButton;
561 pInfo->bPivotExpandButton = bPivotExpandButton;
562 pInfo->bPivotPopupButtonMulti = bPivotPopupButtonMulti;
563 pInfo->bFilterActive = bFilterActive;
564 pInfo->pLinesAttr = pLinesAttr;
565 pInfo->mpTLBRLine = pTLBRLine;
566 pInfo->mpBLTRLine = pBLTRLine;
567 pInfo->pShadowAttr = pShadowAttr;
568 // nWidth is no longer set individually
569
570 if (bScenario)
571 {
573 pThisRowInfo->bEmptyBack = false;
574 }
575
576 if (bContainsCondFormat && pCondFormList)
577 {
578 bAnyCondition |= handleConditionalFormat(*pCondFormList, rCondFormats,
579 pInfo, &rTabInfo, pStlPool, ScAddress(nCol, nCurRow, nTab),
580 bHidden, bHideFormula, bTabProtect);
581 }
582
583 if (bHidden || (bFormulaMode && bHideFormula && pInfo->maCell.getType() == CELLTYPE_FORMULA))
584 pBasicInfo->bEmptyCellText = true;
585
586 ++nArrRow;
587 }
588 else if (nLastHiddenRow >= 0)
589 {
590 nCurRow = nLastHiddenRow;
591 if (nCurRow > nThisRow)
592 nCurRow = nThisRow;
593 }
594 ++nCurRow;
595 }
596 while (nCurRow <= nThisRow && nCurRow <= nYExtra);
597 ++nIndex;
598 }
599 while ( nIndex < pThisAttrArr->Count() && nThisRow < nYExtra );
600
601 if (pMarkData && pMarkData->IsMultiMarked())
602 {
603 // Block marks
604 ScMarkArray aThisMarkArr(pMarkData->GetMarkArray( nCol ));
605 nArrRow = 1;
606 nCurRow = nRow1; // single rows
607
608 if ( aThisMarkArr.Search( nRow1, nIndex ) )
609 {
610 do
611 {
612 nThisRow=aThisMarkArr.mvData[nIndex].nRow; // End of range
613
614 do
615 {
616 if ( !RowHidden( nCurRow,nTab ) )
617 {
618 ++nArrRow;
619 }
620 ++nCurRow;
621 }
622 while (nCurRow <= nThisRow && nCurRow <= nRow2);
623 ++nIndex;
624 }
625 while ( nIndex < aThisMarkArr.mvData.size() && nThisRow < nRow2 );
626 }
627 }
628 }
629 else // columns in front
630 {
631 for (nArrRow=1; nArrRow+1<nArrCount; nArrRow++)
632 pRowInfo[nArrRow].basicCellInfo(nCol).nWidth = nThisWidth; //TODO: or check only 0 ??
633 }
634 }
635 }
636 else
637 pRowInfo[0].basicCellInfo(nCol).nWidth = STD_COL_WIDTH;
638 // STD_COL_WIDTH farthest to the left and right is needed for DrawExtraShadow
639 }
640
641 if (pCondFormList)
642 pCondFormList->endRendering();
643
644 // evaluate conditional formatting
645 std::vector< std::unique_ptr<ScPatternAttr> > aAltPatterns;
646 // favour preview over condition
647 if (bAnyCondition || bAnyPreview)
648 {
649 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
650 {
651 for (SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++) // 1 more left and right
652 {
653 ScCellInfo* pInfo = &pRowInfo[nArrRow].cellInfo(nCol);
654 ScPatternAttr* pModifiedPatt = nullptr;
655
656 if ( ValidCol(nCol) && pRowInfo[nArrRow].nRowNo <= MaxRow() )
657 {
658 if ( ScStyleSheet* pPreviewStyle = GetPreviewCellStyle( nCol, pRowInfo[nArrRow].nRowNo, nTab ) )
659 {
660 aAltPatterns.push_back( std::make_unique<ScPatternAttr>( *pInfo->pPatternAttr ) );
661 pModifiedPatt = aAltPatterns.back().get();
662 pModifiedPatt->SetStyleSheet( pPreviewStyle );
663 }
664 }
665 // favour preview over condition
666 const SfxItemSet* pCondSet = pModifiedPatt ? &pModifiedPatt->GetItemSet() : pInfo->pConditionSet;
667
668 if (pCondSet)
669 {
670 // Background
671 if ( const SvxBrushItem* pItem = pCondSet->GetItemIfSet( ATTR_BACKGROUND ) )
672 {
673 pInfo->pBackground = pItem;
674 pRowInfo[nArrRow].bEmptyBack = false;
675 }
676
677 // Border
678 if ( const SvxBoxItem* pItem = pCondSet->GetItemIfSet( ATTR_BORDER ) )
679 pInfo->pLinesAttr = pItem;
680
681 if ( const SvxLineItem* pItem = pCondSet->GetItemIfSet( ATTR_BORDER_TLBR ) )
682 pInfo->mpTLBRLine = pItem;
683 if ( const SvxLineItem* pItem = pCondSet->GetItemIfSet( ATTR_BORDER_BLTR ) )
684 pInfo->mpBLTRLine = pItem;
685
686 // Shadow
687 if ( const SvxShadowItem* pItem = pCondSet->GetItemIfSet( ATTR_SHADOW ) )
688 {
689 pInfo->pShadowAttr = pItem;
690 bAnyShadow = true;
691 }
692 }
693 if( bAnyCondition && pInfo->mxColorScale)
694 {
695 pRowInfo[nArrRow].bEmptyBack = false;
696 pInfo->pBackground = &pPool->Put(SvxBrushItem(*pInfo->mxColorScale, ATTR_BACKGROUND));
697 }
698 }
699 }
700 }
701
702 // End conditional formatting
703
704 // Adjust data from merged cells
705
706 if (bAnyMerged)
707 {
708 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
709 {
710 RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
711 SCROW nSignedY = nArrRow ? pThisRowInfo->nRowNo : nRow1-1;
712
713 for (SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++) // 1 more left and right
714 {
715 ScCellInfo* pInfo = &pThisRowInfo->cellInfo(nCol);
716
717 if (pInfo->bMerged || pInfo->bHOverlapped || pInfo->bVOverlapped)
718 {
719 SCCOL nStartX;
720 SCROW nStartY;
721 SCCOL nEndX;
722 SCROW nEndY;
723 lcl_GetMergeRange( nCol,nSignedY, nArrRow, this,pRowInfo, nCol1,nRow1,nTab,
724 nStartX,nStartY, nEndX,nEndY );
725 const ScPatternAttr* pStartPattern = GetPattern( nStartX,nStartY,nTab );
726 const SfxItemSet* pStartCond = GetCondResult( nStartX,nStartY,nTab );
727
728 // Copy Background (or in output.cxx)
729
730 const SvxBrushItem* pBrushItem = nullptr;
731 if ( !pStartCond ||
732 !(pBrushItem = pStartCond->GetItemIfSet(ATTR_BACKGROUND)) )
733 pBrushItem = &pStartPattern->GetItem(ATTR_BACKGROUND);
734 pInfo->pBackground = pBrushItem;
735 pRowInfo[nArrRow].bEmptyBack = false;
736
737 // Shadow
738
739 const SvxShadowItem* pShadowItem = nullptr;
740 if ( !pStartCond ||
741 !(pShadowItem = pStartCond->GetItemIfSet(ATTR_SHADOW)) )
742 pShadowItem = &pStartPattern->GetItem(ATTR_SHADOW);
743 pInfo->pShadowAttr = pShadowItem;
744 if (pInfo->pShadowAttr != pDefShadow)
745 bAnyShadow = true;
746
747 const ScCondFormatIndexes& rCondFormatIndex
748 = pStartPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
749
750 if (pCondFormList && !pStartCond && !rCondFormatIndex.empty())
751 {
752 for (const auto& rItem : rCondFormatIndex)
753 {
754 const ScConditionalFormat* pCondForm = pCondFormList->GetFormat(rItem);
755 if (pCondForm)
756 {
757 ScCondFormatData aData = pCondForm->GetData(
758 pInfo->maCell, ScAddress(nStartX, nStartY, nTab));
759
760 // Color scale
761 if (aData.mxColorScale && !pInfo->mxColorScale)
762 pInfo->mxColorScale = aData.mxColorScale;
763 }
764 }
765 }
766 }
767 }
768 }
769 }
770
771 if (bAnyShadow) // distribute Shadow
772 {
773 for (nArrRow=0; nArrRow<nArrCount; nArrRow++)
774 {
775 bool bTop = ( nArrRow == 0 );
776 bool bBottom = ( nArrRow+1 == nArrCount );
777
778 for (SCCOL nCol=nCol1-1; nCol<=nCol2+1; nCol++) // 1 more left and right
779 {
780 bool bLeft = ( nCol == nCol1-1 );
781 bool bRight = ( nCol == nCol2+1 );
782
783 ScCellInfo* pInfo = &pRowInfo[nArrRow].cellInfo(nCol);
784 const SvxShadowItem* pThisAttr = pInfo->pShadowAttr;
785 SvxShadowLocation eLoc = pThisAttr ? pThisAttr->GetLocation() : SvxShadowLocation::NONE;
786 if (eLoc != SvxShadowLocation::NONE)
787 {
788 // or test on != eLoc
789
790 SCCOL nDxPos = 1;
791 SCCOL nDxNeg = -1;
792
793 while ( nCol+nDxPos < nCol2+1 && pRowInfo[0].basicCellInfo(nCol+nDxPos).nWidth == 0 )
794 ++nDxPos;
795 while ( nCol+nDxNeg > nCol1-1 && pRowInfo[0].basicCellInfo(nCol+nDxNeg).nWidth == 0 )
796 --nDxNeg;
797
798 bool bLeftDiff = !bLeft &&
799 pRowInfo[nArrRow].cellInfo(nCol+nDxNeg).pShadowAttr->GetLocation() == SvxShadowLocation::NONE;
800 bool bRightDiff = !bRight &&
801 pRowInfo[nArrRow].cellInfo(nCol+nDxPos).pShadowAttr->GetLocation() == SvxShadowLocation::NONE;
802 bool bTopDiff = !bTop &&
803 pRowInfo[nArrRow-1].cellInfo(nCol).pShadowAttr->GetLocation() == SvxShadowLocation::NONE;
804 bool bBottomDiff = !bBottom &&
805 pRowInfo[nArrRow+1].cellInfo(nCol).pShadowAttr->GetLocation() == SvxShadowLocation::NONE;
806
807 if ( bLayoutRTL )
808 {
809 switch (eLoc)
810 {
811 case SvxShadowLocation::BottomRight: eLoc = SvxShadowLocation::BottomLeft; break;
812 case SvxShadowLocation::BottomLeft: eLoc = SvxShadowLocation::BottomRight; break;
813 case SvxShadowLocation::TopRight: eLoc = SvxShadowLocation::TopLeft; break;
814 case SvxShadowLocation::TopLeft: eLoc = SvxShadowLocation::TopRight; break;
815 default:
816 {
817 // added to avoid warnings
818 }
819 }
820 }
821
822 switch (eLoc)
823 {
824 case SvxShadowLocation::BottomRight:
825 if (bBottomDiff)
826 {
827 pRowInfo[nArrRow+1].cellInfo(nCol).pHShadowOrigin = pThisAttr;
828 pRowInfo[nArrRow+1].cellInfo(nCol).eHShadowPart =
829 bLeftDiff ? SC_SHADOW_HSTART : SC_SHADOW_HORIZ;
830 }
831 if (bRightDiff)
832 {
833 pRowInfo[nArrRow].cellInfo(nCol+1).pVShadowOrigin = pThisAttr;
834 pRowInfo[nArrRow].cellInfo(nCol+1).eVShadowPart =
835 bTopDiff ? SC_SHADOW_VSTART : SC_SHADOW_VERT;
836 }
837 if (bBottomDiff && bRightDiff)
838 {
839 pRowInfo[nArrRow+1].cellInfo(nCol+1).pHShadowOrigin = pThisAttr;
840 pRowInfo[nArrRow+1].cellInfo(nCol+1).eHShadowPart = SC_SHADOW_CORNER;
841 }
842 break;
843
844 case SvxShadowLocation::BottomLeft:
845 if (bBottomDiff)
846 {
847 pRowInfo[nArrRow+1].cellInfo(nCol).pHShadowOrigin = pThisAttr;
848 pRowInfo[nArrRow+1].cellInfo(nCol).eHShadowPart =
849 bRightDiff ? SC_SHADOW_HSTART : SC_SHADOW_HORIZ;
850 }
851 if (bLeftDiff)
852 {
853 pRowInfo[nArrRow].cellInfo(nCol-1).pVShadowOrigin = pThisAttr;
854 pRowInfo[nArrRow].cellInfo(nCol-1).eVShadowPart =
855 bTopDiff ? SC_SHADOW_VSTART : SC_SHADOW_VERT;
856 }
857 if (bBottomDiff && bLeftDiff)
858 {
859 pRowInfo[nArrRow+1].cellInfo(nCol-1).pHShadowOrigin = pThisAttr;
860 pRowInfo[nArrRow+1].cellInfo(nCol-1).eHShadowPart = SC_SHADOW_CORNER;
861 }
862 break;
863
864 case SvxShadowLocation::TopRight:
865 if (bTopDiff)
866 {
867 pRowInfo[nArrRow-1].cellInfo(nCol).pHShadowOrigin = pThisAttr;
868 pRowInfo[nArrRow-1].cellInfo(nCol).eHShadowPart =
869 bLeftDiff ? SC_SHADOW_HSTART : SC_SHADOW_HORIZ;
870 }
871 if (bRightDiff)
872 {
873 pRowInfo[nArrRow].cellInfo(nCol+1).pVShadowOrigin = pThisAttr;
874 pRowInfo[nArrRow].cellInfo(nCol+1).eVShadowPart =
875 bBottomDiff ? SC_SHADOW_VSTART : SC_SHADOW_VERT;
876 }
877 if (bTopDiff && bRightDiff)
878 {
879 pRowInfo[nArrRow-1].cellInfo(nCol+1).pHShadowOrigin = pThisAttr;
880 pRowInfo[nArrRow-1].cellInfo(nCol+1).eHShadowPart = SC_SHADOW_CORNER;
881 }
882 break;
883
884 case SvxShadowLocation::TopLeft:
885 if (bTopDiff)
886 {
887 pRowInfo[nArrRow-1].cellInfo(nCol).pHShadowOrigin = pThisAttr;
888 pRowInfo[nArrRow-1].cellInfo(nCol).eHShadowPart =
889 bRightDiff ? SC_SHADOW_HSTART : SC_SHADOW_HORIZ;
890 }
891 if (bLeftDiff)
892 {
893 pRowInfo[nArrRow].cellInfo(nCol-1).pVShadowOrigin = pThisAttr;
894 pRowInfo[nArrRow].cellInfo(nCol-1).eVShadowPart =
895 bBottomDiff ? SC_SHADOW_VSTART : SC_SHADOW_VERT;
896 }
897 if (bTopDiff && bLeftDiff)
898 {
899 pRowInfo[nArrRow-1].cellInfo(nCol-1).pHShadowOrigin = pThisAttr;
900 pRowInfo[nArrRow-1].cellInfo(nCol-1).eHShadowPart = SC_SHADOW_CORNER;
901 }
902 break;
903
904 default:
905 OSL_FAIL("wrong Shadow-Enum");
906 }
907 }
908 }
909 }
910 }
911
912 rTabInfo.mnArrCount = sal::static_int_cast<sal_uInt16>(nArrCount);
913 rTabInfo.mbPageMode = bPageMode;
914
915 // *** create the frame border array ***
916
917 // RowInfo structs are filled in the range [ 0 , nArrCount-1 ],
918 // each RowInfo contains ScCellInfo structs in the range [ nCol1-1 , nCol2+1 ]
919 // and ScBasicCellInfo structs in the range [ -1, nCol2+1 ]
920
921 size_t nColCount = nCol2 - nCol1 + 1 + 2;
922 size_t nRowCount = nArrCount;
923
924 svx::frame::Array& rArray = rTabInfo.maArray;
925 rArray.Initialize( nColCount, nRowCount );
926
927 for( size_t nRow = 0; nRow < nRowCount; ++nRow )
928 {
929 sal_uInt16 nCellInfoY = static_cast< sal_uInt16 >( nRow );
930 RowInfo& rThisRowInfo = pRowInfo[ nCellInfoY ];
931
932 for( SCCOL nCol = nCol1 - 1; nCol <= nCol2 + 1; ++nCol ) // 1 more left and right
933 {
934 const ScCellInfo& rInfo = rThisRowInfo.cellInfo( nCol );
935 const SvxBoxItem* pBox = rInfo.pLinesAttr;
936 const SvxLineItem* pTLBR = rInfo.mpTLBRLine;
937 const SvxLineItem* pBLTR = rInfo.mpBLTRLine;
938
939 size_t colToIndex = -(nCol1 - 1);
940 // These are rArray indexes (0-based), not really rows/columns.
941 size_t nX = nCol + colToIndex;
942 size_t nFirstCol = nX;
943 size_t nFirstRow = nRow;
944
945 // *** merged cells *** -------------------------------------------
946
947 if( !rArray.IsMerged( nX, nRow ) && (rInfo.bMerged || rInfo.bHOverlapped || rInfo.bVOverlapped) )
948 {
949 // *** insert merged range in svx::frame::Array ***
950
951 /* #i69369# top-left cell of a merged range may be located in
952 a hidden column or row. Use lcl_GetMergeRange() to find the
953 complete merged range, then calculate dimensions and
954 document position of the visible range. */
955
956 // note: document rows must be looked up in RowInfo structs
957
958 // current column and row in document coordinates
959 SCCOL nCurrDocCol = nCol;
960 SCROW nCurrDocRow = static_cast< SCROW >( (nCellInfoY > 0) ? rThisRowInfo.nRowNo : (nRow1 - 1) );
961
962 // find entire merged range in document, returns signed document coordinates
963 SCCOL nFirstRealDocColS, nLastRealDocColS;
964 SCROW nFirstRealDocRowS, nLastRealDocRowS;
965 lcl_GetMergeRange( nCurrDocCol, nCurrDocRow,
966 nCellInfoY, this, pRowInfo, nCol1,nRow1,nTab,
967 nFirstRealDocColS, nFirstRealDocRowS, nLastRealDocColS, nLastRealDocRowS );
968
969 // *complete* merged range in document coordinates
970 SCCOL nFirstRealDocCol = nFirstRealDocColS;
971 SCROW nFirstRealDocRow = nFirstRealDocRowS;
972 SCCOL nLastRealDocCol = nLastRealDocColS;
973 SCROW nLastRealDocRow = nLastRealDocRowS;
974
975 // first visible column (nCol1-1 is first processed document column)
976 SCCOL nFirstDocCol = (nCol1 > 0) ? ::std::max< SCCOL >( nFirstRealDocCol, nCol1 - 1 ) : nFirstRealDocCol;
977 nFirstCol = nFirstDocCol + colToIndex;
978
979 // last visible column (nCol2+1 is last processed document column)
980 SCCOL nLastDocCol = (nCol2 < MaxCol()) ? ::std::min< SCCOL >( nLastRealDocCol, nCol2 + 1 ) : nLastRealDocCol;
981 size_t nLastCol = nLastDocCol + colToIndex;
982
983 // first visible row
984 sal_uInt16 nFirstCellInfoY = nCellInfoY;
985 while( ((nFirstCellInfoY > 1) && (pRowInfo[ nFirstCellInfoY - 1 ].nRowNo >= nFirstRealDocRow)) ||
986 ((nFirstCellInfoY == 1) && (static_cast< SCROW >( nRow1 - 1 ) >= nFirstRealDocRow)) )
987 --nFirstCellInfoY;
988 SCROW nFirstDocRow = (nFirstCellInfoY > 0) ? pRowInfo[ nFirstCellInfoY ].nRowNo : static_cast< SCROW >( nRow1 - 1 );
989 nFirstRow = static_cast< size_t >( nFirstCellInfoY );
990
991 // last visible row
992 sal_uInt16 nLastCellInfoY = nCellInfoY;
993 while( (sal::static_int_cast<SCSIZE>(nLastCellInfoY + 1) < nArrCount) &&
994 (pRowInfo[ nLastCellInfoY + 1 ].nRowNo <= nLastRealDocRow) )
995 ++nLastCellInfoY;
996 SCROW nLastDocRow = (nLastCellInfoY > 0) ? pRowInfo[ nLastCellInfoY ].nRowNo : static_cast< SCROW >( nRow1 - 1 );
997 size_t nLastRow = static_cast< size_t >( nLastCellInfoY );
998
999 // insert merged range
1000 rArray.SetMergedRange( nFirstCol, nFirstRow, nLastCol, nLastRow );
1001
1002 // *** find additional size not included in svx::frame::Array ***
1003
1004 // additional space before first column
1005 if( nFirstCol == 0 )
1006 {
1007 tools::Long nSize = 0;
1008 for( SCCOL nDocCol = nFirstRealDocCol; nDocCol < nFirstDocCol; ++nDocCol )
1009 nSize += std::max( tools::Long(GetColWidth( nDocCol, nTab ) * fColScale), tools::Long(1) );
1010 rArray.SetAddMergedLeftSize( nX, nRow, nSize );
1011 }
1012 // additional space after last column
1013 if( nLastCol + 1 == nColCount )
1014 {
1015 tools::Long nSize = 0;
1016 for( SCCOL nDocCol = nLastDocCol + 1; nDocCol <= nLastRealDocCol; ++nDocCol )
1017 nSize += std::max( tools::Long(GetColWidth( nDocCol, nTab ) * fColScale), tools::Long(1) );
1018 rArray.SetAddMergedRightSize( nX, nRow, nSize );
1019 }
1020 // additional space above first row
1021 if( nFirstRow == 0 )
1022 {
1023 tools::Long nSize = 0;
1024 for( SCROW nDocRow = nFirstRealDocRow; nDocRow < nFirstDocRow; ++nDocRow )
1025 nSize += std::max( tools::Long(GetRowHeight( nDocRow, nTab ) * fRowScale), tools::Long(1) );
1026 rArray.SetAddMergedTopSize( nX, nRow, nSize );
1027 }
1028 // additional space beyond last row
1029 if( nLastRow + 1 == nRowCount )
1030 {
1031 tools::Long nSize = 0;
1032 for( SCROW nDocRow = nLastDocRow + 1; nDocRow <= nLastRealDocRow; ++nDocRow )
1033 nSize += std::max( tools::Long(GetRowHeight( nDocRow, nTab ) * fRowScale), tools::Long(1) );
1034 rArray.SetAddMergedBottomSize( nX, nRow, nSize );
1035 }
1036
1037 // *** use line attributes from real origin cell ***
1038
1039 if( (nFirstRealDocCol != nCurrDocCol) || (nFirstRealDocRow != nCurrDocRow) )
1040 {
1041 if( const ScPatternAttr* pPattern = GetPattern( nFirstRealDocCol, nFirstRealDocRow, nTab ) )
1042 {
1043 const SfxItemSet* pCond = GetCondResult( nFirstRealDocCol, nFirstRealDocRow, nTab );
1044 pBox = &pPattern->GetItem( ATTR_BORDER, pCond );
1045 pTLBR = &pPattern->GetItem( ATTR_BORDER_TLBR, pCond );
1046 pBLTR = &pPattern->GetItem( ATTR_BORDER_BLTR, pCond );
1047 }
1048 else
1049 {
1050 pBox = nullptr;
1051 pTLBR = pBLTR = nullptr;
1052 }
1053 }
1054 }
1055
1056 // *** borders *** ------------------------------------------------
1057
1058 if( pBox )
1059 {
1060 rArray.SetCellStyleLeft( nFirstCol, nFirstRow, svx::frame::Style( pBox->GetLeft(), fColScale ) );
1061 rArray.SetCellStyleRight( nFirstCol, nFirstRow, svx::frame::Style( pBox->GetRight(), fColScale ) );
1062 rArray.SetCellStyleTop( nFirstCol, nFirstRow, svx::frame::Style( pBox->GetTop(), fRowScale ) );
1063 rArray.SetCellStyleBottom( nFirstCol, nFirstRow, svx::frame::Style( pBox->GetBottom(), fRowScale ) );
1064 }
1065
1066 if( pTLBR )
1067 rArray.SetCellStyleTLBR( nFirstCol, nFirstRow, svx::frame::Style( pTLBR->GetLine(), fRowScale ) );
1068 if( pBLTR )
1069 rArray.SetCellStyleBLTR( nFirstCol, nFirstRow, svx::frame::Style( pBLTR->GetLine(), fRowScale ) );
1070 }
1071 }
1072
1073 /* Mirror the entire frame array. */
1074 if( bLayoutRTL )
1075 rArray.MirrorSelfX();
1076}
1077
1079 : mpRowInfo(new RowInfo[capacity])
1080 , mnArrCount(0)
1081 , mnArrCapacity(capacity)
1082 , mbPageMode(false)
1083{
1084 memset(static_cast<void*>(mpRowInfo.get()), 0, mnArrCapacity * sizeof(RowInfo));
1085}
1086
1088{
1089 for( SCSIZE nIdx = 0; nIdx < mnArrCapacity; ++nIdx )
1090 mpRowInfo[ nIdx ].freeCellInfo();
1091}
1092
1093/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
ScMF
Definition: attrib.hxx:34
@ DpCollapse
dp table output
@ DpExpand
dp compact layout collapse button
@ HiddenMember
dp button with popup arrow
@ Scenario
field button for datapilot
@ Button
autofilter arrow
@ ButtonPopup
@ ButtonPopup2
dp compact layout expand button
bool Search(SCROW nRow, SCSIZE &nIndex) const
Definition: attarray.cxx:194
SCSIZE Count() const
Definition: attarray.hxx:226
std::vector< ScAttrEntry > mvData
Definition: attarray.hxx:98
std::unique_ptr< ScAttrArray > pAttrArray
Definition: column.hxx:118
sc::CellStoreType maCells
Definition: column.hxx:197
ScConditionalFormat * GetFormat(sal_uInt32 nKey)
Definition: conditio.cxx:2098
ScCondFormatData GetData(ScRefCellValue &rCell, const ScAddress &rPos) const
Definition: conditio.cxx:1832
SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const
Definition: documen3.cxx:2139
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
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6045
bool ValidRow(SCROW nRow) const
Definition: document.hxx:900
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1905
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
rtl::Reference< ScPoolHelper > mxPoolHelper
Definition: document.hxx:358
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
sal_uInt16 GetSheetOptimalMinRowHeight(SCTAB nTab) const
Definition: document.cxx:928
TableContainer maTabs
Definition: document.hxx:378
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5161
bool ValidCol(SCCOL nCol) const
Definition: document.hxx:899
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:860
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4430
ScStyleSheet * GetPreviewCellStyle()
Definition: document.hxx:1394
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:974
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4684
void FindMaxRotCol(SCTAB nTab, RowInfo *pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2) const
Definition: document.cxx:5228
SC_DLLPUBLIC const SfxItemSet * GetCondResult(SCCOL nCol, SCROW nRow, SCTAB nTab, ScRefCellValue *pCell=nullptr) const
Definition: documen4.cxx:791
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4719
static SvxBrushItem * GetButtonBrushItem()
Definition: global.cxx:441
This is a rather odd datastructure.
Definition: markarr.hxx:44
std::vector< ScMarkEntry > mvData
Definition: markarr.hxx:46
bool Search(SCROW nRow, SCSIZE &nIndex) const
Definition: markarr.cxx:58
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
bool IsMultiMarked() const
Definition: markdata.hxx:81
ScMarkArray GetMarkArray(SCCOL nCol) const
Definition: markdata.hxx:107
SCCOL GetColMerge() const
Definition: attrib.hxx:71
SCROW GetRowMerge() const
Definition: attrib.hxx:72
void SetStyleSheet(ScStyleSheet *pNewStyle, bool bClearDirectFormat=true)
Definition: patattr.cxx:1306
SfxItemSet & GetItemSet()
Definition: patattr.hxx:192
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
bool GetHideFormula() const
Definition: attrib.hxx:150
bool GetHideCell() const
Definition: attrib.hxx:152
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
const T & Put(std::unique_ptr< T > xItem, sal_uInt16 nWhich=0)
sal_uInt32 GetItemCount2(sal_uInt16 nWhich) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
const editeng::SvxBorderLine * GetTop() const
const editeng::SvxBorderLine * GetRight() const
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
const editeng::SvxBorderLine * GetLine() const
SvxShadowLocation GetLocation() const
bool empty() const
void SetAddMergedLeftSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
bool IsMerged(sal_Int32 nCol, sal_Int32 nRow) const
void SetMergedRange(sal_Int32 nFirstCol, sal_Int32 nFirstRow, sal_Int32 nLastCol, sal_Int32 nLastRow)
void SetCellStyleBottom(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetAddMergedBottomSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void SetCellStyleTLBR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleLeft(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleRight(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetAddMergedRightSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void Initialize(sal_Int32 nWidth, sal_Int32 nHeight)
void SetAddMergedTopSize(sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nAddSize)
void SetCellStyleBLTR(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
void SetCellStyleTop(sal_Int32 nCol, sal_Int32 nRow, const Style &rStyle)
sal_Int32 mnCol
static void lcl_GetMergeRange(SCCOL nX, SCROW nY, SCSIZE nArrY, const ScDocument *pDoc, RowInfo *pRowInfo, SCCOL nX1, SCROW nY1, SCTAB nTab, SCCOL &rStartX, SCROW &rStartY, SCCOL &rEndX, SCROW &rEndY)
Definition: fillinfo.cxx:51
const SCCOL SC_ROTMAX_NONE
Definition: fillinfo.hxx:189
@ SC_SHADOW_VSTART
Definition: fillinfo.hxx:56
@ SC_SHADOW_VERT
Definition: fillinfo.hxx:58
@ SC_SHADOW_CORNER
Definition: fillinfo.hxx:59
@ SC_SHADOW_HSTART
Definition: fillinfo.hxx:55
@ SC_SHADOW_HORIZ
Definition: fillinfo.hxx:57
@ CELLTYPE_FORMULA
Definition: global.hxx:276
constexpr sal_Int32 STD_COL_WIDTH
Definition: global.hxx:87
sal_Int32 nIndex
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
constexpr OUStringLiteral aData
CellStoreType::const_iterator ParseAllNonEmpty(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
Definition: mtvcellfunc.hxx:95
long Long
constexpr TypedWhichId< ScMergeFlagAttr > ATTR_MERGE_FLAG(145)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< ScMergeAttr > ATTR_MERGE(144)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
bool bEmptyBack
Definition: fillinfo.hxx:242
bool bPivotButton
Definition: fillinfo.hxx:244
SCROW nRowNo
Definition: fillinfo.hxx:239
SCCOL nRotMaxCol
Definition: fillinfo.hxx:240
bool bAutoFilter
Definition: fillinfo.hxx:243
bool bPivotToggle
Definition: fillinfo.hxx:246
ScCellInfo & cellInfo(SCCOL nCol)
Definition: fillinfo.hxx:197
ScBasicCellInfo & basicCellInfo(SCCOL nCol)
Definition: fillinfo.hxx:210
void allocCellInfo(SCCOL startCol, SCCOL endCol)
Definition: fillinfo.hxx:223
sal_uInt16 nHeight
Definition: fillinfo.hxx:238
bool bChanged
Definition: fillinfo.hxx:245
sal_uInt16 nWidth
Definition: fillinfo.hxx:110
const SvxShadowItem * pVShadowOrigin
Definition: fillinfo.hxx:168
const SfxItemSet * pConditionSet
Definition: fillinfo.hxx:154
const SvxShadowItem * pHShadowOrigin
Definition: fillinfo.hxx:167
ScShadowPart eVShadowPart
Definition: fillinfo.hxx:171
ScRefCellValue maCell
Definition: fillinfo.hxx:151
bool bPivotPopupButton
Definition: fillinfo.hxx:180
std::optional< Color > mxColorScale
Definition: fillinfo.hxx:155
bool bVOverlapped
Definition: fillinfo.hxx:177
const SvxShadowItem * pShadowAttr
original item from document.
Definition: fillinfo.hxx:165
const SvxLineItem * mpBLTRLine
original item from document.
Definition: fillinfo.hxx:163
const SvxBoxItem * pLinesAttr
Definition: fillinfo.hxx:161
bool bFilterActive
Definition: fillinfo.hxx:181
const SvxLineItem * mpTLBRLine
original item from document.
Definition: fillinfo.hxx:162
const ScPatternAttr * pPatternAttr
Definition: fillinfo.hxx:153
ScShadowPart eHShadowPart
Definition: fillinfo.hxx:170
bool bPivotButton
Definition: fillinfo.hxx:179
bool bPivotCollapseButton
Definition: fillinfo.hxx:184
bool bPivotPopupButtonMulti
Definition: fillinfo.hxx:186
bool bHOverlapped
Definition: fillinfo.hxx:176
const ScDataBarInfo * pDataBar
Definition: fillinfo.hxx:156
bool bAutoFilter
Definition: fillinfo.hxx:178
const SvxBrushItem * pBackground
Definition: fillinfo.hxx:159
const ScIconSetInfo * pIconSet
Definition: fillinfo.hxx:157
bool bMerged
Definition: fillinfo.hxx:175
bool bPivotExpandButton
Definition: fillinfo.hxx:185
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:108
CellType getType() const
Definition: cellvalue.hxx:133
SCSIZE mnArrCapacity
Definition: fillinfo.hxx:268
void addIconSetInfo(std::unique_ptr< const ScIconSetInfo > info)
Definition: fillinfo.hxx:280
ScTableInfo(const SCSIZE capacity=1024)
Definition: fillinfo.cxx:1078
SCSIZE mnArrCount
Definition: fillinfo.hxx:267
std::unique_ptr< RowInfo[]> mpRowInfo
Definition: fillinfo.hxx:266
void addDataBarInfo(std::unique_ptr< const ScDataBarInfo > info)
Definition: fillinfo.hxx:276
svx::frame::Array maArray
Definition: fillinfo.hxx:264
bool mbPageMode
Definition: fillinfo.hxx:269
SvxShadowLocation
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
Count