LibreOffice Module sc (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ScCellValue Struct Reference

Store arbitrary cell value of any kind. More...

#include <cellvalue.hxx>

Public Member Functions

 ScCellValue ()
 
 ScCellValue (const ScRefCellValue &rCell)
 
 ScCellValue (double fValue)
 
 ScCellValue (const svl::SharedString &rString)
 
 ScCellValue (std::unique_ptr< EditTextObject >)
 
 ScCellValue (const ScCellValue &r)
 
 ScCellValue (ScCellValue &&r) noexcept
 
 ~ScCellValue ()
 
void clear () noexcept
 
void set (double fValue)
 
void set (const svl::SharedString &rStr)
 
void set (const EditTextObject &rEditText)
 
void set (std::unique_ptr< EditTextObject >)
 
void set (ScFormulaCell *pFormula)
 
CellType getType () const
 
double getDouble () const
 
ScFormulaCellgetFormula () const
 
const svl::SharedStringgetSharedString () const
 
EditTextObjectgetEditText () const
 
EditTextObjectreleaseEditText ()
 
ScFormulaCellreleaseFormula ()
 
void assign (const ScDocument &rDoc, const ScAddress &rPos)
 Take cell value from specified position in specified document. More...
 
void assign (const ScCellValue &rOther, ScDocument &rDestDoc, ScCloneFlags nCloneFlags=ScCloneFlags::Default)
 
void commit (ScDocument &rDoc, const ScAddress &rPos) const
 Set cell value at specified position in specified document. More...
 
void commit (ScColumn &rColumn, SCROW nRow) const
 
void release (ScDocument &rDoc, const ScAddress &rPos)
 Set cell value at specified position in specified document. More...
 
void release (ScColumn &rColumn, SCROW nRow, sc::StartListeningType eListenType=sc::SingleCellListening)
 
OUString getString (const ScDocument &rDoc) const
 
bool isEmpty () const
 
bool equalsWithoutFormat (const ScCellValue &r) const
 
ScCellValueoperator= (const ScCellValue &r)
 
ScCellValueoperator= (ScCellValue &&r) noexcept
 
ScCellValueoperator= (const ScRefCellValue &r)
 
void swap (ScCellValue &r)
 

Private Member Functions

void reset_to_empty ()
 

Private Attributes

std::variant< std::monostate, double, svl::SharedString, EditTextObject *, ScFormulaCell * > maData
 std::monostate is there to indicate CellType::NONE More...
 

Detailed Description

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.

Definition at line 31 of file cellvalue.hxx.

Constructor & Destructor Documentation

◆ ScCellValue() [1/7]

ScCellValue::ScCellValue ( )

Definition at line 232 of file cellvalue.cxx.

◆ ScCellValue() [2/7]

ScCellValue::ScCellValue ( const ScRefCellValue rCell)

◆ ScCellValue() [3/7]

ScCellValue::ScCellValue ( double  fValue)

Definition at line 254 of file cellvalue.cxx.

References maData.

◆ ScCellValue() [4/7]

ScCellValue::ScCellValue ( const svl::SharedString rString)

Definition at line 256 of file cellvalue.cxx.

References maData.

◆ ScCellValue() [5/7]

ScCellValue::ScCellValue ( std::unique_ptr< EditTextObject xEdit)

Definition at line 258 of file cellvalue.cxx.

References maData.

◆ ScCellValue() [6/7]

ScCellValue::ScCellValue ( const ScCellValue r)

◆ ScCellValue() [7/7]

ScCellValue::ScCellValue ( ScCellValue &&  r)
noexcept

Definition at line 285 of file cellvalue.cxx.

References maData.

◆ ~ScCellValue()

ScCellValue::~ScCellValue ( )

Definition at line 291 of file cellvalue.cxx.

References clear().

Member Function Documentation

◆ assign() [1/2]

void ScCellValue::assign ( const ScCellValue rOther,
ScDocument rDestDoc,
ScCloneFlags  nCloneFlags = ScCloneFlags::Default 
)

◆ assign() [2/2]

void ScCellValue::assign ( const ScDocument rDoc,
const ScAddress rPos 
)

◆ clear()

void ScCellValue::clear ( )
noexcept

◆ commit() [1/2]

void ScCellValue::commit ( ScColumn rColumn,
SCROW  nRow 
) const

Definition at line 451 of file cellvalue.cxx.

◆ commit() [2/2]

void ScCellValue::commit ( ScDocument rDoc,
const ScAddress rPos 
) const

◆ equalsWithoutFormat()

bool ScCellValue::equalsWithoutFormat ( const ScCellValue r) const

◆ getDouble()

double ScCellValue::getDouble ( ) const
inline

◆ getEditText()

EditTextObject * ScCellValue::getEditText ( ) const
inline

◆ getFormula()

ScFormulaCell * ScCellValue::getFormula ( ) const
inline

◆ getSharedString()

const svl::SharedString * ScCellValue::getSharedString ( ) const
inline

◆ getString()

OUString ScCellValue::getString ( const ScDocument rDoc) const

Definition at line 514 of file cellvalue.cxx.

Referenced by commit(), ScViewFunc::DoThesaurus(), and release().

◆ getType()

CellType ScCellValue::getType ( ) const

◆ isEmpty()

bool ScCellValue::isEmpty ( ) const

◆ operator=() [1/3]

ScCellValue & ScCellValue::operator= ( const ScCellValue r)

Definition at line 529 of file cellvalue.cxx.

References swap().

◆ operator=() [2/3]

ScCellValue & ScCellValue::operator= ( const ScRefCellValue r)

Definition at line 544 of file cellvalue.cxx.

References swap().

◆ operator=() [3/3]

ScCellValue & ScCellValue::operator= ( ScCellValue &&  r)
noexcept

Definition at line 536 of file cellvalue.cxx.

References maData.

◆ release() [1/2]

void ScCellValue::release ( ScColumn rColumn,
SCROW  nRow,
sc::StartListeningType  eListenType = sc::SingleCellListening 
)

◆ release() [2/2]

void ScCellValue::release ( ScDocument rDoc,
const ScAddress rPos 
)

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.

Definition at line 456 of file cellvalue.cxx.

References CELLTYPE_EDIT, CELLTYPE_FORMULA, CELLTYPE_STRING, CELLTYPE_VALUE, getDouble(), getEditText(), getFormula(), getSharedString(), getString(), getType(), reset_to_empty(), ScDocument::SetEditText(), ScDocument::SetEmptyCell(), ScDocument::SetFormulaCell(), ScDocument::SetString(), ScSetStringParam::setTextInput(), and ScDocument::SetValue().

Referenced by ScTable::CopyData(), ScColumn::SetString(), ScUndoEnterData::Undo(), and ScUndoEnterValue::Undo().

◆ releaseEditText()

EditTextObject * ScCellValue::releaseEditText ( )
inline

Definition at line 62 of file cellvalue.hxx.

References maData, and p.

Referenced by ScDocumentImport::setAutoInput().

◆ releaseFormula()

ScFormulaCell * ScCellValue::releaseFormula ( )
inline

Definition at line 63 of file cellvalue.hxx.

References maData, and p.

Referenced by ScDocumentImport::setAutoInput().

◆ reset_to_empty()

void ScCellValue::reset_to_empty ( )
private

Definition at line 280 of file cellvalue.cxx.

References maData, and suppress_fun_call_w_exception.

Referenced by clear(), and release().

◆ set() [1/5]

void ScCellValue::set ( const EditTextObject rEditText)

Definition at line 341 of file cellvalue.cxx.

References clear(), EditTextObject::Clone(), and maData.

◆ set() [2/5]

void ScCellValue::set ( const svl::SharedString rStr)

Definition at line 335 of file cellvalue.cxx.

References clear(), and maData.

◆ set() [3/5]

void ScCellValue::set ( double  fValue)

◆ set() [4/5]

void ScCellValue::set ( ScFormulaCell pFormula)

Definition at line 353 of file cellvalue.cxx.

References clear(), and maData.

◆ set() [5/5]

void ScCellValue::set ( std::unique_ptr< EditTextObject xEditText)

Definition at line 347 of file cellvalue.cxx.

References clear(), and maData.

◆ swap()

void ScCellValue::swap ( ScCellValue r)

Definition at line 551 of file cellvalue.cxx.

References maData.

Referenced by operator=().

Member Data Documentation

◆ maData

std::variant<std::monostate, double, svl::SharedString, EditTextObject*, ScFormulaCell*> ScCellValue::maData
private

std::monostate is there to indicate CellType::NONE

Definition at line 35 of file cellvalue.hxx.

Referenced by assign(), getType(), reset_to_empty(), ScCellValue(), set(), and swap().


The documentation for this struct was generated from the following files: