4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
19 #include "support/docstring.h"
30 /// The different output types
41 /// The different margin types
42 enum LYX_MARGIN_TYPE {
52 MARGIN_RIGHT_ADDRESS_BOX
69 LYX_ALIGN_LAYOUT = 16,
71 LYX_ALIGN_SPECIAL = 32
76 void operator|=(LyXAlignment & la1, LyXAlignment la2) {
77 la1 = static_cast<LyXAlignment>(la1 | la2);
81 /// The different LaTeX-Types
82 enum LYX_LATEX_TYPES {
90 LATEX_ITEM_ENVIRONMENT,
92 LATEX_BIB_ENVIRONMENT,
94 LATEX_LIST_ENVIRONMENT
98 /// The different title types
99 enum LYX_TITLE_LATEX_TYPES {
101 TITLE_COMMAND_AFTER = 1,
107 /// The different label types
108 enum LYX_LABEL_TYPES {
116 LABEL_TOP_ENVIRONMENT,
118 LABEL_CENTERED_TOP_ENVIRONMENT,
120 // the flushright labels following now must start with LABEL_STATIC
135 enum LYX_END_LABEL_TYPES {
141 END_LABEL_FILLED_BOX,
145 END_LABEL_ENUM_FIRST = END_LABEL_NO_LABEL,
147 END_LABEL_ENUM_LAST = END_LABEL_STATIC
150 /* Fix labels are printed flushright, manual labels flushleft.
151 * MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
152 * MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
153 * This seems a funny restriction, but I think other combinations are
154 * not needed, so I will not change it yet.
155 * Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC
159 /* There is a parindent and a parskip. Which one is used depends on the
160 * paragraph_separation-flag of the text-object.
161 * BUT: parindent is only thrown away, if a parskip is defined! So if you
162 * want a space between the paragraphs and a parindent at the same time,
163 * you should set parskip to zero and use topsep, parsep and bottomsep.
165 * The standard layout is an exception: its parindent is only set, if the
166 * previous paragraph is standard too. Well, this is LateX and it is good!
175 bool read(Lexer &, TextClass const &);
177 void readAlign(Lexer &);
179 void readAlignPossible(Lexer &);
181 void readLabelType(Lexer &);
183 void readEndLabelType(Lexer &);
185 void readMargin(Lexer &);
187 void readLatexType(Lexer &);
189 void readSpacing(Lexer &);
191 std::string const & name() const;
193 void setName(std::string const & n);
195 std::string const & obsoleted_by() const;
197 std::string const & depends_on() const;
199 std::string const & latexname() const { return latexname_; }
201 lyx::docstring const & labelstring() const { return labelstring_; }
203 lyx::docstring const & endlabelstring() const { return endlabelstring_; }
205 docstring const & preamble() const { return preamble_; }
207 std::string const & latexparam() const { return latexparam_; }
209 std::string const & innertag() const { return innertag_; }
211 std::string const & labeltag() const { return labeltag_; }
213 std::string const & itemtag() const { return itemtag_; }
215 lyx::docstring const & labelstring_appendix() const {
216 return labelstring_appendix_;
218 /** Default font for this layout/environment.
219 The main font for this kind of environment. If an attribute has
220 Font::INHERITED_*, it means that the value is specified by
221 the defaultfont for the entire layout. If we are nested, the
222 font is inherited from the font in the environment one level
223 up until the font is resolved. The values Font::IGNORE_*
224 and Font::TOGGLE are illegal here.
228 /** Default font for labels.
229 Interpretation the same as for font above
233 /** Resolved version of the font for this layout/environment.
234 This is a resolved version the default font. The font is resolved
235 against the defaultfont of the entire layout.
239 /** Resolved version of the font used for labels.
240 This is a resolved version the label font. The font is resolved
241 against the defaultfont of the entire layout.
245 /// Text that dictates how wide the left margin is on the screen
246 std::string leftmargin;
247 /// Text that dictates how wide the right margin is on the screen
248 std::string rightmargin;
249 /// Text that dictates how much space to leave after a potential label
250 std::string labelsep;
251 /// Text that dictates how much space to leave before a potential label
252 std::string labelindent;
253 /// Text that dictates the width of the indentation of indented pars
254 std::string parindent;
264 double labelbottomsep;
272 LyXAlignment alignpossible;
274 LYX_LABEL_TYPES labeltype;
276 LYX_END_LABEL_TYPES endlabeltype;
278 LYX_MARGIN_TYPE margintype;
284 bool newline_allowed;
292 * Whether this layout was declared with "Environment xxx" as opposed
293 * to "Style xxx". This is part of some unfinished generic environment
294 * handling (see also InsetEnvironment) started by Andre. No layout
295 * that is shipped with LyX has this flag set.
296 * Don't confuse this with isEnvironment()!
301 /// special value of toclevel for non-section layouts
302 static const int NOT_IN_TOC;
303 /// for new environment insets
304 std::string latexheader;
305 /// for new environment insets
306 std::string latexfooter;
307 /// for new environment insets
308 std::string latexparagraph;
310 /** true when the fragile commands in the paragraph need to be
313 /// true when empty paragraphs should be kept.
316 bool isParagraph() const {
317 return latextype == LATEX_PARAGRAPH;
320 bool isCommand() const {
321 return latextype == LATEX_COMMAND;
324 bool isEnvironment() const {
325 return (latextype == LATEX_ENVIRONMENT
326 || latextype == LATEX_BIB_ENVIRONMENT
327 || latextype == LATEX_ITEM_ENVIRONMENT
328 || latextype == LATEX_LIST_ENVIRONMENT);
330 /// Type of LaTeX object
331 LYX_LATEX_TYPES latextype;
332 /// Does this object belong in the title part of the document?
334 /// Does this layout allow for an optional parameter?
336 /// Which counter to step
337 lyx::docstring counter;
338 /// Depth of XML command
342 /// Name of the layout/paragraph environment
345 /** Name of an layout that has replaced this layout.
346 This is used to rename a layout, while keeping backward
349 std::string obsoleted_by_;
351 /** Name of an layout which preamble must come before this one
352 This is used when the preamble snippet uses macros defined in
355 std::string depends_on_;
357 /// LaTeX name for environment
358 std::string latexname_;
359 /// Label string. "Abstract", "Reference", "Caption"...
360 lyx::docstring labelstring_;
362 lyx::docstring endlabelstring_;
363 /// Label string inside appendix. "Appendix", ...
364 lyx::docstring labelstring_appendix_;
365 /// LaTeX parameter for environment
366 std::string latexparam_;
367 /// Internal tag to use (e.g., <title></title> for sect header)
368 std::string innertag_;
369 /// Internal tag to use e.g. to surround varlistentry label)
370 std::string labeltag_;
371 /// Internal tag to surround the item text in a list)
372 std::string itemtag_;
373 /// Macro definitions needed for this layout