lib Library API Documentation

FractionElement Class Reference

A fraction. More...

#include <fractionelement.h>

Inheritance diagram for FractionElement:

BasicElement List of all members.

Public Types

enum  { numeratorPos, denominatorPos }

Public Member Functions

 FractionElement (BasicElement *parent=0)
 FractionElement (const FractionElement &)
virtual FractionElementclone ()
virtual bool accept (ElementVisitor *visitor)
virtual TokenType getTokenType () const
virtual void entered (SequenceElement *child)
virtual BasicElementgoToPos (FormulaCursor *, bool &handled, const LuPixelPoint &point, const LuPixelPoint &parentOrigin)
virtual void calcSizes (const ContextStyle &style, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle)
virtual void draw (QPainter &painter, const LuPixelRect &r, const ContextStyle &style, 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 void insert (FormulaCursor *, QPtrList< BasicElement > &, Direction)
virtual void remove (FormulaCursor *, QPtrList< BasicElement > &, Direction)
virtual SequenceElementgetMainChild ()
SequenceElementgetNumerator ()
SequenceElementgetDenominator ()
virtual bool isSenseless ()
virtual void selectChild (FormulaCursor *cursor, BasicElement *child)
void showLine (bool line)
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 fraction.

Definition at line 33 of file fractionelement.h.


Member Function Documentation

bool FractionElement::accept ElementVisitor visitor  )  [virtual]
 

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 58 of file fractionelement.cc.

References accept(), and ElementVisitor::visit().

Referenced by accept().

virtual TokenType FractionElement::getTokenType  )  const [inline, virtual]
 

Returns:
the type of this element. Used for parsing a sequence.

Reimplemented from BasicElement.

Definition at line 54 of file fractionelement.h.

void FractionElement::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 63 of file fractionelement.cc.

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

Referenced by entered().

BasicElement * FractionElement::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 74 of file fractionelement.cc.

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

Referenced by goToPos().

void FractionElement::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 117 of file fractionelement.cc.

References SequenceElement::calcSizes(), calcSizes(), BasicElement::getHeight(), BasicElement::getWidth(), BasicElement::setX(), and BasicElement::setY().

Referenced by calcSizes().

void FractionElement::draw QPainter painter,
const LuPixelRect r,
const ContextStyle style,
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 147 of file fractionelement.cc.

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

Referenced by draw().

void FractionElement::dispatchFontCommand FontCommand cmd  )  [virtual]
 

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 177 of file fractionelement.cc.

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

Referenced by dispatchFontCommand().

void FractionElement::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 188 of file fractionelement.cc.

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

Referenced by moveLeft().

void FractionElement::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 218 of file fractionelement.cc.

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

Referenced by moveRight().

void FractionElement::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 248 of file fractionelement.cc.

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

Referenced by moveUp().

void FractionElement::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 272 of file fractionelement.cc.

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

Referenced by moveDown().

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

Reinserts the denominator if it has been removed.

Reimplemented from BasicElement.

Definition at line 294 of file fractionelement.cc.

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

Referenced by insert().

void FractionElement::remove FormulaCursor ,
QPtrList< BasicElement > &  ,
Direction 
[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 numerator.

It is possible to remove the denominator. But after this we are senseless and the caller is required to replace us.

Reimplemented from BasicElement.

Definition at line 323 of file fractionelement.cc.

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

Referenced by remove().

SequenceElement * FractionElement::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 358 of file fractionelement.cc.

bool FractionElement::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 348 of file fractionelement.cc.

void FractionElement::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 376 of file fractionelement.cc.

References selectChild(), and FormulaCursor::setTo().

Referenced by selectChild().

void FractionElement::showLine bool  line  )  [inline]
 

Tells whether the fraction should be drawn with a line.

Definition at line 169 of file fractionelement.h.

References showLine().

Referenced by SequenceElement::buildCommand(), NameSequence::replaceElement(), and showLine().

QString FractionElement::toLatex  )  [virtual]
 

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

Reimplemented from BasicElement.

Definition at line 448 of file fractionelement.cc.

References SequenceElement::toLatex().

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

Same as above, just MathML.

Reimplemented from BasicElement.

Definition at line 463 of file fractionelement.cc.

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

Referenced by writeMathML().

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

Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 188 of file fractionelement.h.

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

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 390 of file fractionelement.cc.

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

Referenced by writeDom().

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 410 of file fractionelement.cc.

References readAttributesFromDom().

Referenced by readAttributesFromDom().

bool FractionElement::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 427 of file fractionelement.cc.

References readContentFromDom().

Referenced by 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.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Sep 24 18:22:30 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003