kspread

KSpread::CellStorage Class Reference

The cell storage. More...

#include <CellStorage.h>

Inheritance diagram for KSpread::CellStorage:

List of all members.

Public Types

enum  Visiting {
  Values = 0x01, Formulas = 0x02, Comments = 0x04, Links = 0x08,
  Styles = 0x10, ConditionStyles = 0x20, Validities = 0x40, VisitContent = 0x03,
  VisitAll = 0xFF
}

Signals

void insertNamedArea (const Region &, const QString &)
void namedAreaRemoved (const QString &)

Public Member Functions

 CellStorage (const CellStorage &other, Sheet *sheet)
 CellStorage (const CellStorage &other)
 CellStorage (Sheet *sheet)
 ~CellStorage ()
Binding binding (int column, int row) const
const BindingStoragebindingStorage () const
int columns () const
QString comment (int column, int row) const
const CommentStoragecommentStorage () const
Conditions conditions (int column, int row) const
const ConditionsStorageconditionsStorage () const
Database database (int column, int row) const
QList< QPair< QRectF, Database > > databases (const Region &region) const
bool doesMergeCells (int column, int row) const
Cell firstInColumn (int col, Visiting visiting=VisitAll) const
Cell firstInRow (int row, Visiting visiting=VisitAll) const
Formula formula (int column, int row) const
const FormulaStorageformulaStorage () const
const FusionStoragefusionStorage () const
void insertColumns (int position, int number=1)
void insertRows (int position, int number=1)
void insertShiftDown (const QRect &rect)
void insertShiftRight (const QRect &rect)
bool isLocked (int column, int row) const
bool isPartOfMerged (int column, int row) const
Cell lastInColumn (int col, Visiting visiting=VisitAll) const
Cell lastInRow (int row, Visiting visiting=VisitAll) const
QString link (int column, int row) const
const LinkStoragelinkStorage () const
void lockCells (const QRect &rect)
QRect lockedCells (int column, int row) const
bool locksCells (int column, int row) const
Cell masterCell (int column, int row) const
QList< CellmasterCells (const Region &region) const
void mergeCells (int column, int row, int numXCells, int numYCells)
int mergedXCells (int column, int row) const
int mergedYCells (int column, int row) const
QString namedArea (int column, int row) const
QList< QPair< QRectF, QString > > namedAreas (const Region &region) const
Cell nextInColumn (int col, int row, Visiting visiting=VisitAll) const
Cell nextInRow (int col, int row, Visiting visiting=VisitAll) const
Cell prevInColumn (int col, int row, Visiting visiting=VisitAll) const
Cell prevInRow (int col, int row, Visiting visiting=VisitAll) const
void removeBinding (const Region &region, const Binding &binding)
void removeColumns (int position, int number=1)
void removeRows (int position, int number=1)
void removeShiftLeft (const QRect &rect)
void removeShiftUp (const QRect &rect)
int rows () const
void setBinding (const Region &region, const Binding &binding)
void setComment (const Region &region, const QString &comment)
void setConditions (const Region &region, Conditions conditions)
void setDatabase (const Region &region, const Database &database)
void setFormula (int column, int row, const Formula &formula)
void setLink (int column, int row, const QString &link)
void setNamedArea (const Region &region, const QString &namedArea)
void setStyle (const Region &region, const Style &style)
void setUserInput (int column, int row, const QString &input)
void setValidity (const Region &region, Validity validity)
void setValue (int column, int row, const Value &value)
void startUndoRecording ()
CellStorageUndoData * stopUndoRecording ()
Style style (const QRect &rect) const
Style style (int column, int row) const
StyleStoragestyleStorage () const
CellStorage subStorage (const Region &region) const
void take (int col, int row)
void undo (CellStorageUndoData *undoData)
void unlockCells (int column, int row)
QString userInput (int column, int row) const
Validity validity (int column, int row) const
const ValidityStoragevalidityStorage () const
Value value (int column, int row) const
Value valueRegion (const Region &region) const
const ValueStoragevalueStorage () const

Detailed Description

The cell storage.

A wrapper around a couple of storages, which hold the cell data. Provides methods to iterate over the non-empty cells. Emits Damages on changes. Capable of recording the old data for undoing.

Author:
Stefan Nikolaus <stefan.nikolaus@kdemail.net>
Note:
If you fill the storage, do it row-wise. That's more performant.

Definition at line 66 of file CellStorage.h.


Member Enumeration Documentation

