kspread

#include <kspread_cell.h>

Public Types

enum  BorderSides {
  Border_None =0x00 , Border_Left =0x01 , Border_Right =0x02 , Border_Top =0x04 ,
  Border_Bottom =0x08 , Border_SizeGrip =0x10
}
enum  CellFlags {
  Flag_LayoutDirty = 0x00010000 , Flag_CalcDirty = 0x00020000 , Flag_Progress = 0x00040000 , Flag_UpdatingDeps = 0x00080000 ,
  Flag_DisplayDirty = 0x00100000 , Flag_Merged = 0x00200000 , Flag_CellTooShortX = 0x00400000 , Flag_CellTooShortY = 0x00800000 ,
  Flag_ParseError = 0x01000000 , Flag_CircularCalculation = 0x02000000 , Flag_DependancyError = 0x04000000 , Flag_PaintingCell = 0x08000000 ,
  Flag_TextFormatDirty = 0x10000000
}

Public Member Functions

 Cell (Sheet *_sheet, int _column, int _row)
 Cell (Sheet *_sheet, Style *_style, int _column, int _row)
 ~Cell ()
Sheet * sheet () const
bool isDefault () const
bool isEmpty () const
int column () const
int row () const
TQString name () const
TQString fullName () const
TQString columnName () const
TDELocale * locale () const
bool isFormula () const
TQString text () const
TQString strOutText () const
Formula * formula () const
Format * format () const
const Value value () const
void setValue (const Value &value)
void setCellValue (const Value &value, FormatType fmtType=No_format, const TQString &inputText=TQString())
Cell * previousCell () const
Cell * nextCell () const
void setPreviousCell (Cell *c)
void setNextCell (Cell *c)
void move (int column, int row)
void sheetDies ()
TQDomElement save (TQDomDocument &doc, int _x_offset=0, int _y_offset=0, bool force=false, bool copy=false, bool era=false)
bool saveOasis (KoXmlWriter &xmlwriter, KoGenStyles &mainStyles, int row, int column, int &repeated, GenValidationStyles &valStyle)
void saveOasisValue (KoXmlWriter &xmlWriter)
TQString saveOasisCellStyle (KoGenStyle &currentCellStyle, KoGenStyles &mainStyles)
bool load (const TQDomElement &cell, int _xshift, int _yshift, Paste::Mode pm=Paste::Normal, Paste::Operation op=Paste::OverWrite, bool paste=false)
bool loadOasis (const TQDomElement &element, KoOasisLoadingContext &oasisContext, Style *style)
TQTime toTime (const TQDomElement &element)
TQDate toDate (const TQDomElement &element)
void copyFormat (const int column, const int row)
void copyFormat (const Cell *cell)
void copyContent (const Cell *cell)
void copyAll (Cell *cell)
void paintCell (const KoRect &rect, TQPainter &painter, View *view, const KoPoint &coordinate, const TQPoint &cellRef, int paintBorder, TQPen &rightPen, TQPen &bottomPen, TQPen &leftPen, TQPen &topPen, TQValueList< TQPoint > &mergedCellsPainted, bool drawCursor=true)
int width (int _col=-1, const Canvas *_canvas=0L) const
int height (int _row=-1, const Canvas *_canvas=0L) const
double dblWidth (int _col=-1, const Canvas *_canvas=0L) const
double dblHeight (int _row=-1, const Canvas *_canvas=0L) const
TQRect cellRect ()
bool needsPrinting () const
void incPrecision ()
void decPrecision ()
void setCellText (const TQString &_text, bool asString=false)
void setDisplayText (const TQString &_text)
void setLink (const TQString &link)
TQString link () const
const TQPen & effLeftBorderPen (int col, int row) const
const TQPen & effTopBorderPen (int col, int row) const
const TQPen & effRightBorderPen (int col, int row) const
const TQPen & effBottomBorderPen (int col, int row) const
const TQPen & effGoUpDiagonalPen (int col, int row) const
const TQPen & effFallDiagonalPen (int col, int row) const
const TQColor & effTextColor (int col, int row) const
uint effBottomBorderValue (int col, int row) const
uint effRightBorderValue (int col, int row) const
uint effLeftBorderValue (int col, int row) const
uint effTopBorderValue (int col, int row) const
const TQPen & leftBorderPen (int col, int row) const
const TQPen & topBorderPen (int col, int row) const
const TQPen & rightBorderPen (int col, int row) const
const TQPen & bottomBorderPen (int col, int row) const
const TQColor & bgColor (int col, int row) const
const TQBrush & backGroundBrush (int col, int row) const
void setLeftBorderPen (const TQPen &p)
void setTopBorderPen (const TQPen &p)
void setRightBorderPen (const TQPen &p)
void setBottomBorderPen (const TQPen &p)
FormatType formatType () const
bool isDate () const
bool isTime () const
void setNumber (double number)
double getDouble ()
void convertToDouble ()
void convertToPercent ()
void convertToMoney ()
void convertToTime ()
void convertToDate ()
double textWidth () const
double textHeight () const
bool updateChart (bool refresh=true)
TQString testAnchor (int _x, int _y) const
bool calc (bool delay=true)
void setCalcDirtyFlag ()
bool calcDirtyFlag ()
void NotifyDepending (int col, int row, Sheet *sheet, bool isDepending)
void setLayoutDirtyFlag (bool format=false)
bool layoutDirtyFlag () const
void clearDisplayDirtyFlag ()
void setDisplayDirtyFlag ()
void obscure (Cell *cell, bool isForcing=false)
void unobscure (Cell *cell)
bool isObscured () const
bool isPartOfMerged () const
Cell * ultimateObscuringCell () const
TQValueList< Cell * > obscuringCells () const
void clearObscuringCells ()
void mergeCells (int _col, int _row, int _x, int _y)
bool doesMergeCells () const
int mergedXCells () const
int mergedYCells () const
int extraXCells () const
int extraYCells () const
double extraWidth () const
double extraHeight () const
TQString encodeFormula (bool _era=false, int _col=-1, int _row=-1) const
TQString decodeFormula (const TQString &_text, int _col=-1, int _row=-1) const
TQString pasteOperation (const TQString &new_text, const TQString &old_text, Paste::Operation op)
bool hasError () const
void clearAllErrors ()
void makeLayout (TQPainter &_painter, int _col, int _row)
bool makeFormula ()
void defaultStyle ()
TQValueList< Conditional > conditionList () const
void setConditionList (const TQValueList< Conditional > &newList)
Validity * getValidity (int newStruct=-1)
void removeValidity ()
bool testValidity () const
void calculateTextParameters (TQPainter &painter, int _col, int _row)
int defineAlignX ()
bool operator> (const Cell &) const
bool operator< (const Cell &) const
bool operator== (const Cell &other) const
bool operator!= (const Cell &other) const
void freeAllObscuredCells ()
void clearFlag (CellFlags flag)
void setFlag (CellFlags flag)
bool testFlag (CellFlags flag) const

