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