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 * ====================================================== */
30 /// Scaled point (65536sp = 1pt) TeX's smallest unit.
32 /// Point = 1/72.27in = 0.351mm
34 /// Big point (72bp = 1in), also PostScript point
36 /// Didot point = 1/72 of a French inch, = 0.376mm
38 /// Millimeter = 2.845pt
40 /// Pica = 12pt = 4.218mm
42 /// Cicero = 12dd = 4.531mm
44 /// Centimeter = 10mm = 2.371pc
46 /// Inch = 25.4mm = 72.27pt = 6.022pc
48 /// Height of a small "x" for the current font.
50 /// Width of capital "M" in current font.
52 /// Math unit (18mu = 1em) for positioning in math mode
54 /// Percent of columnwidth both "%" or "%c"
58 /// Percent of pagewidth
60 /// Percent of linewidth
69 LyXLength(double v, LyXLength::UNIT u);
71 /// "data" must be a decimal number, followed by a unit
72 explicit LyXLength(string const & data);
77 LyXLength::UNIT unit() const;
81 void unit(LyXLength::UNIT unit);
85 string const asString() const;
87 string const asLatexString() const;
89 int inPixels(BufferView const * bv) const;
91 /** If "data" is valid, the length represented by it is
92 stored into "result", if that is not 0. */
93 friend bool isValidLength(string const & data, LyXLength * result = 0);
99 LyXLength::UNIT unit_;
103 bool operator==(LyXLength const & l1, LyXLength const & l2);
105 bool operator!=(LyXLength const & l1, LyXLength const & l2);
107 bool isValidLength(string const & data, LyXLength * result);
109 char const * stringFromUnit(int unit);