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