lib

#include <formulaelement.h>

Inheritance diagram for FormulaElement:
SequenceElement BasicElement

Public Member Functions

 FormulaElement (FormulaDocument *container)
 
virtual FormulaElement * clone ()
 
BasicElement * goToPos (FormulaCursor *, const LuPixelPoint &point)
 
virtual bool readOnly (const BasicElement *) const
 
virtual bool readOnly (const FormulaCursor *) const
 
virtual FormulaElement * formula ()
 
virtual const FormulaElement * formula () 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 TQString &msg)
 
void removeFormula (FormulaCursor *)
 
void insertFormula (FormulaCursor *)
 
virtual void calcSizes (const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style)
 
virtual void draw (TQPainter &painter, const LuPixelRect &r, const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style, const LuPixelPoint &parentOrigin)
 
void calcSizes (ContextStyle &context)
 
void draw (TQPainter &painter, const LuPixelRect &r, ContextStyle &context)
 
virtual KCommand * buildCommand (Container *, Request *)
 
const SymbolTable & getSymbolTable () const
 
virtual TQString toLatex ()
 
int getBaseSize () const
 
void setBaseSize (int size)
 
bool hasOwnBaseSize () const
 
virtual KCommand * input (Container *container, TQKeyEvent *event)
 
virtual void writeMathML (TQDomDocument &doc, TQDomNode &parent, bool oasisFormat=false) const
 
virtual void writeDom (TQDomElement element)
 
TQDomElement emptyFormulaElement (TQDomDocument &doc)
 
- Public Member Functions inherited from SequenceElement
 SequenceElement (BasicElement *parent=0)
 
 SequenceElement (const SequenceElement &)
 
virtual bool accept (ElementVisitor *visitor)
 
virtual bool isTextOnly () const
 
virtual BasicElement * goToPos (FormulaCursor *, bool &handled, const LuPixelPoint &point, const LuPixelPoint &parentOrigin)
 
void setSizeReduction (const ContextStyle &context)
 
bool isEmpty ()
 
virtual void dispatchFontCommand (FontCommand *cmd)
 
virtual void drawEmptyRect (TQPainter &painter, const ContextStyle &context, double factor, const LuPixelPoint &upperLeft)
 
virtual void calcCursorSize (const ContextStyle &context, FormulaCursor *cursor, bool smallCursor)
 
virtual void drawCursor (TQPainter &painter, const ContextStyle &context, StyleAttributes &style, FormulaCursor *cursor, bool smallCursor, bool activeCursor)
 
virtual void moveLeft (FormulaCursor *cursor, BasicElement *from)
 
virtual void moveRight (FormulaCursor *cursor, BasicElement *from)
 
virtual void moveWordLeft (FormulaCursor *cursor)
 
virtual void moveWordRight (FormulaCursor *cursor)
 
virtual void moveUp (FormulaCursor *cursor, BasicElement *from)
 
virtual void moveDown (FormulaCursor *cursor, BasicElement *from)
 
virtual void moveHome (FormulaCursor *cursor)
 
virtual void moveEnd (FormulaCursor *cursor)
 
virtual void goInside (FormulaCursor *cursor)
 
virtual void goInsideLast (FormulaCursor *cursor)
 
virtual void insert (FormulaCursor *, TQPtrList< BasicElement > &, Direction)
 
virtual void remove (FormulaCursor *, TQPtrList< BasicElement > &, Direction)
 
virtual void normalize (FormulaCursor *, Direction)
 
virtual BasicElement * getChild (FormulaCursor *, Direction=beforeCursor)
 
virtual void selectChild (FormulaCursor *cursor, BasicElement *child)
 
virtual void childWillVanish (FormulaCursor *cursor, BasicElement *child)
 
uint countChildren () const
 
bool isChildNumber (uint pos, BasicElement *child)
 
void selectAllChildren (FormulaCursor *cursor)
 
bool onlyTextSelected (FormulaCursor *cursor)
 
virtual KCommand * input (Container *container, TQChar ch)
 
virtual void parse ()
 
void getChildrenDom (TQDomDocument &doc, TQDomElement elem, uint from, uint to)
 
void getChildrenMathMLDom (TQDomDocument &doc, TQDomNode &elem, uint from, uint to)
 
bool buildChildrenFromDom (TQPtrList< BasicElement > &list, TQDomNode n)
 
virtual TQString formulaString ()
 
BasicElement * getChild (uint i)
 
const BasicElement * getChild (uint i) const
 
int childPos (BasicElement *child)
 
int childPos (const BasicElement *child) const
 
iterator begin ()
 
iterator end ()
 
virtual void setStyle (StyleElement *style)
 
virtual int buildChildrenFromMathMLDom (TQPtrList< BasicElement > &list, TQDomNode n)
 
virtual int readContentFromMathMLDom (TQDomNode &node)
 
