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

 numeratorPos
 denominatorPos
enum  { numeratorPos, denominatorPos }

Public Member Functions

 FractionElement (BasicElement *parent=0)
 ~FractionElement ()
 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, bool oasisFormat=false)

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 FractionElement::accept ( ElementVisitor visitor  )  [virtual]

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 58 of file fractionelement.cc.

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.

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.

virtual 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.

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.

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.

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.

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.

virtual 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.

void FractionElement::insert ( FormulaCursor ,
QPtrList< BasicElement > &  ,
Direction   
) [virtual]

Reinserts the denominator if it has been removed.

Reimplemented from BasicElement.

Definition at line 294 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::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.

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.

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.

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.

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.

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.

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.

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.

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

Tells whether the fraction should be drawn with a line.

Definition at line 169 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 448 of file fractionelement.cc.

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.

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

Same as above, just MathML.

Reimplemented from BasicElement.

Definition at line 463 of file fractionelement.cc.


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