lib

ContextStyle Class Reference

#include <contextstyle.h>

Inheritance diagram for ContextStyle:
KoTextZoomHandler KoZoomHandler

Public Types

enum  Alignment { left , center , right }
 
enum  TextStyle { displayStyle = 0 , textStyle = 1 , scriptStyle = 2 , scriptScriptStyle = 3 }
 
enum  IndexStyle { normal , cramped }
 

Public Member Functions

 ContextStyle ()
 
void init (bool init=true)
 
void readConfig (TDEConfig *config, bool init=true)
 
bool edit () const
 
void setEdit (bool e)
 
const SymbolTable & symbolTable () const
 
const FontStyle & fontStyle () const
 
void setZoomAndResolution (int zoom, int dpiX, int dpiY)
 
bool setZoomAndResolution (int zoom, double zoomX, double zoomY, bool updateViews, bool forPrint)
 
bool syntaxHighlighting () const
 
void setSyntaxHighlighting (bool highlight)
 
TQColor getDefaultColor () const
 
TQColor getNumberColorPlain () const
 
TQColor getOperatorColorPlain () const
 
TQColor getErrorColorPlain () const
 
TQColor getEmptyColorPlain () const
 
TQColor getHelpColorPlain () const
 
TQColor getNumberColor () const
 
TQColor getOperatorColor () const
 
TQColor getErrorColor () const
 
TQColor getEmptyColor () const
 
TQColor getHelpColor () const
 
void setDefaultColor (const TQColor &)
 
void setNumberColor (const TQColor &)
 
void setOperatorColor (const TQColor &)
 
void setErrorColor (const TQColor &)
 
void setEmptyColor (const TQColor &)
 
void setHelpColor (const TQColor &)
 
TQString getFontStyle () const
 
void setFontStyle (const TQString &fontStyle, bool init=true)
 
TQFont getMathFont () const
 
TQFont getBracketFont () const
 
TQFont getDefaultFont () const
 
TQFont getNameFont () const
 
TQFont getNumberFont () const
 
TQFont getOperatorFont () const
 
TQFont getSymbolFont () const
 
void setMathFont (TQFont f)
 
void setBracketFont (TQFont f)
 
void setDefaultFont (TQFont f)
 
void setNameFont (TQFont f)
 
void setNumberFont (TQFont f)
 
void setOperatorFont (TQFont f)
 
double getReductionFactor (TextStyle tstyle) const
 
luPt getBaseSize () const
 
int baseSize () const
 
void setBaseSize (int pointSize)
 
void setSizeFactor (double factor)
 
TextStyle getBaseTextStyle () const
 
bool isScript (TextStyle tstyle) const
 
luPixel getSpace (TextStyle tstyle, SpaceWidth space, double factor) const
 
luPixel getThinSpace (TextStyle tstyle, double factor) const
 
luPixel getMediumSpace (TextStyle tstyle, double factor) const
 
luPixel getThickSpace (TextStyle tstyle, double factor) const
 
luPixel getQuadSpace (TextStyle tstyle, double factor) const
 
luPixel axisHeight (TextStyle tstyle, double factor) const
 
luPt getAdjustedSize (TextStyle tstyle, double factor) const
 
luPixel getLineWidth (double factor) const
 
luPixel getEmptyRectWidth (double factor) const
 
luPixel getEmptyRectHeight (double factor) const
 
Alignment getMatrixAlignment () const
 
bool getCenterSymbol () const
 
TextStyle convertTextStyleFraction (TextStyle tstyle) const
 
TextStyle convertTextStyleIndex (TextStyle tstyle) const
 
IndexStyle convertIndexStyleUpper (IndexStyle istyle) const
 
IndexStyle convertIndexStyleLower (IndexStyle) const
 
- Public Member Functions inherited from KoTextZoomHandler
int pixelToLayoutUnitX (int x) const
 
int pixelToLayoutUnitY (int y) const
 