Static Public Member Functions

static TQString name (int col, int row)
static TQString fullName (const Sheet *s, int col, int row)
static TQString columnName (uint column)

Protected Member Functions

void applyZoomedFont (TQPainter &painter, int _col, int _row)
void textSize (TQPainter &_paint)
TQString textDisplaying (TQPainter &painter)
void clearFormula ()
void checkTextInput ()
void checkNumberFormat ()
void loadOasisCellText (const TQDomElement &parent)
void loadOasisObjects (const TQDomElement &e, KoOasisLoadingContext &oasisContext)
void loadOasisValidation (const TQString &validationName)
void loadOasisValidationCondition (TQString &valExpression)
void saveOasisAnnotation (KoXmlWriter &xmlwriter)
void loadOasisConditional (TQDomElement *style)

Friends

class Conditions

Detailed Description

For every cell in the spread sheet there is a Cell object.

Cell contains format information and algorithm and it contains the calculation algorithm.

However, all empty cells are represented by one instace, called the default cell. isDefault can be used to determine whether or not a Cell object represents the default one.

Definition at line 137 of file kspread_cell.h.

Member Enumeration Documentation

◆ BorderSides

enum KSpread::Cell::BorderSides

Definition at line 343 of file kspread_cell.h.

◆ CellFlags

enum KSpread::Cell::CellFlags

Definition at line 871 of file kspread_cell.h.

Constructor & Destructor Documentation

◆ Cell() [1/2]

Cell::Cell ( Sheet * _sheet,
int _column,
int _row )

Definition at line 294 of file kspread_cell.cpp.

◆ Cell() [2/2]

Cell::Cell ( Sheet * _sheet,
Style * _style,
int _column,
int _row )

Definition at line 305 of file kspread_cell.cpp.

◆ ~Cell()

Cell::~Cell ( )
See also
sheetDies

Definition at line 7077 of file kspread_cell.cpp.

Member Function Documentation

◆ applyZoomedFont()

void Cell::applyZoomedFont ( TQPainter & painter,
int _col,
int _row )
protected

Applies the font to use to painter.

Definition at line 1966 of file kspread_cell.cpp.

◆ backGroundBrush()

const TQBrush & Cell::backGroundBrush ( int col,
int row ) const
See also
Format::backGroundBrush

Definition at line 4251 of file kspread_cell.cpp.

◆ bgColor()

const TQColor & Cell::bgColor ( int col,
int row ) const
See also
Format::bgColor

Definition at line 4262 of file kspread_cell.cpp.

◆ bottomBorderPen()

const TQPen & Cell::bottomBorderPen ( int col,
int row ) const
See also
Format::bottomBorderPen

Definition at line 4355 of file kspread_cell.cpp.

◆ calc()

