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 latexargs() const { return latexargs_; }
91 unsigned int optArgs() const;
93 unsigned int requiredArgs() const;
95 docstring preamble() const { return preamble_; }
96 /// Get language dependent macro definitions needed for this inset
97 docstring const langpreamble() const { return langpreamble_; }
98 /// Get language and babel dependent macro definitions needed for
100 docstring const babelpreamble() const { return babelpreamble_; }
102 docstring counter() const { return counter_; }
104 docstring refprefix() const { return refprefix_; }
105 /// The tag enclosing all the material in this inset. Default is "span".
106 std::string const & htmltag() const;
107 /// Additional attributes for inclusion with the start tag. Default (if
108 /// a tag is provided) is: class="name".
109 std::string const & htmlattr() const;
110 /// Tag for individual paragraphs in the inset. Default is none.
111 std::string const & htmlinnertag() const { return htmlinnertag_; }
112 /// Attributes for that tag. Default (if a tag is provided) is:
113 /// class="name_inner".
114 std::string const & htmlinnerattr() const;
115 /// A label for this environment, possibly including a reference
116 /// to a counter. E.g., for footnote, it might be:
117 /// \arabic{footnote}
119 /// FIXME Could we get this from the layout?
120 std::string const & htmllabel() const { return htmllabel_; }
122 inline std::string htmllabeltag() const { return "span"; }
124 std::string htmllabelattr() const
125 { return "class=\"" + defaultCSSClass() + "_label\""; }
126 /// CSS associated with this inset.
127 docstring htmlstyle() const;
128 /// Additional material for the header.
129 docstring htmlpreamble() const { return htmlpreamble_; }
130 /// Whether this inset represents a "block" of material, i.e., a set
131 /// of paragraphs of its own (true), or should be run into the previous
132 /// paragraph (false). Examples:
133 /// For branches, this is false.
134 /// For footnotes, this is true.
135 /// Defaults to true.
136 bool htmlisblock() const { return htmlisblock_; }
138 std::set<std::string> requires() const { return requires_; }
140 bool isMultiPar() const { return multipar_; }
142 bool forcePlainLayout() const { return forceplain_; }
144 bool allowParagraphCustomization() const { return custompars_; }
146 bool isPassThru() const { return passthru_; }
148 bool parbreakIsNewline() const { return parbreakisnewline_; }
150 bool isNeedProtect() const { return needprotect_; }
152 bool isFreeSpacing() const { return freespacing_; }
154 bool isKeepEmpty() const { return keepempty_; }
156 bool forceLTR() const { return forceltr_; }
158 bool isInToc() const { return intoc_; }
160 bool spellcheck() const { return spellcheck_; }
162 bool resetsFont() const { return resetsfont_; }
164 bool isDisplay() const { return display_; }
166 bool forcelocalfontswitch() const { return forcelocalfontswitch_; }
169 void makeDefaultCSS() const;
171 std::string defaultCSSClass() const;
173 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
175 void readArgument(Lexer &);
179 * This is only used (at present) to decide where to put them on the menus.
180 * Values are 'charstyle', 'custom' (things that by default look like a
181 * footnote), 'element' (docbook), 'standard'.
183 InsetLyXType lyxtype_;
185 docstring labelstring_;
187 bool contentaslabel_;
189 InsetDecoration decoration_;
191 InsetLaTeXType latextype_;
193 std::string latexname_;
195 std::string latexparam_;
197 docstring leftdelim_;
199 docstring rightdelim_;
210 /// Language dependent macro definitions needed for this inset
211 docstring langpreamble_;
212 /// Language and babel dependent macro definitions needed for this inset
213 docstring babelpreamble_;
215 docstring refprefix_;
217 mutable std::string htmltag_;
219 mutable std::string htmlattr_;
221 std::string htmlinnertag_;
223 mutable std::string htmlinnerattr_;
225 std::string htmllabel_;
227 docstring htmlstyle_;
228 /// Cache for default CSS info for this inset.
229 mutable docstring htmldefaultstyle_;
230 /// Cache for default CSS class.
231 mutable std::string defaultcssclass_;
232 /// Whether to force generation of default CSS even if some is given.
233 /// False by default.
236 docstring htmlpreamble_;
240 std::set<std::string> requires_;
250 bool parbreakisnewline_;
259 /// should the contents be written to TOC strings?
261 /// check spelling of this inset?
268 bool forcelocalfontswitch_;
270 Layout::LaTeXArgMap latexargs_;
274 InsetLayout::InsetLyXType translateLyXType(std::string const & str);