38 std::map<unsigned,Cell*> cells;
41 std::map<unsigned,Column*> columns;
42 std::map<unsigned,Row*> rows;
62using namespace Swinder;
64Sheet::Sheet( Workbook* wb )
66 d = new Sheet::Private();
85Workbook* Sheet::workbook()
93 std::map<unsigned,Cell*>::iterator cell_it;
94 for( cell_it = d->cells.begin(); cell_it != d->cells.end(); ++cell_it )
95 delete cell_it->second;
98 std::map<unsigned,Column*>::iterator col_it;
99 for( col_it = d->columns.begin(); col_it != d->columns.end(); ++col_it )
100 delete col_it->second;
103 std::map<unsigned,Row*>::iterator row_it;
104 for( row_it = d->rows.begin(); row_it != d->rows.end(); ++row_it )
105 delete row_it->second;
113void Sheet::setName( const UString& name )
118Cell* Sheet::cell( unsigned columnIndex, unsigned rowIndex, bool autoCreate )
120 unsigned hashed = (rowIndex+1)*1024 + columnIndex + 1;
121 Cell* c = d->cells[ hashed ];
124 if( !c && autoCreate )
126 c = new Cell( this, columnIndex, rowIndex );
127 d->cells[ hashed ] = c;
130 this->column( columnIndex, true );
131 this->row( rowIndex, true );
133 if( rowIndex > d->maxRow ) d->maxRow = rowIndex;
134 if( columnIndex > d->maxColumn ) d->maxColumn = columnIndex;
140Column* Sheet::column( unsigned index, bool autoCreate )
142 Column* c = d->columns[ index ];
145 if( !c && autoCreate )
147 c = new Column( this, index );
148 d->columns[ index ] = c;
149 if( index > d->maxColumn ) d->maxColumn = index;
155Row* Sheet::row( unsigned index, bool autoCreate )
157 Row* r = d->rows[ index ];
160 if( !r && autoCreate )
162 r = new Row( this, index );
163 d->rows[ index ] = r;
164 if( index > d->maxRow ) d->maxRow = index;
170unsigned Sheet::maxRow() const
175unsigned Sheet::maxColumn() const
180bool Sheet::visible() const
185void Sheet::setVisible( bool v )
190bool Sheet::protect() const
195void Sheet::setProtect( bool p )
200UString Sheet::leftHeader() const
202 return d->leftHeader;
205void Sheet::setLeftHeader( const UString& h )
210UString Sheet::centerHeader() const
212 return d->centerHeader;
215void Sheet::setCenterHeader( const UString& h )
220UString Sheet::rightHeader() const
222 return d->rightHeader;
225void Sheet::setRightHeader( const UString& h )
230UString Sheet::leftFooter() const
232 return d->leftFooter;
235void Sheet::setLeftFooter( const UString& h )
240UString Sheet::centerFooter() const
242 return d->centerFooter;
245void Sheet::setCenterFooter( const UString& h )
250UString Sheet::rightFooter() const
252 return d->rightFooter;
255void Sheet::setRightFooter( const UString& h )
260double Sheet::leftMargin() const
262 return d->leftMargin;
265void Sheet::setLeftMargin( double m )
270double Sheet::rightMargin() const
272 return d->rightMargin;
275void Sheet::setRightMargin( double m )
280double Sheet::topMargin() const
285void Sheet::setTopMargin( double m )
290double Sheet::bottomMargin() const
292 return d->bottomMargin;
295void Sheet::setBottomMargin( double m )
313 d = new Column::Private;
326Sheet* Column::sheet() const
331unsigned Column::index() const
336double Column::width() const
341void Column::setWidth( double w )
346int Column::formatIndex() const
348 return d->formatIndex;
351void Column::setFormatIndex( int index )
353 d->formatIndex = index;
357const Format& Column::format() const
362void Column::setFormat( const Format& f )
367bool Column::visible() const
372void Column::setVisible( bool b )
388Row::Row( Sheet* sheet, unsigned index )
390 d = new Row::Private;
402Sheet* Row::sheet() const
407unsigned Row::index() const
412double Row::height() const
417void Row::setHeight( double w )
422int Row::formatIndex() const
424 return d->formatIndex;
427void Row::setFormatIndex( int index )
429 d->formatIndex = index;
432const Format& Row::format() const
437void Row::setFormat( const Format& f )
442bool Row::visible() const
447void Row::setVisible( bool b )
|