kspread

kspread_map.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@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 __kspread_map_h__
21#define __kspread_map_h__
22
23#include <tqcstring.h>
24#include <tqptrlist.h>
25#include <tqstring.h>
26#include <tqstringlist.h>
27#include <tqintdict.h>
28#include <tqobject.h>
29#include <tqdict.h>
30
31#include <koffice_export.h>
32
33class KoStore;
34class KoOasisLoadingContext;
35class KoOasisStyles;
36
37class DCOPObject;
38
39class TQDomElement;
40class TQDomDocument;
41class KoXmlWriter;
42class KoGenStyles;
43class KoOasisSettings;
44
45namespace KSpread
46{
47class Changes;
48class Map;
49class Doc;
50class Sheet;
51class GenValidationStyles;
52class Style;
53
58class KSPREAD_EXPORT Map : public TQObject
59{
60TQ_OBJECT
61
62public:
66 Map(Doc* doc, const char* name = 0);
70 virtual ~Map();
71
72 Doc* doc() const;
73
74 TQDomElement save( TQDomDocument& doc );
75
76 void saveOasisSettings( KoXmlWriter &settingsWriter );
77 void loadOasisSettings( KoOasisSettings &settings );
78
79 bool saveOasis( KoXmlWriter & xmlWriter, KoGenStyles & mainStyles, KoStore *store, KoXmlWriter* manifestWriter, int &_indexObj, int &_partIndexObj );
80
81 bool loadOasis( const TQDomElement& mymap, KoOasisLoadingContext& oasisContext );
82 bool loadXML( const TQDomElement& mymap );
83 bool loadChildren( KoStore* _store );
84
85 bool saveChildren( KoStore* _store );
86
87 void password( TQCString & passwd ) const { passwd = m_strPassword; }
88 bool isProtected() const { return !m_strPassword.isNull(); }
89 void setProtected( TQCString const & passwd );
90 bool checkPassword( TQCString const & passwd ) const { return ( passwd == m_strPassword ); }
91
97 void moveSheet( const TQString & _from, const TQString & _to, bool _before = true );
98
103 Sheet* findSheet( const TQString & _name );
104 Sheet* nextSheet( Sheet* );
105 Sheet* previousSheet( Sheet* );
106
107 Sheet* initialActiveSheet()const { return m_initialActiveSheet; }
108 int initialMarkerColumn() const { return m_initialMarkerColumn; }
109 int initialMarkerRow() const { return m_initialMarkerRow; }
110 double initialXOffset() const { return m_initialXOffset; }
111 double initialYOffset() const { return m_initialYOffset; }
112
113
118 Sheet * createSheet();
120 void addSheet( Sheet *_sheet );
121
123 Sheet *addNewSheet ();
124
131 Sheet* firstSheet() { return m_lstSheets.first(); }
132
139 Sheet* lastSheet() { return m_lstSheets.last(); }
140
147 Sheet* nextSheet() { return m_lstSheets.next(); }
148
149 TQPtrList<Sheet>& sheetList() { return m_lstSheets; }
150
154 int count()const { return m_lstSheets.count(); }
155
156 void update();
157
161 // void draw( TQPaintDevice* _dev, long int _width, long int _height,
162 // float _scale );
163
164 virtual DCOPObject* dcopObject();
165
166 void takeSheet( Sheet * sheet );
167 void insertSheet( Sheet * sheet );
168
169 TQStringList visibleSheets() const;
170 TQStringList hiddenSheets() const;
171
172 static bool respectCase;
173
174signals:
175
179 void sig_addSheet( Sheet *_table );
180private:
181
182 Doc* m_doc;
183
187 TQPtrList<Sheet> m_lstSheets;
188 TQPtrList<Sheet> m_lstDeletedSheets;
189
193 TQCString m_strPassword;
197 Sheet * m_initialActiveSheet;
198 int m_initialMarkerColumn;
199 int m_initialMarkerRow;
200 double m_initialXOffset;
201 double m_initialYOffset;
202
203 // used to give every Sheet a unique default name.
204 int tableId;
205
206 DCOPObject* m_dcop;
207};
208
209} // namespace KSpread
210
211#endif
This class holds the data that makes up a spreadsheet.
Definition kspread_doc.h:98
A map is a simple container for all sheets.
Definition kspread_map.h:59
int count() const
Sheet * findSheet(const TQString &_name)
searches for a sheet named _name
Sheet * addNewSheet()
add a new sheet to the map, returning a pointer to it
void addSheet(Sheet *_sheet)
add sheet to the map, making it active
Sheet * lastSheet()
Use the previousSheet() function to get all the other sheets.
Sheet * firstSheet()
Use the nextSheet function to get all the other sheets.
void sig_addSheet(Sheet *_table)
Emitted if a new table is added to the document.
Map(Doc *doc, const char *name=0)
Created an empty map.
Sheet * createSheet()
void moveSheet(const TQString &_from, const TQString &_to, bool _before=true)
The sheet named _from is being moved to the sheet _to.
Sheet * nextSheet()
Call firstSheet first.
The Style class represents a cell style.
The KSpread namespace.
Definition commands.h:39