bool Cell::calc ( bool delay = true)

Starts calculating.

Parameters
delaytrue if you want to check for delay condition in doc() false if you really have to calculate the value right now e.g. if you sort with formula as key
Returns
true on success and false on error.

Definition at line 2077 of file kspread_cell.cpp.

◆ calcDirtyFlag()

bool Cell::calcDirtyFlag ( )

Checks the calcDirtyFlag.

Definition at line 7262 of file kspread_cell.cpp.

◆ calculateTextParameters()

void Cell::calculateTextParameters ( TQPainter & painter,
int _col,
int _row )

Calculates the text parameters stored in cell Applies font to use to painter.

Definition at line 2023 of file kspread_cell.cpp.

◆ cellRect()

TQRect Cell::cellRect ( )
Returns
a TQRect for this cell (i.e., a 1x1 rect).
See also
zoomedCellRect

Definition at line 7222 of file kspread_cell.cpp.

◆ checkNumberFormat()

void Cell::checkNumberFormat ( )
protected

Automatically chooses between a number format and a scientific format (if the number is too big).

Definition at line 5137 of file kspread_cell.cpp.

◆ checkTextInput()

void Cell::checkTextInput ( )
protected

Check the input from the user, and determine the contents of the cell accordingly (in particular the data type).

This is to be called only when m_content == Text.

Input: m_strText Output: m_dataType

Definition at line 5110 of file kspread_cell.cpp.

◆ clearAllErrors()

void Cell::clearAllErrors ( )

Clear all error flags from the cell.

Definition at line 7255 of file kspread_cell.cpp.

◆ clearDisplayDirtyFlag()

void Cell::clearDisplayDirtyFlag ( )

Definition at line 7272 of file kspread_cell.cpp.

◆ clearFlag()

void Cell::clearFlag ( CellFlags flag)

Definition at line 7287 of file kspread_cell.cpp.

◆ clearFormula()

void Cell::clearFormula ( )
protected

Cleans up formula stuff.

Call this before you store a new formula or to delete the formula.

Definition at line 2071 of file kspread_cell.cpp.

◆ clearObscuringCells()

void Cell::clearObscuringCells ( )

Definition at line 918 of file kspread_cell.cpp.

◆ column()

int Cell::column ( ) const

Returns the cell's column.

This could be 0 if the cell is the default cell.

Definition at line 352 of file kspread_cell.cpp.

◆ columnName() [1/2]

TQString Cell::columnName ( ) const

Returns the column name of the cell.

Definition at line 402 of file kspread_cell.cpp.

◆ columnName() [2/2]

TQString 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 414 of file kspread_cell.cpp.

◆ conditionList()

TQValueList< Conditional > Cell::conditionList ( ) const

Gets a copy of the list of current conditions.

Definition at line 7228 of file kspread_cell.cpp.

◆ convertToDate()

void Cell::convertToDate ( )

converts content to date format

Definition at line 5092 of file kspread_cell.cpp.

◆ convertToDouble()

void Cell::convertToDouble ( )

converts content to double format

Definition at line 5049 of file kspread_cell.cpp.

◆ convertToMoney()

void Cell::convertToMoney ( )

converts content to money format

Definition at line 5066 of file kspread_cell.cpp.

◆ convertToPercent()

void Cell::convertToPercent ( )

converts content to percentageformat

Definition at line 5057 of file kspread_cell.cpp.

◆ convertToTime()

void Cell::convertToTime ( )

converts content to time format

Definition at line 5076 of file kspread_cell.cpp.

◆ copyAll()

void Cell::copyAll ( Cell * cell)

Copies the format and the content.

It does not copy the #m_row and #m_column attributes. Besides that all persistent attributes are copied. setCellText is called to set the real content.

See also
copyFormat

Definition at line 632 of file kspread_cell.cpp.

◆ copyContent()

void Cell::copyContent ( const Cell * cell)

Definition at line 639 of file kspread_cell.cpp.

◆ copyFormat() [1/2]

void Cell::copyFormat ( const Cell * cell)

A convenience function.

See also
copyAll

Definition at line 582 of file kspread_cell.cpp.

◆ copyFormat() [2/2]

void Cell::copyFormat ( const int column,
const int row )

Copyies the format from the cell at the position (_column|_row).

See also
copyAll

Definition at line 575 of file kspread_cell.cpp.

◆ dblHeight()

double Cell::dblHeight ( int _row = -1,
const Canvas * _canvas = 0L ) const
Parameters
_rowthe row this cell is assumed to be in.
_canvasthe canvas this cell is assumed to be in.
Returns
the height of this cell as double

Definition at line 4218 of file kspread_cell.cpp.

◆ dblWidth()

double Cell::dblWidth ( int _col = -1,
const Canvas * _canvas = 0L ) const
Parameters
_canvasthe canvas this cell is assumed to be in.
_colthe column this cell is assumed to be in. This parameter defaults to the return value of column.
Returns
the width of this cell as double

