24#include <tqptrstack.h>
27#include <tdeapplication.h>
29#include <kformuladocument.h>
30#include <kformulamimesource.h>
43 _autoCreate = TC_EXTEND;
44 _newFrameBehaviour = TF_RECONNECT;
59 kdDebug(30522) <<
"FRAME ANALYSE (Formula)" << endl;
62 for(
int index= 0; index < getNbChild(balise); index++)
64 if(getChildName(balise, index).compare(
"FRAME")== 0)
66 analyseParamFrame(balise);
68 else if(getChildName(balise, index).compare(
"FORMULA")== 0)
70 getFormula(getChild(getChild(balise,
"FORMULA"),
"FORMULA"), 0);
71 kdDebug(30522) << _formula << endl;
75 kdDebug(30522) <<
"END OF A FRAME" << endl;
83void Formula::getFormula(TQDomNode p,
int indent)
85 switch( p.nodeType() )
87 case TQDomNode::TextNode:
88 _formula = _formula + TQString(p.toText().data()) +
" ";
98 case TQDomNode::ElementNode:
99 _formula = _formula +
"<" + p.nodeName();
100 TQDomNamedNodeMap attr = p.attributes();
101 for(
unsigned int index = 0; index < attr.length(); index++)
103 _formula = _formula +
" " + attr.item(index).nodeName();
104 _formula = _formula +
"=\"" + attr.item(index).nodeValue() +
"\"";
106 if(p.childNodes().length() == 0)
107 _formula = _formula +
"/>\n";
110 _formula = _formula +
">\n";
111 TQDomNodeList child = p.childNodes();
112 for(
unsigned int index = 0; index < child.length(); index++)
114 getFormula(child.item(index), indent + 3);
116 _formula = _formula +
"</" + p.nodeName() +
">\n";
142void Formula::analyseParamFrame(
const TQDomNode balise)
146 _left = getAttr(balise,
"left").toInt();
147 _top = getAttr(balise,
"top").toInt();
148 _right = getAttr(balise,
"right").toInt();
149 _bottom = getAttr(balise,
"bottom").toInt();
151 setAroundGap(getAttr(balise,
"runaroundGap").toInt());
152 setAutoCreate(getAttr(balise,
"autoCreateNewFrame").toInt());
153 setNewFrame(getAttr(balise,
"newFrameBehaviour").toInt());
154 setSheetSide(getAttr(balise,
"sheetside").toInt());
162 kdDebug(30522) <<
"FORMULA GENERATION" << endl;
164 doc.setContent(_formula);
168 KFormula::DocumentWrapper* wrapper =
new KFormula::DocumentWrapper( kapp->config(), 0 );
169 KFormula::Document* formulaDoc =
new KFormula::Document;
170 wrapper->document( formulaDoc );
172 KFormula::Container* formula = formulaDoc->createFormula();
173 if ( !formula->load( doc.documentElement () ) ) {
174 kdError(30522) <<
"Failed." << endl;
177 out <<
"$" << formula->texString() <<
"$";
virtual void analyse(const TQDomNode)
Helpfull functions.