Eneboo - Documentación para desarrolladores
|
00001 /* 00002 odf-gen: Simple API to generate OpenDocument documents. 00003 Copyright (C) 2009 Pablo Jorge, FuDePAN 00004 00005 This file is part of the odf-gen project. 00006 00007 odf-gen is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 odf-gen is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with odf-gen. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef SHEET_H 00022 #define SHEET_H 00023 00024 #include <string> 00025 00026 #include "element.h" 00027 #include "spreadsheet.h" 00028 00029 class Sheet : public Element 00030 { 00031 public: 00032 Sheet( Spreadsheet &spreadsheet, 00033 const std::string &name ) 00034 : Element( spreadsheet ), 00035 _name( name ), 00036 _columns( 0 ), 00037 _rows( 0 ) 00038 { 00039 _ostream << "<sheet name=\"" << _name << "\">"; 00040 } 00041 00042 virtual void close_() 00043 { 00044 _ostream << "</sheet>"; 00045 } 00046 00047 ~Sheet() 00048 { 00049 close(); 00050 } 00051 00052 const char* get_name() const 00053 { 00054 return _name.c_str(); 00055 } 00056 00057 unsigned int get_columns() const 00058 { 00059 return _columns; 00060 } 00061 00062 unsigned int get_rows() const 00063 { 00064 return _rows; 00065 } 00066 00067 void add_column() 00068 { 00069 ++_columns; 00070 } 00071 00072 void add_row() 00073 { 00074 ++_rows; 00075 } 00076 00077 private: 00078 std::string _name; 00079 00080 unsigned int _columns, 00081 _rows; 00082 }; 00083 00084 #endif // SHEET_H