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