KWEFStructures.h
1/*
2 This file is part of the KDE project
3 Copyright (C) 2001, 2002, 2004 Nicolas GOUTTE <goutte@kde.org>
4 Copyright (c) 2001 IABG mbH. All rights reserved.
5 Contact: Wolf-Michael Bolle <Bolle@IABG.de>
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 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21*/
22
23/*
24 The classes in this file are based on a class in the old files:
25 /home/kde/koffice/filters/kword/ascii/asciiexport.cpp
26 /home/kde/koffice/filters/kword/docbookexpert/docbookexport.cpp
27
28 The old file was copyrighted by
29 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
30 Copyright (c) 2000 ID-PRO Deutschland GmbH. All rights reserved.
31 Contact: Wolf-Michael Bolle <Wolf-Michael.Bolle@GMX.de>
32*/
33
34/*
35 Part of the code is based on code licensed under the terms of the
36 GNU Library General Public License version 2:
37 Copyright 2001 Michael Johnson <mikej@xnet.com>
38*/
39
40#ifndef EXPORTFILTERSSTRUCTURES_H
41#define EXPORTFILTERSSTRUCTURES_H
42
43#include <tqvaluelist.h>
44#include <tqstring.h>
45#include <tqmap.h>
46#include <tqcolor.h>
47#include <tqdom.h>
48#include <tqdatetime.h>
49
50#include <KoPictureKey.h>
51#include <koffice_export.h>
57{
58 public:
59 TextFormatting(): italic (false), underline (false), underlineWord(false),
60 strikeout (false), strikeoutWord( false ),
61 weight (50), fontSize (0), verticalAlignment (0), missing (true) {}
62
63 TextFormatting(const bool newMissing) : italic (false),
64 underline (false), underlineWord(false), strikeout (false), strikeoutWord( false ),
65 weight (50), fontSize (0), verticalAlignment (0),
66 missing (newMissing) {}
67
68 TextFormatting ( TQString f,
69 bool i,
70 bool u,
71 bool s,
72 int w,
73 int sz,
74 TQColor fg,
75 TQColor bg,
76 int v) :
77 fontName (f), italic (i), underline (u), underlineWord(false),
78 strikeout(s), strikeoutWord( false ),
79 weight (w), fontSize (sz), fgColor (fg),
80 bgColor (bg), verticalAlignment (v), missing (false) {}
81
82 TQString fontName;
83
84 bool italic;
85
86 bool underline;
87
88 TQString underlineValue;
89 TQString underlineStyle;
92
93 bool strikeout;
94 TQString strikeoutType;
97
98 int weight;
99 int fontSize;
100 TQColor fgColor;
101 TQColor bgColor;
102 int verticalAlignment;
103
104 TQString fontAttribute;
109 TQString language;
110
111 bool missing;
112};
113
114
115class Picture
116{
117 public:
118 Picture () {}
119
120 KoPictureKey key;
121 TQString koStoreName;
122};
123
130{
131public:
132 double right;
133 double left;
134 double top;
135 double bottom;
136 double minHeight;
137 int runaround;
138 TQString runaroundSide;
139 double runaroundGap;
140 int autoCreateNewFrame;
141 int newFrameBehavior;
142 int copy;
143 int sheetSide;
144
145 double lWidth, rWidth, tWidth, bWidth;
146
147 TQColor lColor;
148 TQColor rColor;
149 TQColor tColor;
150 TQColor bColor;
151
152 int lStyle, rStyle, tStyle, bStyle;
153
154 TQColor bkColor;
155 int bkStyle;
156 double bleftpt, brightpt, btoppt, bbottompt;
157};
158
159
160class ParaData;
161
162class KOFFICEFILTER_EXPORT TableCell
163{
164 public:
165 TableCell (): col( 0 ), row( 0 ), m_cols( 0 ), m_rows( 0 ), paraList( 0 ) {}
166
168 TableCell ( int c, int r, int _cols, int _rows, TQValueList<ParaData> *p, FrameData &frameData )
169 : col (c), row (r), m_cols( _cols ), m_rows( _rows ), paraList (p), frame (frameData) {}
170
171 ~TableCell ();
172
173 int col;
174 int row;
175 int m_cols;
176 int m_rows;
177 TQValueList<ParaData> *paraList;
178 FrameData frame;
179};
180
181
182class Table
183{
184 public:
185 Table () : cols (0) {}
186
188 void addCell ( int c, int r, int _cols, int _rows, TQValueList<ParaData> &p, FrameData &frameData );
189
190 int cols;
191 TQValueList<TableCell> cellList;
192};
193
194
197{
198 public:
199 FrameAnchor ():
200 type(-1) {}
201
202 FrameAnchor ( const KoPictureKey& n ) : key (n), type (-1) {}
203
204 KoPictureKey key;
205 int type;
206 FrameData frame;
207
208 Picture picture;
209 Table table;
210};
211
215class KOFFICEFILTER_EXPORT VariableData
216{
217public:
218 VariableData (): m_type(-1), footnotePara(0) {}
219 VariableData ( const TQString& text ) : m_text(text), m_type(-1) {}
220 VariableData ( const VariableData& other ) :
221 m_key(other.m_key), m_text(other.m_text),
222 m_type(other.m_type), propertyMap(other.propertyMap),
223 footnotePara(other.footnotePara) {}
224public:
228 void setLink(const TQString& linkName, const TQString& hrefName);
229 TQString getLinkName(void) const;
230 TQString getHrefName(void) const;
234 void setPgNum(const TQString& subtype, const TQString& value);
235 bool isPageNumber(void) const;
236 bool isPageCount(void) const;
240 void setField(const TQString& subtype, const TQString& value);
241 TQString getFieldName(void) const;
242 TQString getFieldValue(void) const;
247 void setFootnote( const TQString& notetype, const TQString& automatic, const TQString& value, TQValueList<ParaData>* para );
252 bool getFootnoteAuto(void) const;
254 TQString getFootnoteValue(void) const;
260 bool getFootnoteType( void ) const;
262 TQValueList<ParaData>* getFootnotePara(void) const;
263
268 void setGenericData( const TQString& key, const TQString& data );
273 TQString getGenericData( const TQString& key ) const;
274
275 TQString m_key;
276 TQString m_text;
277 int m_type;
278
279protected:
280 TQMap<TQString,TQString> propertyMap;
281 TQValueList<ParaData>* footnotePara;
282};
283
284class FormatData
285{
286public:
287 FormatData ()
288 : id (-1), pos (-1), len (-1), text(true) {}
289
290 FormatData ( const int p, const int l, const bool missing )
291 : id (1), pos (p), len (l), text(missing) {}
292
293 FormatData ( const int i, const int p, const int l )
294 : id (i), pos (p), len (l), text(false) {}
295
296 FormatData ( const int p, const int l, const FrameAnchor& t )
297 : id (6), pos (p), len (l), frameAnchor (t) {}
298
299 FormatData ( const FormatData& other )
300 : id(other.id), pos(other.pos), len(other.len),
301 text(other.text), frameAnchor(other.frameAnchor), variable(other.variable) {}
302public:
303 int id;
304 int pos;
305 int len;
306
307 TextFormatting text;
308 FrameAnchor frameAnchor;
309 VariableData variable;
310};
311
312
313class ValueListFormatData : public TQValueList<FormatData>
314{
315public:
316 ValueListFormatData (void) { }
317 virtual ~ValueListFormatData (void) { }
318};
319
320
323{
324public:
326 : numbering (NUM_NONE), style (STYLE_NONE), depth(0), start(0), customCharacter(0)
327 {}
328
330 {
333 NUM_NONE = 2
334 };
335
336 enum Style
337 {
338 STYLE_NONE = 0,
339 STYLE_NUM = 1,
340 STYLE_ALPHAB_L = 2,
341 STYLE_ALPHAB_U = 3,
342 STYLE_ROM_NUM_L = 4,
343 STYLE_ROM_NUM_U = 5,
344 STYLE_CUSTOMBULLET = 6,
345 STYLE_CUSTOM = 7,
346 STYLE_CIRCLEBULLET = 8,
347 STYLE_SQUAREBULLET = 9,
348 STYLE_DISCBULLET = 10,
349 STYLE_BOXBULLET = 11
350 };
351
352 Numbering numbering;
353 Style style;
354 /*unsigned*/ int depth;
355 int start;
356 TQString lefttext;
357 TQString righttext;
358
359 int /*TQChar*/ customCharacter;
360 TQString customFont;
361 //TQString custom;
362
363 TQString text;
364};
365
366
369{
370public:
371 BorderData() : style(0), width(0.0) {}
372public:
373 TQColor color;
374 int style;
375 double width;
376};
377
381class KOFFICEFILTER_EXPORT TabulatorData
382{
383public:
384
385 enum
386 {
387 TF_NONE = 0,
388 TF_DOT = 1,
389 TF_LINE = 2,
390 TF_DASH = 3,
391 TF_DASHDOT = 4,
392 TF_DASHDOTDOT = 5
393 };
394
395 TabulatorData() : m_type(0), m_ptpos(0.0), m_filling(0), m_width(0.0) {}
396public:
397 bool operator == (const TabulatorData& other) const;
398public:
399 int m_type;
400 double m_ptpos;
401 int m_filling;
402 double m_width;
403};
404
408class TabulatorList : public TQValueList<TabulatorData>
409{
410public:
411 TabulatorList(void) {}
412 virtual ~TabulatorList(void) {}
413};
414
417{
418public:
419 LayoutData():indentFirst(0.0), indentLeft(-1.0), indentRight(-1.0), marginTop(-1.0), marginBottom(-1.0),
420 lineSpacingType(10), lineSpacing(0.0), pageBreakBefore(false), pageBreakAfter(false),
421 keepLinesTogether(false),
423 { }
424
425
426 enum { LS_CUSTOM = 0, LS_SINGLE = 10, LS_ONEANDHALF = 15, LS_DOUBLE = 20,
427 LS_ATLEAST = 30, LS_MULTIPLE = 40, LS_FIXED = 50 };
428
429 TQString styleName;
430 TQString styleFollowing;
431 TQString alignment;
432 CounterData counter;
433 FormatData formatData;
434 double indentFirst;
435 double indentLeft;
436 double indentRight;
437 double marginTop;
439
441 double lineSpacing;
442
443 bool pageBreakBefore;
444 bool pageBreakAfter;
445 bool keepLinesTogether;
446
449 TQColor shadowColor;
450 BorderData leftBorder;
451 BorderData rightBorder;
452 BorderData topBorder;
453 BorderData bottomBorder;
455};
456
457
458struct ParaData
459{
460 TQString text;
461 ValueListFormatData formattingList;
462 LayoutData layout;
463};
464
465struct HeaderFooterData
466{
467 enum HeaderFooterPage
468 {
469 PAGE_FIRST,
470 PAGE_ODD,
471 PAGE_EVEN,
472 PAGE_ALL
473 };
474
475 HeaderFooterPage page;
476 TQValueList<ParaData> para;
477};
478
479typedef HeaderFooterData HeaderData;
480typedef HeaderFooterData FooterData;
481
484{
485 TQString frameName;
486 TQValueList<ParaData> para;
487};
488
491{
492public:
493 VariableSettingsData () : startingPageNumber (1),
494 displaylink (true),
495 underlinelink (true),
496 displaycomment (true),
497 displayfieldcode (false)
498 {
499 }
500
501 int startingPageNumber;
502 bool displaylink;
503 bool underlinelink;
504 bool displaycomment;
505 bool displayfieldcode;
506 TQDateTime creationTime;
507 TQDateTime modificationTime;
508 TQDateTime printTime;
509};
510
511class KWEFDocumentInfo
512{
513public:
514 KWEFDocumentInfo(void) { } // Initiate all TQString
515public:
516 // <ABOUT>
517 TQString title;
518 TQString abstract;
519 TQString keywords;
520 TQString subject;
521 // <AUTHOR>
522 TQString fullName;
523 TQString jobTitle;
524 TQString company;
525 TQString email;
526 TQString telephone;
527 TQString fax;
528 TQString country;
529 TQString postalCode;
530 TQString city;
531 TQString street;
532 TQString initial;
533 TQString position;
534 TQString telephonework;
535};
536
539{
540public:
541 Bookmark();
543 TQString m_name;
545 TQString m_frameset;
554};
555
556// Helper functions
557
558void CreateMissingFormatData ( TQString &paraText, ValueListFormatData &paraFormatDataList );
559
560#endif /* EXPORTFILTERSSTRUCTURES_H */
TQString m_name
Bookmark name.
int m_startparag
Number of the paragrapgh where the booksmark starts.
int m_cursorIndexStart
Position where the bookmark starts in the paragraph.
int m_cursorIndexEnd
Position where the bookmark ends in the paragraph.
TQString m_frameset
Name of the frameset where the bookmark is.
int m_endparag
Number of the paragrapgh where the booksmark starts.
Counter structure, for LayoutData.
TQString text
text at the time of saving (no formatting info though)
@ NUM_NONE
No counter.
@ NUM_LIST
Numbered as a list item.
@ NUM_CHAPTER
Numbered as a heading.
This is basically <FRAMESET> tag.
KoPictureKey key
Picture key.
For <FRAME> Tag.
Paragraph layout.
double lineSpacing
Space between lines in pt, if lineSpacingType==0.
int shadowDirection
direction of <SHADOW>
TabulatorList tabulatorList
List of tabulators.
TQColor shadowColor
red, green, blue of <SHADOW>
double indentFirst
indentation correction of first line (can be negative!)
double indentRight
right indentation (a negative value means invalid)
double shadowDistance
distance of <SHADOW>
double indentLeft
left indentation (a negative value means invalid)
TQString alignment
left, right, center, justify
int lineSpacingType
0=custom, 10=one line, 15=one and half lines, 20= 2 lines
double marginTop
space before the paragraph (a negative value means invalid)
double marginBottom
space after the paragraph (a negative value means invalid)
This class hold a table.
Table()
Constructors.
void addCell(int c, int r, int _cols, int _rows, TQValueList< ParaData > &p, FrameData &frameData)
Tabulator (see also <TABULATOR> element in KWord's DTD)
List of tabulators.
TextFormatting is a container for data retrieved from the <FORMAT> tag and its subtags to be used in ...
bool underlineWord
true if word-by-word (i.e spaces are not underlined)
bool underline
Any underline? (If true, we do not know if simple or double or what else)
TQString language
Language code.
TQColor underlineColor
color of the line
bool strikeout
true if strikeout
TQString underlineStyle
underline style: solid, dash, dot dash, ....
TQString underlineValue
"value" of the underline: single, double, bold-single...
bool missing
true if this TextFormatting object does not correspond to a real <FORMAT> element
TQString strikeoutLineStyle
type of the strikeout line: solid, dash, dot, ....
TQString strikeoutType
type of strikeout: single, bold, double
Data of variables.
see <VARIABLESETTINGS> in the KWord DTD
data for <FRAMESET> which holds footnotes