]> git.lyx.org Git - lyx.git/blob - src/vspace.h
Replace LString.h with support/std_string.h,
[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 #include "support/std_string.h"
18
19 class BufferParams;
20 class BufferView;
21
22
23 /// A class representing latex vertical spacing
24 class VSpace {
25 public:
26         /// The different kinds of spaces.
27         enum vspace_kind {
28                 NONE, ///< no added vertical space
29                 DEFSKIP,
30                 SMALLSKIP,
31                 MEDSKIP,
32                 BIGSKIP,
33                 VFILL,
34                 LENGTH ///< user-defined length
35         };
36
37         VSpace();
38
39         explicit VSpace(vspace_kind k);
40
41         explicit VSpace(LyXLength const & l);
42
43         explicit VSpace(LyXGlueLength const & l);
44
45         /// Constructor for reading from a .lyx file
46         explicit VSpace(string const & data);
47
48         /// return the type of vertical space
49         vspace_kind kind() const;
50         /// return the length of this space
51         LyXGlueLength length() const;
52
53         // a flag that switches between \vspace and \vspace*
54         bool keep() const;
55         /// if set true, use \vspace* when type is not DEFSKIP
56         void setKeep(bool val);
57         ///
58         bool operator==(VSpace const &) const;
59
60         // conversion
61
62         /// how it goes into the LyX file
63         string const asLyXCommand() const;
64         /// the latex representation
65         string const asLatexCommand(BufferParams const & params) const;
66         /// the size of the space on-screen
67         int inPixels(BufferView const & bv) const;
68
69 private:
70         /// This VSpace kind
71         vspace_kind kind_;
72         /// the specified length
73         LyXGlueLength len_;
74         /// if true, use \vspace* type
75         bool keep_;
76 };
77
78 #endif // VSPACE_H