lib Library API Documentation

SymbolElement Class Reference

A symbol is simply a piece of art. More...

#include <symbolelement.h>

Inheritance diagram for SymbolElement:

Inheritance graph
[legend]
Collaboration diagram for SymbolElement:

Collaboration graph
[legend]
List of all members.

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 &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle)
virtual void draw (QPainter &painter, const LuPixelRect &r, const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, 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)

Protected Member Functions

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

Detailed Description

A symbol is simply a piece of art.

Definition at line 33 of file symbolelement.h.


Member Function Documentation

bool SymbolElement::accept ElementVisitor visitor  )  [virtual]
 

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 130 of file symbolelement.cc.

References ElementVisitor::visit().

BasicElement * SymbolElement::goToPos FormulaCursor ,
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.

References BasicElement::getX(), SequenceElement::goToPos(), BasicElement::goToPos(), hasUpper(), SequenceElement::moveLeft(), and SequenceElement::moveRight().

void SymbolElement::calcSizes const ContextStyle style,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle
[virtual]
 

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

Implements BasicElement.

Definition at line 197 of file symbolelement.cc.

References BasicElement::axis(), SequenceElement::calcSizes(), BasicElement::getBaseline(), BasicElement::getHeight(), BasicElement::getWidth(), BasicElement::getX(), BasicElement::getY(), hasUpper(), BasicElement::setX(), and BasicElement::setY().

void SymbolElement::draw QPainter painter,
const LuPixelRect r,
const ContextStyle context,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle,
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 302 of file symbolelement.cc.

References SequenceElement::draw(), and hasUpper().

void SymbolElement::dispatchFontCommand FontCommand cmd  )  [virtual]
 

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 345 of file symbolelement.cc.

References SequenceElement::dispatchFontCommand(), and hasUpper().

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

References FormulaCursor::getLinearMovement(), hasUpper(), FormulaCursor::isSelectionMode(), SequenceElement::moveLeft(), and BasicElement::moveLeft().

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

References FormulaCursor::getLinearMovement(), hasUpper(), FormulaCursor::isSelectionMode(), SequenceElement::moveRight(), and BasicElement::moveRight().

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

References hasUpper(), FormulaCursor::isSelectionMode(), SequenceElement::moveLeft(), SequenceElement::moveRight(), and BasicElement::moveUp().

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

References FormulaCursor::isSelectionMode(), BasicElement::moveDown(), SequenceElement::moveLeft(), and SequenceElement::moveRight().

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 140 of file symbolelement.h.

void SymbolElement::insert FormulaCursor ,
QPtrList< BasicElement > &  ,
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 525 of file symbolelement.cc.

References FormulaElement::changed(), BasicElement::formula(), FormulaCursor::getPos(), SequenceElement::moveLeft(), SequenceElement::moveRight(), BasicElement::setParent(), and FormulaCursor::setSelection().

void SymbolElement::remove FormulaCursor ,
QPtrList< BasicElement > &  ,
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 565 of file symbolelement.cc.

References FormulaElement::changed(), FormulaElement::elementRemoval(), BasicElement::formula(), FormulaCursor::getPos(), BasicElement::remove(), and BasicElement::selectChild().

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

References SequenceElement::moveLeft(), and SequenceElement::moveRight().

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

Returns the child at the cursor.

Reimplemented from BasicElement.

Definition at line 610 of file symbolelement.cc.

References FormulaCursor::getPos().

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 628 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 192 of file symbolelement.h.

Referenced by calcSizes(), dispatchFontCommand(), draw(), goToPos(), moveLeft(), moveRight(), moveUp(), toLatex(), writeDom(), and writeMathML().

ElementIndexPtr SymbolElement::getIndex int  position  ) 
 

Returns the index at the position.

Defaults to upperRight.

Definition at line 688 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 782 of file symbolelement.cc.

References hasUpper(), and SequenceElement::toLatex().

void SymbolElement::writeMathML QDomDocument  doc,
QDomNode  parent
[virtual]
 

Same as above, just MathML.

Reimplemented from BasicElement.

Definition at line 850 of file symbolelement.cc.

References hasUpper(), and SequenceElement::writeMathML().

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

Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 235 of file symbolelement.h.

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

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 703 of file symbolelement.cc.

References BasicElement::getElementDom(), hasUpper(), and BasicElement::writeDom().

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 731 of file symbolelement.cc.

References BasicElement::readAttributesFromDom().

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

References BasicElement::buildChild(), and BasicElement::readContentFromDom().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:51:14 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003