Enumerator:
Values 
Formulas 
Comments 
Links 
Styles 
ConditionStyles 
Validities 
VisitContent 

just visit the cell contents: values, formulas

VisitAll 

visit all: cell contents, styles, comments, ...

Definition at line 70 of file CellStorage.h.


Constructor & Destructor Documentation

CellStorage::CellStorage ( Sheet sheet  ) 

Constructor.

Creates an empty storage for sheet.

Definition at line 123 of file CellStorage.cpp.

CellStorage::CellStorage ( const CellStorage other  ) 

Copy constructor.

Note:
Take care: does not perform a deep copy!

Definition at line 129 of file CellStorage.cpp.

CellStorage::CellStorage ( const CellStorage other,
Sheet sheet 
)

Copy constructor.

Creates a CellStorage for sheet and copies the data from other.

Definition at line 135 of file CellStorage.cpp.

CellStorage::~CellStorage (  ) 

Destructor.

Definition at line 141 of file CellStorage.cpp.


Member Function Documentation

Binding CellStorage::binding ( int  column,
int  row 
) const
Returns:
the binding associated with the Cell at column , row .

Definition at line 175 of file CellStorage.cpp.

const BindingStorage * CellStorage::bindingStorage (  )  const

Definition at line 1210 of file CellStorage.cpp.

int CellStorage::columns (  )  const

The maximum occupied column, i.e.

the horizontal storage dimension.

Returns:
the maximum column

Definition at line 1171 of file CellStorage.cpp.

QString CellStorage::comment ( int  column,
int  row 
) const
Returns:
the comment associated with the Cell at column , row .

Definition at line 198 of file CellStorage.cpp.

const CommentStorage * CellStorage::commentStorage (  )  const

Definition at line 1215 of file CellStorage.cpp.

Conditions CellStorage::conditions ( int  column,
int  row 
) const
Returns:
the conditional formattings associated with the Cell at column , row .

Definition at line 212 of file CellStorage.cpp.

const ConditionsStorage * CellStorage::conditionsStorage (  )  const

Definition at line 1220 of file CellStorage.cpp.

Database CellStorage::database ( int  column,
int  row 
) const
Returns:
the database associated with the Cell at column , row .

Definition at line 226 of file CellStorage.cpp.

QList< QPair< QRectF, Database > > CellStorage::databases ( const Region region  )  const

Definition at line 239 of file CellStorage.cpp.

bool CellStorage::doesMergeCells ( int  column,
int  row 
) const

Definition at line 426 of file CellStorage.cpp.

Cell CellStorage::firstInColumn ( int  col,
Visiting  visiting = VisitAll 
) const

Retrieve the first used data in col .

Can be used in conjunction with nextInColumn() to loop through a column.

Returns:
the first used data in col or the default data, if the column is empty.

Definition at line 1049 of file CellStorage.cpp.