int buildMathMLChild (TQDomNode node)
 
- Public Member Functions inherited from BasicElement
 BasicElement (BasicElement *parent=0)
 
 BasicElement (const BasicElement &)
 
virtual TQChar getCharacter () const
 
virtual TokenType getTokenType () const
 
virtual bool isInvisible () const
 
LuPixelPoint widgetPos ()
 
virtual void entered (SequenceElement *)
 
virtual SequenceElement * getMainChild ()
 
virtual bool isSenseless ()
 
virtual void registerTab (BasicElement *)
 
const BasicElement * getParent () const
 
BasicElement * getParent ()
 
void setParent (BasicElement *p)
 
luPixel getX () const
 
luPixel getY () const
 
void setX (luPixel x)
 
void setY (luPixel y)
 
luPixel getWidth () const
 
luPixel getHeight () const
 
void setWidth (luPixel width)
 
void setHeight (luPixel height)
 
luPixel getBaseline () const
 
void setBaseline (luPixel line)
 
luPixel axis (const ContextStyle &style, ContextStyle::TextStyle tstyle, double factor) const
 
TQDomElement getElementDom (TQDomDocument &doc)
 
bool buildFromDom (TQDomElement element)
 
int buildFromMathMLDom (TQDomElement element)
 
ElementType * getElementType () const
 
virtual void setElementType (ElementType *t)
 

Protected Member Functions

virtual TQString getTagName () const
 
virtual bool readAttributesFromDom (TQDomElement element)
 
virtual bool readContentFromDom (TQDomNode &node)
 
- Protected Member Functions inherited from SequenceElement
virtual TQString getElementName () const
 
virtual void writeMathMLContent (TQDomDocument &doc, TQDomElement &element, bool oasisFormat) const
 
virtual void setChildrenPositions ()
 
virtual BasicElement * createElement (TQString type, const TQDomElement &element)
 
luPixel getChildPosition (const ContextStyle &context, uint child)
 
virtual bool isFirstOfToken (BasicElement *child)
 
bool insert (uint index, BasicElement *child)
 
virtual luPt getSpaceBefore (const ContextStyle &, ContextStyle::TextStyle, double)
 
virtual luPt getSpaceAfter (const ContextStyle &, ContextStyle::TextStyle, double)
 
- Protected Member Functions inherited from BasicElement
virtual void writeMathMLAttributes (TQDomElement &) const
 
bool buildChild (SequenceElement *child, TQDomNode node, TQString name)
 
virtual bool readAttributesFromMathMLDom (const TQDomElement &element)
 
double getSize (const TQString &str, SizeType *st)
 
SizeType getSpace (const TQString &str)
 

Additional Inherited Members

- Public Types inherited from SequenceElement
typedef ChildIterator iterator
 
- Static Public Member Functions inherited from SequenceElement
static void setCreationStrategy (ElementCreationStrategy *strategy)
 
- Static Public Member Functions inherited from BasicElement
static int getEvilDestructionCount ()
 
- Static Protected Member Functions inherited from SequenceElement
static ElementCreationStrategy * getCreationStrategy ()
 
- Static Protected Attributes inherited from SequenceElement
static ElementCreationStrategy * creationStrategy = 0
 

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

◆ FormulaElement()

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

Member Function Documentation

◆ buildCommand()

