]> git.lyx.org Git - lyx.git/blob - src/Spacing.h
ParagraphParameters and SharedContainer
[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         Spacing(Spacing::Space sp, float val = 1.0) {
43                 set(sp, val);
44         }
45         Spacing(Spacing::Space sp, string const & val) {
46                 set(sp, val);
47         }
48         ///
49         bool isDefault() const {
50                 return space == Default;
51         }
52         ///
53         float getValue() const;
54         ///
55         Spacing::Space getSpace() const { return space; }
56         ///
57         void set(Spacing::Space sp, float val = 1.0);
58         ///
59         void set(Spacing::Space sp, string const & val) ;
60         ///
61         void writeFile(std::ostream &, bool para = false) const;
62         ///
63         string const writeEnvirBegin() const;
64         ///
65         string const writeEnvirEnd() const;
66 private:
67         ///
68         Space space;
69         ///
70         float value;
71 };
72
73
74 ///
75 inline
76 bool operator==(Spacing const & a, Spacing const & b)
77 {
78         return a.getSpace() == b.getSpace()
79                 && a.getValue() == b.getValue();
80 }
81
82 ///
83 inline
84 bool operator!=(Spacing const & a, Spacing const & b)
85 {
86         return !(a == b);
87 }
88 #endif