]> git.lyx.org Git - lyx.git/blob - src/lyxgluelength.h
Point fix, earlier forgotten
[lyx.git] / src / lyxgluelength.h
1 // -*- C++ -*-
2 /**
3  * \file lyxgluelength.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Matthias Ettrich
9  * \author Jean-Marc Lasgouttes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef LYX_GLUE_LENGTH_H
15 #define LYX_GLUE_LENGTH_H
16
17 #include "lyxlength.h"
18
19 #include "LString.h"
20
21
22 class LyXGlueLength {
23 public:
24         ///
25         LyXGlueLength() {}
26         ///
27         explicit LyXGlueLength(LyXLength const & len);
28         ///
29         LyXGlueLength(LyXLength const & len,
30                       LyXLength const & plus,
31                       LyXLength const & minus);
32
33         /** "data" must be a decimal number, followed by a unit, and
34           optional "glue" indicated by "+" and "-".  You may abbreviate
35           reasonably.  Examples:
36           1.2 cm  //  4mm +2pt  //  2cm -4mm +2mm  //  4+0.1-0.2cm
37           The traditional Latex format is also accepted, like
38           4cm plus 10pt minus 10pt */
39         explicit LyXGlueLength(string const & data);
40
41         ///
42         LyXLength const & len() const;
43         ///
44         LyXLength const & plus() const;
45         ///
46         LyXLength const & minus() const;
47
48
49         /// conversion
50         string const asString() const;
51         ///
52         string const asLatexString() const;
53
54         friend bool isValidGlueLength(string const & data,
55                                       LyXGlueLength* result);
56
57 private:
58         /// the normal vlaue
59         LyXLength len_;
60         /// extra stretch
61         LyXLength plus_;
62         /// extra shrink
63         LyXLength minus_;
64 };
65
66 ///
67 bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2);
68 ///
69 bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
70 /** If "data" is valid, the length represented by it is
71     stored into "result", if that is not 0. */
72 bool isValidGlueLength(string const & data, LyXGlueLength * result = 0);
73
74 #endif // LYXGLUELENGTH_H