2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright (C) 1995 Matthias Ettrich
9 *======================================================*/
18 #include "definitions.h"
23 /// Reads the style files
26 /// The different output types
38 /// The different margin types
39 enum LYX_MARGIN_TYPE {
49 MARGIN_RIGHT_ADDRESS_BOX
63 LYX_ALIGN_LAYOUT = 16,
65 LYX_ALIGN_SPECIAL = 32
68 /// The different LaTeX-Types
69 enum LYX_LATEX_TYPES {
77 LATEX_ITEM_ENVIRONMENT,
79 LATEX_LIST_ENVIRONMENT
82 /// The different label types
83 enum LYX_LABEL_TYPES {
91 LABEL_TOP_ENVIRONMENT,
93 LABEL_CENTERED_TOP_ENVIRONMENT,
95 // the flushright labels following now must start with LABEL_STATIC
101 LABEL_COUNTER_CHAPTER,
103 LABEL_COUNTER_SECTION,
105 LABEL_COUNTER_SUBSECTION,
107 LABEL_COUNTER_SUBSUBSECTION,
109 LABEL_COUNTER_PARAGRAPH,
111 LABEL_COUNTER_SUBPARAGRAPH,
115 LABEL_COUNTER_ENUMII,
117 LABEL_COUNTER_ENUMIII,
119 LABEL_COUNTER_ENUMIV,
121 LABEL_FIRST_COUNTER = LABEL_COUNTER_CHAPTER
125 /* Fix labels are printed flushright, manual labels flushleft.
126 * MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
127 * MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
128 * This seems a funny restriction, but I think other combinations are
129 * not needed, so I will not change it yet.
130 * Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC */
133 /* There is a parindent and a parskip. Which one is used depends on the
134 * paragraph_separation-flag of the text-object.
135 * BUT: parindent is only thrown away, if a parskip is defined! So if you
136 * want a space between the paragraphs and a parindent at the same time,
137 * you should set parskip to zero and use topsep, parsep and bottomsep.
139 * The standard layout is an exception: its parindent is only set, if the
140 * previous paragraph is standard too. Well, this is LateX and it is good! */
143 /// Attributes of a layout/paragraph environment
155 void Copy (LyXLayout const &l);
158 bool Read (LyXLex&, LyXLayoutList *);
160 /// Name of the layout/paragraph environment
163 /// Name of an layout that has replaced this layout.
164 /** This is used to rename a layout, while keeping backward
167 LString obsoleted_by;
169 /// Default font for this layout/environment
170 /** The main font for this kind of environment. If an attribute has
171 LyXFont::INHERITED_*, it means that the value is specified by
172 the defaultfont for the entire layout. If we are nested, the font
173 is inherited from the font in the environment one level up until the
174 font is resolved. The values LyXFont::IGNORE_* and LyXFont::TOGGLE
179 /// Default font for labels
180 /** Interpretation the same as for font above */
183 /// Resolved version of the font for this layout/environment
184 /** This is a resolved version the default font. The font is resolved
185 against the defaultfont of the entire layout. */
188 /// Resolved version of the font used for labels
189 /** This is a resolved version the label font. The font is resolved
190 against the defaultfont of the entire layout. */
191 LyXFont reslabelfont;
193 /// Text that dictates how wide the left margin is on the screen
196 /// Text that dictates how wide the right margin is on the screen
199 /// Text that dictates how much space to leave after a potential label
202 /// Text that dictates how much space to leave before a potential label
205 /// Text that dictates the width of the indentation of indented paragraphs
208 /// Label string. "Abstract", "Reference", "Caption"...
211 /// Label string inside appendix. "Appendix", ...
212 LString labelstring_appendix;
214 /// LaTeX name for environment
217 /// LaTeX parameter for environment
218 LString latexparam; //arrae970411
220 /// Macro definitions needed for this layout
236 float labelbottomsep;
245 char align; // add approp. signedness
248 char alignpossible; // add approp. signedness
251 char labeltype; // add approp. signedness
254 char margintype; // add approp. signedness
263 bool newline_allowed;
270 /// true when the fragile commands in the paragraph need to be
273 /// true when empty paragraphs should be kept.
276 bool isParagraph() const {
277 return latextype == LATEX_PARAGRAPH;
280 bool isCommand() const {
281 return latextype == LATEX_COMMAND;
284 bool isEnvironment() const {
285 return (latextype == LATEX_ENVIRONMENT
286 || latextype == LATEX_ITEM_ENVIRONMENT
287 || latextype == LATEX_LIST_ENVIRONMENT);
289 /// Type of LaTeX object
290 LYX_LATEX_TYPES latextype;
291 /// Does this object belong in the title part of the document?
297 class LyXLayoutList {
304 void Add (LyXLayout *l);
306 bool Delete (LString const &name);
308 LyXLayout *GetLayout (LString const &name);
336 LyXTextClass (LString const & = LString(),
337 LString const & = LString(),
338 LString const & = LString());
342 /// Not a real copy, just reference!
343 void Copy (LyXTextClass const &l);
345 /// Reads a textclass structure from file
346 int Read (LString const & filename, LyXLayoutList *list = NULL);
348 /// Sees to that the textclass structure has been loaded
358 OutputType output_type;
360 /// Specific class options
361 LString opt_fontsize;
363 LString opt_pagestyle;
367 /// Packages that are already loaded by the class
368 bool provides_amsmath;
370 bool provides_makeidx;
374 /// Base font. This one has to be fully instantiated.
375 /** Base font. The paragraph and layout fonts are resolved against
376 this font. Attributes LyXFont::INHERIT, LyXFont::IGNORE, and
377 LyXFont::TOGGLE are extremely illegal.
380 /// Array of styles in this textclass
383 unsigned char number_of_defined_layouts;
385 unsigned char columns;
389 signed char secnumdepth;
391 signed char tocdepth;
397 /// Text that dictates how wide the left margin is on the screen
400 /// Text that dictates how wide the right margin is on the screen
403 char maxcounter; // add approp. signedness
405 /// Has this layout file been loaded yet?
411 class LyXTextClassList {
419 /// Gets layout structure from layout number and textclass number
420 LyXLayout *Style(char textclass, char layout);
422 /// Gets layout number from textclass number and layout name
423 char NumberOfLayout(char textclass, LString const & name); // add approp. signedness
425 /// Gets a layout name from layout number and textclass number
426 LString NameOfLayout(char textclass, char layout); // add approp. signedness
428 /// Gets textclass number from name
429 /** Returns -1 if textclass name does not exist */
430 signed char NumberOfClass(LString const & textclass);
433 LString NameOfClass(char number); // add approp. signedness
436 LString LatexnameOfClass(char number); // add approp. signedness
439 LString DescOfClass(char number); // add approp. signedness
442 LyXTextClass * TextClass(char textclass); // add approp. signedness
444 /// Read textclass list
445 /** Returns false if this fails */
449 /** Returns false if this fails */
450 bool Load(const char number);
453 struct LyXTextClassL {
455 LyXTextClass * textclass;
457 LyXTextClassL * next;
466 /// After reading, this arrays holds the textclasses
469 /// Add a textclass to list
470 void Add (LyXTextClass *l);
472 /// Convert final linked list to array
473 /** We read the textclasses into a linked list. After the reading,
474 the list is converted to an array, and the linked list is nuked. */
478 /// Should not be declared here!! (Lgb) Why not? (Asger)
479 extern LyXTextClassList lyxstyle;