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