Definition at line 4192 of file kspread_cell.cpp.

◆ decodeFormula()

TQString Cell::decodeFormula ( const TQString & _text,
int _col = -1,
int _row = -1 ) const

Definition at line 1086 of file kspread_cell.cpp.

◆ decPrecision()

void Cell::decPrecision ( )

Decreases the precison of the value displayed.

Precision means here the amount of digits behind the dot. If the current precision is the default of -1, then it is set to the number of digits behind the dot minus 1.

Definition at line 4575 of file kspread_cell.cpp.

◆ defaultStyle()

void Cell::defaultStyle ( )

Definition at line 655 of file kspread_cell.cpp.

◆ defineAlignX()

int Cell::defineAlignX ( )

return align X when align is undefined

Definition at line 4027 of file kspread_cell.cpp.

◆ doesMergeCells()

bool Cell::doesMergeCells ( ) const
Returns
true if the cell is forced to obscure other cells.

Definition at line 7282 of file kspread_cell.cpp.

◆ effBottomBorderPen()

const TQPen & Cell::effBottomBorderPen ( int col,
int row ) const
Returns
effective pen for the bottom border
See also
effLeftBorderPen

Definition at line 4437 of file kspread_cell.cpp.

◆ effBottomBorderValue()

uint Cell::effBottomBorderValue ( int col,
int row ) const
Returns
"worth" of the effective bottom border pen
See also
Style::calculateValue
effLeftBorderPen

Definition at line 4473 of file kspread_cell.cpp.

◆ effFallDiagonalPen()

const TQPen & Cell::effFallDiagonalPen ( int col,
int row ) const
Returns
effective pen for the go up diagonal border
See also
effGoUpDiagonalPen

Definition at line 4463 of file kspread_cell.cpp.

◆ effGoUpDiagonalPen()

const TQPen & Cell::effGoUpDiagonalPen ( int col,
int row ) const
Returns
effective pen for the go up diagonal border If this cell's conditional formatting contains a go up diagonal pen and the condition is matched, the conditional formatting's pen. Otherwise, its own go up diagonal pen.

Definition at line 4453 of file kspread_cell.cpp.

◆ effLeftBorderPen()

const TQPen & Cell::effLeftBorderPen ( int col,
int row ) const
Returns
effective pen for the left border If this cell is merged by another cell, the other cell's left border pen. If this cell's conditional formatting contains a left border pen and the condition is matched, the conditional formatting's pen. Otherwise, its own left border pen.

Definition at line 4389 of file kspread_cell.cpp.

◆ effLeftBorderValue()

uint Cell::effLeftBorderValue ( int col,
int row ) const
Returns
"worth" of the effective left border pen
See also
Style::calculateValue
effLeftBorderPen

Definition at line 4503 of file kspread_cell.cpp.

◆ effRightBorderPen()

const TQPen & Cell::effRightBorderPen ( int col,
int row ) const
Returns
effective pen for the right border
See also
effLeftBorderPen

Definition at line 4421 of file kspread_cell.cpp.

◆ effRightBorderValue()

uint Cell::effRightBorderValue ( int col,
int row ) const
Returns
"worth" of the effective right border pen
See also
Style::calculateValue
effLeftBorderPen

Definition at line 4488 of file kspread_cell.cpp.

◆ effTextColor()

const TQColor & Cell::effTextColor ( int col,
int row ) const

Definition at line 4379 of file kspread_cell.cpp.

◆ effTopBorderPen()

const TQPen & Cell::effTopBorderPen ( int col,
int row ) const
Returns
effective pen for the top border
See also
effLeftBorderPen

Definition at line 4405 of file kspread_cell.cpp.

◆ effTopBorderValue()

uint Cell::effTopBorderValue ( int col,
int row ) const
Returns
"worth" of the effective top border pen
See also
Style::calculateValue
effLeftBorderPen

Definition at line 4518 of file kspread_cell.cpp.

◆ encodeFormula()

TQString Cell::encodeFormula ( bool _era = false,
int _col = -1,
int _row = -1 ) const

encode a formula into a text representation

Parameters
_eraencode 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)
_colrow the formula is in
_rowcolumn the formula is in

Definition at line 952 of file kspread_cell.cpp.

◆ extraHeight()

double Cell::extraHeight ( ) const

Definition at line 4969 of file kspread_cell.cpp.

◆ extraWidth()

double Cell::extraWidth ( ) const

Definition at line 4964 of file kspread_cell.cpp.

◆ extraXCells()

int Cell::extraXCells ( ) const
Returns
the amount of obscured cells in the horizontal direction

Definition at line 4954 of file kspread_cell.cpp.

◆ extraYCells()

int Cell::extraYCells ( ) const
Returns
the amount of obscured cells in the vertical direction

Definition at line 4959 of file kspread_cell.cpp.

