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