lib

BracketElement Class Reference

#include <bracketelement.h>

Inheritance diagram for BracketElement:
SingleContentElement BasicElement

Public Types

enum  { contentPos }

Public Member Functions

 BracketElement (SymbolType left=EmptyBracket, SymbolType right=EmptyBracket, BasicElement *parent=0)
 BracketElement (const BracketElement &)
virtual BracketElement * clone ()
virtual bool accept (ElementVisitor *visitor)
virtual TokenType getTokenType () const
virtual void entered (SequenceElement *child)
virtual BasicElement * goToPos (FormulaCursor *, bool &handled, const LuPixelPoint &point, const LuPixelPoint &parentOrigin)
virtual void calcSizes (const ContextStyle &context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes &style)
virtual TQString getTagName () const
virtual bool readAttributesFromDom (TQDomElement element)
virtual void writeDom (TQDomElement element)
virtual TQString getElementName () const
virtual void writeMathMLAttributes (TQDomElement &element) const
virtual bool readAttributesFromMathMLDom (const TQDomElement &element)
virtual int readContentFromMathMLDom (TQDomNode &node)
virtual TQString toLatex ()
virtual TQString formulaString ()
Public Member Functions inherited from SingleContentElement
 SingleContentElement (BasicElement *parent=0)
 SingleContentElement (const SingleContentElement &)
virtual TQChar getCharacter () const
virtual void dispatchFontCommand (FontCommand *cmd)
virtual void remove (FormulaCursor *, TQPtrList< BasicElement > &, Direction)
virtual void normalize (FormulaCursor *, Direction)
virtual SequenceElement * getMainChild ()
virtual void selectChild (FormulaCursor *cursor, BasicElement *child)
Public Member Functions inherited from BasicElement
 BasicElement (BasicElement *parent=0)
 BasicElement (const BasicElement &)
virtual bool readOnly (const BasicElement *child) const
virtual FormulaElement * formula ()
virtual const FormulaElement * formula () const
virtual bool isInvisible () const
LuPixelPoint widgetPos ()
virtual void moveHome (FormulaCursor *)
virtual void moveEnd (FormulaCursor *)
virtual void goInside (FormulaCursor *cursor)
virtual void insert (FormulaCursor *, TQPtrList< BasicElement > &, Direction)
virtual bool isSenseless ()
virtual BasicElement * getChild (FormulaCursor *, Direction=beforeCursor)
virtual void childWillVanish (FormulaCursor *, BasicElement *)
virtual void registerTab (BasicElement *)
virtual KCommand * buildCommand (Container *, Request *)
virtual KCommand * input (Container *, TQKeyEvent *)
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)
virtual void writeMathML (TQDomDocument &doc, TQDomNode &parent, bool oasisFormat=false) const
bool buildFromDom (TQDomElement element)
int buildFromMathMLDom (TQDomElement element)
ElementType * getElementType () const
virtual void setElementType (ElementType *t)
virtual void setStyle (StyleElement *)

Additional Inherited Members

Static Public Member Functions inherited from BasicElement
static int getEvilDestructionCount ()
Protected Member Functions inherited from SingleContentElement
virtual void writeMathMLContent (TQDomDocument &doc, TQDomElement &element, bool oasisFormat) const
virtual bool readContentFromDom (TQDomNode &node)
SequenceElement * getContent ()
Protected Member Functions inherited from BasicElement
bool buildChild (SequenceElement *child, TQDomNode node, TQString name)
double getSize (const TQString &str, SizeType *st)
SizeType getSpace (const TQString &str)

Detailed Description

A left and/or right bracket around one child.

Definition at line 161 of file bracketelement.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 166 of file bracketelement.h.

Constructor & Destructor Documentation

◆ BracketElement() [1/2]

BracketElement::BracketElement ( SymbolType left = EmptyBracket,
SymbolType right = EmptyBracket,
BasicElement * parent = 0 )

Definition at line 216 of file bracketelement.cpp.

◆ ~BracketElement()

BracketElement::~BracketElement ( )

Definition at line 225 of file bracketelement.cpp.

◆ BracketElement() [2/2]

BracketElement::BracketElement ( const BracketElement & other)

