summaryrefslogtreecommitdiffstats
path: root/filters/kword/latex/export/element.cpp
blob: 992293243503da46e1e7b725b76a93b6f285dd38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
** A program to convert the XML rendered by KWord into LATEX.
**
** Copyright (C) 2000 Robert JACOLIN
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** Library General Public License for more details.
**
** To receive a copy of the GNU Library General Public License, write to the
** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
**
*/

#include <stdlib.h>
#include <kdebug.h>
#include "element.h"

/*******************************************/
/* Constructor                             */
/*******************************************/
Element::Element()
{
	_type      = ST_NONE;
	_hinfo     = SI_NONE;
	_section   = SS_NONE;
	_name      = "";
	_removable = false;
	_visible   = true;
	_row       = 0;
	_col       = 0;
	_rows      = 0;
	_cols      = 0;
	setGrpMgr("");
}

/*******************************************/
/* Destructor                              */
/*******************************************/
Element::~Element()
{
	kdDebug(30522) << "Element Destructor" << endl;
}

/*******************************************/
/* Analyse                                 */
/*******************************************/
void Element::analyse(const TQDomNode balise_initiale)
{
	/* ANALYSE A FRAMESET MARKUP */
	
	/* Parameters Analyse */
	kdDebug(30522) << "FRAMESET PARAMETERS ANALYSE (Element)" << endl;
	analyseParam(balise_initiale);
}

/*******************************************/
/* AnalyseParam                            */
/*******************************************/
void Element::analyseParam(const TQDomNode balise)
{
	/* <FRAMESET frameType="1" frameInfo="0" removable="0"
	 * visible="1" name="Supercadre 1">
	 */
	_name = getAttr(balise, "name");
	_type = (SType) getAttr(balise, "frameType").toInt();
	switch(getAttr(balise, "frameInfo").toInt())
	{
		case 0: _section = SS_BODY;
			break;
		case 1: _section = SS_HEADERS;
			_hinfo   = SI_FIRST;
			break;
		case 2: _section = SS_HEADERS;
			_hinfo   = SI_ODD;
			break;
		case 3: _section = SS_HEADERS;
			_hinfo   = SI_EVEN;
			break;
		case 4: _section = SS_FOOTERS;
			_hinfo   = SI_FIRST;
			break;
		case 5: _section = SS_FOOTERS;
			_hinfo   = SI_ODD;
			break;
		case 6: _section = SS_FOOTERS;
			_hinfo   = SI_EVEN;
			break;
		case 7: _section = SS_FOOTNOTES;
			break;
		default:
			_section = SS_NONE;
			kdDebug(30522) << "error : frameinfo unknown!" << endl;
	}
	setRemovable(getAttr(balise, "removable").toInt());
	setVisible(getAttr(balise, "visible").toInt());
	if(getAttr(balise, "grpMgr")!= 0)
	{
		_section = SS_TABLE;
		setGrpMgr(getAttr(balise, "grpMgr"));
	}
	setRow(getAttr(balise, "row").toInt());
	setCol(getAttr(balise, "col").toInt());
	setRows(getAttr(balise, "rows").toInt());
	setCols(getAttr(balise, "cols").toInt());

	kdDebug(30522) << "FIN PARAM" << endl;
}