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