]> git.lyx.org Git - lyx.git/blob - src/lyxlayout.h
code cosmetics to the iterator fix
[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
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 & labeltag() const { return labeltag_; }
69         ///
70         std::string const & itemtag() const { return itemtag_; }
71         ///
72         std::string const & labelstring_appendix() const {
73                 return labelstring_appendix_;
74         }
75         /** Default font for this layout/environment.
76             The main font for this kind of environment. If an attribute has
77             LyXFont::INHERITED_*, it means that the value is specified by
78             the defaultfont for the entire layout. If we are nested, the
79             font is inherited from the font in the environment one level
80             up until the font is resolved. The values LyXFont::IGNORE_*
81             and LyXFont::TOGGLE are illegal here.
82         */
83         LyXFont font;
84
85         /** Default font for labels.
86             Interpretation the same as for font above
87         */
88         LyXFont labelfont;
89
90         /** Resolved version of the font for this layout/environment.
91             This is a resolved version the default font. The font is resolved
92             against the defaultfont of the entire layout.
93         */
94         LyXFont resfont;
95
96         /** Resolved version of the font used for labels.
97             This is a resolved version the label font. The font is resolved
98             against the defaultfont of the entire layout.
99         */
100         LyXFont reslabelfont;
101
102         /// Text that dictates how wide the left margin is on the screen
103         std::string leftmargin;
104         /// Text that dictates how wide the right margin is on the screen
105         std::string rightmargin;
106         /// Text that dictates how much space to leave after a potential label
107         std::string labelsep;
108         /// Text that dictates how much space to leave before a potential label
109         std::string labelindent;
110         /// Text that dictates the width of the indentation of indented pars
111         std::string parindent;
112         ///
113         double parskip;
114         ///
115         double itemsep;
116         ///
117         double topsep;
118         ///
119         double bottomsep;
120         ///
121         double labelbottomsep;
122         ///
123         double parsep;
124         ///
125         Spacing spacing;
126         ///
127         LyXAlignment align;
128         ///
129         LyXAlignment alignpossible;
130         ///
131         LYX_LABEL_TYPES labeltype;
132         ///
133         LYX_END_LABEL_TYPES endlabeltype;
134         ///
135         LYX_MARGIN_TYPE margintype;
136         ///
137         bool fill_top;
138         ///
139         bool fill_bottom;
140         ///
141         bool newline_allowed;
142         ///
143         bool nextnoindent;
144         ///
145         bool free_spacing;
146         ///
147         bool pass_thru;
148         ///
149         bool is_environment;
150         /// show this in toc
151         int toclevel;
152         /// special value of toclevel for non-section layouts
153         static const int NOT_IN_TOC;
154         /// for new environment insets
155         std::string latexheader;
156         /// for new environment insets
157         std::string latexfooter;
158         /// for new environment insets
159         std::string latexparagraph;
160
161         /** true when the fragile commands in the paragraph need to be
162             \protect'ed. */
163         bool needprotect;
164         /// true when empty paragraphs should be kept.
165         bool keepempty;
166         ///
167         bool isParagraph() const {
168                 return latextype == LATEX_PARAGRAPH;
169         }
170         ///
171         bool isCommand() const {
172                 return latextype == LATEX_COMMAND;
173         }
174         ///
175         bool isEnvironment() const {
176                 return (latextype == LATEX_ENVIRONMENT
177                         || latextype == LATEX_BIB_ENVIRONMENT
178                         || latextype == LATEX_ITEM_ENVIRONMENT
179                         || latextype == LATEX_LIST_ENVIRONMENT);
180         }
181         /// Type of LaTeX object
182         LYX_LATEX_TYPES latextype;
183         /// Does this object belong in the title part of the document?
184         bool intitle;
185         /// Does this layout allow for an optional parameter?
186         int optionalargs;
187         /// Which counter to step
188         std::string counter;
189         /// Depth of XML command
190         int commanddepth;
191
192 private:
193         /// Name of the layout/paragraph environment
194         std::string name_;
195
196         /** Name of an layout that has replaced this layout.
197             This is used to rename a layout, while keeping backward
198             compatibility
199         */
200         std::string obsoleted_by_;
201
202         /** Name of an layout which preamble must come before this one
203             This is used when the preamble snippet uses macros defined in
204             another preamble
205          */
206         std::string depends_on_;
207
208         /// LaTeX name for environment
209         std::string latexname_;
210         /// Label string. "Abstract", "Reference", "Caption"...
211         std::string labelstring_;
212         ///
213         std::string endlabelstring_;
214         /// Label string inside appendix. "Appendix", ...
215         std::string labelstring_appendix_;
216         /// LaTeX parameter for environment
217         std::string latexparam_;
218         /// Internal tag to use (e.g., <title></title> for sect header)
219         std::string innertag_;
220         /// Internal tag to use e.g. to surround varlistentry label)
221         std::string labeltag_;
222         /// Internal tag to surround the item text in a list)
223         std::string itemtag_;
224         /// Macro definitions needed for this layout
225         std::string preamble_;
226 };
227
228 #endif