]> git.lyx.org Git - lyx.git/blob - src/vspace.h
ws changes only
[lyx.git] / src / vspace.h
1 // -*- C++ -*-
2 /**
3  * \file vspace.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Matthias Ettrich
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef VSPACE_H
13 #define VSPACE_H
14
15 #include "lyxgluelength.h"
16
17
18 class BufferParams;
19 class BufferView;
20
21
22 /// A class representing latex vertical spacing
23 class VSpace {
24 public:
25         /// The different kinds of spaces.
26         enum vspace_kind {
27                 NONE, ///< no added vertical space
28                 DEFSKIP,
29                 SMALLSKIP,
30                 MEDSKIP,
31                 BIGSKIP,
32                 VFILL,
33                 LENGTH ///< user-defined length
34         };
35
36         VSpace();
37
38         explicit VSpace(vspace_kind k);
39
40         explicit VSpace(LyXLength const & l);
41
42         explicit VSpace(LyXGlueLength const & l);
43
44         /// Constructor for reading from a .lyx file
45         explicit VSpace(std::string const & data);
46
47         /// return the type of vertical space
48         vspace_kind kind() const;
49         /// return the length of this space
50         LyXGlueLength const & length() const;
51
52         // a flag that switches between \vspace and \vspace*
53         bool keep() const;
54         /// if set true, use \vspace* when type is not DEFSKIP
55         void setKeep(bool val);
56         ///
57         bool operator==(VSpace const &) const;
58
59         // conversion
60
61         /// how it goes into the LyX file
62         std::string const asLyXCommand() const;
63         /// the latex representation
64         std::string const asLatexCommand(BufferParams const & params) const;
65         /// the size of the space on-screen
66         int inPixels(BufferView const & bv) const;
67
68 private:
69         /// This VSpace kind
70         vspace_kind kind_;
71         /// the specified length
72         LyXGlueLength len_;
73         /// if true, use \vspace* type
74         bool keep_;
75 };
76
77 #endif // VSPACE_H