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