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