kspread
KSpread::Cell Class Reference
An accessor to the actual cell data.
More...
#include <Cell.h>
List of all members.
Public Member Functions |
| | Cell (const Cell &other) |
| | Cell (const Sheet *sheet, const QPoint &pos) |
| | Cell (const Sheet *sheet, int column, int row) |
| | Cell () |
| | ~Cell () |
| QPoint | cellPosition () const |
| int | column () const |
| QString | columnName () const |
| QString | comment () const |
| bool | compareData (const Cell &other) const |
| Conditions | conditions () const |
| void | copyAll (const Cell &cell) |
| void | copyContent (const Cell &cell) |
| void | copyFormat (const Cell &cell) |
| Database | database () const |
| QString | decodeFormula (const QString &text) const |
| QString | displayText () const |
| bool | doesMergeCells () const |
| int | effectiveAlignX () const |
| Style | effectiveStyle () const |
| QString | encodeFormula (bool fixedReferences=false) const |
| Formula | formula () const |
| QString | fullName () const |
| double | height () const |
| bool | isDate () const |
| bool | isDefault () const |
| bool | isEmpty () const |
| bool | isFormula () const |
| bool | isLocked () const |
| bool | isNull () const |
| bool | isPartOfMerged () const |
| bool | isText () const |
| bool | isTime () const |
| QString | link () const |
| bool | load (const KoXmlElement &cell, int _xshift, int _yshift, Paste::Mode pm=Paste::Normal, Paste::Operation op=Paste::OverWrite, bool paste=false) |
| bool | loadOdf (const KoXmlElement &element, OdfLoadingContext &tableContext) |
| KLocale * | locale () const |
| QRect | lockedCells () const |
| bool | makeFormula () |
| Cell | masterCell () const |
| void | mergeCells (int _col, int _row, int _x, int _y) |
| int | mergedXCells () const |
| int | mergedYCells () const |
| QString | name () const |
| bool | needsPrinting () const |
| bool | operator! () const |
| bool | operator< (const Cell &other) const |
| Cell & | operator= (const Cell &other) |
| bool | operator== (const Cell &other) const |
| void | parseUserInput (const QString &text) |
| QString | pasteOperation (const QString &new_text, const QString &old_text, Paste::Operation op) |
| int | row () const |
| QDomElement | save (QDomDocument &doc, int xOffset=0, int yOffset=0, bool era=false) |
| bool | saveOdf (KoXmlWriter &xmlwriter, KoGenStyles &mainStyles, int row, int column, int &repeated, OdfSavingContext &savingContext) |
| void | setComment (const QString &comment) |
| void | setConditions (const Conditions &conditions) |
| void | setFormula (const Formula &formula) |
| void | setLink (const QString &link) |
| void | setStyle (const Style &style) |
| void | setUserInput (const QString &text) |
| void | setValidity (Validity validity) |
| void | setValue (const Value &value) |
| Sheet * | sheet () const |
| Style | style () const |
| QDate | toDate (const KoXmlElement &element) |
| QTime | toTime (const KoXmlElement &element) |
| QString | userInput () const |
| Validity | validity () const |
| const Value | value () const |
| double | width () const |
Static Public Member Functions |
| static QString | columnName (uint column) |
| static QString | fullName (const Sheet *s, int col, int row) |
| static QString | name (int col, int row) |
Protected Member Functions |
| void | loadOdfCellText (const KoXmlElement &parent) |
| void | loadOdfObjects (const KoXmlElement &e, KoOdfLoadingContext &odfContext) |
| void | saveOdfAnnotation (KoXmlWriter &xmlwriter) |
Detailed Description
An accessor to the actual cell data.
The Cell object acts as accessor to the actual data stored in the separate storages in CellStorage. It provides methods to alter and retrieve this data and methods related to loading and saving the contents.
Definition at line 74 of file Cell.h.
Constructor & Destructor Documentation
Constructor.
Creates the null cell.
- Note:
- Accessing the sheet(), column() or row() methods or any related method, that makes use of the former, will fail.
Definition at line 101 of file Cell.cpp.
| Cell::Cell |
( |
const Sheet * |
sheet, |
|
|
int |
column, |
|
|
int |
row | |
|
) |
| | |
Constructor.
Creates a Cell for accessing the data in sheet at position col , row .
Definition at line 106 of file Cell.cpp.
Constructor.
Creates a Cell for accessing the data in sheet at position pos .
Definition at line 117 of file Cell.cpp.
| Cell::Cell |
( |
const Cell & |
other |
) |
|
Copy constructor.
Definition at line 128 of file Cell.cpp.
Member Function Documentation
| QPoint Cell::cellPosition |
( |
|
) |
const |
- Returns:
- the position of this cell
Definition at line 2338 of file Cell.cpp.
| int Cell::column |
( |
|
) |
const |
Returns the cell's column.
Definition at line 196 of file Cell.cpp.
| QString Cell::columnName |
( |
uint |
column |
) |
[static] |
Given the column number, this static function returns the corresponding column name, i.e.
the first column is "A", the second is "B", and so on.
Definition at line 259 of file Cell.cpp.
Returns the column name of the cell.
Definition at line 251 of file Cell.cpp.
- Returns:
- the comment associated with this cell
Definition at line 279 of file Cell.cpp.
| bool Cell::compareData |
( |
const Cell & |
other |
) |
const |
Tests for equality of all cell attributes/data to those in other .
Definition at line 2315 of file Cell.cpp.
- Returns:
- the conditions associated with this cell
Definition at line 289 of file Cell.cpp.
| void Cell::copyAll |
( |
const Cell & |
cell |
) |
|
| void Cell::copyContent |
( |
const Cell & |
cell |
) |
|
Copies the content from cell .
- See also:
- copyAll(Cell *cell)
Definition at line 446 of file Cell.cpp.
| void Cell::copyFormat |
( |
const Cell & |
cell |
) |
|
Copies the format from cell .
- See also:
- copyAll(Cell *cell)
Definition at line 421 of file Cell.cpp.
- Returns:
- the database associated with this cell
Definition at line 299 of file Cell.cpp.
| QString Cell::displayText |
( |
|
) |
const |
- Returns:
- the output text, e.g. the result of a formula
Definition at line 383 of file Cell.cpp.
| bool Cell::doesMergeCells |
( |
|
) |
const |
- Returns:
- true if the cell is forced to obscure other cells.
Definition at line 889 of file Cell.cpp.
| int Cell::effectiveAlignX |
( |
|
) |
const |
returns horizontal alignment, depending on style and value type
Definition at line 714 of file Cell.cpp.
| Style Cell::effectiveStyle |
( |
|
) |
const |
The effective style takes conditional style attributes into account.
- Returns:
- the effective Style associated with this Cell
Definition at line 319 of file Cell.cpp.
| QString Cell::encodeFormula |
( |
bool |
fixedReferences = false |
) |
const |
Encodes the cell's formula into a text representation.
- Parameters:
-
| fixedReferences | encode relative references absolutely (this is used for copying a cell to make the paste operation create a formula that points to the original cells, not the cells at the same relative position) |
- See also:
- decodeFormula()
Definition at line 509 of file Cell.cpp.
The cell's formula.
Usable to analyze the formula's tokens.
- Returns:
- pointer to the cell's formula object
Definition at line 304 of file Cell.cpp.
| QString Cell::fullName |
( |
const Sheet * |
s, |
|
|
int |
col, |
|
|
int |
row | |
|
) |
| | [static] |
Given the sheet and cell position, this static function returns the full name of the cell, i.e.
with the name of the sheet.
Definition at line 244 of file Cell.cpp.
Returns the full name of the cell, i.e.
including the worksheet name. Example: "Sheet1!A1"
Definition at line 236 of file Cell.cpp.
| double Cell::height |
( |
|
) |
const |
- Returns:
- the height of this cell as double
Definition at line 745 of file Cell.cpp.
| bool Cell::isDate |
( |
|
) |
const |
returns true, if cell format is of date type or content is a date
Definition at line 851 of file Cell.cpp.
| bool Cell::isDefault |
( |
|
) |
const |
Returns true, if this is a default cell, i.e.
if the cell has no value, formula, link and does not merge any other cells.
Definition at line 150 of file Cell.cpp.
| bool Cell::isEmpty |
( |
|
) |
const |
Returns true, if this cell has no content, i.e no value and no formula.
Definition at line 172 of file Cell.cpp.
| bool Cell::isFormula |
( |
|
) |
const |
Returns true if this cell holds a formula.
Definition at line 189 of file Cell.cpp.
| bool Cell::isLocked |
( |
|
) |
const |
| bool Cell::isNull |
( |
|
) |
const |
Returns true if this cell is the null cell.
Definition at line 182 of file Cell.cpp.
| bool Cell::isPartOfMerged |
( |
|
) |
const |
If this cell is part of a merged cell, then the marker may never reside on this cell.
- Returns:
- true if another cell has this one merged into itself.
Definition at line 872 of file Cell.cpp.
| bool Cell::isText |
( |
|
) |
const |
returns true, if cell format is of text type
Definition at line 863 of file Cell.cpp.
| bool Cell::isTime |
( |
|
) |
const |
returns true, if cell format is of time type or content is a time
Definition at line 857 of file Cell.cpp.
Returns the link associated with cell.
It is empty if this cell contains no link.
Definition at line 838 of file Cell.cpp.
Returns the locale setting of this cell.
Definition at line 144 of file Cell.cpp.
| QRect Cell::lockedCells |
( |
|
) |
const |
| bool Cell::makeFormula |
( |
|
) |
|
Parses the formula.
- Returns:
false on error.
Definition at line 692 of file Cell.cpp.
| Cell Cell::masterCell |
( |
|
) |
const |
- Returns:
- the merging cell (might be this cell)
Definition at line 877 of file Cell.cpp.
| void Cell::mergeCells |
( |
int |
_col, |
|
|
int |
_row, |
|
|
int |
_x, |
|
|
int |
_y | |
|
) |
| | |
Merge a number of cells, i.e.
force the cell to occupy other cells space. If '_x' and '_y' are 0 then the merging is disabled.
- Parameters:
-
| _col | is the column this cell is assumed to be in. |
| _row | is the row this cell is assumed to be in. |
| _x | tells to occupy _x additional cells in the horizontal |
| _y | tells to occupy _y additional cells in the vertical |
Definition at line 884 of file Cell.cpp.
| int Cell::mergedXCells |
( |
|
) |
const |
- Returns:
- the number of obscured cells in the horizontal direction as a result of cell merging (forced obscuring)
Definition at line 894 of file Cell.cpp.
| int Cell::mergedYCells |
( |
|
) |
const |
- Returns:
- the number of obscured cells in the vertical direction as a result of cell merging (forced obscuring)
Definition at line 899 of file Cell.cpp.
| QString Cell::name |
( |
int |
col, |
|
|
int |
row | |
|
) |
| | [static] |
Given the cell position, this static function returns the name of the cell.
Example: name(5,4) will return "E4".
Definition at line 228 of file Cell.cpp.
Returns the name of the cell.
For example, the cell in first column and first row is "A1".
Definition at line 220 of file Cell.cpp.
| bool Cell::needsPrinting |
( |
|
) |
const |
- Returns:
- true if the cell should be printed in a print out. That's the case, if it has any content, border, backgroundcolor, or background brush.
- See also:
- Sheet::print
Definition at line 467 of file Cell.cpp.
| bool Cell::operator! |
( |
|
) |
const |
| bool Cell::operator< |
( |
const Cell & |
other |
) |
const |
Tests whether this cell's location is less than the other 's.
(QMap support)
- Note:
- Does not compare the cell attributes/data.
Definition at line 2296 of file Cell.cpp.
| Cell & Cell::operator= |
( |
const Cell & |
other |
) |
|
| bool Cell::operator== |
( |
const Cell & |
other |
) |
const |
Tests for equality with other 's location only.
(QHash support)
- Note:
- Does not compare the cell attributes/data.
Definition at line 2305 of file Cell.cpp.
| void Cell::parseUserInput |
( |
const QString & |
text |
) |
|
Sets the user input and parses it.
If text is a formula, creates a formula object and sets text as its expression. Otherwise, parses text, creates an appropriate value, including the proper type, validates the value and, if accepted, stores text as the user input and the value as the cell's value.
- See also:
- setUserInput, setValue
Definition at line 755 of file Cell.cpp.
Merges the new_text with old_text during a paste operation.
If both texts represent doubles, then the operation is performed on both values and the result is returned. If both texts represents a formula or one a formula and the other a double value, then a formula is returned. In all other cases new_text is returned.
- Returns:
- the merged text.
Definition at line 2197 of file Cell.cpp.
Returns the cell's row.
Definition at line 207 of file Cell.cpp.
| void Cell::setComment |
( |
const QString & |
comment |
) |
|
| void Cell::setConditions |
( |
const Conditions & |
conditions |
) |
|
| void Cell::setFormula |
( |
const Formula & |
formula |
) |
|
Sets formula as associated formula of this cell.
Definition at line 309 of file Cell.cpp.
| void Cell::setLink |
( |
const QString & |
link |
) |
|
Sets a link for this cell.
For example, setLink( "mailto:joe@somewhere.com" ) will open a new e-mail if this cell is clicked. Possible choices for link are URL (web, ftp), e-mail address, local file, or another cell.
Definition at line 843 of file Cell.cpp.
| void Cell::setStyle |
( |
const Style & |
style |
) |
|
| void Cell::setUserInput |
( |
const QString & |
text |
) |
|
Sets the user input without parsing it.
If text is a formula, creates a formula object and sets text as its expression. Otherwise, simply stores text as user input.
- See also:
- parseUserInput, setValue
Definition at line 358 of file Cell.cpp.
| void Cell::setValidity |
( |
Validity |
validity |
) |
|
| void Cell::setValue |
( |
const Value & |
value |
) |
|
Sets the value for this cell.
It also clears all errors, if the value itself is not an error. In addition to this, it calculates the outstring and sets the dirty flags so that a redraw is forced.
- Parameters:
-
- See also:
- setUserInput, parseUserInput
Definition at line 413 of file Cell.cpp.
| Sheet * Cell::sheet |
( |
|
) |
const |
- Returns:
- the sheet this cell belongs to
Definition at line 138 of file Cell.cpp.
| Style Cell::style |
( |
|
) |
const |
Return the text the user entered.
This could be a value (e.g. "14.03") or a formula (e.g. "=SUM(A1:A10)")
Definition at line 350 of file Cell.cpp.
- Returns:
- the validity checks associated with this cell
Definition at line 333 of file Cell.cpp.
| const Value Cell::value |
( |
|
) |
const |
Returns the value that this cell holds.
It could be from the user (i.e. when s/he enters a value) or a result of formula.
Definition at line 405 of file Cell.cpp.
| double Cell::width |
( |
|
) |
const |
- Returns:
- the width of this cell as double
Definition at line 736 of file Cell.cpp.
The documentation for this class was generated from the following files:
|