]> git.lyx.org Git - lyx.git/blob - src/insets/InsetLayout.h
Try to deal with one of the big problems here, namely, that we
[lyx.git] / src / insets / InsetLayout.h
1 // -*- C++ -*-
2 /**
3  * \file InsetLayout.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Martin Vermeer
8  * \author Richard Heck
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef INSET_LAYOUT_H
14 #define INSET_LAYOUT_H
15
16 #include "ColorCode.h"
17 #include "FontInfo.h"
18
19 #include "support/docstring.h"
20
21 #include <set>
22 #include <string>
23
24 namespace lyx {
25
26 class Lexer;
27 class TextClass;
28
29 ///
30 class InsetLayout {
31 public:
32         ///
33         InsetLayout();
34         ///
35         enum InsetDecoration {
36                 CLASSIC,
37                 MINIMALISTIC,
38                 CONGLOMERATE,
39                 DEFAULT
40         };
41         ///
42         enum InsetLyXType {
43                 NOLYXTYPE,
44                 CHARSTYLE,
45                 CUSTOM,
46                 ELEMENT,
47                 END,
48                 STANDARD
49         };
50         ///
51         enum InsetLaTeXType {
52                 NOLATEXTYPE,
53                 COMMAND,
54                 ENVIRONMENT,
55                 ILT_ERROR
56         };
57         ///
58         bool read(Lexer & lexrc, TextClass const & tclass);
59         ///
60         docstring name() const { return name_; }
61         ///
62         void setName(docstring const & n) { name_ = n; }
63         ///
64         InsetLyXType lyxtype() const { return lyxtype_; }
65         ///
66         docstring labelstring() const { return labelstring_; }
67         ///
68         InsetDecoration decoration() const { return decoration_; }
69         ///
70         InsetLaTeXType latextype() const { return latextype_; }
71         ///
72         std::string latexname() const { return latexname_; }
73         ///
74         std::string latexparam() const { return latexparam_; }
75         ///
76         FontInfo font() const { return font_; }
77         ///
78         FontInfo labelfont() const { return labelfont_; }
79         ///
80         ColorCode bgcolor() const { return bgcolor_; }
81         ///
82         docstring preamble() const { return preamble_; }
83         ///
84         docstring counter() const { return counter_; }
85         /// 
86         std::string const & htmlinnertag() const { return htmlinnertag_; }
87         /// 
88         std::string const & htmlinnerattr() const { return htmlinnerattr_; }
89         ///
90         std::string const & htmltag() const { return htmltag_; }
91         /// 
92         std::string const & htmlattr() const { return htmlattr_; }
93         ///
94         std::string const & htmllabel() const { return htmllabel_; }
95         /// 
96         docstring htmlstyle() const { return htmlstyle_; }
97         /// 
98         docstring htmlpreamble() const { return htmlpreamble_; }
99         ///
100         bool htmlisblock() const { return htmlisblock_; }
101         ///
102         std::set<std::string> requires() const { return requires_; };
103         ///
104         bool isMultiPar() const { return multipar_; };
105         ///
106         bool forcePlainLayout() const { return forceplain_; }
107         ///
108         bool allowParagraphCustomization() const { return custompars_; }
109         ///
110         bool isPassThru() const { return passthru_; };
111         ///
112         bool isNeedProtect() const { return needprotect_; };
113         ///
114         bool isFreeSpacing() const { return freespacing_; };
115         ///
116         bool isKeepEmpty() const { return keepempty_; };
117         ///
118         bool forceLTR() const { return forceltr_; };
119         ///
120         bool isInToc() const { return intoc_; };
121 private:
122         ///
123         docstring name_;
124         /**
125                 * This is only used (at present) to decide where to put them on the menus.
126                 * Values are 'charstyle', 'custom' (things that by default look like a
127                 * footnote), 'element' (docbook), 'standard'.
128                 */
129         InsetLyXType lyxtype_;
130         ///
131         docstring labelstring_;
132         ///
133         InsetDecoration decoration_;
134         ///
135         InsetLaTeXType latextype_;
136         ///
137         std::string latexname_;
138         ///
139         std::string latexparam_;
140         ///
141         FontInfo font_;
142         ///
143         FontInfo labelfont_;
144         ///
145         ColorCode bgcolor_;
146         ///
147         docstring counter_;
148         ///
149         docstring preamble_;
150         /// The tag enclosing all the material in this inset.
151         std::string htmltag_;
152         /// Additional attributes for inclusion with the start tag.
153         std::string htmlattr_;
154         /// Tag for individual paragraphs in the inset.
155         std::string htmlinnertag_;
156         /// Attributes for that tag.
157         std::string htmlinnerattr_;
158         /// A label for this environment, possibly including a reference
159         /// to a counter. E.g., for footnote, it might be:
160         ///    <span class='notenum'>\arabic{footnote}</span>
161         std::string htmllabel_;
162         /// CSS associated with this inset.
163         docstring htmlstyle_;
164         /// Additional material for the header.
165         docstring htmlpreamble_;
166         /// Whether this inset represents a "block" of material, i.e., a set
167         /// of paragraphs of its own (true), or should be run into the previous
168         /// paragraph (false). Examples:
169         ///   For branches, this is false.
170         ///   For footnotes, this is true.
171         /// Defaults to true.
172         bool htmlisblock_;
173         ///
174         std::set<std::string> requires_;
175         ///
176         bool multipar_;
177         /// 
178         bool custompars_;
179         ///
180         bool forceplain_;
181         ///
182         bool passthru_;
183         ///
184         bool needprotect_;
185         ///
186         bool freespacing_;
187         ///
188         bool keepempty_;
189         ///
190         bool forceltr_;
191         /// should the contents be written to TOC strings?
192         bool intoc_;
193 };
194
195 ///
196 InsetLayout::InsetLyXType translateLyXType(std::string const & str);
197
198 } // namespace lyx
199
200 #endif