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