LibreOffice Module sc (master) 1
table5.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 <scitems.hxx>
21#include <attrib.hxx>
22#include <formulacell.hxx>
23#include <table.hxx>
24#include <column.hxx>
25#include <document.hxx>
26#include <drwlayer.hxx>
27#include <global.hxx>
28#include <stlpool.hxx>
29#include <tabprotection.hxx>
30#include <globstr.hrc>
31#include <scresid.hxx>
32#include <segmenttree.hxx>
33#include <columniterator.hxx>
34#include <globalnames.hxx>
35#include <scmod.hxx>
36#include <printopt.hxx>
37#include <bcaslot.hxx>
38#include <compressedarray.hxx>
39#include <userdat.hxx>
40#include <conditio.hxx>
41#include <colorscale.hxx>
42#include <cellform.hxx>
43
44#include <com/sun/star/sheet/TablePageBreakData.hpp>
45
46#include <editeng/brushitem.hxx>
47#include <editeng/colritem.hxx>
48#include <osl/diagnose.h>
49#include <svl/numformat.hxx>
50#include <svl/zformat.hxx>
51
52#include <algorithm>
53#include <limits>
54
55using ::com::sun::star::uno::Sequence;
56using ::com::sun::star::sheet::TablePageBreakData;
57using ::std::set;
58
59void ScTable::UpdatePageBreaks(const ScRange* pUserArea)
60{
62 return;
63
64 // pUserArea != NULL -> print area is specified. We need to force-update
65 // the page breaks.
66
67 if (!pUserArea)
68 {
69 if (!bPageSizeValid)
70 return;
71
72 // Always update breaks if force breaks option has changed
73 if (mbPageBreaksValid && mbForceBreaks == SC_MOD()->GetPrintOptions().GetForceBreaks())
74 return;
75 }
76
77 SfxStyleSheetBase* pStyle
78 = rDocument.GetStyleSheetPool()->Find(aPageStyle, SfxStyleFamily::Page);
79 if (!pStyle)
80 {
81 OSL_FAIL("UpdatePageBreaks: Style not found");
82 return;
83 }
84 SfxItemSet* pStyleSet = &pStyle->GetItemSet();
85
86 SCCOL nStartCol = 0;
87 SCROW nStartRow = 0;
88 SCCOL nEndCol = rDocument.MaxCol();
89 SCROW nEndRow = rDocument.MaxRow();
90 if (pUserArea)
91 {
92 nStartCol = pUserArea->aStart.Col();
93 nStartRow = pUserArea->aStart.Row();
94 nEndCol = pUserArea->aEnd.Col();
95 nEndRow = pUserArea->aEnd.Row();
96 }
97 else
98 {
99 sal_uInt16 nAreaCount = GetPrintRangeCount();
100 if (nAreaCount > 1)
101 {
102 // Show nothing, when multiple ranges
103
104 for (SCCOL nX : GetColumnsRange(0, rDocument.MaxCol()))
105 RemoveColBreak(nX, true, false);
106
108
109 return;
110 }
111 else if (nAreaCount == 1)
112 {
113 const ScRange* pArea = GetPrintRange(0);
114 if (pArea)
115 {
116 nStartCol = pArea->aStart.Col();
117 nStartRow = pArea->aStart.Row();
118 nEndCol = pArea->aEnd.Col();
119 nEndRow = pArea->aEnd.Row();
120 }
121 } // otherwise show everything
122 }
123
124 // get bSkipColBreaks/bSkipRowBreaks flags:
125 // fdo#40788 - print range scale settings can cause manual breaks to be
126 // ignored (see below). This behaviour may now be set by the user.
127 mbForceBreaks = SC_MOD()->GetPrintOptions().GetForceBreaks();
128 bool bSkipColBreaks = false;
129 bool bSkipRowBreaks = false;
130
131 if (!mbForceBreaks)
132 {
133 if (const SfxUInt16Item* pItem = pStyleSet->GetItemIfSet(ATTR_PAGE_SCALETOPAGES, false))
134 {
135 bSkipColBreaks = bSkipRowBreaks = pItem->GetValue() > 0;
136 }
137
138 const ScPageScaleToItem* pScaleToItem;
139 if (!bSkipColBreaks && (pScaleToItem = pStyleSet->GetItemIfSet(ATTR_PAGE_SCALETO, false)))
140 {
141 // #i54993# when fitting to width or height, ignore only manual breaks in that direction
142 if (pScaleToItem->GetWidth() > 0)
143 bSkipColBreaks = true;
144 if (pScaleToItem->GetHeight() > 0)
145 bSkipRowBreaks = true;
146 }
147 }
148
149 tools::Long nPageSizeX = aPageSizeTwips.Width();
150 tools::Long nPageSizeY = aPageSizeTwips.Height();
151
152 // Beginning: Remove breaks
153
154 for (SCCOL nX : GetColumnsRange(0, nStartCol - 1))
155 RemoveColBreak(nX, true, false);
156 RemoveRowPageBreaks(0, nStartRow - 1);
157
158 if (nStartCol > 0)
159 SetColBreak(nStartCol, true, false); // AREABREAK
160 if (nStartRow > 0)
161 SetRowBreak(nStartRow, true, false); // AREABREAK
162
163 // Middle part: Distribute breaks
164
165 bool bRepeatCol = (nRepeatStartX != SCCOL_REPEAT_NONE);
166 bool bColFound = false;
167 tools::Long nSizeX = 0;
168 for (SCCOL nX = nStartCol; nX <= nEndCol; nX++)
169 {
170 bool bStartOfPage = false;
171 tools::Long nThisX = ColHidden(nX) ? 0 : mpColWidth->GetValue(nX);
172 bool bManualBreak = HasColManualBreak(nX);
173 if ((nSizeX + nThisX > nPageSizeX) || (bManualBreak && !bSkipColBreaks))
174 {
175 SetColBreak(nX, true, false);
176 nSizeX = 0;
177 bStartOfPage = true;
178 }
179 else if (nX != nStartCol)
180 RemoveColBreak(nX, true, false);
181 else
182 bStartOfPage = true;
183
184 if (bStartOfPage && bRepeatCol && nX > nRepeatStartX && !bColFound)
185 {
186 // subtract size of repeat columns from page size
187 for (SCCOL i = nRepeatStartX; i <= nRepeatEndX; i++)
188 nPageSizeX -= ColHidden(i) ? 0 : mpColWidth->GetValue(i);
189 while (nX <= nRepeatEndX)
190 RemoveColBreak(++nX, true, false);
191 bColFound = true;
192 }
193
194 nSizeX += nThisX;
195 }
196
197 // Remove all page breaks in range.
198 RemoveRowPageBreaks(nStartRow + 1, nEndRow);
199
200 // And set new page breaks.
201 bool bRepeatRow = (nRepeatStartY != SCROW_REPEAT_NONE);
202 bool bRowFound = false;
203 tools::Long nSizeY = 0;
206 SCROW nNextManualBreak = GetNextManualBreak(nStartRow); // -1 => no more manual breaks
207 for (SCROW nY = nStartRow; nY <= nEndRow; ++nY)
208 {
209 bool bStartOfPage = false;
210 bool bThisRowHidden = false;
211 const bool bHasValue = aIterHidden.getValue(nY, bThisRowHidden);
212 assert(bHasValue);
213 (void)bHasValue;
214 tools::Long nThisY = 0;
215 if (!bThisRowHidden)
216 {
217 sal_uInt16 nTmp;
218 const bool bHasHeight = aIterHeights.getValue(nY, nTmp);
219 assert(bHasHeight);
220 if (bHasHeight)
221 nThisY = static_cast<tools::Long>(nTmp);
222 }
223
224 bool bManualBreak = false;
225 if (nNextManualBreak >= 0)
226 {
227 bManualBreak = (nY == nNextManualBreak);
228 if (nY >= nNextManualBreak)
229 // Query the next manual break position.
230 nNextManualBreak = GetNextManualBreak(nY + 1);
231 }
232
233 if ((nSizeY + nThisY > nPageSizeY) || (bManualBreak && !bSkipRowBreaks))
234 {
235 SetRowBreak(nY, true, false);
236 nSizeY = 0;
237 bStartOfPage = true;
238 }
239 else if (nY != nStartRow)
240 ; // page break already removed
241 else
242 bStartOfPage = true;
243
244 if (bStartOfPage && bRepeatRow && nY > nRepeatStartY && !bRowFound)
245 {
246 // subtract size of repeat rows from page size
248#if OSL_DEBUG_LEVEL > 0
249 if (nHeights == ::std::numeric_limits<tools::Long>::max())
250 OSL_FAIL("ScTable::UpdatePageBreaks: row heights overflow");
251#endif
252 nPageSizeY -= nHeights;
253 if (nY <= nRepeatEndY)
255 bRowFound = true;
256 }
257
258 if (bThisRowHidden)
259 {
260 // Hidden row range. Skip them unless there is a manual break.
261 SCROW nLastCommon = aIterHidden.getLastPos();
262 if (nNextManualBreak >= 0)
263 nLastCommon = ::std::min(nLastCommon, nNextManualBreak - 1);
264 nY = nLastCommon;
265 }
266 else
267 {
268 // Visible row range.
269
270 SCROW nLastHidden = aIterHidden.getLastPos();
271 SCROW nLastHeight = aIterHeights.getLastPos();
272 SCROW nLastCommon = ::std::min(nLastHidden, nLastHeight);
273 if (nNextManualBreak >= 0)
274 nLastCommon = ::std::min(nLastCommon, nNextManualBreak - 1);
275
276 if (nLastCommon > nY)
277 {
278 tools::Long nMaxMultiple = static_cast<tools::Long>(nLastCommon - nY);
279 tools::Long nMultiple = (nPageSizeY - nSizeY) / nThisY;
280 if (nMultiple > nMaxMultiple)
281 nMultiple = nMaxMultiple;
282 if (nMultiple > 1)
283 {
284 nSizeY += nThisY * (nMultiple - 1);
285 nY += nMultiple - 1;
286 }
287 }
288 }
289
290 nSizeY += nThisY;
291 }
292
293 // End: Remove Break
294
295 if (nEndCol < rDocument.MaxCol())
296 {
297 SetColBreak(nEndCol + 1, true, false); // AREABREAK
298 for (SCCOL nCol : GetColumnsRange(nEndCol + 2, rDocument.MaxCol()))
299 RemoveColBreak(nCol, true, false);
300 }
301 if (nEndRow < rDocument.MaxRow())
302 {
303 SetRowBreak(nEndRow + 1, true, false); // AREABREAK
304 if (nEndRow + 2 <= rDocument.MaxRow())
305 RemoveRowPageBreaks(nEndRow + 2, rDocument.MaxRow());
306 }
308 = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case
309}
310
312{
313 maRowManualBreaks.clear();
314 maColManualBreaks.clear();
316
317 SetStreamValid(false);
318}
319
321{
322 return !maRowManualBreaks.empty() || !maColManualBreaks.empty();
323}
324
325void ScTable::SetRowManualBreaks(::std::set<SCROW>&& rBreaks)
326{
327 maRowManualBreaks = std::move(rBreaks);
329 SetStreamValid(false);
330}
331
332void ScTable::SetColManualBreaks(::std::set<SCCOL>&& rBreaks)
333{
334 maColManualBreaks = std::move(rBreaks);
336 SetStreamValid(false);
337}
338
339void ScTable::GetAllRowBreaks(set<SCROW>& rBreaks, bool bPage, bool bManual) const
340{
341 if (bPage)
342 rBreaks = maRowPageBreaks;
343
344 if (bManual)
345 {
347 inserter(rBreaks, rBreaks.begin()));
348 }
349}
350
351void ScTable::GetAllColBreaks(set<SCCOL>& rBreaks, bool bPage, bool bManual) const
352{
353 if (bPage)
354 rBreaks = maColPageBreaks;
355
356 if (bManual)
357 {
359 inserter(rBreaks, rBreaks.begin()));
360 }
361}
362
364{
365 if (!ValidRow(nRow))
366 return false;
367
368 return maRowPageBreaks.find(nRow) != maRowPageBreaks.end();
369}
370
372{
373 if (!ValidCol(nCol))
374 return false;
375
376 return maColPageBreaks.find(nCol) != maColPageBreaks.end();
377}
378
380{
381 if (!ValidRow(nRow))
382 return false;
383
384 return maRowManualBreaks.find(nRow) != maRowManualBreaks.end();
385}
386
388{
389 if (!ValidCol(nCol))
390 return false;
391
392 return maColManualBreaks.find(nCol) != maColManualBreaks.end();
393}
394
396{
397 set<SCROW>::const_iterator itr = maRowManualBreaks.lower_bound(nRow);
398 return itr == maRowManualBreaks.end() ? -1 : *itr;
399}
400
402{
403 if (!ValidRow(nStartRow) || !ValidRow(nEndRow))
404 return;
405
406 set<SCROW>::iterator low = maRowPageBreaks.lower_bound(nStartRow);
407 set<SCROW>::iterator high = maRowPageBreaks.upper_bound(nEndRow);
408 maRowPageBreaks.erase(low, high);
409}
410
411void ScTable::RemoveRowBreak(SCROW nRow, bool bPage, bool bManual)
412{
413 if (!ValidRow(nRow))
414 return;
415
416 if (bPage)
417 maRowPageBreaks.erase(nRow);
418
419 if (bManual)
420 {
421 maRowManualBreaks.erase(nRow);
423 }
424}
425
426void ScTable::RemoveColBreak(SCCOL nCol, bool bPage, bool bManual)
427{
428 if (!ValidCol(nCol))
429 return;
430
431 if (bPage)
432 maColPageBreaks.erase(nCol);
433
434 if (bManual)
435 {
436 maColManualBreaks.erase(nCol);
438 }
439}
440
441void ScTable::SetRowBreak(SCROW nRow, bool bPage, bool bManual)
442{
443 if (!ValidRow(nRow))
444 return;
445
446 if (bPage)
447 maRowPageBreaks.insert(nRow);
448
449 if (bManual)
450 {
451 maRowManualBreaks.insert(nRow);
453 }
454}
455
456void ScTable::SetColBreak(SCCOL nCol, bool bPage, bool bManual)
457{
458 if (!ValidCol(nCol))
459 return;
460
461 if (bPage)
462 maColPageBreaks.insert(nCol);
463
464 if (bManual)
465 {
466 maColManualBreaks.insert(nCol);
468 }
469}
470
471Sequence<TablePageBreakData> ScTable::GetRowBreakData() const
472{
473 using ::std::inserter;
474
475 set<SCROW> aRowBreaks = maRowPageBreaks;
477 inserter(aRowBreaks, aRowBreaks.begin()));
478
479 Sequence<TablePageBreakData> aSeq(aRowBreaks.size());
480 std::transform(aRowBreaks.begin(), aRowBreaks.end(), aSeq.getArray(), [this](const SCROW nRow) {
481 return TablePageBreakData(nRow, HasRowManualBreak(nRow));
482 });
483
484 return aSeq;
485}
486
487bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
488{
489 if (!ValidRow(nRow))
490 {
491 if (pFirstRow)
492 *pFirstRow = nRow;
493 if (pLastRow)
494 *pLastRow = nRow;
495 return true;
496 }
497
499 if (!mpHiddenRows->getRangeData(nRow, aData))
500 {
501 // search failed.
502 if (pFirstRow)
503 *pFirstRow = nRow;
504 if (pLastRow)
505 *pLastRow = nRow;
506 return true;
507 }
508
509 if (pFirstRow)
510 *pFirstRow = aData.mnRow1;
511 if (pLastRow)
512 *pLastRow = aData.mnRow2;
513
514 return aData.mbValue;
515}
516
517bool ScTable::RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
518{
519 if (!ValidRow(nRow))
520 {
521 if (pFirstRow)
522 *pFirstRow = nRow;
523 if (pLastRow)
524 *pLastRow = nRow;
525 return true;
526 }
527
529 if (!mpHiddenRows->getRangeDataLeaf(nRow, aData))
530 {
531 // search failed.
532 if (pFirstRow)
533 *pFirstRow = nRow;
534 if (pLastRow)
535 *pLastRow = nRow;
536 return true;
537 }
538
539 if (pFirstRow)
540 *pFirstRow = aData.mnRow1;
541 if (pLastRow)
542 *pLastRow = aData.mnRow2;
543
544 return aData.mbValue;
545}
546
547bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
548{
549 SCROW nRow = nStartRow;
550 while (nRow <= nEndRow)
551 {
552 SCROW nLastRow = -1;
553 bool bHidden = RowHidden(nRow, nullptr, &nLastRow);
554 if (bHidden)
555 return true;
556
557 nRow = nLastRow + 1;
558 }
559 return false;
560}
561
562bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
563{
564 if (!ValidCol(nCol))
565 return true;
566
568 if (!mpHiddenCols->getRangeData(nCol, aData))
569 return true;
570
571 if (pFirstCol)
572 *pFirstCol = aData.mnCol1;
573 if (pLastCol)
574 *pLastCol = aData.mnCol2;
575
576 return aData.mbValue;
577}
578
579bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
580{
581 bool bChanged = false;
582 if (bHidden)
583 bChanged = mpHiddenRows->setTrue(nStartRow, nEndRow);
584 else
585 bChanged = mpHiddenRows->setFalse(nStartRow, nEndRow);
586
587 // Cell anchored objects might change visibility
588 ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
589 if (pDrawLayer)
590 {
591 std::vector<SdrObject*> aRowDrawObjects;
592 aRowDrawObjects = pDrawLayer->GetObjectsAnchoredToRows(GetTab(), nStartRow, nEndRow);
593 for (auto aObj : aRowDrawObjects)
594 {
596 if (pData)
597 {
598 if (bHidden)
599 aObj->SetVisible(false);
600 else if (!GetDoc().ColHidden(pData->maStart.Col(), pData->maStart.Tab()))
601 {
602 // Only change visibility if object is not hidden by a hidden col
603 aObj->SetVisible(true);
604 }
605 }
606 }
607 }
608
609 if (bChanged)
610 {
611 SetStreamValid(false);
612
613 { // Scoped bulk broadcast.
614 // Only subtotal formula cells will accept the notification of
615 // SfxHintId::ScHiddenRowsChanged, leaving the bulk will track
616 // those and broadcast SfxHintId::ScDataChanged to notify all
617 // dependents.
618 ScBulkBroadcast aBulkBroadcast(rDocument.GetBASM(), SfxHintId::ScDataChanged);
619 for (SCCOL i = 0; i < aCol.size(); i++)
620 {
621 aCol[i].BroadcastRows(nStartRow, nEndRow, SfxHintId::ScHiddenRowsChanged);
622 }
623 }
624 }
625
626 return bChanged;
627}
628
629void ScTable::SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden)
630{
631 bool bChanged = false;
632 if (bHidden)
633 bChanged = mpHiddenCols->setTrue(nStartCol, nEndCol);
634 else
635 bChanged = mpHiddenCols->setFalse(nStartCol, nEndCol);
636
637 // Cell anchored objects might change visibility
638 ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
639 if (pDrawLayer)
640 {
641 std::vector<SdrObject*> aColDrawObjects;
642 aColDrawObjects = pDrawLayer->GetObjectsAnchoredToCols(GetTab(), nStartCol, nEndCol);
643 for (auto aObj : aColDrawObjects)
644 {
646 if (pData)
647 {
648 if (bHidden)
649 aObj->SetVisible(false);
650 else if (!GetDoc().RowHidden(pData->maStart.Row(), pData->maStart.Tab()))
651 {
652 // Only change visibility if object is not hidden by a hidden row
653 aObj->SetVisible(true);
654 }
655 }
656 }
657 }
658
659 if (bChanged)
660 SetStreamValid(false);
661}
662
663void ScTable::CopyColHidden(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol)
664{
665 SCCOL nCol = nStartCol;
666 while (nCol <= nEndCol)
667 {
668 SCCOL nLastCol = -1;
669 bool bHidden = rTable.ColHidden(nCol, nullptr, &nLastCol);
670 if (nLastCol > nEndCol)
671 nLastCol = nEndCol;
672
673 SetColHidden(nCol, nLastCol, bHidden);
674 nCol = nLastCol + 1;
675 }
676}
677
678void ScTable::CopyRowHidden(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow)
679{
680 SCROW nRow = nStartRow;
681 while (nRow <= nEndRow)
682 {
683 SCROW nLastRow = -1;
684 bool bHidden = rTable.RowHidden(nRow, nullptr, &nLastRow);
685 if (nLastRow > nEndRow)
686 nLastRow = nEndRow;
687 SetRowHidden(nRow, nLastRow, bHidden);
688 nRow = nLastRow + 1;
689 }
690}
691
692void ScTable::CopyRowHeight(const ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow,
693 SCROW nSrcOffset)
694{
695 SCROW nRow = nStartRow;
697 while (nRow <= nEndRow)
698 {
699 if (!rSrcTable.mpRowHeights->getRangeData(nRow + nSrcOffset, aSrcData))
700 // Something is wrong !
701 return;
702
703 SCROW nLastRow = aSrcData.mnRow2 - nSrcOffset;
704 if (nLastRow > nEndRow)
705 nLastRow = nEndRow;
706
707 mpRowHeights->setValue(nRow, nLastRow, aSrcData.mnValue);
708 nRow = nLastRow + 1;
709 }
710}
711
712SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
713{
714 SCROW nRow = nStartRow;
716 while (nRow <= nEndRow)
717 {
718 if (!ValidRow(nRow))
719 break;
720
721 if (!mpHiddenRows->getRangeData(nRow, aData))
722 // failed to get range data.
723 break;
724
725 if (!aData.mbValue)
726 // visible row found
727 return nRow;
728
729 nRow = aData.mnRow2 + 1;
730 }
731
732 return ::std::numeric_limits<SCROW>::max();
733}
734
735SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
736{
737 SCROW nRow = nEndRow;
739 while (nRow >= nStartRow)
740 {
741 if (!ValidRow(nRow))
742 break;
743
744 if (!mpHiddenRows->getRangeData(nRow, aData))
745 // failed to get range data.
746 break;
747
748 if (!aData.mbValue)
749 // visible row found
750 return nRow;
751
752 nRow = aData.mnRow1 - 1;
753 }
754
755 return ::std::numeric_limits<SCROW>::max();
756}
757
759{
760 SCROW nCount = 0;
761 SCROW nRow = nStartRow;
763 while (nRow <= nEndRow)
764 {
765 if (!mpHiddenRows->getRangeData(nRow, aData))
766 break;
767
768 if (aData.mnRow2 > nEndRow)
769 aData.mnRow2 = nEndRow;
770
771 if (!aData.mbValue)
772 nCount += aData.mnRow2 - nRow + 1;
773
774 nRow = aData.mnRow2 + 1;
775 }
776 return nCount;
777}
778
779tools::Long ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero) const
780{
781 tools::Long nHeight = 0;
782 SCROW nRow = nStartRow;
784 while (nRow <= nEndRow)
785 {
786 if (!mpHiddenRows->getRangeData(nRow, aData))
787 break;
788
789 if (aData.mnRow2 > nEndRow)
790 aData.mnRow2 = nEndRow;
791
792 if (!(bHiddenAsZero && aData.mbValue))
793 // visible row range.
794 nHeight += mpRowHeights->getSumValue(nRow, aData.mnRow2);
795
796 nRow = aData.mnRow2 + 1;
797 }
798
799 return nHeight;
800}
801
803{
804 assert(nStartCol <= nEndCol);
805 SCCOL nCount = 0;
806 SCCOL nCol = nStartCol;
808 while (nCol <= nEndCol)
809 {
810 if (!mpHiddenCols->getRangeData(nCol, aData))
811 break;
812
813 if (aData.mnCol2 > nEndCol)
814 aData.mnCol2 = nEndCol;
815
816 if (!aData.mbValue)
817 nCount += aData.mnCol2 - nCol + 1;
818
819 nCol = aData.mnCol2 + 1;
820 }
821 return nCount;
822}
823
825{
826 if (bCol)
827 {
828 SCCOL nCol = static_cast<SCCOL>(nPos);
829 if (ColHidden(nCol))
830 {
831 for (SCCOL i = nCol + 1; i <= rDocument.MaxCol(); ++i)
832 {
833 if (!ColHidden(i))
834 return i - 1;
835 }
836 }
837 }
838 else
839 {
840 SCROW nRow = static_cast<SCROW>(nPos);
841 SCROW nLastRow;
842 if (RowHidden(nRow, nullptr, &nLastRow))
843 return static_cast<SCCOLROW>(nLastRow);
844 }
845 return ::std::numeric_limits<SCCOLROW>::max();
846}
847
848bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
849{
850 if (!ValidRow(nRow))
851 return false;
852
854 if (!mpFilteredRows->getRangeData(nRow, aData))
855 // search failed.
856 return false;
857
858 if (pFirstRow)
859 *pFirstRow = aData.mnRow1;
860 if (pLastRow)
861 *pLastRow = aData.mnRow2;
862
863 return aData.mbValue;
864}
865
866bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
867{
868 if (!ValidCol(nCol))
869 return false;
870
872 if (!mpFilteredCols->getRangeData(nCol, aData))
873 // search failed.
874 return false;
875
876 if (pFirstCol)
877 *pFirstCol = aData.mnCol1;
878 if (pLastCol)
879 *pLastCol = aData.mnCol2;
880
881 return aData.mbValue;
882}
883
884bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
885{
886 SCROW nRow = nStartRow;
887 while (nRow <= nEndRow)
888 {
889 SCROW nLastRow = nRow;
890 bool bFiltered = RowFiltered(nRow, nullptr, &nLastRow);
891 if (bFiltered)
892 return true;
893
894 nRow = nLastRow + 1;
895 }
896 return false;
897}
898
899void ScTable::CopyColFiltered(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol)
900{
901 SCCOL nCol = nStartCol;
902 while (nCol <= nEndCol)
903 {
904 SCCOL nLastCol = -1;
905 bool bFiltered = rTable.ColFiltered(nCol, nullptr, &nLastCol);
906 if (nLastCol > nEndCol)
907 nLastCol = nEndCol;
908
909 SetColFiltered(nCol, nLastCol, bFiltered);
910 nCol = nLastCol + 1;
911 }
912}
913
914void ScTable::CopyRowFiltered(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow)
915{
916 SCROW nRow = nStartRow;
917 while (nRow <= nEndRow)
918 {
919 SCROW nLastRow = -1;
920 bool bFiltered = rTable.RowFiltered(nRow, nullptr, &nLastRow);
921 if (nLastRow > nEndRow)
922 nLastRow = nEndRow;
923 SetRowFiltered(nRow, nLastRow, bFiltered);
924 nRow = nLastRow + 1;
925 }
926}
927
928void ScTable::SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered)
929{
930 if (bFiltered)
931 mpFilteredRows->setTrue(nStartRow, nEndRow);
932 else
933 mpFilteredRows->setFalse(nStartRow, nEndRow);
934}
935
936void ScTable::SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered)
937{
938 if (bFiltered)
939 mpFilteredCols->setTrue(nStartCol, nEndCol);
940 else
941 mpFilteredCols->setFalse(nStartCol, nEndCol);
942}
943
945{
946 SCROW nRow = nStartRow;
948 while (nRow <= nEndRow)
949 {
950 if (!ValidRow(nRow))
951 break;
952
953 if (!mpFilteredRows->getRangeData(nRow, aData))
954 // failed to get range data.
955 break;
956
957 if (!aData.mbValue)
958 // non-filtered row found
959 return nRow;
960
961 nRow = aData.mnRow2 + 1;
962 }
963
964 return ::std::numeric_limits<SCROW>::max();
965}
966
968{
969 SCROW nRow = nEndRow;
971 while (nRow >= nStartRow)
972 {
973 if (!ValidRow(nRow))
974 break;
975
976 if (!mpFilteredRows->getRangeData(nRow, aData))
977 // failed to get range data.
978 break;
979
980 if (!aData.mbValue)
981 // non-filtered row found
982 return nRow;
983
984 nRow = aData.mnRow1 - 1;
985 }
986
987 return ::std::numeric_limits<SCROW>::max();
988}
989
991{
992 SCROW nCount = 0;
993 SCROW nRow = nStartRow;
995 while (nRow <= nEndRow)
996 {
997 if (!mpFilteredRows->getRangeData(nRow, aData))
998 break;
999
1000 if (aData.mnRow2 > nEndRow)
1001 aData.mnRow2 = nEndRow;
1002
1003 if (!aData.mbValue)
1004 nCount += aData.mnRow2 - nRow + 1;
1005
1006 nRow = aData.mnRow2 + 1;
1007 }
1008 return nCount;
1009}
1010
1012{
1013 Color backgroundColor;
1014 bool bHasConditionalBackgroundColor = false;
1015 // Check background color from cond. formatting
1016 const ScPatternAttr* pPattern = GetDoc().GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
1017 if (pPattern)
1018 {
1019 if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
1020 {
1021 const SfxItemSet* pCondSet = GetDoc().GetCondResult(aPos.Col(), aPos.Row(), aPos.Tab());
1022 const SvxBrushItem* pBackgroundColor = &pPattern->GetItem(ATTR_BACKGROUND, pCondSet);
1023 backgroundColor = pBackgroundColor->GetColor();
1024 bHasConditionalBackgroundColor = true;
1025 }
1026 }
1027
1028 // Color scale needs a different handling
1029 ScConditionalFormat* pCondFormat = GetDoc().GetCondFormat(aPos.Col(), aPos.Row(), aPos.Tab());
1030 if (pCondFormat)
1031 {
1032 for (size_t i = 0; i < pCondFormat->size(); i++)
1033 {
1034 auto aEntry = pCondFormat->GetEntry(i);
1035 if (aEntry->GetType() == ScFormatEntry::Type::Colorscale)
1036 {
1037 const ScColorScaleFormat* pColFormat
1038 = static_cast<const ScColorScaleFormat*>(aEntry);
1039 std::optional<Color> oColor = pColFormat->GetColor(aPos);
1040 if (oColor)
1041 {
1042 backgroundColor = oColor.value();
1043 bHasConditionalBackgroundColor = true;
1044 }
1045 }
1046 }
1047 }
1048 return bHasConditionalBackgroundColor ? backgroundColor
1049 : GetDoc().GetAttr(aPos, ATTR_BACKGROUND)->GetColor();
1050}
1051
1053{
1054 // Check text & background color from cond. formatting
1055 const ScPatternAttr* pPattern = GetDoc().GetPattern(aPos.Col(), aPos.Row(), aPos.Tab());
1056 if (pPattern)
1057 {
1058 if (!pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData().empty())
1059 {
1060 const SfxItemSet* pCondSet = GetDoc().GetCondResult(aPos.Col(), aPos.Row(), aPos.Tab());
1061 const SvxColorItem* pColor = &pPattern->GetItem(ATTR_FONT_COLOR, pCondSet);
1062 return pColor->GetValue();
1063 }
1064
1065 if (pPattern->GetItem(ATTR_VALUE_FORMAT).GetValue())
1066 {
1067 SvNumberFormatter* pNumberFormatter = GetDoc().GetFormatTable();
1068 const SfxUInt32Item pItem = pPattern->GetItem(ATTR_VALUE_FORMAT);
1069 auto& rDoc = const_cast<ScDocument&>(GetDoc());
1070 const Color* pColor;
1071 ScRefCellValue aCell(rDoc, aPos);
1072 ScCellFormat::GetString(rDoc, aPos, pItem.GetValue(), &pColor, *pNumberFormatter, false,
1073 false);
1074 if (pColor)
1075 return *pColor;
1076 }
1077 }
1078
1079 const SvxColorItem* pColor = GetDoc().GetAttr(aPos, ATTR_FONT_COLOR);
1080 return pColor->GetValue();
1081}
1082
1084{
1085 return bool(pRowFlags->GetValue(nRow) & CRFlags::ManualSize);
1086}
1087
1088namespace
1089{
1090void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegments,
1091 const ScFlatBoolRowSegments& rRowSegments,
1093 ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask)
1094{
1095 CRFlags nFlagMaskComplement = ~nFlagMask;
1096
1097 pRowFlags->AndValue(0, pDocument->MaxRow(), nFlagMaskComplement);
1098 pColFlags->AndValue(0, pDocument->MaxCol() + 1, nFlagMaskComplement);
1099
1100 {
1101 // row hidden flags.
1102
1103 SCROW nRow = 0;
1105 while (nRow <= pDocument->MaxRow())
1106 {
1107 if (!rRowSegments.getRangeData(nRow, aData))
1108 break;
1109
1110 if (aData.mbValue)
1111 pRowFlags->OrValue(nRow, aData.mnRow2, nFlagMask);
1112
1113 nRow = aData.mnRow2 + 1;
1114 }
1115 }
1116
1117 {
1118 // column hidden flags.
1119
1120 SCCOL nCol = 0;
1122 while (nCol <= pDocument->MaxCol())
1123 {
1124 if (!rColSegments.getRangeData(nCol, aData))
1125 break;
1126
1127 if (aData.mbValue)
1128 pColFlags->OrValue(nCol, aData.mnCol2, nFlagMask);
1129
1130 nCol = aData.mnCol2 + 1;
1131 }
1132 }
1133}
1134}
1135
1137{
1138 CRFlags nManualBreakComplement = ~CRFlags::ManualBreak;
1139
1140 // Manual breaks.
1141 pRowFlags->AndValue(0, rDocument.MaxRow(), nManualBreakComplement);
1142 mpColFlags->AndValue(0, rDocument.MaxCol() + 1, nManualBreakComplement);
1143
1144 for (const auto& rBreakPos : maRowManualBreaks)
1145 pRowFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
1146
1147 for (const auto& rBreakPos : maColManualBreaks)
1148 mpColFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
1149
1150 // Hidden flags.
1151 lcl_syncFlags(&rDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(),
1153 lcl_syncFlags(&rDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(),
1155}
1156
1157void ScTable::SetPageSize(const Size& rSize)
1158{
1159 if (!rSize.IsEmpty())
1160 {
1161 if (aPageSizeTwips != rSize)
1163
1164 bPageSizeValid = true;
1165 aPageSizeTwips = rSize;
1166 }
1167 else
1168 bPageSizeValid = false;
1169}
1170
1171bool ScTable::IsProtected() const { return pTabProtection && pTabProtection->isProtected(); }
1172
1174{
1175 if (pProtect)
1176 pTabProtection.reset(new ScTableProtection(*pProtect));
1177 else
1178 pTabProtection.reset();
1179
1180 SetStreamValid(false);
1181}
1182
1184
1186{
1187 if (bPageSizeValid)
1188 return aPageSizeTwips;
1189 else
1190 return Size(); // blank
1191}
1192
1193void ScTable::SetRepeatArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow)
1194{
1195 // #i117952# page break calculation uses these values (set from ScPrintFunc), not pRepeatColRange/pRepeatRowRange
1196 if (nStartCol != nRepeatStartX || nEndCol != nRepeatEndX || nStartRow != nRepeatStartY
1197 || nEndRow != nRepeatEndY)
1199
1200 nRepeatStartX = nStartCol;
1201 nRepeatEndX = nEndCol;
1202 nRepeatStartY = nStartRow;
1203 nRepeatEndY = nEndRow;
1204}
1205
1206void ScTable::StartListening(const ScAddress& rAddress, SvtListener* pListener)
1207{
1208 if (!ValidCol(rAddress.Col()))
1209 return;
1210
1211 CreateColumnIfNotExists(rAddress.Col()).StartListening(*pListener, rAddress.Row());
1212}
1213
1214void ScTable::EndListening(const ScAddress& rAddress, SvtListener* pListener)
1215{
1216 if (!ValidCol(rAddress.Col()))
1217 return;
1218
1219 if (rAddress.Col() < aCol.size())
1220 aCol[rAddress.Col()].EndListening(*pListener, rAddress.Row());
1221}
1222
1224 SvtListener& rListener)
1225{
1226 if (!ValidCol(rAddress.Col()))
1227 return;
1228
1229 CreateColumnIfNotExists(rAddress.Col()).StartListening(rCxt, rAddress, rListener);
1230}
1231
1233 SvtListener& rListener)
1234{
1235 if (!ValidCol(rAddress.Col()))
1236 return;
1237
1238 if (rAddress.Col() < aCol.size())
1239 aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener);
1240}
1241
1242void ScTable::SetPageStyle(const OUString& rName)
1243{
1244 if (aPageStyle == rName)
1245 return;
1246
1247 OUString aStrNew = rName;
1249 SfxStyleSheetBase* pNewStyle = pStylePool->Find(aStrNew, SfxStyleFamily::Page);
1250
1251 if (!pNewStyle)
1252 {
1253 aStrNew = ScResId(STR_STYLENAME_STANDARD);
1254 pNewStyle = pStylePool->Find(aStrNew, SfxStyleFamily::Page);
1255 }
1256
1257 if (aPageStyle == aStrNew)
1258 return;
1259
1260 SfxStyleSheetBase* pOldStyle = pStylePool->Find(aPageStyle, SfxStyleFamily::Page);
1261 if (pOldStyle && pNewStyle)
1262 {
1263 SfxItemSet& rOldSet = pOldStyle->GetItemSet();
1264 SfxItemSet& rNewSet = pNewStyle->GetItemSet();
1265 auto getScaleValue = [](const SfxItemSet& rSet, sal_uInt16 nId) {
1266 return static_cast<const SfxUInt16Item&>(rSet.Get(nId)).GetValue();
1267 };
1268
1269 const sal_uInt16 nOldScale = getScaleValue(rOldSet, ATTR_PAGE_SCALE);
1270 const sal_uInt16 nOldScaleToPages = getScaleValue(rOldSet, ATTR_PAGE_SCALETOPAGES);
1271 const sal_uInt16 nNewScale = getScaleValue(rNewSet, ATTR_PAGE_SCALE);
1272 const sal_uInt16 nNewScaleToPages = getScaleValue(rNewSet, ATTR_PAGE_SCALETOPAGES);
1273
1274 if ((nOldScale != nNewScale) || (nOldScaleToPages != nNewScaleToPages))
1275 InvalidateTextWidth(nullptr, nullptr, false, false);
1276 }
1277
1278 if (pNewStyle) // also without the old one (for UpdateStdNames)
1279 aPageStyle = aStrNew;
1280
1281 SetStreamValid(false);
1282}
1283
1284void ScTable::PageStyleModified(const OUString& rNewName)
1285{
1286 aPageStyle = rNewName;
1287 InvalidateTextWidth(nullptr, nullptr, false, false); // don't know what was in the style before
1288}
1289
1290void ScTable::InvalidateTextWidth(const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1291 bool bNumFormatChanged, bool bBroadcast)
1292{
1293 if (pAdrFrom && !pAdrTo)
1294 {
1295 // Special case: only process the "from" cell.
1296 SCCOL nCol = pAdrFrom->Col();
1297 SCROW nRow = pAdrFrom->Row();
1298 if (nCol >= aCol.size())
1299 return;
1300 ScColumn& rCol = aCol[nCol];
1301 ScRefCellValue aCell = rCol.GetCellValue(nRow);
1302 if (aCell.isEmpty())
1303 return;
1304
1305 rCol.SetTextWidth(nRow, TEXTWIDTH_DIRTY);
1306
1307 if (bNumFormatChanged)
1308 rCol.SetScriptType(nRow, SvtScriptType::UNKNOWN);
1309
1310 if (bBroadcast)
1311 { // Only with CalcAsShown
1312 switch (aCell.getType())
1313 {
1314 case CELLTYPE_VALUE:
1315 rCol.Broadcast(nRow);
1316 break;
1317 case CELLTYPE_FORMULA:
1318 aCell.getFormula()->SetDirty();
1319 break;
1320 default:
1321 {
1322 // added to avoid warnings
1323 }
1324 }
1325 }
1326
1327 return;
1328 }
1329
1330 const SCCOL nCol1 = pAdrFrom ? pAdrFrom->Col() : 0;
1331 const SCROW nRow1 = pAdrFrom ? pAdrFrom->Row() : 0;
1332 const SCCOL nCol2 = pAdrTo ? pAdrTo->Col() : aCol.size() - 1;
1333 const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : rDocument.MaxRow();
1334
1335 for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
1336 {
1337 ScColumnTextWidthIterator aIter(GetDoc(), aCol[nCol], nRow1, nRow2);
1338 sc::ColumnBlockPosition blockPos; // cache mdds position
1339 InitColumnBlockPosition(blockPos, nCol);
1340
1341 for (; aIter.hasCell(); aIter.next())
1342 {
1343 SCROW nRow = aIter.getPos();
1345 ScRefCellValue aCell = aCol[nCol].GetCellValue(blockPos, nRow);
1346 if (aCell.isEmpty())
1347 continue;
1348
1349 if (bNumFormatChanged)
1350 aCol[nCol].SetScriptType(nRow, SvtScriptType::UNKNOWN);
1351
1352 if (bBroadcast)
1353 { // Only with CalcAsShown
1354 switch (aCell.getType())
1355 {
1356 case CELLTYPE_VALUE:
1357 aCol[nCol].Broadcast(nRow);
1358 break;
1359 case CELLTYPE_FORMULA:
1360 aCell.getFormula()->SetDirty();
1361 break;
1362 default:
1363 {
1364 // added to avoid warnings
1365 }
1366 }
1367 }
1368 }
1369 }
1370}
1371
1372/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SCROW SCROW_REPEAT_NONE
Definition: address.hxx:94
const SCCOL SCCOL_REPEAT_NONE
Definition: address.hxx:93
sal_uInt32 GetValue() const
SCTAB Tab() const
Definition: address.hxx:283
SCROW Row() const
Definition: address.hxx:274
SCCOL Col() const
Definition: address.hxx:279
The data type represents bits, manageable by bitwise operations.
void AndValue(A nPos, const D &rValueToAnd)
void OrValue(A nPos, const D &rValueToOr)
static OUString GetString(const ScRefCellValue &rCell, sal_uInt32 nFormat, const Color **ppColor, SvNumberFormatter &rFormatter, const ScDocument &rDoc, bool bNullVals=true, bool bFormula=false, bool bUseStarFormat=false)
Definition: cellform.cxx:31
SCCOL size() const
std::optional< Color > GetColor(const ScAddress &rAddr) const
Definition: colorscale.cxx:633
void setValue(sal_uInt16 nVal)
ScRefCellValue GetCellValue(SCROW nRow) const
Definition: column.cxx:638
void Broadcast(SCROW nRow)
Definition: column3.cxx:75
void SetScriptType(SCROW nRow, SvtScriptType nType)
Definition: column2.cxx:2392
void SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
Definition: column2.cxx:2302
void StartListening(SvtListener &rLst, SCROW nRow)
Definition: column2.cxx:3486
const ScFormatEntry * GetEntry(sal_uInt16 nPos) const
Definition: conditio.cxx:1802
size_t size() const
Definition: conditio.cxx:1788
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
ScBroadcastAreaSlotMachine * GetBASM() const
Definition: document.hxx:2231
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1084
SC_DLLPUBLIC ScConditionalFormat * GetCondFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: documen4.cxx:837
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6055
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4684
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
bool IsImportingXML() const
Definition: document.hxx:2227
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2874
std::vector< SdrObject * > GetObjectsAnchoredToCols(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol)
Definition: drwlayer.cxx:2810
std::vector< SdrObject * > GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
Definition: drwlayer.cxx:2742
bool getRangeData(SCCOL nCol, RangeData &rData)
bool getValue(SCROW nPos, bool &rVal)
bool getRangeData(SCROW nRow, RangeData &rData) const
bool getValue(SCROW nPos, sal_uInt16 &rVal)
void SetDirty(bool bDirtyFlag=true)
Contains the "scale to width/height" attribute in page styles.
Definition: attrib.hxx:230
sal_uInt16 GetHeight() const
Definition: attrib.hxx:248
sal_uInt16 GetWidth() const
Definition: attrib.hxx:247
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
sheet protection state container
std::unique_ptr< ScFlatBoolColSegments > mpHiddenCols
Definition: table.hxx:199
Size aPageSizeTwips
Definition: table.hxx:177
OUString aPageStyle
Definition: table.hxx:176
SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const
Definition: table5.cxx:824
bool ValidCol(SCCOL nCol) const
Definition: table.hxx:356
SCCOL CountVisibleCols(SCCOL nStartCol, SCCOL nEndCol) const
Definition: table5.cxx:802
void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden)
Definition: table5.cxx:629
std::unique_ptr< ScFlatBoolRowSegments > mpFilteredRows
Definition: table.hxx:202
bool bPageSizeValid
Definition: table.hxx:250
SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:735
ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const
Definition: table1.cxx:2729
bool ColFiltered(SCCOL nCol, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: table5.cxx:866
void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered)
Definition: table5.cxx:928
SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:712
void InvalidatePageBreaks()
Definition: table2.cxx:1563
void GetAllRowBreaks(::std::set< SCROW > &rBreaks, bool bPage, bool bManual) const
Definition: table5.cxx:339
void EndListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1214
bool RowHiddenLeaf(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:517
::std::set< SCCOL > maColManualBreaks
Definition: table.hxx:207
void CopyRowFiltered(const ScTable &rTable, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:914
Size GetPageSize() const
Definition: table5.cxx:1185
ScColContainer aCol
Definition: table.hxx:162
void GetAllColBreaks(::std::set< SCCOL > &rBreaks, bool bPage, bool bManual) const
Definition: table5.cxx:351
std::unique_ptr< ScBitMaskCompressedArray< SCROW, CRFlags > > pRowFlags
Definition: table.hxx:198
void PageStyleModified(const OUString &rNewName)
Definition: table5.cxx:1284
ScColumn & CreateColumnIfNotExists(const SCCOL nScCol)
Definition: table.hxx:303
bool mbPageBreaksValid
Definition: table.hxx:259
SCROW nRepeatEndY
Definition: table.hxx:181
::std::set< SCROW > maRowPageBreaks
Definition: table.hxx:204
std::unique_ptr< ScBitMaskCompressedArray< SCCOL, CRFlags > > mpColFlags
Definition: table.hxx:197
void SetStreamValid(bool bSet, bool bIgnoreLock=false)
Definition: table1.cxx:382
void CopyRowHeight(const ScTable &rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset)
Definition: table5.cxx:692
bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
Definition: table5.cxx:579
void SetPageSize(const Size &rSize)
Definition: table5.cxx:1157
std::unique_ptr< ScFlatBoolColSegments > mpFilteredCols
Definition: table.hxx:201
void SyncColRowFlags()
Definition: table5.cxx:1136
SCCOL nRepeatStartX
Definition: table.hxx:178
css::uno::Sequence< css::sheet::TablePageBreakData > GetRowBreakData() const
Definition: table5.cxx:471
void SetColBreak(SCCOL nCol, bool bPage, bool bManual)
Definition: table5.cxx:456
bool HasRowPageBreak(SCROW nRow) const
Definition: table5.cxx:363
SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:990
void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:401
bool HasColPageBreak(SCCOL nCol) const
Definition: table5.cxx:371
bool mbForceBreaks
Definition: table.hxx:260
bool ColHidden(SCCOL nCol, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: table5.cxx:562
void SetRepeatArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:1193
tools::Long GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero=true) const
Definition: table5.cxx:779
void StartListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1206
sal_uInt16 GetPrintRangeCount() const
Definition: table.hxx:827
SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:944
void InvalidateTextWidth(const ScAddress *pAdrFrom, const ScAddress *pAdrTo, bool bNumFormatChanged, bool bBroadcast)
Definition: table5.cxx:1290
bool IsProtected() const
Definition: table5.cxx:1171
void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered)
Definition: table5.cxx:936
bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:547
void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual)
Definition: table5.cxx:411
void SetProtection(const ScTableProtection *pProtect)
Definition: table5.cxx:1173
bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:884
bool RowHidden(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:487
bool HasColManualBreak(SCCOL nCol) const
Definition: table5.cxx:387
void SetRowBreak(SCROW nRow, bool bPage, bool bManual)
Definition: table5.cxx:441
void RemoveManualBreaks()
Definition: table5.cxx:311
SCCOL nRepeatEndX
Definition: table.hxx:179
::std::set< SCROW > maRowManualBreaks
Definition: table.hxx:205
SCROW GetNextManualBreak(SCROW nRow) const
Get the row position of the next manual break that occurs at or below specified row.
Definition: table5.cxx:395
SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:967
std::unique_ptr< ScCompressedArray< SCCOL, sal_uInt16 > > mpColWidth
Definition: table.hxx:194
void CopyColFiltered(const ScTable &rTable, SCCOL nStartCol, SCCOL nEndCol)
Definition: table5.cxx:899
SCROW nRepeatStartY
Definition: table.hxx:180
bool InitColumnBlockPosition(sc::ColumnBlockPosition &rBlockPos, SCCOL nCol)
Definition: table2.cxx:713
void UpdatePageBreaks(const ScRange *pUserArea)
Definition: table5.cxx:59
std::unique_ptr< ScFlatBoolRowSegments > mpHiddenRows
Definition: table.hxx:200
SCTAB GetTab() const
Definition: table.hxx:299
bool RowFiltered(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:848
std::unique_ptr< ScFlatUInt16RowSegments > mpRowHeights
Definition: table.hxx:195
SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:758
Color GetCellBackgroundColor(ScAddress aPos) const
Definition: table5.cxx:1011
void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual)
Definition: table5.cxx:426
const ScTableProtection * GetProtection() const
Definition: table5.cxx:1183
ScDocument & rDocument
Definition: table.hxx:219
void SetColManualBreaks(::std::set< SCCOL > &&rBreaks)
Definition: table5.cxx:332
void CopyColHidden(const ScTable &rTable, SCCOL nStartCol, SCCOL nEndCol)
Definition: table5.cxx:663
bool HasManualBreaks() const
Definition: table5.cxx:320
bool IsManualRowHeight(SCROW nRow) const
Definition: table5.cxx:1083
ScDocument & GetDoc()
Definition: table.hxx:297
Color GetCellTextColor(ScAddress aPos) const
Definition: table5.cxx:1052
double GetValue(SCCOL nCol, SCROW nRow) const
Definition: table2.cxx:1799
const ScRange * GetPrintRange(sal_uInt16 nPos) const
Definition: table1.cxx:2342
std::unique_ptr< ScTableProtection > pTabProtection
Definition: table.hxx:192
void CopyRowHidden(const ScTable &rTable, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:678
::std::set< SCCOL > maColPageBreaks
Definition: table.hxx:206
bool HasRowManualBreak(SCROW nRow) const
Definition: table5.cxx:379
void SetPageStyle(const OUString &rName)
Definition: table5.cxx:1242
void SetRowManualBreaks(::std::set< SCROW > &&rBreaks)
Definition: table5.cxx:325
bool ValidRow(SCROW nRow) const
Definition: table.hxx:357
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
virtual SfxItemSet & GetItemSet()
bool IsEmpty() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetColor() const
const Color & GetValue() const
int nCount
@ CELLTYPE_FORMULA
Definition: global.hxx:276
@ CELLTYPE_VALUE
Definition: global.hxx:274
CRFlags
Definition: global.hxx:125
#define TEXTWIDTH_DIRTY
Definition: globalnames.hxx:19
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral aData
void copy(const fs::path &src, const fs::path &dest)
int i
long Long
sal_Int16 nId
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
constexpr TypedWhichId< SvxColorItem > ATTR_FONT_COLOR(109)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< ScPageScaleToItem > ATTR_PAGE_SCALETO(188)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
#define SC_MOD()
Definition: scmod.hxx:247
static SfxItemSet & rSet
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:108
ScFormulaCell * getFormula() const
Definition: cellvalue.hxx:137
bool isEmpty() const
Definition: cellvalue.cxx:667
CellType getType() const
Definition: cellvalue.hxx:133
Store position data for column array storage.
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17