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