#include <KoUnit.h>
|
| 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
} |
| |
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 59 of file KoUnit.h.
◆ Unit
◆ fromUserValue() [1/2]
| double KoUnit::fromUserValue |
( |
const TQString & |
value, |
|
|
Unit |
unit, |
|
|
bool * |
ok = 0 |
|
) |
| |
|
static |
This method is the one to use to read a value from a dialog.
- Parameters
-
| value | value entered by the user |
| unit | unit type selected by the user |
| ok | if set, the pointed bool is set to true if the value could be converted to a double, and to false otherwise. |
- Returns
- the value in
unit, converted to points for internal use
Definition at line 143 of file KoUnit.cpp.
◆ fromUserValue() [2/2]
| double KoUnit::fromUserValue |
( |
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 Old name: ptFromUnit
Definition at line 120 of file KoUnit.cpp.
◆ listOfUnitName()
| TQStringList KoUnit::listOfUnitName |
( |
| ) |
|
|
static |
◆ parseValue()
| double KoUnit::parseValue |
( |
TQString |
value, |
|
|
double |
defaultVal = 0.0 |
|
) |
| |
|
static |
parse common KOffice and OO values, like "10cm", "5mm" to pt
Definition at line 148 of file KoUnit.cpp.
◆ ptToUnit()
| double KoUnit::ptToUnit |
( |
const double |
ptValue, |
|
|
const Unit |
unit |
|
) |
| |
|
static |
Convert the value ptValue to a given unit unit Unlike KoUnit::ptToUnit the return value remains unrounded, so that it can be used in complex calculation.
- Returns
- the converted value Old name: ptToUnitUnrounded
Definition at line 91 of file KoUnit.cpp.
◆ saveOasis()
Save a unit in OASIS format.
Definition at line 212 of file KoUnit.cpp.
◆ toCC()
| static double KoUnit::toCC |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in cicero.
Definition at line 117 of file KoUnit.h.
◆ toCM()
| static double KoUnit::toCM |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in cm.
Definition at line 89 of file KoUnit.h.
◆ toDD()
| static double KoUnit::toDD |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in didot.
Definition at line 111 of file KoUnit.h.
◆ toDM()
| static double KoUnit::toDM |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in dm.
Definition at line 94 of file KoUnit.h.
◆ toInch()
| static double KoUnit::toInch |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in inch.
Definition at line 99 of file KoUnit.h.
◆ toMM()
| static double KoUnit::toMM |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in mm.
Definition at line 83 of file KoUnit.h.
◆ toPI()
| static double KoUnit::toPI |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in pica.
Definition at line 105 of file KoUnit.h.
◆ toPoint()
| static double KoUnit::toPoint |
( |
double |
ptValue | ) |
|
|
inlinestatic |
Prepare ptValue to be displayed in pt.
Definition at line 77 of file KoUnit.h.
◆ toUserStringValue()
| TQString KoUnit::toUserStringValue |
( |
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 Old name: userValue
Definition at line 115 of file KoUnit.cpp.
◆ toUserValue()
| double KoUnit::toUserValue |
( |
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 Old name: ptToUnit
Definition at line 68 of file KoUnit.cpp.
◆ unit()
| KoUnit::Unit KoUnit::unit |
( |
const TQString & |
_unitName, |
|
|
bool * |
ok = 0 |
|
) |
| |
|
static |
Convert a unit name into a Unit enum.
- Parameters
-
| _unitName | name to convert |
| ok | if set, it will be true if the unit was known, false if unknown |
Definition at line 182 of file KoUnit.cpp.
◆ unitDescription()
| TQString KoUnit::unitDescription |
( |
Unit |
_unit | ) |
|
|
static |
Get the full (translated) description of a unit.
Definition at line 43 of file KoUnit.cpp.
◆ unitName()
| TQString KoUnit::unitName |
( |
Unit |
_unit | ) |
|
|
static |
Get the name of a unit.
Definition at line 200 of file KoUnit.cpp.
The documentation for this class was generated from the following files:
|