lib

FractionElement Class Reference

#include <fractionelement.h>

Inheritance diagram for FractionElement:

BasicElement

List of all members.


Detailed Description

A fraction.

Definition at line 33 of file fractionelement.h.


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

Protected Member Functions

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

Member Function Documentation

bool FractionElement::accept ( ElementVisitor  )  [virtual]

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 67 of file fractionelement.cc.

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 72 of file fractionelement.cc.

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

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

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

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

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 197 of file fractionelement.cc.

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 208 of file fractionelement.cc.

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 238 of file fractionelement.cc.

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 268 of file fractionelement.cc.

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 292 of file fractionelement.cc.

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 314 of file fractionelement.cc.

void FractionElement::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.

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 343 of file fractionelement.cc.

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 378 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 368 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 396 of file fractionelement.cc.

void FractionElement::showLine ( bool  line  )  [inline]

Moves the cursor away from the given child.

The cursor is guaranteed to be inside this element. Tells whether the fraction should be drawn with a line.

Definition at line 173 of file fractionelement.h.

QString FractionElement::toLatex (  )  [virtual]

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

Reimplemented from BasicElement.

Definition at line 565 of file fractionelement.cc.

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

Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 198 of file fractionelement.h.

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

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 410 of file fractionelement.cc.

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 430 of file fractionelement.cc.

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 513 of file fractionelement.cc.

bool FractionElement::readAttributesFromMathMLDom ( const QDomElement &  element  )  [protected, virtual]

Reads our attributes from the MathML element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 447 of file fractionelement.cc.

int FractionElement::readContentFromMathMLDom ( QDomNode &  node  )  [protected, virtual]

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 539 of file fractionelement.cc.


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