Spreadsheet::Cell Class Reference

#include <Cell.h>

Public Member Functions

void afterRestore ()
 
 Cell (const App::CellAddress &_address, PropertySheet *_owner)
 Construct a CellContent object. More...
 
 Cell (PropertySheet *_owner, const Cell &other)
 
void clearDirty ()
 
void clearException ()
 
void clearResolveException ()
 
App::CellAddress getAddress () const
 
bool getAlias (std::string &n) const
 
bool getAlignment (int &_alignment) const
 Get alignment. More...
 
bool getBackground (App::Color &color) const
 Get the background color of the cell into color. More...
 
bool getComputedUnit (Base::Unit &unit) const
 Get the computed unit into unit. More...
 
bool getDisplayUnit (DisplayUnit &unit) const
 Get the display unit for the cell into unit. More...
 
const std::string & getException () const
 
const App::ExpressiongetExpression (bool withFormat=false) const
 Get the expression tree. More...
 
bool getForeground (App::Color &color) const
 Get foreground color of the cell. More...
 
std::string getFormattedQuantity (void)
 
bool getSpans (int &rows, int &columns) const
 Get the row and column spans for the cell into rows and columns. More...
 
bool getStringContent (std::string &s, bool persistent=false) const
 Get string content. More...
 
bool getStyle (std::set< std::string > &style) const
 Get the style of the cell. More...
 
bool hasException () const
 
bool isMarked () const
 
bool isUsed () const
 Determine if the any of the contents of the cell is set a non-default value. More...
 
void mark ()
 
void moveAbsolute (App::CellAddress newAddress)
 Move the cell to a new position given by _row and _col. More...
 
Celloperator= (const Cell &rhs)
 
void restore (Base::XMLReader &reader, bool checkAlias=false)
 Restore cell contents from reader. More...
 
void save (Base::Writer &writer) const
 Save cell contents into writer. More...
 
void save (std::ostream &os, const char *indent, bool noContent) const
 
void setAlias (const std::string &n)
 
void setAlignment (int _alignment)
 Set alignment of this cell. More...
 
void setBackground (const App::Color &color)
 Set background color of the cell to color. More...
 
void setComputedUnit (const Base::Unit &unit)
 Set the computed unit for the cell to unit. More...
 
void setContent (const char *value)
 
void setDirty ()
 
void setDisplayUnit (const std::string &unit)
 Set the display unit for the cell. More...
 
void setException (const std::string &e, bool silent=false)
 
void setForeground (const App::Color &color)
 Set foreground (i.e text) color of the cell to color. More...
 
void setResolveException (const std::string &e)
 
void setSpans (int rows, int columns)
 Set the cell's row and column span to rows and columns. More...
 
void setStyle (const std::set< std::string > &_style)
 Set style to the given set _style. More...
 
bool spansChanged () const
 
void visit (App::ExpressionVisitor &v)
 
 ~Cell ()
 Destroy a CellContent object. More...
 

Static Public Member Functions

static int decodeAlignment (const std::string &itemStr, int alignment)
 Decode alignment into its internal value. More...
 
static App::Color decodeColor (const std::string &color, const App::Color &defaultColor)
 Decode a string of the format #rrggbb or #rrggbbaa into a Color. More...
 
static std::string encodeAlignment (int alignment)
 Encode internal alignment value as a string. More...
 
static std::string encodeColor (const App::Color &color)
 Encode color as a #rrggbbaa string. More...
 
static std::string encodeStyle (const std::set< std::string > &style)
 Encode set of styles as a string. More...
 

Static Public Attributes

static const int ALIGNMENT_BOTTOM = 0x40
 
static const int ALIGNMENT_HCENTER = 0x02
 
static const int ALIGNMENT_HIMPLIED = 0x08
 
static const int ALIGNMENT_HORIZONTAL = 0x0f
 
static const int ALIGNMENT_LEFT = 0x01
 
static const int ALIGNMENT_RIGHT = 0x04
 
static const int ALIGNMENT_TOP = 0x10
 
static const int ALIGNMENT_VCENTER = 0x20
 
static const int ALIGNMENT_VERTICAL = 0xf0
 
static const int ALIGNMENT_VIMPLIED = 0x80
 

Friends

class PropertySheet
 

Constructor & Destructor Documentation

◆ Cell() [1/2]

Cell::Cell ( const App::CellAddress _address,
PropertySheet _owner 
)

Construct a CellContent object.

Parameters
_addressThe address of the cell (i.e. row and column)
_ownerThe spreadsheet that owns this cell.

◆ Cell() [2/2]

Cell::Cell ( PropertySheet _owner,
const Cell other 
)

References setAlias(), and setDirty().

◆ ~Cell()

Cell::~Cell ( )

Destroy a CellContent object.

Referenced by decodeAlignment().

Member Function Documentation

◆ afterRestore()

void Cell::afterRestore ( )

References setContent().

◆ clearDirty()

void Cell::clearDirty ( )

◆ clearException()

void Cell::clearException ( )

Referenced by setContent().

◆ clearResolveException()

void Cell::clearResolveException ( )

◆ decodeAlignment()

int Cell::decodeAlignment ( const std::string &  itemStr,
int  alignment 
)
static

Decode alignment into its internal value.

Parameters
itemStrAlignment as a string
alignmentCurrent alignment. This is or'ed with the one in itemStr.
Returns
New alignment.

References ALIGNMENT_BOTTOM, ALIGNMENT_HCENTER, ALIGNMENT_HIMPLIED, ALIGNMENT_HORIZONTAL, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP, ALIGNMENT_VCENTER, ALIGNMENT_VERTICAL, ALIGNMENT_VIMPLIED, and ~Cell().

Referenced by restore().

◆ decodeColor()

App::Color Cell::decodeColor ( const std::string &  color,
const App::Color defaultColor 
)
static

Decode a string of the format #rrggbb or #rrggbbaa into a Color.

Parameters
colorThe color to decode.
defaultColorA default color in case the decoding fails.
Returns
Decoded color.

Referenced by restore().

◆ encodeAlignment()

std::string Cell::encodeAlignment ( int  alignment)
static

Encode internal alignment value as a string.

Parameters
alignmentAlignment as a binary value.
Returns
Alignment represented as a string.

References ALIGNMENT_BOTTOM, ALIGNMENT_HCENTER, ALIGNMENT_HIMPLIED, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, ALIGNMENT_TOP, ALIGNMENT_VCENTER, ALIGNMENT_VERTICAL, and ALIGNMENT_VIMPLIED.

Referenced by save().

◆ encodeColor()

std::string Cell::encodeColor ( const App::Color color)
static

Encode color as a #rrggbbaa string.

Parameters
colorColor to encode.
Returns
String with encoded color.

Referenced by save().

◆ encodeStyle()

std::string Cell::encodeStyle ( const std::set< std::string > &  style)
static

Encode set of styles as a string.

Parameters
styleSet of string describing the style.
Returns
Set encoded as a string.

Referenced by save().

◆ getAddress()

◆ getAlias()

◆ getAlignment()

◆ getBackground()

bool Cell::getBackground ( App::Color color) const

Get the background color of the cell into color.

Returns
true if the background color was previously set.

References isUsed().

Referenced by SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), TechDraw::DrawViewSpreadsheet::getSheetImage(), and SpreadsheetGui::PropertiesDialog::PropertiesDialog().

◆ getComputedUnit()

bool Cell::getComputedUnit ( Base::Unit unit) const

Get the computed unit into unit.

Returns
true if the computed unit was previously set.

References isUsed().

◆ getDisplayUnit()

bool Cell::getDisplayUnit ( DisplayUnit unit) const

Get the display unit for the cell into unit.

Returns
true if the display unit was previously set.

References isUsed().

Referenced by SpreadsheetGui::SheetModel::data(), getFormattedQuantity(), and SpreadsheetGui::PropertiesDialog::PropertiesDialog().

◆ getException()

const std::string & Spreadsheet::Cell::getException ( ) const

◆ getExpression()

const App::Expression * Cell::getExpression ( bool  withFormat = false) const

◆ getForeground()

◆ getFormattedQuantity()

◆ getSpans()

bool Cell::getSpans ( int rows,
int columns 
) const

◆ getStringContent()

bool Cell::getStringContent ( std::string &  s,
bool  persistent = false 
) const

◆ getStyle()

bool Cell::getStyle ( std::set< std::string > &  style) const

◆ hasException()

bool Spreadsheet::Cell::hasException ( ) const

◆ isMarked()

bool Spreadsheet::Cell::isMarked ( ) const

◆ isUsed()

bool Cell::isUsed ( ) const

Determine if the any of the contents of the cell is set a non-default value.

Referenced by SpreadsheetGui::SheetTableView::finishEditWithMove(), getAlias(), getAlignment(), getBackground(), getComputedUnit(), getDisplayUnit(), getForeground(), getSpans(), getStyle(), and save().

◆ mark()

void Spreadsheet::Cell::mark ( )

◆ moveAbsolute()

void Cell::moveAbsolute ( App::CellAddress  newAddress)

Move the cell to a new position given by _row and _col.

◆ operator=()

◆ restore()

◆ save() [1/2]

◆ save() [2/2]

◆ setAlias()

◆ setAlignment()

void Cell::setAlignment ( int  _alignment)

Set alignment of this cell.

Alignment is the or'ed value of vertical and horizontal alignment, given by the constants defined in the class.

References ALIGNMENT_HIMPLIED, ALIGNMENT_LEFT, ALIGNMENT_VCENTER, ALIGNMENT_VIMPLIED, Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().

Referenced by operator=(), restore(), and Spreadsheet::PropertySheet::setAlignment().

◆ setBackground()

void Cell::setBackground ( const App::Color color)

Set background color of the cell to color.

References Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().

Referenced by operator=(), restore(), and Spreadsheet::PropertySheet::setBackground().

◆ setComputedUnit()

void Cell::setComputedUnit ( const Base::Unit unit)

◆ setContent()

◆ setDirty()

◆ setDisplayUnit()

void Cell::setDisplayUnit ( const std::string &  unit)

◆ setException()

void Cell::setException ( const std::string &  e,
bool  silent = false 
)

◆ setForeground()

void Cell::setForeground ( const App::Color color)

Set foreground (i.e text) color of the cell to color.

References Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().

Referenced by operator=(), restore(), and Spreadsheet::PropertySheet::setForeground().

◆ setResolveException()

void Cell::setResolveException ( const std::string &  e)

◆ setSpans()

void Cell::setSpans ( int  rows,
int  columns 
)

Set the cell's row and column span to rows and columns.

This is done when cells are merged.

References Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().

Referenced by operator=(), Spreadsheet::PropertySheet::pasteCells(), restore(), and Spreadsheet::PropertySheet::setSpans().

◆ setStyle()

void Cell::setStyle ( const std::set< std::string > &  _style)

Set style to the given set _style.

References Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().

Referenced by operator=(), restore(), and Spreadsheet::PropertySheet::setStyle().

◆ spansChanged()

bool Spreadsheet::Cell::spansChanged ( ) const

◆ visit()

Friends And Related Function Documentation

◆ PropertySheet

friend class PropertySheet
friend

Member Data Documentation

◆ ALIGNMENT_BOTTOM

const int Cell::ALIGNMENT_BOTTOM = 0x40
static

Referenced by decodeAlignment(), and encodeAlignment().

◆ ALIGNMENT_HCENTER

◆ ALIGNMENT_HIMPLIED

const int Cell::ALIGNMENT_HIMPLIED = 0x08
static

◆ ALIGNMENT_HORIZONTAL

const int Cell::ALIGNMENT_HORIZONTAL = 0x0f
static

Referenced by decodeAlignment().

◆ ALIGNMENT_LEFT

◆ ALIGNMENT_RIGHT

◆ ALIGNMENT_TOP

const int Cell::ALIGNMENT_TOP = 0x10
static

Referenced by decodeAlignment(), and encodeAlignment().

◆ ALIGNMENT_VCENTER

const int Cell::ALIGNMENT_VCENTER = 0x20
static

◆ ALIGNMENT_VERTICAL

const int Cell::ALIGNMENT_VERTICAL = 0xf0
static

Referenced by decodeAlignment(), and encodeAlignment().

◆ ALIGNMENT_VIMPLIED

const int Cell::ALIGNMENT_VIMPLIED = 0x80
static

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