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"
20 #include "support/docstring.h"
36 enum InsetDecoration {
59 bool read(Lexer & lexrc, TextClass const & tclass);
61 docstring name() const { return name_; }
63 void setName(docstring const & n) { name_ = n; }
65 InsetLyXType lyxtype() const { return lyxtype_; }
67 docstring labelstring() const { return labelstring_; }
69 bool contentaslabel() const { return contentaslabel_; }
71 InsetDecoration decoration() const { return decoration_; }
73 InsetLaTeXType latextype() const { return latextype_; }
75 std::string latexname() const { return latexname_; }
77 std::string latexparam() const { return latexparam_; }
79 docstring leftdelim() const { return leftdelim_; }
81 docstring rightdelim() const { return rightdelim_; }
83 FontInfo font() const { return font_; }
85 FontInfo labelfont() const { return labelfont_; }
87 ColorCode bgcolor() const { return bgcolor_; }
89 Layout::LaTeXArgMap args() const;
91 Layout::LaTeXArgMap latexargs() const { return latexargs_; }
93 Layout::LaTeXArgMap postcommandargs() const { return postcommandargs_; }
95 unsigned int optArgs() const;
97 unsigned int requiredArgs() const;
99 docstring preamble() const { return preamble_; }
100 /// Get language dependent macro definitions needed for this inset
101 docstring const langpreamble() const { return langpreamble_; }
102 /// Get language and babel dependent macro definitions needed for
104 docstring const babelpreamble() const { return babelpreamble_; }
106 docstring counter() const { return counter_; }
108 docstring refprefix() const { return refprefix_; }
109 /// The tag enclosing all the material in this inset. Default is "span".
110 std::string const & htmltag() const;
111 /// Additional attributes for inclusion with the start tag. Default (if
112 /// a tag is provided) is: class="name".
113 std::string const & htmlattr() const;
114 /// Tag for individual paragraphs in the inset. Default is none.
115 std::string const & htmlinnertag() const { return htmlinnertag_; }
116 /// Attributes for that tag. Default (if a tag is provided) is:
117 /// class="name_inner".
118 std::string const & htmlinnerattr() const;
119 /// A label for this environment, possibly including a reference
120 /// to a counter. E.g., for footnote, it might be:
121 /// \arabic{footnote}
123 /// FIXME Could we get this from the layout?
124 std::string const & htmllabel() const { return htmllabel_; }
126 inline std::string htmllabeltag() const { return "span"; }
128 std::string htmllabelattr() const
129 { return "class=\"" + defaultCSSClass() + "_label\""; }
130 /// CSS associated with this inset.
131 docstring htmlstyle() const;
132 /// Additional material for the header.
133 docstring htmlpreamble() const { return htmlpreamble_; }
134 /// Whether this inset represents a "block" of material, i.e., a set
135 /// of paragraphs of its own (true), or should be run into the previous
136 /// paragraph (false). Examples:
137 /// For branches, this is false.
138 /// For footnotes, this is true.
139 /// Defaults to true.
140 bool htmlisblock() const { return htmlisblock_; }
142 std::set<std::string> requires() const { return requires_; }
144 bool isMultiPar() const { return multipar_; }
146 bool forcePlainLayout() const { return forceplain_; }
148 bool allowParagraphCustomization() const { return custompars_; }
150 bool isPassThru() const { return passthru_; }
152 bool parbreakIsNewline() const { return parbreakisnewline_; }
154 bool isNeedProtect() const { return needprotect_; }
156 bool isFreeSpacing() const { return freespacing_; }
158 bool isKeepEmpty() const { return keepempty_; }
160 bool forceLTR() const { return forceltr_; }
162 bool isInToc() const { return intoc_; }
164 bool spellcheck() const { return spellcheck_; }
166 bool resetsFont() const { return resetsfont_; }
168 bool isDisplay() const { return display_; }
170 bool forcelocalfontswitch() const { return forcelocalfontswitch_; }
173 void makeDefaultCSS() const;
175 std::string defaultCSSClass() const;
177 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
179 void readArgument(Lexer &);
183 * This is only used (at present) to decide where to put them on the menus.
184 * Values are 'charstyle', 'custom' (things that by default look like a
185 * footnote), 'element' (docbook), 'standard'.
187 InsetLyXType lyxtype_;
189 docstring labelstring_;
191 bool contentaslabel_;
193 InsetDecoration decoration_;
195 InsetLaTeXType latextype_;
197 std::string latexname_;
199 std::string latexparam_;
201 docstring leftdelim_;
203 docstring rightdelim_;
214 /// Language dependent macro definitions needed for this inset
215 docstring langpreamble_;
216 /// Language and babel dependent macro definitions needed for this inset
217 docstring babelpreamble_;
219 docstring refprefix_;
221 mutable std::string htmltag_;
223 mutable std::string htmlattr_;
225 std::string htmlinnertag_;
227 mutable std::string htmlinnerattr_;
229 std::string htmllabel_;
231 docstring htmlstyle_;
232 /// Cache for default CSS info for this inset.
233 mutable docstring htmldefaultstyle_;
234 /// Cache for default CSS class.
235 mutable std::string defaultcssclass_;
236 /// Whether to force generation of default CSS even if some is given.
237 /// False by default.
240 docstring htmlpreamble_;
244 std::set<std::string> requires_;
254 bool parbreakisnewline_;
263 /// should the contents be written to TOC strings?
265 /// check spelling of this inset?
272 bool forcelocalfontswitch_;
274 Layout::LaTeXArgMap latexargs_;
276 Layout::LaTeXArgMap postcommandargs_;
280 InsetLayout::InsetLyXType translateLyXType(std::string const & str);
281 InsetLayout::InsetDecoration translateDecoration(std::string const & str);