TQPoint pixelToLayoutUnit (const TQPoint &p) const
 
TQRect pixelToLayoutUnit (const TQRect &r) const
 
int layoutUnitToPixelX (int lupix) const
 
int layoutUnitToPixelY (int lupix) const
 
int layoutUnitToPixelX (int x, int w) const
 
int layoutUnitToPixelY (int y, int h) const
 
TQPoint layoutUnitToPixel (const TQPoint &p) const
 
TQRect layoutUnitToPixel (const TQRect &r) const
 
int ptToPixelX (double pt) const
 
int ptToPixelY (double pt) const
 
TQPoint ptToPixel (const KoPoint &p) const
 
double pixelXToPt (int x) const
 
double pixelYToPt (int y) const
 
KoPoint pixelToPt (const TQPoint &p) const
 
int ptToLayoutUnitPixX (double x_pt) const
 
int ptToLayoutUnitPixY (double y_pt) const
 
TQPoint ptToLayoutUnitPix (const KoPoint &p) const
 
double layoutUnitToFontSize (int luSize, bool) const
 
- Public Member Functions inherited from KoZoomHandler
double zoomedResolutionX () const
 
double zoomedResolutionY () const
 
double resolutionX () const
 
double resolutionY () const
 
double zoomFactorX () const
 
double zoomFactorY () const
 
void setResolution (double resolutionX, double resolutionY)
 
virtual void setZoomedResolution (double zoomedResolutionX, double zoomedResolutionY)
 
void setZoom (int zoom)
 
void setZoomMode (KoZoomMode::Mode zoomMode)
 
int zoom () const
 
KoZoomMode::Mode zoomMode () const
 
int zoomItX (double z) const
 
int zoomItY (double z) const
 
TQPoint zoomPoint (const KoPoint &p) const
 
TQRect zoomRect (const KoRect &r) const
 
TQSize zoomSize (const KoSize &s) const
 
double unzoomItX (int x) const
 
double unzoomItY (int y) const
 
KoPoint unzoomPoint (const TQPoint &p) const
 
KoRect unzoomRect (const TQRect &r) const
 

Additional Inherited Members

- Static Public Member Functions inherited from KoTextZoomHandler
static void setPtToLayoutUnitFactor (int factor)
 
static double ptToLayoutUnitPt (double pt)
 
static int ptToLayoutUnitPt (int ptSize)
 
static KoPoint ptToLayoutUnitPt (const KoPoint &p)
 
static KoRect ptToLayoutUnitPt (const KoRect &r)
 
static double layoutUnitPtToPt (double lupt)
 
static KoPoint layoutUnitPtToPt (const KoPoint &p)
 
- Protected Attributes inherited from KoZoomHandler
int m_zoom
 
KoZoomMode::Mode m_zoomMode
 
double m_resolutionX
 
double m_resolutionY
 
double m_zoomedResolutionX
 
double m_zoomedResolutionY
 
- Static Protected Attributes inherited from KoTextZoomHandler
static int m_layoutUnitFactor = 20
 

Detailed Description

Contains all the style information for the formela.

The idea is to change the values here (user configurable) and have the elements paint themselves with this information.

All distances are stored in point. Most methods return pixel values.

Definition at line 53 of file contextstyle.h.

Member Enumeration Documentation

◆ Alignment

enum ContextStyle::Alignment

Definition at line 57 of file contextstyle.h.

◆ IndexStyle

enum ContextStyle::IndexStyle

Definition at line 78 of file contextstyle.h.

◆ TextStyle

Textstyles like in TeX.

In the remaining documentation, the styles are abbreviated like this:

displayStyle: D

textStyle: T

scriptStyle: S

scriptScriptStyle: SS

Definition at line 71 of file contextstyle.h.

Constructor & Destructor Documentation

◆ ContextStyle()

KFORMULA_NAMESPACE_BEGIN ContextStyle::ContextStyle ( )

Build a default context style.

Definition at line 35 of file contextstyle.cpp.

◆ ~ContextStyle()

ContextStyle::~ContextStyle ( )

Definition at line 64 of file contextstyle.cpp.

Member Function Documentation

◆ axisHeight()

luPixel ContextStyle::axisHeight ( TextStyle  tstyle,
double  factor 
) const

Definition at line 275 of file contextstyle.cpp.

◆ baseSize()

int ContextStyle::baseSize ( ) const
inline

Definition at line 163 of file contextstyle.h.

◆ convertIndexStyleLower()

IndexStyle ContextStyle::convertIndexStyleLower ( IndexStyle  ) const
inline

Index-style-conversions a la TeX.

The function convertIndexStyleLower is responsible for everything that ends 'down', like nominators of fractions, or upper indices.

We have the following rule: normal->cramped, cramped->cramped

Definition at line 237 of file contextstyle.h.

◆ convertIndexStyleUpper()

IndexStyle ContextStyle::convertIndexStyleUpper ( IndexStyle  istyle) const
inline

Index-style-conversions a la TeX.

The function convertIndexStyleUpper is responsible for everything that ends 'up', like nominators of fractions, or upper indices.

We have the following rule: normal->normal, cramped->cramped

Definition at line 224 of file contextstyle.h.

◆ convertTextStyleFraction()

ContextStyle::TextStyle ContextStyle::convertTextStyleFraction ( TextStyle  tstyle) const

Font-conversions a la TeX.

For fractions (and also matrices), we have the following conversions: D->T, T->S, S,SS->SS

Definition at line 320 of file contextstyle.cpp.

◆ convertTextStyleIndex()

ContextStyle::TextStyle ContextStyle::convertTextStyleIndex ( TextStyle  tstyle) const

Font-conversions a la TeX.

For indices, we have the following conversions: D->S, T->S, S,SS->SS

Definition at line 340 of file contextstyle.cpp.

◆ edit()

bool ContextStyle::edit ( ) const
inline

Definition at line 98 of file contextstyle.h.

◆ fontStyle()

const FontStyle & ContextStyle::fontStyle ( ) const
inline

Definition at line 106 of file contextstyle.h.

◆ getAdjustedSize()

luPt ContextStyle::getAdjustedSize ( TextStyle  tstyle,
double  factor 
) const

Calculates the font size corresponding to the given TextStyle.

Definition at line 222 of file contextstyle.cpp.

◆ getBaseSize()

luPt ContextStyle::getBaseSize ( ) const

Definition at line 284 of file contextstyle.cpp.

◆ getBaseTextStyle()

TextStyle ContextStyle::getBaseTextStyle ( ) const
inline

Definition at line 167 of file contextstyle.h.

◆ getBracketFont()

TQFont ContextStyle::getBracketFont ( ) const
inline

Definition at line 143 of file contextstyle.h.

◆ getCenterSymbol()

bool ContextStyle::getCenterSymbol ( ) const
inline

Definition at line 197 of file contextstyle.h.

◆ getDefaultColor()

TQColor ContextStyle::getDefaultColor ( ) const
inline

Definition at line 120 of file contextstyle.h.

◆ getDefaultFont()

TQFont ContextStyle::getDefaultFont ( ) const
inline

Definition at line 144 of file contextstyle.h.

◆ getEmptyColor()

TQColor ContextStyle::getEmptyColor ( ) const

Definition at line 163 of file contextstyle.cpp.

◆ getEmptyColorPlain()

TQColor ContextStyle::getEmptyColorPlain ( ) const
inline

Definition at line 124 of file contextstyle.h.

◆ getEmptyRectHeight()

luPixel ContextStyle::getEmptyRectHeight ( double  factor) const

Definition at line 314 of file contextstyle.cpp.

◆ getEmptyRectWidth()

luPixel ContextStyle::getEmptyRectWidth ( double  factor) const

Definition at line 309 of file contextstyle.cpp.

