Consider the case where there is not any layout name.
[lyx.git] / src / Spacing.h
blob617ec9269e2d92e57bec69118705395de12b90a5
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 ///
20 class Spacing {
21 public:
22 ///
23 enum Space {
24 ///
25 Single,
26 ///
27 Onehalf,
28 ///
29 Double,
30 ///
31 Other,
32 ///
33 Default
35 ///
36 Spacing() : space(Default), value("1.0") {}
37 ///
38 Spacing(Spacing::Space sp, double val = 1.0) {
39 set(sp, val);
41 Spacing(Spacing::Space sp, std::string const & val) {
42 set(sp, val);
44 ///
45 bool isDefault() const {
46 return space == Default;
48 ///
49 std::string const getValueAsString() const;
50 ///
51 double getValue() const;
52 ///
53 Spacing::Space getSpace() const { return space; }
54 ///
55 void set(Spacing::Space sp, double val = 1.0);
56 ///
57 void set(Spacing::Space sp, std::string const & val);
58 ///
59 void writeFile(std::ostream &, bool para = false) const;
60 ///
61 std::string const writeEnvirBegin() const;
62 ///
63 std::string const writeEnvirEnd() const;
65 private:
66 ///
67 Space space;
68 ///
69 std::string value;
70 /// names of line spacing
71 static std::string const spacing_string[];
75 ///
76 inline
77 bool operator==(Spacing const & a, Spacing const & b)
79 return a.getSpace() == b.getSpace()
80 && a.getValueAsString() == b.getValueAsString();
83 ///
84 inline
85 bool operator!=(Spacing const & a, Spacing const & b)
87 return !(a == b);
89 #endif