]> git.lyx.org Git - lyx.git/blob - src/lyxlayout.h
ef8dcbadf479ee81c8468e727412249eacc7d62b
[lyx.git] / src / lyxlayout.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LYX_LAYOUT_H
13 #define LYX_LAYOUT_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "lyxfont.h"
20 #include "layout.h"
21 #include "Spacing.h"
22 #include "LString.h"
23
24 class LyXLex;
25 class LyXTextClass;
26
27 ///
28 class LyXLayout {
29 public:
30         ///
31         LyXLayout ();
32
33         ///
34         bool Read (LyXLex &, LyXTextClass const &);
35         ///
36         void readAlign(LyXLex &);
37         ///
38         void readAlignPossible(LyXLex &);
39         ///
40         void readLabelType(LyXLex &);
41         ///
42         void readEndLabelType(LyXLex &);
43         ///
44         void readMargin(LyXLex &);
45         ///
46         void readLatexType(LyXLex &);
47         ///
48         void readSpacing(LyXLex &);
49         ///
50         string const & name() const { return name_; }
51         ///
52         void setName(string const & n) { name_ = n; }
53         ///
54         string const & obsoleted_by() const { return obsoleted_by_; }
55         ///
56         string const & latexname() const { return latexname_; }
57         ///
58         string const & labelstring() const { return labelstring_; }
59         ///
60         string const & endlabelstring() const { return endlabelstring_; }
61         ///
62         string const & preamble() const { return preamble_; }
63         ///
64         string const & latexparam() const { return latexparam_; }
65         ///
66         string const & labelstring_appendix() const {
67                 return labelstring_appendix_;
68         }
69         /** Default font for this layout/environment.
70             The main font for this kind of environment. If an attribute has
71             LyXFont::INHERITED_*, it means that the value is specified by
72             the defaultfont for the entire layout. If we are nested, the
73             font is inherited from the font in the environment one level
74             up until the font is resolved. The values LyXFont::IGNORE_*
75             and LyXFont::TOGGLE are illegal here.
76         */
77         LyXFont font;
78
79         /** Default font for labels.
80             Interpretation the same as for font above
81         */
82         LyXFont labelfont;
83
84         /** Resolved version of the font for this layout/environment.
85             This is a resolved version the default font. The font is resolved
86             against the defaultfont of the entire layout.
87         */
88         LyXFont resfont;
89
90         /** Resolved version of the font used for labels.
91             This is a resolved version the label font. The font is resolved
92             against the defaultfont of the entire layout.
93         */
94         LyXFont reslabelfont;
95
96         /// Text that dictates how wide the left margin is on the screen
97         string leftmargin;
98
99         /// Text that dictates how wide the right margin is on the screen
100         string rightmargin;
101
102         /// Text that dictates how much space to leave after a potential label
103         string labelsep;
104
105         /// Text that dictates how much space to leave before a potential label
106         string labelindent;
107
108         /** Text that dictates the width of the indentation of
109             indented paragraphs.
110         */
111         string parindent;
112
113         ///
114         float parskip;
115
116         ///
117         float itemsep;
118
119         ///
120         float topsep;
121
122         ///
123         float bottomsep;
124
125         ///
126         float labelbottomsep;
127
128         ///
129         float parsep;
130
131         ///
132         Spacing spacing;
133
134         ///
135         LyXAlignment align;
136
137         ///
138         LyXAlignment alignpossible;
139
140         ///
141         char labeltype; // add approp. type
142
143         ///
144         LYX_END_LABEL_TYPES endlabeltype;
145
146         ///
147         LYX_MARGIN_TYPE margintype;
148
149         ///
150         bool fill_top;
151
152         ///
153         bool fill_bottom;
154
155         ///
156         bool newline_allowed;
157
158         ///
159         bool nextnoindent;
160
161         ///
162         bool free_spacing;
163
164         ///
165         bool pass_thru;
166
167         /** true when the fragile commands in the paragraph need to be
168             \protect'ed. */
169         bool needprotect;
170         /// true when empty paragraphs should be kept.
171         bool keepempty;
172         ///
173         bool isParagraph() const {
174                 return latextype == LATEX_PARAGRAPH;
175         }
176         ///
177         bool isCommand() const { 
178                 return latextype == LATEX_COMMAND;
179         }
180         ///
181         bool isEnvironment() const {
182                 return (latextype == LATEX_ENVIRONMENT
183                         || latextype == LATEX_ITEM_ENVIRONMENT
184                         || latextype == LATEX_LIST_ENVIRONMENT);
185         }
186         /// Type of LaTeX object
187         LYX_LATEX_TYPES latextype;
188         /// Does this object belong in the title part of the document?
189         bool intitle;
190 private:
191         /// Name of the layout/paragraph environment
192         string name_;
193
194         /** Name of an layout that has replaced this layout.
195             This is used to rename a layout, while keeping backward
196             compatibility 
197         */
198         string obsoleted_by_;
199
200         /// LaTeX name for environment
201         string latexname_;
202
203         /// Label string. "Abstract", "Reference", "Caption"...
204         string labelstring_;
205
206         ///
207         string endlabelstring_;
208
209         /// Label string inside appendix. "Appendix", ...
210         string labelstring_appendix_;
211
212         /// LaTeX parameter for environment
213         string latexparam_;
214
215         /// Macro definitions needed for this layout
216         string preamble_;
217 };
218
219 #endif