* qt_helpers.cpp:
[lyx.git] / src / VSpace.h
blob0d154d63e4bc2a0d0d0bbc2e512c4b20b04d539f
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 "Length.h"
18 namespace lyx {
21 class BufferParams;
22 class BufferView;
25 /// A class representing latex vertical spacing
26 class VSpace {
27 public:
28 /// The different kinds of spaces.
29 enum VSpaceKind {
30 DEFSKIP,
31 SMALLSKIP,
32 MEDSKIP,
33 BIGSKIP,
34 VFILL,
35 LENGTH ///< user-defined length
38 ///
39 VSpace();
40 ///
41 explicit VSpace(VSpaceKind k);
42 ///
43 explicit VSpace(Length const & l);
44 ///
45 explicit VSpace(GlueLength const & l);
47 /// Constructor for reading from a .lyx file
48 explicit VSpace(std::string const & data);
50 /// return the type of vertical space
51 VSpaceKind kind() const { return kind_; }
52 /// return the length of this space
53 GlueLength const & length() const { return len_; }
55 /// a flag that switches between \vspace and \vspace*
56 bool keep() const { return keep_; }
57 /// if set true, use \vspace* when type is not DEFSKIP
58 void setKeep(bool keep) { keep_ = keep; }
59 ///
60 bool operator==(VSpace const &) const;
62 // conversion
64 /// how it goes into the LyX file
65 std::string const asLyXCommand() const;
66 /// the latex representation
67 std::string const asLatexCommand(BufferParams const & params) const;
68 ///
69 std::string asHTMLLength() const;
70 /// how it is seen in the LyX window
71 docstring const asGUIName() const;
72 /// the size of the space on-screen
73 int inPixels(BufferView const & bv) const;
75 private:
76 /// This VSpace kind
77 VSpaceKind kind_;
78 /// the specified length
79 GlueLength len_;
80 /// if true, use \vspace* type
81 bool keep_;
85 } // namespace lyx
87 #endif // VSPACE_H