Update lyx examples to latest file format (for 1.5.0 release)
[lyx.git] / src / Spacing.h
blob273786aced0a77d2d2dddc84543b36063e749bf8
1 // -*- C++ -*-
2 /**
3 * \file src/Spacing.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
12 #ifndef SPACING_H
13 #define SPACING_H
15 #include <iosfwd>
16 #include <string>
19 namespace lyx {
22 ///
23 class Spacing {
24 public:
25 ///
26 enum Space {
27 ///
28 Single,
29 ///
30 Onehalf,
31 ///
32 Double,
33 ///
34 Other,
35 ///
36 Default
38 ///
39 Spacing() : space(Default), value("1.0") {}
40 ///
41 Spacing(Spacing::Space sp, double val = 1.0) {
42 set(sp, val);
44 Spacing(Spacing::Space sp, std::string const & val) {
45 set(sp, val);
47 ///
48 bool isDefault() const {
49 return space == Default;
51 ///
52 std::string const getValueAsString() const;
53 ///
54 double getValue() const;
55 ///
56 Spacing::Space getSpace() const { return space; }
57 ///
58 void set(Spacing::Space sp, double val = 1.0);
59 ///
60 void set(Spacing::Space sp, std::string const & val);
61 ///
62 void writeFile(std::ostream &, bool para = false) const;
63 ///
64 std::string const writeEnvirBegin() const;
65 ///
66 std::string const writeEnvirEnd() const;
68 private:
69 ///
70 Space space;
71 ///
72 std::string value;
73 /// names of line spacing
74 static std::string const spacing_string[];
78 ///
79 inline
80 bool operator==(Spacing const & a, Spacing const & b)
82 return a.getSpace() == b.getSpace()
83 && a.getValueAsString() == b.getValueAsString();
86 ///
87 inline
88 bool operator!=(Spacing const & a, Spacing const & b)
90 return !(a == b);
93 } // namespace lyx
95 #endif