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 * - auto: find out the input encoding from the used languages
182 * - default: Don't load the inputenc package and hope that it will
184 * - any encoding supported by the inputenc package
185 * The encoding of the LyX file is always utf8 and has nothing to
186 * do with this setting.
188 std::string inputenc;
189 /// The main encoding used by this buffer for LaTeX output.
190 /// Individual pieces of text can use different encodings.
191 Encoding const & encoding() const;
193 std::string preamble;
197 std::string float_placement;
199 unsigned int columns;
201 LyXTextClass::PageSides sides;
203 std::string pagestyle;
204 /// \param index should lie in the range 0 <= \c index <= 3.
205 Bullet & temp_bullet(size_type index);
206 Bullet const & temp_bullet(size_type index) const;
207 /// \param index should lie in the range 0 <= \c index <= 3.
208 Bullet & user_defined_bullet(size_type index);
209 Bullet const & user_defined_bullet(size_type index) const;
211 void readPreamble(LyXLex &);
213 void readLanguage(LyXLex &);
215 void readGraphicsDriver(LyXLex &);
217 void readBullets(LyXLex &);
219 void readBulletsLaTeX(LyXLex &);
221 /// Whether to load a package such as amsmath or esint.
222 /// The enum values must not be changed (file format!)
224 /// Don't load the package. For experts only.
226 /// Load the package if needed (recommended)
228 /// Always load the package (e.g. if the document contains
229 /// some ERT that needs the package)
232 /// Whether and how to load amsmath
234 /// Whether and how to load esint
237 biblio::CiteEngine cite_engine;
240 /// revision tracking for this buffer ?
242 /** This param decides whether change tracking marks should be output
243 * (using the dvipost package) or if the current "state" of the
244 * document should be output instead. Since dvipost needs dvi
245 * specials, it only works with dvi/ps output (the param will be
246 * ignored with other output flavors and disabled when dvipost is
250 /// Time ago we agreed that this was a buffer property [ale990407]
251 std::string parentname;
255 /// the author list for the document
256 AuthorList & authors();
257 AuthorList const & authors() const;
259 /// map of the file's author IDs to buffer author IDs
260 std::vector<unsigned int> author_map;
262 std::string const dvips_options() const;
264 std::string const paperSizeName() const;
266 std::string const babelCall(std::string const & lang_opts) const;
267 /// set up the document fonts
268 std::string const loadFonts(LaTeXFeatures & features, std::string const & rm,
269 std::string const & sf, std::string const & tt,
270 bool const & sc, bool const & osf,
271 int const & sfscale, int const & ttscale) const;
272 /// path of the current buffer
273 std::string filepath;
276 /** Use the Pimpl idiom to hide those member variables that would otherwise
277 * drag in other header files.
282 static Impl * clone(Impl const *);
283 static void destroy(Impl *);
285 support::copied_ptr<Impl, MemoryTraits> pimpl_;