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