◆ getErrorColor()

TQColor ContextStyle::getErrorColor ( ) const

Definition at line 155 of file contextstyle.cpp.

◆ getErrorColorPlain()

TQColor ContextStyle::getErrorColorPlain ( ) const
inline

Definition at line 123 of file contextstyle.h.

◆ getFontStyle()

TQString ContextStyle::getFontStyle ( ) const
inline

Definition at line 139 of file contextstyle.h.

◆ getHelpColor()

TQColor ContextStyle::getHelpColor ( ) const

Definition at line 171 of file contextstyle.cpp.

◆ getHelpColorPlain()

TQColor ContextStyle::getHelpColorPlain ( ) const
inline

Definition at line 125 of file contextstyle.h.

◆ getLineWidth()

luPixel ContextStyle::getLineWidth ( double  factor) const

All simple lines like the one that makes up a fraction.

Definition at line 304 of file contextstyle.cpp.

◆ getMathFont()

TQFont ContextStyle::getMathFont ( ) const
inline

Definition at line 142 of file contextstyle.h.

◆ getMatrixAlignment()

Alignment ContextStyle::getMatrixAlignment ( ) const
inline

Definition at line 195 of file contextstyle.h.

◆ getMediumSpace()

luPixel ContextStyle::getMediumSpace ( TextStyle  tstyle,
double  factor 
) const

Definition at line 251 of file contextstyle.cpp.

◆ getNameFont()

TQFont ContextStyle::getNameFont ( ) const
inline

Definition at line 145 of file contextstyle.h.

◆ getNumberColor()

TQColor ContextStyle::getNumberColor ( ) const

Definition at line 139 of file contextstyle.cpp.

◆ getNumberColorPlain()

TQColor ContextStyle::getNumberColorPlain ( ) const
inline

Definition at line 121 of file contextstyle.h.

◆ getNumberFont()

TQFont ContextStyle::getNumberFont ( ) const
inline

Definition at line 146 of file contextstyle.h.

◆ getOperatorColor()

TQColor ContextStyle::getOperatorColor ( ) const

Definition at line 147 of file contextstyle.cpp.

◆ getOperatorColorPlain()

TQColor ContextStyle::getOperatorColorPlain ( ) const
inline

Definition at line 122 of file contextstyle.h.

◆ getOperatorFont()

TQFont ContextStyle::getOperatorFont ( ) const
inline

Definition at line 147 of file contextstyle.h.

◆ getQuadSpace()

luPixel ContextStyle::getQuadSpace ( TextStyle  tstyle,
double  factor 
) const

Definition at line 267 of file contextstyle.cpp.

◆ getReductionFactor()

double ContextStyle::getReductionFactor ( TextStyle  tstyle) const

Definition at line 217 of file contextstyle.cpp.

◆ getSpace()

luPixel ContextStyle::getSpace ( TextStyle  tstyle,
SpaceWidth  space,
double  factor 
) const

TeX like spacings.

Definition at line 231 of file contextstyle.cpp.

◆ getSymbolFont()

TQFont ContextStyle::getSymbolFont ( ) const
inline

Definition at line 148 of file contextstyle.h.

◆ getThickSpace()

luPixel ContextStyle::getThickSpace ( TextStyle  tstyle,
double  factor 
) const

Definition at line 259 of file contextstyle.cpp.

◆ getThinSpace()

luPixel ContextStyle::getThinSpace ( TextStyle  tstyle,
double  factor 
) const

Definition at line 243 of file contextstyle.cpp.

◆ init()

void ContextStyle::init ( bool  init = true)
Parameters
initif true fonts may be installed if needed.

Definition at line 70 of file contextstyle.cpp.

◆ isScript()

bool ContextStyle::isScript ( TextStyle  tstyle) const
inline

Definition at line 168 of file contextstyle.h.

◆ readConfig()

