android: Update app-specific/MIME type icons
[LibreOffice.git] / sc / inc / table.hxx
blob780d122ce47ed2a508139dee821626b84ae393ad
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <tools/gen.hxx>
23 #include <tools/color.hxx>
24 #include "attarray.hxx"
25 #include "column.hxx"
26 #include "colcontainer.hxx"
27 #include "sortparam.hxx"
28 #include "types.hxx"
29 #include "cellvalue.hxx"
30 #include <formula/types.hxx>
31 #include "calcmacros.hxx"
32 #include <formula/errorcodes.hxx>
33 #include "document.hxx"
34 #include "drwlayer.hxx"
35 #include "SparklineList.hxx"
36 #include "SolverSettings.hxx"
38 #include <algorithm>
39 #include <atomic>
40 #include <memory>
41 #include <optional>
42 #include <set>
43 #include <vector>
45 template <typename A, typename D> class ScBitMaskCompressedArray;
46 template <typename A, typename D> class ScCompressedArray;
48 namespace utl {
49 class TextSearch;
52 namespace com::sun::star {
53 namespace sheet {
54 struct TablePageBreakData;
58 namespace formula { struct VectorRefArray; }
59 namespace sc {
61 struct BroadcasterState;
62 class StartListeningContext;
63 class EndListeningContext;
64 class CopyFromClipContext;
65 class CopyToClipContext;
66 class CopyToDocContext;
67 class MixDocContext;
68 class ColumnSpanSet;
69 class RangeColumnSpanSet;
70 class ColumnSet;
71 struct ColumnBlockPosition;
72 class TableColumnBlockPositionSet;
73 struct RefUpdateContext;
74 struct RefUpdateInsertTabContext;
75 struct RefUpdateDeleteTabContext;
76 struct RefUpdateMoveTabContext;
77 struct NoteEntry;
78 class DocumentStreamAccess;
79 class CellValues;
80 class TableValues;
81 class RowHeightContext;
82 class CompileFormulaContext;
83 struct SetFormulaDirtyContext;
84 class ColumnIterator;
85 class ScDrawObjData;
88 class SfxItemSet;
89 class SfxStyleSheetBase;
90 class SvxBoxInfoItem;
91 class SvxBoxItem;
92 class SvxSearchItem;
94 class ScAutoFormatData;
95 class ScEditDataArray;
96 class ScFormulaCell;
97 class ScOutlineTable;
98 class ScPrintSaverTab;
99 class ScProgress;
100 class ScRangeList;
101 class ScSheetEvents;
102 class ScSortInfoArray;
103 class ScConditionalFormat;
104 class ScConditionalFormatList;
105 class ScStyleSheet;
106 class ScTableProtection;
107 class ScUserListData;
108 struct RowInfo;
109 class ScFunctionData;
110 class CollatorWrapper;
111 class ScFlatUInt16RowSegments;
112 class ScFlatBoolRowSegments;
113 class ScFlatBoolColSegments;
114 struct ScSetStringParam;
115 struct ScColWidthParam;
116 class ScRangeName;
117 class ScDBData;
118 class ScHint;
119 class ScPostIt;
120 struct ScInterpreterContext;
123 class ScColumnsRange final
125 public:
126 class Iterator final
128 SCCOL mCol;
129 public:
130 typedef std::bidirectional_iterator_tag iterator_category;
131 typedef SCCOL value_type;
132 typedef SCCOL difference_type;
133 typedef const SCCOL* pointer;
134 typedef SCCOL reference;
136 explicit Iterator(SCCOL nCol) : mCol(nCol) {}
138 Iterator& operator++() { ++mCol; return *this;}
139 Iterator& operator--() { --mCol; return *this;}
141 // Comparing iterators from different containers is undefined, so comparing mCol is enough.
142 bool operator==(const Iterator & rOther) const {return mCol == rOther.mCol;}
143 bool operator!=(const Iterator & rOther) const {return !(*this == rOther);}
144 SCCOL operator*() const {return mCol;}
147 ScColumnsRange(SCCOL nBegin, SCCOL nEnd) : maBegin(nBegin), maEnd(nEnd) {}
148 const Iterator & begin() { return maBegin; }
149 const Iterator & end() { return maEnd; }
150 std::reverse_iterator<Iterator> rbegin() { return std::reverse_iterator<Iterator>(maEnd); }
151 std::reverse_iterator<Iterator> rend() { return std::reverse_iterator<Iterator>(maBegin); }
152 private:
153 const Iterator maBegin;
154 const Iterator maEnd;
157 class ScTable
159 private:
160 typedef ::std::vector< ScRange > ScRangeVec;
162 ScColContainer aCol;
164 OUString aName;
165 OUString aCodeName;
166 OUString aComment;
168 OUString aLinkDoc;
169 OUString aLinkFlt;
170 OUString aLinkOpt;
171 OUString aLinkTab;
172 sal_uLong nLinkRefreshDelay;
173 ScLinkMode nLinkMode;
175 // page style template
176 OUString aPageStyle;
177 Size aPageSizeTwips; // size of the print-page
178 SCCOL nRepeatStartX; // repeating rows/columns
179 SCCOL nRepeatEndX; // REPEAT_NONE, if not used
180 SCROW nRepeatStartY;
181 SCROW nRepeatEndY;
183 // last used col and row
184 bool mbCellAreaDirty;
185 bool mbCellAreaEmpty;
186 SCCOL mnEndCol;
187 SCROW mnEndRow;
189 std::unique_ptr<ScTableProtection> pTabProtection;
191 std::unique_ptr<ScCompressedArray<SCCOL, sal_uInt16>> mpColWidth;
192 std::unique_ptr<ScFlatUInt16RowSegments> mpRowHeights;
194 std::unique_ptr<ScBitMaskCompressedArray<SCCOL, CRFlags>> mpColFlags;
195 std::unique_ptr<ScBitMaskCompressedArray< SCROW, CRFlags>> pRowFlags;
196 std::unique_ptr<ScFlatBoolColSegments> mpHiddenCols;
197 std::unique_ptr<ScFlatBoolRowSegments> mpHiddenRows;
198 std::unique_ptr<ScFlatBoolColSegments> mpFilteredCols;
199 std::unique_ptr<ScFlatBoolRowSegments> mpFilteredRows;
201 ::std::set<SCROW> maRowPageBreaks;
202 ::std::set<SCROW> maRowManualBreaks;
203 ::std::set<SCCOL> maColPageBreaks;
204 ::std::set<SCCOL> maColManualBreaks;
206 std::unique_ptr<ScOutlineTable> pOutlineTable;
208 std::unique_ptr<ScSheetEvents> pSheetEvents;
210 mutable SCCOL nTableAreaX;
211 mutable SCROW nTableAreaY;
212 mutable SCCOL nTableAreaVisibleX;
213 mutable SCROW nTableAreaVisibleY;
215 SCTAB nTab;
216 ScDocument& rDocument;
217 std::unique_ptr<utl::TextSearch> pSearchText;
219 mutable OUString aUpperName; // #i62977# filled only on demand, reset in SetName
221 // sort parameter to minimize stack size of quicksort
222 ScSortParam aSortParam;
223 CollatorWrapper* pSortCollator;
225 ScRangeVec aPrintRanges;
227 std::optional<ScRange> moRepeatColRange;
228 std::optional<ScRange> moRepeatRowRange;
230 sal_uInt16 nLockCount;
232 std::unique_ptr<ScRangeList> pScenarioRanges;
233 Color aScenarioColor;
234 Color aTabBgColor;
235 ScScenarioFlags nScenarioFlags;
236 std::unique_ptr<ScDBData> pDBDataNoName;
237 mutable std::unique_ptr<ScRangeName> mpRangeName;
239 std::unique_ptr<ScConditionalFormatList> mpCondFormatList;
240 sc::SparklineList maSparklineList;
242 ScAddress maLOKFreezeCell;
244 bool bScenario:1;
245 bool bLayoutRTL:1;
246 bool bLoadingRTL:1;
247 bool bPageSizeValid:1;
248 mutable bool bTableAreaValid:1;
249 mutable bool bTableAreaVisibleValid:1;
250 bool bVisible:1;
251 bool bPendingRowHeights:1;
252 bool bCalcNotification:1;
253 bool bGlobalKeepQuery:1;
254 bool bPrintEntireSheet:1;
255 bool bActiveScenario:1;
256 bool mbPageBreaksValid:1;
257 bool mbForceBreaks:1;
258 /** this is touched from formula group threading context */
259 std::atomic<bool> bStreamValid;
261 // Solver settings in current tab
262 std::shared_ptr<sc::SolverSettings> m_pSolverSettings;
264 // Default attributes for the unallocated columns.
265 ScColumnData aDefaultColData;
267 friend class ScDocument; // for FillInfo
268 friend class ScColumn;
269 friend class ScValueIterator;
270 friend class ScHorizontalValueIterator;
271 friend class ScDBQueryDataIterator;
272 friend class ScFormulaGroupIterator;
273 friend class ScCellIterator;
274 template< ScQueryCellIteratorAccess accessType, ScQueryCellIteratorType queryType >
275 friend class ScQueryCellIteratorBase;
276 template< ScQueryCellIteratorAccess accessType >
277 friend class ScQueryCellIteratorAccessSpecific;
278 friend class ScHorizontalCellIterator;
279 friend class ScColumnTextWidthIterator;
280 friend class ScDocumentImport;
281 friend class sc::DocumentStreamAccess;
282 friend class sc::ColumnSpanSet;
283 friend class sc::RangeColumnSpanSet;
284 friend class sc::EditTextIterator;
285 friend class sc::FormulaGroupAreaListener;
287 public:
288 ScTable( ScDocument& rDoc, SCTAB nNewTab, const OUString& rNewName,
289 bool bColInfo = true, bool bRowInfo = true );
290 ~ScTable() COVERITY_NOEXCEPT_FALSE;
291 ScTable(const ScTable&) = delete;
292 ScTable& operator=(const ScTable&) = delete;
294 ScDocument& GetDoc() { return rDocument;}
295 const ScDocument& GetDoc() const { return rDocument;}
296 SCTAB GetTab() const { return nTab; }
298 ScOutlineTable* GetOutlineTable() { return pOutlineTable.get(); }
300 ScColumn& CreateColumnIfNotExists( const SCCOL nScCol )
302 if ( nScCol >= aCol.size() )
303 CreateColumnIfNotExistsImpl(nScCol);
304 return aCol[nScCol];
306 // out-of-line the cold part of the function
307 void CreateColumnIfNotExistsImpl( const SCCOL nScCol );
309 ScColumnData& GetColumnData( SCCOL nCol )
311 if( nCol >= aCol.size())
312 return aDefaultColData;
313 return aCol[nCol];
316 sal_uInt64 GetCellCount() const;
317 sal_uInt64 GetWeightedCount() const;
318 sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const;
319 sal_uInt64 GetCodeCount() const; // RPN code in formula
321 sal_uInt16 GetTextWidth(SCCOL nCol, SCROW nRow) const;
323 bool SetOutlineTable( const ScOutlineTable* pNewOutline );
324 void StartOutlineTable();
326 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
328 bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
329 void RemoveSubTotals( ScSubTotalParam& rParam );
330 bool DoSubTotals( ScSubTotalParam& rParam );
332 const ScSheetEvents* GetSheetEvents() const { return pSheetEvents.get(); }
333 void SetSheetEvents( std::unique_ptr<ScSheetEvents> pNew );
335 bool IsVisible() const { return bVisible; }
336 void SetVisible( bool bVis );
338 bool IsStreamValid() const { return bStreamValid; }
339 void SetStreamValid( bool bSet, bool bIgnoreLock = false );
341 [[nodiscard]] bool IsColValid( const SCCOL nScCol ) const
343 return nScCol >= static_cast< SCCOL >( 0 ) && nScCol < aCol.size();
345 [[nodiscard]] bool IsColRowValid( const SCCOL nScCol, const SCROW nScRow ) const
347 return IsColValid( nScCol ) && GetDoc().ValidRow( nScRow );
349 [[nodiscard]] bool IsColRowTabValid( const SCCOL nScCol, const SCROW nScRow, const SCTAB nScTab ) const
351 return IsColValid( nScCol ) && GetDoc().ValidRow( nScRow ) && ValidTab( nScTab );
353 [[nodiscard]] bool ValidCol(SCCOL nCol) const { return GetDoc().ValidCol(nCol); }
354 [[nodiscard]] bool ValidRow(SCROW nRow) const { return GetDoc().ValidRow(nRow); }
355 [[nodiscard]] bool ValidColRow(SCCOL nCol, SCROW nRow) const { return GetDoc().ValidColRow(nCol, nRow); }
357 bool IsPendingRowHeights() const { return bPendingRowHeights; }
358 void SetPendingRowHeights( bool bSet );
360 bool GetCalcNotification() const { return bCalcNotification; }
361 void SetCalcNotification( bool bSet );
363 bool IsLayoutRTL() const { return bLayoutRTL; }
364 bool IsLoadingRTL() const { return bLoadingRTL; }
365 void SetLayoutRTL( bool bSet );
366 void SetLoadingRTL( bool bSet );
368 bool IsScenario() const { return bScenario; }
369 void SetScenario( bool bFlag );
370 void GetScenarioComment( OUString& rComment) const { rComment = aComment; }
371 void SetScenarioComment( const OUString& rComment ) { aComment = rComment; }
372 const Color& GetScenarioColor() const { return aScenarioColor; }
373 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
374 const Color& GetTabBgColor() const { return aTabBgColor; }
375 void SetTabBgColor(const Color& rColor);
376 ScScenarioFlags GetScenarioFlags() const { return nScenarioFlags; }
377 void SetScenarioFlags(ScScenarioFlags nNew) { nScenarioFlags = nNew; }
378 void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
379 bool IsActiveScenario() const { return bActiveScenario; }
381 ScLinkMode GetLinkMode() const { return nLinkMode; }
382 bool IsLinked() const { return nLinkMode != ScLinkMode::NONE; }
383 const OUString& GetLinkDoc() const { return aLinkDoc; }
384 const OUString& GetLinkFlt() const { return aLinkFlt; }
385 const OUString& GetLinkOpt() const { return aLinkOpt; }
386 const OUString& GetLinkTab() const { return aLinkTab; }
387 sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
389 void SetLink( ScLinkMode nMode, const OUString& rDoc, const OUString& rFlt,
390 const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay );
392 sal_Int64 GetHashCode () const;
394 const OUString& GetName() const { return aName; }
395 void SetName( const OUString& rNewName );
397 void SetAnonymousDBData(std::unique_ptr<ScDBData> pDBData);
398 ScDBData* GetAnonymousDBData() { return pDBDataNoName.get();}
400 const OUString& GetCodeName() const { return aCodeName; }
401 void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; }
403 const OUString& GetUpperName() const;
405 const OUString& GetPageStyle() const { return aPageStyle; }
406 void SetPageStyle( const OUString& rName );
407 void PageStyleModified( const OUString& rNewName );
409 bool IsProtected() const;
410 void SetProtection(const ScTableProtection* pProtect);
411 const ScTableProtection* GetProtection() const;
412 void GetUnprotectedCells( ScRangeList& rRangeList ) const;
414 bool IsEditActionAllowed( sc::ColRowEditAction eAction, SCCOLROW nStart, SCCOLROW nEnd ) const;
416 Size GetPageSize() const;
417 void SetPageSize( const Size& rSize );
418 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
420 void LockTable();
421 void UnlockTable();
423 bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
424 SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = nullptr,
425 bool bNoMatrixAtAll = false ) const;
426 bool IsSelectionEditable( const ScMarkData& rMark,
427 bool* pOnlyNotBecauseOfMatrix = nullptr ) const;
429 bool HasBlockMatrixFragment( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2,
430 bool bNoMatrixAtAll = false ) const;
431 bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
433 // This also includes e.g. notes. Use IsEmptyData() for cell data only.
434 bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
436 bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
437 const ScSetStringParam * pParam = nullptr );
439 bool SetEditText( SCCOL nCol, SCROW nRow, std::unique_ptr<EditTextObject> pEditText );
440 void SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
441 SCROW GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
443 void SetEmptyCell( SCCOL nCol, SCROW nRow );
444 void SetFormula(
445 SCCOL nCol, SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
446 void SetFormula(
447 SCCOL nCol, SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
449 SC_DLLPUBLIC std::shared_ptr<sc::SolverSettings> GetSolverSettings();
452 * Takes ownership of pCell
454 * @return pCell if it was successfully inserted, NULL otherwise. pCell
455 * is deleted automatically on failure to insert.
457 ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
459 bool SetFormulaCells( SCCOL nCol, SCROW nRow, std::vector<ScFormulaCell*>& rCells );
461 bool HasFormulaCell( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2 ) const;
463 svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
465 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
466 void SetValues( const SCCOL nCol, const SCROW nRow, const std::vector<double>& rVals );
467 void SetError( SCCOL nCol, SCROW nRow, FormulaError nError);
468 SCSIZE GetPatternCount( SCCOL nCol ) const;
469 SCSIZE GetPatternCount( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
470 bool ReservePatternCount( SCCOL nCol, SCSIZE nReserve );
472 void SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr );
473 OUString GetString( SCCOL nCol, SCROW nRow, const ScInterpreterContext* pContext = nullptr ) const;
474 double* GetValueCell( SCCOL nCol, SCROW nRow );
475 // Note that if pShared is set and a value is returned that way, the returned OUString is empty.
476 OUString GetInputString( SCCOL nCol, SCROW nRow, bool bForceSystemLocale = false ) const;
477 double GetValue( SCCOL nCol, SCROW nRow ) const;
478 const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
479 void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
480 OUString GetFormula( SCCOL nCol, SCROW nRow ) const;
481 const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
482 ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
484 CellType GetCellType( const ScAddress& rPos ) const
486 if (!GetDoc().ValidColRow(rPos.Col(),rPos.Row()))
487 return CELLTYPE_NONE;
488 if (rPos.Col() >= aCol.size())
489 return CELLTYPE_NONE;
490 return aCol[rPos.Col()].GetCellType( rPos.Row() );
492 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
493 ScRefCellValue GetCellValue( SCCOL nCol, sc::ColumnBlockPosition& rBlockPos, SCROW nRow );
494 ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
496 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
497 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
499 // Sparklines
501 std::shared_ptr<sc::Sparkline> GetSparkline(SCCOL nCol, SCROW nRow);
502 sc::Sparkline* CreateSparkline(SCCOL nCol, SCROW nRow, std::shared_ptr<sc::SparklineGroup> const& pSparklineGroup);
503 bool DeleteSparkline(SCCOL nCol, SCROW nRow);
505 sc::SparklineList& GetSparklineList();
506 void CopySparklinesToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab);
507 void FillSparkline(bool bVertical, SCCOLROW nFixed, SCCOLROW nIteratingStart, SCCOLROW nIteratingEnd, SCCOLROW nFillStart, SCCOLROW nFillEnd);
509 // Notes / Comments
510 std::unique_ptr<ScPostIt> ReleaseNote( SCCOL nCol, SCROW nRow );
511 ScPostIt* GetNote( SCCOL nCol, SCROW nRow );
512 void SetNote( SCCOL nCol, SCROW nRow, std::unique_ptr<ScPostIt> pNote );
514 size_t GetNoteCount( SCCOL nCol ) const;
515 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
516 void CreateAllNoteCaptions();
517 void ForgetNoteCaptions( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bPreserveData );
519 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
520 void GetNotesInRange( const ScRange& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
521 CommentCaptionState GetAllNoteCaptionsState( const ScRange& rRange, std::vector<sc::NoteEntry>& rNotes );
522 bool ContainsNotesInRange( const ScRange& rRange ) const;
524 bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const;
525 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
526 void DeleteRow(
527 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
528 bool* pUndoOutline, std::vector<ScAddress>* pGroupPos );
530 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
531 void InsertCol(
532 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
533 void DeleteCol(
534 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline );
536 void DeleteArea(
537 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, InsertDeleteFlags nDelFlag,
538 bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = nullptr );
540 void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
541 void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
543 void CopyStaticToDocument(
544 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
545 ScTable* pDestTab );
547 void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
549 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
551 void DeleteBeforeCopyFromClip(
552 sc::CopyFromClipContext& rCxt, const ScTable& rClipTab, sc::ColumnSpanSet& rBroadcastSpans );
554 void CopyOneCellFromClip(
555 sc::CopyFromClipContext& rCxt, const SCCOL nCol1, const SCROW nRow1,
556 const SCCOL nCol2, const SCROW nRow2,
557 const SCROW nSrcRow, const ScTable* pSrcTab );
559 void CopyFromClip(
560 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
561 SCCOL nDx, SCROW nDy, ScTable* pTable );
563 void StartListeningFormulaCells(
564 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt,
565 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
567 void SetDirtyFromClip(
568 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
570 void CopyToTable(
571 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
572 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab,
573 const ScMarkData* pMarkData, bool bAsLink, bool bColRowFlags,
574 bool bGlobalNamesToLocal, bool bCopyCaptions );
576 void CopyCaptionsToTable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab, bool bCloneCaption );
578 void UndoToTable(
579 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
580 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab );
582 void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
583 SCCOL nDx, SCROW nDy, const ScTable* pTable);
585 * @param nCombinedStartRow start row of the combined range;
586 * used for transposed multi range selection with row direction;
587 * for other cases than multi range row selection this it equal to nRow1
588 * @param nRowDestOffset adjustment of destination row position;
589 * used for transposed multi range selection with row direction, otherwise 0
591 void TransposeClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCROW nCombinedStartRow,
592 SCROW nRowDestOffset, ScTable* pTransClip, InsertDeleteFlags nFlags,
593 bool bAsLink, bool bIncludeFiltered);
595 // mark of this document
596 void MixMarked(
597 sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
598 bool bSkipEmpty, const ScTable* pSrcTab );
600 void MixData(
601 sc::MixDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
602 ScPasteFunc nFunction, bool bSkipEmpty, const ScTable* pSrcTab );
604 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
605 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
607 void CopyScenarioFrom( const ScTable* pSrcTab );
608 void CopyScenarioTo( ScTable* pDestTab ) const;
609 bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
610 void MarkScenarioIn(ScMarkData& rMark, ScScenarioFlags nNeededBits) const;
611 bool HasScenarioRange( const ScRange& rRange ) const;
612 void InvalidateScenarioRanges();
613 const ScRangeList* GetScenarioRanges() const;
615 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
617 void InvalidateTableArea();
618 void InvalidatePageBreaks();
620 void InvalidateCellArea() { mbCellAreaDirty = true; }
621 bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ); // FALSE = empty
622 bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow, bool bCalcHiddens = false) const;
623 bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bCalcHiddens = false) const;
624 bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
625 SCCOL& rEndCol ) const;
626 bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
627 SCROW& rEndRow, bool bNotes ) const;
629 bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
631 void ExtendPrintArea( OutputDevice* pDev,
632 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
634 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
635 bool bIncludeOld, bool bOnlyDown ) const;
637 bool GetDataAreaSubrange( ScRange& rRange ) const;
639 bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
640 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly,
641 bool bStickyTopRow, bool bStickyLeftCol,
642 ScDataAreaExtras* pDataAreaExtras ) const;
644 SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow,
645 ScDataAreaExtras* pDataAreaExtras = nullptr ) const;
647 bool IsEmptyData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow) const;
648 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
649 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
651 void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
652 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY,
653 bool bMarked, bool bUnprotected, const ScMarkData& rMark, SCCOL nTabStartCol ) const;
655 bool SkipRow( const SCCOL rCol, SCROW& rRow, const SCROW nMovY, const ScMarkData& rMark,
656 const bool bUp, const SCROW nUsedY, const bool bMarked, const bool bSheetProtected ) const;
657 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
659 bool HasData( SCCOL nCol, SCROW nRow ) const;
660 bool HasStringData( SCCOL nCol, SCROW nRow ) const;
661 bool HasValueData( SCCOL nCol, SCROW nRow ) const;
662 bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
663 SCCOL nEndCol, SCROW nEndRow ) const;
665 sc::MultiDataCellState HasMultipleDataCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
667 FormulaError GetErrCode( const ScAddress& rPos ) const
669 return IsColRowValid(rPos.Col(),rPos.Row()) ?
670 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
671 FormulaError::NONE;
674 void ResetChanged( const ScRange& rRange );
676 void CheckVectorizationState();
677 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
678 void SetDirty( const ScRange&, ScColumn::BroadcastMode );
679 void SetDirtyAfterLoad();
680 void SetDirtyVar();
681 void SetTableOpDirty( const ScRange& );
682 void CalcAll();
683 void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
684 void CompileAll( sc::CompileFormulaContext& rCxt );
685 void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
687 /** Broadcast single broadcasters in range, without explicitly setting
688 anything dirty, not doing area broadcasts.
689 @param rHint address is modified to adapt to the actual broadcasted
690 position on each iteration and upon return points to the last
691 position broadcasted. */
692 bool BroadcastBroadcasters( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SfxHintId nHint );
694 bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode );
696 void UpdateReference(
697 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr,
698 bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
700 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
701 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
702 SCCOL nDx, SCROW nDy, SCTAB nDz, bool bUpdateNoteCaptionPos = true );
704 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
705 ScDocument* pUndoDoc );
707 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
709 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
710 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
711 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo, ScProgress* pProgress );
712 void UpdateCompile( bool bForceIfNameInUse = false );
713 void SetTabNo(SCTAB nNewTab);
714 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
715 sc::UpdatedRangeNames& rIndexes) const;
716 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
717 sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
718 double nStepValue, const tools::Duration& rDurationStep,
719 double nMaxValue, ScProgress* pProgress);
720 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
722 void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark );
724 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
725 sal_uInt16 nFormatNo );
726 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
727 bool SearchAndReplace(
728 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
729 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc, bool& bMatchedRangesWereClamped);
731 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
733 bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask ) const;
734 bool HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const;
735 bool HasAttrib( SCCOL nCol, SCROW nRow, HasAttrFlags nMask,
736 SCROW* nStartRow = nullptr, SCROW* nEndRow = nullptr ) const;
737 bool IsMerged( SCCOL nCol, SCROW nRow ) const;
738 bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
739 SCCOL& rEndCol, SCROW& rEndRow,
740 bool bRefresh );
741 void SetMergedCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
743 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
744 template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, TypedWhichId<T> nWhich ) const
746 return static_cast<const T*>(GetAttr(nCol, nRow, sal_uInt16(nWhich)));
748 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich, SCROW& nStartRow, SCROW& nEndRow ) const;
749 template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, TypedWhichId<T> nWhich, SCROW& nStartRow, SCROW& nEndRow ) const
751 return static_cast<const T*>(GetAttr(nCol, nRow, sal_uInt16(nWhich), nStartRow, nEndRow));
753 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
754 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
756 sal_uInt32 GetNumberFormat( const ScInterpreterContext& rContext, const ScAddress& rPos ) const;
757 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
758 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
760 void SetNumberFormat( SCCOL nCol, SCROW nRow, sal_uInt32 nNumberFormat );
762 void MergeSelectionPattern( ScMergePatternState& rState,
763 const ScMarkData& rMark, bool bDeep ) const;
764 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
765 SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
766 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
767 ScLineFlags& rFlags,
768 SCCOL nStartCol, SCROW nStartRow,
769 SCCOL nEndCol, SCROW nEndRow ) const;
770 void ApplyBlockFrame(const SvxBoxItem& rLineOuter,
771 const SvxBoxInfoItem* pLineInner,
772 SCCOL nStartCol, SCROW nStartRow,
773 SCCOL nEndCol, SCROW nEndRow );
775 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
776 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
777 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
778 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = nullptr,
779 bool* const pIsChanged = nullptr );
780 void SetAttrEntries( SCCOL nStartCol, SCCOL nEndCol, std::vector<ScAttrEntry> && vNewData);
782 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr );
783 const ScPatternAttr* SetPattern( SCCOL nCol, SCROW nRow, std::unique_ptr<ScPatternAttr> );
784 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
785 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
786 const ScPatternAttr& rPattern, SvNumFormatType nNewType );
787 void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
788 void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
789 void SetPatternAreaCondFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow,
790 const ScPatternAttr& rAttr, const ScCondFormatIndexes& rCondFormatIndexes );
792 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet* rStyle );
793 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
794 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
795 void ApplySelectionLineStyle( const ScMarkData& rMark,
796 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
798 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
799 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
800 const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
801 SCCOL nCol2, SCROW nRow2 ) const;
803 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
804 OutputDevice* pDev,
805 double nPPTX, double nPPTY,
806 const Fraction& rZoomX, const Fraction& rZoomY );
808 bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
810 bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags );
811 bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags );
813 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = nullptr, bool* const pIsChanged = nullptr );
814 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
816 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
817 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
819 const std::optional<ScRange>& GetRepeatColRange() const { return moRepeatColRange; }
820 const std::optional<ScRange>& GetRepeatRowRange() const { return moRepeatRowRange; }
821 void SetRepeatColRange( std::optional<ScRange> oNew );
822 void SetRepeatRowRange( std::optional<ScRange> oNew );
824 sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
825 const ScRange* GetPrintRange(sal_uInt16 nPos) const;
826 /** Returns true, if the sheet is always printed. */
827 bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
829 /** Removes all print ranges. */
830 void ClearPrintRanges();
831 /** Adds a new print ranges. */
832 void AddPrintRange( const ScRange& rNew );
834 // Removes all named ranges used for print ranges
835 void ClearPrintNamedRanges();
837 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
838 void SetPrintEntireSheet();
840 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
841 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
843 sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
844 double nPPTX, double nPPTY,
845 const Fraction& rZoomX, const Fraction& rZoomY,
846 bool bFormula, const ScMarkData* pMarkData,
847 const ScColWidthParam* pParam );
848 bool SetOptimalHeight(
849 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, bool bApi,
850 ScProgress* pOuterProgress = nullptr, sal_uInt64 nProgressStart = 0 );
852 void SetOptimalHeightOnly(
853 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
854 ScProgress* pOuterProgress = nullptr, sal_uInt64 nProgressStart = 0 );
856 tools::Long GetNeededSize( SCCOL nCol, SCROW nRow,
857 OutputDevice* pDev,
858 double nPPTX, double nPPTY,
859 const Fraction& rZoomX, const Fraction& rZoomY,
860 bool bWidth, bool bTotalSize,
861 bool bInPrintTwips = false);
862 void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
863 void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
864 void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
865 bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
866 double nPPTY, bool bApi );
869 * Set specified row height to specified ranges. Don't check for drawing
870 * objects etc. Just set the row height. Nothing else.
872 * Note that setting a new row height via this function will not
873 * invalidate page breaks.
875 void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
877 // nPPT to test for modification
878 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
880 sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
881 tools::Long GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const;
882 sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const;
883 tools::Long GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true ) const;
884 tools::Long GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
885 tools::Long GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) const;
886 tools::Long GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) const;
889 * Get the last row such that the height of row 0 to the end row is as
890 * high as possible without exceeding the specified height value.
892 * @param nHeight maximum desired height
894 * @return SCROW last row of the range within specified height.
896 SCROW GetRowForHeight(tools::Long nHeight) const;
898 sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
899 sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
901 sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
903 SCROW GetHiddenRowCount( SCROW nRow ) const;
905 void ShowCol(SCCOL nCol, bool bShow);
906 void ShowRow(SCROW nRow, bool bShow);
907 void DBShowRow(SCROW nRow, bool bShow);
909 void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
910 void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
912 void SetRowFlags( SCROW nRow, CRFlags nNewFlags );
913 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, CRFlags nNewFlags );
915 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
916 SCROW GetLastFlaggedRow() const;
918 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
919 SCCOL GetLastChangedColFlagsWidth() const;
920 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
921 SCROW GetLastChangedRowFlagsWidth() const;
923 bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
924 bool IsDataFiltered(const ScRange& rRange) const;
925 CRFlags GetColFlags( SCCOL nCol ) const;
926 CRFlags GetRowFlags( SCROW nRow ) const;
928 const ScBitMaskCompressedArray< SCROW, CRFlags> * GetRowFlagsArray() const
929 { return pRowFlags.get(); }
931 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
932 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
934 void UpdatePageBreaks( const ScRange* pUserArea );
935 void RemoveManualBreaks();
936 bool HasManualBreaks() const;
937 void SetRowManualBreaks( ::std::set<SCROW>&& rBreaks );
938 void SetColManualBreaks( ::std::set<SCCOL>&& rBreaks );
940 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
941 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
942 bool HasRowPageBreak(SCROW nRow) const;
943 bool HasColPageBreak(SCCOL nCol) const;
944 bool HasRowManualBreak(SCROW nRow) const;
945 bool HasColManualBreak(SCCOL nCol) const;
948 * Get the row position of the next manual break that occurs at or below
949 * specified row. When no more manual breaks are present at or below
950 * the specified row, -1 is returned.
952 * @param nRow row at which the search begins.
954 * @return SCROW next row position with manual page break, or -1 if no
955 * more manual breaks are present.
957 SCROW GetNextManualBreak(SCROW nRow) const;
959 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
960 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
961 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
962 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
963 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
964 css::uno::Sequence<
965 css::sheet::TablePageBreakData> GetRowBreakData() const;
967 bool RowHidden(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
968 bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
969 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
970 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = nullptr, SCCOL* pLastCol = nullptr) const;
971 bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
972 void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
973 void CopyColHidden(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
974 void CopyRowHidden(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
975 void CopyRowHeight(const ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
976 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
977 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
978 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
979 SCROW CountHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
980 tools::Long GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true) const;
982 SCCOL CountVisibleCols(SCCOL nStartCol, SCCOL nEndCol) const;
983 SCCOL CountHiddenCols(SCCOL nStartCol, SCCOL nEndCol) const;
985 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
987 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
988 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = nullptr, SCCOL* pLastCol = nullptr) const;
989 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
990 void CopyColFiltered(const ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
991 void CopyRowFiltered(const ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
992 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
993 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
994 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
995 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
996 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
998 Color GetCellBackgroundColor(ScAddress aPos) const;
999 Color GetCellTextColor(ScAddress aPos) const;
1001 bool IsManualRowHeight(SCROW nRow) const;
1003 bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const;
1005 void SyncColRowFlags();
1007 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
1008 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
1010 /** Sort a range of data. */
1011 void Sort(
1012 const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
1013 ScProgress* pProgress, sc::ReorderParam* pUndo );
1015 void Reorder( const sc::ReorderParam& rParam );
1017 // For ValidQuery() see ScQueryEvalutor class.
1018 void TopTenQuery( ScQueryParam& );
1019 void PrepareQuery( ScQueryParam& rQueryParam );
1020 SCSIZE Query(const ScQueryParam& rQueryParam, bool bKeepSub);
1021 bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1023 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, ScFilterEntries& rFilterEntries, bool bFiltering = false);
1024 void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, ScFilterEntries& rFilterEntries, bool bFiltering );
1025 [[nodiscard]]
1026 bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings);
1028 bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
1029 bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
1031 sal_Int32 GetMaxStringLen( SCCOL nCol,
1032 SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
1033 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
1034 SCCOL nCol,
1035 SCROW nRowStart, SCROW nRowEnd ) const;
1037 bool IsSortCollatorGlobal() const;
1038 void InitSortCollator( const ScSortParam& rPar );
1039 void DestroySortCollator();
1040 void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true,
1041 const ScObjectHandling eObjectHandling = ScObjectHandling::RecalcPosMode);
1043 void SetRangeName(std::unique_ptr<ScRangeName> pNew);
1044 ScRangeName* GetRangeName() const;
1046 void PreprocessRangeNameUpdate(
1047 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
1049 void CompileHybridFormula(
1050 sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
1052 void PreprocessDBDataUpdate(
1053 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
1055 ScConditionalFormatList* GetCondFormList();
1056 const ScConditionalFormatList* GetCondFormList() const;
1057 void SetCondFormList( ScConditionalFormatList* pList );
1059 void DeleteConditionalFormat(sal_uLong nOldIndex);
1061 sal_uLong AddCondFormat( std::unique_ptr<ScConditionalFormat> pNew );
1063 SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow ) const;
1064 void SetScriptType( SCCOL nCol, SCROW nRow, SvtScriptType nType );
1065 void UpdateScriptTypes( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2 );
1067 SvtScriptType GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
1069 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
1070 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1071 formula::VectorRefArray FetchVectorRefArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 );
1072 bool HandleRefArrayForParallelism( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScFormulaCellGroupRef& mxGroup );
1073 #ifdef DBG_UTIL
1074 void AssertNoInterpretNeeded( SCCOL nCol, SCROW nRow1, SCROW nRow2 );
1075 #endif
1077 void SplitFormulaGroups( SCCOL nCol, std::vector<SCROW>& rRows );
1078 void UnshareFormulaCells( SCCOL nCol, std::vector<SCROW>& rRows );
1079 void RegroupFormulaCells( SCCOL nCol );
1081 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
1082 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow, sc::ColumnBlockPosition& rBlockPos );
1084 SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow );
1085 const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const;
1086 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
1087 void DeleteEmptyBroadcasters();
1089 void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool ) const;
1091 void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1092 bool InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1094 void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen );
1096 void CalculateInColumnInThread( ScInterpreterContext& rContext, SCCOL nColStart, SCCOL nColEnd,
1097 SCROW nRowStart, SCROW nRowEnd, unsigned nThisThread, unsigned nThreadsTotal);
1098 void HandleStuffAfterParallelCalculation( SCCOL nColStart, SCCOL nColEnd, SCROW nRow, size_t nLen, ScInterpreter* pInterpreter);
1101 * Either start all formula cells as listeners unconditionally, or start
1102 * those that are marked "needs listening".
1104 * @param rCxt context object.
1105 * @param bAll when true, start all formula cells as listeners. When
1106 * false, only start those that are marked "needs listening".
1108 void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
1111 * Mark formula cells dirty that have the mbPostponedDirty flag set or
1112 * contain named ranges with relative references.
1114 void SetDirtyIfPostponed();
1117 * Broadcast dirty formula cells that contain functions such as CELL(),
1118 * COLUMN() or ROW() which may change its value on move.
1120 void BroadcastRecalcOnRefMove();
1122 void TransferCellValuesTo( const SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest );
1123 void CopyCellValuesFrom( const SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc );
1125 std::optional<sc::ColumnIterator> GetColumnIterator( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
1127 bool EnsureFormulaCellResults( const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2, bool bSkipRunning = false );
1129 void ConvertFormulaToValue(
1130 sc::EndListeningContext& rCxt,
1131 const SCCOL nCol1, const SCROW nRow1, const SCCOL nCol2, const SCROW nRow2,
1132 sc::TableValues* pUndo );
1134 void SwapNonEmpty(
1135 sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
1137 void finalizeOutlineImport();
1139 void StoreToCache(SvStream& rStrm) const;
1141 void RestoreFromCache(SvStream& rStrm);
1143 #if DUMP_COLUMN_STORAGE
1144 void DumpColumnStorage( SCCOL nCol ) const;
1145 #endif
1147 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
1149 'Replace' replaces at the 'current' position, but in order to achieve
1150 that, we have to 'shift' the rCol / rRow to the 'previous' position -
1151 what it is depends on various settings in rSearchItem.
1153 static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
1155 ScColumnsRange GetWritableColumnsRange(SCCOL begin, SCCOL end);
1156 ScColumnsRange GetAllocatedColumnsRange(SCCOL begin, SCCOL end) const;
1157 ScColumnsRange GetColumnsRange(SCCOL begin, SCCOL end) const;
1158 SCCOL ClampToAllocatedColumns(SCCOL nCol) const { return std::min(nCol, static_cast<SCCOL>(aCol.size() - 1)); }
1159 SCCOL GetAllocatedColumnsCount() const { return aCol.size(); }
1162 * Serializes the sheet's geometry data.
1164 * @param bColumns - if true it dumps the data for columns, else it does for rows.
1165 * @param eGeomType indicates the type of data to be dumped for rows/columns.
1166 * @return the serialization of the sheet's geometry data as an OString.
1168 OString dumpSheetGeomData(bool bColumns, SheetGeomType eGeomType);
1170 std::set<SCCOL> QueryColumnsWithFormulaCells() const;
1172 const ScColumnData& ColumnData( SCCOL nCol ) const { return nCol < aCol.size() ? aCol[ nCol ] : aDefaultColData; }
1174 void CheckIntegrity() const;
1176 void CollectBroadcasterState(sc::BroadcasterState& rState) const;
1178 private:
1180 void FillFormulaVertical(
1181 const ScFormulaCell& rSrcCell,
1182 SCCOLROW& rInner, SCCOL nCol, SCROW nRow1, SCROW nRow2,
1183 ScProgress* pProgress, sal_uInt64& rProgress );
1185 void FillSeriesSimple(
1186 const ScCellValue& rSrcCell, SCCOLROW& rInner, SCCOLROW nIMin, SCCOLROW nIMax,
1187 const SCCOLROW& rCol, const SCCOLROW& rRow, bool bVertical, ScProgress* pProgress, sal_uInt64& rProgress );
1189 void FillAutoSimple(
1190 SCCOLROW nISrcStart, SCCOLROW nISrcEnd, SCCOLROW nIStart, SCCOLROW nIEnd,
1191 SCCOLROW& rInner, const SCCOLROW& rCol, const SCCOLROW& rRow,
1192 sal_uInt64 nActFormCnt, sal_uInt64 nMaxFormCnt,
1193 bool bHasFiltered, bool bVertical, bool bPositive,
1194 ScProgress* pProgress, sal_uInt64& rProgress );
1196 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1197 sal_uInt64 nFillCount, FillDir eFillDir, FillCmd eFillCmd,
1198 FillDateCmd eFillDateCmd,
1199 double nStepValue, const tools::Duration& rDurationStep,
1200 double nMaxValue, sal_uInt16 nMinDigits,
1201 bool bAttribs, ScProgress* pProgress,
1202 bool bSkipOverlappedCells = false,
1203 std::vector<sal_Int32>* pNonOverlappedCellIdx = nullptr);
1204 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1205 FillCmd& rCmd, FillDateCmd& rDateCmd,
1206 double& rInc, tools::Duration& rDuration, sal_uInt16& rMinDigits,
1207 ScUserListData*& rListData, sal_uInt16& rListIndex,
1208 bool bHasFiltered, bool& rSkipOverlappedCells,
1209 std::vector<sal_Int32>& rNonOverlappedCellIdx );
1210 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1211 sal_uInt64 nFillCount, FillDir eFillDir, ScProgress* pProgress );
1213 bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
1214 bool bMarked, bool bUnprotected ) const;
1216 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1217 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
1218 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
1219 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
1220 bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow,
1221 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1222 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1223 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1224 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1225 SCCOL nLastCol, SCROW nLastRow,
1226 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc,
1227 std::vector< sc::ColumnBlockConstPosition >& blockPos);
1228 bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
1229 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1230 bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1231 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1232 bool ReplaceAll(
1233 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1234 OUString& rUndoStr, ScDocument* pUndoDoc, bool& bMatchedRangesWereClamped);
1236 bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1237 const ScMarkData& rMark);
1238 bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1239 const ScMarkData& rMark, bool bIsUndo);
1240 bool SearchAllStyle(
1241 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
1242 bool ReplaceAllStyle(
1243 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1244 ScDocument* pUndoDoc);
1245 bool SearchAndReplaceEmptyCells(
1246 const SvxSearchItem& rSearchItem,
1247 SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1248 OUString& rUndoStr, ScDocument* pUndoDoc);
1249 bool SearchRangeForEmptyCell(const ScRange& rRange,
1250 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1251 OUString& rUndoStr);
1252 bool SearchRangeForAllEmptyCells(
1253 const ScRange& rRange, const SvxSearchItem& rSearchItem,
1254 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1256 // use the global sort parameter:
1257 bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
1258 static void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
1259 short CompareCell(
1260 sal_uInt16 nSort,
1261 ScRefCellValue& rCell1, SCCOL nCell1Col, SCROW nCell1Row,
1262 ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
1263 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1264 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1265 std::unique_ptr<ScSortInfoArray> CreateSortInfoArray( const sc::ReorderParam& rParam );
1266 std::unique_ptr<ScSortInfoArray> CreateSortInfoArray(
1267 const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2,
1268 bool bKeepQuery, bool bUpdateRefs );
1269 void QuickSort( ScSortInfoArray*, SCCOLROW nLo, SCCOLROW nHi);
1270 void SortReorderByColumn( const ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2,
1271 bool bPattern, ScProgress* pProgress );
1272 void SortReorderAreaExtrasByColumn( const ScSortInfoArray* pArray, SCROW nDataRow1, SCROW nDataRow2,
1273 const ScDataAreaExtras& rDataAreaExtras, ScProgress* pProgress );
1275 void SortReorderByRow( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2,
1276 ScProgress* pProgress, bool bOnlyDataAreaExtras );
1277 void SortReorderByRowRefUpdate( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2,
1278 ScProgress* pProgress );
1279 void SortReorderAreaExtrasByRow( ScSortInfoArray* pArray, SCCOL nDataCol1, SCCOL nDataCol2,
1280 const ScDataAreaExtras& rDataAreaExtras, ScProgress* pProgress );
1282 bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1283 bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1284 OUString GetUpperCellString(SCCOL nCol, SCROW nRow);
1286 bool RefVisible(const ScFormulaCell* pCell);
1288 bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
1290 void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
1291 void FillFormula(
1292 const ScFormulaCell* pSrcCell, SCCOL nDestCol, SCROW nDestRow, bool bLast );
1293 void UpdateInsertTabAbs(SCTAB nNewPos);
1294 bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
1295 const ScMarkData& rMark) const;
1296 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
1297 void TestTabRefAbs(SCTAB nTable) const;
1298 void CompileDBFormula( sc::CompileFormulaContext& rCxt );
1299 void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
1301 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
1302 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
1303 void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
1304 void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
1306 void AttachFormulaCells( sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1307 void DetachFormulaCells( sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1309 void SetLoadingMedium(bool bLoading);
1311 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
1312 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
1313 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
1315 // idle calculation of OutputDevice text width for cell
1316 // also invalidates script type, broadcasts for "calc as shown"
1317 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1318 bool bNumFormatChanged, bool bBroadcast );
1320 void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
1323 * In case the cell text goes beyond the column width, move the max column
1324 * position to the right. This is called from ExtendPrintArea.
1326 void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
1328 void CopyPrintRange(const ScTable& rTable);
1330 SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
1332 SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
1335 * Transpose clipboard patterns
1336 * @param nCombinedStartRow start row of the combined range;
1337 * used for transposed multi range selection with row direction;
1338 * for other cases than multi range row selection this it equal to nRow1
1339 * @param nRowDestOffset adjustment of destination row position;
1340 * used for transposed multi range row selections, otherwise 0
1342 void TransposeColPatterns(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1,
1343 SCROW nRow2, SCROW nCombinedStartRow, bool bIncludeFiltered,
1344 const std::vector<SCROW>& rFilteredRows, SCROW nRowDestOffset);
1347 * Transpose clipboard notes
1348 * @param nCombinedStartRow start row of the combined range;
1349 * used for transposed multi range selection with row direction;
1350 * for other cases than multi range row selection this it equal to nRow1
1351 * @param nRowDestOffset adjustment of destination row position;
1352 * used for transposed multi range row selections, otherwise 0
1354 void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2,
1355 SCROW nCombinedStartRow, bool bIncludeFiltered, SCROW nRowDestOffset);
1357 ScColumn* FetchColumn( SCCOL nCol );
1358 const ScColumn* FetchColumn( SCCOL nCol ) const;
1360 void EndListeningIntersectedGroup(
1361 sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, std::vector<ScAddress>* pGroupPos );
1363 void EndListeningIntersectedGroups(
1364 sc::EndListeningContext& rCxt, const SCCOL nCol1, SCROW nRow1, const SCCOL nCol2, SCROW nRow2,
1365 std::vector<ScAddress>* pGroupPos );
1367 void EndListeningGroup( sc::EndListeningContext& rCxt, const SCCOL nCol, SCROW nRow );
1368 void SetNeedsListeningGroup( SCCOL nCol, SCROW nRow );
1370 /// Returns list-of-spans representation of the column-widths/row-heights in twips encoded as an OString.
1371 OString dumpColumnRowSizes(bool bColumns);
1372 /// Returns list-of-spans representation of hidden/filtered states of columns/rows encoded as an OString.
1373 OString dumpHiddenFiltered(bool bColumns, bool bHidden);
1374 /// Returns list-of-spans representation of the column/row groupings encoded as an OString.
1375 OString dumpColumnRowGroups(bool bColumns) const;
1377 SCCOL GetLOKFreezeCol() const;
1378 SCROW GetLOKFreezeRow() const;
1379 bool SetLOKFreezeCol(SCCOL nFreezeCol);
1380 bool SetLOKFreezeRow(SCROW nFreezeRow);
1383 * Use this to iterate through non-empty visible cells in a single column.
1385 class VisibleDataCellIterator
1387 static constexpr SCROW ROW_NOT_FOUND = -1;
1389 public:
1390 explicit VisibleDataCellIterator(const ScDocument& rDoc, ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
1393 * Set the start row position. In case there is not visible data cell
1394 * at the specified row position, it will move to the position of the
1395 * first visible data cell below that point.
1397 * @return First visible data cell if found, or NULL otherwise.
1399 ScRefCellValue reset(SCROW nRow);
1402 * Find the next visible data cell position.
1404 * @return Next visible data cell if found, or NULL otherwise.
1406 ScRefCellValue next();
1409 * Get the current row position.
1411 * @return Current row position, or ROW_NOT_FOUND if the iterator
1412 * doesn't point to a valid data cell position.
1414 SCROW getRow() const { return mnCurRow;}
1416 private:
1417 const ScDocument& mrDocument;
1418 ScFlatBoolRowSegments& mrRowSegs;
1419 ScColumn& mrColumn;
1420 ScRefCellValue maCell;
1421 SCROW mnCurRow;
1422 SCROW mnUBound;
1427 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */