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