lib Library API Documentation

IndexElement Class Reference

The element with up to four indexes in the four corners. More...

#include <indexelement.h>

Inheritance diagram for IndexElement:

Inheritance graph
[legend]
Collaboration diagram for IndexElement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 IndexElement (BasicElement *parent=0)
 IndexElement (const IndexElement &)
virtual IndexElementclone ()
virtual bool accept (ElementVisitor *visitor)
virtual QChar getCharacter () const
virtual void entered (SequenceElement *child)
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 ()
SequenceElementgetExponent ()
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)
virtual bool isSenseless ()
bool hasUpperLeft () const
bool hasUpperMiddle () const
bool hasUpperRight () const
bool hasLowerLeft () const
bool hasLowerMiddle () const
bool hasLowerRight () const
void setToUpperLeft (FormulaCursor *cursor)
void setToUpperMiddle (FormulaCursor *cursor)
void setToUpperRight (FormulaCursor *cursor)
void setToLowerLeft (FormulaCursor *cursor)
void setToLowerMiddle (FormulaCursor *cursor)
void setToLowerRight (FormulaCursor *cursor)
void moveToUpperLeft (FormulaCursor *cursor, Direction direction)
void moveToUpperMiddle (FormulaCursor *cursor, Direction direction)
void moveToUpperRight (FormulaCursor *cursor, Direction direction)
void moveToLowerLeft (FormulaCursor *cursor, Direction direction)
void moveToLowerMiddle (FormulaCursor *cursor, Direction direction)
void moveToLowerRight (FormulaCursor *cursor, Direction direction)
ElementIndexPtr getUpperLeft ()
ElementIndexPtr getLowerLeft ()
ElementIndexPtr getUpperMiddle ()
ElementIndexPtr getLowerMiddle ()
ElementIndexPtr getUpperRight ()
ElementIndexPtr getLowerRight ()
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

The element with up to four indexes in the four corners.

Definition at line 34 of file indexelement.h.


Member Function Documentation

bool IndexElement::accept ElementVisitor visitor  )  [virtual]
 

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 169 of file indexelement.cc.

References ElementVisitor::visit().

QChar IndexElement::getCharacter  )  const [virtual]
 

Returns:
the character that represents this element. Used for parsing a sequence. This is guaranteed to be QChar::null for all non-text elements.

Reimplemented from BasicElement.

Definition at line 175 of file indexelement.cc.

References SequenceElement::isTextOnly().

void IndexElement::entered SequenceElement child  )  [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 203 of file indexelement.cc.

References BasicElement::formula(), and FormulaElement::tell().

BasicElement * IndexElement::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 217 of file indexelement.cc.

References BasicElement::getHeight(), BasicElement::getWidth(), BasicElement::getX(), BasicElement::getY(), SequenceElement::goToPos(), BasicElement::goToPos(), and SequenceElement::moveLeft().

void IndexElement::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 334 of file indexelement.cc.

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

void IndexElement::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 503 of file indexelement.cc.

References SequenceElement::draw().

void IndexElement::dispatchFontCommand FontCommand cmd  )  [virtual]
 

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 546 of file indexelement.cc.

References SequenceElement::dispatchFontCommand().

void IndexElement::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 609 of file indexelement.cc.

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

void IndexElement::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 680 of file indexelement.cc.

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

void IndexElement::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 751 of file indexelement.cc.

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

void IndexElement::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 798 of file indexelement.cc.

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

virtual SequenceElement* IndexElement::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 152 of file indexelement.h.

Referenced by SequenceElement::buildCommand().

void IndexElement::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 867 of file indexelement.cc.

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

void IndexElement::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 920 of file indexelement.cc.

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

void IndexElement::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 976 of file indexelement.cc.

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

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

Returns the child at the cursor.

Reimplemented from BasicElement.

Definition at line 1001 of file indexelement.cc.

References FormulaCursor::getPos().

void IndexElement::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 1034 of file indexelement.cc.

bool IndexElement::isSenseless  )  [virtual]
 

Returns wether the element has no more useful children (except its main child) and should therefore be replaced by its main child's content.

Reimplemented from BasicElement.

Definition at line 991 of file indexelement.cc.

ElementIndexPtr IndexElement::getIndex int  position  ) 
 

Returns the index at the position.

Defaults to upperRight.

Definition at line 1301 of file indexelement.cc.

Referenced by SequenceElement::buildCommand().

QString IndexElement::toLatex  )  [virtual]
 

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

Reimplemented from BasicElement.

Definition at line 1322 of file indexelement.cc.

References SequenceElement::toLatex().

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

Same as above, just MathML.

Reimplemented from BasicElement.

Definition at line 1372 of file indexelement.cc.

References SequenceElement::writeMathML().

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

Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 274 of file indexelement.h.

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

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 1183 of file indexelement.cc.

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

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 1229 of file indexelement.cc.

References BasicElement::readAttributesFromDom().

bool IndexElement::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 1242 of file indexelement.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:48:27 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003