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