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