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"
46 ENGINE_NATBIB_AUTHORYEAR,
47 ENGINE_NATBIB_NUMERICAL,
51 class CiteEngine_enum {
54 CiteEngine_enum(CiteEngine val) : val_(val) {}
55 operator CiteEngine() const{ return val_; }
61 /** Buffer parameters.
62 * This class contains all the parameters for this a buffer uses. Some
63 * work needs to be done on this class to make it nice. Now everything
79 /// read a header token, if unrecognised, return it or an unknown class name
80 std::string const readToken(LyXLex & lex, std::string const & token);
83 void writeFile(std::ostream &) const;
85 /** \returns true if the babel package is used (interogates
86 * the BufferParams and a LyXRC variable).
87 * This returned value can then be passed to the insets...
89 bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
92 void useClassDefaults();
95 bool hasClassDefaults() const;
98 VSpace const & getDefSkip() const;
101 void setDefSkip(VSpace const & vs);
103 /** Wether paragraphs are separated by using a indent like in
104 * articles or by using a little skip like in letters.
106 PARSEP paragraph_separation;
108 InsetQuotes::quote_language quotes_language;
110 InsetQuotes::quote_times quotes_times;
112 std::string fontsize;
114 textclass_type textclass;
116 LyXTextClass const & getLyXTextClass() const;
118 /// returns the main font for the buffer (document)
119 LyXFont const getFont() const;
121 /* this are for the PaperLayout */
123 PAPER_SIZE papersize;
125 PAPER_ORIENTATION orientation;
126 /// use custom margins
129 std::string paperwidth;
131 std::string paperheight;
133 std::string leftmargin;
135 std::string topmargin;
137 std::string rightmargin;
139 std::string bottommargin;
141 std::string headheight;
145 std::string footskip;
147 /* some LaTeX options */
148 /// The graphics driver
149 std::string graphicsDriver;
151 std::string fontsRoman;
153 std::string fontsSans;
155 std::string fontsTypewriter;
156 /// the default family (rm, sf, tt)
157 std::string fontsDefaultFamily;
158 /// use expert Small Caps
160 /// use Old Style Figures
162 /// the scale factor of the sf font
164 /// the scale factor of the tt font
165 int fontsTypewriterScale;
168 Spacing const & spacing() const;
174 Language const * language;
176 BranchList & branchlist();
177 BranchList const & branchlist() const;
179 * The input encoding for LaTeX. This can be one of
180 * - auto: find out the input encoding from the used languages
181 * - default: Don't load the inputenc package and hope that it will
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.
187 std::string inputenc;
189 std::string preamble;
193 std::string float_placement;
195 unsigned int columns;
197 LyXTextClass::PageSides sides;
199 std::string pagestyle;
200 /// \param index should lie in the range 0 <= \c index <= 3.
201 Bullet & temp_bullet(size_type index);
202 Bullet const & temp_bullet(size_type index) const;
203 /// \param index should lie in the range 0 <= \c index <= 3.
204 Bullet & user_defined_bullet(size_type index);
205 Bullet const & user_defined_bullet(size_type index) const;
207 void readPreamble(LyXLex &);
209 void readLanguage(LyXLex &);
211 void readGraphicsDriver(LyXLex &);
213 void readBullets(LyXLex &);
215 void readBulletsLaTeX(LyXLex &);
217 /// Whether to load a package such as amsmath or esint.
218 /// The enum values must not be changed (file format!)
220 /// Don't load the package. For experts only.
222 /// Load the package if needed (recommended)
224 /// Always load the package (e.g. if the document contains
225 /// some ERT that needs the package)
228 /// Whether and how to load amsmath
230 /// Whether and how to load esint
233 biblio::CiteEngine cite_engine;
236 /// revision tracking for this buffer ?
238 /** This param decides whether change tracking marks should be output
239 * (using the dvipost package) or if the current "state" of the
240 * document should be output instead. Since dvipost needs dvi
241 * specials, it only works with dvi/ps output (the param will be
242 * ignored with other output flavors and disabled when dvipost is
246 /// Time ago we agreed that this was a buffer property [ale990407]
247 std::string parentname;
251 /// the author list for the document
252 AuthorList & authors();
253 AuthorList const & authors() const;
255 /// map of the file's author IDs to buffer author IDs
256 std::vector<unsigned int> author_map;
258 std::string const dvips_options() const;
260 std::string const paperSizeName() const;
262 std::string const babelCall(std::string const & lang_opts) const;
263 /// set up the document fonts
264 std::string const loadFonts(LaTeXFeatures & features, std::string const & rm,
265 std::string const & sf, std::string const & tt,
266 bool const & sc, bool const & osf,
267 int const & sfscale, int const & ttscale) const;
268 /// path of the current buffer
269 std::string filepath;
272 /** Use the Pimpl idiom to hide those member variables that would otherwise
273 * drag in other header files.
278 static Impl * clone(Impl const *);
279 static void destroy(Impl *);
281 support::copied_ptr<Impl, MemoryTraits> pimpl_;