]> git.lyx.org Git - lyx.git/blob - src/OutputParams.h
Patch by Richard Heck:
[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
20
21 namespace lyx {
22
23
24 class Encoding;
25 class ExportData;
26 class Font;
27
28
29 class OutputParams {
30 public:
31         enum FLAVOR {
32                 LATEX,
33                 PDFLATEX,
34                 XML
35         };
36
37         OutputParams(Encoding const *);
38         ~OutputParams();
39
40         /** The latex that we export depends occasionally on what is to
41             compile the file.
42         */
43         FLAVOR flavor;
44
45         /** Are we to write a 'nice' LaTeX file or not.
46             This esentially seems to mean whether InsetInclude, InsetGraphics
47             and InsetExternal should add the absolute path to any external
48             files or not.
49         */
50         bool nice;
51
52         /** moving_arg == true means that the environment in which the inset
53             is typeset is a moving argument. The inset should take care about
54             fragile commands by preceding the latex with \\protect.
55         */
56         bool moving_arg;
57
58         /** intitle == true means that the environment in which the
59             inset is typeset is part of a title (before a \\maketitle).
60             Footnotes in such environments have moving arguments.
61         */
62         bool intitle;
63
64         /** the font at the point where the inset is
65          */
66         Font const * local_font;
67
68         /** Document language babel name
69          */
70         mutable std::string document_language;
71
72         /** Current stream encoding. Only used for LaTeX.
73             This must be set to the document encoding (via the constructor)
74             before output starts. Afterwards it must be kept up to date for
75             each single character (\see Paragraph::simpleTeXOnePar).
76             This does also mean that you need to set it back if you use a
77             copy (e.g. in insets): \code
78             int InsetFoo::latex(..., OutputParams const & runparams_in) const
79             {
80                 OutputParams runparams(runparams_in);
81                 runparams.inComment = true;
82                 ...
83                 InsetBla::latex(..., runparams);
84                 ...
85                 runparams_in.encoding = runparams.encoding;
86             }
87             \endcode
88          */
89         mutable Encoding const * encoding;
90
91         /** free_spacing == true means that the inset is in a free-spacing
92             paragraph.
93         */
94         bool free_spacing;
95
96         /** This var is set by the return value from BufferParams::writeLaTeX
97         */
98         bool use_babel;
99
100         /** Line length to use with plaintext export.
101         */
102         size_type linelen;
103
104         /** The depth of the current paragraph, set for plaintext
105          *  export and used by InsetTabular
106          */
107         int depth;
108
109         /** Export data filled in by the latex(), docbook() etc methods.
110             This is a hack: Make it possible to add stuff to constant
111             OutputParams instances.
112         */
113         boost::shared_ptr<ExportData> exportdata;
114
115         /** Whether we are inside a comment inset. Insets that are including
116          *  external files like InsetGraphics, InsetInclude and InsetExternal
117          *  may only write the usual output and must not attempt to do
118          *  something with the included files (e.g. copying, converting)
119          *  if this flag is true, since they may not exist.
120          */
121         bool inComment;
122
123         /** allow output of only part of the top-level paragraphs
124          *  par_begin: beginning paragraph
125          */
126         pit_type par_begin;
127
128         /** allow output of only part of the top-level paragraphs
129          *  par_end: par_end-1 is the ending paragraph
130          *  if par_begin=par_end, output all paragraphs
131          */
132         pit_type par_end;
133
134         /** whether or not do actual file copying and image conversion
135          *  This mode will be used to preview the source code
136          */
137         bool dryrun;
138 };
139
140
141 } // namespace lyx
142
143 #endif // NOT OUTPUTPARAMS_H