4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Martin Vermeer
10 * Full author contact details are available in file CREDITS.
13 #ifndef INSET_LAYOUT_H
14 #define INSET_LAYOUT_H
16 #include "ColorCode.h"
19 #include "support/docstring.h"
20 #include "support/debug.h"
33 // just so these can be put in containers
34 // it should not really be used
37 InsetLayout(docstring const & name);
39 enum InsetDecoration {
62 bool read(Lexer & lexrc, TextClass const & tclass);
64 docstring name() const { return name_; }
66 InsetLyXType lyxtype() const { return lyxtype_; }
68 docstring labelstring() const { return labelstring_; }
70 bool contentaslabel() const { return contentaslabel_; }
72 InsetDecoration decoration() const { return decoration_; }
74 InsetLaTeXType latextype() const { return latextype_; }
76 std::string latexname() const { return latexname_; }
78 std::string latexparam() const { return latexparam_; }
80 FontInfo font() const { return font_; }
82 FontInfo labelfont() const { return labelfont_; }
84 ColorCode bgcolor() const { return bgcolor_; }
86 docstring preamble() const { return preamble_; }
88 docstring counter() const { return counter_; }
90 std::string const & htmltag() const;
92 std::string const & htmlattr() const;
94 std::string const & htmlinnertag() const { return htmlinnertag_; }
96 std::string const & htmlinnerattr() const;
98 std::string const & htmllabel() const { return htmllabel_; }
100 inline std::string htmllabeltag() const { return "span"; }
102 std::string htmllabelattr() const
103 { return "class=\"" + defaultCSSClass() + "_label\""; }
105 docstring htmlstyle() const;
107 docstring htmlpreamble() const { return htmlpreamble_; }
109 bool htmlisblock() const { return htmlisblock_; }
111 std::set<std::string> requires() const { return requires_; }
113 bool isMultiPar() const { return multipar_; }
115 bool forcePlainLayout() const { return forceplain_; }
117 bool allowParagraphCustomization() const { return custompars_; }
119 bool isPassThru() const { return passthru_; }
121 bool isNeedProtect() const { return needprotect_; }
123 bool isFreeSpacing() const { return freespacing_; }
125 bool isKeepEmpty() const { return keepempty_; }
127 bool forceLTR() const { return forceltr_; }
129 bool isInToc() const { return intoc_; }
133 void makeDefaultCSS() const;
135 std::string defaultCSSClass() const;
137 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
141 * This is only used (at present) to decide where to put them on the menus.
142 * Values are 'charstyle', 'custom' (things that by default look like a
143 * footnote), 'element' (docbook), 'standard'.
145 InsetLyXType lyxtype_;
147 docstring labelstring_;
149 bool contentaslabel_;
151 InsetDecoration decoration_;
153 InsetLaTeXType latextype_;
155 std::string latexname_;
157 std::string latexparam_;
168 /// The tag enclosing all the material in this inset. Default is "span".
169 mutable std::string htmltag_;
170 /// Additional attributes for inclusion with the start tag. Default (if
171 /// a tag is provided) is: class="name".
172 mutable std::string htmlattr_;
173 /// Tag for individual paragraphs in the inset. Default is none.
174 std::string htmlinnertag_;
175 /// Attributes for that tag. Default (if a tag is provided) is:
176 /// class="name_inner".
177 mutable std::string htmlinnerattr_;
178 /// A label for this environment, possibly including a reference
179 /// to a counter. E.g., for footnote, it might be:
180 /// \arabic{footnote}
182 /// FIXME Could we get this from the layout?
183 std::string htmllabel_;
184 /// CSS associated with this inset.
185 docstring htmlstyle_;
186 /// Cache for default CSS info for this inset.
187 mutable docstring htmldefaultstyle_;
189 mutable std::string defaultcssclass_;
190 /// Whether to force generation of default CSS even if some is given.
191 /// False by default.
193 /// Additional material for the header.
194 docstring htmlpreamble_;
195 /// Whether this inset represents a "block" of material, i.e., a set
196 /// of paragraphs of its own (true), or should be run into the previous
197 /// paragraph (false). Examples:
198 /// For branches, this is false.
199 /// For footnotes, this is true.
200 /// Defaults to true.
203 std::set<std::string> requires_;
220 /// should the contents be written to TOC strings?
225 InsetLayout::InsetLyXType translateLyXType(std::string const & str);