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"
35 enum InsetDecoration {
58 bool read(Lexer & lexrc, TextClass const & tclass);
60 docstring name() const { return name_; }
62 void setName(docstring const & n) { name_ = n; }
64 InsetLyXType lyxtype() const { return lyxtype_; }
66 docstring labelstring() const { return labelstring_; }
68 bool contentaslabel() const { return contentaslabel_; }
70 InsetDecoration decoration() const { return decoration_; }
72 InsetLaTeXType latextype() const { return latextype_; }
74 std::string latexname() const { return latexname_; }
76 std::string latexparam() const { return latexparam_; }
78 FontInfo font() const { return font_; }
80 FontInfo labelfont() const { return labelfont_; }
82 ColorCode bgcolor() const { return bgcolor_; }
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
89 docstring const babelpreamble() const { return babelpreamble_; }
91 docstring counter() const { return counter_; }
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}
108 /// FIXME Could we get this from the layout?
109 std::string const & htmllabel() const { return htmllabel_; }
111 inline std::string htmllabeltag() const { return "span"; }
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_; }
127 std::set<std::string> requires() const { return requires_; }
129 bool isMultiPar() const { return multipar_; }
131 bool forcePlainLayout() const { return forceplain_; }
133 bool allowParagraphCustomization() const { return custompars_; }
135 bool isPassThru() const { return passthru_; }
137 bool parbreakIsNewline() const { return parbreakisnewline_; }
139 bool isNeedProtect() const { return needprotect_; }
141 bool isFreeSpacing() const { return freespacing_; }
143 bool isKeepEmpty() const { return keepempty_; }
145 bool forceLTR() const { return forceltr_; }
147 bool isInToc() const { return intoc_; }
149 bool spellcheck() const { return spellcheck_; }
151 bool resetsFont() const { return resetsfont_; }
153 bool isDisplay() const { return display_; }
156 void makeDefaultCSS() const;
158 std::string defaultCSSClass() const;
160 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
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'.
168 InsetLyXType lyxtype_;
170 docstring labelstring_;
172 bool contentaslabel_;
174 InsetDecoration decoration_;
176 InsetLaTeXType latextype_;
178 std::string latexname_;
180 std::string latexparam_;
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_;
196 docstring refprefix_;
198 mutable std::string htmltag_;
200 mutable std::string htmlattr_;
202 std::string htmlinnertag_;
204 mutable std::string htmlinnerattr_;
206 std::string htmllabel_;
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.
217 docstring htmlpreamble_;
221 std::set<std::string> requires_;
231 bool parbreakisnewline_;
240 /// should the contents be written to TOC strings?
242 /// check spelling of this inset?
251 InsetLayout::InsetLyXType translateLyXType(std::string const & str);