]> git.lyx.org Git - lyx.git/blob - src/lyxgluelength.h
"Inter-word Space"
[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 #include "lyxlength.h"
15
16 #include "LString.h"
17
18
19 class LyXGlueLength {
20 public:
21         ///
22         LyXGlueLength() {}
23         ///
24         explicit LyXGlueLength(LyXLength const & len);
25         ///
26         LyXGlueLength(LyXLength const & len,
27                       LyXLength const & plus,
28                       LyXLength const & minus);
29
30         /** "data" must be a decimal number, followed by a unit, and
31           optional "glue" indicated by "+" and "-".  You may abbreviate
32           reasonably.  Examples:
33           1.2 cm  //  4mm +2pt  //  2cm -4mm +2mm  //  4+0.1-0.2cm
34           The traditional Latex format is also accepted, like
35           4cm plus 10pt minus 10pt */
36         explicit LyXGlueLength(string const & data);
37
38         ///
39         LyXLength const & len() const;
40         ///
41         LyXLength const & plus() const;
42         ///
43         LyXLength const & minus() const;
44
45
46         /// conversion
47         string const asString() const;
48         ///
49         string const asLatexString() const;
50
51         friend bool isValidGlueLength(string const & data,
52                                       LyXGlueLength* result);
53
54 private:
55         /// the normal vlaue
56         LyXLength len_;
57         /// extra stretch
58         LyXLength plus_;
59         /// extra shrink
60         LyXLength minus_;
61 };
62
63 ///
64 bool operator==(LyXGlueLength const & l1, LyXGlueLength const & l2);
65 ///
66 bool operator!=(LyXGlueLength const & l1, LyXGlueLength const & l2);
67 /** If "data" is valid, the length represented by it is
68     stored into "result", if that is not 0. */
69 bool isValidGlueLength(string const & data, LyXGlueLength * result = 0);
70
71 #endif // LYXGLUELENGTH_H