/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/** * Store arbitrary cell value of any kind. It only stores cell value and * nothing else. It creates a copy of the original cell value, and manages * the life cycle of the copied value.
*/ struct ScCellValue
{ private: /// std::monostate is there to indicate CellType::NONE
std::variant<std::monostate, double, svl::SharedString, EditTextObject*, ScFormulaCell*> maData;
/** * Set cell value at specified position in specified document. But unlike * commit(), this method sets the original value to the document without * copying. After this call, the value gets cleared.
*/ void release( ScDocument& rDoc, const ScAddress& rPos );
bool equalsWithoutFormat( const ScCellValue& r ) const;
ScCellValue& operator= ( const ScCellValue& r );
ScCellValue& operator=(ScCellValue&& r) noexcept;
ScCellValue& operator= ( const ScRefCellValue& r );
void swap( ScCellValue& r );
};
/** * This is very similar to ScCellValue, except that it references the * original value instead of copying it. As such, don't hold an instance of * this class any longer than necessary, and absolutely not after the * original cell has been destroyed.
*/ struct SAL_DLLPUBLIC_RTTI ScRefCellValue
{ private:
CellType meType; union { double mfValue; const svl::SharedString* mpString; const EditTextObject* mpEditText;
ScFormulaCell* mpFormula;
}; public:
/** * Take cell value from specified position in specified document.
*/
SC_DLLPUBLIC void assign( ScDocument& rDoc, const ScAddress& rPos ); void assign( ScDocument& rDoc, const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos );
/** * Set cell value at specified position in specified document.
*/ void commit( ScDocument& rDoc, const ScAddress& rPos ) const;
bool hasString() const;
SC_DLLPUBLIC bool hasNumeric() const;
bool hasError() const;
double getValue();
/** * Retrieve a numeric value without modifying the states of any objects in * the referenced document store.
*/ double getRawValue() const;
/** * Retrieve string value. * * Note that this method is NOT thread-safe. * * @param rDoc * Needed to resolve EditCells' field contents, obtain a * ScFieldEditEngine from that document.
*/
SC_DLLPUBLIC OUString getString( const ScDocument& rDoc ) const;
SC_DLLPUBLIC svl::SharedString getSharedString( const ScDocument& rDoc, svl::SharedStringPool& rStrPool ) const;
/** * 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& rDoc ) const;
SC_DLLPUBLIC bool isEmpty() const;
bool hasEmptyValue();
bool equalsWithoutFormat( const ScRefCellValue& r ) const;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.