diff options
Diffstat (limited to 'sc/inc')
-rw-r--r-- | sc/inc/cellvalue.hxx | 33 | ||||
-rw-r--r-- | sc/inc/column.hxx | 5 | ||||
-rw-r--r-- | sc/inc/columniterator.hxx | 29 | ||||
-rw-r--r-- | sc/inc/document.hxx | 13 | ||||
-rw-r--r-- | sc/inc/formulacell.hxx | 10 | ||||
-rw-r--r-- | sc/inc/mtvcellfunc.hxx | 12 | ||||
-rw-r--r-- | sc/inc/table.hxx | 5 |
7 files changed, 100 insertions, 7 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 4ebd29889fee..430212245870 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -132,19 +132,38 @@ struct SC_DLLPUBLIC ScRefCellValue bool hasNumeric() const; + bool hasError() const; + double getValue(); - /** Retrieve string value. + /** + * Retrieve a numeric value without modifying the states of any objects in + * the referenced document store. + */ + double getRawValue() const; - @param pDoc - Needed to resolve EditCells' field contents, obtain a - ScFieldEditEngine from that document. May be NULL if there is - no ScDocument in the calling context but then the document - specific fields can not be resolved. See - ScEditUtil::GetString(). + /** + * Retrieve string value. + * + * Note that this method is NOT thread-safe. + * + * @param pDoc + * Needed to resolve EditCells' field contents, obtain a + * ScFieldEditEngine from that document. May be NULL if there is + * no ScDocument in the calling context but then the document + * specific fields can not be resolved. See + * ScEditUtil::GetString(). */ OUString getString( const ScDocument* pDoc ); + /** + * Retrieve a string value without modifying the states of any objects in + * the referenced document store. + * + * This method is thread-safe. + */ + OUString getRawString( const ScDocument* pDoc ) const; + bool isEmpty() const; bool hasEmptyValue(); diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index d406a21ac784..69caa12e648a 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -67,6 +67,7 @@ class CompileFormulaContext; struct SetFormulaDirtyContext; class RefMovedHint; enum class MatrixEdge; +class ColumnIterator; } @@ -666,6 +667,10 @@ public: void SwapNonEmpty( sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt ); + std::unique_ptr<sc::ColumnIterator> GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const; + + void EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2 ); + #if DUMP_COLUMN_STORAGE void DumpColumnStorage() const; #endif diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx index b36df3df6dbd..c6a87b4e6b39 100644 --- a/sc/inc/columniterator.hxx +++ b/sc/inc/columniterator.hxx @@ -49,6 +49,35 @@ private: void checkEndRow(); }; +namespace sc { + +/** + * This iterator lets you iterate over cells over specified range in a + * single column. It does not modify the state of the cells, and therefore + * is thread safe. + */ +class ColumnIterator +{ + CellStoreType::const_position_type maPos; + CellStoreType::const_position_type maPosEnd; + +public: + ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ); + ~ColumnIterator(); + + void next(); + + SCROW getRow() const; + + bool hasCell() const; + + mdds::mtv::element_t getType() const; + + ScRefCellValue getCell() const; +}; + +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index da3f6feb2d66..ca8a02769af4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -85,6 +85,7 @@ class FormulaGroupAreaListener; class ColumnSet; class UpdatedRangeNames; class TableColumnBlockPositionSet; +class ColumnIterator; } @@ -2281,10 +2282,22 @@ public: */ void PrepareFormulaCalc(); + /** + * Make sure all of the formula cells in the specified range have been + * fully calculated. This method only re-calculates those formula cells + * that have been flagged dirty. + * + * @param rRange range in which to potentially calculate the formula + * cells. + */ + void EnsureFormulaCellResults( const ScRange& rRange ); + SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ); const SvtBroadcaster* GetBroadcaster( const ScAddress& rPos ) const; void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, const ScAddress& rTopPos, SCROW nLength ); + std::unique_ptr<sc::ColumnIterator> GetColumnIterator( SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; + #if DUMP_COLUMN_STORAGE SC_DLLPUBLIC void DumpColumnStorage( SCTAB nTab, SCCOL nCol ) const; #endif diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index fce0227805e1..d4cc6949aa48 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -298,6 +298,16 @@ public: bool IsValueNoError() const; double GetValue(); svl::SharedString GetString(); + + /** + * Get a numeric value without potentially triggering re-calculation. + */ + double GetRawValue() const; + + /** + * Get a string value without potentially triggering re-calculation. + */ + svl::SharedString GetRawString() const; const ScMatrix* GetMatrix(); bool GetMatrixOrigin( ScAddress& rPos ) const; void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx index db72fd4a3278..195e6449007a 100644 --- a/sc/inc/mtvcellfunc.hxx +++ b/sc/inc/mtvcellfunc.hxx @@ -13,6 +13,10 @@ #include "mtvelements.hxx" #include "mtvfunctions.hxx" +#include <functional> + +class ScFormulaCell; + namespace sc { template<typename Func> @@ -32,6 +36,14 @@ ProcessFormula( CellStoreType, formula_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse); } +/** + * Process formula cells found within specified row range. This function + * allows modifications of the states of the formula function objects. + */ +CellStoreType::iterator ProcessFormula( + const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, + std::function<void(size_t,ScFormulaCell*)> aFuncElem ); + template<typename FuncElem, typename FuncElse> typename CellStoreType::iterator ProcessFormula( diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index ef94249026b4..1227847fea2e 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -78,6 +78,7 @@ class CompileFormulaContext; struct SetFormulaDirtyContext; class RefMovedHint; struct ReorderParam; +class ColumnIterator; } @@ -992,6 +993,10 @@ public: void TransferCellValuesTo( SCCOL nCol, SCROW nRow, size_t nLen, sc::CellValues& rDest ); void CopyCellValuesFrom( SCCOL nCol, SCROW nRow, const sc::CellValues& rSrc ); + std::unique_ptr<sc::ColumnIterator> GetColumnIterator( SCCOL nCol, SCROW nRow1, SCROW nRow2 ) const; + + void EnsureFormulaCellResults( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + void ConvertFormulaToValue( sc::EndListeningContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::TableValues* pUndo ); |