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)
87 switch( p.nodeType() )
89 case TQDomNode::TextNode:
90 _formula = _formula + TQString(p.toText().data()) + " ";
100 case TQDomNode::ElementNode:
101 _formula = _formula + "<" + p.nodeName();
102 TQDomNamedNodeMap attr = p.attributes();
103 for( unsigned int index = 0; index < attr.length(); index++)
105 _formula = _formula + " " + attr.item(index).nodeName();
106 _formula = _formula + "=\"" + attr.item(index).nodeValue() + "\"";
108 if(p.childNodes().length() == 0)
109 _formula = _formula + "/>\n";
112 _formula = _formula + ">\n";
113 TQDomNodeList child = p.childNodes();
114 for( unsigned int index = 0; index < child.length(); index++)
116 getFormula(child.item(index), indent+3);
118 _formula = _formula + "</" + p.nodeName() + ">\n";
132void Formula::analyseParamFrame( const TQDomNode balise)
136 _left = getAttr(balise, "left").toInt();
137 _top = getAttr(balise, "top").toInt();
138 _right = getAttr(balise, "right").toInt();
139 _bottom = getAttr(balise, "bottom").toInt();
141 setAroundGap(getAttr(balise, "runaroundGap").toInt());
142 setAutoCreate(getAttr(balise, "autoCreateNewFrame").toInt());
143 setNewFrame(getAttr(balise, "newFrameBehaviour").toInt());
144 setSheetSide(getAttr(balise, "sheetside").toInt());
152 kdDebug(30522) << "FORMULA GENERATION" << endl;
154 doc.setContent(_formula);
158 KFormula::Document formulaDoc( kapp->sessionConfig() );
160 KFormula::Container* formula = new KFormula::Container( &formulaDoc );
161 if ( !formula->load( doc ) ) {
162 kdError(30522) << "Failed." << endl;
165 out << "$" << formula->texString() << "$";
virtual void analyse(const TQDomNode) Helpfull functions.
|