listeformat.h
1
2/*
3** Header file for inclusion with kword_xml2latex.c
4**
5** Copyright (C) 2000 Robert JACOLIN
6**
7** This library is free software; you can redistribute it and/or
8** modify it under the terms of the GNU Library General Public
9** License as published by the Free Software Foundation; either
10** version 2 of the License, or (at your option) any later version.
11**
12** This library is distributed in the hope that it will be useful,
13** but WITHOUT ANY WARRANTY; without even the implied warranty of
14** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15** Library General Public License for more details.
16**
17** To receive a copy of the GNU Library General Public License, write to the
18** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20**
21*/
22
23
24#ifndef __KWORD_LISTEFORMAT_H__
25#define __KWORD_LISTEFORMAT_H__
26
27#include "format.h"
28
29class FormatElt
30{
31 Format* _format;
32 FormatElt* _next;
33
34 private:
35
36 protected:
37
38 public:
44 FormatElt() {
45 _format = 0;
46 _next = 0;
47 }
48
50 FormatElt(FormatElt * eltt) {
51 _format = eltt->getFormat();
52 _next = eltt->getNext();
53 }
55
61 virtual ~FormatElt();
63
68 Format* getFormat () const { return _format; }
69 FormatElt* getNext () const { return _next; }
71
76 void setFormat (Format*);
77 void remFormat ();
78 void setNext (FormatElt*);
79 void remNext ();
81
87 FormatElt& operator = (const FormatElt &);
89
93
95};
96
97class ListeFormat
98{
99 //TQString _texte;
100
101 private:
102 FormatElt* _first;
103 FormatElt* _end;
104 int _size;
105
106 protected:
107
108 public:
114 ListeFormat();
116
121 virtual ~ListeFormat();
123
128 Format* getFirst () const { return _first->getFormat(); }
129 FormatElt* getFirstElt() const { return _first; }
130 Format* getLast () const { return _end->getFormat(); }
131 bool isVide () const { return (_size == 0); }
132 int getSize () const { return _size; }
134
139 void addLast (Format*);
140 void addFirst(Format*);
141 void remLast ();
142 void remFirst();
143
145
151
155 void vider(); /* Empty the list */
156
158};
159
160class FormatIter {
161 FormatElt *_courant;
162
163 protected:
164
165 public:
171 FormatIter() { _courant = 0; }
173 FormatIter(ListeFormat& l) { _courant = l.getFirstElt(); }
175 FormatIter(ListeFormat*);
177
183 virtual ~FormatIter() { }
185
190
191 Format* getCourant() const { return _courant->getFormat(); }
192 bool isTerminate() const { return (_courant == 0); }
194
199 void next () { _courant = _courant->getNext(); }
200 void setList(ListeFormat* l) { _courant = l->getFirstElt(); }
202
208
212
214
215};
216
217#endif /* __KWORD_LISTEFORMAT_H__ */
218
This class describe a cell, row or column format.