filters

element.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 #include <kdebug.h>
00024 #include "element.h"
00025 
00026 /*******************************************/
00027 /* Constructor                             */
00028 /*******************************************/
00029 Element::Element()
00030 {
00031     _type      = ST_NONE;
00032     _hinfo     = SI_NONE;
00033     _section   = SS_NONE;
00034     _name      = "";
00035     _removable = false;
00036     _visible   = true;
00037     _row       = 0;
00038     _col       = 0;
00039     _rows      = 0;
00040     _cols      = 0;
00041     setGrpMgr("");
00042 }
00043 
00044 /*******************************************/
00045 /* Destructor                              */
00046 /*******************************************/
00047 Element::~Element()
00048 {
00049     kdDebug(30522) << "Element Destructor" << endl;
00050 }
00051 
00052 /*******************************************/
00053 /* Analyse                                 */
00054 /*******************************************/
00055 void Element::analyse(const QDomNode balise_initiale)
00056 {
00057     /* ANALYSE A FRAMESET MARKUP */
00058     
00059     /* Parameters Analyse */
00060     kdDebug(30522) << "FRAMESET PARAMETERS ANALYSE (Element)" << endl;
00061     analyseParam(balise_initiale);
00062 }
00063 
00064 /*******************************************/
00065 /* AnalyseParam                            */
00066 /*******************************************/
00067 void Element::analyseParam(const QDomNode balise)
00068 {
00069     /* <FRAMESET frameType="1" frameInfo="0" removable="0"
00070      * visible="1" name="Supercadre 1">
00071      */
00072     _name = getAttr(balise, "name");
00073     _type = (SType) getAttr(balise, "frameType").toInt();
00074     switch(getAttr(balise, "frameInfo").toInt())
00075     {
00076         case 0: _section = SS_BODY;
00077             break;
00078         case 1: _section = SS_HEADERS;
00079             _hinfo   = SI_FIRST;
00080             break;
00081         case 2: _section = SS_HEADERS;
00082             _hinfo   = SI_ODD;
00083             break;
00084         case 3: _section = SS_HEADERS;
00085             _hinfo   = SI_EVEN;
00086             break;
00087         case 4: _section = SS_FOOTERS;
00088             _hinfo   = SI_FIRST;
00089             break;
00090         case 5: _section = SS_FOOTERS;
00091             _hinfo   = SI_ODD;
00092             break;
00093         case 6: _section = SS_FOOTERS;
00094             _hinfo   = SI_EVEN;
00095             break;
00096         case 7: _section = SS_FOOTNOTES;
00097             break;
00098         default:
00099             _section = SS_NONE;
00100             kdDebug(30522) << "error : frameinfo unknown!" << endl;
00101     }
00102     setRemovable(getAttr(balise, "removable").toInt());
00103     setVisible(getAttr(balise, "visible").toInt());
00104     if(getAttr(balise, "grpMgr")!= 0)
00105     {
00106         _section = SS_TABLE;
00107         setGrpMgr(getAttr(balise, "grpMgr"));
00108     }
00109     setRow(getAttr(balise, "row").toInt());
00110     setCol(getAttr(balise, "col").toInt());
00111     setRows(getAttr(balise, "rows").toInt());
00112     setCols(getAttr(balise, "cols").toInt());
00113 
00114     kdDebug(30522) << "FIN PARAM" << endl;
00115 }
KDE Home | KDE Accessibility Home | Description of Access Keys