kformula/flake

AttributeManager Class Reference

manages all the attributes, used by the elements to obtain attribute values More...

#include <AttributeManager.h>

List of all members.

Public Member Functions

 AttributeManager ()
 ~AttributeManager ()
QList< AlignalignListOf (const QString &attribute, const BasicElement *element) const
Align alignOf (const QString &attribute, const BasicElement *element) const
bool boolOf (const QString &attribute, const BasicElement *element) const
QColor colorOf (const QString &attribute, const BasicElement *element) const
QList< double > doubleListOf (const QString &attribute, const BasicElement *element) const
double doubleOf (const QString &attribute, const BasicElement *element) const
QString findValue (const QString &attribute, const BasicElement *element) const
QFont font (const BasicElement *element) const
double layoutSpacing (const BasicElement *element) const
double lengthToPixels (Length length, const BasicElement *element, const QString &attribute) const
double lineThickness (const BasicElement *element) const
double maxHeightOfChildren (const BasicElement *element) const
double maxWidthOfChildren (const BasicElement *element) const
Align parseAlign (const QString &value) const
double parseMathSpace (const QString &value, const BasicElement *element) const
Qt::PenStyle parsePenStyle (const QString &value) const
Length parseUnit (const QString &value, const BasicElement *element) const
QList< Qt::PenStyle > penStyleListOf (const QString &attribute, const BasicElement *element) const
Qt::PenStyle penStyleOf (const QString &attribute, const BasicElement *element) const
int scriptLevel (const BasicElement *parent, int index) const
void setViewConverter (KoViewConverter *converter)
QString stringOf (const QString &attribute, const BasicElement *element) const

Public Attributes

KoViewConverter * m_viewConverter

Detailed Description

manages all the attributes, used by the elements to obtain attribute values

The AttributeManager is the central point dealing with the MathML attributes and their values. It is in fact something like a StyleManager. As the normal elements only have a general hash list of the elements they hold, there is the need for a class that manages conversion and heritage of the attributes during the painting phase. These are the two main tasks of AttributeManager. The AttributeManager is always called when an element needs a value to work with. The AttributeManager looks for that value first in the asking element's own attribute list. If nothing is found the AttributeManager looks for a parent element that might inherit the right value. If AttributeManager has no success again it returns the default value for that attribute.

Author:
Martin Pfeiffer <hubipete@gmx.net>

Definition at line 85 of file AttributeManager.h.


Constructor & Destructor Documentation

AttributeManager::AttributeManager (  ) 

The constructor.

Definition at line 53 of file AttributeManager.cpp.

AttributeManager::~AttributeManager (  ) 

The destructor.

Definition at line 58 of file AttributeManager.cpp.


Member Function Documentation

QList< Align > AttributeManager::alignListOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as list of aligns.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 131 of file AttributeManager.cpp.

Align AttributeManager::alignOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as align.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 126 of file AttributeManager.cpp.

bool AttributeManager::boolOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as boolean.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 88 of file AttributeManager.cpp.

QColor AttributeManager::colorOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as color.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 117 of file AttributeManager.cpp.

QList< double > AttributeManager::doubleListOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as list of doubles.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 101 of file AttributeManager.cpp.

double AttributeManager::doubleOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as double.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 94 of file AttributeManager.cpp.

QString AttributeManager::findValue ( const QString attribute,
const BasicElement element 
) const

Find a value for attribute that applies to element.

Definition at line 61 of file AttributeManager.cpp.

QFont AttributeManager::font ( const BasicElement element  )  const
Returns:
The font that is set for element

Definition at line 361 of file AttributeManager.cpp.

double AttributeManager::layoutSpacing ( const BasicElement element  )  const
Returns:
A value used for spacing tasks during layouting

Definition at line 224 of file AttributeManager.cpp.

double AttributeManager::lengthToPixels ( Length  length,
const BasicElement element,
const QString attribute 
) const

Definition at line 231 of file AttributeManager.cpp.

double AttributeManager::lineThickness ( const BasicElement element  )  const
Returns:
Line thickness for mfrac, mroot etc lines

Definition at line 218 of file AttributeManager.cpp.

double AttributeManager::maxHeightOfChildren ( const BasicElement element  )  const

Determine the maximal height of an given element's child elements.

Parameters:
element The element whos children are used
Returns:
The maximal height

Definition at line 387 of file AttributeManager.cpp.

double AttributeManager::maxWidthOfChildren ( const BasicElement element  )  const

Determine the maximal height of an given element's child elements.

Parameters:
element The element whos children are used
Returns:
The maximal height

Definition at line 396 of file AttributeManager.cpp.

Align AttributeManager::parseAlign ( const QString value  )  const
Returns:
The Align value that was passed as QString value

Definition at line 331 of file AttributeManager.cpp.

double AttributeManager::parseMathSpace ( const QString value,
const BasicElement element 
) const

Convert a math space string, such as "thinmathspace", to a size in pixels.

Definition at line 404 of file AttributeManager.cpp.

Qt::PenStyle AttributeManager::parsePenStyle ( const QString value  )  const
Returns:
The parsed the value into a Qt::PenStyle

Definition at line 351 of file AttributeManager.cpp.

Length AttributeManager::parseUnit ( const QString value,
const BasicElement element 
) const
Returns:
The parsed value which is given with a unit

Definition at line 265 of file AttributeManager.cpp.

QList< Qt::PenStyle > AttributeManager::penStyleListOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as list of Qt::PenStyles.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The valuefont that was looked up

Definition at line 149 of file AttributeManager.cpp.

Qt::PenStyle AttributeManager::penStyleOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as Qt::PenStyle.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 143 of file AttributeManager.cpp.

int AttributeManager::scriptLevel ( const BasicElement parent,
int  index 
) const

Obtain the scaling level for parent's child element at index index Usually the first child is treated different.

For example in <msup><mi>b</mi><mn>2</mn></msup> to represent b^2, the 2 is smaller than the b.

Parameters:
element The parent of the element for which scaling is determined
index The index of the child element for which scaling is determined
Returns:
The scaling level for the font size

First check for types where all children are scaled

Now check for types where the first child isn't scaled, but the rest are

Definition at line 161 of file AttributeManager.cpp.

void AttributeManager::setViewConverter ( KoViewConverter *  converter  ) 

Set the KoViewConverter to use.

Definition at line 382 of file AttributeManager.cpp.

QString AttributeManager::stringOf ( const QString attribute,
const BasicElement element 
) const

Obtain the attribute's value as string.

Parameters:
attribute A string with the attribute to look up
element The element the value is looked up for
Returns:
The value that was looked up

Definition at line 112 of file AttributeManager.cpp.


Member Data Documentation

The KoViewConverter used to determine the point values of pixels.

Definition at line 223 of file AttributeManager.h.


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