Consider the case where there is not any layout name.
[lyx.git] / src / vspace.h
blobe95c5ec7b55a8b9c562fa6e3513e513bbde7e97b
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.
7 * \author Matthias Ettrich
9 * Full author contact details are available in file CREDITS.
12 #ifndef VSPACE_H
13 #define VSPACE_H
15 #include "lyxgluelength.h"
18 class BufferParams;
19 class BufferView;
22 /// A class representing latex vertical spacing
23 class VSpace {
24 public:
25 /// The different kinds of spaces.
26 enum vspace_kind {
27 DEFSKIP,
28 SMALLSKIP,
29 MEDSKIP,
30 BIGSKIP,
31 VFILL,
32 LENGTH ///< user-defined length
35 VSpace();
37 explicit VSpace(vspace_kind k);
39 explicit VSpace(LyXLength const & l);
41 explicit VSpace(LyXGlueLength const & l);
43 /// Constructor for reading from a .lyx file
44 explicit VSpace(std::string const & data);
46 /// return the type of vertical space
47 vspace_kind kind() const;
48 /// return the length of this space
49 LyXGlueLength const & length() const;
51 // a flag that switches between \vspace and \vspace*
52 bool keep() const;
53 /// if set true, use \vspace* when type is not DEFSKIP
54 void setKeep(bool val);
55 ///
56 bool operator==(VSpace const &) const;
58 // conversion
60 /// how it goes into the LyX file
61 std::string const asLyXCommand() const;
62 /// the latex representation
63 std::string const asLatexCommand(BufferParams const & params) const;
64 /// how it is seen in the LyX window
65 std::string const VSpace::asGUIName() const;
66 /// the size of the space on-screen
67 int inPixels(BufferView const & bv) const;
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_;
78 #endif // VSPACE_H