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