filters

variableformat.cpp
1/*
2** A program to convert the XML rendered by KWord into LATEX.
3**
4** Copyright (C) 2000 Robert JACOLIN
5**
6** This library is free software; you can redistribute it and/or
7** modify it under the terms of the GNU Library General Public
8** License as published by the Free Software Foundation; either
9** version 2 of the License, or (at your option) any later version.
10**
11** This library is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14** Library General Public License for more details.
15**
16** To receive a copy of the GNU Library General Public License, write to the
17** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19**
20*/
21
22#include <stdlib.h>
23
24#include <kdebug.h>
25
26#include "fileheader.h" /* for the use of _fileHeader (color and underlined) */
27#include "variableformat.h"
28
29/*******************************************/
30/* getColorBlue */
31/*******************************************/
32/*int VariableFormat::getColorBlue () const
33{
34 if(_textcolor!= 0)
35 return _textcolor->blue();
36 else
37 return 0;
38}*/
39
40/*******************************************/
41/* getColorGreen */
42/*******************************************/
43/*int VariableFormat::getColorGreen() const
44{
45 if(_textcolor!= 0)
46 return _textcolor->green();
47 else
48 return 0;
49}*/
50
51/*******************************************/
52/* getColorRed */
53/*******************************************/
54/*int VariableFormat::getColorRed () const
55{
56 if(_textcolor!= 0)
57 return _textcolor->red();
58 else
59 return 0;
60}*/
61
62/*******************************************/
63/* setColor */
64/*******************************************/
65/*void VariableFormat::setColor (const int r, const int g, const int b)
66{
67 if(_textcolor == 0)
68 _textcolor = new TQColor(r, g, b);
69 else
70 _textcolor->setRgb(r, g, b);
71}*/
72
73/*******************************************/
74/* analyseVariableFormat */
75/*******************************************/
76/* Get the set of info. about a text format*/
77/*******************************************/
78void VariableFormat::analyseFormat(const TQDomNode balise)
79{
80 /* MARKUPS FORMAT id="1" pos="0" len="17">...</FORMAT> */
81
82 /* Parameters Analyse */
83 analyseParam(balise);
84 kdDebug(30522) << "ANALYSE A FORMAT" << endl;
85
86 /* Children Markups Analyse */
87 if(isChild(balise, "FONT"))
88 analyseFont(getChild(balise, "FONT"));
89 if(isChild(balise, "ITALIC"))
90 analyseItalic(getChild(balise, "ITALIC"));
91 if(isChild(balise, "UNDERLINE"))
92 analyseUnderlined(getChild(balise, "UNDERLINE"));
93 if(isChild(balise, "WEIGHT"))
94 analyseWeight(getChild(balise, "WEIGHT"));
95 if(isChild(balise, "VERTALIGN"))
96 analyseAlign(getChild(balise, "VERTALIGN"));
97 if(isChild(balise, "STRIKEOUT"))
98 analyseStrikeout(getChild(balise, "STRIKEOUT"));
99 if(isChild(balise, "COLOR"))
100 analyseColor(getChild(balise, "COLOR"));
101 if(isChild(balise, "SIZE"))
102 analyseSize(getChild(balise, "SIZE"));
103 if(isChild(balise, "DATE"))
104 analyseDate(getChild(balise, "DATE"));
105 if(isChild(balise, "FOOTNOTE"))
106 analyseFootnote(getChild(balise, "FOOTNOTE"));
107 if(isChild(balise, "NOTE"))
108 analyseNote(getChild(balise, "NOTE"));
109 if(isChild(balise, "TYPE"))
110 analyseType(getChild(balise, "TYPE"));
111 kdDebug(30522) << "END OF A FORMAT" << endl;
112}
113
114/*******************************************/
115/* analyseDate */
116/*******************************************/
117/* Get the date. */
118/*******************************************/
119void VariableFormat::analyseDate(const TQDomNode balise)
120{
121 setDay(getAttr(balise, "day").toInt());
122 setMonth(getAttr(balise, "month").toInt());
123 setYear(getAttr(balise, "year").toInt());
124 setFix(getAttr(balise, "fix").toInt());
125}
126
127/*******************************************/
128/* analyseTime */
129/*******************************************/
130/* Get the time. */
131/*******************************************/
132void VariableFormat::analyseTime(const TQDomNode balise)
133{
134 setHour(getAttr(balise, "day").toInt());
135 setMinute(getAttr(balise, "month").toInt());
136 setSeconde(getAttr(balise, "year").toInt());
137 setFix(getAttr(balise, "fix").toInt());
138}
139
140void VariableFormat::analyseFootnote(const TQDomNode balise)
141{
142 setNumberingtype(getAttr(balise, "numberingtype"));
143 setNotetype(getAttr(balise, "notetype"));
144 setFrameset(getAttr(balise, "frameset"));
145 setValue(getAttr(balise, "value"));
146}
147
148void VariableFormat::analyseNote(const TQDomNode balise)
149{
150 setNote(getAttr(balise, "note"));
151}
152
153/*******************************************/
154/* analyseType */
155/*******************************************/
156/* Get information about variable. */
157/*******************************************/
158void VariableFormat::analyseType(const TQDomNode balise)
159{
160 setKey(getAttr(balise, "key"));
161 setType(getAttr(balise, "type").toInt());
162 setText(getAttr(balise, "text"));
163}
164