Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / inc / table.hxx
blob4877f2be983582d4b0a46cb120be1169c3c640a3
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 #ifndef INCLUDED_SC_INC_TABLE_HXX
21 #define INCLUDED_SC_INC_TABLE_HXX
23 #include <vector>
24 #include <utility>
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include "column.hxx"
29 #include "colcontainer.hxx"
30 #include "sortparam.hxx"
31 #include "compressedarray.hxx"
32 #include "postit.hxx"
33 #include "types.hxx"
34 #include "cellvalue.hxx"
35 #include <formula/types.hxx>
36 #include "calcmacros.hxx"
38 #include <set>
39 #include <map>
40 #include <memory>
42 namespace utl {
43 class TextSearch;
46 namespace com { namespace sun { namespace star {
47 namespace sheet {
48 struct TablePageBreakData;
50 } } }
52 namespace formula { struct VectorRefArray; }
53 namespace sc {
55 struct FormulaGroupContext;
56 class StartListeningContext;
57 class EndListeningContext;
58 class CopyFromClipContext;
59 class CopyToClipContext;
60 class CopyToDocContext;
61 class MixDocContext;
62 class ColumnSpanSet;
63 class ColumnSet;
64 struct ColumnBlockPosition;
65 struct RefUpdateContext;
66 struct RefUpdateInsertTabContext;
67 struct RefUpdateDeleteTabContext;
68 struct RefUpdateMoveTabContext;
69 struct NoteEntry;
70 class DocumentStreamAccess;
71 class CellValues;
72 class TableValues;
73 class RowHeightContext;
74 class CompileFormulaContext;
75 struct SetFormulaDirtyContext;
76 class RefMovedHint;
77 struct ReorderParam;
81 class SfxItemSet;
82 class SfxStyleSheetBase;
83 class SvxBoxInfoItem;
84 class SvxBoxItem;
85 class SvxSearchItem;
87 class ScAutoFormatData;
88 class ScDocument;
89 class ScEditDataArray;
90 class ScFormulaCell;
91 class ScOutlineTable;
92 class ScPrintSaverTab;
93 class ScProgress;
94 class ScRangeList;
95 class ScSheetEvents;
96 class ScSortInfoArray;
97 class ScConditionalFormat;
98 class ScConditionalFormatList;
99 class ScStyleSheet;
100 class ScTableProtection;
101 class ScUserListData;
102 struct RowInfo;
103 struct ScFunctionData;
104 struct ScLineFlags;
105 class CollatorWrapper;
106 class ScFlatUInt16RowSegments;
107 class ScFlatBoolRowSegments;
108 class ScFlatBoolColSegments;
109 struct ScSetStringParam;
110 struct ScColWidthParam;
111 struct ScColWidthParam;
112 class ScRangeName;
113 class ScDBData;
114 class ScDocumentImport;
115 class ScHint;
117 class ScTable
119 private:
120 typedef ::std::vector< ScRange > ScRangeVec;
122 ScColContainer aCol;
124 OUString aName;
125 OUString aCodeName;
126 OUString aComment;
128 OUString aLinkDoc;
129 OUString aLinkFlt;
130 OUString aLinkOpt;
131 OUString aLinkTab;
132 sal_uLong nLinkRefreshDelay;
133 ScLinkMode nLinkMode;
135 // page style template
136 OUString aPageStyle;
137 Size aPageSizeTwips; // size of the print-page
138 SCCOL nRepeatStartX; // repeating rows/columns
139 SCCOL nRepeatEndX; // REPEAT_NONE, if not used
140 SCROW nRepeatStartY;
141 SCROW nRepeatEndY;
143 std::unique_ptr<ScTableProtection> pTabProtection;
145 sal_uInt16* pColWidth;
146 std::unique_ptr<ScFlatUInt16RowSegments> mpRowHeights;
148 sal_uInt8* pColFlags;
149 ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags;
150 std::unique_ptr<ScFlatBoolColSegments> mpHiddenCols;
151 std::unique_ptr<ScFlatBoolRowSegments> mpHiddenRows;
152 std::unique_ptr<ScFlatBoolColSegments> mpFilteredCols;
153 std::unique_ptr<ScFlatBoolRowSegments> mpFilteredRows;
155 ::std::set<SCROW> maRowPageBreaks;
156 ::std::set<SCROW> maRowManualBreaks;
157 ::std::set<SCCOL> maColPageBreaks;
158 ::std::set<SCCOL> maColManualBreaks;
160 ScOutlineTable* pOutlineTable;
162 ScSheetEvents* pSheetEvents;
164 mutable SCCOL nTableAreaX;
165 mutable SCROW nTableAreaY;
167 SCTAB nTab;
168 ScDocument* pDocument;
169 utl::TextSearch* pSearchText;
171 mutable OUString aUpperName; // #i62977# filled only on demand, reset in SetName
173 // sort parameter to minimize stack size of quicksort
174 ScSortParam aSortParam;
175 CollatorWrapper* pSortCollator;
177 ScRangeVec aPrintRanges;
179 ScRange* pRepeatColRange;
180 ScRange* pRepeatRowRange;
182 sal_uInt16 nLockCount;
184 ScRangeList* pScenarioRanges;
185 Color aScenarioColor;
186 Color aTabBgColor;
187 sal_uInt16 nScenarioFlags;
188 ScDBData* pDBDataNoName;
189 mutable ScRangeName* mpRangeName;
191 std::unique_ptr<ScConditionalFormatList> mpCondFormatList;
193 bool bScenario:1;
194 bool bLayoutRTL:1;
195 bool bLoadingRTL:1;
196 bool bPageSizeValid:1;
197 mutable bool bTableAreaValid:1;
198 bool bVisible:1;
199 bool bStreamValid:1;
200 bool bPendingRowHeights:1;
201 bool bCalcNotification:1;
202 bool bGlobalKeepQuery:1;
203 bool bPrintEntireSheet:1;
204 bool bActiveScenario:1;
205 bool mbPageBreaksValid:1;
206 bool mbForceBreaks:1;
208 friend class ScDocument; // for FillInfo
209 friend class ScValueIterator;
210 friend class ScHorizontalValueIterator;
211 friend class ScDBQueryDataIterator;
212 friend class ScFormulaGroupIterator;
213 friend class ScCellIterator;
214 friend class ScQueryCellIterator;
215 friend class ScHorizontalCellIterator;
216 friend class ScHorizontalAttrIterator;
217 friend class ScDocAttrIterator;
218 friend class ScAttrRectIterator;
219 friend class ScColumnTextWidthIterator;
220 friend class ScDocumentImport;
221 friend class sc::DocumentStreamAccess;
222 friend class sc::ColumnSpanSet;
223 friend class sc::EditTextIterator;
224 friend class sc::FormulaGroupAreaListener;
226 public:
227 ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
228 bool bColInfo = true, bool bRowInfo = true );
229 ~ScTable();
230 ScTable(const ScTable&) = delete;
231 ScTable& operator=(const ScTable&) = delete;
233 ScDocument& GetDoc() { return *pDocument;}
234 const ScDocument& GetDoc() const { return *pDocument;}
235 SCTAB GetTab() const { return nTab; }
237 ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
239 sal_uLong GetCellCount() const;
240 sal_uLong GetWeightedCount() const;
241 sal_uLong GetCodeCount() const; // RPN code in formula
243 sal_uInt16 GetTextWidth(SCCOL nCol, SCROW nRow) const;
245 bool SetOutlineTable( const ScOutlineTable* pNewOutline );
246 void StartOutlineTable();
248 void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
250 bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
251 void RemoveSubTotals( ScSubTotalParam& rParam );
252 bool DoSubTotals( ScSubTotalParam& rParam );
254 const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; }
255 void SetSheetEvents( const ScSheetEvents* pNew );
257 bool IsVisible() const { return bVisible; }
258 void SetVisible( bool bVis );
260 bool IsStreamValid() const { return bStreamValid; }
261 void SetStreamValid( bool bSet, bool bIgnoreLock = false );
263 bool IsPendingRowHeights() const { return bPendingRowHeights; }
264 void SetPendingRowHeights( bool bSet );
266 bool GetCalcNotification() const { return bCalcNotification; }
267 void SetCalcNotification( bool bSet );
269 bool IsLayoutRTL() const { return bLayoutRTL; }
270 bool IsLoadingRTL() const { return bLoadingRTL; }
271 void SetLayoutRTL( bool bSet );
272 void SetLoadingRTL( bool bSet );
274 bool IsScenario() const { return bScenario; }
275 void SetScenario( bool bFlag );
276 void GetScenarioComment( OUString& rComment) const { rComment = aComment; }
277 void SetScenarioComment( const OUString& rComment ) { aComment = rComment; }
278 const Color& GetScenarioColor() const { return aScenarioColor; }
279 void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
280 const Color& GetTabBgColor() const { return aTabBgColor; }
281 void SetTabBgColor(const Color& rColor);
282 sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; }
283 void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; }
284 void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
285 bool IsActiveScenario() const { return bActiveScenario; }
287 ScLinkMode GetLinkMode() const { return nLinkMode; }
288 bool IsLinked() const { return nLinkMode != ScLinkMode::NONE; }
289 const OUString& GetLinkDoc() const { return aLinkDoc; }
290 const OUString& GetLinkFlt() const { return aLinkFlt; }
291 const OUString& GetLinkOpt() const { return aLinkOpt; }
292 const OUString& GetLinkTab() const { return aLinkTab; }
293 sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
295 void SetLink( ScLinkMode nMode, const OUString& rDoc, const OUString& rFlt,
296 const OUString& rOpt, const OUString& rTab, sal_uLong nRefreshDelay );
298 sal_Int64 GetHashCode () const;
300 void GetName( OUString& rName ) const;
301 void SetName( const OUString& rNewName );
303 void SetAnonymousDBData(ScDBData* pDBData);
304 ScDBData* GetAnonymousDBData() { return pDBDataNoName;}
306 void GetCodeName( OUString& rName ) const { rName = aCodeName; }
307 void SetCodeName( const OUString& rNewName ) { aCodeName = rNewName; }
309 const OUString& GetUpperName() const;
311 const OUString& GetPageStyle() const { return aPageStyle; }
312 void SetPageStyle( const OUString& rName );
313 void PageStyleModified( const OUString& rNewName );
315 bool IsProtected() const;
316 void SetProtection(const ScTableProtection* pProtect);
317 ScTableProtection* GetProtection();
319 Size GetPageSize() const;
320 void SetPageSize( const Size& rSize );
321 void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
323 void LockTable();
324 void UnlockTable();
326 bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
327 SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = nullptr ) const;
328 bool IsSelectionEditable( const ScMarkData& rMark,
329 bool* pOnlyNotBecauseOfMatrix = nullptr ) const;
331 bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
332 bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
334 bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
336 bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString& rString,
337 ScSetStringParam* pParam = nullptr );
339 bool SetEditText( SCCOL nCol, SCROW nRow, EditTextObject* pEditText );
340 void SetEditText( SCCOL nCol, SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
341 SCROW GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
343 void SetEmptyCell( SCCOL nCol, SCROW nRow );
344 void SetFormula(
345 SCCOL nCol, SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
346 void SetFormula(
347 SCCOL nCol, SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
350 * Takes ownership of pCell
352 * @return pCell if it was successfully inserted, NULL otherwise. pCell
353 * is deleted automatically on failure to insert.
355 ScFormulaCell* SetFormulaCell( SCCOL nCol, SCROW nRow, ScFormulaCell* pCell );
357 bool SetFormulaCells( SCCOL nCol, SCROW nRow, std::vector<ScFormulaCell*>& rCells );
359 bool HasFormulaCell( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
361 svl::SharedString GetSharedString( SCCOL nCol, SCROW nRow ) const;
363 void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
364 void SetValues( SCCOL nCol, SCROW nRow, const std::vector<double>& rVals );
365 void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
366 SCSIZE GetPatternCount( SCCOL nCol ) const;
367 SCSIZE GetPatternCount( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const;
368 bool ReservePatternCount( SCCOL nCol, SCSIZE nReserve );
370 void SetRawString( SCCOL nCol, SCROW nRow, const svl::SharedString& rStr );
371 void GetString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
372 double* GetValueCell( SCCOL nCol, SCROW nRow );
373 void GetInputString( SCCOL nCol, SCROW nRow, OUString& rString ) const;
374 double GetValue( SCCOL nCol, SCROW nRow ) const;
375 const EditTextObject* GetEditText( SCCOL nCol, SCROW nRow ) const;
376 void RemoveEditTextCharAttribs( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
377 void GetFormula( SCCOL nCol, SCROW nRow, OUString& rFormula ) const;
378 const ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow ) const;
379 ScFormulaCell* GetFormulaCell( SCCOL nCol, SCROW nRow );
381 CellType GetCellType( const ScAddress& rPos ) const
383 return ValidColRow(rPos.Col(),rPos.Row()) ?
384 aCol[rPos.Col()].GetCellType( rPos.Row() ) :
385 CELLTYPE_NONE;
387 CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
388 ScRefCellValue GetCellValue( SCCOL nCol, SCROW nRow ) const;
390 void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
391 void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
393 ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow );
395 size_t GetNoteCount( SCCOL nCol ) const;
396 SCROW GetNotePosition( SCCOL nCol, size_t nIndex ) const;
397 void CreateAllNoteCaptions();
398 void ForgetNoteCaptions( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
400 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
401 void GetNotesInRange( const ScRange& rRange, std::vector<sc::NoteEntry>& rNotes ) const;
402 bool ContainsNotesInRange( const ScRange& rRange ) const;
404 bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) const;
405 void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
406 void DeleteRow(
407 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
408 bool* pUndoOutline = nullptr, std::vector<ScAddress>* pGroupPos = nullptr );
410 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
411 void InsertCol(
412 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
413 void DeleteCol(
414 const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline = nullptr );
416 void DeleteArea(
417 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, InsertDeleteFlags nDelFlag,
418 bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = nullptr );
420 void CopyToClip( sc::CopyToClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable );
421 void CopyToClip( sc::CopyToClipContext& rCxt, const ScRangeList& rRanges, ScTable* pTable );
423 void CopyStaticToDocument(
424 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const SvNumberFormatterMergeMap& rMap,
425 ScTable* pDestTab );
427 void CopyCellToDocument( SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, SCROW nDestRow, ScTable& rDestTab );
429 bool InitColumnBlockPosition( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol );
431 void DeleteBeforeCopyFromClip(
432 sc::CopyFromClipContext& rCxt, const ScTable& rClipTab, sc::ColumnSpanSet& rBroadcastSpans );
434 void CopyOneCellFromClip(
435 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCROW nSrcRow, ScTable* pSrcTab );
437 void CopyFromClip(
438 sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
439 SCsCOL nDx, SCsROW nDy, ScTable* pTable );
441 void StartListeningFormulaCells(
442 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt,
443 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
445 void SetDirtyFromClip(
446 SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
448 void CopyToTable(
449 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
450 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab,
451 const ScMarkData* pMarkData = nullptr, bool bAsLink = false, bool bColRowFlags = true,
452 bool bGlobalNamesToLocal = false, bool bCopyCaptions = true );
454 void CopyCaptionsToTable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pDestTab, bool bCloneCaption );
456 void UndoToTable(
457 sc::CopyToDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
458 InsertDeleteFlags nFlags, bool bMarked, ScTable* pDestTab );
460 void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
461 SCsCOL nDx, SCsROW nDy, ScTable* pTable);
462 void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
463 ScTable* pTransClip, InsertDeleteFlags nFlags, bool bAsLink );
465 // mark of this document
466 void MixMarked(
467 sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
468 bool bSkipEmpty, const ScTable* pSrcTab );
470 void MixData(
471 sc::MixDocContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
472 ScPasteFunc nFunction, bool bSkipEmpty, const ScTable* pSrcTab );
474 void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
475 SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
477 void CopyScenarioFrom( const ScTable* pSrcTab );
478 void CopyScenarioTo( ScTable* pDestTab ) const;
479 bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
480 void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
481 bool HasScenarioRange( const ScRange& rRange ) const;
482 void InvalidateScenarioRanges();
483 const ScRangeList* GetScenarioRanges() const;
485 void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
487 void InvalidateTableArea();
488 void InvalidatePageBreaks();
490 bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty
491 bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
492 bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const;
493 bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
494 SCCOL& rEndCol, bool bNotes ) const;
495 bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
496 SCROW& rEndRow, bool bNotes ) const;
498 bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
500 void ExtendPrintArea( OutputDevice* pDev,
501 SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
503 void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
504 bool bIncludeOld, bool bOnlyDown ) const;
506 bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
507 SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly,
508 bool bStickyTopRow, bool bStickyLeftCol ) const;
510 SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const;
512 SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
513 SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
515 void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
516 void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
517 bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
519 void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
521 bool HasData( SCCOL nCol, SCROW nRow ) const;
522 bool HasStringData( SCCOL nCol, SCROW nRow ) const;
523 bool HasValueData( SCCOL nCol, SCROW nRow ) const;
524 bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
525 SCCOL nEndCol, SCROW nEndRow ) const;
527 sal_uInt16 GetErrCode( const ScAddress& rPos ) const
529 return ValidColRow(rPos.Col(),rPos.Row()) ?
530 aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
534 void ResetChanged( const ScRange& rRange );
536 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
537 void SetDirty( const ScRange&, ScColumn::BroadcastMode );
538 void SetDirtyAfterLoad();
539 void SetDirtyVar();
540 void SetTableOpDirty( const ScRange& );
541 void CalcAll();
542 void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
543 void CompileAll( sc::CompileFormulaContext& rCxt );
544 void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
546 /** Broadcast single broadcasters in range, without explicitly setting
547 anything dirty, not doing area broadcasts.
548 @param rHint address is modified to adapt to the actual broadcasted
549 position on each iteration and upon return points to the last
550 position broadcasted. */
551 bool BroadcastBroadcasters( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScHint& rHint );
553 bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode );
555 void UpdateReference(
556 sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr,
557 bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
559 void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
560 SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
561 SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
563 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
564 ScDocument* pUndoDoc );
566 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
568 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
569 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
570 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo, ScProgress* pProgress );
571 void UpdateCompile( bool bForceIfNameInUse = false );
572 void SetTabNo(SCTAB nNewTab);
573 void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
574 sc::UpdatedRangeNames& rIndexes) const;
575 void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
576 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
577 double nStepValue, double nMaxValue, ScProgress* pProgress);
578 OUString GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
580 void UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData& rMark );
582 void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
583 sal_uInt16 nFormatNo );
584 void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
585 bool SearchAndReplace(
586 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
587 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
589 void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
591 bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
592 bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
593 bool IsMerged( SCCOL nCol, SCROW nRow ) const;
594 bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
595 SCCOL& rEndCol, SCROW& rEndRow,
596 bool bRefresh );
597 const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
598 const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
599 const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
601 sal_uInt32 GetNumberFormat( const ScAddress& rPos ) const;
602 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
603 sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
605 void SetNumberFormat( SCCOL nCol, SCROW nRow, sal_uInt32 nNumberFormat );
607 void MergeSelectionPattern( ScMergePatternState& rState,
608 const ScMarkData& rMark, bool bDeep ) const;
609 void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
610 SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
611 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
612 ScLineFlags& rFlags,
613 SCCOL nStartCol, SCROW nStartRow,
614 SCCOL nEndCol, SCROW nEndRow ) const;
615 void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
616 const SvxBoxInfoItem* pLineInner,
617 SCCOL nStartCol, SCROW nStartRow,
618 SCCOL nEndCol, SCROW nEndRow );
620 void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
621 void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
622 void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
623 const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = nullptr );
625 void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr )
627 if (ValidColRow(rPos.Col(),rPos.Row()))
628 aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr );
630 void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
631 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
632 const ScPatternAttr& rPattern, short nNewType );
633 void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
634 void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
636 void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
637 void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
638 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
639 void ApplySelectionLineStyle( const ScMarkData& rMark,
640 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
642 const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
643 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
644 const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
645 SCCOL nCol2, SCROW nRow2 ) const;
647 void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
648 OutputDevice* pDev,
649 double nPPTX, double nPPTY,
650 const Fraction& rZoomX, const Fraction& rZoomY );
652 bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
654 bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags );
655 bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags );
657 void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = nullptr );
658 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true );
660 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
661 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
663 const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
664 const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
665 void SetRepeatColRange( const ScRange* pNew );
666 void SetRepeatRowRange( const ScRange* pNew );
668 sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
669 const ScRange* GetPrintRange(sal_uInt16 nPos) const;
670 /** Returns true, if the sheet is always printed. */
671 bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
673 /** Removes all print ranges. */
674 void ClearPrintRanges();
675 /** Adds a new print ranges. */
676 void AddPrintRange( const ScRange& rNew );
677 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
678 void SetPrintEntireSheet();
680 void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
681 void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
683 sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
684 double nPPTX, double nPPTY,
685 const Fraction& rZoomX, const Fraction& rZoomY,
686 bool bFormula, const ScMarkData* pMarkData,
687 const ScColWidthParam* pParam );
688 bool SetOptimalHeight(
689 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
690 ScProgress* pOuterProgress = nullptr, sal_uLong nProgressStart = 0 );
692 void SetOptimalHeightOnly(
693 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
694 ScProgress* pOuterProgress = nullptr, sal_uLong nProgressStart = 0 );
696 long GetNeededSize( SCCOL nCol, SCROW nRow,
697 OutputDevice* pDev,
698 double nPPTX, double nPPTY,
699 const Fraction& rZoomX, const Fraction& rZoomY,
700 bool bWidth, bool bTotalSize );
701 void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
702 void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
703 void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
704 bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
705 double nPPTX, double nPPTY );
708 * Set specified row height to specified ranges. Don't check for drawing
709 * objects etc. Just set the row height. Nothing else.
711 * Note that setting a new row height via this function will not
712 * invalidate page breaks.
714 void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
716 // nPPT to test for modification
717 void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
719 sal_uInt16 GetColWidth( SCCOL nCol, bool bHiddenAsZero = true ) const;
720 sal_uLong GetColWidth( SCCOL nStartCol, SCCOL nEndCol ) const;
721 SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = nullptr, SCROW* pEndRow = nullptr, bool bHiddenAsZero = true ) const;
722 sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true ) const;
723 sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
724 sal_uLong GetColOffset( SCCOL nCol, bool bHiddenAsZero = true ) const;
725 sal_uLong GetRowOffset( SCROW nRow, bool bHiddenAsZero = true ) const;
728 * Get the last row such that the height of row 0 to the end row is as
729 * high as possible without exceeding the specified height value.
731 * @param nHeight maximum desired height
733 * @return SCROW last row of the range within specified height.
735 SCROW GetRowForHeight(sal_uLong nHeight) const;
737 sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
738 sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
740 sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
742 SCROW GetHiddenRowCount( SCROW nRow ) const;
744 void ShowCol(SCCOL nCol, bool bShow);
745 void ShowRow(SCROW nRow, bool bShow);
746 void DBShowRow(SCROW nRow, bool bShow);
748 void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
749 void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
751 void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
752 void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
754 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
755 SCROW GetLastFlaggedRow() const;
757 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
758 SCCOL GetLastChangedCol() const;
759 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
760 SCROW GetLastChangedRow() const;
762 bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
763 bool IsDataFiltered(const ScRange& rRange) const;
764 sal_uInt8 GetColFlags( SCCOL nCol ) const;
765 sal_uInt8 GetRowFlags( SCROW nRow ) const;
767 const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
768 { return pRowFlags; }
770 bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
771 bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
773 void UpdatePageBreaks( const ScRange* pUserArea );
774 void RemoveManualBreaks();
775 bool HasManualBreaks() const;
776 void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
777 void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
779 void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
780 void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
781 bool HasRowPageBreak(SCROW nRow) const;
782 bool HasColPageBreak(SCCOL nCol) const;
783 bool HasRowManualBreak(SCROW nRow) const;
784 bool HasColManualBreak(SCCOL nCol) const;
787 * Get the row position of the next manual break that occurs at or below
788 * specified row. When no more manual breaks are present at or below
789 * the specified row, -1 is returned.
791 * @param nRow row at which the search begins.
793 * @return SCROW next row position with manual page break, or -1 if no
794 * more manual breaks are present.
796 SCROW GetNextManualBreak(SCROW nRow) const;
798 void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
799 void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
800 void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
801 void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
802 void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
803 css::uno::Sequence<
804 css::sheet::TablePageBreakData> GetRowBreakData() const;
806 bool RowHidden(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
807 bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
808 bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
809 bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = nullptr, SCCOL* pLastCol = nullptr) const;
810 bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
811 void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
812 void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
813 void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
814 void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
815 SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
816 SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
817 SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
818 sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero = true) const;
820 SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
822 bool RowFiltered(SCROW nRow, SCROW* pFirstRow = nullptr, SCROW* pLastRow = nullptr) const;
823 bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = nullptr, SCCOL* pLastCol = nullptr) const;
824 bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
825 void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
826 void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
827 void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
828 void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
829 SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
830 SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
831 SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
833 bool IsManualRowHeight(SCROW nRow) const;
835 bool HasUniformRowHeight( SCROW nRow1, SCROW nRow2 ) const;
837 void SyncColRowFlags();
839 void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
840 void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
842 /** Sort a range of data. */
843 void Sort(
844 const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
845 ScProgress* pProgress, sc::ReorderParam* pUndo );
847 void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress );
849 bool ValidQuery(
850 SCROW nRow, const ScQueryParam& rQueryParam, ScRefCellValue* pCell = nullptr,
851 bool* pbTestEqualCondition = nullptr);
852 void TopTenQuery( ScQueryParam& );
853 SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub);
854 bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
856 void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
857 void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
858 bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
860 bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
861 bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
863 sal_Int32 GetMaxStringLen( SCCOL nCol,
864 SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
865 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
866 SCCOL nCol,
867 SCROW nRowStart, SCROW nRowEnd ) const;
869 bool IsSortCollatorGlobal() const;
870 void InitSortCollator( const ScSortParam& rPar );
871 void DestroySortCollator();
872 void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
874 void SetRangeName(ScRangeName* pNew);
875 ScRangeName* GetRangeName() const;
877 void PreprocessRangeNameUpdate(
878 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
880 void CompileHybridFormula(
881 sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
883 void PreprocessDBDataUpdate(
884 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
886 ScConditionalFormatList* GetCondFormList();
887 const ScConditionalFormatList* GetCondFormList() const;
888 void SetCondFormList( ScConditionalFormatList* pList );
890 void DeleteConditionalFormat(sal_uLong nOldIndex);
892 sal_uLong AddCondFormat( ScConditionalFormat* pNew );
894 SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow ) const;
895 void SetScriptType( SCCOL nCol, SCROW nRow, SvtScriptType nType );
896 void UpdateScriptTypes( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
898 SvtScriptType GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
900 size_t GetFormulaHash( SCCOL nCol, SCROW nRow ) const;
902 ScFormulaVectorState GetFormulaVectorState( SCCOL nCol, SCROW nRow ) const;
903 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol, SCROW nRow );
904 formula::FormulaTokenRef ResolveStaticReference( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
905 formula::VectorRefArray FetchVectorRefArray( SCCOL nCol, SCROW nRow1, SCROW nRow2 );
907 void SplitFormulaGroups( SCCOL nCol, std::vector<SCROW>& rRows );
908 void UnshareFormulaCells( SCCOL nCol, std::vector<SCROW>& rRows );
909 void RegroupFormulaCells( SCCOL nCol );
911 ScRefCellValue GetRefCellValue( SCCOL nCol, SCROW nRow );
913 SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow );
914 const SvtBroadcaster* GetBroadcaster( SCCOL nCol, SCROW nRow ) const;
915 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
916 bool HasBroadcaster( SCCOL nCol ) const;
918 void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool = nullptr ) const;
920 void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
922 void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen );
923 void SetFormulaResults( SCCOL nCol, SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen );
926 * Either start all formula cells as listeners unconditionally, or start
927 * those that are marked "needs listening".
929 * @param rCxt context object.
930 * @param bAll when true, start all formula cells as listeners. When
931 * false, only start those that are marked "needs listening".
933 void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
936 * Mark formula cells dirty that have the mbPostponedDirty flag set or
937 * contain named ranges with relative references.
939 void SetDirtyIfPostponed();
942 * Broadcast dirty formula cells that contain functions such as CELL(),
943 * COLUMN() or ROW() which may change its value on move.
945 void BroadcastRecalcOnRefMove();
947 void CollectListeners( std::vector<SvtListener*>& rListeners, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
949 void TransferListeners(
950 ScTable& rDestTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
951 SCCOL nColDelta, SCROW nRowDelta );
953 void TransferCellValuesTo( SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest );
954 void CopyCellValuesFrom( SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc );
956 void ConvertFormulaToValue(
957 sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
958 sc::TableValues* pUndo );
960 void SwapNonEmpty(
961 sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
963 void finalizeOutlineImport();
965 #if DEBUG_COLUMN_STORAGE
966 void DumpFormulaGroups( SCCOL nCol ) const;
967 #endif
969 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
971 'Replace' replaces at the 'current' position, but in order to achieve
972 that, we have to 'shift' the rCol / rRow to the 'previous' position -
973 what it is depends on various settings in rSearchItem.
975 static void UpdateSearchItemAddressForReplace( const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow );
977 private:
979 void FillFormulaVertical(
980 const ScFormulaCell& rSrcCell,
981 SCCOLROW& rInner, SCCOL nCol, SCROW nRow1, SCROW nRow2,
982 ScProgress* pProgress, sal_uLong& rProgress );
984 void FillSeriesSimple(
985 ScCellValue& rSrcCell, SCCOLROW& rInner, SCCOLROW nIMin, SCCOLROW nIMax,
986 SCCOLROW& rCol, SCCOLROW& rRow, bool bVertical, ScProgress* pProgress, sal_uLong& rProgress );
988 void FillAutoSimple(
989 SCCOLROW nISrcStart, SCCOLROW nISrcEnd, SCCOLROW nIStart, SCCOLROW nIEnd,
990 SCCOLROW& rInner, SCCOLROW& rCol, SCCOLROW& rRow,
991 sal_uLong nActFormCnt, sal_uLong nMaxFormCnt,
992 bool bHasFiltered, bool bVertical, bool bPositive,
993 ScProgress* pProgress, sal_uLong& rProgress );
995 void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
996 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
997 FillDateCmd eFillDateCmd,
998 double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
999 bool bAttribs, ScProgress* pProgress );
1000 void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1001 FillCmd& rCmd, FillDateCmd& rDateCmd,
1002 double& rInc, sal_uInt16& rMinDigits,
1003 ScUserListData*& rListData, sal_uInt16& rListIndex);
1004 void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1005 sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
1007 bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
1008 bool bMarked, bool bUnprotected ) const;
1010 void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
1011 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
1012 void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
1013 void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
1014 bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
1015 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1016 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1017 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1018 bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1019 SCCOL nLastCol, SCROW nLastRow,
1020 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1021 bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
1022 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1023 bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1024 const ScMarkData& rMark, OUString& rUndoStr, ScDocument* pUndoDoc);
1025 bool ReplaceAll(
1026 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1027 OUString& rUndoStr, ScDocument* pUndoDoc);
1029 bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1030 const ScMarkData& rMark);
1031 bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1032 const ScMarkData& rMark, bool bIsUndo);
1033 bool SearchAllStyle(
1034 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
1035 bool ReplaceAllStyle(
1036 const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1037 ScDocument* pUndoDoc);
1038 bool SearchAndReplaceEmptyCells(
1039 const SvxSearchItem& rSearchItem,
1040 SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
1041 OUString& rUndoStr, ScDocument* pUndoDoc);
1042 bool SearchRangeForEmptyCell(const ScRange& rRange,
1043 const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
1044 OUString& rUndoStr);
1045 bool SearchRangeForAllEmptyCells(
1046 const ScRange& rRange, const SvxSearchItem& rSearchItem,
1047 ScRangeList& rMatchedRanges, OUString& rUndoStr, ScDocument* pUndoDoc);
1049 // use the global sort parameter:
1050 bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
1051 static void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
1052 short CompareCell(
1053 sal_uInt16 nSort,
1054 ScRefCellValue& rCell1, SCCOL nCell1Col, SCROW nCell1Row,
1055 ScRefCellValue& rCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
1056 short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1057 short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
1058 ScSortInfoArray* CreateSortInfoArray( const sc::ReorderParam& rParam );
1059 ScSortInfoArray* CreateSortInfoArray(
1060 const ScSortParam& rSortParam, SCCOLROW nInd1, SCCOLROW nInd2,
1061 bool bKeepQuery, bool bUpdateRefs );
1062 void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
1063 void SortReorderByColumn( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2, bool bPattern, ScProgress* pProgress );
1065 void SortReorderByRow( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress );
1066 void SortReorderByRowRefUpdate( ScSortInfoArray* pArray, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress );
1068 bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1069 bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
1070 void GetUpperCellString(SCCOL nCol, SCROW nRow, OUString& rStr);
1072 bool RefVisible(ScFormulaCell* pCell);
1074 bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
1076 void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
1077 void FillFormula(
1078 ScFormulaCell* pSrcCell, SCCOL nDestCol, SCROW nDestRow, bool bLast );
1079 void UpdateInsertTabAbs(SCTAB nNewPos);
1080 bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
1081 const ScMarkData& rMark) const;
1082 bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
1083 void TestTabRefAbs(SCTAB nTable) const;
1084 void CompileDBFormula( sc::CompileFormulaContext& rCxt );
1085 void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
1087 void StartListening( const ScAddress& rAddress, SvtListener* pListener );
1088 void EndListening( const ScAddress& rAddress, SvtListener* pListener );
1089 void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
1090 void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
1092 void AttachFormulaCells( sc::StartListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1093 void DetachFormulaCells( sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
1095 void SetLoadingMedium(bool bLoading);
1097 SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
1098 SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
1099 const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
1101 // idle calculation of OutputDevice text width for cell
1102 // also invalidates script type, broadcasts for "calc as shown"
1103 void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
1104 bool bNumFormatChanged, bool bBroadcast );
1106 void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
1109 * In case the cell text goes beyond the column width, move the max column
1110 * position to the right. This is called from ExtendPrintArea.
1112 void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
1114 void CopyPrintRange(const ScTable& rTable);
1116 SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
1118 SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
1120 // Clipboard transpose for notes
1121 void TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SCROW nRow1, SCROW nRow2);
1123 ScColumn* FetchColumn( SCCOL nCol );
1124 const ScColumn* FetchColumn( SCCOL nCol ) const;
1126 void EndListeningIntersectedGroup(
1127 sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow, std::vector<ScAddress>* pGroupPos = nullptr );
1129 void EndListeningIntersectedGroups(
1130 sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
1131 std::vector<ScAddress>* pGroupPos = nullptr );
1133 void EndListeningGroup( sc::EndListeningContext& rCxt, SCCOL nCol, SCROW nRow );
1134 void SetNeedsListeningGroup( SCCOL nCol, SCROW nRow );
1137 * Use this to iterate through non-empty visible cells in a single column.
1139 class VisibleDataCellIterator
1141 public:
1142 static SCROW ROW_NOT_FOUND;
1144 explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
1145 ~VisibleDataCellIterator();
1148 * Set the start row position. In case there is not visible data cell
1149 * at the specified row position, it will move to the position of the
1150 * first visible data cell below that point.
1152 * @return First visible data cell if found, or NULL otherwise.
1154 ScRefCellValue reset(SCROW nRow);
1157 * Find the next visible data cell position.
1159 * @return Next visible data cell if found, or NULL otherwise.
1161 ScRefCellValue next();
1164 * Get the current row position.
1166 * @return Current row position, or ROW_NOT_FOUND if the iterator
1167 * doesn't point to a valid data cell position.
1169 SCROW getRow() const { return mnCurRow;}
1171 private:
1172 ScFlatBoolRowSegments& mrRowSegs;
1173 ScColumn& mrColumn;
1174 ScRefCellValue maCell;
1175 SCROW mnCurRow;
1176 SCROW mnUBound;
1181 #endif
1183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */