4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
15 #ifndef BUFFERPARAMS_H
16 #define BUFFERPARAMS_H
18 #include "lyxtextclass.h"
21 #include "insets/insetquotes.h"
23 #include "support/copied_ptr.h"
24 #include "support/types.h"
47 ENGINE_NATBIB_AUTHORYEAR,
48 ENGINE_NATBIB_NUMERICAL,
52 class CiteEngine_enum {
55 CiteEngine_enum(CiteEngine val) : val_(val) {}
56 operator CiteEngine() const{ return val_; }
62 /** Buffer parameters.
63 * This class contains all the parameters for this a buffer uses. Some
64 * work needs to be done on this class to make it nice. Now everything
80 /// read a header token, if unrecognised, return it or an unknown class name
81 std::string const readToken(LyXLex & lex, std::string const & token);
84 void writeFile(std::ostream &) const;
86 /** \returns true if the babel package is used (interogates
87 * the BufferParams and a LyXRC variable).
88 * This returned value can then be passed to the insets...
90 bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
93 void useClassDefaults();
96 bool hasClassDefaults() const;
99 VSpace const & getDefSkip() const;
102 void setDefSkip(VSpace const & vs);
104 /** Wether paragraphs are separated by using a indent like in
105 * articles or by using a little skip like in letters.
107 PARSEP paragraph_separation;
109 InsetQuotes::quote_language quotes_language;
111 InsetQuotes::quote_times quotes_times;
113 std::string fontsize;
115 textclass_type textclass;
117 LyXTextClass const & getLyXTextClass() const;
119 /// returns the main font for the buffer (document)
120 LyXFont const getFont() const;
122 /* this are for the PaperLayout */
124 PAPER_SIZE papersize;
126 PAPER_ORIENTATION orientation;
127 /// use custom margins
130 std::string paperwidth;
132 std::string paperheight;
134 std::string leftmargin;
136 std::string topmargin;
138 std::string rightmargin;
140 std::string bottommargin;
142 std::string headheight;
146 std::string footskip;
148 /* some LaTeX options */
149 /// The graphics driver
150 std::string graphicsDriver;
152 std::string fontsRoman;
154 std::string fontsSans;
156 std::string fontsTypewriter;
157 /// the default family (rm, sf, tt)
158 std::string fontsDefaultFamily;
159 /// use expert Small Caps
161 /// use Old Style Figures
163 /// the scale factor of the sf font
165 /// the scale factor of the tt font
166 int fontsTypewriterScale;
169 Spacing const & spacing() const;
175 Language const * language;
177 BranchList & branchlist();
178 BranchList const & branchlist() const;
180 * The input encoding for LaTeX. This can be one of
181 * - \c auto: find out the input encoding from the used languages
182 * - \c default: ditto
183 * - any encoding supported by the inputenc package
184 * The encoding of the LyX file is always utf8 and has nothing to
185 * do with this setting.
186 * The difference between \c auto and \c default is that \c auto also
187 * causes loading of the inputenc package, while \c default does not.
188 * \c default will not work unless the user takes additional measures
189 * (such as using special environments like the CJK environment from
191 * \c default can be seen as an unspecified 8bit encoding, since LyX
192 * does not interpret it in any way apart from display on screen.
194 std::string inputenc;
195 /// The main encoding used by this buffer for LaTeX output.
196 /// Individual pieces of text can use different encodings.
197 Encoding const & encoding() const;
199 std::string preamble;
203 std::string float_placement;
205 unsigned int columns;
207 LyXTextClass::PageSides sides;
209 std::string pagestyle;
210 /// \param index should lie in the range 0 <= \c index <= 3.
211 Bullet & temp_bullet(size_type index);
212 Bullet const & temp_bullet(size_type index) const;
213 /// \param index should lie in the range 0 <= \c index <= 3.
214 Bullet & user_defined_bullet(size_type index);
215 Bullet const & user_defined_bullet(size_type index) const;
217 void readPreamble(LyXLex &);
219 void readLanguage(LyXLex &);
221 void readGraphicsDriver(LyXLex &);
223 void readBullets(LyXLex &);
225 void readBulletsLaTeX(LyXLex &);
227 /// Whether to load a package such as amsmath or esint.
228 /// The enum values must not be changed (file format!)
230 /// Don't load the package. For experts only.
232 /// Load the package if needed (recommended)
234 /// Always load the package (e.g. if the document contains
235 /// some ERT that needs the package)
238 /// Whether and how to load amsmath
240 /// Whether and how to load esint
243 biblio::CiteEngine cite_engine;
246 /// revision tracking for this buffer ?
248 /** This param decides whether change tracking marks should be output
249 * (using the dvipost package) or if the current "state" of the
250 * document should be output instead. Since dvipost needs dvi
251 * specials, it only works with dvi/ps output (the param will be
252 * ignored with other output flavors and disabled when dvipost is
256 /// Time ago we agreed that this was a buffer property [ale990407]
257 std::string parentname;
261 /// the author list for the document
262 AuthorList & authors();
263 AuthorList const & authors() const;
265 /// map of the file's author IDs to buffer author IDs
266 std::vector<unsigned int> author_map;
268 std::string const dvips_options() const;
270 std::string const paperSizeName() const;
272 std::string const babelCall(std::string const & lang_opts) const;
273 /// set up the document fonts
274 std::string const loadFonts(std::string const & rm,
275 std::string const & sf, std::string const & tt,
276 bool const & sc, bool const & osf,
277 int const & sfscale, int const & ttscale) const;
278 /// path of the current buffer
279 std::string filepath;
282 /** Use the Pimpl idiom to hide those member variables that would otherwise
283 * drag in other header files.
288 static Impl * clone(Impl const *);
289 static void destroy(Impl *);
291 support::copied_ptr<Impl, MemoryTraits> pimpl_;