]> git.lyx.org Git - lyx.git/blob - src/HSpace.h
Enable OK/Apply buttons when resetting to class defaults.
[lyx.git] / src / HSpace.h
1 // -*- C++ -*-
2 /**
3  * \file HSpace.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Spitzmüller
8  * \author Uwe Stöhr
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef HSPACE_H
14 #define HSPACE_H
15
16 #include "Length.h"
17
18
19 namespace lyx {
20
21
22 class BufferParams;
23 class BufferView;
24
25
26 /// A class representing latex horizontal spacing
27 class HSpace {
28 public:
29         /// The different kinds of spaces.
30         enum HSpaceKind {
31                 DEFAULT,
32                 LENGTH ///< user-defined length
33         };
34
35         ///
36         HSpace();
37         ///
38         explicit HSpace(HSpaceKind k);
39         ///
40         explicit HSpace(Length const & l);
41         ///
42         explicit HSpace(GlueLength const & l);
43
44         /// Constructor for reading from a .lyx file
45         explicit HSpace(std::string const & data);
46
47         /// return the type of vertical space
48         HSpaceKind kind() const { return kind_; }
49         /// return the length of this space
50         GlueLength const & length() const { return len_; }
51
52         ///
53         bool operator==(HSpace const &) const;
54
55         // conversion
56
57         /// how it goes into the LyX file
58         std::string const asLyXCommand() const;
59         /// the latex representation
60         std::string const asLatexCommand() const;
61         ///
62         std::string asHTMLLength() const;
63         /// how it is seen in the LyX window
64         docstring const asGUIName() const;
65         /// the size of the space on-screen
66         int inPixels(BufferView const & bv) const;
67
68 private:
69         /// This HSpace kind
70         HSpaceKind kind_;
71         /// the specified length
72         GlueLength len_;
73 };
74
75
76 } // namespace lyx
77
78 #endif // HSPACE_H