◆ format()

Format * Cell::format ( ) const

Returns the format object of this cell.

Definition at line 316 of file kspread_cell.cpp.

◆ formatType()

FormatType Cell::formatType ( ) const

Return the format of this cell.

Convenience method for Format::getFormatType Note that this is "how the user would like the data to be displayed if possible". If he selects a date format, and the cell contains a string, we won't apply that format.

Definition at line 4929 of file kspread_cell.cpp.

◆ formula()

Formula * Cell::formula ( ) const

Definition at line 463 of file kspread_cell.cpp.

◆ freeAllObscuredCells()

void Cell::freeAllObscuredCells ( )

Definition at line 1177 of file kspread_cell.cpp.

◆ fullName() [1/2]

TQString Cell::fullName ( ) const

Returns the full name of the cell, i.e.

including the worksheet name. Example: "Sheet1!A1"

Definition at line 386 of file kspread_cell.cpp.

◆ fullName() [2/2]

TQString 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 394 of file kspread_cell.cpp.

◆ getDouble()

double Cell::getDouble ( )

return the cell's value as a double

Definition at line 5026 of file kspread_cell.cpp.

◆ getValidity()

Validity * Cell::getValidity ( int newStruct = -1)

Definition at line 554 of file kspread_cell.cpp.

◆ hasError()

bool Cell::hasError ( ) const
Returns
true if the cell contains a formula that could not be evaluated. These cells usually appear with "####" on the screen.

Definition at line 7248 of file kspread_cell.cpp.

◆ height()

int Cell::height ( int _row = -1,
const Canvas * _canvas = 0L ) const
Parameters
_rowthe row this cell is assumed to be in.
_canvasthe canvas this cell is assumed to be in.
Returns
the height of this cell as int

Definition at line 4239 of file kspread_cell.cpp.

◆ incPrecision()

void Cell::incPrecision ( )

Increases the precison of the value displayed.

Precision means here the amount of digits behind the dot. If the current precision is the default of -1, then it is set to the number of digits behind the dot plus 1.

Definition at line 4539 of file kspread_cell.cpp.

◆ isDate()

bool Cell::isDate ( ) const

returns true, if cell format is of date type or content is a date

Definition at line 4975 of file kspread_cell.cpp.

◆ isDefault()

bool Cell::isDefault ( ) const

Returns true if this is a default cell (with row and column equal to zero).

Normally, cell constructed within a sheet can't be a default cell.

Definition at line 328 of file kspread_cell.cpp.

◆ isEmpty()

bool Cell::isEmpty ( ) const

Returns true if this cell has no content, i.e no text and no formula.

Definition at line 822 of file kspread_cell.cpp.

◆ isFormula()

bool Cell::isFormula ( ) const

Returns true if this cell holds a formula.

Definition at line 436 of file kspread_cell.cpp.

◆ isObscured()

bool Cell::isObscured ( ) const
Returns
true if this cell is obscured by another.

Definition at line 830 of file kspread_cell.cpp.

◆ isPartOfMerged()

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 842 of file kspread_cell.cpp.

◆ isTime()

bool Cell::isTime ( ) const

returns true, if cell format is of time type or content is a time

Definition at line 4983 of file kspread_cell.cpp.

◆ layoutDirtyFlag()

bool Cell::layoutDirtyFlag ( ) const

Definition at line 7267 of file kspread_cell.cpp.

◆ leftBorderPen()

const TQPen & Cell::leftBorderPen ( int col,
int row ) const
See also
Format::leftBorderPen

Definition at line 4343 of file kspread_cell.cpp.

◆ link()

TQString Cell::link ( ) const

Returns the link associated with cell.

It is empty if this cell contains no link.

Definition at line 4700 of file kspread_cell.cpp.

◆ load()

bool Cell::load ( const TQDomElement & cell,
int _xshift,
int _yshift,
Paste::Mode pm = Paste::Normal,
Paste::Operation op = Paste::OverWrite,
bool paste = false )

Definition at line 6361 of file kspread_cell.cpp.

◆ loadOasis()

bool Cell::loadOasis ( const TQDomElement & element,
KoOasisLoadingContext & oasisContext,
Style * style )

Loads a cell from an OASIS XML element.

Parameters
elementAn OASIS XML element
oasisContextThe loading context assoiated with the XML element

Definition at line 5686 of file kspread_cell.cpp.

◆ loadOasisCellText()

void Cell::loadOasisCellText ( const TQDomElement & parent)
protected

Load the text paragraphs from an OASIS XML cell description.

Parameters
parentThe DOM element representing the cell.

Definition at line 5961 of file kspread_cell.cpp.

◆ loadOasisConditional()

void Cell::loadOasisConditional ( TQDomElement * style)
protected

Definition at line 5664 of file kspread_cell.cpp.

◆ loadOasisObjects()

