2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team.
10 * ====================================================== */
28 /// Scaled point (65536sp = 1pt) TeX's smallest unit.
30 /// Point = 1/72.27in = 0.351mm
32 /// Big point (72bp = 1in), also PostScript point
34 /// Didot point = 1/72 of a French inch, = 0.376mm
36 /// Millimeter = 2.845pt
38 /// Pica = 12pt = 4.218mm
40 /// Cicero = 12dd = 4.531mm
42 /// Centimeter = 10mm = 2.371pc
44 /// Inch = 25.4mm = 72.27pt = 6.022pc
46 /// Height of a small "x" for the current font.
48 /// Width of capital "M" in current font.
50 /// Math unit (18mu = 1em) for positioning in math mode
52 /// Percent of columnwidth both "%" or "%c"
56 /// Percent of pagewidth
58 /// Percent of linewidth
67 LyXLength(double v, LyXLength::UNIT u);
69 /// "data" must be a decimal number, followed by a unit
70 explicit LyXLength(string const & data);
75 LyXLength::UNIT unit() const;
79 void unit(LyXLength::UNIT unit);
83 string const asString() const;
85 string const asLatexString() const;
87 int inPixels(int default_width, int default_height) const;
89 /** If "data" is valid, the length represented by it is
90 stored into "result", if that is not 0. */
91 friend bool isValidLength(string const & data, LyXLength * result = 0);
97 LyXLength::UNIT unit_;
101 bool operator==(LyXLength const & l1, LyXLength const & l2);
103 bool operator!=(LyXLength const & l1, LyXLength const & l2);
105 bool isValidLength(string const & data, LyXLength * result);
107 char const * stringFromUnit(int unit);