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