void Cell::loadOasisObjects ( const TQDomElement & e,
KoOasisLoadingContext & oasisContext )
protected

Definition at line 6013 of file kspread_cell.cpp.

◆ loadOasisValidation()

void Cell::loadOasisValidation ( const TQString & validationName)
protected

Definition at line 6075 of file kspread_cell.cpp.

◆ loadOasisValidationCondition()

void Cell::loadOasisValidationCondition ( TQString & valExpression)
protected

Definition at line 6298 of file kspread_cell.cpp.

◆ locale()

TDELocale * Cell::locale ( ) const

Returns the locale setting of this cell.

Definition at line 407 of file kspread_cell.cpp.

◆ makeFormula()

bool Cell::makeFormula ( )

Parses the formula.

Fills #dependList and formula.

Returns
false on error.

Definition at line 2041 of file kspread_cell.cpp.

◆ makeLayout()

void Cell::makeLayout ( TQPainter & _painter,
int _col,
int _row )

Calculates the layout of the cell, i,e, determines what should be shown for this cell, m_strOutText.

Definition at line 1221 of file kspread_cell.cpp.

◆ mergeCells()

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
_colis the column this cell is assumed to be in.
_rowis the row this cell is assumed to be in.
_xtells to occupy _x additional cells in the horizontal
_ytells to occupy _y additional cells in the vertical

Definition at line 676 of file kspread_cell.cpp.

◆ mergedXCells()

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 4944 of file kspread_cell.cpp.

◆ mergedYCells()

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 4949 of file kspread_cell.cpp.

◆ move()

void Cell::move ( int column,
int row )

Moves around the cell.

It cares about obscured and obscuring cells and forces, relayout, calculation and redrawing of the cell.

Definition at line 724 of file kspread_cell.cpp.

◆ name() [1/2]

TQString Cell::name ( ) const

Returns the name of the cell.

For example, the cell in first column and first row is "A1".

Definition at line 369 of file kspread_cell.cpp.

◆ name() [2/2]

TQString 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 377 of file kspread_cell.cpp.

◆ needsPrinting()

bool Cell::needsPrinting ( ) const
Returns
true if the cell should be printed in a print out. That si the case if it has any content, border, backgroundcolor, or background brush.
See also
Sheet::print

Definition at line 778 of file kspread_cell.cpp.

◆ nextCell()

Cell * Cell::nextCell ( ) const

Definition at line 539 of file kspread_cell.cpp.

◆ NotifyDepending()

void KSpread::Cell::NotifyDepending ( int col,
int row,
Sheet * sheet,
bool isDepending )

Notify this cell that another cell is depending, or no longer depending on this cell's value.

Parameters
colthe column of the cell
rowthe row of the cell
sheetthe sheet that the cell is on
isDependingtrue if the cell is now depending on this one, false if it is not any longer depending on it.

◆ obscure()

void Cell::obscure ( Cell * cell,
bool isForcing = false )

Tells this cell that the Cell 'cell' obscures this one.

If this cell has to be redrawn, then the obscuring cell is redrawn instead.

Parameters
cellthe obscuring cell
isForcingwhether this is a forced obscuring (merged cells) or just a temporary obscure (text overlap).

Definition at line 925 of file kspread_cell.cpp.

◆ obscuringCells()

TQValueList< Cell * > Cell::obscuringCells ( ) const
Returns
the obscuring cell list (might be empty)

Definition at line 908 of file kspread_cell.cpp.

◆ operator!=()

bool KSpread::Cell::operator!= ( const Cell & other) const
inline

Definition at line 866 of file kspread_cell.h.

◆ operator<()

bool Cell::operator< ( const Cell & cell) const

Definition at line 7148 of file kspread_cell.cpp.

◆ operator==()

bool Cell::operator== ( const Cell & other) const

Definition at line 7186 of file kspread_cell.cpp.

◆ operator>()

bool Cell::operator> ( const Cell & cell) const

Used for comparing cells (when sorting).

Definition at line 7110 of file kspread_cell.cpp.

◆ paintCell()

void Cell::paintCell ( const KoRect & rect,
TQPainter & painter,
View * view,
const KoPoint & coordinate,
const TQPoint & cellRef,
int paintBorder,
TQPen & rightPen,
TQPen & bottomPen,
TQPen & leftPen,
TQPen & topPen,
TQValueList< TQPoint > & mergedCellsPainted,
bool drawCursor = true )

Paints the cell.

Parameters
rectthe portion of the canvas that is actually in view
painterthe painter object to paint on
viewthe view of this data. This may be NULL, but no selection will be included with the painting.
coordinatecoordinates on the painter where the top left corner of the cell should be painted plus width and height
cellRefthe column/row coordinates of the cell.
paintBordera combination of flags from the Cell::BorderSides enum which specifies which cell borders to paint
rightPenpen to use to draw the right border if paintBorder includes the Border_Right flag
bottomPenpen to use to draw the bottom border if paintBorderBottom includes the Border_Bottom flag
leftPenpen to use to draw the left border if paintBorderLeft includes the Border_Left flag
topPenpen to use to draw the top border if paintBorderTop includes the Border_Top flag
mergedCellsPaintedlist of merged cells being painted
drawCursorwhether to draw the cursor and selection or not

