4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author Matthias Ettrich
21 * LyXLength - Represents latex length measurement
27 SP, ///< Scaled point (65536sp = 1pt) TeX's smallest unit.
28 PT, ///< Point = 1/72.27in = 0.351mm
29 BP, ///< Big point (72bp = 1in), also PostScript point
30 DD, ///< Didot point = 1/72 of a French inch, = 0.376mm
31 MM, ///< Millimeter = 2.845pt
32 PC, ///< Pica = 12pt = 4.218mm
33 CC, ///< Cicero = 12dd = 4.531mm
34 CM, ///< Centimeter = 10mm = 2.371pc
35 IN, ///< Inch = 25.4mm = 72.27pt = 6.022pc
36 EX, ///< Height of a small "x" for the current font.
37 EM, ///< Width of capital "M" in current font.
38 MU, ///< Math unit (18mu = 1em) for positioning in math mode
39 PW, ///< Percent of columnwidth both "%" or "%c"
41 PP, ///< Percent of pagewidth
42 PL, ///< Percent of linewidth
43 UNIT_NONE ///< no unit
49 LyXLength(double v, LyXLength::UNIT u);
51 /// "data" must be a decimal number, followed by a unit
52 explicit LyXLength(string const & data);
57 LyXLength::UNIT unit() const;
61 void unit(LyXLength::UNIT unit);
64 /// return string representation
65 string const asString() const;
66 /// return string representation for LaTeX
67 string const asLatexString() const;
68 /// return the on-screen size of this length
69 int inPixels(int default_width, int default_height) const;
71 /** If "data" is valid, the length represented by it is
72 stored into "result", if that is not 0. */
73 friend bool isValidLength(string const & data, LyXLength * result = 0);
79 LyXLength::UNIT unit_;
83 bool operator==(LyXLength const & l1, LyXLength const & l2);
85 bool operator!=(LyXLength const & l1, LyXLength const & l2);
87 bool isValidLength(string const & data, LyXLength * result);
88 /// return the name of the given unit number
89 char const * stringFromUnit(int unit);