lib Library API Documentation

FormulaElement Class Reference

The main element. More...

#include <formulaelement.h>

Inheritance diagram for FormulaElement:

SequenceElement BasicElement List of all members.

Public Member Functions

 FormulaElement (FormulaDocument *container)
virtual FormulaElementclone ()
BasicElementgoToPos (FormulaCursor *, const LuPixelPoint &point)
virtual bool readOnly (const BasicElement *) const
virtual bool readOnly (const FormulaCursor *) const
virtual FormulaElementformula ()
virtual const FormulaElementformula () const
void elementRemoval (BasicElement *child)
virtual void changed ()
void cursorHasMoved (FormulaCursor *)
void moveOutLeft (FormulaCursor *)
void moveOutRight (FormulaCursor *)
void moveOutBelow (FormulaCursor *)
void moveOutAbove (FormulaCursor *)
void tell (const QString &msg)
void removeFormula (FormulaCursor *)
void insertFormula (FormulaCursor *)
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)
void calcSizes (ContextStyle &context)
void draw (QPainter &painter, const LuPixelRect &r, ContextStyle &context)
virtual KCommand * buildCommand (Container *, Request *)
const SymbolTablegetSymbolTable () const
virtual QString toLatex ()
int getBaseSize () const
void setBaseSize (int size)
bool hasOwnBaseSize () const
virtual KCommand * input (Container *container, QKeyEvent *event)
virtual void writeMathML (QDomDocument doc, QDomNode parent)
virtual void writeDom (QDomElement element)
QDomElement emptyFormulaElement (QDomDocument doc)

Protected Member Functions

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

Detailed Description

The main element.

A formula consists of a FormulaElement and its children. The only element that has no parent.

Definition at line 40 of file formulaelement.h.


Constructor & Destructor Documentation

KFORMULA_NAMESPACE_BEGIN FormulaElement::FormulaElement FormulaDocument container  ) 
 

The container this FormulaElement belongs to must not be 0, except you really know what you are doing.

Definition at line 34 of file formulaelement.cc.

References FormulaElement().

Referenced by FormulaElement().


Member Function Documentation

BasicElement * FormulaElement::goToPos FormulaCursor cursor,
const LuPixelPoint point
 

Returns the element the point is in.

Definition at line 56 of file formulaelement.cc.

References SequenceElement::countChildren(), goToPos(), and FormulaCursor::setTo().

Referenced by goToPos().

virtual bool FormulaElement::readOnly const BasicElement  )  const [inline, virtual]
 

Ordinary formulas are not write protected.

Reimplemented from BasicElement.

Definition at line 60 of file formulaelement.h.

References readOnly().

Referenced by readOnly().

virtual bool FormulaElement::readOnly const FormulaCursor  )  const [inline, virtual]
 

Returns:
whether its prohibited to change the sequence with this cursor.

Reimplemented from SequenceElement.

Definition at line 65 of file formulaelement.h.

virtual FormulaElement* FormulaElement::formula  )  [inline, virtual]
 

Provide fast access to the rootElement for each child.

Reimplemented from BasicElement.

Definition at line 70 of file formulaelement.h.

virtual const FormulaElement* FormulaElement::formula  )  const [inline, virtual]
 

Provide fast access to the rootElement for each child.

Reimplemented from BasicElement.

Definition at line 75 of file formulaelement.h.

void FormulaElement::elementRemoval BasicElement child  ) 
 

Gets called just before the child is removed from the element tree.

Definition at line 69 of file formulaelement.cc.

References FormulaDocument::elementRemoval(), and elementRemoval().

Referenced by elementRemoval(), SymbolElement::remove(), SequenceElement::remove(), RootElement::remove(), MultilineElement::remove(), IndexElement::remove(), and FractionElement::remove().

void FormulaElement::changed  )  [virtual]
 

Gets called whenever something changes and we need to recalc.

Definition at line 74 of file formulaelement.cc.

References FormulaDocument::changed().

Referenced by SymbolElement::insert(), SequenceElement::insert(), RootElement::insert(), MultilineElement::insert(), IndexElement::insert(), FractionElement::insert(), SymbolElement::remove(), SequenceElement::remove(), RootElement::remove(), MultilineElement::remove(), IndexElement::remove(), and FractionElement::remove().

void FormulaElement::cursorHasMoved FormulaCursor  ) 
 

Gets called when a request has the side effect of moving the cursor.

In the end any operation that moves the cursor should call this.

