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