filters
workbook.h
00001 /* Swinder - Portable library for spreadsheet 00002 Copyright (C) 2003-2005 Ariya Hidayat <ariya@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA 00018 */ 00019 00020 #ifndef SWINDER_WORKBOOK_H 00021 #define SWINDER_WORKBOOK_H 00022 00023 #include "format.h" 00024 00025 namespace Swinder 00026 { 00027 00028 class Sheet; 00029 00030 class Workbook 00031 { 00032 public: 00033 00034 /* 00035 * Constructs a new workbook. 00036 */ 00037 00038 Workbook(); 00039 00040 /* 00041 * Destroys the workbook. 00042 */ 00043 00044 virtual ~Workbook(); 00045 00046 /* 00047 * Clears the workbook, i.e. makes it as if it is just constructed. 00048 */ 00049 void clear(); 00050 00051 /* 00052 * Loads the workbook from file. Returns false if error occurred. 00053 */ 00054 bool load( const char* filename ); 00055 00056 /* 00057 * Appends a new sheet. 00058 */ 00059 void appendSheet( Sheet* sheet ); 00060 00061 /* 00062 * Returns the number of worksheet in this workbook. A newly created 00063 * workbook has no sheet, i.e. sheetCount() returns 0. 00064 */ 00065 unsigned sheetCount() const; 00066 00067 /* 00068 * Returns a worksheet at given index. If index is invalid (e.g. larger 00069 * than total number of worksheet), this function returns NULL. 00070 */ 00071 Sheet* sheet( unsigned index ); 00072 00073 /* 00074 * Returns the index (zero-based) of the specified sheet, or -1 if 00075 * the sheet is not inside the workbook. 00076 */ 00077 int indexOf(Sheet *sheet); 00078 00079 /* 00080 * Returns true if automatic calculation is enabled. 00081 */ 00082 bool autoCalc() const; 00083 00084 /* 00085 * Sets the automatic calculation. 00086 */ 00087 void setAutoCalc( bool a ); 00088 00089 00090 bool isPasswordProtected() const; 00091 void setPasswordProtected( bool p ); 00092 00093 void setFormat(int index, const Format& format); 00094 const Format& format(int index) const; 00095 const int maxFormatIndex() const; 00096 00097 private: 00098 // no copy or assign 00099 Workbook( const Workbook& ); 00100 Workbook& operator=( const Workbook& ); 00101 00102 class Private; 00103 Private* d; 00104 }; 00105 00106 } 00107 00108 00109 #endif // SWINDER_WORKBOOK_H