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 FontInfo font() const { return font_; }
81 FontInfo labelfont() const { return labelfont_; }
83 ColorCode bgcolor() const { return bgcolor_; }
85 Layout::LaTeXArgMap latexargs() const { return latexargs_; }
87 unsigned int numOptArgs() const;
89 unsigned int numRequiredArgs() const;
91 docstring preamble() const { return preamble_; }
92 /// Get language dependent macro definitions needed for this inset
93 docstring const langpreamble() const { return langpreamble_; }
94 /// Get language and babel dependent macro definitions needed for
96 docstring const babelpreamble() const { return babelpreamble_; }
98 docstring counter() const { return counter_; }
100 docstring refprefix() const { return refprefix_; }
101 /// The tag enclosing all the material in this inset. Default is "span".
102 std::string const & htmltag() const;
103 /// Additional attributes for inclusion with the start tag. Default (if
104 /// a tag is provided) is: class="name".
105 std::string const & htmlattr() const;
106 /// Tag for individual paragraphs in the inset. Default is none.
107 std::string const & htmlinnertag() const { return htmlinnertag_; }
108 /// Attributes for that tag. Default (if a tag is provided) is:
109 /// class="name_inner".
110 std::string const & htmlinnerattr() const;
111 /// A label for this environment, possibly including a reference
112 /// to a counter. E.g., for footnote, it might be:
113 /// \arabic{footnote}
115 /// FIXME Could we get this from the layout?
116 std::string const & htmllabel() const { return htmllabel_; }
118 inline std::string htmllabeltag() const { return "span"; }
120 std::string htmllabelattr() const
121 { return "class=\"" + defaultCSSClass() + "_label\""; }
122 /// CSS associated with this inset.
123 docstring htmlstyle() const;
124 /// Additional material for the header.
125 docstring htmlpreamble() const { return htmlpreamble_; }
126 /// Whether this inset represents a "block" of material, i.e., a set
127 /// of paragraphs of its own (true), or should be run into the previous
128 /// paragraph (false). Examples:
129 /// For branches, this is false.
130 /// For footnotes, this is true.
131 /// Defaults to true.
132 bool htmlisblock() const { return htmlisblock_; }
134 std::set<std::string> requires() const { return requires_; }
136 bool isMultiPar() const { return multipar_; }
138 bool forcePlainLayout() const { return forceplain_; }
140 bool allowParagraphCustomization() const { return custompars_; }
142 bool isPassThru() const { return passthru_; }
144 bool parbreakIsNewline() const { return parbreakisnewline_; }
146 bool isNeedProtect() const { return needprotect_; }
148 bool isFreeSpacing() const { return freespacing_; }
150 bool isKeepEmpty() const { return keepempty_; }
152 bool forceLTR() const { return forceltr_; }
154 bool isInToc() const { return intoc_; }
156 bool spellcheck() const { return spellcheck_; }
158 bool resetsFont() const { return resetsfont_; }
160 bool isDisplay() const { return display_; }
163 void makeDefaultCSS() const;
165 std::string defaultCSSClass() const;
167 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
169 void readArgument(Lexer &);
173 * This is only used (at present) to decide where to put them on the menus.
174 * Values are 'charstyle', 'custom' (things that by default look like a
175 * footnote), 'element' (docbook), 'standard'.
177 InsetLyXType lyxtype_;
179 docstring labelstring_;
181 bool contentaslabel_;
183 InsetDecoration decoration_;
185 InsetLaTeXType latextype_;
187 std::string latexname_;
189 std::string latexparam_;
200 /// Language dependent macro definitions needed for this inset
201 docstring langpreamble_;
202 /// Language and babel dependent macro definitions needed for this inset
203 docstring babelpreamble_;
205 docstring refprefix_;
207 mutable std::string htmltag_;
209 mutable std::string htmlattr_;
211 std::string htmlinnertag_;
213 mutable std::string htmlinnerattr_;
215 std::string htmllabel_;
217 docstring htmlstyle_;
218 /// Cache for default CSS info for this inset.
219 mutable docstring htmldefaultstyle_;
220 /// Cache for default CSS class.
221 mutable std::string defaultcssclass_;
222 /// Whether to force generation of default CSS even if some is given.
223 /// False by default.
226 docstring htmlpreamble_;
230 std::set<std::string> requires_;
240 bool parbreakisnewline_;
249 /// should the contents be written to TOC strings?
251 /// check spelling of this inset?
258 Layout::LaTeXArgMap latexargs_;
262 InsetLayout::InsetLyXType translateLyXType(std::string const & str);