Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / column.hxx
blob032ef8e8708837566c086d86f886178274c91092
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 SC_COLUMN_HXX
21 #define SC_COLUMN_HXX
23 #include "markarr.hxx"
24 #include "global.hxx"
25 #include "address.hxx"
26 #include "rangenam.hxx"
27 #include "types.hxx"
28 #include "mtvelements.hxx"
29 #include "formula/types.hxx"
31 #include <set>
32 #include <vector>
34 #include <boost/intrusive_ptr.hpp>
35 #include <mdds/flat_segment_tree.hpp>
37 namespace editeng { class SvxBorderLine; }
38 namespace formula { struct VectorRefArray; }
40 namespace sc {
42 struct FormulaGroupContext;
43 class StartListeningContext;
44 class EndListeningContext;
45 class CopyFromClipContext;
46 class CopyToClipContext;
47 class CopyToDocContext;
48 class MixDocContext;
49 class ColumnSpanSet;
50 struct ColumnBlockPosition;
51 class SingleColumnSpanSet;
52 struct RefUpdateContext;
53 struct RefUpdateInsertTabContext;
54 struct RefUpdateDeleteTabContext;
55 struct RefUpdateMoveTabContext;
56 class EditTextIterator;
57 struct NoteEntry;
58 class DocumentStreamAccess;
62 class Fraction;
63 class OutputDevice;
64 class SfxItemPoolCache;
65 class SvtListener;
66 class SfxPoolItem;
67 class SfxStyleSheetBase;
68 class SvxBoxInfoItem;
69 class SvxBoxItem;
71 class ScAttrIterator;
72 class ScAttrArray;
73 struct ScAttrEntry;
74 class ScDocument;
75 class ScEditDataArray;
76 class ScFormulaCell;
77 class ScMarkData;
78 class ScPatternAttr;
79 class ScStyleSheet;
80 class SvtBroadcaster;
81 class ScTypedStrData;
82 class ScProgress;
83 struct ScFunctionData;
84 struct ScLineFlags;
85 struct ScMergePatternState;
86 class ScFlatBoolRowSegments;
87 struct ScSetStringParam;
88 struct ScColWidthParam;
89 class ScColumnTextWidthIterator;
90 struct ScFormulaCellGroup;
91 struct ScRefCellValue;
92 struct ScCellValue;
93 class ScDocumentImport;
95 struct ScNeededSizeOptions
97 const ScPatternAttr* pPattern;
98 bool bFormula;
99 bool bSkipMerged;
100 bool bGetFont;
101 bool bTotalSize;
103 ScNeededSizeOptions();
106 class ScColumn
108 // Empty values correspond with empty cells. All non-empty cell positions
109 // must have non-empty elements. For text width, the value should be
110 // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
111 // calculated yet. For script type, it should be either the real script
112 // type value or SC_SCRIPTTYPE_UNKNOWN.
113 sc::CellTextAttrStoreType maCellTextAttrs;
115 // Cell notes
116 sc::CellNoteStoreType maCellNotes;
118 // Broadcasters for formula cells.
119 sc::BroadcasterStoreType maBroadcasters;
121 // Cell values.
122 sc::CellStoreType maCells;
124 SCCOL nCol;
125 SCTAB nTab;
127 ScAttrArray* pAttrArray;
128 ScDocument* pDocument;
129 bool mbDirtyGroups; /// formula groups are dirty.
131 friend class ScDocument; // for FillInfo
132 friend class ScTable;
133 friend class ScValueIterator;
134 friend class ScHorizontalValueIterator;
135 friend class ScDBQueryDataIterator;
136 friend class ScQueryCellIterator;
137 friend class ScCellIterator;
138 friend class ScHorizontalCellIterator;
139 friend class ScHorizontalAttrIterator;
140 friend class ScColumnTextWidthIterator;
141 friend class ScDocumentImport;
142 friend class sc::DocumentStreamAccess;
143 friend class sc::SingleColumnSpanSet;
144 friend class sc::ColumnSpanSet;
145 friend class sc::EditTextIterator;
147 ScColumn(const ScColumn&); // disabled
148 ScColumn& operator= (const ScColumn&); // disabled
150 bool ParseString(
151 ScCellValue& rCell,
152 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
153 ScSetStringParam* pParam );
155 public:
156 ScColumn();
157 ~ScColumn();
159 void Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc);
161 ScDocument& GetDoc();
162 const ScDocument& GetDoc() const;
163 SCTAB GetTab() const { return nTab; }
164 SCCOL GetCol() const { return nCol; }
165 sc::CellStoreType& GetCellStore() { return maCells; }
166 const sc::CellStoreType& GetCellStore() const { return maCells; }
167 sc::CellTextAttrStoreType& GetCellAttrStore() { return maCellTextAttrs; }
168 const sc::CellTextAttrStoreType& GetCellAttrStore() const { return maCellTextAttrs; }
170 ScRefCellValue GetCellValue( SCROW nRow ) const;
171 ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset ) const;
173 void Delete( SCROW nRow );
174 void FreeAll();
175 void SwapRow( SCROW nRow1, SCROW nRow2 );
176 void SwapCell( SCROW nRow, ScColumn& rCol);
178 bool HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
179 bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
180 bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
181 SCCOL& rPaintCol, SCROW& rPaintRow,
182 bool bRefresh );
184 bool IsEmptyData() const;
185 bool IsEmptyAttr() const;
186 bool IsEmpty() const;
188 // data only:
189 bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
190 SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
191 bool HasDataAt(SCROW nRow) const;
192 bool HasVisibleDataAt(SCROW nRow) const;
193 SCROW GetFirstDataPos() const;
194 SCROW GetLastDataPos() const;
195 SCROW GetLastDataPos( SCROW nLastRow ) const;
196 bool GetPrevDataPos(SCROW& rRow) const;
197 bool GetNextDataPos(SCROW& rRow) const;
198 void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster)
199 void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const;
201 SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
202 sal_uInt16 GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
203 bool HasSelectionMatrixFragment(const ScMarkData& rMark) const;
205 bool GetFirstVisibleAttr( SCROW& rFirstRow ) const;
206 bool GetLastVisibleAttr( SCROW& rLastRow, bool bFullFormattedArea = false ) const;
207 bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
208 bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
209 SCROW nEndRow = MAXROW ) const;
210 bool IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
212 bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
213 bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
214 void InsertRow( SCROW nStartRow, SCSIZE nSize );
215 void DeleteRow( SCROW nStartRow, SCSIZE nSize );
216 void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag );
217 void CopyToClip(
218 sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
219 void CopyStaticToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol);
220 void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
221 bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
222 bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
223 void CopyFromClip(
224 sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy, ScColumn& rColumn );
226 void StartListeningInArea( sc::StartListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
228 void RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow );
230 // Selection (?) of this document
231 void MixMarked(
232 sc::MixDocContext& rCxt, const ScMarkData& rMark, sal_uInt16 nFunction,
233 bool bSkipEmpty, const ScColumn& rSrcCol );
234 void MixData(
235 sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, sal_uInt16 nFunction, bool bSkipEmpty,
236 const ScColumn& rSrcCol );
238 ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
240 void UpdateSelectionFunction(
241 const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows );
243 void CopyToColumn(
244 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
245 ScColumn& rColumn, const ScMarkData* pMarkData = NULL, bool bAsLink = false) const;
247 void UndoToColumn(
248 sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked,
249 ScColumn& rColumn, const ScMarkData* pMarkData = NULL) const;
251 void CopyScenarioFrom( const ScColumn& rSrcCol );
252 void CopyScenarioTo( ScColumn& rDestCol ) const;
253 bool TestCopyScenarioTo( const ScColumn& rDestCol ) const;
254 void MarkScenarioIn( ScMarkData& rDestMark ) const;
256 void CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const;
258 void SwapCol(ScColumn& rCol);
259 void MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
261 void MarkSubTotalCells( sc::ColumnSpanSet& rSet, SCROW nRow1, SCROW nRow2, bool bVal ) const;
263 bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst);
265 bool SetString(
266 SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
267 ScSetStringParam* pParam = NULL );
269 void SetEditText( SCROW nRow, EditTextObject* pEditText );
270 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, EditTextObject* pEditText );
271 void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const EditTextObject& rEditText );
272 void SetEditText( SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
273 void SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
274 void SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
277 * Takes ownership of pCell
279 * @return pCell if it was successfully inserted, NULL otherwise. pCell
280 * is deleted automatically on failure to insert.
282 ScFormulaCell* SetFormulaCell( SCROW nRow, ScFormulaCell* pCell );
283 ScFormulaCell* SetFormulaCell( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell );
285 svl::SharedString GetSharedString( SCROW nRow ) const;
287 void SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast = true );
288 void SetRawString( SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
289 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const OUString& rStr, bool bBroadcast = true );
290 void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
291 void SetValue( SCROW nRow, double fVal );
292 void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
293 void SetError( SCROW nRow, const sal_uInt16 nError);
295 void GetString( SCROW nRow, OUString& rString ) const;
296 double* GetValueCell( SCROW nRow );
297 void GetInputString( SCROW nRow, OUString& rString ) const;
298 double GetValue( SCROW nRow ) const;
299 const EditTextObject* GetEditText( SCROW nRow ) const;
300 void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
301 void GetFormula( SCROW nRow, OUString& rFormula ) const;
302 const ScTokenArray* GetFormulaTokens( SCROW nRow ) const;
303 const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
304 ScFormulaCell* GetFormulaCell( SCROW nRow );
305 CellType GetCellType( SCROW nRow ) const;
306 SCSIZE GetCellCount() const;
307 sal_uInt32 GetWeightedCount() const;
308 sal_uInt32 GetCodeCount() const; // RPN-Code in formulas
309 sal_uInt16 GetErrCode( SCROW nRow ) const;
311 bool HasStringData( SCROW nRow ) const;
312 bool HasValueData( SCROW nRow ) const;
313 bool HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
315 bool IsFormulaDirty( SCROW nRow ) const;
317 void SetDirty();
318 void SetDirty( SCROW nRow1, SCROW nRow2 );
319 void SetDirtyVar();
320 void SetDirtyAfterLoad();
321 void SetTableOpDirty( const ScRange& );
322 void CalcAll();
323 void CalcAfterLoad();
324 void CompileAll();
325 void CompileXML( ScProgress& rProgress );
327 bool CompileErrorCells(sal_uInt16 nErrCode);
329 void ResetChanged( SCROW nStartRow, SCROW nEndRow );
331 bool UpdateReferenceOnCopy( const sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL );
334 * Update reference addresses in formula cell in response to mass cell
335 * movement.
337 * @return true if reference of at least one formula cell has been
338 * updated, false otherwise.
340 bool UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL );
342 void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
343 void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext& rCxt );
344 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
345 void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo );
346 void UpdateCompile( bool bForceIfNameInUse = false );
347 void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
348 ScDocument* pUndoDoc );
349 void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
351 void SetTabNo(SCTAB nNewTab);
352 void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<sal_uInt16>& rIndexes) const;
354 const SfxPoolItem* GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
355 const ScPatternAttr* GetPattern( SCROW nRow ) const;
356 const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
358 sal_uInt32 GetNumberFormat( SCROW nRow ) const;
359 sal_uInt32 GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
361 void MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const;
362 void MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const;
363 void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
364 ScLineFlags& rFlags,
365 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const;
366 void ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
367 SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight );
369 void ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
370 void ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
371 void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
372 ScEditDataArray* pDataArray = NULL );
373 bool SetAttrEntries(ScAttrEntry* pData, SCSIZE nSize);
374 void SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, bool bPutToPool = false );
375 void SetPatternArea( SCROW nStartRow, SCROW nEndRow,
376 const ScPatternAttr& rPatAttr, bool bPutToPool = false );
377 void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
378 const ScPatternAttr& rPattern, short nNewType );
380 void ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle );
381 void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
382 void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
383 void ApplySelectionLineStyle( const ScMarkData& rMark,
384 const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
385 void AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
386 void RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
388 const ScStyleSheet* GetStyle( SCROW nRow ) const;
389 const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
390 const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
392 void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
393 bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
395 /// May return -1 if not found
396 SCsROW SearchStyle(
397 SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
398 const ScMarkData& rMark) const;
400 bool SearchStyleRange(
401 SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
402 bool bInSelection, const ScMarkData& rMark) const;
404 bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
405 bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
406 void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
408 void RemoveProtected( SCROW nStartRow, SCROW nEndRow );
410 SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
411 void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
413 void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
414 void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
416 long GetNeededSize(
417 SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
418 const Fraction& rZoomX, const Fraction& rZoomY,
419 bool bWidth, const ScNeededSizeOptions& rOptions) const;
421 sal_uInt16 GetOptimalColWidth(
422 OutputDevice* pDev, double nPPTX, double nPPTY,
423 const Fraction& rZoomX, const Fraction& rZoomY,
424 bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
426 void GetOptimalHeight(
427 SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* pDev,
428 double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
429 bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart);
431 /// Including current, may return -1
432 SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const;
434 void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
435 bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
437 void UpdateInsertTabAbs(SCTAB nNewPos);
438 bool TestTabRefAbs(SCTAB nTable) const;
439 bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
441 void StartListening( SvtListener& rLst, SCROW nRow );
442 void EndListening( SvtListener& rLst, SCROW nRow );
443 void StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
444 void EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
445 void MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow );
446 void StartAllListeners();
447 void StartNeededListeners(); // only for cells where NeedsListening()==true
448 void SetDirtyIfPostponed();
449 void BroadcastRecalcOnRefMove();
451 void CompileDBFormula();
452 void CompileDBFormula( bool bCreateFormulaString );
453 void CompileNameFormula( bool bCreateFormulaString );
454 void CompileColRowNameFormula();
456 sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
457 xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
458 SCROW nRowStart, SCROW nRowEnd ) const;
460 sal_uInt16 GetTextWidth(SCROW nRow) const;
461 void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
463 sal_uInt8 GetScriptType( SCROW nRow ) const;
466 * Get combined script types of the specified range. This method may
467 * update script types on demand if they have not been determined.
469 sal_uInt8 GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
470 sc::CellStoreType::iterator itr);
472 void SetScriptType( SCROW nRow, sal_uInt8 nType );
474 size_t GetFormulaHash( SCROW nRow ) const;
476 ScFormulaVectorState GetFormulaVectorState( SCROW nRow ) const;
477 formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
478 bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
479 void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2 ) const;
480 formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
481 void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
482 void SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen );
484 void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
486 SvtBroadcaster* GetBroadcaster( SCROW nRow );
487 const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
488 void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
489 bool HasBroadcaster() const;
491 void Broadcast( SCROW nRow );
492 void BroadcastCells( const std::vector<SCROW>& rRows, sal_uLong nHint );
494 // cell notes
495 ScPostIt* GetCellNote( SCROW nRow );
496 const ScPostIt* GetCellNote( SCROW nRow ) const;
497 void DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
498 void DeleteCellNote( SCROW nRow );
499 bool HasCellNotes() const;
500 void SetCellNote( SCROW nRow, ScPostIt* pNote);
501 bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
503 size_t GetNoteCount() const;
504 SCROW GetNotePosition( size_t nIndex ) const;
505 void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
506 void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vector<sc::NoteEntry>& rNotes ) const;
508 SCROW GetCellNotesMaxRow() const;
509 SCROW GetCellNotesMinRow() const;
511 void CopyCellNotesToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
512 SCROW nRowOffsetDest=0) const;
513 void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
514 sc::ColumnBlockPosition& maDestBlockPos, bool bCloneCaption = true, SCROW nRowOffsetDest=0 ) const;
515 void UpdateNoteCaptions();
517 void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
519 void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ) const;
522 * Detach a formula cell that's about to be deleted, or removed from
523 * document storage (if that ever happens).
525 void DetachFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
527 void DetachFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
530 * Regroup formula cells for the entire column.
532 void RegroupFormulaCells();
534 #if DEBUG_COLUMN_STORAGE
535 void DumpFormulaGroups() const;
536 #endif
538 private:
540 sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow );
541 sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow );
542 void ActivateNewFormulaCell( const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell, bool bJoin = true );
543 void ActivateNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell, bool bJoin = true );
544 void BroadcastNewCell( SCROW nRow );
545 bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellStoreType::iterator& itr );
547 const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
549 SCROW FindNextVisibleRowWithContent(
550 sc::CellStoreType::const_iterator& itPos, SCROW nRow, bool bForward) const;
551 SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
554 * Called whenever the state of cell array gets modified i.e. new cell
555 * insertion, cell removal or relocation, cell value update and so on.
557 * Call this only from those methods where maCells is modified directly.
559 void CellStorageModified();
561 void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
562 void SwapCellTextAttrs( SCROW nRow1, SCROW nRow2 );
564 // cell notes
565 void SwapCellNotes( SCROW nRow1, SCROW nRow2 );
569 #endif
572 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */