#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::Expression * | getExpression (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... | |
Cell & | operator= (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
-
_address The address of the cell (i.e. row and column) _owner The spreadsheet that owns this cell.
◆ Cell() [2/2]
Cell::Cell | ( | PropertySheet * | _owner, |
const Cell & | other | ||
) |
References setDirty().
◆ ~Cell()
Cell::~Cell | ( | ) |
Destroy a CellContent object.
Referenced by decodeAlignment().
Member Function Documentation
◆ afterRestore()
void Cell::afterRestore | ( | ) |
References setContent().
◆ clearDirty()
void Cell::clearDirty | ( | ) |
References Spreadsheet::PropertySheet::clearDirty().
◆ clearException()
void Cell::clearException | ( | ) |
Referenced by setContent().
◆ clearResolveException()
void Cell::clearResolveException | ( | ) |
◆ decodeAlignment()
|
static |
Decode alignment into its internal value.
- Parameters
-
itemStr Alignment as a string alignment Current 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(), and Spreadsheet::SheetPy::setAlignment().
◆ decodeColor()
|
static |
Decode a string of the format #rrggbb or #rrggbbaa into a Color.
- Parameters
-
color The color to decode. defaultColor A default color in case the decoding fails.
- Returns
- Decoded color.
Referenced by restore().
◆ encodeAlignment()
|
static |
Encode internal alignment value as a string.
- Parameters
-
alignment Alignment 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()
|
static |
Encode color as a #rrggbbaa string.
- Parameters
-
color Color to encode.
- Returns
- String with encoded color.
Referenced by save().
◆ encodeStyle()
|
static |
Encode set of styles as a string.
- Parameters
-
style Set of string describing the style.
- Returns
- Set encoded as a string.
Referenced by save().
◆ getAddress()
App::CellAddress Spreadsheet::Cell::getAddress | ( | ) | const |
Referenced by Spreadsheet::Sheet::getAddressFromAlias(), and getFormattedQuantity().
◆ getAlias()
bool Cell::getAlias | ( | std::string & | n | ) | const |
References isUsed().
Referenced by Spreadsheet::Sheet::clear(), SpreadsheetGui::SheetModel::data(), SpreadsheetGui::SheetView::editingFinished(), Spreadsheet::SheetPy::getAlias(), Spreadsheet::PropertySheet::moveCell(), SpreadsheetGui::PropertiesDialog::PropertiesDialog(), Spreadsheet::PropertySheet::setAlias(), Spreadsheet::Sheet::updateAlias(), and SpreadsheetGui::SheetView::updateAliasLine().
◆ getAlignment()
bool Cell::getAlignment | ( | int & | _alignment | ) | const |
Get alignment.
References isUsed().
Referenced by SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), Spreadsheet::SheetPy::getAlignment(), TechDraw::DrawViewSpreadsheet::getSheetImage(), SpreadsheetGui::PropertiesDialog::PropertiesDialog(), and Spreadsheet::SheetPy::setAlignment().
◆ 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(), Spreadsheet::SheetPy::getBackground(), 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(), Spreadsheet::SheetPy::getDisplayUnit(), getFormattedQuantity(), and SpreadsheetGui::PropertiesDialog::PropertiesDialog().
◆ getException()
const std::string& Spreadsheet::Cell::getException | ( | ) | const |
Referenced by SpreadsheetGui::SheetModel::data().
◆ getExpression()
const App::Expression * Cell::getExpression | ( | bool | withFormat = false | ) | const |
Get the expression tree.
References save().
Referenced by SpreadsheetGui::SheetModel::data(), and Spreadsheet::Sheet::updateProperty().
◆ getForeground()
bool Cell::getForeground | ( | App::Color & | color | ) | const |
Get foreground color of the cell.
References isUsed().
Referenced by SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), Spreadsheet::SheetPy::getForeground(), TechDraw::DrawViewSpreadsheet::getSheetImage(), and SpreadsheetGui::PropertiesDialog::PropertiesDialog().
◆ getFormattedQuantity()
std::string Cell::getFormattedQuantity | ( | void | ) |
References Base::Tools::fromStdString(), getAddress(), Base::Persistence::getClassTypeId(), Base::UnitsApi::getDecimals(), getDisplayUnit(), Spreadsheet::Sheet::getPropertyByName(), App::PropertyQuantity::getUnit(), App::PropertyString::getValue(), Base::BaseClass::isDerivedFrom(), Base::Unit::isEmpty(), Spreadsheet::DisplayUnit::scaler, Spreadsheet::PropertySheet::sheet(), Spreadsheet::DisplayUnit::stringRep, Base::Tools::toStdString(), App::CellAddress::toString(), and Spreadsheet::DisplayUnit::unit.
Referenced by TechDraw::DrawViewSpreadsheet::getSheetImage().
◆ getSpans()
bool Cell::getSpans | ( | int & | rows, |
int & | columns | ||
) | const |
Get the row and column spans for the cell into rows and columns.
References isUsed().
Referenced by Drawing::FeatureViewSpreadsheet::execute(), TechDraw::DrawViewSpreadsheet::getSheetImage(), Spreadsheet::PropertySheet::getSpans(), Spreadsheet::PropertySheet::moveCell(), Spreadsheet::PropertySheet::Restore(), and Spreadsheet::PropertySheet::splitCell().
◆ getStringContent()
Get string content.
Referenced by SpreadsheetGui::SheetModel::data(), Spreadsheet::SheetPy::getContents(), Spreadsheet::Sheet::recomputeCell(), save(), SpreadsheetGui::SheetView::updateContentLine(), and Spreadsheet::Sheet::updateProperty().
◆ getStyle()
bool Cell::getStyle | ( | std::set< std::string > & | style | ) | const |
Get the style of the cell.
References isUsed().
Referenced by SpreadsheetGui::SheetModel::data(), Drawing::FeatureViewSpreadsheet::execute(), TechDraw::DrawViewSpreadsheet::getSheetImage(), Spreadsheet::SheetPy::getStyle(), SpreadsheetGui::PropertiesDialog::PropertiesDialog(), and Spreadsheet::SheetPy::setStyle().
◆ hasException()
bool Spreadsheet::Cell::hasException | ( | ) | const |
Referenced by SpreadsheetGui::SheetModel::data(), and Spreadsheet::Sheet::recomputeCell().
◆ isMarked()
bool Spreadsheet::Cell::isMarked | ( | ) | const |
Referenced by Spreadsheet::PropertySheet::Paste().
◆ isUsed()
bool Cell::isUsed | ( | ) | const |
Determine if the any of the contents of the cell is set a non-default value.
Referenced by 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.
Referenced by Spreadsheet::PropertySheet::moveCell().
◆ operator=()
◆ restore()
void Cell::restore | ( | Base::XMLReader & | reader, |
bool | checkAlias = false |
||
) |
Restore cell contents from reader.
References Spreadsheet::PropertySheet::AtomicPropertyChange, decodeAlignment(), decodeColor(), Base::XMLReader::getAttribute(), Base::XMLReader::hasAttribute(), setAlias(), setAlignment(), setBackground(), setContent(), setDisplayUnit(), setForeground(), setSpans(), and setStyle().
Referenced by Spreadsheet::PropertySheet::Restore().
◆ save() [1/2]
void Cell::save | ( | Base::Writer & | writer | ) | const |
Save cell contents into writer.
References Base::Writer::ind(), and Base::Writer::Stream().
Referenced by getExpression().
◆ save() [2/2]
void Cell::save | ( | std::ostream & | os, |
const char * | indent, | ||
bool | noContent | ||
) | const |
◆ setAlias()
void Cell::setAlias | ( | const std::string & | n | ) |
References Spreadsheet::PropertySheet::AtomicPropertyChange, and setDirty().
Referenced by Spreadsheet::PropertySheet::moveCell(), operator=(), restore(), and Spreadsheet::PropertySheet::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(), Spreadsheet::SheetPy::setAlignment(), 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 | ) |
Set the computed unit for the cell to unit.
References Spreadsheet::PropertySheet::AtomicPropertyChange, Base::Unit::isEmpty(), and setDirty().
Referenced by operator=(), and Spreadsheet::PropertySheet::setComputedUnit().
◆ setContent()
void Cell::setContent | ( | const char * | value | ) |
References Spreadsheet::PropertySheet::AtomicPropertyChange, clearException(), App::Expression::eval(), App::DocumentObject::isRestoring(), App::ExpressionParser::parse(), and Spreadsheet::PropertySheet::sheet().
Referenced by afterRestore(), Spreadsheet::Sheet::recomputeCell(), restore(), and Spreadsheet::PropertySheet::setContent().
◆ setDirty()
void Cell::setDirty | ( | ) |
References Spreadsheet::PropertySheet::setDirty().
Referenced by Cell(), operator=(), setAlias(), setAlignment(), setBackground(), setComputedUnit(), setDisplayUnit(), setForeground(), setSpans(), and setStyle().
◆ setDisplayUnit()
void Cell::setDisplayUnit | ( | const std::string & | unit | ) |
Set the display unit for the cell.
References Spreadsheet::PropertySheet::AtomicPropertyChange, Spreadsheet::DisplayUnit::isEmpty(), setDirty(), and Spreadsheet::PropertySheet::sheet().
Referenced by operator=(), restore(), and Spreadsheet::PropertySheet::setDisplayUnit().
◆ setException()
void Cell::setException | ( | const std::string & | e, |
bool | silent = false |
||
) |
References App::DocumentObject::getFullName(), and Spreadsheet::PropertySheet::sheet().
Referenced by Spreadsheet::Sheet::execute(), and Spreadsheet::Sheet::recomputeCell().
◆ 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 | ) |
References App::DocumentObject::getFullName(), and Spreadsheet::PropertySheet::sheet().
Referenced by Spreadsheet::PropertySheet::invalidateDependants().
◆ 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 Spreadsheet::PropertySheet::moveCell(), 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 |
Referenced by Spreadsheet::Sheet::recomputeCell().
◆ visit()
void Cell::visit | ( | App::ExpressionVisitor & | v | ) |
Friends And Related Function Documentation
◆ PropertySheet
|
friend |
Member Data Documentation
◆ ALIGNMENT_BOTTOM
|
static |
Referenced by decodeAlignment(), encodeAlignment(), and Spreadsheet::SheetPy::getAlignment().
◆ ALIGNMENT_HCENTER
|
static |
◆ ALIGNMENT_HIMPLIED
|
static |
Referenced by decodeAlignment(), encodeAlignment(), and setAlignment().
◆ ALIGNMENT_HORIZONTAL
|
static |
Referenced by decodeAlignment(), and Spreadsheet::SheetPy::setAlignment().
◆ ALIGNMENT_LEFT
|
static |
◆ ALIGNMENT_RIGHT
|
static |
◆ ALIGNMENT_TOP
|
static |
Referenced by decodeAlignment(), encodeAlignment(), and Spreadsheet::SheetPy::getAlignment().
◆ ALIGNMENT_VCENTER
|
static |
Referenced by decodeAlignment(), encodeAlignment(), Spreadsheet::SheetPy::getAlignment(), and setAlignment().
◆ ALIGNMENT_VERTICAL
|
static |
Referenced by decodeAlignment(), encodeAlignment(), and Spreadsheet::SheetPy::setAlignment().
◆ ALIGNMENT_VIMPLIED
|
static |
Referenced by decodeAlignment(), encodeAlignment(), and setAlignment().
The documentation for this class was generated from the following files:
- src/Mod/Spreadsheet/App/Cell.h
- src/Mod/Spreadsheet/App/Cell.cpp