textformat.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#ifndef __KWORD_TEXTFORMAT_H__
24#define __KWORD_TEXTFORMAT_H__
25
26#include <tqstring.h>
27#include <tqcolor.h>
28#include "format.h"
29
30enum _EAlign
31{
32 EA_NONE,
33 EA_SUB,
34 EA_SUPER
35};
36
37typedef enum _EAlign EAlign;
38
39enum _ETypeUnderline
40{
41 UNDERLINE_NONE,
42 UNDERLINE_SIMPLE,
43 UNDERLINE_DOUBLE,
44 UNDERLINE_WAVE
45};
46
47typedef enum _ETypeUnderline ETypeUnderline;
48
49enum _ETypeLinespacing
50{
51 LINESPACING_NONE,
52 LINESPACING_ONEANDHALF,
53 LINESPACING_DOUBLE,
54 LINESPACING_CUSTOM,
55 LINESPACING_ATLEAST,
56 LINESPACING_MULTIPLE
57};
58
59typedef enum _ETypeLinespacing ETypeLinespacing;
60
61/***********************************************************************/
62/* Class: TextFormat */
63/***********************************************************************/
64
69class TextFormat: public Format
70{
71 TQString _police;
72 unsigned int _size; /* Size of the police */
73 unsigned int _weight; /* bold */
74 bool _italic;
75 ETypeUnderline _underline;
76 bool _strikeout;
77 EAlign _vertalign;
78 TQColor* _textcolor;
79 TQColor* _backcolor;
80 ETypeLinespacing _linespacingType;
81 int _spacingValue;
82
83 public:
90 TextFormat(): _weight(0), _italic(false),
91 _strikeout(0)
92 {
93 _textcolor = 0;
94 _backcolor = 0;
95 _size = Config::instance()->getDefaultFontSize();
96 setPos(0);
97 setLength(0);
98 setUnderlined("0");
99 }
100
101 /*
102 * Destructor
103 *
104 * The destructor must remove the list of little zones.
105 *
106 */
107 virtual ~TextFormat() {}
108
109 /* ==== Getters ==== */
110 unsigned int getSize () const { return _size; }
111 unsigned int getWeight () const { return _weight; }
112 EAlign getAlign () const { return _vertalign; }
113 int getColorBlue () const;
114 int getColorGreen() const;
115 int getColorRed () const;
116 ETypeUnderline getUnderlineType() const { return _underline; }
117
118 int getBkColorBlue () const;
119 int getBkColorGreen() const;
120 int getBkColorRed () const;
121
122 bool isItalic () const { return (_italic == true); }
123 bool isUnderlined () const { return (_underline != UNDERLINE_NONE); }
124 bool isStrikeout () const { return (_strikeout == true); }
125 bool isColor () const { return (_textcolor != 0); }
126 bool isBkColored () const { return (_backcolor != 0); }
127
128 /* ==== Setters ==== */
129 void setSize (const unsigned int t) { _size = t; }
130 void setWeight (const unsigned int w) { _weight = w; }
131 void setItalic (bool i) { _italic = i; }
132 void setUnderlined (ETypeUnderline u) { _underline = u; }
133 void setUnderlined (TQString u)
134 {
135 if(u == "double")
136 _underline = UNDERLINE_DOUBLE;
137 else if(u == "wave")
138 _underline = UNDERLINE_WAVE;
139 else if (u == "1")
140 _underline = UNDERLINE_SIMPLE;
141 else
142 _underline = UNDERLINE_NONE;
143 }
144 void setStrikeout (bool s) { _strikeout = s; }
145 void setPolice (TQString p) { _police = p; }
146 void setAlign (const int a) { _vertalign = (EAlign) a; }
147 void setColor (const int, const int, const int);
148 void setBkColor (const int, const int, const int);
149
150 /* ==== Helpfull functions ==== */
151 void analyseFormat (const TQDomNode);
152 void analyseParam (const TQDomNode);
153 void analyseFont (const TQDomNode);
154 void analyseItalic (const TQDomNode);
155 void analyseUnderlined(const TQDomNode);
156 void analyseStrikeout (const TQDomNode);
157 void analyseWeight (const TQDomNode);
158 void analyseAlign (const TQDomNode);
159 void analyseColor (const TQDomNode);
160 void analyseSize (const TQDomNode);
161 void analyseBackgroundColor(const TQDomNode);
162};
163
164#endif /* __KWORD_TEXTFORMAT_H__ */
This class describe a cell, row or column format.
This class holds information formating the textzone.
Definition textformat.h:70
TextFormat()
Constructors.
Definition textformat.h:90