#include <rootelement.h>
Public Member Functions | |
| RootElement (BasicElement *parent=0) | |
| RootElement (const RootElement &) | |
| virtual RootElement * | clone () |
| virtual bool | accept (ElementVisitor *visitor) |
| virtual void | entered (SequenceElement *child) |
| virtual BasicElement * | goToPos (FormulaCursor *, bool &handled, const LuPixelPoint &point, const LuPixelPoint &parentOrigin) |
| virtual void | calcSizes (const ContextStyle &cstyle, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style) |
| virtual void | dispatchFontCommand (FontCommand *cmd) |
| virtual void | insert (FormulaCursor *, TQPtrList< BasicElement > &, Direction) |
| virtual void | remove (FormulaCursor *, TQPtrList< BasicElement > &, Direction) |
| virtual void | normalize (FormulaCursor *, Direction) |
| virtual SequenceElement * | getMainChild () |
| SequenceElement * | getRadiant () |
| virtual void | selectChild (FormulaCursor *cursor, BasicElement *child) |
| void | moveToIndex (FormulaCursor *, Direction) |
| void | setToIndex (FormulaCursor *) |
| bool | hasIndex () const |
| ElementIndexPtr | getIndex () |
| virtual TQString | toLatex () |
| virtual TQString | formulaString () |
| Public Member Functions inherited from BasicElement | |
| BasicElement (BasicElement *parent=0) | |
| BasicElement (const BasicElement &) | |
| virtual bool | readOnly (const BasicElement *child) const |
| virtual FormulaElement * | formula () |
| virtual const FormulaElement * | formula () const |
| virtual TQChar | getCharacter () const |
| virtual TokenType | getTokenType () const |
| virtual bool | isInvisible () const |
| LuPixelPoint | widgetPos () |
| virtual void | moveHome (FormulaCursor *) |
| virtual void | moveEnd (FormulaCursor *) |
| virtual void | goInside (FormulaCursor *cursor) |
| virtual bool | isSenseless () |
| virtual BasicElement * | getChild (FormulaCursor *, Direction=beforeCursor) |
| virtual void | childWillVanish (FormulaCursor *, BasicElement *) |
| virtual void | registerTab (BasicElement *) |
| virtual KCommand * | buildCommand (Container *, Request *) |
| virtual KCommand * | input (Container *, TQKeyEvent *) |
| const BasicElement * | getParent () const |
| BasicElement * | getParent () |
| void | setParent (BasicElement *p) |
| luPixel | getX () const |
| luPixel | getY () const |
| void | setX (luPixel x) |
| void | setY (luPixel y) |
| luPixel | getWidth () const |
| luPixel | getHeight () const |
| void | setWidth (luPixel width) |
| void | setHeight (luPixel height) |
| luPixel | getBaseline () const |
| void | setBaseline (luPixel line) |
| luPixel | axis (const ContextStyle &style, ContextStyle::TextStyle tstyle, double factor) const |
| TQDomElement | getElementDom (TQDomDocument &doc) |
| virtual void | writeMathML (TQDomDocument &doc, TQDomNode &parent, bool oasisFormat=false) const |
| bool | buildFromDom (TQDomElement element) |
| int | buildFromMathMLDom (TQDomElement element) |
| ElementType * | getElementType () const |
| virtual void | setElementType (ElementType *t) |
| virtual void | setStyle (StyleElement *) |
Protected Member Functions | |
| virtual TQString | getTagName () const |
| virtual void | writeDom (TQDomElement element) |
| virtual bool | readAttributesFromDom (TQDomElement element) |
| virtual bool | readContentFromDom (TQDomNode &node) |
| virtual bool | readAttributesFromMathMLDom (const TQDomElement &element) |
| virtual int | readContentFromMathMLDom (TQDomNode &node) |
| Protected Member Functions inherited from BasicElement | |
| virtual void | writeMathMLAttributes (TQDomElement &) const |
| bool | buildChild (SequenceElement *child, TQDomNode node, TQString name) |
| double | getSize (const TQString &str, SizeType *st) |
| SizeType | getSpace (const TQString &str) |
Additional Inherited Members | |
| Static Public Member Functions inherited from BasicElement | |
| static int | getEvilDestructionCount () |
Detailed Description
A nice graphical root.
Definition at line 35 of file rootelement.h.
Constructor & Destructor Documentation
◆ RootElement() [1/2]
| RootElement::RootElement | ( | BasicElement * | parent = 0 | ) |
Definition at line 95 of file rootelement.cpp.
◆ ~RootElement()
| RootElement::~RootElement | ( | ) |
Definition at line 102 of file rootelement.cpp.
◆ RootElement() [2/2]
| RootElement::RootElement | ( | const RootElement & | other | ) |
Definition at line 109 of file rootelement.cpp.
Member Function Documentation
◆ accept()
|
virtual |
Visit this element.
An implementation of the visitor pattern.
Implements BasicElement.
Definition at line 123 of file rootelement.cpp.
◆ calcSizes()
|
virtual |
Calculates our width and height and our children's parentPosition.
Implements BasicElement.
Definition at line 181 of file rootelement.cpp.
◆ clone()
|
inlinevirtual |
Implements BasicElement.
Definition at line 46 of file rootelement.h.
◆ dispatchFontCommand()
|
virtual |
Draws the whole element including its children.
The `parentOrigin' is the point this element's parent starts. We can use our parentPosition to get our own origin then. */ virtual void draw( TQPainter& painter, const LuPixelRect& r, const ContextStyle& cstyle, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes& style, const LuPixelPoint& parentOrigin );
/** Dispatch this FontCommand to all our TextElement children.
Reimplemented from BasicElement.
◆ entered()
|
virtual |
The cursor has entered one of our child sequences.
This is a good point to tell the user where he is.
Reimplemented from BasicElement.
Definition at line 129 of file rootelement.cpp.
◆ formulaString()
|
virtual |
Reimplemented from BasicElement.
Definition at line 663 of file rootelement.cpp.
◆ getIndex()
|
inline |
Definition at line 170 of file rootelement.h.
◆ getMainChild()
|
virtual |
Removes the child.
If this was the main child this element might request its own removal. The cursor is the one that caused the removal. It has to be moved to the place any user expects the cursor after that particular element has been removed.
Reimplemented from BasicElement.
Definition at line 481 of file rootelement.cpp.
◆ getRadiant()
|
inline |
Definition at line 145 of file rootelement.h.
◆ getTagName()
|
inlineprotectedvirtual |
Returns the tag name of this element type.
Reimplemented from BasicElement.
Definition at line 191 of file rootelement.h.
◆ goToPos()
|
virtual |
Sets the cursor and returns the element the point is in.
The handled flag shows whether the cursor has been set. This is needed because only the innermost matching element is allowed to set the cursor.
Reimplemented from BasicElement.
Definition at line 140 of file rootelement.cpp.
◆ hasIndex()
|
inline |
Definition at line 168 of file rootelement.h.
◆ insert()
|
virtual |
Enters this element while moving to the left starting inside the element `from'.
Draws the whole element including its children.
Searches for a cursor position inside this element or to the left of it. */ virtual void moveLeft(FormulaCursor* cursor, BasicElement* from);
/** Enters this element while moving to the right starting inside the element `from'. Searches for a cursor position inside this element or to the right of it. */ virtual void moveRight(FormulaCursor* cursor, BasicElement* from);
/** Enters this element while moving up starting inside the element `from'. Searches for a cursor position inside this element or above it. */ virtual void moveUp(FormulaCursor* cursor, BasicElement* from);
/** Enters this element while moving down starting inside the element `from'. Searches for a cursor position inside this element or below it. */ virtual void moveDown(FormulaCursor* cursor, BasicElement* from);
/** Reinserts the index if it has been removed.
The `parentOrigin' is the point this element's parent starts. We can use our parentPosition to get our own origin then. */ void RootElement::draw( TQPainter& painter, const LuPixelRect& r, const ContextStyle& context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes& style, const LuPixelPoint& parentOrigin ) { LuPixelPoint myPos( parentOrigin.x()+getX(), parentOrigin.y()+getY() ); if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) ) return;
content->draw( painter, r, context, tstyle, context.convertIndexStyleLower(istyle), style, myPos); if (hasIndex()) { index->draw(painter, r, context, context.convertTextStyleIndex(tstyle), context.convertIndexStyleUpper(istyle), style, myPos); }
luPixel x = myPos.x() + rootOffset.x(); luPixel y = myPos.y() + rootOffset.y(); int distX = context.getDistanceX(tstyle); double factor = style.sizeFactor(); luPixel distY = context.ptToPixelY( context.getThinSpace( tstyle, factor ) ); luPixel unit = (content->getHeight() + distY)/ 3;
painter.setPen( TQPen( style.color(), context.layoutUnitToPixelX( 2*context.getLineWidth( factor ) ) ) ); painter.drawLine( context.layoutUnitToPixelX( x+unit/3 ), context.layoutUnitToPixelY( y+unit+distY/3 ), context.layoutUnitToPixelX( x+unit/2+unit/3 ), context.layoutUnitToPixelY( myPos.y()+getHeight() ) );
painter.setPen( TQPen( style.color(), context.layoutUnitToPixelY( context.getLineWidth( factor ) ) ) );
painter.drawLine( context.layoutUnitToPixelX( x+unit+unit/3 ), context.layoutUnitToPixelY( y+distY/3 ), context.layoutUnitToPixelX( x+unit/2+unit/3 ), context.layoutUnitToPixelY( myPos.y()+getHeight() ) ); painter.drawLine( context.layoutUnitToPixelX( x+unit+unit/3 ), context.layoutUnitToPixelY( y+distY/3 ), context.layoutUnitToPixelX( x+unit+unit/3+content->getWidth() ), context.layoutUnitToPixelY( y+distY/3 ) ); painter.drawLine( context.layoutUnitToPixelX( x+unit/3 ), context.layoutUnitToPixelY( y+unit+distY/2 ), context.layoutUnitToPixelX( x ), context.layoutUnitToPixelY( y+unit+unit/2 ) ); }
void RootElement::dispatchFontCommand( FontCommand* cmd ) { content->dispatchFontCommand( cmd ); if (hasIndex()) { index->dispatchFontCommand( cmd ); } }
/** Enters this element while moving to the left starting inside the element `from'. Searches for a cursor position inside this element or to the left of it. */ void RootElement::moveLeft(FormulaCursor* cursor, BasicElement* from) { if (cursor->isSelectionMode()) { getParent()->moveLeft(cursor, this); } else { bool linear = cursor->getLinearMovement(); if (from == getParent()) { content->moveLeft(cursor, this); } else if (from == content) { if (linear && hasIndex()) { index->moveLeft(cursor, this); } else { getParent()->moveLeft(cursor, this); } } else { getParent()->moveLeft(cursor, this); } } }
/** Enters this element while moving to the right starting inside the element `from'. Searches for a cursor position inside this element or to the right of it. */ void RootElement::moveRight(FormulaCursor* cursor, BasicElement* from) { if (cursor->isSelectionMode()) { getParent()->moveRight(cursor, this); } else { bool linear = cursor->getLinearMovement(); if (from == getParent()) { if (linear && hasIndex()) { index->moveRight(cursor, this); } else { content->moveRight(cursor, this); } } else if (from == index) { content->moveRight(cursor, this); } else { getParent()->moveRight(cursor, this); } } }
/** Enters this element while moving up starting inside the element `from'. Searches for a cursor position inside this element or above it. */ void RootElement::moveUp(FormulaCursor* cursor, BasicElement* from) { if (cursor->isSelectionMode()) { getParent()->moveUp(cursor, this); } else { if (from == getParent()) { content->moveRight(cursor, this); } else if (from == content) { if (hasIndex()) { index->moveRight(cursor, this); } else { getParent()->moveUp(cursor, this); } } else { getParent()->moveUp(cursor, this); } } }
/** Enters this element while moving down starting inside the element `from'. Searches for a cursor position inside this element or below it. */ void RootElement::moveDown(FormulaCursor* cursor, BasicElement* from) { if (cursor->isSelectionMode()) { getParent()->moveDown(cursor, this); } else { if (from == getParent()) { if (hasIndex()) { index->moveRight(cursor, this); } else { content->moveRight(cursor, this); } } else if (from == index) { content->moveRight(cursor, this); } else { getParent()->moveDown(cursor, this); } } }
/** Reinserts the index if it has been removed.
Reimplemented from BasicElement.
Definition at line 417 of file rootelement.cpp.
◆ moveToIndex()
| void RootElement::moveToIndex | ( | FormulaCursor * | cursor, |
| Direction | direction ) |
Moves the cursor away from the given child.
The cursor is guaranteed to be inside this element.
Definition at line 510 of file rootelement.cpp.
◆ normalize()
|
virtual |
Moves the cursor to a normal place where new elements might be inserted.
Reimplemented from BasicElement.
Definition at line 466 of file rootelement.cpp.
◆ readAttributesFromDom()
|
protectedvirtual |
Reads our attributes from the element.
Returns false if it failed.
Reimplemented from BasicElement.
Definition at line 552 of file rootelement.cpp.
◆ readAttributesFromMathMLDom()
|
protectedvirtual |
Reads our attributes from the MathML element.
Also checks whether it's a msqrt or mroot. Returns false if it failed.
Reimplemented from BasicElement.
Definition at line 595 of file rootelement.cpp.
◆ readContentFromDom()
|
protectedvirtual |
Reads our content from the node.
Sets the node to the next node that needs to be read. Returns false if it failed.
Reimplemented from BasicElement.
Definition at line 562 of file rootelement.cpp.
◆ readContentFromMathMLDom()
|
protectedvirtual |
Reads our content from the MathML node.
Sets the node to the next node that needs to be read. Returns false if it failed.
Reimplemented from BasicElement.
Definition at line 610 of file rootelement.cpp.
◆ remove()
|
virtual |
Removes all selected children and returns them.
Places the cursor to where the children have been.
We remove ourselve if we are requested to remove our content.
Reimplemented from BasicElement.
Definition at line 442 of file rootelement.cpp.
◆ selectChild()
|
virtual |
Sets the cursor to select the child.
The mark is placed before, the position behind it.
Reimplemented from BasicElement.
Definition at line 499 of file rootelement.cpp.
◆ setToIndex()
| void RootElement::setToIndex | ( | FormulaCursor * | cursor | ) |
Definition at line 522 of file rootelement.cpp.
◆ toLatex()
|
virtual |
- Returns
- the latex representation of the element and of the element's children
Reimplemented from BasicElement.
Definition at line 647 of file rootelement.cpp.
◆ writeDom()
|
protectedvirtual |
Appends our attributes to the dom element.
Reimplemented from BasicElement.
Definition at line 531 of file rootelement.cpp.
The documentation for this class was generated from the following files:
