filters
footnote.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <stdlib.h>
00023 #include <kdebug.h>
00024 #include "footnote.h"
00025 #include "textFrame.h"
00026 #include "document.h"
00027
00028 Footnote::Footnote(Para* para): Format(para)
00029 {
00030 }
00031
00032 Footnote::~Footnote()
00033 {
00034 kdDebug(30522) << "Destruction of a footnote." << endl;
00035 }
00036
00037
00038 void Footnote::setSpace (QString new_space)
00039 {
00040 _space = new_space;
00041 }
00042
00043 void Footnote::setBefore(QString new_before)
00044 {
00045 _before = new_before;
00046
00047 }
00048
00049 void Footnote::setAfter(QString new_after)
00050 {
00051 _after = new_after;
00052 }
00053
00054 void Footnote::setRef(QString new_ref)
00055 {
00056 _ref = new_ref;
00057 }
00058
00059 void Footnote::analyse(const QDomNode balise)
00060 {
00061
00062
00063
00064 kdDebug(30522) << "ANALYSE A FOOTNOTE" << endl;
00065
00066
00067 for(int index= 0; index < getNbChild(balise); index++)
00068 {
00069 if(getChildName(balise, index).compare("INTERNAL")== 0)
00070 {
00071 kdDebug(30522) << "INTERNAL : " << endl;
00072 analyseInternal(balise);
00073 }
00074 else if(getChildName(balise, index).compare("RANGE")== 0)
00075 {
00076 kdDebug(30522) << "RANGE : " << endl;
00077 analyseRange(balise);
00078 }
00079 else if(getChildName(balise, index).compare("TEXT")== 0)
00080 {
00081 kdDebug(30522) << "TEXT : " << endl;
00082 analyseText(balise);
00083 }
00084 else if(getChildName(balise, index).compare("DESCRIPT")== 0)
00085 {
00086 kdDebug(30522) << "DESCRIPT : " << endl;
00087 analyseDescript(balise);
00088 }
00089 else if(getChildName(balise, index).compare("FORMAT")== 0)
00090 {
00091 kdDebug(30522) << "SUBFORMAT : " << endl;
00092 Format::analyse(balise);
00093 }
00094 }
00095 kdDebug(30522) << "END OF FOOTNOTE" << endl;
00096 }
00097
00098 void Footnote::analyseInternal(const QDomNode balise)
00099 {
00100 QDomNode fils;
00101
00102
00103
00104 fils = getChild(balise, "PART");
00105 for(int index= 0; index < getNbChild(balise); index++)
00106 {
00107 if(getChildName(balise, index).compare("PART")== 0)
00108 {
00109 kdDebug(30522) << "PART : " << endl;
00110 setFrom(getAttr(balise, "FROM").toInt());
00111 setTo(getAttr(balise, "TO").toInt());
00112 setSpace(getAttr(balise, "SPACE"));
00113
00114 }
00115 }
00116 }
00117
00118 void Footnote::analyseRange(const QDomNode balise)
00119 {
00120 kdDebug(30522) << "PARAM" << endl;
00121 setStart(getAttr(balise, "START").toInt());
00122 setEnd(getAttr(balise, "END").toInt());
00123 }
00124
00125 void Footnote::analyseText(const QDomNode balise)
00126 {
00127 kdDebug(30522) << "PARAM" << endl;
00128 setBefore(getAttr(balise, "BEFORE"));
00129 setAfter(getAttr(balise, "AFTER"));
00130 }
00131
00132 void Footnote::analyseDescript(const QDomNode balise)
00133 {
00134 kdDebug(30522) << "PARAM" << endl;
00135 setRef(getAttr(balise, "REF"));
00136 }
00137
00138 void Footnote::generate(QTextStream &out)
00139 {
00140 Element *footnote = 0;
00141
00142 kdDebug(30522) << " GENERATION FOOTNOTE" << endl;
00143
00144
00145
00146 out << "\\,\\footnote{";
00147 kdDebug(30522) << "footnote : " << _ref << endl;
00148 if((footnote = getRoot()->searchFootnote(_ref)) != 0)
00149 footnote->generate(out);
00150 out << "}";
00151 kdDebug(30522) << "FOOTNOTE GENERATED" << endl;
00152 }
00153
00154
|