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
19 #include "TextClass.h"
22 #include "insets/InsetQuotes.h"
24 #include "support/copied_ptr.h"
25 #include "support/types.h"
27 #include "frontends/controllers/frontend_helpers.h"
46 /** Buffer parameters.
47 * This class contains all the parameters for this a buffer uses. Some
48 * work needs to be done on this class to make it nice. Now everything
64 /// get l10n translated to the buffers language
65 docstring const B_(std::string const & l10n) const;
67 /// read a header token, if unrecognised, return it or an unknown class name
68 std::string const readToken(Lexer & lex, std::string const & token);
71 void writeFile(std::ostream &) const;
73 /** \returns true if the babel package is used (interogates
74 * the BufferParams and a LyXRC variable).
75 * This returned value can then be passed to the insets...
77 bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
80 void useClassDefaults();
83 bool hasClassDefaults() const;
86 VSpace const & getDefSkip() const;
89 void setDefSkip(VSpace const & vs);
91 /** Wether paragraphs are separated by using a indent like in
92 * articles or by using a little skip like in letters.
94 PARSEP paragraph_separation;
96 InsetQuotes::quote_language quotes_language;
98 InsetQuotes::quote_times quotes_times;
100 std::string fontsize;
102 textclass_type textclass;
104 TextClass const & getTextClass() const;
106 /// returns the main font for the buffer (document)
107 Font const getFont() const;
109 /* this are for the PaperLayout */
111 PAPER_SIZE papersize;
113 PAPER_ORIENTATION orientation;
114 /// use custom margins
117 std::string paperwidth;
119 std::string paperheight;
121 std::string leftmargin;
123 std::string topmargin;
125 std::string rightmargin;
127 std::string bottommargin;
129 std::string headheight;
133 std::string footskip;
135 /* some LaTeX options */
136 /// The graphics driver
137 std::string graphicsDriver;
139 std::string fontsRoman;
141 std::string fontsSans;
143 std::string fontsTypewriter;
144 /// the default family (rm, sf, tt)
145 std::string fontsDefaultFamily;
146 /// use expert Small Caps
148 /// use Old Style Figures
150 /// the scale factor of the sf font
152 /// the scale factor of the tt font
153 int fontsTypewriterScale;
156 Spacing const & spacing() const;
162 Language const * language;
164 BranchList & branchlist();
165 BranchList const & branchlist() const;
167 * The input encoding for LaTeX. This can be one of
168 * - \c auto: find out the input encoding from the used languages
169 * - \c default: ditto
170 * - any encoding supported by the inputenc package
171 * The encoding of the LyX file is always utf8 and has nothing to
172 * do with this setting.
173 * The difference between \c auto and \c default is that \c auto also
174 * causes loading of the inputenc package, while \c default does not.
175 * \c default will not work unless the user takes additional measures
176 * (such as using special environments like the CJK environment from
178 * \c default can be seen as an unspecified 8bit encoding, since LyX
179 * does not interpret it in any way apart from display on screen.
181 std::string inputenc;
182 /// The main encoding used by this buffer for LaTeX output.
183 /// Individual pieces of text can use different encodings.
184 Encoding const & encoding() const;
186 std::string preamble;
190 std::string float_placement;
192 unsigned int columns;
193 /// parameters for the listings package
194 std::string listings_params;
196 TextClass::PageSides sides;
198 std::string pagestyle;
199 /// \param index should lie in the range 0 <= \c index <= 3.
200 Bullet & temp_bullet(size_type index);
201 Bullet const & temp_bullet(size_type index) const;
202 /// \param index should lie in the range 0 <= \c index <= 3.
203 Bullet & user_defined_bullet(size_type index);
204 Bullet const & user_defined_bullet(size_type index) const;
206 void readPreamble(Lexer &);
208 void readLanguage(Lexer &);
210 void readGraphicsDriver(Lexer &);
212 void readBullets(Lexer &);
214 void readBulletsLaTeX(Lexer &);
216 /// Whether to load a package such as amsmath or esint.
217 /// The enum values must not be changed (file format!)
219 /// Don't load the package. For experts only.
221 /// Load the package if needed (recommended)
223 /// Always load the package (e.g. if the document contains
224 /// some ERT that needs the package)
227 /// Whether and how to load amsmath
229 /// Whether and how to load esint
233 /// revision tracking for this buffer ?
235 /** This param decides whether change tracking marks should be used
236 * in output (irrespective of how these marks are actually defined;
237 * for instance, they may differ for DVI and PDF generation)
240 /// Time ago we agreed that this was a buffer property [ale990407]
241 std::string parentname;
245 /// the author list for the document
246 AuthorList & authors();
247 AuthorList const & authors() const;
249 /// map of the file's author IDs to buffer author IDs
250 std::vector<unsigned int> author_map;
252 std::string const dvips_options() const;
254 std::string const paperSizeName() const;
255 /// set up if and how babel is called
256 std::string const babelCall(std::string const & lang_opts) const;
257 /// handle inputenc etc.
258 void writeEncodingPreamble(odocstream & os, LaTeXFeatures & features,
259 TexRow & texrow) const;
260 /// set up the document fonts
261 std::string const loadFonts(std::string const & rm,
262 std::string const & sf, std::string const & tt,
263 bool const & sc, bool const & osf,
264 int const & sfscale, int const & ttscale) const;
265 /// path of the current buffer
266 std::string filepath;
267 /// get the appropriate cite engine (natbib handling)
268 biblio::CiteEngine getEngine() const;
271 void setCiteEngine(biblio::CiteEngine const);
274 /** Use the Pimpl idiom to hide those member variables that would otherwise
275 * drag in other header files.
280 static Impl * clone(Impl const *);
281 static void destroy(Impl *);
283 support::copied_ptr<Impl, MemoryTraits> pimpl_;
286 biblio::CiteEngine cite_engine_;