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