22#include "bracketelement.h"
23#include "elementtype.h"
24#include "fractionelement.h"
25#include "indexelement.h"
26#include "matrixelement.h"
27#include "rootelement.h"
28#include "sequenceelement.h"
29#include "spaceelement.h"
30#include "symbolelement.h"
31#include "textelement.h"
32#include "glyphelement.h"
33#include "styleelement.h"
34#include "numberelement.h"
35#include "identifierelement.h"
36#include "operatorelement.h"
37#include "stringelement.h"
38#include "paddedelement.h"
39#include "errorelement.h"
40#include "phantomelement.h"
41#include "actionelement.h"
42#include "encloseelement.h"
44#include "oasiscreationstrategy.h"
46KFORMULA_NAMESPACE_BEGIN
48BasicElement* OasisCreationStrategy::createElement( TQString type,
const TQDomElement& element )
57 kdDebug( DEBUGID ) << type << endl;
60 if ( type ==
"mi" )
return new IdentifierElement();
61 else if ( type ==
"mo" )
return createOperatorElement( element );
62 else if ( type ==
"mn" )
return new NumberElement();
63 else if ( type ==
"mtext" )
return new TokenElement();
64 else if ( type ==
"ms" )
return new StringElement();
66 else if ( type ==
"mglyph" )
return new GlyphElement();
71 else if ( type ==
"msqrt"
73 else if ( type ==
"mstyle" )
return new StyleElement();
74 else if ( type ==
"merror" )
return new ErrorElement();
75 else if ( type ==
"mpadded" )
return new PaddedElement();
76 else if ( type ==
"mphantom" )
return new PhantomElement();
78 else if ( type ==
"menclose" )
return new EncloseElement();
81 else if ( type ==
"msub"
86 || type ==
"munderover"
103EmptyElement* OasisCreationStrategy::createEmptyElement()
108NameSequence* OasisCreationStrategy::createNameSequence()
113BracketElement* OasisCreationStrategy::createBracketElement( SymbolType lhs, SymbolType rhs )
133SpaceElement* OasisCreationStrategy::createSpaceElement( SpaceWidth width )
143RootElement* OasisCreationStrategy::createRootElement()
148SymbolElement* OasisCreationStrategy::createSymbolElement( SymbolType type )
158IndexElement* OasisCreationStrategy::createIndexElement()
163BasicElement* OasisCreationStrategy::createOperatorElement(
const TQDomElement& element )
165 TQDomNode n = element.firstChild();
168 if ( n.isEntityReference() ) {
169 TQString
name = n.nodeName();
170 if ( name ==
"CloseCurlyDoubleQuote"
171 || name ==
"CloseCurlyQuote"
172 || name ==
"LeftAngleBracket"
173 || name ==
"LeftCeiling"
174 || name ==
"LeftDoubleBracket"
175 || name ==
"LeftFloor"
176 || name ==
"OpenCurlyDoubleQuote"
177 || name ==
"OpenCurlyQuote"
178 || name ==
"RightAngleBracket"
179 || name ==
"RightCeiling"
180 || name ==
"RightDoubleBracket"
181 || name ==
"RightFloor" ) {
184 return new OperatorElement();
187 TQString text = n.toText().data();
188 if ( text.length() == 1 && TQString(
"()[]{}").contains(text[0]) ) {
192 return new OperatorElement();
195IdentifierElement* OasisCreationStrategy::createIdentifierElement()
197 return new IdentifierElement();
200OperatorElement* OasisCreationStrategy::createOperatorElement()
202 return new OperatorElement();
205NumberElement* OasisCreationStrategy::createNumberElement()
207 return new NumberElement();
210KFORMULA_NAMESPACE_END
Support for action elements in MathML.
Basis of every formula element.
A left and/or right bracket around one child.
An element that represents an empty box.
The element with up to four indexes in the four corners.
The sequence thats a name.
virtual TextElement * createTextElement(const TQChar &ch, bool symbol=false)
there must always be a TextElement, so this can never return 0
virtual MatrixElement * createMatrixElement(uint rows, uint columns)
when this gets called the user has seen the matrix dialog and expects a matrix!
A line above the content.
The element that contains a number of children.
A element that represents a space.
A symbol is simply a piece of art.
An element that represents one char.
A line below the content.
const char * name(StdAction id)