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