24#include <kspread_doc.h>
25#include <kspread_sheet.h>
26#include <kspread_cell.h>
27#include <kspread_value.h>
29namespace Kross {
namespace KSpreadCore {
31Sheet::Sheet(KSpread::Sheet* sheet,
KSpread::Doc *doc) : Kross::Api::Class<Sheet>(
"KSpreadSheet"), m_sheet(sheet), m_doc(doc) {
33 this->addFunction0< Kross::Api::Variant >(
"name",
this, &Sheet::name);
34 this->addFunction1< void, Kross::Api::Variant >(
"setName",
this, &Sheet::setName);
36 this->addFunction0< Kross::Api::Variant >(
"maxColumn",
this, &Sheet::maxColumn);
37 this->addFunction0< Kross::Api::Variant >(
"maxRow",
this, &Sheet::maxRow);
39 this->addFunction0< Cell >(
"firstCell",
this, &Sheet::firstCell);
41 this->addFunction2< Cell, Kross::Api::Variant, Kross::Api::Variant >(
"cell",
this, &Sheet::cell);
43 this->addFunction1< Kross::Api::Variant, Kross::Api::Variant >(
"insertRow",
this, &Sheet::insertRow);
44 this->addFunction1< Kross::Api::Variant, Kross::Api::Variant >(
"insertColumn",
this, &Sheet::insertColumn);
46 this->addFunction1< void, Kross::Api::Variant >(
"removeRow",
this, &Sheet::removeRow);
47 this->addFunction1< void, Kross::Api::Variant >(
"removeColumn",
this, &Sheet::removeColumn);
53const TQString Sheet::getClassName()
const {
54 return "Kross::KSpreadCore::Sheet";
57const TQString Sheet::name()
const
59 return m_sheet->sheetName();
62void Sheet::setName(
const TQString& name)
64 m_sheet->setSheetName(name);
67int Sheet::maxColumn()
const {
68 return m_sheet->maxColumn();
71int Sheet::maxRow()
const {
72 return m_sheet->maxRow();
75Cell* Sheet::firstCell()
const {
80Cell* Sheet::cell(uint col, uint row) {
81 uint c = TQMAX(uint(1), col);
82 uint r = TQMAX(uint(1), row);
83 return new Cell(m_sheet->cellAt(c,r),m_sheet,c,r);
86bool Sheet::insertRow(uint row) {
87 return m_sheet->insertRow(row);
90bool Sheet::insertColumn(uint col) {
91 return m_sheet->insertColumn(col);
94void Sheet::removeRow(uint row) {
95 m_sheet->removeRow( TQMAX(uint(1), row) );
98void Sheet::removeColumn(uint col) {
99 m_sheet->removeColumn( TQMAX(uint(1), col) );
For every cell in the spread sheet there is a Cell object.
int row() const
Returns the cell's row.
Sheet * sheet() const
Returns the worksheet which owns this cell.
int column() const
Returns the cell's column.
This class holds the data that makes up a spreadsheet.