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