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