]> git.lyx.org Git - lyx.git/blob - src/OutputParams.h
HTML for math fonts.
[lyx.git] / src / OutputParams.h
1 // -*- C++ -*-
2 /**
3  * \file OutputParams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  *  \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef OUTPUTPARAMS_H
13 #define OUTPUTPARAMS_H
14
15 #include <string>
16
17 #include "support/types.h"
18 #include <boost/shared_ptr.hpp>
19 #include "Changes.h"
20
21
22 namespace lyx {
23
24
25 class Encoding;
26 class ExportData;
27 class Font;
28 class Language;
29
30 class OutputParams {
31 public:
32         enum FLAVOR {
33                 LATEX,
34                 PDFLATEX,
35                 XETEX,
36                 XML,
37                 HTML,
38                 TEXT
39         };
40         
41         enum MathFlavor {
42                 NotApplicable,
43                 MathAsMathML,
44                 MathAsHTML,
45                 MathAsImages,
46                 MathAsLaTeX
47         };
48
49         enum TableCell {
50                 NO,
51                 PLAIN,
52                 ALIGNED
53         };
54
55         enum Float {
56                 NONFLOAT,
57                 MAINFLOAT,
58                 SUBFLOAT
59         };
60
61         OutputParams(Encoding const *);
62         ~OutputParams();
63
64         /** The file that we export depends occasionally on what is to
65             compile the file.
66         */
67         FLAVOR flavor;
68         /// is it some flavor of LaTeX?
69         bool isLaTeX() const;
70         
71         /// Same, but for math output, which only matter is XHTML output.
72         MathFlavor math_flavor;
73         
74         /** Are we to write a 'nice' LaTeX file or not.
75             This esentially seems to mean whether InsetInclude, InsetGraphics
76             and InsetExternal should add the absolute path to any external
77             files or not.
78         */
79         bool nice;
80
81         /** moving_arg == true means that the environment in which the inset
82             is typeset is a moving argument. The inset should take care about
83             fragile commands by preceding the latex with \\protect.
84         */
85         bool moving_arg;
86
87         /** intitle == true means that the environment in which the
88             inset is typeset is part of a title (before a \\maketitle).
89             Footnotes in such environments have moving arguments.
90         */
91         bool intitle;
92
93         /** inulemcmd == true means that the environment in which the
94             inset is typeset is part of a ulem command (\uline, \uuline,
95             \uwave, or \sout). Insets that output latex commands relying
96             on local assignments (such as \cite) should enclose such
97             commands in \mbox{} in order to avoid breakage.
98         */
99         mutable bool inulemcmd;
100
101         /** the font at the point where the inset is
102          */
103         Font const * local_font;
104
105         /** Document language babel name
106          */
107         mutable std::string document_language;
108
109         /** The master language. Non-null only for child documents.
110          */
111         mutable Language const * master_language;
112
113         /** Current stream encoding. Only used for LaTeX.
114             This must be set to the document encoding (via the constructor)
115             before output starts. Afterwards it must be kept up to date for
116             each single character (\sa Paragraph::latex).
117             This does also mean that you need to set it back if you use a
118             copy (e.g. in insets): \code
119             int InsetFoo::latex(..., OutputParams const & runparams_in) const
120             {
121                 OutputParams runparams(runparams_in);
122                 runparams.inComment = true;
123                 ...
124                 InsetBla::latex(..., runparams);
125                 ...
126                 runparams_in.encoding = runparams.encoding;
127             }
128             \endcode
129          */
130         mutable Encoding const * encoding;
131
132         /** free_spacing == true means that the inset is in a free-spacing
133             paragraph.
134         */
135         bool free_spacing;
136
137         /** This var is set by the return value from BufferParams::writeLaTeX
138         */
139         bool use_babel;
140
141         /** Are we generating multiple indices?
142         */
143         bool use_indices;
144
145         /** Are we using japanese (pLaTeX)?
146         */
147         bool use_japanese;
148
149         /** Customized bibtex_command
150         */
151         mutable std::string bibtex_command;
152
153         /** Customized index_command
154         */
155         mutable std::string index_command;
156
157         /** Line length to use with plaintext or LaTeX export.
158         */
159         size_type linelen;
160
161         /** The depth of the current paragraph, set for plaintext
162          *  export and used by InsetTabular
163          */
164         int depth;
165
166         /** Export data filled in by the latex(), docbook() etc methods.
167             This is a hack: Make it possible to add stuff to constant
168             OutputParams instances.
169         */
170         boost::shared_ptr<ExportData> exportdata;
171
172         /** Whether we are inside a comment inset. Insets that are including
173          *  external files like InsetGraphics, InsetInclude and InsetExternal
174          *  may only write the usual output and must not attempt to do
175          *  something with the included files (e.g. copying, converting)
176          *  if this flag is true, since they may not exist.
177          */
178         bool inComment;
179
180         /** Whether we are in a table cell.
181          *  For newline, it matters whether its content is aligned or not.
182          */
183         TableCell inTableCell;
184
185         /** Whether we are inside a float or subfloat.
186          *  Needed for subfloat detection on the command line.
187          */
188         Float inFloat;
189
190         /** Whether we are inside an index inset.
191          *  ERT needs to know this, due to the active chars.
192          */
193         bool inIndexEntry;
194
195         /** Whether we are inside an inset that is logically deleted.
196          *  A value > 0 indicates a deleted inset.
197          */
198         int inDeletedInset;
199
200         /** The change information of the outermost logically deleted inset.
201          *  changeOfDeletedInset shall only be evaluated if inDeletedInset > 0.
202          */ 
203         Change changeOfDeletedInset;
204
205         /** allow output of only part of the top-level paragraphs
206          *  par_begin: beginning paragraph
207          */
208         pit_type par_begin;
209
210         /** allow output of only part of the top-level paragraphs
211          *  par_end: par_end-1 is the ending paragraph
212          *  if par_begin=par_end, output all paragraphs
213          */
214         pit_type par_end;
215
216         /// is this the last paragraph in the current buffer/inset?
217         bool isLastPar;
218         
219
220         /** whether or not do actual file copying and image conversion
221          *  This mode will be used to preview the source code
222          */
223         bool dryrun;
224         
225         /// Should we output verbatim or escape LaTeX's special chars?
226         bool verbatim;
227         
228         /// Should we output captions?
229         bool html_disable_captions;
230         
231         /// Are we already in a paragraph?
232         bool html_in_par;
233         
234         /// Does the present context even permit paragraphs?
235         bool html_make_pars;
236         
237         /// Are we generating this material for inclusion in a TOC-like entity?
238         bool for_toc;
239         
240         /// Include all children notwithstanding the use of \includeonly
241         bool includeall;
242 };
243
244
245 } // namespace lyx
246
247 #endif // NOT OUTPUTPARAMS_H