26#include "fileheader.h"
27#include "textformat.h"
32int TextFormat::getColorBlue ()
const
35 return _textcolor->blue();
40int TextFormat::getColorGreen()
const
43 return _textcolor->green();
48int TextFormat::getColorRed ()
const
51 return _textcolor->red();
59int TextFormat::getBkColorBlue ()
const
62 return _backcolor->blue();
67int TextFormat::getBkColorGreen()
const
70 return _backcolor->green();
75int TextFormat::getBkColorRed ()
const
78 return _backcolor->red();
86void TextFormat::setColor (
const int r,
const int g,
const int b)
89 _textcolor =
new TQColor(r, g, b);
91 _textcolor->setRgb(r, g, b);
97void TextFormat::setBkColor (
const int r,
const int g,
const int b)
100 _backcolor =
new TQColor(r, g, b);
102 _backcolor->setRgb(r, g, b);
110void TextFormat::analyseFormat(
const TQDomNode balise)
115 analyseParam(balise);
116 kdDebug(30522) <<
"ANALYSE A FORMAT" << endl;
119 if(isChild(balise,
"FONT"))
120 analyseFont(getChild(balise,
"FONT"));
121 if(isChild(balise,
"ITALIC"))
122 analyseItalic(getChild(balise,
"ITALIC"));
123 if(isChild(balise,
"UNDERLINE"))
124 analyseUnderlined(getChild(balise,
"UNDERLINE"));
125 if(isChild(balise,
"WEIGHT"))
126 analyseWeight(getChild(balise,
"WEIGHT"));
127 if(isChild(balise,
"VERTALIGN"))
128 analyseAlign(getChild(balise,
"VERTALIGN"));
129 if(isChild(balise,
"STRIKEOUT"))
130 analyseStrikeout(getChild(balise,
"STRIKEOUT"));
131 if(isChild(balise,
"COLOR"))
132 analyseColor(getChild(balise,
"COLOR"));
133 if(isChild(balise,
"SIZE"))
134 analyseSize(getChild(balise,
"SIZE"));
135 if(isChild(balise,
"TEXTBACKGROUNDCOLOR"))
136 analyseBackgroundColor(getChild(balise,
"TEXTBACKGROUNDCOLOR"));
138 kdDebug(30522) <<
"END OF A FORMAT" << endl;
141void TextFormat::analyseBackgroundColor(
const TQDomNode balise)
148 red = getAttr(balise,
"red").toInt();
149 green = getAttr(balise,
"green").toInt();
150 blue = getAttr(balise,
"blue").toInt();
152 if(!(red == 255 && green == 255 && blue == 255))
154 kdDebug(30522) <<
"bk color = " << red <<
"," << green <<
"," << blue << endl;
156 setBkColor(red, green, blue);
157 FileHeader::instance()->useColor();
166void TextFormat::analyseParam(
const TQDomNode balise)
181void TextFormat::analyseFont(
const TQDomNode balise)
184 setPolice(getAttr(balise,
"name"));
192void TextFormat::analyseItalic(
const TQDomNode balise)
195 setItalic(getAttr(balise,
"value").toInt());
203void TextFormat::analyseUnderlined(
const TQDomNode balise)
207 setUnderlined(getAttr(balise,
"value"));
209 FileHeader::instance()->useUnderline();
210 kdDebug(30522) <<
"Underlined ? " << isUnderlined() << endl;
218void TextFormat::analyseStrikeout(
const TQDomNode balise)
221 setStrikeout(getAttr(balise,
"value").toInt());
223 FileHeader::instance()->useUnderline();
224 kdDebug(30522) <<
"Strikeout ? " << isUnderlined() << endl;
232void TextFormat::analyseWeight(
const TQDomNode balise)
235 setWeight(getAttr(balise,
"value").toInt());
236 kdDebug(30522) <<
"Weight = " << getWeight() << endl;
244void TextFormat::analyseAlign(
const TQDomNode balise)
248 setAlign(getAttr(balise,
"value").toInt());
256void TextFormat::analyseColor(
const TQDomNode balise)
263 red = getAttr(balise,
"red").toInt();
264 green = getAttr(balise,
"green").toInt();
265 blue = getAttr(balise,
"blue").toInt();
267 if(!(red == 0 && green == 0 && blue == 0))
270 kdDebug(30522) <<
"color = " << red <<
"," << green <<
"," << blue << endl;
271 setColor(red, green, blue);
272 FileHeader::instance()->useColor();
281void TextFormat::analyseSize(
const TQDomNode balise)
284 setSize(getAttr(balise,
"value").toInt());
285 kdDebug(30522) <<
"font size : " << getSize() << endl;