LibreOffice Module sc (master)  1
table7.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 
10 #include <table.hxx>
11 #include <clipcontext.hxx>
12 #include <document.hxx>
13 #include <clipparam.hxx>
14 #include <segmenttree.hxx>
15 #include <sharedformula.hxx>
16 #include <cellvalues.hxx>
17 #include <olinetab.hxx>
18 #include <tabprotection.hxx>
19 #include <columniterator.hxx>
20 #include <drwlayer.hxx>
21 #include <compressedarray.hxx>
22 
23 #include <osl/diagnose.h>
24 #include <sal/log.hxx>
25 #include <tools/stream.hxx>
26 
27 bool ScTable::IsMerged( SCCOL nCol, SCROW nRow ) const
28 {
29  if (!ValidCol(nCol) || nCol >= GetAllocatedColumnsCount() )
30  return false;
31 
32  return aCol[nCol].IsMerged(nRow);
33 }
34 
36 {
37  if (!ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2))
38  return sc::MultiDataCellState();
39 
40  if (nCol1 > nCol2 || nRow1 > nRow2)
41  // invalid range.
42  return sc::MultiDataCellState();
43 
44  if (aCol.empty())
46 
47  auto setFirstCell = []( sc::MultiDataCellState& rRet, SCCOL nCurCol, SCROW nCurRow )
48  {
49  if (rRet.mnCol1 < 0)
50  {
51  // First cell not yet set. Set it.
52  rRet.mnCol1 = nCurCol;
53  rRet.mnRow1 = nCurRow;
54  }
55  };
56 
57  SCCOL nMaxCol = aCol.size()-1;
58  bool bHasOne = false;
60 
61  for (SCCOL nCol = nCol1; nCol <= nCol2 && nCol <= nMaxCol; ++nCol)
62  {
63  SCROW nFirstDataRow = -1;
64  switch (aCol[nCol].HasDataCellsInRange(nRow1, nRow2, &nFirstDataRow))
65  {
67  {
68  setFirstCell(aRet, nCol, nFirstDataRow);
69 
70  if (bHasOne)
71  {
72  // We've already found one data cell in another column.
74  return aRet;
75  }
76  bHasOne = true;
77  break;
78  }
80  {
81  setFirstCell(aRet, nCol, nFirstDataRow);
82 
84  return aRet;
85  }
87  default:
88  ;
89  }
90  }
91 
92  if (bHasOne)
94 
95  return aRet;
96 }
97 
99  sc::CopyFromClipContext& rCxt, const ScTable& rClipTab, sc::ColumnSpanSet& rBroadcastSpans )
100 {
102  if (!ValidCol(aRange.mnCol1) || !ValidCol(aRange.mnCol2))
103  return;
104 
105  // Pass some stuff to the columns via context.
108 
109  ScRange aClipRange = rCxt.getClipDoc()->GetClipParam().getWholeRange();
110  SCCOL nClipCol = aClipRange.aStart.Col();
111  {
112  const SCCOL nMaxCol2 = std::min<SCCOL>( aRange.mnCol2, aCol.size() - 1 );
113  for (SCCOL nCol = aRange.mnCol1; nCol <= nMaxCol2; ++nCol, ++nClipCol)
114  {
115  if (nClipCol > aClipRange.aEnd.Col())
116  nClipCol = aClipRange.aStart.Col(); // loop through columns.
117 
118  const ScColumn& rClipCol = rClipTab.aCol[nClipCol];
119  aCol[nCol].DeleteBeforeCopyFromClip(rCxt, rClipCol, rBroadcastSpans);
120  }
121  }
122 
123  SetStreamValid(false);
124 }
125 
127  sc::CopyFromClipContext& rCxt, const SCCOL nCol1, const SCROW nRow1, const SCCOL nCol2, const SCROW nRow2, const SCROW nSrcRow, const ScTable* pSrcTab )
128 {
129  ScRange aSrcRange = rCxt.getClipDoc()->GetClipParam().getWholeRange();
130  SCCOL nSrcColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1;
131 
132  for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
133  {
134  SCCOL nColOffset = nCol - nCol1;
135  nColOffset = nColOffset % nSrcColSize;
136  assert(nColOffset >= 0);
137  CreateColumnIfNotExists(nCol).CopyOneCellFromClip(rCxt, nRow1, nRow2, nColOffset);
138 
140  {
141  for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
142  CopyConditionalFormat(nCol, nRow, nCol, nRow, nCol - aSrcRange.aStart.Col() - nColOffset,
143  nRow - nSrcRow, pSrcTab);
144  }
145  }
146 
147  if (nCol1 == 0 && nCol2 == rDocument.MaxCol() && mpRowHeights)
148  {
149  mpRowHeights->setValue(nRow1, nRow2, pSrcTab->GetOriginalHeight(nSrcRow));
150 
151  if (pRowFlags && pSrcTab->pRowFlags) {
152  if (pSrcTab->pRowFlags->GetValue(nSrcRow) & CRFlags::ManualSize)
153  pRowFlags->OrValue(nRow1, CRFlags::ManualSize);
154  else
155  pRowFlags->AndValue(nRow1, ~CRFlags::ManualSize);
156  }
157  }
158 
159  // Copy graphics over too
160  bool bCopyGraphics
162  if (!(bCopyGraphics && rCxt.getClipDoc()->mpDrawLayer))
163  return;
164 
165  ScDrawLayer* pDrawLayer = GetDoc().GetDrawLayer();
166  OSL_ENSURE(pDrawLayer, "No drawing layer");
167  if (pDrawLayer)
168  {
169  const ScAddress aSrcStartPos
171  const ScAddress aSrcEndPos = rCxt.getClipDoc()->GetClipParam().getWholeRange().aEnd;
172  tools::Rectangle aSourceRect = rCxt.getClipDoc()->GetMMRect(
173  aSrcStartPos.Col(), aSrcStartPos.Row(), aSrcEndPos.Col(), aSrcEndPos.Row(),
174  aSrcStartPos.Tab());
175  tools::Rectangle aDestRect = GetDoc().GetMMRect(nCol1, nRow1, nCol2, nRow2, nTab);
176  pDrawLayer->CopyFromClip(rCxt.getClipDoc()->mpDrawLayer.get(), aSrcStartPos.Tab(),
177  aSourceRect, ScAddress(nCol1, nRow1, nTab), aDestRect);
178  }
179 }
180 
181 void ScTable::SetValues( const SCCOL nCol, const SCROW nRow, const std::vector<double>& rVals )
182 {
183  if (!ValidCol(nCol))
184  return;
185 
186  CreateColumnIfNotExists(nCol).SetValues(nRow, rVals);
187 }
188 
189 void ScTable::TransferCellValuesTo( const SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest )
190 {
191  if (!ValidCol(nCol))
192  return;
193 
194  CreateColumnIfNotExists(nCol).TransferCellValuesTo(nRow, nLen, rDest);
195 }
196 
197 void ScTable::CopyCellValuesFrom( const SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc )
198 {
199  if (!ValidCol(nCol))
200  return;
201 
203 }
204 
206  sc::EndListeningContext& rCxt, const SCCOL nCol1, const SCROW nRow1, const SCCOL nCol2, const SCROW nRow2,
207  sc::TableValues* pUndo )
208 {
209  if (!ValidCol(nCol1) || !ValidCol(nCol2) || nCol1 > nCol2)
210  return;
211 
212  for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
213  CreateColumnIfNotExists(nCol).ConvertFormulaToValue(rCxt, nRow1, nRow2, pUndo);
214 }
215 
217  sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt )
218 {
219  const ScRange& rRange = rValues.getRange();
220  assert(rRange.IsValid());
221  for (SCCOL nCol = rRange.aStart.Col(); nCol <= rRange.aEnd.Col(); ++nCol)
222  CreateColumnIfNotExists(nCol).SwapNonEmpty(rValues, rStartCxt, rEndCxt);
223 }
224 
226  sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt )
227 {
228  for (SCCOL i = 0; i < aCol.size(); ++i)
229  aCol[i].PreprocessRangeNameUpdate(rEndListenCxt, rCompileCxt);
230 }
231 
233  sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt )
234 {
235  for (SCCOL i = 0; i < aCol.size(); ++i)
236  aCol[i].PreprocessDBDataUpdate(rEndListenCxt, rCompileCxt);
237 }
238 
240  sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt )
241 {
242  for (SCCOL i = 0; i < aCol.size(); ++i)
243  aCol[i].CompileHybridFormula(rStartListenCxt, rCompileCxt);
244 }
245 
246 void ScTable::UpdateScriptTypes( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2 )
247 {
248  if (!IsColValid(nCol1) || !ValidCol(nCol2) || nCol1 > nCol2)
249  return;
250 
251  const SCCOL nMaxCol2 = std::min<SCCOL>( nCol2, aCol.size() - 1 );
252 
253  for (SCCOL nCol = nCol1; nCol <= nMaxCol2; ++nCol)
254  aCol[nCol].UpdateScriptTypes(nRow1, nRow2);
255 }
256 
257 bool ScTable::HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const
258 {
259  if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
260  return false;
261 
263  if (!mpRowHeights->getRangeData(nRow1, aData))
264  // Search failed.
265  return false;
266 
267  return nRow2 <= aData.mnRow2;
268 }
269 
270 void ScTable::SplitFormulaGroups( SCCOL nCol, std::vector<SCROW>& rRows )
271 {
272  if (!IsColValid(nCol))
273  return;
274 
276 }
277 
278 void ScTable::UnshareFormulaCells( SCCOL nCol, std::vector<SCROW>& rRows )
279 {
280  if (!IsColValid(nCol))
281  return;
282 
284 }
285 
287 {
288  if (!IsColValid(nCol))
289  return;
290 
291  aCol[nCol].RegroupFormulaCells();
292 }
293 
294 bool ScTable::HasFormulaCell( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2 ) const
295 {
296  if (nCol2 < nCol1 || !IsColValid(nCol1) || !ValidCol(nCol2))
297  return false;
298 
299  const SCCOL nMaxCol2 = std::min<SCCOL>( nCol2, aCol.size() - 1 );
300 
301  for (SCCOL nCol = nCol1; nCol <= nMaxCol2; ++nCol)
302  if (aCol[nCol].HasFormulaCell(nRow1, nRow2))
303  return true;
304 
305  return false;
306 }
307 
309  sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, std::vector<ScAddress>* pGroupPos )
310 {
311  if (!IsColValid(nCol))
312  return;
313 
314  aCol[nCol].EndListeningIntersectedGroup(rCxt, nRow, pGroupPos);
315 }
316 
318  sc::EndListeningContext& rCxt, const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2,
319  std::vector<ScAddress>* pGroupPos )
320 {
321  if (nCol2 < nCol1 || !IsColValid(nCol1) || !ValidCol(nCol2))
322  return;
323 
324  for (SCCOL nCol : GetColumnsRange(nCol1, nCol2))
325  aCol[nCol].EndListeningIntersectedGroups(rCxt, nRow1, nRow2, pGroupPos);
326 }
327 
329 {
330  if (!IsColValid(nCol))
331  return;
332 
333  aCol[nCol].EndListeningGroup(rCxt, nRow);
334 }
335 
337 {
338  if (!ValidCol(nCol))
339  return;
340 
342 }
343 
345  sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd ) const
346 {
347  if (!IsProtected())
348  {
349  SCCOL nCol1 = 0, nCol2 = aCol.size() - 1;
350  SCROW nRow1 = 0, nRow2 = rDocument.MaxRow();
351 
352  switch (eAction)
353  {
357  {
358  nCol1 = nStart;
359  nCol2 = nEnd;
360  break;
361  }
365  {
366  nRow1 = nStart;
367  nRow2 = nEnd;
368  break;
369  }
370  default:
371  ;
372  }
373 
374  return IsBlockEditable(nCol1, nRow1, nCol2, nRow2, nullptr);
375  }
376 
377  if (IsScenario())
378  // TODO: I don't even know what this scenario thingie is. Perhaps we
379  // should check it against the scenario ranges?
380  return false;
381 
382  assert(pTabProtection);
383 
384  switch (eAction)
385  {
388  {
389  // TODO: improve the matrix range handling for the insert-before action.
390  if (HasBlockMatrixFragment(nStart, 0, nEnd, rDocument.MaxRow()))
391  return false;
392 
393  return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_COLUMNS);
394  }
397  {
398  // TODO: improve the matrix range handling for the insert-before action.
399  if (HasBlockMatrixFragment(0, nStart, rDocument.MaxCol(), nEnd))
400  return false;
401 
402  return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_ROWS);
403  }
405  {
406  if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_COLUMNS))
407  return false;
408 
409  return !HasAttrib(nStart, 0, nEnd, rDocument.MaxRow(), HasAttrFlags::Protected);
410  }
412  {
413  if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_ROWS))
414  return false;
415 
416  return !HasAttrib(0, nStart, rDocument.MaxCol(), nEnd, HasAttrFlags::Protected);
417  }
418  default:
419  ;
420  }
421 
422  return false;
423 }
424 
425 std::optional<sc::ColumnIterator> ScTable::GetColumnIterator( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const
426 {
427  if (!ValidCol(nCol))
428  return {};
429 
430  return CreateColumnIfNotExists(nCol).GetColumnIterator(nRow1, nRow2);
431 }
432 
433 bool ScTable::EnsureFormulaCellResults( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, bool bSkipRunning )
434 {
435  if (nCol2 < nCol1 || !IsColValid(nCol1) || !ValidCol(nCol2))
436  return false;
437 
438  const SCCOL nMaxCol2 = std::min<SCCOL>( nCol2, aCol.size() - 1 );
439 
440  bool bAnyDirty = false;
441 
442  for (SCCOL nCol = nCol1; nCol <= nMaxCol2; ++nCol)
443  {
444  bool bRet = aCol[nCol].EnsureFormulaCellResults(nRow1, nRow2, bSkipRunning);
445  bAnyDirty = bAnyDirty || bRet;
446  }
447 
448  return bAnyDirty;
449 }
450 
452 {
453  if (pOutlineTable && pRowFlags)
454  {
455  pOutlineTable->GetRowArray().finalizeImport(*this);
456  }
457 }
458 
459 void ScTable::StoreToCache(SvStream& rStrm) const
460 {
461  SCCOL nStartCol = 0;
462  SCCOL nEndCol = rDocument.MaxCol();
463  SCROW nStartRow = 0;
464  SCROW nEndRow = rDocument.MaxRow();
465 
466  GetDataArea(nStartCol, nStartRow, nEndCol, nEndRow, false, false);
467 
468  rStrm.WriteUInt64(nEndCol + 1);
469  for (SCCOL nCol = 0; nCol <= nEndCol; ++nCol)
470  {
471  aCol[nCol].StoreToCache(rStrm);
472  }
473 }
474 
476 {
477  sal_uInt64 nCols = 0;
478  rStrm.ReadUInt64(nCols);
479  for (SCCOL nCol = 0; nCol < static_cast<SCCOL>(nCols); ++nCol)
480  {
481  aCol[nCol].RestoreFromCache(rStrm);
482  }
483 }
484 
485 OString ScTable::dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType)
486 {
487  switch (eGeomType)
488  {
490  // returns a non-empty space separated list of spans with trailing space.
491  // The format of the span is <size of any row/col in the span in print twips>:<last row/col of the span>
492  // Example (for columns with three spans if MAXCOL is 1023): "1280:3 1049:50 1280:1023"
493  return dumpColumnRowSizes(bColumns);
495  // returns a non-empty space separated list of spans with trailing space.
496  // The format of the span is:
497  // 1) First span: <1 (span is hidden) / 0 (not hidden)>:<last row/col of the span>
498  // 2) Rest of the spans: <last row/col of the span>
499  // The hidden state of the spans after the first can be inferred from the first span's flag as no adjacent
500  // spans can have the same state by definition of span.
501  return dumpHiddenFiltered(bColumns, /*bHidden*/ true);
503  // has exactly the same format as 'hidden'.
504  return dumpHiddenFiltered(bColumns, /*bHidden*/ false);
506  // returns a space separated list of 'levels' with trailing space.
507  // A 'level' is a comma separated list of groups(outline entries) with trailing comma.
508  // format of a group is:
509  // <start row/col of group>:<number of rows/cols in the group>:<1/0(group is hidden?)>:<1/0(control is visible?)>
510  return dumpColumnRowGroups(bColumns);
511  default:
512  ;
513  }
514 
515  return "";
516 }
517 
518 OString ScTable::dumpColumnRowSizes(bool bColumns)
519 {
520  // If the data-structures are not available, just report that all
521  // rows/cols have the default sizes.
522  static const OString aDefaultForCols
523  = OString::number(STD_COL_WIDTH) + ":" + OString::number(MAXCOL) + " ";
524  static const OString aDefaultForRows
525  = OString::number(ScGlobal::nStdRowHeight) + ":" + OString::number(MAXROW) + " ";
526 
527  // ScCompressedArray is a template class and we don't want to impose
528  // the restriction that its value type should be string serializable,
529  // instead just operate on the specialized object.
530  typedef ScCompressedArray<SCCOL, sal_uInt16> ColWidthsType;
531  auto dumpColWidths = [](const ColWidthsType& rWidths) -> OString {
532  OString aOutput;
533  OString aSegment;
534  SCCOL nStartCol = 0;
535  const SCCOL nMaxCol = std::min(rWidths.GetLastPos(), MAXCOL);
536  size_t nDummy = 0;
537  while (nStartCol <= nMaxCol)
538  {
539  SCCOL nEndCol;
540  sal_uInt16 nWidth = rWidths.GetValue(nStartCol, nDummy, nEndCol);
541  // The last span nEndCol is always MAXCOL+1 for some reason, and we don't want that.
542  if (nEndCol > nMaxCol)
543  nEndCol = nMaxCol;
544  aSegment = OString::number(nWidth) + ":" + OString::number(nEndCol) + " ";
545  aOutput += aSegment;
546  nStartCol = nEndCol + 1;
547  }
548 
549  return aOutput;
550  };
551 
552  if (bColumns)
553  return mpColWidth ? dumpColWidths(*mpColWidth) : aDefaultForCols;
554 
555  return mpRowHeights ? mpRowHeights->dumpAsString() : aDefaultForRows;
556 }
557 
558 OString ScTable::dumpHiddenFiltered(bool bColumns, bool bHidden)
559 {
560  // defaults to no hidden/filtered row/cols.
561  static const OString aDefaultForCols = "0:" + OString::number(MAXCOL) + " ";
562  static const OString aDefaultForRows = "0:" + OString::number(MAXROW) + " ";
563 
564  if (bHidden)
565  {
566  if (bColumns)
567  return mpHiddenCols ? mpHiddenCols->dumpAsString() : aDefaultForCols;
568 
569  return mpHiddenRows ? mpHiddenRows->dumpAsString() : aDefaultForRows;
570  }
571 
572  if (bColumns)
573  return mpFilteredCols ? mpFilteredCols->dumpAsString() : aDefaultForCols;
574 
575  return mpFilteredRows ? mpFilteredRows->dumpAsString() : aDefaultForRows;
576 }
577 
578 OString ScTable::dumpColumnRowGroups(bool bColumns) const
579 {
580  if (!pOutlineTable)
581  return "";
582 
583  if (bColumns)
584  return pOutlineTable->GetColArray().dumpAsString();
585 
586  return pOutlineTable->GetRowArray().dumpAsString();
587 }
588 
590 {
591  return maLOKFreezeCell.Col();
592 }
593 
595 {
596  return maLOKFreezeCell.Row();
597 }
598 
600 {
601  if (!ValidCol(nFreezeCol))
602  {
603  SAL_WARN("sc.core", "ScTable::SetLOKFreezeCol : invalid nFreezeCol = " << nFreezeCol);
604  return false;
605  }
606 
607  if (maLOKFreezeCell.Col() != nFreezeCol)
608  {
609  maLOKFreezeCell.SetCol(nFreezeCol);
610  return true;
611  }
612 
613  return false;
614 }
615 
617 {
618  if (!ValidRow(nFreezeRow))
619  {
620  SAL_WARN("sc.core", "ScTable::SetLOKFreezeRow : invalid nFreezeRow = " << nFreezeRow);
621  return false;
622  }
623 
624  if (maLOKFreezeCell.Row() != nFreezeRow)
625  {
626  maLOKFreezeCell.SetRow(nFreezeRow);
627  return true;
628  }
629 
630  return false;
631 }
632 
633 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SCTAB nTab
Definition: table.hxx:205
SvStream & WriteUInt64(sal_uInt64 nuInt64)
bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask) const
Definition: table2.cxx:2212
ScAddress aStart
Definition: address.hxx:499
void TransferCellValuesTo(const SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues &rDest)
Definition: table7.cxx:189
bool HasBlockMatrixFragment(const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, bool bNoMatrixAtAll=false) const
Definition: table2.cxx:2443
std::optional< sc::ColumnIterator > GetColumnIterator(SCCOL nCol, SCROW nRow1, SCROW nRow2) const
Definition: table7.cxx:425
std::unique_ptr< ScFlatUInt16RowSegments > mpRowHeights
Definition: table.hxx:182
SCROW Row() const
Definition: address.hxx:261
void SetValues(const SCCOL nCol, const SCROW nRow, const std::vector< double > &rVals)
Definition: table7.cxx:181
void SwapNonEmpty(sc::TableValues &rValues, sc::StartListeningContext &rStartCxt, sc::EndListeningContext &rEndCxt)
Definition: column4.cxx:495
void UpdateScriptTypes(const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2)
Definition: table7.cxx:246
bool HasFormulaCell(const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2) const
Definition: table7.cxx:294
Think of this as a mini-ScColumn like storage that only stores cell values in a column.
Definition: cellvalues.hxx:40
SCCOL size() const
std::unique_ptr< ScFlatBoolColSegments > mpFilteredCols
Definition: table.hxx:188
void TransferCellValuesTo(SCROW nRow, size_t nLen, sc::CellValues &rDest)
Definition: column4.cxx:341
InsertDeleteFlags getInsertFlag() const
Stores cell values for multiple tables.
Definition: cellvalues.hxx:85
ScAddress aEnd
Definition: address.hxx:500
void CopyFromClip(ScDrawLayer *pClipModel, SCTAB nSourceTab, const tools::Rectangle &rSourceRange, const ScAddress &rDestPos, const tools::Rectangle &rDestRange)
Definition: drwlayer.cxx:1790
sal_uInt16 GetOriginalHeight(SCROW nRow) const
Definition: table2.cxx:3497
bool empty() const
SvStream & ReadUInt64(sal_uInt64 &rUInt64)
void CompileHybridFormula(sc::StartListeningContext &rStartListenCxt, sc::CompileFormulaContext &rCompileCxt)
Definition: table7.cxx:239
void RestoreFromCache(SvStream &rStrm)
Definition: table7.cxx:475
void PreprocessDBDataUpdate(sc::EndListeningContext &rEndListenCxt, sc::CompileFormulaContext &rCompileCxt)
Definition: table7.cxx:232
Internal use only (d&d undo): do not delete caption objects of cell notes.
bool ValidRow(SCROW nRow) const
Definition: table.hxx:333
void SetStreamValid(bool bSet, bool bIgnoreLock=false)
Definition: table1.cxx:374
ScColumn & CreateColumnIfNotExists(const SCCOL nScCol) const
Definition: table.hxx:287
bool IsEditActionAllowed(sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd) const
Definition: table7.cxx:344
#define STD_COL_WIDTH
Definition: global.hxx:94
ScClipParam & GetClipParam()
Definition: document.cxx:2566
bool IsBlockEditable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: table2.cxx:2555
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:871
void finalizeOutlineImport()
Definition: table7.cxx:451
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
void setCondFormatList(ScConditionalFormatList *pCondFormatList)
const SCROW MAXROW
Definition: address.hxx:68
void ConvertFormulaToValue(sc::EndListeningContext &rCxt, const SCCOL nCol1, const SCROW nRow1, const SCCOL nCol2, const SCROW nRow2, sc::TableValues *pUndo)
Definition: table7.cxx:205
void PreprocessRangeNameUpdate(sc::EndListeningContext &rEndListenCxt, sc::CompileFormulaContext &rCompileCxt)
Definition: table7.cxx:225
SCTAB Tab() const
Definition: address.hxx:270
void SetRow(SCROW nRowP)
Definition: address.hxx:274
void CopyCellValuesFrom(const SCCOL nCol, SCROW nRow, const sc::CellValues &rSrc)
Definition: table7.cxx:197
void EndListeningIntersectedGroups(sc::EndListeningContext &rCxt, const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, std::vector< ScAddress > *pGroupPos)
Definition: table7.cxx:317
bool HasUniformRowHeight(SCROW nRow1, SCROW nRow2) const
Definition: table7.cxx:257
std::unique_ptr< ScOutlineTable > pOutlineTable
Definition: table.hxx:196
void SetNeedsListeningGroup(SCCOL nCol, SCROW nRow)
Definition: table7.cxx:336
void SetCol(SCCOL nColP)
Definition: address.hxx:278
std::unique_ptr< ScDrawLayer > mpDrawLayer
Definition: document.hxx:370
bool IsColValid(const SCCOL nScCol) const
Definition: table.hxx:320
constexpr OUStringLiteral aData
void CopyOneCellFromClip(sc::CopyFromClipContext &rCxt, const SCCOL nCol1, const SCROW nRow1, const SCCOL nCol2, const SCROW nRow2, const SCROW nSrcRow, const ScTable *pSrcTab)
Definition: table7.cxx:126
static SC_DLLPUBLIC sal_uInt16 nStdRowHeight
Definition: global.hxx:584
OString dumpColumnRowGroups(bool bColumns) const
Returns list-of-spans representation of the column/row groupings encoded as an OString.
Definition: table7.cxx:578
std::unique_ptr< ScFlatBoolColSegments > mpHiddenCols
Definition: table.hxx:186
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
Definition: document.hxx:1057
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:870
bool IsProtected() const
Definition: table5.cxx:1088
bool ValidCol(SCCOL nCol) const
Definition: table.hxx:332
ScDocument & GetDoc()
Definition: table.hxx:281
int i
void SetValues(const SCROW nRow, const std::vector< double > &rVals)
Definition: column4.cxx:311
sal_Int16 SCCOL
Definition: types.hxx:21
void UnshareFormulaCells(SCCOL nCol, std::vector< SCROW > &rRows)
Definition: table7.cxx:278
const SCCOL MAXCOL
Definition: address.hxx:69
sc::MultiDataCellState HasMultipleDataCells(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const
Definition: table7.cxx:35
ScAddress maLOKFreezeCell
Definition: table.hxx:231
std::unique_ptr< ScTableProtection > pTabProtection
Definition: table.hxx:179
Structure that stores segments of boolean flags per column, and perform custom action on those segmen...
OString dumpHiddenFiltered(bool bColumns, bool bHidden)
Returns list-of-spans representation of hidden/filtered states of columns/rows encoded as an OString...
Definition: table7.cxx:558
const ScRange & getRange() const
Definition: cellvalues.cxx:317
ScColContainer aCol
Definition: table.hxx:158
std::unique_ptr< ScConditionalFormatList > mpCondFormatList
Definition: table.hxx:229
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1996
bool IsValid() const
Definition: address.hxx:546
bool IsScenario() const
Definition: table.hxx:347
SCCOL Col() const
Definition: address.hxx:266
void setTableProtected(bool b)
SheetGeomType
Represents the type of sheet geometry data.
Definition: document.hxx:266
void EndListeningGroup(sc::EndListeningContext &rCxt, const SCCOL nCol, SCROW nRow)
Definition: table7.cxx:328
SCROW GetLOKFreezeRow() const
Definition: table7.cxx:594
bool SetLOKFreezeCol(SCCOL nFreezeCol)
Definition: table7.cxx:599
const D & GetValue(A nPos) const
sal_Int32 SCROW
Definition: types.hxx:17
ScRange getWholeRange() const
Return a single range that encompasses all individual ranges.
Definition: clipparam.cxx:109
ColRowEditAction
Definition: global.hxx:435
std::unique_ptr< ScFlatBoolRowSegments > mpFilteredRows
Definition: table.hxx:189
void CopyCellValuesFrom(SCROW nRow, const sc::CellValues &rSrc)
Definition: column4.cxx:366
void GetDataArea(SCCOL &rStartCol, SCROW &rStartRow, SCCOL &rEndCol, SCROW &rEndRow, bool bIncludeOld, bool bOnlyDown) const
Definition: table1.cxx:813
bool ValidColRow(SCCOL nCol, SCROW nRow) const
Definition: table.hxx:334
void CopyConditionalFormat(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCCOL nDx, SCROW nDy, const ScTable *pTable)
Definition: table2.cxx:623
ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const
Definition: table1.cxx:2610
void CopyOneCellFromClip(sc::CopyFromClipContext &rCxt, SCROW nRow1, SCROW nRow2, size_t nColOffset)
Definition: column4.cxx:195
std::unique_ptr< ScCompressedArray< SCCOL, sal_uInt16 > > mpColWidth
Definition: table.hxx:181
static bool splitFormulaCellGroups(const ScDocument &rDoc, CellStoreType &rCells, std::vector< SCROW > &rBounds)
Split existing shared formula ranges at specified row positions.
ScDocument * getClipDoc()
Definition: clipcontext.cxx:97
bool SetLOKFreezeRow(SCROW nFreezeRow)
Definition: table7.cxx:616
Compressed array of row (or column) entries, e.g.
void ConvertFormulaToValue(sc::EndListeningContext &rCxt, SCROW nRow1, SCROW nRow2, sc::TableValues *pUndo)
Definition: column4.cxx:432
std::optional< sc::ColumnIterator > GetColumnIterator(SCROW nRow1, SCROW nRow2) const
Definition: column4.cxx:1666
bool EnsureFormulaCellResults(const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, bool bSkipRunning=false)
Definition: table7.cxx:433
void RegroupFormulaCells(SCCOL nCol)
Definition: table7.cxx:286
Range getDestRange() const
Definition: clipcontext.cxx:82
#define SAL_WARN(area, stream)
ScDocument & rDocument
Definition: table.hxx:206
void DeleteBeforeCopyFromClip(sc::CopyFromClipContext &rCxt, const ScTable &rClipTab, sc::ColumnSpanSet &rBroadcastSpans)
Definition: table7.cxx:98
void EndListeningIntersectedGroup(sc::EndListeningContext &rCxt, SCCOL nCol, SCROW nRow, std::vector< ScAddress > *pGroupPos)
Definition: table7.cxx:308
std::unique_ptr< ScBitMaskCompressedArray< SCROW, CRFlags > > pRowFlags
Definition: table.hxx:185
void SwapNonEmpty(sc::TableValues &rValues, sc::StartListeningContext &rStartCxt, sc::EndListeningContext &rEndCxt)
Definition: table7.cxx:216
void StoreToCache(SvStream &rStrm) const
Definition: table7.cxx:459
std::unique_ptr< ScFlatBoolRowSegments > mpHiddenRows
Definition: table.hxx:187
SCCOL GetAllocatedColumnsCount() const
Definition: table.hxx:1099
void SetNeedsListeningGroup(SCROW nRow)
Definition: column4.cxx:1636
SCCOL GetLOKFreezeCol() const
Definition: table7.cxx:589
bool IsMerged(SCCOL nCol, SCROW nRow) const
Definition: table7.cxx:27
void SplitFormulaGroups(SCCOL nCol, std::vector< SCROW > &rRows)
Definition: table7.cxx:270
static void unshareFormulaCells(const ScDocument &rDoc, CellStoreType &rCells, std::vector< SCROW > &rRows)
Make specified formula cells non-shared ones, and split them off from their respective adjacent formu...
OString dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType)
Serializes the sheet's geometry data.
Definition: table7.cxx:485
OString dumpColumnRowSizes(bool bColumns)
Returns list-of-spans representation of the column-widths/row-heights in twips encoded as an OString...
Definition: table7.cxx:518