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 const & latexargs() const { return latexargs_; }
91 Layout::LaTeXArgMap const & postcommandargs() const { return postcommandargs_; }
92 /// Returns latexargs() + postcommandargs().
93 /// But note that it returns a *copy*, not a reference, so do not do
95 /// Layout::LaTeXArgMap::iterator it = args().begin();
96 /// Layout::LaTeXArgMap::iterator en = args().end();
97 /// Those are iterators for different containers.
98 Layout::LaTeXArgMap args() const;
100 unsigned int optArgs() const;
102 unsigned int requiredArgs() const;
104 docstring preamble() const { return preamble_; }
105 /// Get language dependent macro definitions needed for this inset
106 docstring const langpreamble() const { return langpreamble_; }
107 /// Get language and babel dependent macro definitions needed for
109 docstring const babelpreamble() const { return babelpreamble_; }
111 docstring counter() const { return counter_; }
113 docstring refprefix() const { return refprefix_; }
114 /// The tag enclosing all the material in this inset. Default is "span".
115 std::string const & htmltag() const;
116 /// Additional attributes for inclusion with the start tag. Default (if
117 /// a tag is provided) is: class="name".
118 std::string const & htmlattr() const;
119 /// Tag for individual paragraphs in the inset. Default is none.
120 std::string const & htmlinnertag() const { return htmlinnertag_; }
121 /// Attributes for that tag. Default (if a tag is provided) is:
122 /// class="name_inner".
123 std::string const & htmlinnerattr() const;
124 /// A label for this environment, possibly including a reference
125 /// to a counter. E.g., for footnote, it might be:
126 /// \arabic{footnote}
128 /// FIXME Could we get this from the layout?
129 std::string const & htmllabel() const { return htmllabel_; }
131 inline std::string htmllabeltag() const { return "span"; }
133 std::string htmllabelattr() const
134 { return "class=\"" + defaultCSSClass() + "_label\""; }
135 /// CSS associated with this inset.
136 docstring htmlstyle() const;
137 /// Additional material for the header.
138 docstring htmlpreamble() const { return htmlpreamble_; }
139 /// Whether this inset represents a "block" of material, i.e., a set
140 /// of paragraphs of its own (true), or should be run into the previous
141 /// paragraph (false). Examples:
142 /// For branches, this is false.
143 /// For footnotes, this is true.
144 /// Defaults to true.
145 bool htmlisblock() const { return htmlisblock_; }
147 std::set<std::string> requires() const { return requires_; }
149 bool isMultiPar() const { return multipar_; }
151 bool forcePlainLayout() const { return forceplain_; }
153 bool allowParagraphCustomization() const { return custompars_; }
155 bool isPassThru() const { return passthru_; }
157 bool parbreakIsNewline() const { return parbreakisnewline_; }
159 bool isNeedProtect() const { return needprotect_; }
161 bool isFreeSpacing() const { return freespacing_; }
163 bool isKeepEmpty() const { return keepempty_; }
165 bool forceLTR() const { return forceltr_; }
167 bool isInToc() const { return intoc_; }
169 bool spellcheck() const { return spellcheck_; }
171 bool resetsFont() const { return resetsfont_; }
173 bool isDisplay() const { return display_; }
175 bool forcelocalfontswitch() const { return forcelocalfontswitch_; }
178 void makeDefaultCSS() const;
180 std::string defaultCSSClass() const;
182 void readArgument(Lexer &);
186 * This is only used (at present) to decide where to put them on the menus.
187 * Values are 'charstyle', 'custom' (things that by default look like a
188 * footnote), 'element' (docbook), 'standard'.
190 InsetLyXType lyxtype_;
192 docstring labelstring_;
194 bool contentaslabel_;
196 InsetDecoration decoration_;
198 InsetLaTeXType latextype_;
200 std::string latexname_;
202 std::string latexparam_;
204 docstring leftdelim_;
206 docstring rightdelim_;
217 /// Language dependent macro definitions needed for this inset
218 docstring langpreamble_;
219 /// Language and babel dependent macro definitions needed for this inset
220 docstring babelpreamble_;
222 docstring refprefix_;
224 mutable std::string htmltag_;
226 mutable std::string htmlattr_;
228 std::string htmlinnertag_;
230 mutable std::string htmlinnerattr_;
232 std::string htmllabel_;
234 docstring htmlstyle_;
235 /// Cache for default CSS info for this inset.
236 mutable docstring htmldefaultstyle_;
237 /// Cache for default CSS class.
238 mutable std::string defaultcssclass_;
239 /// Whether to force generation of default CSS even if some is given.
240 /// False by default.
243 docstring htmlpreamble_;
247 std::set<std::string> requires_;
257 bool parbreakisnewline_;
266 /// should the contents be written to TOC strings?
268 /// check spelling of this inset?
275 bool forcelocalfontswitch_;
277 Layout::LaTeXArgMap latexargs_;
279 Layout::LaTeXArgMap postcommandargs_;
283 InsetLayout::InsetLyXType translateLyXType(std::string const & str);
284 InsetLayout::InsetDecoration translateDecoration(std::string const & str);