kwdwriter.h
1/***************************************************************************
2 kwdwriter.h - description
3 -------------------
4 begin : Wed Sep 5 2001
5 copyright : (C) 2001 by Frank Dekervel
6 email : Frank.Dekervel@student.kuleuven.ac.be
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU Lesser General Public License as *
13 * published by *
14 * the Free Software Foundation; either version 2 of the License, or *
15 * (at your option) any later version. *
16 * *
17 ***************************************************************************/
18
19#ifndef KWDWRITER_H
20#define KWDWRITER_H
21
22
23#include <tqrect.h>
24#include <KoStore.h>
25#include <tqdom.h>
26
32class KoTextZoomHandler;
33
34class KWDWriter {
35public:
36 KWDWriter(KoStore *store);
37 ~KWDWriter();
38
39
43 bool writeDoc();
44
45
49 TQDomElement addFrameSet(TQDomElement parent, int frametype=1,
50 int frameinfo=0, TQString name=TQString(),
51 int visible=1);
52
57 bool isInTable() const;
58
62 int createTable();
63
64
68 TQDomElement createTableCell(int tableno, int nrow,
69 int ncol, int colspan, TQRect rect);
70
71
72
76 TQDomElement fetchTableCell(int tableno, int rowno, int colno);
77
78
84 void finishTable(int tableno, TQRect rect);
85 void finishTable(int tableno);
86
92 void createInline(TQDomElement paragraph, TQDomElement toInline);
93
94
98 void createHR(TQDomElement paragraph, int width=1);
99
103 TQDomElement currentLayout(TQDomElement paragraph);
104
108 TQDomElement addFrame(TQDomElement frameset, TQRect rect, int runaround=0, int copy=0,
109 //int top=42, int left=28, int bottom=799, int right=567,
110 int newFrameBehaviour=0, int runaroundGap=2
111 );
112
113
117 TQDomElement addParagraph(TQDomElement parent);
118 TQDomElement addParagraph(TQDomElement parent, TQDomElement layout);
119
123 TQDomElement formatAttribute(TQDomElement paragraph, TQString name, TQString attrName, TQString attr);
124
128 TQString getLayoutAttribute(TQDomElement paragraph, TQString name, TQString attrName);
129
130
134 TQDomElement layoutAttribute(TQDomElement paragraph, TQString name, TQString attrName, TQString attr);
135
140 TQDomElement startFormat(TQDomElement paragraph);
141 TQDomElement startFormat(TQDomElement paragraph, TQDomElement formatToClone);
142
143
148 void cleanUpParagraph(TQDomElement paragraph);
149
153 void addText(TQDomElement paragraph, TQString text, int format_id, bool keep_formatting=false);
154
159 TQDomElement currentFormat(TQDomElement paragraph, bool start_new_one=false);
160
164 TQDomElement createLink(TQDomElement paragraph, TQString linkName, TQString hrefName);
165
169 TQDomElement setLayout(TQDomElement paragraph, TQDomElement layout);
170
174 TQString getText(TQDomElement paragraph);
175
179 TQRect getRect(TQDomElement frameset);
180
184 TQDomElement mainFrameset();
185
189 void createDocInfo(TQString author, TQString title);
190
194 TQDomElement docroot();
195
199 void appendKWordVariable(TQDomDocument& doc, TQDomElement& format,
200 const TQString& text, const TQString& key, int type, TQDomElement& child);
201
202private:
206 void addRect(TQDomElement e, TQRect rect);
207
208
209protected:
210 KoStore *_store;
211 TQDomElement _mainFrameset;
212 TQDomDocument *_doc;
213 TQDomDocument *_docinfo;
214 TQDomElement _docinfoMain;
215 KoTextZoomHandler *_zoomhandler;
216 int tableNo;
217 bool insidetable;
218
219};
220
221#endif