KCommand * FormulaElement::buildCommand ( Container *  container,
Request *  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 173 of file formulaelement.cpp.

◆ calcSizes() [1/2]

void FormulaElement::calcSizes ( const ContextStyle &  context,
ContextStyle::TextStyle  tstyle,
ContextStyle::IndexStyle  istyle,
StyleAttributes &  style 
)
virtual

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

Reimplemented from SequenceElement.

Definition at line 119 of file formulaelement.cpp.

◆ calcSizes() [2/2]

void FormulaElement::calcSizes ( ContextStyle &  context)

Calculates the formulas sizes and positions.

Definition at line 142 of file formulaelement.cpp.

◆ changed()

void FormulaElement::changed ( )
virtual

Gets called whenever something changes and we need to recalc.

Definition at line 74 of file formulaelement.cpp.

◆ clone()

virtual FormulaElement * FormulaElement::clone ( )
inlinevirtual

Reimplemented from SequenceElement.

Definition at line 50 of file formulaelement.h.

◆ cursorHasMoved()

void FormulaElement::cursorHasMoved ( FormulaCursor *  cursor)

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

◆ draw() [1/2]

void FormulaElement::draw ( TQPainter &  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.

Reimplemented from SequenceElement.

Definition at line 128 of file formulaelement.cpp.

◆ draw() [2/2]

void FormulaElement::draw ( TQPainter &  painter,
const LuPixelRect &  r,
ContextStyle &  context 
)

Draws the whole thing.

Definition at line 158 of file formulaelement.cpp.

◆ elementRemoval()

void FormulaElement::elementRemoval ( BasicElement *  child)

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

Definition at line 69 of file formulaelement.cpp.

◆ emptyFormulaElement()

TQDomElement FormulaElement::emptyFormulaElement ( TQDomDocument &  doc)

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

Definition at line 190 of file formulaelement.cpp.

◆ formula() [1/2]

virtual FormulaElement * FormulaElement::formula ( )
inlinevirtual

Provide fast access to the rootElement for each child.

Reimplemented from BasicElement.

Definition at line 70 of file formulaelement.h.

◆ formula() [2/2]

virtual const FormulaElement * FormulaElement::formula ( ) const
inlinevirtual

Provide fast access to the rootElement for each child.

Reimplemented from BasicElement.

Definition at line 75 of file formulaelement.h.

◆ getBaseSize()

int FormulaElement::getBaseSize ( ) const
inline

Definition at line 166 of file formulaelement.h.

◆ getSymbolTable()

const SymbolTable & FormulaElement::getSymbolTable ( ) const
Returns
our documents symbol table

Definition at line 184 of file formulaelement.cpp.

◆ getTagName()

virtual TQString FormulaElement::getTagName ( ) const
inlineprotectedvirtual

Returns the tag name of this element type.

Reimplemented from SequenceElement.

Definition at line 192 of file formulaelement.h.

◆ goToPos()

BasicElement * FormulaElement::goToPos ( FormulaCursor *  cursor,
const LuPixelPoint &  point 
)

Returns the element the point is in.

Definition at line 56 of file formulaelement.cpp.

◆ hasOwnBaseSize()

bool FormulaElement::hasOwnBaseSize ( ) const
inline

Definition at line 169 of file formulaelement.h.

◆ input()

KCommand * FormulaElement::input ( Container *  ,
TQKeyEvent *   
)
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 202 of file formulaelement.cpp.

◆ insertFormula()

void FormulaElement::insertFormula ( FormulaCursor *  cursor)

Definition at line 114 of file formulaelement.cpp.

◆ moveOutAbove()

void FormulaElement::moveOutAbove ( FormulaCursor *  cursor)

Definition at line 99 of file formulaelement.cpp.

◆ moveOutBelow()

void FormulaElement::moveOutBelow ( FormulaCursor *  cursor)

Definition at line 94 of file formulaelement.cpp.

◆ moveOutLeft()

void FormulaElement::moveOutLeft ( FormulaCursor *  cursor)

Definition at line 84 of file formulaelement.cpp.

◆ moveOutRight()

void FormulaElement::moveOutRight ( FormulaCursor *  cursor)

Definition at line 89 of file formulaelement.cpp.

◆ readAttributesFromDom()

bool FormulaElement::readAttributesFromDom ( TQDomElement  element)
protectedvirtual

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from SequenceElement.

Definition at line 238 of file formulaelement.cpp.

◆ readContentFromDom()

bool FormulaElement::readContentFromDom ( TQDomNode &  node)
protectedvirtual

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 271 of file formulaelement.cpp.

◆ readOnly() [1/2]

virtual bool FormulaElement::readOnly ( const BasicElement *  ) const
inlinevirtual

Ordinary formulas are not write protected.

Reimplemented from BasicElement.

Definition at line 60 of file formulaelement.h.

◆ readOnly() [2/2]

virtual bool FormulaElement::readOnly ( const FormulaCursor *  ) const
inlinevirtual
Returns
whether its prohibited to change the sequence with this cursor.

Reimplemented from SequenceElement.

Definition at line 65 of file formulaelement.h.

◆ removeFormula()

void FormulaElement::removeFormula ( FormulaCursor *  cursor)

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

◆ setBaseSize()

void FormulaElement::setBaseSize ( int  size)

Definition at line 40 of file formulaelement.cpp.

◆ tell()

void FormulaElement::tell ( const TQString &  msg)

Tell the user something has happened.

Definition at line 104 of file formulaelement.cpp.

◆ toLatex()

TQString FormulaElement::toLatex ( )
virtual
Returns
the latex representation of the element and of the element's children

Reimplemented from SequenceElement.

Definition at line 311 of file formulaelement.cpp.

◆ writeDom()

void FormulaElement::writeDom ( TQDomElement  element)
virtual

Appends our attributes to the dom element.

Reimplemented from SequenceElement.

Definition at line 225 of file formulaelement.cpp.

◆ writeMathML()

void FormulaElement::writeMathML ( TQDomDocument &  doc,
TQDomNode &  parent,
bool  oasisFormat = false 
) const
virtual

Same as above, just MathML.

It shouldn't be redefined but for exceptional cases, use the general writeMathML* API instead

Reimplemented from BasicElement.

Definition at line 316 of file formulaelement.cpp.


The documentation for this class was generated from the following files: