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