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