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