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"
20 #include "support/debug.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 InsetDecoration decoration() const { return decoration_; }
71 InsetLaTeXType latextype() const { return latextype_; }
73 std::string latexname() const { return latexname_; }
75 std::string latexparam() const { return latexparam_; }
77 FontInfo font() const { return font_; }
79 FontInfo labelfont() const { return labelfont_; }
81 ColorCode bgcolor() const { return bgcolor_; }
83 docstring preamble() const { return preamble_; }
85 docstring counter() const { return counter_; }
87 std::string const & htmltag() const;
89 std::string const & htmlattr() const;
91 std::string const & htmlinnertag() const { return htmlinnertag_; }
93 std::string const & htmlinnerattr() const;
95 std::string const & htmllabel() const { return htmllabel_; }
97 inline std::string htmllabeltag() const { return "span"; }
99 std::string htmllabelattr() const
100 { return "class=\"" + defaultCSSClass() + "_label\""; }
102 docstring htmlstyle() const;
104 docstring htmlpreamble() const { return htmlpreamble_; }
106 bool htmlisblock() const { return htmlisblock_; }
108 std::set<std::string> requires() const { return requires_; }
110 bool isMultiPar() const { return multipar_; }
112 bool forcePlainLayout() const { return forceplain_; }
114 bool allowParagraphCustomization() const { return custompars_; }
116 bool isPassThru() const { return passthru_; }
118 bool isNeedProtect() const { return needprotect_; }
120 bool isFreeSpacing() const { return freespacing_; }
122 bool isKeepEmpty() const { return keepempty_; }
124 bool forceLTR() const { return forceltr_; }
126 bool isInToc() const { return intoc_; }
130 void makeDefaultCSS() const;
132 std::string defaultCSSClass() const;
134 std::string defaultCSSLabelClass() const { return defaultCSSClass() + "_label"; }
138 * This is only used (at present) to decide where to put them on the menus.
139 * Values are 'charstyle', 'custom' (things that by default look like a
140 * footnote), 'element' (docbook), 'standard'.
142 InsetLyXType lyxtype_;
144 docstring labelstring_;
146 InsetDecoration decoration_;
148 InsetLaTeXType latextype_;
150 std::string latexname_;
152 std::string latexparam_;
163 /// The tag enclosing all the material in this inset. Default is "span".
164 mutable std::string htmltag_;
165 /// Additional attributes for inclusion with the start tag. Default (if
166 /// a tag is provided) is: class="name".
167 mutable std::string htmlattr_;
168 /// Tag for individual paragraphs in the inset. Default is none.
169 std::string htmlinnertag_;
170 /// Attributes for that tag. Default (if a tag is provided) is:
171 /// class="name_inner".
172 mutable std::string htmlinnerattr_;
173 /// A label for this environment, possibly including a reference
174 /// to a counter. E.g., for footnote, it might be:
175 /// \arabic{footnote}
177 /// FIXME Could we get this from the layout?
178 std::string htmllabel_;
179 /// CSS associated with this inset.
180 docstring htmlstyle_;
181 /// Cache for default CSS info for this inset.
182 mutable docstring htmldefaultstyle_;
184 mutable std::string defaultcssclass_;
185 /// Whether to force generation of default CSS even if some is given.
186 /// False by default.
188 /// Additional material for the header.
189 docstring htmlpreamble_;
190 /// Whether this inset represents a "block" of material, i.e., a set
191 /// of paragraphs of its own (true), or should be run into the previous
192 /// paragraph (false). Examples:
193 /// For branches, this is false.
194 /// For footnotes, this is true.
195 /// Defaults to true.
198 std::set<std::string> requires_;
215 /// should the contents be written to TOC strings?
220 InsetLayout::InsetLyXType translateLyXType(std::string const & str);