lib

SymbolElement Class Reference

#include <symbolelement.h>

Inheritance diagram for SymbolElement:

BasicElement

List of all members.


Detailed Description

A symbol is simply a piece of art.

Definition at line 33 of file symbolelement.h.


Public Member Functions

 SymbolElement (SymbolType type=EmptyBracket, BasicElement *parent=0)
 SymbolElement (const SymbolElement &)
virtual SymbolElementclone ()
virtual bool accept (ElementVisitor *visitor)
virtual BasicElementgoToPos (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 draw (QPainter &painter, const LuPixelRect &r, const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style, const LuPixelPoint &parentOrigin)
virtual void dispatchFontCommand (FontCommand *cmd)
virtual void moveLeft (FormulaCursor *cursor, BasicElement *from)
virtual void moveRight (FormulaCursor *cursor, BasicElement *from)
virtual void moveUp (FormulaCursor *cursor, BasicElement *from)
virtual void moveDown (FormulaCursor *cursor, BasicElement *from)
virtual SequenceElementgetMainChild ()
virtual void insert (FormulaCursor *, QPtrList< BasicElement > &, Direction)
virtual void remove (FormulaCursor *, QPtrList< BasicElement > &, Direction)
virtual void normalize (FormulaCursor *, Direction)
virtual BasicElementgetChild (FormulaCursor *, Direction=beforeCursor)
virtual void selectChild (FormulaCursor *cursor, BasicElement *child)
bool hasUpper () const
bool hasLower () const
void setToUpper (FormulaCursor *cursor)
void setToLower (FormulaCursor *cursor)
void moveToUpper (FormulaCursor *, Direction)
void moveToLower (FormulaCursor *, Direction)
ElementIndexPtr getUpperIndex ()
ElementIndexPtr getLowerIndex ()
ElementIndexPtr getIndex (int position)
virtual QString toLatex ()
virtual QString formulaString ()
virtual void writeMathML (QDomDocument &doc, QDomNode &parent, bool oasisFormat=false) const

Protected Member Functions

virtual QString getTagName () const
virtual void writeDom (QDomElement element)
virtual bool readAttributesFromDom (QDomElement element)
virtual bool readContentFromDom (QDomNode &node)

Member Function Documentation

bool SymbolElement::accept ( ElementVisitor  )  [virtual]

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 130 of file symbolelement.cc.

BasicElement * SymbolElement::goToPos ( FormulaCursor cursor,
bool &  handled,
const LuPixelPoint &  point,
const LuPixelPoint &  parentOrigin 
) [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 136 of file symbolelement.cc.

void SymbolElement::calcSizes ( const ContextStyle cstyle,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle,
StyleAttributes &  style 
) [virtual]

Calculates our width and height and our children's parentPosition.

Implements BasicElement.

Definition at line 197 of file symbolelement.cc.

void SymbolElement::draw ( QPainter &  painter,
const LuPixelRect &  r,
const ContextStyle context,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle,
StyleAttributes &  style,
const LuPixelPoint &  parentOrigin 
) [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.

Implements BasicElement.

Definition at line 306 of file symbolelement.cc.

void SymbolElement::dispatchFontCommand ( FontCommand cmd  )  [virtual]

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 350 of file symbolelement.cc.

void SymbolElement::moveLeft ( FormulaCursor cursor,
BasicElement from 
) [virtual]

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.

Reimplemented from BasicElement.

Definition at line 374 of file symbolelement.cc.

void SymbolElement::moveRight ( FormulaCursor cursor,
BasicElement from 
) [virtual]

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.

Reimplemented from BasicElement.

Definition at line 414 of file symbolelement.cc.

void SymbolElement::moveUp ( FormulaCursor cursor,
BasicElement from 
) [virtual]

Enters this element while moving up starting inside the element `from'.

Searches for a cursor position inside this element or above it.

Reimplemented from BasicElement.

Definition at line 454 of file symbolelement.cc.

void SymbolElement::moveDown ( FormulaCursor cursor,
BasicElement from 
) [virtual]

Enters this element while moving down starting inside the element `from'.

Searches for a cursor position inside this element or below it.

Reimplemented from BasicElement.

Definition at line 482 of file symbolelement.cc.

virtual SequenceElement* SymbolElement::getMainChild (  )  [inline, 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 144 of file symbolelement.h.

void SymbolElement::insert ( FormulaCursor cursor,
QPtrList< BasicElement > &  newChildren,
Direction  direction 
) [virtual]

Inserts all new children at the cursor position.

Places the cursor according to the direction.

You only can insert one index at a time. So the list must contain exactly on SequenceElement. And the index you want to insert must not exist already.

The list will be emptied but stays the property of the caller.

Reimplemented from BasicElement.

Definition at line 530 of file symbolelement.cc.

void SymbolElement::remove ( FormulaCursor cursor,
QPtrList< BasicElement > &  removedChildren,
Direction  direction 
) [virtual]

Removes all selected children and returns them.

Places the cursor to where the children have been.

The cursor has to be inside one of our indexes which is supposed to be empty. The index will be removed and the cursor will be placed to the removed index so it can be inserted again. This methode is called by SequenceElement::remove only.

The ownership of the list is passed to the caller.

Reimplemented from BasicElement.

Definition at line 570 of file symbolelement.cc.

void SymbolElement::normalize ( FormulaCursor cursor,
Direction  direction 
) [virtual]

Moves the cursor to a normal place where new elements might be inserted.

Reimplemented from BasicElement.

Definition at line 602 of file symbolelement.cc.

BasicElement * SymbolElement::getChild ( FormulaCursor cursor,
Direction  = beforeCursor 
) [virtual]

Returns the child at the cursor.

Reimplemented from BasicElement.

Definition at line 615 of file symbolelement.cc.

void SymbolElement::selectChild ( FormulaCursor cursor,
BasicElement child 
) [virtual]

Sets the cursor to select the child.

The mark is placed before, the position behind it.

Reimplemented from BasicElement.

Definition at line 633 of file symbolelement.cc.

bool SymbolElement::hasUpper (  )  const [inline]

Moves the cursor away from the given child.

The cursor is guaranteed to be inside this element.

Definition at line 196 of file symbolelement.h.

ElementIndexPtr SymbolElement::getIndex ( int  position  ) 

Returns the index at the position.

Defaults to upperRight.

Definition at line 693 of file symbolelement.cc.

QString SymbolElement::toLatex (  )  [virtual]

Returns:
the latex representation of the element and of the element's children

Reimplemented from BasicElement.

Definition at line 787 of file symbolelement.cc.

void SymbolElement::writeMathML ( QDomDocument &  doc,
QDomNode &  parent,
bool  oasisFormat = false 
) const [virtual]

Same as above, just MathML.

It shouldn't be redefined but for exceptional cases, use the general writeMathML* API instead

Reimplemented from BasicElement.

Definition at line 855 of file symbolelement.cc.

virtual QString SymbolElement::getTagName (  )  const [inline, protected, virtual]

Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 239 of file symbolelement.h.

void SymbolElement::writeDom ( QDomElement  element  )  [protected, virtual]

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 708 of file symbolelement.cc.

bool SymbolElement::readAttributesFromDom ( QDomElement  element  )  [protected, virtual]

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 736 of file symbolelement.cc.

bool SymbolElement::readContentFromDom ( QDomNode &  node  )  [protected, virtual]

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 755 of file symbolelement.cc.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys