filters

workbook.h
1/* Swinder - Portable library for spreadsheet
2 Copyright (C) 2003-2005 Ariya Hidayat <ariya@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA
18*/
19
20#ifndef SWINDER_WORKBOOK_H
21#define SWINDER_WORKBOOK_H
22
23#include "format.h"
24
25namespace Swinder
26{
27
28class Sheet;
29
30class Workbook
31{
32public:
33
34 /*
35 * Constructs a new workbook.
36 */
37
38 Workbook();
39
40 /*
41 * Destroys the workbook.
42 */
43
44 virtual ~Workbook();
45
46 /*
47 * Clears the workbook, i.e. makes it as if it is just constructed.
48 */
49 void clear();
50
51 /*
52 * Loads the workbook from file. Returns false if error occurred.
53 */
54 bool load( const char* filename );
55
56 /*
57 * Appends a new sheet.
58 */
59 void appendSheet( Sheet* sheet );
60
61 /*
62 * Returns the number of worksheet in this workbook. A newly created
63 * workbook has no sheet, i.e. sheetCount() returns 0.
64 */
65 unsigned sheetCount() const;
66
67 /*
68 * Returns a worksheet at given index. If index is invalid (e.g. larger
69 * than total number of worksheet), this function returns NULL.
70 */
71 Sheet* sheet( unsigned index );
72
73 /*
74 * Returns the index (zero-based) of the specified sheet, or -1 if
75 * the sheet is not inside the workbook.
76 */
77 int indexOf(Sheet *sheet);
78
79 /*
80 * Returns true if automatic calculation is enabled.
81 */
82 bool autoCalc() const;
83
84 /*
85 * Sets the automatic calculation.
86 */
87 void setAutoCalc( bool a );
88
89
90 bool isPasswordProtected() const;
91 void setPasswordProtected( bool p );
92
93 void setFormat(int index, const Format& format);
94 const Format& format(int index) const;
95 const int maxFormatIndex() const;
96
97private:
98 // no copy or assign
99 Workbook( const Workbook& );
100 Workbook& operator=( const Workbook& );
101
102 class Private;
103 Private* d;
104};
105
106}
107
108
109#endif // SWINDER_WORKBOOK_H