filters

variablezone.cpp
1/* MEMO: to see the unicode table
2 * xset +fp /usr/X11R6/lib/X11/fonts/ucs/
3 * xfd -fn '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'
4 */
5/*
6** A program to convert the XML rendered by KWord into LATEX.
7**
8** Copyright (C) 2002 - 2003 Robert JACOLIN
9**
10** This library is free software; you can redistribute it and/or
11** modify it under the terms of the GNU Library General Public
12** License as published by the Free Software Foundation; either
13** version 2 of the License, or (at your option) any later version.
14**
15** This library is distributed in the hope that it will be useful,
16** but WITHOUT ANY WARRANTY; without even the implied warranty of
17** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18** Library General Public License for more details.
19**
20** To receive a copy of the GNU Library General Public License, write to the
21** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23**
24*/
25
26#include <kdebug.h> /* for kdDebug() stream */
27
28#include "variablezone.h"
29#include "para.h"
30#include "document.h"
31
32/*******************************************/
33/* VariableZone */
34/*******************************************/
36{
37 setPara(para);
38 setSize(para->getSize());
39 setWeight(para->getWeight());
40 setItalic(para->isItalic());
41 setUnderlined(para->getUnderlineType());
42 setStrikeout(para->isStrikeout());
43}
44
45/*******************************************/
46/* VariableZone */
47/*******************************************/
49{
50 setTexte(text);
51 /*setPara(para);
52 setSize(para->getSize());
53 setWeight(para->getWeight());
54 setItalic(para->isItalic());
55 setUnderlined(para->getUnderlineType());
56 setStrikeout(para->isStrikeout());*/
57}
58
59/*******************************************/
60/* ~VariableZone */
61/*******************************************/
62VariableZone::~VariableZone()
63{
64 kdDebug(30522) << "Destruction of an area" << endl;
65}
66
67/*******************************************/
68/* analyse */
69/*******************************************/
70/* Analyse a text format, get the text used*/
71/* by this format. */
72/*******************************************/
73void VariableZone::analyse(const TQDomNode balise)
74{
75 kdDebug(30522) << "FORMAT" << endl;
76 /* Get header information (size, position)
77 * Get infos. to format the text
78 */
79 //if(balise != 0)
80 analyseFormat(balise);
81
82 /* Format the text */
83 setTexte(getTexte().mid(getPos(), getLength()));
84
85 kdDebug(30522) << getTexte().length() << endl;
86 kdDebug(30522) << getTexte().latin1() << endl;
87 kdDebug(30522) << "END FORMAT" << endl;
88}
89
90/*******************************************/
91/* generate */
92/*******************************************/
93/* Generate the text formated (if needed). */
94/*******************************************/
95void VariableZone::generate(TQTextStream &out)
96{
97
98 if(useFormat())
99 generate_format_begin(out);
100
101 /* Display the text */
102 kdDebug(30522) << "type : " << getType() << endl;
103 if((getType() == VAR_DATE) && !isFix())
104 out << "\\today" << endl;
105 else if(getType() == VAR_FOOTNOTE)
106 {
107 if(getNotetype() == "footnote")
108 out << "\\,\\footnote{";
109 else if(getNotetype() == "endnote")
110 out << "\\,\\endnote{";
111 /* Get the footnote and generate it. */
112 Element* footnote = getRoot()->searchFootnote(getFrameset());
113 if(footnote != NULL)
114 {
115 footnote->generate(out);
116 }
117 Config::instance()->writeIndent(out);
118 out << "}";
119 }
120 else if(getType() == VAR_NOTE)
121 {
122 out << "\\marginpar{\\scriptsize ";
123 if(Config::instance()->mustUseLatin1())
124 display(escapeLatin1(getNote()), out);
125 else if(Config::instance()->mustUseUnicode())
126 display(getNote(), out);
127 out << "}" << endl;
128 }
129 else
130 {
131 if(Config::instance()->mustUseLatin1())
132 display(escapeLatin1(getText()), out);
133 else if(Config::instance()->mustUseUnicode())
134 display(getText(), out);
135 }
136 if(useFormat())
137 generate_format_end(out);
138
139}
140
This class is a element.
This class hold a real paragraph.
Definition para.h:59
TQString escapeLatin1(TQString)
convert a unicode text in latin1 enconding ala latex.
Definition textzone.cpp:91
bool useFormat() const
Definition textzone.cpp:80
VariableFormat(Para *para)
Constructors.
void analyse(const TQDomNode)
Helpfull functions.
VariableZone(Para *para)
Creates a new instance of VariableZone.