]> git.lyx.org Git - lyx.git/blob - src/insets/InsetLayout.h
tex2lyx/text.cpp: fix typos
[lyx.git] / src / insets / InsetLayout.h
1 // -*- C++ -*-
2 /**
3  * \file InsetLayout.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Martin Vermeer
8  * \author Richard Heck
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSET_LAYOUT_H
14 #define INSET_LAYOUT_H
15
16 #include "ColorCode.h"
17 #include "FontInfo.h"
18
19 #include "support/docstring.h"
20
21 #include <set>
22 #include <string>
23
24 namespace lyx {
25
26 class Lexer;
27 class TextClass;
28
29 ///
30 class InsetLayout {
31 public:
32         ///
33         InsetLayout();
34         ///
35         enum InsetDecoration {
36                 CLASSIC,
37                 MINIMALISTIC,
38                 CONGLOMERATE,
39                 DEFAULT
40         };
41         ///
42         enum InsetLyXType {
43                 NOLYXTYPE,
44                 CHARSTYLE,
45                 CUSTOM,
46                 ELEMENT,
47                 END,
48                 STANDARD
49         };
50         ///
51         enum InsetLaTeXType {
52                 NOLATEXTYPE,
53                 COMMAND,
54                 ENVIRONMENT,
55                 ILT_ERROR
56         };
57         ///
58         bool read(Lexer & lexrc, TextClass const & tclass);
59         ///
60         docstring name() const { return name_; }
61         ///
62         void setName(docstring const & n) { name_ = n; }
63         ///
64         InsetLyXType lyxtype() const { return lyxtype_; }
65         ///
66         docstring labelstring() const { return labelstring_; }
67         ///
68         bool contentaslabel() const { return contentaslabel_; }
69         ///
70         InsetDecoration decoration() const { return decoration_; }
71         ///
72         InsetLaTeXType latextype() const { return latextype_; }
73         ///
74         std::string latexname() const { return latexname_; }
75         ///
76         std::string latexparam() const { return latexparam_; }
77         ///
78         FontInfo font() const { return font_; }
79         ///
80         FontInfo labelfont() const { return labelfont_; }
81         ///
82         ColorCode bgcolor() const { return bgcolor_; }
83         ///
84         docstring preamble() const { return preamble_; }
85         /// Get language dependent macro definitions needed for this inset
86         docstring const langpreamble() const { return langpreamble_; }
87         /// Get language and babel dependent macro definitions needed for
88         /// this inset
89         docstring const babelpreamble() const { return babelpreamble_; }
90         ///
91         docstring counter() const { return counter_; }
92         ///
93         docstring refprefix() const { return refprefix_; }
94         /// The tag enclosing all the material in this inset. Default is "span".
95         std::string const & htmltag() const;
96         /// Additional attributes for inclusion with the start tag. Default (if
97         /// a tag is provided) is: class="name".
98         std::string const & htmlattr() const;
99         /// Tag for individual paragraphs in the inset. Default is none.
100         std::string const & htmlinnertag() const { return htmlinnertag_; }
101         /// Attributes for that tag. Default (if a tag is provided) is: 
102         /// class="name_inner".
103         std::string const & htmlinnerattr() const;
104         /// A label for this environment, possibly including a reference
105         /// to a counter. E.g., for footnote, it might be:
106         ///    \arabic{footnote}
107         /// No default.
108         /// FIXME Could we get this from the layout?
109         std::string const & htmllabel() const { return htmllabel_; }
110         ///
111         inline std::string htmllabeltag() const { return "span"; }
112         ///
113         std::string htmllabelattr() const 
114                 { return "class=\"" + defaultCSSClass() + "_label\""; }
115         /// CSS associated with this inset.
116         docstring htmlstyle() const;
117         /// Additional material for the header.
118         docstring htmlpreamble() const { return htmlpreamble_; }
119         /// Whether this inset represents a "block" of material, i.e., a set
120         /// of paragraphs of its own (true), or should be run into the previous
121         /// paragraph (false). Examples:
122         ///   For branches, this is false.
123         ///   For footnotes, this is true.
124         /// Defaults to true.
125         bool htmlisblock() const { return htmlisblock_; }
126         ///
127         std::set<std::string> requires() const { return requires_; }
128         ///
129         bool isMultiPar() const { return multipar_; }
130         ///
131         bool forcePlainLayout() const { return forceplain_; }
132         ///
133         bool allowParagraphCustomization() const { return custompars_; }
134         ///
135         bool isPassThru() const { return passthru_; }
136         ///
137         bool parbreakIsNewline() const { return parbreakisnewline_; }
138         ///
139         bool isNeedProtect() const { return needprotect_; }
140         ///
141         bool isFreeSpacing() const { return freespacing_; }
142         ///
143         bool isKeepEmpty() const { return keepempty_; }
144         ///
145         bool forceLTR() const { return forceltr_; }
146         ///
147         bool isInToc() const { return intoc_; }
148         ///
149         bool spellcheck() const { return spellcheck_; }
150         ///
151         bool resetsFont() const { return resetsfont_; }
152         ///
153         bool isDisplay() const { return display_; }
154 private:
155         ///
156         void makeDefaultCSS() const;
157         ///
158         std::string defaultCSSClass() const;
159         ///
160         std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
161         ///
162         docstring name_;
163         /**
164                 * This is only used (at present) to decide where to put them on the menus.
165                 * Values are 'charstyle', 'custom' (things that by default look like a
166                 * footnote), 'element' (docbook), 'standard'.
167                 */
168         InsetLyXType lyxtype_;
169         ///
170         docstring labelstring_;
171         ///
172         bool contentaslabel_;
173         ///
174         InsetDecoration decoration_;
175         ///
176         InsetLaTeXType latextype_;
177         ///
178         std::string latexname_;
179         ///
180         std::string latexparam_;
181         ///
182         FontInfo font_;
183         ///
184         FontInfo labelfont_;
185         ///
186         ColorCode bgcolor_;
187         ///
188         docstring counter_;
189         ///
190         docstring preamble_;
191         /// Language dependent macro definitions needed for this inset
192         docstring langpreamble_;
193         /// Language and babel dependent macro definitions needed for this inset
194         docstring babelpreamble_;
195         ///
196         docstring refprefix_;
197         ///
198         mutable std::string htmltag_;
199         ///
200         mutable std::string htmlattr_;
201         ///
202         std::string htmlinnertag_;
203         ///
204         mutable std::string htmlinnerattr_;
205         ///
206         std::string htmllabel_;
207         ///
208         docstring htmlstyle_;
209         /// Cache for default CSS info for this inset.
210         mutable docstring htmldefaultstyle_;
211         /// Cache for default CSS class.
212         mutable std::string defaultcssclass_;
213         /// Whether to force generation of default CSS even if some is given.
214         /// False by default.
215         bool htmlforcecss_;
216         ///
217         docstring htmlpreamble_;
218         ///
219         bool htmlisblock_;
220         ///
221         std::set<std::string> requires_;
222         ///
223         bool multipar_;
224         /// 
225         bool custompars_;
226         ///
227         bool forceplain_;
228         ///
229         bool passthru_;
230         ///
231         bool parbreakisnewline_;
232         ///
233         bool freespacing_;
234         ///
235         bool keepempty_;
236         ///
237         bool forceltr_;
238         ///
239         bool needprotect_;
240         /// should the contents be written to TOC strings?
241         bool intoc_;
242         /// check spelling of this inset?
243         bool spellcheck_;
244         ///
245         bool resetsfont_;
246         ///
247         bool display_;
248 };
249
250 ///
251 InsetLayout::InsetLyXType translateLyXType(std::string const & str);
252
253 } // namespace lyx
254
255 #endif