27#include "elementtype.h"
28#include "sequenceelement.h"
29#include "textelement.h"
30#include "glyphelement.h"
31#include "tokenelement.h"
32#include "identifierelement.h"
33#include "kformulacommand.h"
34#include "kformulacontainer.h"
35#include "kformuladocument.h"
36#include "formulaelement.h"
37#include "creationstrategy.h"
39KFORMULA_NAMESPACE_BEGIN
46int TokenElement::buildChildrenFromMathMLDom(TQPtrList<BasicElement>& list, TQDomNode n)
48 while ( ! n.isNull() ) {
50 TQString textelements = n.toText().data();
51 textelements = textelements.stripWhiteSpace();
53 for (uint i = 0; i < textelements.length(); i++) {
54 TextElement* child =
new TextElement(textelements[i]);
55 child->setParent(
this);
56 child->setCharFamily( charFamily() );
57 child->setCharStyle( charStyle() );
61 else if ( n.isEntityReference() ) {
62 TQString entity = n.toEntityReference().nodeName();
63 const entityMap* begin = entities;
64 const entityMap* end = entities + entityMap::size();
65 const entityMap* pos = std::lower_bound( begin, end, entity.ascii() );
66 if ( pos == end || TQString( pos->name ) != entity ) {
67 kdWarning() <<
"Invalid entity refererence: " << entity << endl;
70 TextElement* child =
new TextElement( TQChar( pos->unicode ) );
71 child->setParent(
this);
72 child->setCharFamily( charFamily() );
73 child->setCharStyle( charStyle() );
77 else if ( n.isElement() ) {
80 TQDomElement e = n.toElement();
81 if ( e.tagName().lower() !=
"mglyph" ) {
82 kdWarning( DEBUGID ) <<
"Invalid element inside Token Element\n";
85 GlyphElement* child =
new GlyphElement();
86 child->setParent(
this);
87 child->setCharFamily( charFamily() );
88 child->setCharStyle( charStyle() );
95 kdWarning() <<
"Invalid content in TokenElement\n";
100 kdWarning() <<
"Num of children " << list.count() << endl;
104luPt TokenElement::getSpaceBefore(
const ContextStyle& context,
108 if ( !context.isScript( tstyle ) ) {
109 return context.getMediumSpace( tstyle, factor );
114luPt TokenElement::getSpaceAfter(
const ContextStyle& context,
118 if ( !context.isScript( tstyle ) ) {
119 return context.getThinSpace( tstyle, factor );
124KFORMULA_NAMESPACE_END
Basis of every formula element.
int buildFromMathMLDom(TQDomElement element)
Set this element attribute, build children and call their builFromMathMLDom.
Contains all the style information for the formela.
TextStyle
Textstyles like in TeX.
This class handles mathematical style attributes common to token elements, as explained in MathML Spe...