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.

References toPoint().

Referenced by ptToUnit(), and toPoint().

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

Prepare ptValue to be displayed in mm.

Definition at line 76 of file koUnit.h.

References toMM().

Referenced by ptToUnit(), and toMM().

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

Prepare ptValue to be displayed in cm.

Definition at line 82 of file koUnit.h.

References toCM().

Referenced by ptToUnit(), and toCM().

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

Prepare ptValue to be displayed in dm.

Definition at line 87 of file koUnit.h.

References toDM().

Referenced by ptToUnit(), and toDM().

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

Prepare ptValue to be displayed in inch.

Definition at line 92 of file koUnit.h.

References toInch().

Referenced by ptToUnit(), and toInch().

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

Prepare ptValue to be displayed in pica.

Definition at line 98 of file koUnit.h.

References toPI().

Referenced by ptToUnit(), and toPI().

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

Prepare ptValue to be displayed in didot.

Definition at line 104 of file koUnit.h.

References toDD().

Referenced by ptToUnit(), and toDD().

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

Prepare ptValue to be displayed in cicero.

Definition at line 110 of file koUnit.h.

References toCC().

Referenced by ptToUnit(), and toCC().

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 ptToUnit(), toCC(), toCM(), toDD(), toDM(), toInch(), toMM(), toPI(), and toPoint().

Referenced by ptToUnit(), and 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(), and userValue().

Referenced by userValue().

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.

References ptFromUnit().

Referenced by fromUserValue(), parseValue(), and ptFromUnit().

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 fromUserValue(), and ptFromUnit().

Referenced by fromUserValue().

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

Convert a unit name into a Unit enum.

Definition at line 132 of file koUnit.h.

References unit().

Referenced by parseValue(), and unit().

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

Get the name of a unit.

Definition at line 144 of file koUnit.h.

References unitName().

Referenced by unitName().

QString KoUnit::unitDescription Unit  _unit  )  [static]
 

Get the full (translated) description of a unit.

Definition at line 38 of file koUnit.cc.

References unitDescription().

Referenced by unitDescription().

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 parseValue(), ptFromUnit(), and unit().

Referenced by parseValue().


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.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Sep 28 04:04:05 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003