Cell CellStorage::firstInRow ( int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the first used data in row .

Can be used in conjunction with nextInRow() to loop through a row.

Returns:
the first used data in row or the default data, if the row is empty.

Definition at line 1065 of file CellStorage.cpp.

Formula CellStorage::formula ( int  column,
int  row 
) const
Returns:
the formula associated with the Cell at column , row .

Definition at line 253 of file CellStorage.cpp.

const FormulaStorage * CellStorage::formulaStorage (  )  const

Definition at line 1225 of file CellStorage.cpp.

const FusionStorage * CellStorage::fusionStorage (  )  const

Definition at line 1230 of file CellStorage.cpp.

void CellStorage::insertColumns ( int  position,
int  number = 1 
)

Insert number columns at position .

Returns:
the data, that became out of range (shifted over the end)

Definition at line 586 of file CellStorage.cpp.

void KSpread::CellStorage::insertNamedArea ( const Region ,
const QString  
) [signal]
void CellStorage::insertRows ( int  position,
int  number = 1 
)

Insert number rows at position .

Returns:
the data, that became out of range (shifted over the end)

Definition at line 704 of file CellStorage.cpp.

void CellStorage::insertShiftDown ( const QRect rect  ) 

Shifts the data in and below rect to the bottom by the height of rect .

Definition at line 992 of file CellStorage.cpp.

void CellStorage::insertShiftRight ( const QRect rect  ) 

Shifts the data in and right of rect to the right by the width of rect .

Definition at line 877 of file CellStorage.cpp.

bool CellStorage::isLocked ( int  column,
int  row 
) const

Definition at line 525 of file CellStorage.cpp.

bool CellStorage::isPartOfMerged ( int  column,
int  row 
) const

Definition at line 439 of file CellStorage.cpp.

Cell CellStorage::lastInColumn ( int  col,
Visiting  visiting = VisitAll 
) const

Retrieve the last used data in col .

Can be used in conjunction with prevInColumn() to loop through a column.

Returns:
the last used data in col or the default data, if the column is empty.

Definition at line 1085 of file CellStorage.cpp.

Cell CellStorage::lastInRow ( int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the last used data in row .

Can be used in conjunction with prevInRow() to loop through a row.

Returns:
the last used data in row or the default data, if the row is empty.

Definition at line 1098 of file CellStorage.cpp.

QString CellStorage::link ( int  column,
int  row 
) const
Returns:
the hyperlink associated with the Cell at column , row .

Definition at line 287 of file CellStorage.cpp.

const LinkStorage * CellStorage::linkStorage (  )  const

Definition at line 1235 of file CellStorage.cpp.

void CellStorage::lockCells ( const QRect rect  ) 

Definition at line 538 of file CellStorage.cpp.

QRect CellStorage::lockedCells ( int  column,
int  row 
) const

Definition at line 574 of file CellStorage.cpp.

bool CellStorage::locksCells ( int  column,
int  row 
) const
Returns:
true, if the cell's value is a matrix and obscures other cells

Definition at line 512 of file CellStorage.cpp.

Cell CellStorage::masterCell ( int  column,
int  row 
) const

Definition at line 463 of file CellStorage.cpp.

QList< Cell > CellStorage::masterCells ( const Region region  )  const

Definition at line 495 of file CellStorage.cpp.

void CellStorage::mergeCells ( int  column,
int  row,
int  numXCells,
int  numYCells 
)

Merge the cell at column, row with the numXCells adjacent cells in horizontal direction and with the numYCells adjacent cells in vertical direction.

I.e. the resulting cell spans numXCells + 1 columns and numYCells + 1 rows. Passing 0 as numXCells and numYCells unmerges the cell at column, row.

Parameters:
column the master cell's column
row the master cell's row
numXCells number of horizontal cells to be merged in
numYCells number of vertical cells to be merged in

Definition at line 452 of file CellStorage.cpp.

int CellStorage::mergedXCells ( int  column,
int  row 
) const

Definition at line 473 of file CellStorage.cpp.

int CellStorage::mergedYCells ( int  column,
int  row 
) const

Definition at line 484 of file CellStorage.cpp.

QString CellStorage::namedArea ( int  column,
int  row 
) const
Returns:
the named area's name associated with the Cell at column , row .

Definition at line 305 of file CellStorage.cpp.

void KSpread::CellStorage::namedAreaRemoved ( const QString  )  [signal]
QList< QPair< QRectF, QString > > CellStorage::namedAreas ( const Region region  )  const

Definition at line 315 of file CellStorage.cpp.

Cell CellStorage::nextInColumn ( int  col,
int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the next used data in col after row .

Can be used in conjunction with firstInColumn() to loop through a column.

Returns:
the next used data in col or the default data, there is no further data.

Definition at line 1111 of file CellStorage.cpp.

Cell CellStorage::nextInRow ( int  col,
int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the next used data in row after col .

Can be used in conjunction with firstInRow() to loop through a row.

Returns:
the next used data in row or the default data, if there is no further data.

Definition at line 1125 of file CellStorage.cpp.

Cell CellStorage::prevInColumn ( int  col,
int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the previous used data in col after row .

Can be used in conjunction with lastInColumn() to loop through a column.

Returns:
the previous used data in col or the default data, there is no further data.

Definition at line 1145 of file CellStorage.cpp.

Cell CellStorage::prevInRow ( int  col,
int  row,
Visiting  visiting = VisitAll 
) const

Retrieve the previous used data in row after col .

Can be used in conjunction with lastInRow() to loop through a row.

Returns:
the previous used data in row or the default data, if there is no further data.

Definition at line 1158 of file CellStorage.cpp.

void CellStorage::removeBinding ( const Region region,
const Binding binding 
)

Definition at line 189 of file CellStorage.cpp.

void CellStorage::removeColumns ( int  position,
int  number = 1 
)

Removes number columns at position .

Returns:
the removed data

Definition at line 646 of file CellStorage.cpp.

void CellStorage::removeRows ( int  position,
int  number = 1 
)

Removes number rows at position .

Returns:
the removed data

Definition at line 761 of file CellStorage.cpp.

void CellStorage::removeShiftLeft ( const QRect rect  ) 

Shifts the data right of rect to the left by the width of rect .

The data formerly contained in rect becomes overridden.

Definition at line 819 of file CellStorage.cpp.

void CellStorage::removeShiftUp ( const QRect rect  ) 

Shifts the data below rect to the top by the height of rect .

The data formerly contained in rect becomes overridden.

Definition at line 934 of file CellStorage.cpp.

int CellStorage::rows (  )  const

The maximum occupied row, i.e.

the vertical storage dimension.

Returns:
the maximum row

Definition at line 1186 of file CellStorage.cpp.

void CellStorage::setBinding ( const Region region,
const Binding binding 
)

Definition at line 180 of file CellStorage.cpp.

void CellStorage::setComment ( const Region region,
const QString comment 
)

Definition at line 203 of file CellStorage.cpp.

void CellStorage::setConditions ( const Region region,
Conditions  conditions 
)

Definition at line 217 of file CellStorage.cpp.

void CellStorage::setDatabase ( const Region region,
const Database database 
)

Definition at line 244 of file CellStorage.cpp.

void CellStorage::setFormula ( int  column,
int  row,
const Formula formula 
)

Definition at line 258 of file CellStorage.cpp.

void CellStorage::setLink ( int  column,
int  row,
const QString link 
)

Definition at line 292 of file CellStorage.cpp.

void CellStorage::setNamedArea ( const Region region,
const QString namedArea 
)

Definition at line 320 of file CellStorage.cpp.

void CellStorage::setStyle ( const Region region,
const Style style 
)

Definition at line 339 of file CellStorage.cpp.

void CellStorage::setUserInput ( int  column,
int  row,
const QString input 
)

Definition at line 353 of file CellStorage.cpp.

void CellStorage::setValidity ( const Region region,
Validity  validity 
)

Definition at line 371 of file CellStorage.cpp.

void CellStorage::setValue ( int  column,
int  row,
const Value value 
)

Definition at line 391 of file CellStorage.cpp.

void CellStorage::startUndoRecording (  ) 

Start the undo recording.

While recording the undo data of each storage operation is saved in the undo data object, that is returned when the recording is stopped.

See also:
stopUndoRecording
undo

Definition at line 1255 of file CellStorage.cpp.

CellStorageUndoData * CellStorage::stopUndoRecording (  ) 

Stops the undo recording and return the undo data object.

If no undo data occurred, it returns null.

See also:
startUndoRecording
undo
Returns:
the undo object

Definition at line 1263 of file CellStorage.cpp.

Style CellStorage::style ( const QRect rect  )  const
Returns:
the Style associated with rect.

Definition at line 334 of file CellStorage.cpp.

Style CellStorage::style ( int  column,
int  row 
) const
Returns:
the Style associated with the Cell at column , row .

Definition at line 329 of file CellStorage.cpp.

StyleStorage * CellStorage::styleStorage (  )  const

Definition at line 1240 of file CellStorage.cpp.

CellStorage CellStorage::subStorage ( const Region region  )  const

Creates a substorage consisting of the values in region.

Returns:
a subset of the storage stripped down to the values in region

Definition at line 1201 of file CellStorage.cpp.

void CellStorage::take ( int  col,
int  row 
)

Removes all data at col , row .

Definition at line 146 of file CellStorage.cpp.

void CellStorage::undo ( CellStorageUndoData *  undoData  ) 

Reapplies the data stored in undoData.

See also:
startUndoRecording
stopUndoRecording

Definition at line 1281 of file CellStorage.cpp.

void CellStorage::unlockCells ( int  column,
int  row 
)

Definition at line 549 of file CellStorage.cpp.

QString CellStorage::userInput ( int  column,
int  row 
) const
Returns:
the user input associated with the Cell at column , row .

Definition at line 348 of file CellStorage.cpp.

Validity CellStorage::validity ( int  column,
int  row 
) const
Returns:
the validity checks associated with the Cell at column , row .

Definition at line 366 of file CellStorage.cpp.

const ValidityStorage * CellStorage::validityStorage (  )  const

Definition at line 1245 of file CellStorage.cpp.

Value CellStorage::value ( int  column,
int  row 
) const
Returns:
the value associated with the Cell at column , row .

Definition at line 380 of file CellStorage.cpp.

Value CellStorage::valueRegion ( const Region region  )  const

Creates a value array containing the values in region.

Definition at line 385 of file CellStorage.cpp.

const ValueStorage * CellStorage::valueStorage (  )  const

Definition at line 1250 of file CellStorage.cpp.


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