]> git.lyx.org Git - lyx.git/blob - src/OutputParams.h
Revert "Read list of translated languages from a file"
[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         /** moving_arg == true means that the environment in which the inset
85             is typeset is a moving argument. The inset should take care about
86             fragile commands by preceding the latex with \\protect.
87         */
88         bool moving_arg;
89
90         /** intitle == true means that the environment in which the
91             inset is typeset is part of a title (before a \\maketitle).
92             Footnotes in such environments have moving arguments.
93         */
94         bool intitle;
95
96         /** inulemcmd == true means that the environment in which the
97             inset is typeset is part of a ulem command (\uline, \uuline,
98             \uwave, or \sout). Insets that output latex commands relying
99             on local assignments (such as \cite) should enclose such
100             commands in \mbox{} in order to avoid breakage.
101         */
102         mutable bool inulemcmd;
103
104         /** the font at the point where the inset is
105          */
106         Font const * local_font;
107
108         /** Document language babel name
109          */
110         mutable std::string document_language;
111
112         /** The master language. Non-null only for child documents.
113          */
114         mutable Language const * master_language;
115
116         /** Current stream encoding. Only used for LaTeX.
117             This must be set to the document encoding (via the constructor)
118             before output starts. Afterwards it must be kept up to date for
119             each single character (\sa Paragraph::latex).
120             This does also mean that you need to set it back if you use a
121             copy (e.g. in insets): \code
122             int InsetFoo::latex(..., OutputParams const & runparams_in) const
123             {
124                 OutputParams runparams(runparams_in);
125                 runparams.inComment = true;
126                 ...
127                 InsetBla::latex(..., runparams);
128                 ...
129                 runparams_in.encoding = runparams.encoding;
130             }
131             \endcode
132          */
133         mutable Encoding const * encoding;
134
135         /** free_spacing == true means that the inset is in a free-spacing
136             paragraph.
137         */
138         bool free_spacing;
139
140         /** This var is set by the return value from BufferParams::writeLaTeX
141         */
142         bool use_babel;
143
144         /** Do we use polyglossia (instead of babel)?
145         */
146         bool use_polyglossia;
147
148         /** Are we generating multiple indices?
149         */
150         bool use_indices;
151
152         /** Are we using japanese (pLaTeX)?
153         */
154         bool use_japanese;
155
156         /** Customized bibtex_command
157         */
158         mutable std::string bibtex_command;
159
160         /** Customized index_command
161         */
162         mutable std::string index_command;
163
164         /** Line length to use with plaintext or LaTeX export.
165         */
166         size_type linelen;
167
168         /** The depth of the current paragraph, set for plaintext
169          *  export and used by InsetTabular
170          */
171         int depth;
172
173         /** Export data filled in by the latex(), docbook() etc methods.
174             This is a hack: Make it possible to add stuff to constant
175             OutputParams instances.
176         */
177         shared_ptr<ExportData> exportdata;
178
179         /** Whether we are inside a comment inset. Insets that are including
180          *  external files like InsetGraphics, InsetInclude and InsetExternal
181          *  may only write the usual output and must not attempt to do
182          *  something with the included files (e.g. copying, converting)
183          *  if this flag is true, since they may not exist.
184          */
185         bool inComment;
186
187         /** Whether we are in a table cell.
188          *  For newline, it matters whether its content is aligned or not.
189          */
190         TableCell inTableCell;
191
192         /** Whether we are inside a float or subfloat.
193          *  Needed for subfloat detection on the command line.
194          */
195         Float inFloat;
196
197         /** Whether we are inside an index inset.
198          *  ERT needs to know this, due to the active chars.
199          */
200         bool inIndexEntry;
201
202         /** Whether we are inside an IPA inset.
203          *  Needed for proper IPA output.
204          */
205         bool inIPA;
206
207         /** Whether we are inside an inset that is logically deleted.
208          *  A value > 0 indicates a deleted inset.
209          */
210         int inDeletedInset;
211
212         /** The change information of the outermost logically deleted inset.
213          *  changeOfDeletedInset shall only be evaluated if inDeletedInset > 0.
214          */ 
215         Change changeOfDeletedInset;
216
217         /** allow output of only part of the top-level paragraphs
218          *  par_begin: beginning paragraph
219          */
220         mutable pit_type par_begin;
221
222         /** allow output of only part of the top-level paragraphs
223          *  par_end: par_end-1 is the ending paragraph
224          *  if par_begin=par_end, output all paragraphs
225          */
226         mutable pit_type par_end;
227
228         /// Id of the last paragraph before an inset
229         mutable int lastid;
230
231         /// Last position in the last paragraph before an inset
232         mutable int lastpos;
233
234         /// is this the last paragraph in the current buffer/inset?
235         bool isLastPar;
236         
237
238         /** whether or not do actual file copying and image conversion
239          *  This mode will be used to preview the source code
240          */
241         bool dryrun;
242         
243         /// Should we output verbatim or escape LaTeX's special chars?
244         bool pass_thru;
245         
246         /// Should we output captions?
247         bool html_disable_captions;
248         
249         /// Are we already in a paragraph?
250         bool html_in_par;
251         
252         /// Does the present context even permit paragraphs?
253         bool html_make_pars;
254         
255         /// Are we generating this material for inclusion in a TOC-like entity?
256         bool for_toc;
257         
258         /// Include all children notwithstanding the use of \includeonly
259         bool includeall;
260
261         /// Explicit output folder, if any is desired
262         std::string export_folder;
263 };
264
265
266 } // namespace lyx
267
268 #endif // NOT OUTPUTPARAMS_H