Definition at line 232 of file bracketelement.cpp.

Member Function Documentation

◆ accept()

bool BracketElement::accept ( ElementVisitor * )
virtual

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 242 of file bracketelement.cpp.

◆ calcSizes()

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

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

Implements BasicElement.

Definition at line 286 of file bracketelement.cpp.

◆ clone()

virtual BracketElement * BracketElement::clone ( )
inlinevirtual

Implements BasicElement.

Definition at line 174 of file bracketelement.h.

◆ entered()

void BracketElement::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 248 of file bracketelement.cpp.

◆ formulaString()

TQString BracketElement::formulaString ( )
virtual

Reimplemented from BasicElement.

Definition at line 661 of file bracketelement.cpp.

◆ getElementName()

virtual TQString BracketElement::getElementName ( ) const
inlinevirtual

Reimplemented from BasicElement.

Definition at line 239 of file bracketelement.h.

◆ getTagName()

virtual TQString BracketElement::getTagName ( ) const
inlinevirtual

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. */ virtual void draw( TQPainter& painter, const LuPixelRect& r, const ContextStyle& context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes& style, const LuPixelPoint& parentOrigin );

protected:

Save/load support

/** Returns the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 229 of file bracketelement.h.

◆ getTokenType()

virtual TokenType BracketElement::getTokenType ( ) const
inlinevirtual
Returns
the type of this element. Used for parsing a sequence.

Reimplemented from BasicElement.

Definition at line 184 of file bracketelement.h.

◆ goToPos()

BasicElement * BracketElement::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 SingleContentElement.

Definition at line 254 of file bracketelement.cpp.

◆ readAttributesFromDom()

bool BracketElement::readAttributesFromDom ( TQDomElement element)
virtual

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 423 of file bracketelement.cpp.

◆ readAttributesFromMathMLDom()

bool BracketElement::readAttributesFromMathMLDom ( const TQDomElement & element)
virtual

Reads our attributes from the MathML element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 443 of file bracketelement.cpp.

◆ readContentFromMathMLDom()

int BracketElement::readContentFromMathMLDom ( TQDomNode & node)
virtual

Reads our content from the MathML node.

Sets the node to the next node that needs to be read. It is sometimes needed to read more than one node (e. g. for fence operators). Returns the number of nodes processed or -1 if it failed.

Sets the node to the next node that needs to be read. Returns false if it failed.

Reimplemented from SingleContentElement.

Definition at line 518 of file bracketelement.cpp.

◆ toLatex()

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

Reimplemented from BasicElement.

Definition at line 622 of file bracketelement.cpp.

◆ writeDom()

void BracketElement::writeDom ( TQDomElement element)
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. */ void BracketElement::draw( TQPainter& painter, const LuPixelRect& r, const ContextStyle& context, ContextStyle::TextStyle tstyle, ContextStyle::IndexStyle istyle, StyleAttributes& style, const LuPixelPoint& parentOrigin ) { LuPixelPoint myPos( parentOrigin.x()+getX(), parentOrigin.y()+getY() ); if ( !LuPixelRect( myPos.x(), myPos.y(), getWidth(), getHeight() ).intersects( r ) ) return;

SequenceElement* content = getContent(); content->draw(painter, r, context, tstyle, istyle, style, myPos);

if (content->isTextOnly()) { left->draw(painter, r, context, tstyle, style, myPos); right->draw(painter, r, context, tstyle, style, myPos); } else { double factor = style.sizeFactor(); luPixel contentHeight = 2 * TQMAX(content->axis( context, tstyle, factor ), content->getHeight() - content->axis( context, tstyle, factor )); left->draw(painter, r, context, tstyle, style, contentHeight, myPos); right->draw(painter, r, context, tstyle, style, contentHeight, myPos); }

Debug

}

/** Appends our attributes to the dom element.

Reimplemented from SingleContentElement.

Definition at line 412 of file bracketelement.cpp.

◆ writeMathMLAttributes()

void BracketElement::writeMathMLAttributes ( TQDomElement & element) const
virtual

Reimplemented from BasicElement.

Definition at line 787 of file bracketelement.cpp.


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