Definition at line 2136 of file kspread_cell.cpp.

◆ pasteOperation()

TQString Cell::pasteOperation ( const TQString & new_text,
const TQString & old_text,
Paste::Operation op )

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 6942 of file kspread_cell.cpp.

◆ previousCell()

Cell * Cell::previousCell ( ) const

Definition at line 534 of file kspread_cell.cpp.

◆ removeValidity()

void Cell::removeValidity ( )

Definition at line 565 of file kspread_cell.cpp.

◆ rightBorderPen()

const TQPen & Cell::rightBorderPen ( int col,
int row ) const
See also
Format::rightBorderPen

Definition at line 4331 of file kspread_cell.cpp.

◆ row()

int Cell::row ( ) const

Returns the cell's row.

This could be 0 if the cell is the default cell.

Definition at line 334 of file kspread_cell.cpp.

◆ save()

TQDomElement Cell::save ( TQDomDocument & doc,
int _x_offset = 0,
int _y_offset = 0,
bool force = false,
bool copy = false,
bool era = false )

Save this cell.

Parameters
docdocument to save cell in
_x_offsetx offset
_y_offsety offset
forceif set to true, all the properties of the format are stored (used for "Copy"), otherwise only the non-default properties will be stored. Set this to false if you want smaller files.
copyif set to true, all cell formats will be copied instead of referencing the format (style name), thus resulting in larger output (files). Set this to false if you want smaller files.
eraset this to true if you want to encode relative references as absolutely (they will be switched back to relative references during decoding) - is used for cutting to clipboard Usually this is false, to only store the properties explicitely set.

Definition at line 5151 of file kspread_cell.cpp.

◆ saveOasis()

bool Cell::saveOasis ( KoXmlWriter & xmlwriter,
KoGenStyles & mainStyles,
int row,
int column,
int & repeated,
GenValidationStyles & valStyle )

Definition at line 5384 of file kspread_cell.cpp.

◆ saveOasisAnnotation()

void Cell::saveOasisAnnotation ( KoXmlWriter & xmlwriter)
protected

Definition at line 5354 of file kspread_cell.cpp.

◆ saveOasisCellStyle()

TQString Cell::saveOasisCellStyle ( KoGenStyle & currentCellStyle,
KoGenStyles & mainStyles )
Returns
the OASIS style's name

Definition at line 5372 of file kspread_cell.cpp.

◆ saveOasisValue()

void Cell::saveOasisValue ( KoXmlWriter & xmlWriter)

Definition at line 5514 of file kspread_cell.cpp.

◆ setBottomBorderPen()

void Cell::setBottomBorderPen ( const TQPen & p)
See also
Format::setBottomBorderPen

Definition at line 4318 of file kspread_cell.cpp.

◆ setCalcDirtyFlag()

void Cell::setCalcDirtyFlag ( )

Set the calcDirtyFlag.

Definition at line 4991 of file kspread_cell.cpp.

◆ setCellText()

void Cell::setCellText ( const TQString & _text,
bool asString = false )

The high-level method for setting text, when the user inputs it.

It will revert back to the old text if testValidity() returns action==stop.

Definition at line 4621 of file kspread_cell.cpp.

◆ setCellValue()

void Cell::setCellValue ( const Value & value,
FormatType fmtType = No_format,
const TQString & inputText = TQString() )

Sets the value for this cell and its formatting and input text, if appropriate.

Can therefore be used as a replacement for setCellText, if we don't need to parse.

If inputText is empty and the cell has NO formula, the input text is created from value .

Parameters
valuethe new cell value
fmtTypethe formatting type
inputTextthe new input text
Note
Calls setValue() after setting the formatting and input text.

Definition at line 516 of file kspread_cell.cpp.

◆ setConditionList()

void Cell::setConditionList ( const TQValueList< Conditional > & newList)

Replace the old set of conditions with a new one.

Definition at line 7239 of file kspread_cell.cpp.

◆ setDisplayDirtyFlag()

void Cell::setDisplayDirtyFlag ( )

Definition at line 7277 of file kspread_cell.cpp.

◆ setDisplayText()

void Cell::setDisplayText ( const TQString & _text)

Sets the text in the cell when the user inputs it.

Will determine the type of contents automatically. Called by setCellText.

A real formula "=A1+A2*3" was entered.

Some numeric value or a string.

Definition at line 4654 of file kspread_cell.cpp.

◆ setFlag()

void Cell::setFlag ( CellFlags flag)

Definition at line 7292 of file kspread_cell.cpp.

◆ setLayoutDirtyFlag()

void Cell::setLayoutDirtyFlag ( bool format = false)

Causes the format to be recalculated when the cell is drawn next time.

This flag is for example set if the width of the column changes or if some cell specific format value like font or text change.

Definition at line 762 of file kspread_cell.cpp.

◆ setLeftBorderPen()

void Cell::setLeftBorderPen ( const TQPen & p)
See also
Format::setLeftBorderPen

Definition at line 4280 of file kspread_cell.cpp.

◆ setLink()

void Cell::setLink ( const TQString & 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 4692 of file kspread_cell.cpp.

◆ setNextCell()

void Cell::setNextCell ( Cell * c)

Definition at line 549 of file kspread_cell.cpp.

◆ setNumber()

void Cell::setNumber ( double number)

Definition at line 4612 of file kspread_cell.cpp.

◆ setPreviousCell()

void Cell::setPreviousCell ( Cell * c)

Definition at line 544 of file kspread_cell.cpp.

◆ setRightBorderPen()

void Cell::setRightBorderPen ( const TQPen & p)
See also
Format::setRightBorderPen

Definition at line 4305 of file kspread_cell.cpp.

◆ setTopBorderPen()

void Cell::setTopBorderPen ( const TQPen & p)
See also
Format::setTopBorderPen

Definition at line 4293 of file kspread_cell.cpp.

◆ setValue()

void Cell::setValue ( const Value & value)

Sets the value for this cell.

Definition at line 483 of file kspread_cell.cpp.

◆ sheet()

Sheet * Cell::sheet ( ) const

Returns the worksheet which owns this cell.

Definition at line 322 of file kspread_cell.cpp.

◆ sheetDies()

void Cell::sheetDies ( )

This method notifies the cell that the parent sheet is being deleted.

Definition at line 7062 of file kspread_cell.cpp.

◆ strOutText()

TQString Cell::strOutText ( ) const

Definition at line 458 of file kspread_cell.cpp.

◆ testAnchor()

TQString Cell::testAnchor ( int _x,
int _y ) const

Definition at line 7044 of file kspread_cell.cpp.

◆ testFlag()

bool Cell::testFlag ( CellFlags flag) const

Definition at line 7297 of file kspread_cell.cpp.

◆ testValidity()

bool Cell::testValidity ( ) const

return true if value is good else show a messagebox

Definition at line 4726 of file kspread_cell.cpp.

◆ text()

TQString Cell::text ( ) 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 448 of file kspread_cell.cpp.

◆ textDisplaying()

TQString Cell::textDisplaying ( TQPainter & painter)
protected

Called from paintCell to determine the text wich can be displaying.

Definition at line 4063 of file kspread_cell.cpp.

◆ textHeight()

double Cell::textHeight ( ) const

return height of the text

Definition at line 4939 of file kspread_cell.cpp.

◆ textSize()

void Cell::textSize ( TQPainter & _paint)
protected

Called from makeFormat() to determine the space needed for the text.

Definition at line 1871 of file kspread_cell.cpp.

◆ textWidth()

double Cell::textWidth ( ) const

return width of the text

Definition at line 4934 of file kspread_cell.cpp.

◆ toDate()

TQDate Cell::toDate ( const TQDomElement & element)

Definition at line 6925 of file kspread_cell.cpp.

◆ topBorderPen()

const TQPen & Cell::topBorderPen ( int col,
int row ) const
See also
Format::topBorderPen

Definition at line 4367 of file kspread_cell.cpp.

◆ toTime()

TQTime Cell::toTime ( const TQDomElement & element)

Definition at line 6907 of file kspread_cell.cpp.

◆ ultimateObscuringCell()

Cell * Cell::ultimateObscuringCell ( ) const

Return the cell that is obscuring this one (merged cells only).

If no obscuring, return the cell itself.

Returns
the cell that decides the format for the cell in question.

Definition at line 875 of file kspread_cell.cpp.

◆ unobscure()

void Cell::unobscure ( Cell * cell)

Tells this cell that it is no longer obscured.

Parameters
cellthe cell that is no longer obscuring this one.

Definition at line 944 of file kspread_cell.cpp.

◆ updateChart()

bool Cell::updateChart ( bool refresh = true)

Refreshing chart.

Parameters
refreshis default true when it's false it's just for test it's used when you paste cell

Definition at line 5004 of file kspread_cell.cpp.

◆ value()

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 471 of file kspread_cell.cpp.

◆ width()

int Cell::width ( int _col = -1,
const Canvas * _canvas = 0L ) const
Parameters
_colthe column this cell is assumed to be in. This parameter defaults to the return value of column.
_canvasthe canvas this cell is assumed to be in.
Returns
the width of this cell as int

Definition at line 4213 of file kspread_cell.cpp.

◆ Conditions

friend class Conditions
friend

Definition at line 139 of file kspread_cell.h.


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