build fix
[LibreOffice.git] / sc / inc / column.hxx
blob93ed1ce94e8db7a8eddffd8ac519e825b345be1c
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_COLUMN_HXX
21 #define INCLUDED_SC_INC_COLUMN_HXX
23 #include "markarr.hxx"
24 #include "global.hxx"
25 #include "address.hxx"
26 #include "rangenam.hxx"
27 #include "rangelst.hxx"
28 #include "types.hxx"
29 #include "mtvelements.hxx"
30 #include <formula/types.hxx>
31 #include <svl/zforlist.hxx>
32 #include "attarray.hxx"
34 #include <set>
35 #include <vector>
37 #include <boost/intrusive_ptr.hpp>
38 #include <mdds/flat_segment_tree.hpp>
40 namespace editeng { class SvxBorderLine; }
41 namespace formula { struct VectorRefArray; }
43 namespace sc {
45 struct FormulaGroupContext;
46 struct FormulaGroupEntry;
47 class StartListeningContext;
48 class EndListeningContext;
49 class CopyFromClipContext;
50 class CopyToClipContext;
51 class CopyToDocContext;
52 class MixDocContext;
53 class ColumnSpanSet;
54 struct ColumnBlockPosition;
55 class SingleColumnSpanSet;
56 struct RefUpdateContext;
57 struct RefUpdateInsertTabContext;
58 struct RefUpdateDeleteTabContext;
59 struct RefUpdateMoveTabContext;
60 class EditTextIterator;
61 struct NoteEntry;
62 class DocumentStreamAccess;
63 class CellValues;
64 class TableValues;
65 struct RowSpan;
66 class RowHeightContext;
67 class CompileFormulaContext;
68 struct SetFormulaDirtyContext;
69 class RefMovedHint;
70 enum class MatrixEdge;
71 class ColumnIterator;
75 class Fraction;
76 class OutputDevice;
77 class SfxItemPoolCache;
78 class SvtListener;
79 class SfxPoolItem;
80 class SfxStyleSheetBase;
81 class SvxBoxInfoItem;
82 class SvxBoxItem;
84 class ScAttrIterator;
85 class ScAttrArray;
86 struct ScAttrEntry;
87 class ScDocument;
88 class ScEditDataArray;
89 class ScFormulaCell;
90 class ScMarkData;
91 class ScPatternAttr;
92 class ScStyleSheet;
93 class SvtBroadcaster;
94 class ScTypedStrData;
95 class ScProgress;
96 struct ScFunctionData;
97 struct ScLineFlags;
98 struct ScMergePatternState;
99 class ScFlatBoolRowSegments;
100 struct ScSetStringParam;
101 struct ScColWidthParam;
102 class ScColumnTextWidthIterator;
103 struct ScFormulaCellGroup;
104 struct ScRefCellValue;
105 struct ScCellValue;
106 class ScDocumentImport;
107 class ScHint;
108 enum class ScMF;
110 struct ScNeededSizeOptions
112 const ScPatternAttr* pPattern;
113 bool bFormula;
114 bool bSkipMerged;
115 bool bGetFont;
116 bool bTotalSize;
118 ScNeededSizeOptions();
121 class ScColumn
123 // Empty values correspond with empty cells. All non-empty cell positions
124 // must have non-empty elements. For text width, the value should be
125 // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
126 // calculated yet. For script type, it should be either the real script
127 // type value or SvtScriptType::UNKNOWN.
128 sc::CellTextAttrStoreType maCellTextAttrs;
130 // Cell notes
131 sc::CellNoteStoreType maCellNotes;
133 // Broadcasters for formula cells.
134 sc::BroadcasterStoreType maBroadcasters;
136 sc::CellStoreEvent maCellsEvent;
138 // Cell values.
139 sc::CellStoreType maCells;
141 ScAttrArray* pAttrArray;
143 size_t mnBlkCountFormula;
145 SCCOL nCol;
146 SCTAB nTab;
148 friend class ScDocument; // for FillInfo
149 friend class ScTable;
150 friend class ScValueIterator;
151 friend class ScHorizontalValueIterator;
152 friend class ScDBQueryDataIterator;
153 friend class ScQueryCellIterator;
154 friend class ScFormulaGroupIterator;
155 friend class ScCellIterator;
156 friend class ScHorizontalCellIterator;
157 friend class ScHorizontalAttrIterator;
158 friend class ScColumnTextWidthIterator;
159 friend class ScDocumentImport;
160 friend class sc::DocumentStreamAccess;
161 friend class sc::SingleColumnSpanSet;
162 friend class sc::ColumnSpanSet;
163 friend class sc::EditTextIterator;
164 friend class sc::CellValues;
165 friend class sc::TableValues;
166 friend class sc::CellStoreEvent;
168 ScColumn(const ScColumn&) = delete;
169 ScColumn& operator= (const ScColumn&) = delete;
171 bool ParseString(
172 ScCellValue& rCell,
173 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
174 ScSetStringParam* pParam );
176 public:
178 /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
179 enum BroadcastMode
181 BROADCAST_NONE, ///< no broadcasting
182 BROADCAST_DATA_POSITIONS, ///< broadcast existing cells with position => does AreaBroadcast
183 BROADCAST_BROADCASTERS ///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
186 ScColumn();
187 ~ScColumn();
189 void Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc, bool bEmptyAttrArray = false);
191 ScDocument* GetDoc() const { return pAttrArray->GetDoc(); }
192 SCTAB GetTab() const { return nTab; }
193 SCCOL GetCol() const { return nCol; }
194 sc::CellStoreType& GetCellStore() { return maCells; }
195 const sc::CellStoreType& GetCellStore() const { return maCells; }
196 sc::CellTextAttrStoreType& GetCellAttrStore() { return maCellTextAttrs; }
197 const sc::CellTextAttrStoreType& GetCellAttrStore() const { return maCellTextAttrs; }
198 sc::CellNoteStoreType& GetCellNoteStore() { return maCellNotes; }
199 const sc::CellNoteStoreType& GetCellNoteStore() const { return maCellNotes; }
201 ScRefCellValue GetCellValue( SCROW nRow ) const;
202 ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
203 static ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
205 const sc::CellTextAttr* GetCellTextAttr( SCROW nRow ) const;
206 const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
208 void Delete( SCROW nRow );
209 void DeleteContent( SCROW nRow, bool bBroadcast = true );
210 void FreeAll();
211 void FreeNotes();
212 void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
214 bool HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const;
215 bool HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const;
216 bool IsMerged( SCROW nRow ) const;
217 bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
218 SCCOL& rPaintCol, SCROW& rPaintRow,
219 bool bRefresh );
221 bool IsEmptyData() const;
222 bool IsEmptyAttr() const;
224 // data only:
225 bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
226 SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
227 bool HasDataAt(SCROW nRow) const;
228 bool HasVisibleDataAt(SCROW nRow) const;
229 SCROW GetFirstDataPos() const;
230 SCROW GetLastDataPos() const;
231 SCROW GetLastDataPos( SCROW nLastRow ) const;
232 bool GetPrevDataPos(SCROW& rRow) const;
233 bool GetNextDataPos(SCROW& rRow) const;
234 void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster)
235 void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const;
237 SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
238 sc::MatrixEdge GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask ) const;
239 bool HasSelectionMatrixFragment(const ScMarkData& rMark) const;
241 bool GetFirstVisibleAttr( SCROW& rFirstRow ) const;
242 bool GetLastVisibleAttr( SCROW& rLastRow ) const;
243 bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
244 bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
245 SCROW nEndRow = MAXROW ) const;
246 bool IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
248 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
249 bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
250 void InsertRow( SCROW nStartRow, SCSIZE nSize );
253 * @param nStartRow top row position
254 * @param nSize size of the segment to delete.
255 * @param pGroupPos when non-NULL, stores the top position of formula
256 * group that's been merged as a result of row deletion.
258 void DeleteRow( SCROW nStartRow, SCSIZE nSize, std::vector<ScAddress>* pGroupPos );
260 void DeleteArea(
261 SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag,
262 bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = nullptr );
264 void DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDeleteFlags nDelFlag );
266 void CopyToClip(
267 sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
269 void CopyStaticToDocument(
270 SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
272 void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
273 bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
274 void InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
276 void DeleteBeforeCopyFromClip(
277 sc::CopyFromClipContext& rCxt, const ScColumn& rClipCol, sc::ColumnSpanSet& rBroadcastSpans );
279 void CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, size_t nColOffset );
281 void CopyFromClip(
282 sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy, ScColumn& rColumn );
284 void RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow );
286 // Selection (?) of this document
287 void MixMarked(
288 sc::MixDocContext& rCxt, const ScMarkData& rMark, ScPasteFunc nFunction,
289 bool bSkipEmpty, const ScColumn& rSrcCol );
290 void MixData(
291 sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, ScPasteFunc nFunction, bool bSkipEmpty,
292 const ScColumn& rSrcCol );
294 ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
296 void UpdateSelectionFunction(
297 const ScRangeList& rRanges, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows );
299 void CopyToColumn(
300 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
301 ScColumn& rColumn, const ScMarkData* pMarkData = nullptr, bool bAsLink = false,
302 bool bGlobalNamesToLocal = false ) const;
304 void UndoToColumn(
305 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
306 ScColumn& rColumn) const;
308 void CopyScenarioFrom( const ScColumn& rSrcCol );
309 void CopyScenarioTo( ScColumn& rDestCol ) const;
310 bool TestCopyScenarioTo( const ScColumn& rDestCol ) const;
311 void MarkScenarioIn( ScMarkData& rDestMark ) const;
313 void CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const;
315 void SwapCol(ScColumn& rCol);
316 void MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
318 bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst);
320 bool SetString(
321 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
322 ScSetStringParam* pParam = nullptr );
324 void SetEditText( SCROW nRow, EditTextObject* pEditText );
325 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, EditTextObject* pEditText );
326 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const EditTextObject& rEditText );
327 void SetEditText( SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
328 void SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
329 void SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
332 * Takes ownership of pCell
334 * @return pCell if it was successfully inserted, NULL otherwise. pCell
335 * is deleted automatically on failure to insert.
337 ScFormulaCell* SetFormulaCell(
338 SCROW nRow, ScFormulaCell* pCell,
339 sc::StartListeningType eListenType = sc::SingleCellListening );
340 void SetFormulaCell(
341 sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
342 sc::StartListeningType eListenType = sc::SingleCellListening );
344 bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells );
346 bool HasFormulaCell() const;
347 bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const;
349 void CloneFormulaCell(
350 const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
351 const std::vector<sc::RowSpan>& rRanges );
353 svl::SharedString GetSharedString( SCROW nRow ) const;
355 void SetRawString( SCROW nRow, const OUString& rStr );
356 void SetRawString( SCROW nRow, const svl::SharedString& rStr );
357 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
358 void SetValue( SCROW nRow, double fVal );
359 void SetValues( SCROW nRow, const std::vector<double>& rVals );
360 void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
361 void SetError( SCROW nRow, const FormulaError nError);
363 void GetString( SCROW nRow, OUString& rString ) const;
364 double* GetValueCell( SCROW nRow );
365 void GetInputString( SCROW nRow, OUString& rString ) const;
366 double GetValue( SCROW nRow ) const;
367 const EditTextObject* GetEditText( SCROW nRow ) const;
368 void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
369 void GetFormula( SCROW nRow, OUString& rFormula ) const;
370 const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
371 ScFormulaCell* GetFormulaCell( SCROW nRow );
372 ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const;
373 CellType GetCellType( SCROW nRow ) const;
374 SCSIZE GetCellCount() const;
375 sal_uInt32 GetWeightedCount() const;
376 sal_uInt32 GetCodeCount() const; // RPN-Code in formulas
377 FormulaError GetErrCode( SCROW nRow ) const;
379 bool HasStringData( SCROW nRow ) const;
380 bool HasValueData( SCROW nRow ) const;
381 bool HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
383 sc::MultiDataCellState::StateType HasDataCellsInRange(
384 SCROW nRow1, SCROW nRow2, SCROW* pRow1 = nullptr ) const;
386 bool IsFormulaDirty( SCROW nRow ) const;
388 void CheckVectorizationState();
389 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
390 void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
391 void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode );
392 void SetDirtyVar();
393 void SetDirtyAfterLoad();
394 void SetTableOpDirty( const ScRange& );
395 void CalcAll();
396 void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
397 void CompileAll( sc::CompileFormulaContext& rCxt );
398 void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
400 /** Broadcast single broadcasters in range, without explicitly setting
401 anything dirty, not doing area broadcasts.
402 @param rHint address is modified to adapt to the actual broadcasted
403 position on each iteration and upon return points to the last
404 position broadcasted. */
405 bool BroadcastBroadcasters( SCROW nRow1, SCROW nRow2, ScHint& rHint );
407 bool CompileErrorCells( sc::CompileFormulaContext& rCxt, FormulaError nErrCode );
409 void ResetChanged( SCROW nStartRow, SCROW nEndRow );
411 bool UpdateReferenceOnCopy( const sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = nullptr );
414 * Update reference addresses in formula cell in response to mass cell
415 * movement.
417 * @return true if reference of at least one formula cell has been
418 * updated, false otherwise.
420 bool UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc );
422 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
423 void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext& rCxt );
424 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
425 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo );
426 void UpdateCompile( bool bForceIfNameInUse = false );
427 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
428 ScDocument* pUndoDoc );
429 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
431 void SetTabNo(SCTAB nNewTab);
432 void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, sc::UpdatedRangeNames& rIndexes) const;
434 void PreprocessRangeNameUpdate(
435 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
437 void CompileHybridFormula(
438 sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
440 void PreprocessDBDataUpdate(
441 sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
443 const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
444 const ScPatternAttr* GetPattern( SCROW nRow ) const;
445 const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
447 sal_uInt32 GetNumberFormat( SCROW nRow ) const;
448 sal_uInt32 GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
450 void MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const;
451 void MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const;
452 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
453 ScLineFlags& rFlags,
454 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const;
455 void ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
456 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight );
458 void ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
459 void ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
460 void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
461 ScEditDataArray* pDataArray = nullptr );
462 void SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
463 void SetPatternArea( SCROW nStartRow, SCROW nEndRow,
464 const ScPatternAttr& rPatAttr );
465 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
466 const ScPatternAttr& rPattern, short nNewType );
468 void ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle );
469 void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
470 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
471 void ApplySelectionLineStyle( const ScMarkData& rMark,
472 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
473 void AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
474 void RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
476 const ScStyleSheet* GetStyle( SCROW nRow ) const;
477 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
478 const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
480 void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
481 bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const;
483 /// May return -1 if not found
484 SCsROW SearchStyle(
485 SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
486 const ScMarkData& rMark) const;
488 bool SearchStyleRange(
489 SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
490 bool bInSelection, const ScMarkData& rMark) const;
492 bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
493 bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags );
494 void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
496 void RemoveProtected( SCROW nStartRow, SCROW nEndRow );
498 SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray );
499 void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast );
501 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
502 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
504 long GetNeededSize(
505 SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
506 const Fraction& rZoomX, const Fraction& rZoomY,
507 bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange ) const;
509 sal_uInt16 GetOptimalColWidth(
510 OutputDevice* pDev, double nPPTX, double nPPTY,
511 const Fraction& rZoomX, const Fraction& rZoomY,
512 bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
514 void GetOptimalHeight(
515 sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nMinHeight, SCROW nMinStart );
517 /// Including current, may return -1
518 SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const;
520 void GetFilterEntries(
521 sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
522 std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
524 bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
526 void UpdateInsertTabAbs(SCTAB nNewPos);
527 bool TestTabRefAbs(SCTAB nTable) const;
528 bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
530 void StartListeningFormulaCells(
531 sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, SCROW nRow1, SCROW nRow2 );
533 void EndListeningFormulaCells(
534 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2,
535 SCROW* pStartRow, SCROW* pEndRow );
537 void StartListening( SvtListener& rLst, SCROW nRow );
538 void EndListening( SvtListener& rLst, SCROW nRow );
539 void StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
540 void EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener );
541 void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
542 void SetDirtyIfPostponed();
543 void BroadcastRecalcOnRefMove();
544 void TransferListeners( ScColumn& rDestCol, SCROW nRow1, SCROW nRow2, SCROW nRowDelta );
545 void CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 );
546 void CollectFormulaCells( std::vector<ScFormulaCell*>& rCells, SCROW nRow1, SCROW nRow2 );
548 void CompileDBFormula( sc::CompileFormulaContext& rCxt );
549 void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
551 sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
552 sal_Int32 GetMaxNumberStringLen( sal_uInt16& nPrecision,
553 SCROW nRowStart, SCROW nRowEnd ) const;
555 sal_uInt16 GetTextWidth(SCROW nRow) const;
556 void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
558 SvtScriptType GetScriptType( SCROW nRow ) const;
561 * Get combined script types of the specified range. This method may
562 * update script types on demand if they have not been determined.
564 SvtScriptType GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
565 const sc::CellStoreType::iterator& itr);
567 void SetScriptType( SCROW nRow, SvtScriptType nType );
568 void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 );
570 size_t GetFormulaHash( SCROW nRow ) const;
572 ScFormulaVectorState GetFormulaVectorState( SCROW nRow ) const;
573 formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
574 bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
575 void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2, svl::SharedStringPool* pPool ) const;
576 formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
577 void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
578 void SetFormulaResults( SCROW nRow, const formula::FormulaConstTokenRef* pResults, size_t nLen );
580 void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
582 SvtBroadcaster* GetBroadcaster( SCROW nRow );
583 const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
585 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
586 void PrepareBroadcastersForDestruction();
588 void Broadcast( SCROW nRow );
589 void BroadcastCells( const std::vector<SCROW>& rRows, sal_uInt32 nHint );
590 void BroadcastRows( SCROW nStartRow, SCROW nEndRow );
592 // cell notes
593 ScPostIt* GetCellNote( SCROW nRow );
594 const ScPostIt* GetCellNote( SCROW nRow ) const;
595 const ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
596 void DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
597 bool HasCellNotes() const;
598 void SetCellNote( SCROW nRow, ScPostIt* pNote);
599 bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
601 ScPostIt* ReleaseNote( SCROW nRow );
602 size_t GetNoteCount() const;
603 void CreateAllNoteCaptions();
604 void ForgetNoteCaptions( SCROW nRow1, SCROW nRow2, bool bPreserveData );
605 SCROW GetNotePosition( size_t nIndex ) const;
606 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
607 void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vector<sc::NoteEntry>& rNotes ) const;
609 SCROW GetCellNotesMaxRow() const;
610 SCROW GetCellNotesMinRow() const;
612 void CopyCellNotesToDocument(
613 SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
614 SCROW nRowOffsetDest = 0) const;
616 void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
617 sc::ColumnBlockPosition& maDestBlockPos, bool bCloneCaption, SCROW nRowOffsetDest=0 ) const;
619 void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 );
621 void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
623 static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
626 * Detach a formula cell that's about to be deleted, or removed from
627 * document storage (if that ever happens).
629 void DetachFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
631 void DetachFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
633 void AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
634 void DetachFormulaCells( sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
637 * Regroup formula cells for the entire column.
639 void RegroupFormulaCells( std::vector<ScAddress>* pGroupPos = nullptr );
642 * Reset column position of formula cells within specified row range.
643 * If bUpdateRefs==true then reference positions are also adjusted to
644 * reflect the new position so that the formula cells still reference the
645 * same cells or ranges after the position change.
646 * The position of a formula cell before the call is interpreted as the old
647 * position of that cell.
649 * Caller needs to ensure that no formula groups cross the top and bottom
650 * row boundaries.
652 * @param nRow1 top row boundary
653 * @param nRow2 bottom row boundary
654 * @param bUpdateRefs whether to adjust references
656 void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs );
658 void SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange );
660 void TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rDest );
661 void CopyCellValuesFrom( SCROW nRow, const sc::CellValues& rSrc );
662 void ConvertFormulaToValue(
663 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, sc::TableValues* pUndo );
665 void SwapNonEmpty(
666 sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
668 std::unique_ptr<sc::ColumnIterator> GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const;
670 void EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2 );
672 #if DUMP_COLUMN_STORAGE
673 void DumpColumnStorage() const;
674 #endif
676 SCSIZE GetPatternCount() const;
677 SCSIZE GetPatternCount( SCROW nRow1, SCROW nRow2 ) const;
678 bool ReservePatternCount( SCSIZE nReserve );
679 private:
681 sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow );
682 sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow );
684 void AttachNewFormulaCell(
685 const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell,
686 bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
688 void AttachNewFormulaCell(
689 const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell,
690 bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
692 void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
693 void BroadcastNewCell( SCROW nRow );
694 bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr );
696 const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
698 SCROW FindNextVisibleRowWithContent(
699 sc::CellStoreType::const_iterator& itPos, SCROW nRow, bool bForward) const;
700 SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
703 * Called whenever the state of cell array gets modified i.e. new cell
704 * insertion, cell removal or relocation, cell value update and so on.
706 * Call this only from those methods where maCells is modified directly.
708 void CellStorageModified();
709 void CellNotesDeleting(SCROW nRow1, SCROW nRow2, bool bForgetCaptionOwnership );
711 void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
713 void DeleteCells(
714 sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag,
715 sc::SingleColumnSpanSet& rDeleted );
718 * Get all non-grouped formula cells and formula cell groups in the whole
719 * column.
721 std::vector<sc::FormulaGroupEntry> GetFormulaGroupEntries();
723 void EndListeningIntersectedGroup(
724 sc::EndListeningContext& rCxt, SCROW nRow, std::vector<ScAddress>* pGroupPos );
726 void EndListeningIntersectedGroups(
727 sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, std::vector<ScAddress>* pGroupPos );
729 void EndListeningGroup( sc::EndListeningContext& rCxt, SCROW nRow );
730 void SetNeedsListeningGroup( SCROW nRow );
733 #endif
735 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */