1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
/* This file is part of the KDE project
Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef docstruct_h
#define docstruct_h
#include <tdelistview.h>
#include <tqwidget.h>
class KWDocument;
class KWFormulaFrameSet;
class KWPictureFrameSet;
class KWPartFrameSet;
class KWGUI;
class TQWidget;
class TQVBoxLayout;
class KWFrame;
class KWFrameSet;
class KWTextParag;
/******************************************************************/
/* Class: KWOrderedFrameSet */
/******************************************************************/
/** Provides a way to sort framesets using a TQValueList based on their top left corner. */
class KWOrderedFrameSet
{
public:
KWOrderedFrameSet(KWFrameSet* fs);
KWOrderedFrameSet(); // default constructor
bool operator<( KWOrderedFrameSet ofs);
KWFrameSet* frameSet() { return m_frameset; }
private:
KWFrameSet* m_frameset;
};
class KWDocListViewItem : public TDEListViewItem
{
public:
enum ItemType {
IT_BASE = FT_BASE,
IT_TEXT = FT_TEXT,
IT_PICTURE = FT_PICTURE,
IT_PART = FT_PART,
IT_FORMULA = FT_FORMULA,
IT_CLIPART = FT_CLIPART,
IT_TABLE = FT_TABLE,
IT_ROOT = 11,
IT_TEXTFRAME = 12,
IT_PARAG = 13
};
KWDocListViewItem(TQListViewItem *_parent, const TQString &_text);
KWDocListViewItem(TQListViewItem *_parent, TQListViewItem *_after, const TQString &_text);
KWDocListViewItem(TQListView *_parent, const TQString &_text);
virtual ItemType itemType() { return IT_BASE; }
virtual void selectItem() {}
virtual void editItem() {}
virtual void deleteItem() {}
virtual void editProperties() {}
virtual void speakItem() {}
virtual void contextMenu(TQListViewItem *, const TQPoint &, int) {}
protected:
KWDocument* doc();
KWGUI* gui();
void deleteAllChildren();
};
/******************************************************************/
/* Class: KWDocStructParagItem */
/******************************************************************/
class KWDocStructParagItem : public KWDocListViewItem
{
public:
KWDocStructParagItem(TQListViewItem* parent, const TQString& text, KWTextParag* parag);
KWDocStructParagItem(TQListViewItem* parent, TQListViewItem* after, const TQString& text, KWTextParag* parag);
virtual ItemType itemType() { return IT_PARAG; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void speakItem();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
KWTextParag* parag() const { return m_parag; }
protected:
KWTextParag* m_parag;
};
/******************************************************************/
/* Class: KWDocStructTextFrameItem */
/******************************************************************/
class KWDocStructTextFrameItem : public KWDocListViewItem
{
public:
KWDocStructTextFrameItem(TQListViewItem* parent, const TQString& text,
KWTextFrameSet* frameset, KWFrame* frame );
KWDocStructTextFrameItem(TQListViewItem* parent, TQListViewItem* after, const TQString& text,
KWTextFrameSet* frameset, KWFrame* frame );
virtual int ItemType() { return IT_TEXTFRAME; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void speakItem();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
KWFrame* frame() const { return m_frame; }
KWTextFrameSet* frameSet() const { return m_frameset; };
void setupTextParags();
KWDocStructParagItem* findTextParagItem(const KWTextParag* parag);
protected:
KWFrame* m_frame;
KWTextFrameSet* m_frameset;
};
/******************************************************************/
/* Class: KWDocStructTextFrameSetItem */
/******************************************************************/
class KWDocStructTextFrameSetItem : public KWDocListViewItem
{
public:
KWDocStructTextFrameSetItem(TQListViewItem* parent, const TQString& text, KWTextFrameSet* frameset);
KWDocStructTextFrameSetItem(TQListViewItem* parent, TQListViewItem* after, const TQString& text,
KWTextFrameSet* frameset );
virtual int ItemType() { return IT_TEXT; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void speakItem();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
KWTextFrameSet* frameSet() const { return m_frameset; };
void setupTextFrames();
KWDocStructTextFrameItem* findTextFrameItem(const KWFrame* frame);
protected:
KWTextFrameSet* m_frameset;
};
/******************************************************************/
/* Class: KWDocStructTableItem */
/******************************************************************/
class KWDocStructTableItem : public KWDocListViewItem
{
public:
KWDocStructTableItem(TQListViewItem* parent, const TQString& text, KWTableFrameSet* table );
KWDocStructTableItem(TQListViewItem* parent, TQListViewItem* after, const TQString& text,
KWTableFrameSet* table );
virtual int ItemType() { return IT_TABLE; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void speakItem();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
KWTableFrameSet* table() const { return m_table; };
void setupCells();
KWDocStructTextFrameItem* findCellItem(const KWTextFrameSet* cell);
protected:
KWTableFrameSet* m_table;
};
/******************************************************************/
/* Class: KWDocStructFormulaItem */
/******************************************************************/
class KWDocStructFormulaItem : public KWDocListViewItem
{
public:
KWDocStructFormulaItem(TQListViewItem* parent, const TQString& text, KWFormulaFrameSet* form);
virtual int ItemType() { return IT_FORMULA; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void speakItem();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
protected:
KWFormulaFrameSet* m_form;
};
/******************************************************************/
/* Class: KWDocStructPictureItem */
/******************************************************************/
class KWDocStructPictureItem : public KWDocListViewItem
{
public:
KWDocStructPictureItem(TQListViewItem* parent, const TQString& text, KWPictureFrameSet* pic);
virtual int ItemType() { return IT_PICTURE; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
protected:
KWPictureFrameSet* m_pic;
};
/******************************************************************/
/* Class: KWDocStructPartItem */
/******************************************************************/
class KWDocStructPartItem : public KWDocListViewItem
{
public:
KWDocStructPartItem(TQListViewItem* parent, const TQString& text, KWPartFrameSet* part);
virtual int ItemType() { return IT_PART; }
virtual void selectItem();
virtual void editItem();
virtual void deleteItem();
virtual void editProperties();
virtual void contextMenu(TQListViewItem* item, const TQPoint& p, int);
protected:
KWPartFrameSet* m_part;
};
/******************************************************************/
/* Class: KWDocStructRootItem */
/******************************************************************/
class KWDocStructRootItem : public KWDocListViewItem
{
public:
KWDocStructRootItem(TQListView* parent, const TQString& text, TypeStructDocItem type);
virtual int ItemType() { return IT_ROOT; }
void setupArrangement();
void setupTextFrameSets();
void setupTables();
void setupPictures();
void setupEmbedded();
void setupFormulaFrames();
virtual void setOpen(bool o);
protected:
KWDocStructTextFrameSetItem* findTextFrameSetItem(const KWFrameSet* frameset);
KWDocStructTableItem* findTableItem(const KWFrameSet* frameset);
TypeStructDocItem m_type;
};
/******************************************************************/
/* Class: KWDocStructTree */
/******************************************************************/
class KWDocStructTree : public TDEListView
{
Q_OBJECT
public:
KWDocStructTree( TQWidget* parent, KWDocument* doc, KWGUI* gui );
~KWDocStructTree();
void setup();
void refreshTree(int _type);
TQSize minimumSizeHint() const {
return TQSize( 0, 0 );
}
void selectItem();
void editItem();
void deleteItem();
void editProperties();
void speakItem();
KWDocument* doc() { return m_doc; };
KWGUI* gui() { return m_gui; };
public slots:
void slotContextMenu(TDEListView* l, TQListViewItem* i, const TQPoint& p);
void slotRightButtonClicked(TQListViewItem*, const TQPoint&, int);
void slotDoubleClicked(TQListViewItem* item);
void slotReturnPressed(TQListViewItem* item);
protected:
KWDocument* m_doc;
KWGUI* m_gui;
KWDocStructRootItem *arrangement, *tables, *pictures, *textfrms, *embedded, *formulafrms;
};
/******************************************************************/
/* Class: KWDocStruct */
/******************************************************************/
class KWDocStruct : public TQWidget
{
Q_OBJECT
public:
KWDocStruct( TQWidget* parent, KWDocument* doc, KWGUI* gui );
void selectItem();
void editItem();
void deleteItem();
void editProperties();
void speakItem();
/** Refresh the specified branches of the tree. Actual refreshing is deferred
until the paint event. */
void refreshTree(int _type);
/** Set focus to the tree, if visible. */
void setFocusHere();
public slots:
/** Refresh the entire tree. */
void refreshEntireTree();
protected:
KWDocStructTree* m_tree;
TQVBoxLayout* m_layout;
virtual void paintEvent(TQPaintEvent* ev);
KWDocument* m_doc;
KWGUI* m_gui;
int dirtyTreeTypes;
};
#endif
|