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