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  OSL_ENSURE(dynamic_cast<const SfxUInt16Item*>(pItem) != nullptr, "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(const ::std::set<SCROW>& rBreaks)
323 {
324  maRowManualBreaks = rBreaks;
326  SetStreamValid(false);
327 }
328 
329 void ScTable::SetColManualBreaks(const ::std::set<SCCOL>& rBreaks)
330 {
331  maColManualBreaks = 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  {
343  using namespace std;
345  inserter(rBreaks, rBreaks.begin()));
346  }
347 }
348 
349 void ScTable::GetAllColBreaks(set<SCCOL>& rBreaks, bool bPage, bool bManual) const
350 {
351  if (bPage)
352  rBreaks = maColPageBreaks;
353 
354  if (bManual)
355  {
356  using namespace std;
358  inserter(rBreaks, rBreaks.begin()));
359  }
360 }
361 
363 {
364  if (!ValidRow(nRow))
365  return false;
366 
367  return maRowPageBreaks.find(nRow) != maRowPageBreaks.end();
368 }
369 
371 {
372  if (!ValidCol(nCol))
373  return false;
374 
375  return maColPageBreaks.find(nCol) != maColPageBreaks.end();
376 }
377 
379 {
380  if (!ValidRow(nRow))
381  return false;
382 
383  return maRowManualBreaks.find(nRow) != maRowManualBreaks.end();
384 }
385 
387 {
388  if (!ValidCol(nCol))
389  return false;
390 
391  return maColManualBreaks.find(nCol) != maColManualBreaks.end();
392 }
393 
395 {
396  set<SCROW>::const_iterator itr = maRowManualBreaks.lower_bound(nRow);
397  return itr == maRowManualBreaks.end() ? -1 : *itr;
398 }
399 
400 void ScTable::RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow)
401 {
402  using namespace std;
403 
404  if (!ValidRow(nStartRow) || !ValidRow(nEndRow))
405  return;
406 
407  set<SCROW>::iterator low = maRowPageBreaks.lower_bound(nStartRow);
408  set<SCROW>::iterator high = maRowPageBreaks.upper_bound(nEndRow);
409  maRowPageBreaks.erase(low, high);
410 }
411 
412 void ScTable::RemoveRowBreak(SCROW nRow, bool bPage, bool bManual)
413 {
414  if (!ValidRow(nRow))
415  return;
416 
417  if (bPage)
418  maRowPageBreaks.erase(nRow);
419 
420  if (bManual)
421  {
422  maRowManualBreaks.erase(nRow);
424  }
425 }
426 
427 void ScTable::RemoveColBreak(SCCOL nCol, bool bPage, bool bManual)
428 {
429  if (!ValidCol(nCol))
430  return;
431 
432  if (bPage)
433  maColPageBreaks.erase(nCol);
434 
435  if (bManual)
436  {
437  maColManualBreaks.erase(nCol);
439  }
440 }
441 
442 void ScTable::SetRowBreak(SCROW nRow, bool bPage, bool bManual)
443 {
444  if (!ValidRow(nRow))
445  return;
446 
447  if (bPage)
448  maRowPageBreaks.insert(nRow);
449 
450  if (bManual)
451  {
452  maRowManualBreaks.insert(nRow);
454  }
455 }
456 
457 void ScTable::SetColBreak(SCCOL nCol, bool bPage, bool bManual)
458 {
459  if (!ValidCol(nCol))
460  return;
461 
462  if (bPage)
463  maColPageBreaks.insert(nCol);
464 
465  if (bManual)
466  {
467  maColManualBreaks.insert(nCol);
469  }
470 }
471 
472 Sequence<TablePageBreakData> ScTable::GetRowBreakData() const
473 {
474  using ::std::copy;
475  using ::std::inserter;
476 
477  set<SCROW> aRowBreaks = maRowPageBreaks;
479  inserter(aRowBreaks, aRowBreaks.begin()));
480 
481  sal_Int32 i = 0;
482  Sequence<TablePageBreakData> aSeq(aRowBreaks.size());
483 
484  for (const SCROW nRow : aRowBreaks)
485  {
486  TablePageBreakData aData;
487  aData.Position = nRow;
488  aData.ManualBreak = HasRowManualBreak(nRow);
489  aSeq[i] = aData;
490  ++i;
491  }
492 
493  return aSeq;
494 }
495 
496 bool ScTable::RowHidden(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
497 {
498  if (!ValidRow(nRow))
499  {
500  if (pFirstRow)
501  *pFirstRow = nRow;
502  if (pLastRow)
503  *pLastRow = nRow;
504  return true;
505  }
506 
508  if (!mpHiddenRows->getRangeData(nRow, aData))
509  {
510  // search failed.
511  if (pFirstRow)
512  *pFirstRow = nRow;
513  if (pLastRow)
514  *pLastRow = nRow;
515  return true;
516  }
517 
518  if (pFirstRow)
519  *pFirstRow = aData.mnRow1;
520  if (pLastRow)
521  *pLastRow = aData.mnRow2;
522 
523  return aData.mbValue;
524 }
525 
526 bool ScTable::RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
527 {
528  if (!ValidRow(nRow))
529  {
530  if (pFirstRow)
531  *pFirstRow = nRow;
532  if (pLastRow)
533  *pLastRow = nRow;
534  return true;
535  }
536 
538  if (!mpHiddenRows->getRangeDataLeaf(nRow, aData))
539  {
540  // search failed.
541  if (pFirstRow)
542  *pFirstRow = nRow;
543  if (pLastRow)
544  *pLastRow = nRow;
545  return true;
546  }
547 
548  if (pFirstRow)
549  *pFirstRow = aData.mnRow1;
550  if (pLastRow)
551  *pLastRow = aData.mnRow2;
552 
553  return aData.mbValue;
554 }
555 
556 bool ScTable::HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
557 {
558  SCROW nRow = nStartRow;
559  while (nRow <= nEndRow)
560  {
561  SCROW nLastRow = -1;
562  bool bHidden = RowHidden(nRow, nullptr, &nLastRow);
563  if (bHidden)
564  return true;
565 
566  nRow = nLastRow + 1;
567  }
568  return false;
569 }
570 
571 bool ScTable::ColHidden(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
572 {
573  if (!ValidCol(nCol))
574  return true;
575 
577  if (!mpHiddenCols->getRangeData(nCol, aData))
578  return true;
579 
580  if (pFirstCol)
581  *pFirstCol = aData.mnCol1;
582  if (pLastCol)
583  *pLastCol = aData.mnCol2;
584 
585  return aData.mbValue;
586 }
587 
588 bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
589 {
590  bool bChanged = false;
591  if (bHidden)
592  bChanged = mpHiddenRows->setTrue(nStartRow, nEndRow);
593  else
594  bChanged = mpHiddenRows->setFalse(nStartRow, nEndRow);
595 
596  // Cell anchored objects might change visibility
597  ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
598  if (pDrawLayer)
599  {
600  std::vector<SdrObject*> aRowDrawObjects;
601  aRowDrawObjects = pDrawLayer->GetObjectsAnchoredToRows(GetTab(), nStartRow, nEndRow);
602  for (auto aObj : aRowDrawObjects)
603  {
605  if (pData)
606  {
607  if (bHidden)
608  aObj->SetVisible(false);
609  else if (!GetDoc().ColHidden(pData->maStart.Col(), pData->maStart.Tab()))
610  {
611  // Only change visibility if object is not hidden by a hidden col
612  aObj->SetVisible(true);
613  }
614  }
615  }
616  }
617 
618  if (bChanged)
619  {
620  SetStreamValid(false);
621 
622  { // Scoped bulk broadcast.
623  // Only subtotal formula cells will accept the notification of
624  // SfxHintId::ScHiddenRowsChanged, leaving the bulk will track
625  // those and broadcast SfxHintId::ScDataChanged to notify all
626  // dependents.
627  ScBulkBroadcast aBulkBroadcast(rDocument.GetBASM(), SfxHintId::ScDataChanged);
628  for (SCCOL i = 0; i < aCol.size(); i++)
629  {
630  aCol[i].BroadcastRows(nStartRow, nEndRow, SfxHintId::ScHiddenRowsChanged);
631  }
632  }
633  }
634 
635  return bChanged;
636 }
637 
638 void ScTable::SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden)
639 {
640  bool bChanged = false;
641  if (bHidden)
642  bChanged = mpHiddenCols->setTrue(nStartCol, nEndCol);
643  else
644  bChanged = mpHiddenCols->setFalse(nStartCol, nEndCol);
645 
646  // Cell anchored objects might change visibility
647  ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
648  if (pDrawLayer)
649  {
650  std::vector<SdrObject*> aColDrawObjects;
651  aColDrawObjects = pDrawLayer->GetObjectsAnchoredToCols(GetTab(), nStartCol, nEndCol);
652  for (auto aObj : aColDrawObjects)
653  {
655  if (pData)
656  {
657  if (bHidden)
658  aObj->SetVisible(false);
659  else if (!GetDoc().RowHidden(pData->maStart.Row(), pData->maStart.Tab()))
660  {
661  // Only change visibility if object is not hidden by a hidden row
662  aObj->SetVisible(true);
663  }
664  }
665  }
666  }
667 
668  if (bChanged)
669  SetStreamValid(false);
670 }
671 
672 void ScTable::CopyColHidden(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol)
673 {
674  SCCOL nCol = nStartCol;
675  while (nCol <= nEndCol)
676  {
677  SCCOL nLastCol = -1;
678  bool bHidden = rTable.ColHidden(nCol, nullptr, &nLastCol);
679  if (nLastCol > nEndCol)
680  nLastCol = nEndCol;
681 
682  SetColHidden(nCol, nLastCol, bHidden);
683  nCol = nLastCol + 1;
684  }
685 }
686 
687 void ScTable::CopyRowHidden(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow)
688 {
689  SCROW nRow = nStartRow;
690  while (nRow <= nEndRow)
691  {
692  SCROW nLastRow = -1;
693  bool bHidden = rTable.RowHidden(nRow, nullptr, &nLastRow);
694  if (nLastRow > nEndRow)
695  nLastRow = nEndRow;
696  SetRowHidden(nRow, nLastRow, bHidden);
697  nRow = nLastRow + 1;
698  }
699 }
700 
701 void ScTable::CopyRowHeight(const ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow,
702  SCROW nSrcOffset)
703 {
704  SCROW nRow = nStartRow;
706  while (nRow <= nEndRow)
707  {
708  if (!rSrcTable.mpRowHeights->getRangeData(nRow + nSrcOffset, aSrcData))
709  // Something is wrong !
710  return;
711 
712  SCROW nLastRow = aSrcData.mnRow2 - nSrcOffset;
713  if (nLastRow > nEndRow)
714  nLastRow = nEndRow;
715 
716  mpRowHeights->setValue(nRow, nLastRow, aSrcData.mnValue);
717  nRow = nLastRow + 1;
718  }
719 }
720 
721 SCROW ScTable::FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
722 {
723  SCROW nRow = nStartRow;
725  while (nRow <= nEndRow)
726  {
727  if (!ValidRow(nRow))
728  break;
729 
730  if (!mpHiddenRows->getRangeData(nRow, aData))
731  // failed to get range data.
732  break;
733 
734  if (!aData.mbValue)
735  // visible row found
736  return nRow;
737 
738  nRow = aData.mnRow2 + 1;
739  }
740 
741  return ::std::numeric_limits<SCROW>::max();
742 }
743 
744 SCROW ScTable::LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
745 {
746  SCROW nRow = nEndRow;
748  while (nRow >= nStartRow)
749  {
750  if (!ValidRow(nRow))
751  break;
752 
753  if (!mpHiddenRows->getRangeData(nRow, aData))
754  // failed to get range data.
755  break;
756 
757  if (!aData.mbValue)
758  // visible row found
759  return nRow;
760 
761  nRow = aData.mnRow1 - 1;
762  }
763 
764  return ::std::numeric_limits<SCROW>::max();
765 }
766 
767 SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const
768 {
769  SCROW nCount = 0;
770  SCROW nRow = nStartRow;
772  while (nRow <= nEndRow)
773  {
774  if (!mpHiddenRows->getRangeData(nRow, aData))
775  break;
776 
777  if (aData.mnRow2 > nEndRow)
778  aData.mnRow2 = nEndRow;
779 
780  if (!aData.mbValue)
781  nCount += aData.mnRow2 - nRow + 1;
782 
783  nRow = aData.mnRow2 + 1;
784  }
785  return nCount;
786 }
787 
788 sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero) const
789 {
790  sal_uInt32 nHeight = 0;
791  SCROW nRow = nStartRow;
793  while (nRow <= nEndRow)
794  {
795  if (!mpHiddenRows->getRangeData(nRow, aData))
796  break;
797 
798  if (aData.mnRow2 > nEndRow)
799  aData.mnRow2 = nEndRow;
800 
801  if (!(bHiddenAsZero && aData.mbValue))
802  // visible row range.
803  nHeight += mpRowHeights->getSumValue(nRow, aData.mnRow2);
804 
805  nRow = aData.mnRow2 + 1;
806  }
807 
808  return nHeight;
809 }
810 
812 {
813  if (bCol)
814  {
815  SCCOL nCol = static_cast<SCCOL>(nPos);
816  if (ColHidden(nCol))
817  {
818  for (SCCOL i = nCol + 1; i <= rDocument.MaxCol(); ++i)
819  {
820  if (!ColHidden(i))
821  return i - 1;
822  }
823  }
824  }
825  else
826  {
827  SCROW nRow = static_cast<SCROW>(nPos);
828  SCROW nLastRow;
829  if (RowHidden(nRow, nullptr, &nLastRow))
830  return static_cast<SCCOLROW>(nLastRow);
831  }
832  return ::std::numeric_limits<SCCOLROW>::max();
833 }
834 
835 bool ScTable::RowFiltered(SCROW nRow, SCROW* pFirstRow, SCROW* pLastRow) const
836 {
837  if (!ValidRow(nRow))
838  return false;
839 
841  if (!mpFilteredRows->getRangeData(nRow, aData))
842  // search failed.
843  return false;
844 
845  if (pFirstRow)
846  *pFirstRow = aData.mnRow1;
847  if (pLastRow)
848  *pLastRow = aData.mnRow2;
849 
850  return aData.mbValue;
851 }
852 
853 bool ScTable::ColFiltered(SCCOL nCol, SCCOL* pFirstCol, SCCOL* pLastCol) const
854 {
855  if (!ValidCol(nCol))
856  return false;
857 
859  if (!mpFilteredCols->getRangeData(nCol, aData))
860  // search failed.
861  return false;
862 
863  if (pFirstCol)
864  *pFirstCol = aData.mnCol1;
865  if (pLastCol)
866  *pLastCol = aData.mnCol2;
867 
868  return aData.mbValue;
869 }
870 
871 bool ScTable::HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
872 {
873  SCROW nRow = nStartRow;
874  while (nRow <= nEndRow)
875  {
876  SCROW nLastRow = nRow;
877  bool bFiltered = RowFiltered(nRow, nullptr, &nLastRow);
878  if (bFiltered)
879  return true;
880 
881  nRow = nLastRow + 1;
882  }
883  return false;
884 }
885 
886 void ScTable::CopyColFiltered(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol)
887 {
888  SCCOL nCol = nStartCol;
889  while (nCol <= nEndCol)
890  {
891  SCCOL nLastCol = -1;
892  bool bFiltered = rTable.ColFiltered(nCol, nullptr, &nLastCol);
893  if (nLastCol > nEndCol)
894  nLastCol = nEndCol;
895 
896  SetColFiltered(nCol, nLastCol, bFiltered);
897  nCol = nLastCol + 1;
898  }
899 }
900 
901 void ScTable::CopyRowFiltered(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow)
902 {
903  SCROW nRow = nStartRow;
904  while (nRow <= nEndRow)
905  {
906  SCROW nLastRow = -1;
907  bool bFiltered = rTable.RowFiltered(nRow, nullptr, &nLastRow);
908  if (nLastRow > nEndRow)
909  nLastRow = nEndRow;
910  SetRowFiltered(nRow, nLastRow, bFiltered);
911  nRow = nLastRow + 1;
912  }
913 }
914 
915 void ScTable::SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered)
916 {
917  if (bFiltered)
918  mpFilteredRows->setTrue(nStartRow, nEndRow);
919  else
920  mpFilteredRows->setFalse(nStartRow, nEndRow);
921 }
922 
923 void ScTable::SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered)
924 {
925  if (bFiltered)
926  mpFilteredCols->setTrue(nStartCol, nEndCol);
927  else
928  mpFilteredCols->setFalse(nStartCol, nEndCol);
929 }
930 
932 {
933  SCROW nRow = nStartRow;
935  while (nRow <= nEndRow)
936  {
937  if (!ValidRow(nRow))
938  break;
939 
940  if (!mpFilteredRows->getRangeData(nRow, aData))
941  // failed to get range data.
942  break;
943 
944  if (!aData.mbValue)
945  // non-filtered row found
946  return nRow;
947 
948  nRow = aData.mnRow2 + 1;
949  }
950 
951  return ::std::numeric_limits<SCROW>::max();
952 }
953 
954 SCROW ScTable::LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
955 {
956  SCROW nRow = nEndRow;
958  while (nRow >= nStartRow)
959  {
960  if (!ValidRow(nRow))
961  break;
962 
963  if (!mpFilteredRows->getRangeData(nRow, aData))
964  // failed to get range data.
965  break;
966 
967  if (!aData.mbValue)
968  // non-filtered row found
969  return nRow;
970 
971  nRow = aData.mnRow1 - 1;
972  }
973 
974  return ::std::numeric_limits<SCROW>::max();
975 }
976 
978 {
979  SCROW nCount = 0;
980  SCROW nRow = nStartRow;
982  while (nRow <= nEndRow)
983  {
984  if (!mpFilteredRows->getRangeData(nRow, aData))
985  break;
986 
987  if (aData.mnRow2 > nEndRow)
988  aData.mnRow2 = nEndRow;
989 
990  if (!aData.mbValue)
991  nCount += aData.mnRow2 - nRow + 1;
992 
993  nRow = aData.mnRow2 + 1;
994  }
995  return nCount;
996 }
997 
999 {
1000  return bool(pRowFlags->GetValue(nRow) & CRFlags::ManualSize);
1001 }
1002 
1003 namespace
1004 {
1005 void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegments,
1006  const ScFlatBoolRowSegments& rRowSegments,
1009 {
1010  using ::sal::static_int_cast;
1011 
1012  CRFlags nFlagMaskComplement = ~nFlagMask;
1013 
1014  pRowFlags->AndValue(0, pDocument->MaxRow(), nFlagMaskComplement);
1015  pColFlags->AndValue(0, pDocument->MaxCol() + 1, nFlagMaskComplement);
1016 
1017  {
1018  // row hidden flags.
1019 
1020  SCROW nRow = 0;
1022  while (nRow <= pDocument->MaxRow())
1023  {
1024  if (!rRowSegments.getRangeData(nRow, aData))
1025  break;
1026 
1027  if (aData.mbValue)
1028  pRowFlags->OrValue(nRow, aData.mnRow2, nFlagMask);
1029 
1030  nRow = aData.mnRow2 + 1;
1031  }
1032  }
1033 
1034  {
1035  // column hidden flags.
1036 
1037  SCCOL nCol = 0;
1039  while (nCol <= pDocument->MaxCol())
1040  {
1041  if (!rColSegments.getRangeData(nCol, aData))
1042  break;
1043 
1044  if (aData.mbValue)
1045  pColFlags->OrValue(nCol, aData.mnCol2, nFlagMask);
1046 
1047  nCol = aData.mnCol2 + 1;
1048  }
1049  }
1050 }
1051 }
1052 
1054 {
1055  CRFlags nManualBreakComplement = ~CRFlags::ManualBreak;
1056 
1057  // Manual breaks.
1058  pRowFlags->AndValue(0, rDocument.MaxRow(), nManualBreakComplement);
1059  mpColFlags->AndValue(0, rDocument.MaxCol() + 1, nManualBreakComplement);
1060 
1061  for (const auto& rBreakPos : maRowManualBreaks)
1062  pRowFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
1063 
1064  for (const auto& rBreakPos : maColManualBreaks)
1065  mpColFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
1066 
1067  // Hidden flags.
1068  lcl_syncFlags(&rDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(),
1069  CRFlags::Hidden);
1070  lcl_syncFlags(&rDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(),
1072 }
1073 
1074 void ScTable::SetPageSize(const Size& rSize)
1075 {
1076  if (!rSize.IsEmpty())
1077  {
1078  if (aPageSizeTwips != rSize)
1080 
1081  bPageSizeValid = true;
1082  aPageSizeTwips = rSize;
1083  }
1084  else
1085  bPageSizeValid = false;
1086 }
1087 
1088 bool ScTable::IsProtected() const { return pTabProtection && pTabProtection->isProtected(); }
1089 
1091 {
1092  if (pProtect)
1093  pTabProtection.reset(new ScTableProtection(*pProtect));
1094  else
1095  pTabProtection.reset();
1096 
1097  SetStreamValid(false);
1098 }
1099 
1101 
1103 {
1104  if (bPageSizeValid)
1105  return aPageSizeTwips;
1106  else
1107  return Size(); // blank
1108 }
1109 
1110 void ScTable::SetRepeatArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow)
1111 {
1112  // #i117952# page break calculation uses these values (set from ScPrintFunc), not pRepeatColRange/pRepeatRowRange
1113  if (nStartCol != nRepeatStartX || nEndCol != nRepeatEndX || nStartRow != nRepeatStartY
1114  || nEndRow != nRepeatEndY)
1116 
1117  nRepeatStartX = nStartCol;
1118  nRepeatEndX = nEndCol;
1119  nRepeatStartY = nStartRow;
1120  nRepeatEndY = nEndRow;
1121 }
1122 
1123 void ScTable::StartListening(const ScAddress& rAddress, SvtListener* pListener)
1124 {
1125  if (!ValidCol(rAddress.Col()))
1126  return;
1127 
1128  CreateColumnIfNotExists(rAddress.Col()).StartListening(*pListener, rAddress.Row());
1129 }
1130 
1131 void ScTable::EndListening(const ScAddress& rAddress, SvtListener* pListener)
1132 {
1133  if (!ValidCol(rAddress.Col()))
1134  return;
1135 
1136  if (rAddress.Col() < aCol.size())
1137  aCol[rAddress.Col()].EndListening(*pListener, rAddress.Row());
1138 }
1139 
1141  SvtListener& rListener)
1142 {
1143  if (!ValidCol(rAddress.Col()))
1144  return;
1145 
1146  CreateColumnIfNotExists(rAddress.Col()).StartListening(rCxt, rAddress, rListener);
1147 }
1148 
1150  SvtListener& rListener)
1151 {
1152  if (!ValidCol(rAddress.Col()))
1153  return;
1154 
1155  aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener);
1156 }
1157 
1158 void ScTable::SetPageStyle(const OUString& rName)
1159 {
1160  if (aPageStyle == rName)
1161  return;
1162 
1163  OUString aStrNew = rName;
1165  SfxStyleSheetBase* pNewStyle = pStylePool->Find(aStrNew, SfxStyleFamily::Page);
1166 
1167  if (!pNewStyle)
1168  {
1169  aStrNew = ScResId(STR_STYLENAME_STANDARD);
1170  pNewStyle = pStylePool->Find(aStrNew, SfxStyleFamily::Page);
1171  }
1172 
1173  if (aPageStyle == aStrNew)
1174  return;
1175 
1176  SfxStyleSheetBase* pOldStyle = pStylePool->Find(aPageStyle, SfxStyleFamily::Page);
1177  if (pOldStyle && pNewStyle)
1178  {
1179  SfxItemSet& rOldSet = pOldStyle->GetItemSet();
1180  SfxItemSet& rNewSet = pNewStyle->GetItemSet();
1181  auto getScaleValue = [](const SfxItemSet& rSet, sal_uInt16 nId) {
1182  return static_cast<const SfxUInt16Item&>(rSet.Get(nId)).GetValue();
1183  };
1184 
1185  const sal_uInt16 nOldScale = getScaleValue(rOldSet, ATTR_PAGE_SCALE);
1186  const sal_uInt16 nOldScaleToPages = getScaleValue(rOldSet, ATTR_PAGE_SCALETOPAGES);
1187  const sal_uInt16 nNewScale = getScaleValue(rNewSet, ATTR_PAGE_SCALE);
1188  const sal_uInt16 nNewScaleToPages = getScaleValue(rNewSet, ATTR_PAGE_SCALETOPAGES);
1189 
1190  if ((nOldScale != nNewScale) || (nOldScaleToPages != nNewScaleToPages))
1191  InvalidateTextWidth(nullptr, nullptr, false, false);
1192  }
1193 
1194  if (pNewStyle) // also without the old one (for UpdateStdNames)
1195  aPageStyle = aStrNew;
1196 
1197  SetStreamValid(false);
1198 }
1199 
1200 void ScTable::PageStyleModified(const OUString& rNewName)
1201 {
1202  aPageStyle = rNewName;
1203  InvalidateTextWidth(nullptr, nullptr, false, false); // don't know what was in the style before
1204 }
1205 
1206 void ScTable::InvalidateTextWidth(const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1207  bool bNumFormatChanged, bool bBroadcast)
1208 {
1209  if (pAdrFrom && !pAdrTo)
1210  {
1211  // Special case: only process the "from" cell.
1212  SCCOL nCol = pAdrFrom->Col();
1213  SCROW nRow = pAdrFrom->Row();
1214  if (nCol >= aCol.size())
1215  return;
1216  ScColumn& rCol = aCol[nCol];
1217  ScRefCellValue aCell = rCol.GetCellValue(nRow);
1218  if (aCell.isEmpty())
1219  return;
1220 
1221  rCol.SetTextWidth(nRow, TEXTWIDTH_DIRTY);
1222 
1223  if (bNumFormatChanged)
1224  rCol.SetScriptType(nRow, SvtScriptType::UNKNOWN);
1225 
1226  if (bBroadcast)
1227  { // Only with CalcAsShown
1228  switch (aCell.meType)
1229  {
1230  case CELLTYPE_VALUE:
1231  rCol.Broadcast(nRow);
1232  break;
1233  case CELLTYPE_FORMULA:
1234  aCell.mpFormula->SetDirty();
1235  break;
1236  default:
1237  {
1238  // added to avoid warnings
1239  }
1240  }
1241  }
1242 
1243  return;
1244  }
1245 
1246  const SCCOL nCol1 = pAdrFrom ? pAdrFrom->Col() : 0;
1247  const SCROW nRow1 = pAdrFrom ? pAdrFrom->Row() : 0;
1248  const SCCOL nCol2 = pAdrTo ? pAdrTo->Col() : aCol.size() - 1;
1249  const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : rDocument.MaxRow();
1250 
1251  for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
1252  {
1253  ScColumnTextWidthIterator aIter(GetDoc(), aCol[nCol], nRow1, nRow2);
1254  sc::ColumnBlockPosition blockPos; // cache mdds position
1255  InitColumnBlockPosition(blockPos, nCol);
1256 
1257  for (; aIter.hasCell(); aIter.next())
1258  {
1259  SCROW nRow = aIter.getPos();
1260  aIter.setValue(TEXTWIDTH_DIRTY);
1261  ScRefCellValue aCell = aCol[nCol].GetCellValue(blockPos, nRow);
1262  if (aCell.isEmpty())
1263  continue;
1264 
1265  if (bNumFormatChanged)
1266  aCol[nCol].SetScriptType(nRow, SvtScriptType::UNKNOWN);
1267 
1268  if (bBroadcast)
1269  { // Only with CalcAsShown
1270  switch (aCell.meType)
1271  {
1272  case CELLTYPE_VALUE:
1273  aCol[nCol].Broadcast(nRow);
1274  break;
1275  case CELLTYPE_FORMULA:
1276  aCell.mpFormula->SetDirty();
1277  break;
1278  default:
1279  {
1280  // added to avoid warnings
1281  }
1282  }
1283  }
1284  }
1285  }
1286 }
1287 
1288 /* 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:853
ScAddress aStart
Definition: address.hxx:499
void SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
Definition: column2.cxx:2050
bool HasRowManualBreak(SCROW nRow) const
Definition: table5.cxx:378
std::vector< SdrObject * > GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow)
Definition: drwlayer.cxx:2453
std::unique_ptr< ScFlatUInt16RowSegments > mpRowHeights
Definition: table.hxx:181
void InvalidateTextWidth(const ScAddress *pAdrFrom, const ScAddress *pAdrTo, bool bNumFormatChanged, bool bBroadcast)
Definition: table5.cxx:1206
SCROW Row() const
Definition: address.hxx:261
const ScRange * GetPrintRange(sal_uInt16 nPos) const
Definition: table1.cxx:2254
Size GetPageSize() const
Definition: table5.cxx:1102
std::unique_ptr< ContentProperties > pData
void setValue(sal_uInt16 nVal)
SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:954
void PageStyleModified(const OUString &rNewName)
Definition: table5.cxx:1200
bool mbForceBreaks
Definition: table.hxx:246
void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:400
SCTAB GetTab() const
Definition: table.hxx:281
::std::set< SCROW > maRowPageBreaks
Definition: table.hxx:190
bool isEmpty() const
Definition: cellvalue.cxx:670
sheet protection state container
void StartListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1123
sal_uInt16 GetPrintRangeCount() const
Definition: table.hxx:774
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALE(175)
SCCOL size() const
long Long
void CopyRowFiltered(const ScTable &rTable, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:901
static ScDrawObjData * GetObjData(SdrObject *pObj, bool bCreate=false)
Definition: drwlayer.cxx:2591
bool getValue(SCROW nPos, bool &rVal)
void SetPageSize(const Size &rSize)
Definition: table5.cxx:1074
std::unique_ptr< ScFlatBoolColSegments > mpFilteredCols
Definition: table.hxx:187
void Broadcast(SCROW nRow)
Definition: column3.cxx:69
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:811
std::vector< SdrObject * > GetObjectsAnchoredToCols(SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol)
Definition: drwlayer.cxx:2524
ScAddress aEnd
Definition: address.hxx:500
void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden)
Definition: table5.cxx:638
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:923
SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:744
bool ValidRow(SCROW nRow) const
Definition: table.hxx:331
void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual)
Definition: table5.cxx:412
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:285
void SetRowBreak(SCROW nRow, bool bPage, bool bManual)
Definition: table5.cxx:442
ScRefCellValue GetCellValue(SCROW nRow) const
Definition: column.cxx:733
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 SetColManualBreaks(const ::std::set< SCCOL > &rBreaks)
Definition: table5.cxx:329
void EndListening(const ScAddress &rAddress, SvtListener *pListener)
Definition: table5.cxx:1131
const ScTableProtection * GetProtection() const
Definition: table5.cxx:1100
int nCount
void SetPageStyle(const OUString &rName)
Definition: table5.cxx:1158
ScFormulaCell * mpFormula
Definition: cellvalue.hxx:110
SCTAB Tab() const
Definition: address.hxx:270
SCROW nRepeatStartY
Definition: table.hxx:175
void CopyColHidden(const ScTable &rTable, SCCOL nStartCol, SCCOL nEndCol)
Definition: table5.cxx:672
bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
Definition: table5.cxx:588
SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:931
ScBroadcastAreaSlotMachine * GetBASM() const
Definition: document.hxx:2153
void SetRowManualBreaks(const ::std::set< SCROW > &rBreaks)
Definition: table5.cxx:322
void SetDirty(bool bDirtyFlag=true)
std::unique_ptr< ScBitMaskCompressedArray< SCCOL, CRFlags > > mpColFlags
Definition: table.hxx:183
constexpr OUStringLiteral aData
std::unique_ptr< ScFlatBoolColSegments > mpHiddenCols
Definition: table.hxx:185
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:571
bool IsProtected() const
Definition: table5.cxx:1088
bool ValidCol(SCCOL nCol) const
Definition: table.hxx:330
ScDocument & GetDoc()
Definition: table.hxx:279
bool IsImportingXML() const
Definition: document.hxx:2149
bool IsEmpty() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
bool HasColManualBreak(SCCOL nCol) const
Definition: table5.cxx:386
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:427
void CopyRowHidden(const ScTable &rTable, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:687
std::unique_ptr< ScTableProtection > pTabProtection
Definition: table.hxx:178
ScColContainer aCol
Definition: table.hxx:157
void GetAllRowBreaks(::std::set< SCROW > &rBreaks, bool bPage, bool bManual) const
Definition: table5.cxx:336
::std::set< SCROW > maRowManualBreaks
Definition: table.hxx:191
bool HasRowPageBreak(SCROW nRow) const
Definition: table5.cxx:362
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:1530
CellType meType
Definition: cellvalue.hxx:105
bool HasManualBreaks() const
Definition: table5.cxx:317
SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:767
void GetAllColBreaks(::std::set< SCCOL > &rBreaks, bool bPage, bool bManual) const
Definition: table5.cxx:349
::std::set< SCCOL > maColPageBreaks
Definition: table.hxx:192
SCCOL nRepeatEndX
Definition: table.hxx:174
bool RowHidden(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:496
CRFlags
Definition: global.hxx:134
sal_Int32 SCROW
Definition: types.hxx:17
void SetProtection(const ScTableProtection *pProtect)
Definition: table5.cxx:1090
OUString aPageStyle
Definition: table.hxx:171
OUString ScResId(std::string_view aId)
Definition: scdll.cxx:89
std::unique_ptr< ScFlatBoolRowSegments > mpFilteredRows
Definition: table.hxx:188
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:788
constexpr tools::Long Height() const
SCROW nRepeatEndY
Definition: table.hxx:176
ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const
Definition: table1.cxx:2610
bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:871
::std::set< SCCOL > maColManualBreaks
Definition: table.hxx:193
void SetRepeatArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow)
Definition: table5.cxx:1110
SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:977
void CopyRowHeight(const ScTable &rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset)
Definition: table5.cxx:701
bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:556
std::unique_ptr< ScCompressedArray< SCCOL, sal_uInt16 > > mpColWidth
Definition: table.hxx:180
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:457
SC_DLLPUBLIC ScStyleSheetPool * GetStyleSheetPool() const
Definition: document.cxx:6092
SCCOL nRepeatStartX
Definition: table.hxx:173
constexpr TypedWhichId< SfxUInt16Item > ATTR_PAGE_SCALETOPAGES(176)
void SetScriptType(SCROW nRow, SvtScriptType nType)
Definition: column2.cxx:2140
bool RowFiltered(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:835
bool IsManualRowHeight(SCROW nRow) const
Definition: table5.cxx:998
SCROW GetNextManualBreak(SCROW nRow) const
Get the row position of the next manual break that occurs at or below specified row.
Definition: table5.cxx:394
The data type represents bits, manageable by bitwise operations.
ScDocument & rDocument
Definition: table.hxx:205
void SyncColRowFlags()
Definition: table5.cxx:1053
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:370
std::unique_ptr< ScBitMaskCompressedArray< SCROW, CRFlags > > pRowFlags
Definition: table.hxx:184
bool RowHiddenLeaf(SCROW nRow, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: table5.cxx:526
bool bPageSizeValid
Definition: table.hxx:235
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:186
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:1766
Size aPageSizeTwips
Definition: table.hxx:172
const SCCOL SCCOL_REPEAT_NONE
Definition: address.hxx:86
void CopyColFiltered(const ScTable &rTable, SCCOL nStartCol, SCCOL nEndCol)
Definition: table5.cxx:886
css::uno::Sequence< css::sheet::TablePageBreakData > GetRowBreakData() const
Definition: table5.cxx:472
SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const
Definition: table5.cxx:721
#define TEXTWIDTH_DIRTY
Definition: globalnames.hxx:17
void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered)
Definition: table5.cxx:915
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo