44 static UString columnNames[256];
46 CellPrivate(Sheet* s, unsigned column, unsigned row);
47 ~CellPrivate() { delete format; }
52using namespace Swinder;
54UString CellPrivate::columnNames[256];
57CellPrivate::CellPrivate(Sheet* s, unsigned c, unsigned r):
58sheet(s), column(c), row(r), format(0), formatIndex(-1), columnSpan(0), rowSpan(0)
62Cell::Cell( Sheet* sheet, unsigned column, unsigned row )
64 d = new CellPrivate(sheet, column, row);
77unsigned Cell::column() const
82unsigned Cell::row() const
89 return name( column(), row() );
92UString Cell::name( unsigned column, unsigned row )
98UString Cell::columnLabel() const
100 return columnLabel( column() );
104UString Cell::columnLabel( unsigned column )
111 label = CellPrivate::columnNames[column];
116 for( unsigned c = 0; c < 26; c++)
117 CellPrivate::columnNames[c] = UString( UChar(( char) 'A'+c));
118 for( unsigned d = 0; d < 256-26; d++)
120 char buf[3] = { (char)( 'A'+(d / 26)), ( char)( 'A'+(d % 26)), 0};
121 CellPrivate::columnNames[d+26] = UString(buf);
124 label = CellPrivate::columnNames[column];
134 for( unsigned limit = 26; column-offset >= limit; limit *= 26, digits++ )
140 char ref[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
143 char* colp = ref + 9 - 1;
144 for( unsigned c = column - offset; digits; --digits, c/=26, colp-- )
145 *colp = char( 'A' + (c%26));
147 label = UString(( const char*)(colp+1));
154const Value& Cell::value() const
159void Cell::setValue( const Value& value )
164const UString& Cell::formula() const
169void Cell::setFormula( const UString& formula )
171 d->formula = formula;
174int Cell::formatIndex() const
176 return d->formatIndex;
179void Cell::setFormatIndex( int index )
181 d->formatIndex = index;
184Format Cell::format() const
189 return Format(*d->format);
192void Cell::setFormat( const Format& format )
197 (*d->format) = format;
200unsigned Cell::columnSpan() const
202 return d->columnSpan;
205void Cell::setColumnSpan( unsigned span )
207 if( span < 1 ) return;
208 d->columnSpan = span;
211unsigned Cell::rowSpan() const
216void Cell::setRowSpan( unsigned span )
218 if( span < 1 ) return;
static UString number(int i) Constructs a string from an int.
Provides a wrapper for cell value.
|