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_; }
86 docstring counter() const { return counter_; }
88 docstring refprefix() const { return refprefix_; }
89 /// The tag enclosing all the material in this inset. Default is "span".
90 std::string const & htmltag() const;
91 /// Additional attributes for inclusion with the start tag. Default (if
92 /// a tag is provided) is: class="name".
93 std::string const & htmlattr() const;
94 /// Tag for individual paragraphs in the inset. Default is none.
95 std::string const & htmlinnertag() const { return htmlinnertag_; }
96 /// Attributes for that tag. Default (if a tag is provided) is:
97 /// class="name_inner".
98 std::string const & htmlinnerattr() const;
99 /// A label for this environment, possibly including a reference
100 /// to a counter. E.g., for footnote, it might be:
101 /// \arabic{footnote}
103 /// FIXME Could we get this from the layout?
104 std::string const & htmllabel() const { return htmllabel_; }
106 inline std::string htmllabeltag() const { return "span"; }
108 std::string htmllabelattr() const
109 { return "class=\"" + defaultCSSClass() + "_label\""; }
110 /// CSS associated with this inset.
111 docstring htmlstyle() const;
112 /// Additional material for the header.
113 docstring htmlpreamble() const { return htmlpreamble_; }
114 /// Whether this inset represents a "block" of material, i.e., a set
115 /// of paragraphs of its own (true), or should be run into the previous
116 /// paragraph (false). Examples:
117 /// For branches, this is false.
118 /// For footnotes, this is true.
119 /// Defaults to true.
120 bool htmlisblock() const { return htmlisblock_; }
122 std::set<std::string> requires() const { return requires_; }
124 bool isMultiPar() const { return multipar_; }
126 bool forcePlainLayout() const { return forceplain_; }
128 bool allowParagraphCustomization() const { return custompars_; }
130 bool isPassThru() const { return passthru_; }
132 bool isNeedProtect() const { return needprotect_; }
134 bool isFreeSpacing() const { return freespacing_; }
136 bool isKeepEmpty() const { return keepempty_; }
138 bool forceLTR() const { return forceltr_; }
140 bool isInToc() const { return intoc_; }
142 bool spellcheck() const { return spellcheck_; }
145 void makeDefaultCSS() const;
147 std::string defaultCSSClass() const;
149 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
153 * This is only used (at present) to decide where to put them on the menus.
154 * Values are 'charstyle', 'custom' (things that by default look like a
155 * footnote), 'element' (docbook), 'standard'.
157 InsetLyXType lyxtype_;
159 docstring labelstring_;
161 bool contentaslabel_;
163 InsetDecoration decoration_;
165 InsetLaTeXType latextype_;
167 std::string latexname_;
169 std::string latexparam_;
181 docstring refprefix_;
183 mutable std::string htmltag_;
185 mutable std::string htmlattr_;
187 std::string htmlinnertag_;
189 mutable std::string htmlinnerattr_;
191 std::string htmllabel_;
193 docstring htmlstyle_;
194 /// Cache for default CSS info for this inset.
195 mutable docstring htmldefaultstyle_;
196 /// Cache for default CSS class.
197 mutable std::string defaultcssclass_;
198 /// Whether to force generation of default CSS even if some is given.
199 /// False by default.
202 docstring htmlpreamble_;
206 std::set<std::string> requires_;
223 /// should the contents be written to TOC strings?
225 /// check spelling of this inset?
230 InsetLayout::InsetLyXType translateLyXType(std::string const & str);