]> git.lyx.org Git - lyx.git/blob - src/vspace.h
split LyXText::rowlist_ into individual Paragraph::rows_ chunks
[lyx.git] / src / vspace.h
1 // -*- C++ -*-
2 /**
3  * \file vspace.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author Matthias Ettrich
8  */
9
10 #ifndef VSPACE_H
11 #define VSPACE_H
12
13 #include "lyxgluelength.h"
14
15 #include "LString.h"
16
17 class BufferParams;
18 class BufferView;
19
20
21 /// A class representing latex vertical spacing
22 class VSpace {
23 public:
24         /// The different kinds of spaces.
25         enum vspace_kind {
26                 NONE, ///< no added vertical space
27                 DEFSKIP,
28                 SMALLSKIP,
29                 MEDSKIP,
30                 BIGSKIP,
31                 VFILL,
32                 LENGTH ///< user-defined length
33         };
34
35         VSpace();
36
37         explicit VSpace(vspace_kind k);
38
39         explicit VSpace(LyXLength const & l);
40
41         explicit VSpace(LyXGlueLength const & l);
42
43         /// Constructor for reading from a .lyx file
44         explicit VSpace(string const & data);
45
46         /// return the type of vertical space
47         vspace_kind kind() const;
48         /// return the length of this space
49         LyXGlueLength length() const;
50
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;
57
58         // conversion
59
60         /// how it goes into the LyX file
61         string const asLyXCommand() const;
62         /// the latex representation
63         string const asLatexCommand(BufferParams const & params) const;
64         /// the size of the space on-screen
65         int inPixels(BufferView const & bv) const;
66
67 private:
68         /// This VSpace kind
69         vspace_kind kind_;
70         /// the specified length
71         LyXGlueLength len_;
72         /// if true, use \vspace* type
73         bool keep_;
74 };
75
76 #endif // VSPACE_H