]> git.lyx.org Git - lyx.git/blob - src/lyxlayout.h
the toc fix plus layout stuff
[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 "support/std_string.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         /// show this in toc
144         int toclevel;
145         /// for new environment insets
146         string latexheader;
147         /// for new environment insets
148         string latexfooter;
149         /// for new environment insets
150         string latexparagraph;
151
152         /** true when the fragile commands in the paragraph need to be
153             \protect'ed. */
154         bool needprotect;
155         /// true when empty paragraphs should be kept.
156         bool keepempty;
157         ///
158         bool isParagraph() const {
159                 return latextype == LATEX_PARAGRAPH;
160         }
161         ///
162         bool isCommand() const {
163                 return latextype == LATEX_COMMAND;
164         }
165         ///
166         bool isEnvironment() const {
167                 return (latextype == LATEX_ENVIRONMENT
168                         || latextype == LATEX_BIB_ENVIRONMENT
169                         || latextype == LATEX_ITEM_ENVIRONMENT
170                         || latextype == LATEX_LIST_ENVIRONMENT);
171         }
172         /// Type of LaTeX object
173         LYX_LATEX_TYPES latextype;
174         /// Does this object belong in the title part of the document?
175         bool intitle;
176         /// Does this layout allow for an optional parameter?
177         int optionalargs;
178         /// Which counter to step
179         string counter;
180
181 private:
182         /// Name of the layout/paragraph environment
183         string name_;
184
185         /** Name of an layout that has replaced this layout.
186             This is used to rename a layout, while keeping backward
187             compatibility
188         */
189         string obsoleted_by_;
190
191         /** Name of an layout which preamble must come before this one
192             This is used when the preamble snippet uses macros defined in
193             another preamble
194          */
195         string depends_on_;
196
197         /// LaTeX name for environment
198         string latexname_;
199         /// Label string. "Abstract", "Reference", "Caption"...
200         string labelstring_;
201         ///
202         string endlabelstring_;
203         /// Label string inside appendix. "Appendix", ...
204         string labelstring_appendix_;
205         /// LaTeX parameter for environment
206         string latexparam_;
207         /// Macro definitions needed for this layout
208         string preamble_;
209 };
210
211 #endif