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