1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
/*
* Copyright (c) 2005 Cyrille Berger <[email protected]>
* Copyright (c) 2006 Isaac Clerencia <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KROSS_KSPREADCOREKRSCELL_H
#define KROSS_KSPREADCOREKRSCELL_H
#include <kspread_sheet.h>
#include <kspread_cell.h>
#include <kspread_value.h>
#include <api/class.h>
#include <tqstring.h>
#include <tqcolor.h>
namespace Kross { namespace KSpreadCore {
/**
* For every cell in the spread sheet there is a Cell object.
*
* Cell contains format information and algorithm and it
* contains the calculation algorithm.
*
* Example (in Ruby) :
* @code
* doc = krosskspreadcore::get("KSpreadDocument")
* sheet = doc.currentSheet()
* cellA1 = sheet.cell(0, 0)
* cellA2 = sheet.cell(0, 1)
* cellA2.setValue( cellA1.value() )
* cellA2.setTextColor( "#ff0000" )
* @endcode
*/
class Cell : public Kross::Api::Class<Cell>
{
public:
Cell(KSpread::Cell* cell, KSpread::Sheet* sheet, uint col, uint row);
virtual ~Cell();
virtual const TQString getClassName() const;
private:
/**
* Return the value of the cell.
*/
TQVariant value() const;
/**
* Set the value the cell has.
*/
bool setValue(const TQVariant& value);
/**
* Return the column number.
*/
int column() const;
/**
* Return the row number.
*/
int row() const;
/**
* Return the previous cell if there is any.
*/
Cell* previousCell() const;
/**
* Return the next cell if there is any.
*/
Cell* nextCell() const;
/**
* Set the previous cell.
*/
void setPreviousCell(Cell* c);
/**
* Set the next cell.
*/
void setNextCell(Cell* c);
/**
* Returns the name of the cell. For example, the cell in first column
* and first row is "A1".
*/
const TQString name() const;
/**
* Returns the full name of the cell, i.e. including the worksheet name.
* Example: "Sheet1!A1"
*/
const TQString fullName() const;
/**
* Returns the comment for the cell.
*/
const TQString comment() const;
/**
* Set the comment for the cell.
*/
void setComment(const TQString& c);
#if 0
bool isFormula() const;
Formula *formula () const;
#endif
/**
* Returns the format of the cell, e.g. #.##0.00, dd/mmm/yyyy,...
*/
const TQString getFormatString() const;
/**
* Sets the format of the cell, e.g. #.##0.00, dd/mmm/yyyy,...
*/
void setFormatString(const TQString& format);
/**
* Return the text of the cell (the formula if there is one,
* the value otherwise). This could be a value (e.g. "14.03")
* or a formula (e.g. "=SUM(A1:A10)")
*/
const TQString text() const;
/**
* Set the text of the cell. the text
* will be handled as string
*/
bool setText(const TQString& text);
/**
* Return the textcolor as RGB-value in the format "#RRGGBB".
*/
const TQString textColor();
/**
* Set the textcolor to the RGB-value in the format "#RRGGBB"
* where each of R, G, and B is a single hex digit.
*/
void setTextColor(const TQString& textcolor);
/**
* Return the backgroundcolor as RGB-value in the format "#RRGGBB".
*/
const TQString backgroundColor();
/**
* Set the backgroundcolor to the RGB-value in the format "#RRGGBB"
* where each of R, G, and B is a single hex digit.
*/
void setBackgroundColor(const TQString& backgroundcolor);
private:
KSpread::Cell* m_cell;
KSpread::Sheet* m_sheet;
uint m_col, m_row;
TQVariant toVariant(const KSpread::Value& value) const;
};
}
}
#endif
|