filters
layout.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
00024 #include <kdebug.h>
00025
00026 #include "fileheader.h"
00027 #include "layout.h"
00028
00029
00030 QString Layout::_last_name;
00031 EType Layout::_last_counter;
00032
00033
00034
00035
00036 Layout::Layout()
00037 {
00038 _last_name = "STANDARD";
00039 _last_counter = TL_NONE;
00040 _env = ENV_LEFT;
00041 _counterType = TL_NONE;
00042 _counterDepth = 0;
00043 _counterBullet = 0;
00044 _counterStart = 0;
00045 _numberingType = -1;
00046 _useHardBreakAfter = false;
00047 _useHardBreak = false;
00048 _keepLinesTogether = false;
00049 }
00050
00051
00052
00053
00054 void Layout::analyseLayout(const QDomNode balise)
00055 {
00056
00057
00058
00059 kdDebug(30522) << "ANALYSE OF THE BEGINING OF A LAYOUT" << endl;
00060
00061
00062 for(int index= 0; index < getNbChild(balise); index++)
00063 {
00064 if(getChildName(balise, index).compare("NAME")== 0)
00065 {
00066 kdDebug(30522) << "NAME : " << endl;
00067 analyseName(getChild(balise, index));
00068 }
00069 else if(getChildName(balise, index).compare("FOLLOWING")== 0)
00070 {
00071 kdDebug(30522) << "FOLLOWING : " << endl;
00072 analyseFollowing(getChild(balise, index));
00073 }
00074 else if(getChildName(balise, index).compare("FLOW")== 0)
00075 {
00076 kdDebug(30522) << "FLOW : " << endl;
00077 analyseEnv(getChild(balise, index));
00078 }
00079 else if(getChildName(balise, index).compare("PAGEBREAKING")== 0)
00080 {
00081 kdDebug(30522) << "PAGEBREAKING : " << endl;
00082 analyseBreakLine(getChild(balise, index));
00083 }
00084 else if(getChildName(balise, index).compare("COUNTER")== 0)
00085 {
00086 kdDebug(30522) << "COUNTER : " << endl;
00087 analyseCounter(getChild(balise, index));
00088 }
00089 else if(getChildName(balise, index).compare("FORMAT")== 0)
00090 {
00091 kdDebug(30522) << "FORMAT : " << endl;
00092 analyseFormat(getChild(balise, index));
00093 }
00094 }
00095 kdDebug(30522) << "END OF THE BEGINING OF A LAYOUT" << endl;
00096 }
00097
00098 void Layout::analyseName(const QDomNode balise)
00099 {
00100
00101 kdDebug(30522) << "PARAM" << endl;
00102 setName(getAttr(balise, "value"));
00103 }
00104
00105
00106
00107
00108
00109
00110 void Layout::analyseFollowing(const QDomNode balise)
00111 {
00112
00113 kdDebug(30522) << "PARAM" << endl;
00114 setFollowing(getAttr(balise, "name"));
00115 }
00116
00117
00118
00119
00120
00121
00122 void Layout::analyseEnv(const QDomNode balise)
00123 {
00124
00125
00126 kdDebug(30522) << "PARAM" << endl;
00127 if(getAttr(balise,"align").compare("justify")== 0)
00128 setEnv(ENV_JUSTIFY);
00129 else if(getAttr(balise, "align").compare("left")== 0)
00130 setEnv(ENV_LEFT);
00131 else if(getAttr(balise, "align").compare("right")== 0)
00132 setEnv(ENV_RIGHT);
00133 else if(getAttr(balise, "align").compare("center")== 0)
00134 setEnv(ENV_CENTER);
00135 }
00136
00137 void Layout::analyseBreakLine(const QDomNode balise)
00138 {
00139
00140 kdDebug(30522) << "PARAM" << endl;
00141 if(getAttr(balise, "linesTogether") != 0)
00142 keepLinesTogether();
00143 else if(getAttr(balise, "hardFrameBreak") != 0)
00144 useHardBreak();
00145 else if(getAttr(balise, "hardFrameBreakAfter") != 0)
00146 useHardBreakAfter();
00147 }
00148
00149
00150
00151
00152
00153
00154
00155
00156 void Layout::analyseCounter(const QDomNode balise)
00157 {
00158
00159 kdDebug(30522) << "PARAM" << endl;
00160 setCounterType(getAttr(balise, "type").toInt());
00161 if(getCounterType() > TL_ARABIC && getCounterType() < TL_DISC_BULLET)
00162 {
00163 kdDebug(30522) << getCounterType() << endl;
00164 FileHeader::instance()->useEnumerate();
00165 }
00166 setCounterDepth(getAttr(balise, "depth").toInt());
00167 setCounterBullet(getAttr(balise, "bullet").toInt());
00168 setCounterStart(getAttr(balise, "start").toInt());
00169 setNumberingType(getAttr(balise, "numberingtype").toInt());
00170 }
|