lib Library API Documentation

KoUnit Class Reference

KOffice stores everything in pt (using "double") internally. More...

#include <koUnit.h>

List of all members.

Public Types

enum  Unit {
  U_MM = 0, U_PT = 1, U_INCH = 2, U_CM = 3,
  U_DM = 4, U_PI = 5, U_DD = 6, U_CC = 7,
  U_LASTUNIT = U_CC
}

Static Public Member Functions

double toPoint (double ptValue)
double toMM (double ptValue)
double toCM (double ptValue)
double toDM (double ptValue)
double toInch (double ptValue)
double toPI (double ptValue)
double toDD (double ptValue)
double toCC (double ptValue)
double ptToUnit (double ptValue, Unit unit)
QString userValue (double ptValue, Unit unit)
double ptFromUnit (double value, Unit unit)
double fromUserValue (const QString &value, Unit unit)
Unit unit (const QString &_unitName)
QString unitName (Unit _unit)
QString unitDescription (Unit _unit)
QStringList listOfUnitName ()
double parseValue (QString value, double defaultVal=0.0)


Detailed Description

KOffice stores everything in pt (using "double") internally.

When displaying a value to the user, the value is converted to the user's unit of choice, and rounded to a reasonable precision to avoid 0.999999

Definition at line 53 of file koUnit.h.


Member Function Documentation

double KoUnit::toPoint double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in pt.

Definition at line 70 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toMM double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in mm.

Definition at line 76 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toCM double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in cm.

Definition at line 82 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toDM double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in dm.

Definition at line 87 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toInch double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in inch.

Definition at line 92 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toPI double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in pica.

Definition at line 98 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toDD double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in didot.

Definition at line 104 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::toCC double  ptValue  )  [inline, static]
 

Prepare ptValue to be displayed in cicero.

Definition at line 110 of file koUnit.h.

Referenced by ptToUnit().

double KoUnit::ptToUnit double  ptValue,
Unit  unit
[static]
 

This method is the one to use to display a value in a dialog.

Returns:
the value ptValue converted to unit and rounded, ready to be displayed

Definition at line 63 of file koUnit.cc.

References toCC(), toCM(), toDD(), toDM(), toInch(), toMM(), toPI(), and toPoint().

Referenced by userValue().

QString KoUnit::userValue double  ptValue,
Unit  unit
[static]
 

This method is the one to use to display a value in a dialog.

Returns:
the value ptValue converted to unit and rounded, ready to be displayed

Definition at line 86 of file koUnit.cc.

References ptToUnit().

double KoUnit::ptFromUnit double  value,
Unit  unit
[static]
 

This method is the one to use to read a value from a dialog.

Returns:
the value in unit, converted to points for internal use

Definition at line 91 of file koUnit.cc.

Referenced by fromUserValue(), and parseValue().

double KoUnit::fromUserValue const QString value,
Unit  unit
[static]
 

This method is the one to use to read a value from a dialog.

Returns:
the value in unit, converted to points for internal use

Definition at line 114 of file koUnit.cc.

References ptFromUnit().

Unit KoUnit::unit const QString _unitName  )  [inline, static]
 

Convert a unit name into a Unit enum.

Definition at line 132 of file koUnit.h.

Referenced by parseValue().

QString KoUnit::unitName Unit  _unit  )  [inline, static]
 

Get the name of a unit.

Definition at line 144 of file koUnit.h.

QString KoUnit::unitDescription Unit  _unit  )  [static]
 

Get the full (translated) description of a unit.

Definition at line 38 of file koUnit.cc.

double KoUnit::parseValue QString  value,
double  defaultVal = 0.0
[static]
 

parse common koffice and OO values, like "10cm", "5mm" to pt

Definition at line 120 of file koUnit.cc.

References ptFromUnit(), and unit().

Referenced by KoTextFormat::parseShadowFromCss().


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.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:50:27 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003