diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-26 12:00:43 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-26 15:35:04 -0400 |
commit | 0b0e7ca9b3bae3b3295da33e5980f3f4c6a5f532 (patch) | |
tree | 352d493e794127383ea9b75faf5a7249fbdf3a15 /sc/inc/cellvalue.hxx | |
parent | 0fb1409d9682f118d28f89e27bba7887882dad91 (diff) |
Add ScRefCellValue, which is ScCellValue without copied value.
It directly points to the original cell value instance.
Change-Id: I638ec8b931873d237871b6d8fa9f0e1277520d0f
Diffstat (limited to 'sc/inc/cellvalue.hxx')
-rw-r--r-- | sc/inc/cellvalue.hxx | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx index 9dd3a9a72247..7998898fd3ef 100644 --- a/sc/inc/cellvalue.hxx +++ b/sc/inc/cellvalue.hxx @@ -19,7 +19,8 @@ class ScBaseCell; /** * Store arbitrary cell value of any kind. It only stores cell value and - * nothing else. + * nothing else. It creates a copy of the original cell value, and manages + * the life cycle of the copied value. */ struct SC_DLLPUBLIC ScCellValue { @@ -78,6 +79,59 @@ struct SC_DLLPUBLIC ScCellValue void swap( ScCellValue& r ); }; +/** + * This is very similar to ScCellValue, except that it points to the + * original value instead of copying it. As such, don't hold an instance of + * this class any longer than necessary. + */ +struct SC_DLLPUBLIC ScRefCellValue +{ + CellType meType; + union { + double mfValue; + const OUString* mpString; + const EditTextObject* mpEditText; + ScFormulaCell* mpFormula; + }; + + ScRefCellValue(); + ScRefCellValue( double fValue ); + ScRefCellValue( const OUString* pString ); + ScRefCellValue( const EditTextObject* pEditText ); + ScRefCellValue( ScFormulaCell* pFormula ); + ScRefCellValue( const ScRefCellValue& r ); + ~ScRefCellValue(); + + void clear(); + + /** + * Take cell value from specified position in specified document. + */ + void assign( ScDocument& rDoc, const ScAddress& rPos ); + + /** + * TODO: Remove this later. + */ + void assign( ScBaseCell& rCell ); + + /** + * Set cell value at specified position in specified document. + */ + void commit( ScDocument& rDoc, const ScAddress& rPos ) const; + + bool hasString() const; + + bool hasNumeric() const; + + bool isEmpty() const; + + bool equalsWithoutFormat( const ScRefCellValue& r ) const; + + ScRefCellValue& operator= ( const ScRefCellValue& r ); + + void swap( ScRefCellValue& r ); +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |