* de.po: sync with branch.
[lyx.git] / src / Spacing.h
blobafdcda1773cfdaed577afefead22647907a38081
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 #ifdef TEX2LYX
16 #include "tex2lyx/Spacing.h"
17 #else
19 #include "support/strfwd.h"
21 #include <string>
23 namespace lyx {
25 ///
26 class Spacing {
27 public:
28 ///
29 enum Space {
30 ///
31 Single,
32 ///
33 Onehalf,
34 ///
35 Double,
36 ///
37 Other,
38 ///
39 Default
41 ///
42 Spacing() : space(Default), value("1.0") {}
43 ///
44 Spacing(Spacing::Space sp, double val = 1.0) { set(sp, val); }
45 ///
46 Spacing(Spacing::Space sp, std::string const & val) { set(sp, val); }
47 ///
48 bool isDefault() const { return space == Default; }
49 ///
50 std::string const getValueAsString() const;
51 ///
52 double getValue() const;
53 ///
54 Spacing::Space getSpace() const { return space; }
55 ///
56 void set(Spacing::Space sp, double val = 1.0);
57 ///
58 void set(Spacing::Space sp, std::string const & val);
59 ///
60 void writeFile(std::ostream &, bool para = false) const;
61 /// useSetSpace is true when using the variant supported by
62 /// the memoir class.
63 std::string const writeEnvirBegin(bool useSetSpace) const;
64 /// useSetSpace is true when using the variant supported by
65 /// the memoir class.
66 std::string const writeEnvirEnd(bool useSetSpace) const;
67 /// useSetSpace is true when using the variant supported by
68 /// the memoir class.
69 std::string const writePreamble(bool useSetSpace) const;
71 private:
72 ///
73 Space space;
74 ///
75 std::string value;
76 /// names of line spacing
77 static std::string const spacing_string[];
81 ///
82 inline
83 bool operator==(Spacing const & a, Spacing const & b)
85 return a.getSpace() == b.getSpace()
86 && a.getValueAsString() == b.getValueAsString();
89 ///
90 inline
91 bool operator!=(Spacing const & a, Spacing const & b)
93 return !(a == b);
96 } // namespace lyx
98 #endif // TEX2LYX
99 #endif // SPACING_H