]> git.lyx.org Git - lyx.git/blob - src/Spacing.h
More fixes to insettabular/text (and some missing features added).
[lyx.git] / src / Spacing.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef SPACING_H
13 #define SPACING_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <iosfwd>
20
21 #include "LString.h"
22
23 ///
24 class Spacing {
25 public:
26         ///
27         enum Space {
28                 ///
29                 Single,
30                 ///
31                 Onehalf,
32                 ///
33                 Double,
34                 ///
35                 Other,
36                 ///
37                 Default
38         };
39         ///
40         Spacing() : space(Single), value(1.0) {}
41         ///
42         bool isDefault() const {
43                 return space == Default;
44         }
45         ///
46         float getValue() const;
47         ///
48         Spacing::Space getSpace() const { return space; }
49         ///
50         void set(Spacing::Space sp, float val = 1.0);
51         ///
52         void set(Spacing::Space sp, string const & val) ;
53         ///
54         void writeFile(std::ostream &, bool para = false) const;
55         ///
56         string const writeEnvirBegin() const;
57         ///
58         string const writeEnvirEnd() const;
59 private:
60         ///
61         Space space;
62         ///
63         float value;
64 };
65
66
67 ///
68 inline
69 bool operator==(Spacing const & a, Spacing const & b)
70 {
71         return a.getSpace() == b.getSpace()
72                 && a.getValue() == b.getValue();
73 }
74
75 ///
76 inline
77 bool operator!=(Spacing const & a, Spacing const & b)
78 {
79         return !(a == b);
80 }
81 #endif