filters

variableformat.cc

00001 /*
00002 ** A program to convert the XML rendered by KWord into LATEX.
00003 **
00004 ** Copyright (C) 2000 Robert JACOLIN
00005 **
00006 ** This library is free software; you can redistribute it and/or
00007 ** modify it under the terms of the GNU Library General Public
00008 ** License as published by the Free Software Foundation; either
00009 ** version 2 of the License, or (at your option) any later version.
00010 **
00011 ** This library is distributed in the hope that it will be useful,
00012 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 ** Library General Public License for more details.
00015 **
00016 ** To receive a copy of the GNU Library General Public License, write to the
00017 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 **
00020 */
00021 
00022 #include <stdlib.h>
00023 
00024 #include <kdebug.h>
00025 
00026 #include "fileheader.h"     /* for the use of _fileHeader (color and underlined) */
00027 #include "variableformat.h"
00028 
00029 /*******************************************/
00030 /* getColorBlue                            */
00031 /*******************************************/
00032 /*int VariableFormat::getColorBlue () const
00033 {
00034     if(_textcolor!= 0)
00035         return _textcolor->blue();
00036     else
00037         return 0;
00038 }*/
00039 
00040 /*******************************************/
00041 /* getColorGreen                           */
00042 /*******************************************/
00043 /*int VariableFormat::getColorGreen() const
00044 {
00045     if(_textcolor!= 0)
00046         return _textcolor->green();
00047     else
00048         return 0;
00049 }*/
00050 
00051 /*******************************************/
00052 /* getColorRed                             */
00053 /*******************************************/
00054 /*int VariableFormat::getColorRed  () const
00055 {
00056     if(_textcolor!= 0)
00057         return _textcolor->red();
00058     else
00059         return 0;
00060 }*/
00061 
00062 /*******************************************/
00063 /* setColor                                */
00064 /*******************************************/
00065 /*void VariableFormat::setColor (const int r, const int g, const int b)
00066 {
00067     if(_textcolor == 0)
00068         _textcolor = new QColor(r, g, b);
00069     else
00070         _textcolor->setRgb(r, g, b);
00071 }*/
00072 
00073 /*******************************************/
00074 /* analyseVariableFormat                       */
00075 /*******************************************/
00076 /* Get the set of info. about a text format*/
00077 /*******************************************/
00078 void VariableFormat::analyseFormat(const QDomNode balise)
00079 {
00080     /* MARKUPS FORMAT id="1" pos="0" len="17">...</FORMAT> */
00081     
00082     /* Parameters Analyse */
00083     analyseParam(balise);
00084     kdDebug(30522) << "ANALYSE A FORMAT" << endl;
00085     
00086     /* Children Markups Analyse */
00087     if(isChild(balise, "FONT"))
00088         analyseFont(getChild(balise, "FONT"));
00089     if(isChild(balise, "ITALIC"))
00090         analyseItalic(getChild(balise, "ITALIC"));
00091     if(isChild(balise, "UNDERLINE"))
00092         analyseUnderlined(getChild(balise, "UNDERLINE"));
00093     if(isChild(balise, "WEIGHT"))
00094         analyseWeight(getChild(balise, "WEIGHT"));
00095     if(isChild(balise, "VERTALIGN"))
00096         analyseAlign(getChild(balise, "VERTALIGN"));
00097     if(isChild(balise, "STRIKEOUT"))
00098         analyseStrikeout(getChild(balise, "STRIKEOUT"));
00099     if(isChild(balise, "COLOR"))
00100         analyseColor(getChild(balise, "COLOR"));
00101     if(isChild(balise, "SIZE"))
00102         analyseSize(getChild(balise, "SIZE"));
00103     if(isChild(balise, "DATE"))
00104         analyseDate(getChild(balise, "DATE"));
00105     if(isChild(balise, "FOOTNOTE"))
00106         analyseFootnote(getChild(balise, "FOOTNOTE"));
00107     if(isChild(balise, "NOTE"))
00108         analyseNote(getChild(balise, "NOTE"));
00109     if(isChild(balise, "TYPE"))
00110         analyseType(getChild(balise, "TYPE"));
00111     kdDebug(30522) << "END OF A FORMAT" << endl;
00112 }
00113 
00114 /*******************************************/
00115 /* analyseDate                             */
00116 /*******************************************/
00117 /* Get the date.                           */
00118 /*******************************************/
00119 void VariableFormat::analyseDate(const QDomNode balise)
00120 {
00121     setDay(getAttr(balise, "day").toInt());
00122     setMonth(getAttr(balise, "month").toInt());
00123     setYear(getAttr(balise, "year").toInt());
00124     setFix(getAttr(balise, "fix").toInt());
00125 }
00126 
00127 /*******************************************/
00128 /* analyseTime                             */
00129 /*******************************************/
00130 /* Get the time.                           */
00131 /*******************************************/
00132 void VariableFormat::analyseTime(const QDomNode balise)
00133 {
00134     setHour(getAttr(balise, "day").toInt());
00135     setMinute(getAttr(balise, "month").toInt());
00136     setSeconde(getAttr(balise, "year").toInt());
00137     setFix(getAttr(balise, "fix").toInt());
00138 }
00139 
00140 void VariableFormat::analyseFootnote(const QDomNode balise)
00141 {
00142     setNumberingtype(getAttr(balise, "numberingtype"));
00143     setNotetype(getAttr(balise, "notetype"));
00144     setFrameset(getAttr(balise, "frameset"));
00145     setValue(getAttr(balise, "value"));
00146 }
00147 
00148 void VariableFormat::analyseNote(const QDomNode balise)
00149 {
00150     setNote(getAttr(balise, "note"));
00151 }
00152 
00153 /*******************************************/
00154 /* analyseType                             */
00155 /*******************************************/
00156 /* Get information about variable.         */
00157 /*******************************************/
00158 void VariableFormat::analyseType(const QDomNode balise)
00159 {
00160     setKey(getAttr(balise, "key"));
00161     setType(getAttr(balise, "type").toInt());
00162     setText(getAttr(balise, "text"));
00163 }
00164 
KDE Home | KDE Accessibility Home | Description of Access Keys