Definition at line 79 of file formulaelement.cc.

References FormulaDocument::cursorHasMoved(), and cursorHasMoved().

Referenced by SequenceElement::buildCommand(), cursorHasMoved(), and SequenceElement::input().

void FormulaElement::tell const QString msg  ) 
 

Tell the user something has happened.

Definition at line 104 of file formulaelement.cc.

References FormulaDocument::tell(), and tell().

Referenced by SequenceElement::buildCommand(), RootElement::entered(), MultilineElement::entered(), MatrixElement::entered(), IndexElement::entered(), FractionElement::entered(), UnderlineElement::entered(), OverlineElement::entered(), BracketElement::entered(), BasicElement::entered(), SequenceElement::moveLeft(), SequenceElement::moveRight(), and tell().

void FormulaElement::removeFormula FormulaCursor  ) 
 

Gets called when the formula wants to vanish.

The one who holds it should create an appropriate command and execute it.

Definition at line 109 of file formulaelement.cc.

References FormulaDocument::removeFormula(), and removeFormula().

Referenced by removeFormula().

void FormulaElement::calcSizes const ContextStyle context,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle
[virtual]
 

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

Reimplemented from SequenceElement.

Definition at line 119 of file formulaelement.cc.

References calcSizes().

Referenced by calcSizes(), and Container::recalc().

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

Reimplemented from SequenceElement.

Definition at line 127 of file formulaelement.cc.

References draw().

Referenced by Container::draw(), draw(), and Container::print().

void FormulaElement::calcSizes ContextStyle context  ) 
 

Calculates the formulas sizes and positions.

Definition at line 140 of file formulaelement.cc.

References ContextStyle::baseSize(), calcSizes(), ContextStyle::getBaseTextStyle(), and ContextStyle::setSizeFactor().

void FormulaElement::draw QPainter painter,
const LuPixelRect r,
ContextStyle context
 

Draws the whole thing.

Definition at line 156 of file formulaelement.cc.

References ContextStyle::baseSize(), draw(), ContextStyle::getBaseTextStyle(), and ContextStyle::setSizeFactor().

KCommand * FormulaElement::buildCommand Container ,
Request * 
[virtual]
 

This is called by the container to get a command depending on the current cursor position (this is how the element gets chosen) and the request.

Returns:
the command that performs the requested action with the containers active cursor.

Reimplemented from SequenceElement.

Definition at line 170 of file formulaelement.cc.

References buildCommand().

Referenced by buildCommand().

const SymbolTable & FormulaElement::getSymbolTable  )  const
 

Returns:
our documents symbol table

Definition at line 181 of file formulaelement.cc.

References FormulaDocument::getSymbolTable().

Referenced by SequenceElement::parse().

QString FormulaElement::toLatex  )  [virtual]
 

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

Reimplemented from SequenceElement.

Definition at line 308 of file formulaelement.cc.

Referenced by Container::texString().

KCommand * FormulaElement::input Container container,
QKeyEvent event
[virtual]
 

Parses the input.

It's the container which does create new elements because it owns the undo stack. But only the sequence knows what chars are allowed.

Reimplemented from SequenceElement.

Definition at line 199 of file formulaelement.cc.

References Container::activeCursor(), and input().

Referenced by input().

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

Same as above, just MathML.

Reimplemented from SequenceElement.

Definition at line 313 of file formulaelement.cc.

References writeMathML().

Referenced by Container::saveMathML(), and writeMathML().

void FormulaElement::writeDom QDomElement  element  )  [virtual]
 

Appends our attributes to the dom element.

Reimplemented from SequenceElement.

Definition at line 222 of file formulaelement.cc.

References writeDom().

Referenced by writeDom().

QDomElement FormulaElement::emptyFormulaElement QDomDocument  doc  ) 
 

For copy&paste we need to create an empty XML element.

Definition at line 187 of file formulaelement.cc.

References emptyFormulaElement(), and getTagName().

Referenced by FormulaCursor::copy(), and emptyFormulaElement().

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

Returns the tag name of this element type.

Reimplemented from SequenceElement.

Definition at line 190 of file formulaelement.h.

Referenced by emptyFormulaElement().

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from SequenceElement.

Definition at line 235 of file formulaelement.cc.

References readAttributesFromDom().

Referenced by readAttributesFromDom().

bool FormulaElement::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 SequenceElement.

Definition at line 268 of file formulaelement.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 Tue Sep 28 04:04:04 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003