]> git.lyx.org Git - lyx.git/blob - src/OutputParams.h
FindAdv: Added remaining accents(2) dgrave, textdoublegrave, rcap, textroundcap
[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             Non-nice LaTeX also includes additional safe line breaks in order to
83             increase the precision of forward/reverse search and error reporting.
84         */
85         bool nice;
86
87         /** Is this a real child (i.e., compiled as a child)?
88             This depends on wherefrom we export the buffer. Even children
89             that have a master can be compiled standalone.
90         */
91         mutable bool is_child;
92
93         /** moving_arg == true means that the environment in which the inset
94             is typeset is a moving argument. The inset should take care about
95             fragile commands by preceding the latex with \\protect.
96         */
97         bool moving_arg;
98
99         /** intitle == true means that the environment in which the
100             inset is typeset is part of a title (before a \\maketitle).
101             Footnotes in such environments have moving arguments.
102         */
103         bool intitle;
104
105         /** inulemcmd > 0 means that the environment in which the
106             inset is typeset is part of a ulem or soul command (e.g., \uline,
107             \uuline, \uwave, \sout or \xout). Insets that output latex commands
108             relying on local assignments (such as \cite) should enclose such
109             commands in \mbox{} in order to avoid breakage.
110         */
111         mutable int inulemcmd;
112
113         /** the font at the point where the inset is
114          */
115         Font const * local_font;
116
117         /** Document language babel name
118          */
119         std::string document_language;
120
121         /// main font encoding of the document
122         std::string main_fontenc;
123
124         /** The master language. Non-null only for child documents.
125             Note that this is not the language of the top level master, but
126             of the direct parent for nested includes.
127          */
128         mutable Language const * master_language;
129
130         /** Current stream encoding. Only used for LaTeX.
131             This must be set to the document encoding (via the constructor)
132             before output starts. Afterwards it must be kept up to date for
133             each single character (\sa Paragraph::latex).
134             This does also mean that you need to set it back if you use a
135             copy (e.g. in insets): \code
136             int InsetFoo::latex(..., OutputParams const & runparams_in) const
137             {
138                 OutputParams runparams(runparams_in);
139                 runparams.inComment = true;
140                 ...
141                 InsetBla::latex(..., runparams);
142                 ...
143                 runparams_in.encoding = runparams.encoding;
144             }
145             \endcode
146          */
147         mutable Encoding const * encoding;
148
149         /** free_spacing == true means that the inset is in a free-spacing
150             paragraph.
151         */
152         bool free_spacing;
153
154         /** This var is set by the return value from BufferParams::writeLaTeX
155         */
156         bool use_babel;
157
158         /** Do we use polyglossia (instead of babel)?
159         */
160         bool use_polyglossia;
161
162         /// Do we use the CJK package?
163         bool use_CJK;
164
165         /** Are we generating multiple indices?
166         */
167         bool use_indices;
168
169         /** Are we using japanese (pLaTeX)?
170         */
171         bool use_japanese;
172
173         /** Customized bibtex_command
174         */
175         std::string bibtex_command;
176
177         /** Customized index_command
178         */
179         std::string index_command;
180
181         /** Hyperref driver
182         */
183         std::string hyperref_driver;
184
185         /** Line length to use with plaintext or LaTeX export.
186         */
187         size_type linelen;
188
189         /** The depth of the current paragraph, set for plaintext
190          *  export and used by InsetTabular
191          */
192         int depth;
193
194         /** Export data filled in by the latex(), docbook() etc methods.
195             This is a hack: Make it possible to add stuff to constant
196             OutputParams instances.
197         */
198         std::shared_ptr<ExportData> exportdata;
199
200         /** Store labels, index entries (etc.) (in \ref post_macro)
201          *  and output them later. This is used in particular to get
202          *  labels and index entries (and potentially other fragile commands)
203          *  outside of moving arguments (bug 2154)
204          */
205         bool postpone_fragile_stuff;
206
207         /** Stuff to be postponed and output after the current macro
208          *  (if \ref postpone_fragile_stuff is true). Used for labels and index
209          *  entries in commands with moving arguments (\\section, \\caption etc.)
210          */
211         mutable docstring post_macro;
212
213         /** Whether we are entering a display math inset.
214          *  Needed to correctly strike out deleted math in change tracking.
215          */
216         mutable bool inDisplayMath;
217
218         /** Whether we are leaving a display math inset.
219          *  Needed to correctly track nested ulem commands in change tracking.
220          */
221         mutable bool wasDisplayMath;
222
223         /** Whether we are inside a comment inset. Insets that are including
224          *  external files like InsetGraphics, InsetInclude and InsetExternal
225          *  may only write the usual output and must not attempt to do
226          *  something with the included files (e.g. copying, converting)
227          *  if this flag is true, since they may not exist.
228          */
229         bool inComment;
230
231         /** Whether a btUnit (for multiple biblographies) is open.
232          */
233         mutable bool openbtUnit;
234
235         /** Process only the children's aux files with BibTeX.
236          *  This is necessary with chapterbib.
237          */
238         bool only_childbibs;
239
240         /** Whether we are in a table cell.
241          *  For newline, it matters whether its content is aligned or not.
242          */
243         TableCell inTableCell;
244
245         /** Whether we are inside a float or subfloat.
246          *  Needed for subfloat detection on the command line.
247          */
248         Float inFloat;
249
250         /** Whether we are inside an index inset.
251          *  ERT needs to know this, due to the active chars.
252          */
253         bool inIndexEntry;
254
255         /** Whether we are inside an IPA inset.
256          *  Needed for proper IPA output.
257          */
258         bool inIPA;
259
260         /** Whether we are inside an inset that is logically deleted.
261          *  A value > 0 indicates a deleted inset.
262          */
263         int inDeletedInset;
264
265         /** The change information of the outermost logically deleted inset.
266          *  changeOfDeletedInset shall only be evaluated if inDeletedInset > 0.
267          */
268         Change changeOfDeletedInset;
269
270         /** allow output of only part of the top-level paragraphs
271          *  par_begin: beginning paragraph
272          */
273         mutable pit_type par_begin;
274
275         /** allow output of only part of the top-level paragraphs
276          *  par_end: par_end-1 is the ending paragraph
277          *  if par_begin=par_end, output all paragraphs
278          */
279         mutable pit_type par_end;
280
281         /// Id of the last paragraph before an inset
282         mutable int lastid;
283
284         /// Last position in the last paragraph before an inset
285         mutable pos_type lastpos;
286
287         /// is this the last paragraph in the current buffer/inset?
288         bool isLastPar;
289
290
291         /** whether or not to do actual file copying and image conversion
292          *  This mode will be used to preview the source code
293          */
294         bool dryrun;
295
296         /// whether to display output errors or not
297         bool silent;
298
299         /// Should we output verbatim or escape LaTeX's special chars?
300         bool pass_thru;
301
302         /// Should we output verbatim specific chars?
303         docstring pass_thru_chars;
304
305         /// Should we output captions?
306         bool html_disable_captions;
307
308         /// Are we already in a paragraph?
309         bool html_in_par;
310
311         /// Does the present context even permit paragraphs?
312         bool html_make_pars;
313
314         /// Are we generating this material for inclusion in a TOC-like entity?
315         bool for_toc;
316
317         /// Are we generating this material for inclusion in a tooltip?
318         bool for_tooltip;
319
320         /// Are we generating this material for use by advanced search?
321         bool for_search;
322
323         /// Are we generating this material for instant preview?
324         bool for_preview;
325
326         /// Include all children notwithstanding the use of \includeonly
327         bool includeall;
328
329         /// Explicit output folder, if any is desired
330         std::string export_folder;
331 };
332
333
334 } // namespace lyx
335
336 #endif // NOT OUTPUTPARAMS_H