lib Library API Documentation

TextElement Class Reference

An element that represents one char. More...

#include <textelement.h>

Inheritance diagram for TextElement:

Inheritance graph
[legend]
Collaboration diagram for TextElement:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TextElement (QChar ch= ' ', bool beSymbol=false, BasicElement *parent=0)
 TextElement (const TextElement &)
virtual TextElementclone ()
virtual bool accept (ElementVisitor *visitor)
virtual TokenType getTokenType () const
virtual bool isInvisible () const
virtual QChar getCharacter () const
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)
virtual void dispatchFontCommand (FontCommand *cmd)
CharStyle getCharStyle () const
void setCharStyle (CharStyle cs)
CharFamily getCharFamily () const
void setCharFamily (CharFamily cf)
char format () const
bool isSymbol () const
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)
QChar getRealCharacter (const ContextStyle &context)
QFont getFont (const ContextStyle &context)
void setUpPainter (const ContextStyle &context, QPainter &painter)
const SymbolTablegetSymbolTable () const

Detailed Description

An element that represents one char.

Definition at line 37 of file textelement.h.


Member Function Documentation

bool TextElement::accept ElementVisitor visitor  )  [virtual]
 

Visit this element.

An implementation of the visitor pattern.

Implements BasicElement.

Definition at line 57 of file textelement.cc.

References ElementVisitor::visit().

TokenType TextElement::getTokenType  )  const [virtual]
 

Returns:
the type of this element. Used for parsing a sequence.

Reimplemented from BasicElement.

Definition at line 63 of file textelement.cc.

References isSymbol().

bool TextElement::isInvisible  )  const [virtual]
 

Returns:
true if we don't want to see the element.

Reimplemented from BasicElement.

Definition at line 98 of file textelement.cc.

References BasicElement::getElementType().

virtual QChar TextElement::getCharacter  )  const [inline, virtual]
 

Returns:
the character that represents this element. Used for parsing a sequence.

Reimplemented from BasicElement.

Definition at line 65 of file textelement.h.

Referenced by SequenceElement::buildCommand().

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

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

Implements BasicElement.

Definition at line 111 of file textelement.cc.

References getFont(), and getRealCharacter().

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

Implements BasicElement.

Definition at line 149 of file textelement.cc.

References ContextStyle::getAdjustedSize(), BasicElement::getElementType(), getFont(), getRealCharacter(), setUpPainter(), and ElementType::text().

void TextElement::dispatchFontCommand FontCommand cmd  )  [virtual]
 

Dispatch this FontCommand to all our TextElement children.

Reimplemented from BasicElement.

Definition at line 225 of file textelement.cc.

bool TextElement::isSymbol  )  const [inline]
 

Returns:
whether we are a symbol (greek letter).

Definition at line 113 of file textelement.h.

Referenced by SequenceElement::buildCommand(), getFont(), getRealCharacter(), getTokenType(), and toLatex().

QString TextElement::toLatex  )  [virtual]
 

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

Reimplemented from BasicElement.

Definition at line 443 of file textelement.cc.

References isSymbol().

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

Returns:
the tag name of this element type.

Reimplemented from BasicElement.

Definition at line 130 of file textelement.h.

void TextElement::writeDom QDomElement  element  )  [protected, virtual]
 

Appends our attributes to the dom element.

Reimplemented from BasicElement.

Definition at line 328 of file textelement.cc.

References BasicElement::writeDom().

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

Reads our attributes from the element.

Returns false if it failed.

Reimplemented from BasicElement.

Definition at line 357 of file textelement.cc.

References BasicElement::readAttributesFromDom().

bool TextElement::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 438 of file textelement.cc.

References BasicElement::readContentFromDom().

QChar TextElement::getRealCharacter const ContextStyle context  )  [protected]
 

Returns:
the char that is used to draw with the given font.

Definition at line 242 of file textelement.cc.

References FontStyle::alphaTable(), AlphaTable::entry(), ContextStyle::fontStyle(), isSymbol(), AlphaTableEntry::pos, and AlphaTableEntry::valid().

Referenced by calcSizes(), and draw().

QFont TextElement::getFont const ContextStyle context  )  [protected]
 

Returns:
the font to be used for the element.

Definition at line 263 of file textelement.cc.

References FontStyle::alphaTable(), AlphaTable::entry(), AlphaTableEntry::font, ContextStyle::fontStyle(), ContextStyle::getDefaultFont(), BasicElement::getElementType(), isSymbol(), ContextStyle::symbolTable(), and AlphaTableEntry::valid().

Referenced by calcSizes(), and draw().

void TextElement::setUpPainter const ContextStyle context,
QPainter painter
[protected]
 

Sets up the painter to be used for drawing.

Definition at line 309 of file textelement.cc.

References BasicElement::getElementType().

Referenced by draw().


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.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:42:04 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003