void ContextStyle::readConfig ( TDEConfig *  config,
bool  init = true 
)
Parameters
inittrue if initialization may take place. This may cause font installation. Mark as false when this is not intended (i. e. creating configuration dialog from another component)

Definition at line 92 of file contextstyle.cpp.

◆ setBaseSize()

void ContextStyle::setBaseSize ( int  pointSize)

Definition at line 289 of file contextstyle.cpp.

◆ setBracketFont()

void ContextStyle::setBracketFont ( TQFont  f)
inline

Definition at line 151 of file contextstyle.h.

◆ setDefaultColor()

void ContextStyle::setDefaultColor ( const TQColor &  color)

Definition at line 179 of file contextstyle.cpp.

◆ setDefaultFont()

void ContextStyle::setDefaultFont ( TQFont  f)
inline

Definition at line 152 of file contextstyle.h.

◆ setEdit()

void ContextStyle::setEdit ( bool  e)
inline

Definition at line 99 of file contextstyle.h.

◆ setEmptyColor()

void ContextStyle::setEmptyColor ( const TQColor &  color)

Definition at line 195 of file contextstyle.cpp.

◆ setErrorColor()

void ContextStyle::setErrorColor ( const TQColor &  color)

Definition at line 191 of file contextstyle.cpp.

◆ setFontStyle()

void ContextStyle::setFontStyle ( const TQString &  fontStyle,
bool  init = true 
)

Definition at line 77 of file contextstyle.cpp.

◆ setHelpColor()

void ContextStyle::setHelpColor ( const TQColor &  color)

Definition at line 199 of file contextstyle.cpp.

◆ setMathFont()

void ContextStyle::setMathFont ( TQFont  f)
inline

Definition at line 150 of file contextstyle.h.

◆ setNameFont()

void ContextStyle::setNameFont ( TQFont  f)
inline

Definition at line 153 of file contextstyle.h.

◆ setNumberColor()

void ContextStyle::setNumberColor ( const TQColor &  color)

Definition at line 183 of file contextstyle.cpp.

◆ setNumberFont()

void ContextStyle::setNumberFont ( TQFont  f)
inline

Definition at line 154 of file contextstyle.h.

◆ setOperatorColor()

void ContextStyle::setOperatorColor ( const TQColor &  color)

Definition at line 187 of file contextstyle.cpp.

◆ setOperatorFont()

void ContextStyle::setOperatorFont ( TQFont  f)
inline

Definition at line 155 of file contextstyle.h.

◆ setSizeFactor()

void ContextStyle::setSizeFactor ( double  factor)

Definition at line 298 of file contextstyle.cpp.

◆ setSyntaxHighlighting()

void ContextStyle::setSyntaxHighlighting ( bool  highlight)
inline

Definition at line 118 of file contextstyle.h.

◆ setZoomAndResolution() [1/2]

bool ContextStyle::setZoomAndResolution ( int  zoom,
double  zoomX,
double  zoomY,
bool  updateViews,
bool  forPrint 
)

Sets the zoom by hand.

This is to be used in paintContent.

Returns
whether there was any change.

Definition at line 130 of file contextstyle.cpp.

◆ setZoomAndResolution() [2/2]

void ContextStyle::setZoomAndResolution ( int  zoom,
int  dpiX,
int  dpiY 
)
virtual

Change the zoom factor to z (e.g.

150 for 150%) and/or change the resolution, given in DPI. This is done on startup, when zooming, and when printing. The same call combines both so that all the updating done behind the scenes is done only once, even if both zoom and DPI must be changed.

Reimplemented from KoZoomHandler.

Definition at line 125 of file contextstyle.cpp.

◆ symbolTable()

const SymbolTable & ContextStyle::symbolTable ( ) const
Returns
our symbol table.

Definition at line 86 of file contextstyle.cpp.

◆ syntaxHighlighting()

bool ContextStyle::syntaxHighlighting ( ) const
inline

Definition at line 117 of file contextstyle.h.


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