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 "TextClass.h"
21 #include "insets/InsetQuotes.h"
23 #include "support/copied_ptr.h"
24 #include "support/types.h"
26 #include "frontends/controllers/frontend_helpers.h"
45 /** Buffer parameters.
46 * This class contains all the parameters for this a buffer uses. Some
47 * work needs to be done on this class to make it nice. Now everything
63 /// get l10n translated to the buffers language
64 docstring const B_(std::string const & l10n) const;
66 /// read a header token, if unrecognised, return it or an unknown class name
67 std::string const readToken(Lexer & lex, std::string const & token);
70 void writeFile(std::ostream &) const;
72 /** \returns true if the babel package is used (interogates
73 * the BufferParams and a LyXRC variable).
74 * This returned value can then be passed to the insets...
76 bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
79 void useClassDefaults();
82 bool hasClassDefaults() const;
85 VSpace const & getDefSkip() const;
88 void setDefSkip(VSpace const & vs);
90 /** Wether paragraphs are separated by using a indent like in
91 * articles or by using a little skip like in letters.
93 PARSEP paragraph_separation;
95 InsetQuotes::quote_language quotes_language;
97 InsetQuotes::quote_times quotes_times;
101 textclass_type textclass;
103 TextClass const & getTextClass() const;
105 /// returns the main font for the buffer (document)
106 Font const getFont() const;
108 /* this are for the PaperLayout */
110 PAPER_SIZE papersize;
112 PAPER_ORIENTATION orientation;
113 /// use custom margins
116 std::string paperwidth;
118 std::string paperheight;
120 std::string leftmargin;
122 std::string topmargin;
124 std::string rightmargin;
126 std::string bottommargin;
128 std::string headheight;
132 std::string footskip;
134 /* some LaTeX options */
135 /// The graphics driver
136 std::string graphicsDriver;
138 std::string fontsRoman;
140 std::string fontsSans;
142 std::string fontsTypewriter;
143 /// the default family (rm, sf, tt)
144 std::string fontsDefaultFamily;
145 /// use expert Small Caps
147 /// use Old Style Figures
149 /// the scale factor of the sf font
151 /// the scale factor of the tt font
152 int fontsTypewriterScale;
155 Spacing const & spacing() const;
161 Language const * language;
163 BranchList & branchlist();
164 BranchList const & branchlist() const;
166 * The input encoding for LaTeX. This can be one of
167 * - \c auto: find out the input encoding from the used languages
168 * - \c default: ditto
169 * - any encoding supported by the inputenc package
170 * The encoding of the LyX file is always utf8 and has nothing to
171 * do with this setting.
172 * The difference between \c auto and \c default is that \c auto also
173 * causes loading of the inputenc package, while \c default does not.
174 * \c default will not work unless the user takes additional measures
175 * (such as using special environments like the CJK environment from
177 * \c default can be seen as an unspecified 8bit encoding, since LyX
178 * does not interpret it in any way apart from display on screen.
180 std::string inputenc;
181 /// The main encoding used by this buffer for LaTeX output.
182 /// Individual pieces of text can use different encodings.
183 Encoding const & encoding() const;
185 std::string preamble;
189 std::string float_placement;
191 unsigned int columns;
192 /// parameters for the listings package
193 std::string listings_params;
195 TextClass::PageSides sides;
197 std::string pagestyle;
198 /// \param index should lie in the range 0 <= \c index <= 3.
199 Bullet & temp_bullet(size_type index);
200 Bullet const & temp_bullet(size_type index) const;
201 /// \param index should lie in the range 0 <= \c index <= 3.
202 Bullet & user_defined_bullet(size_type index);
203 Bullet const & user_defined_bullet(size_type index) const;
205 void readPreamble(Lexer &);
207 void readLanguage(Lexer &);
209 void readGraphicsDriver(Lexer &);
211 void readBullets(Lexer &);
213 void readBulletsLaTeX(Lexer &);
215 /// Whether to load a package such as amsmath or esint.
216 /// The enum values must not be changed (file format!)
218 /// Don't load the package. For experts only.
220 /// Load the package if needed (recommended)
222 /// Always load the package (e.g. if the document contains
223 /// some ERT that needs the package)
226 /// Whether and how to load amsmath
228 /// Whether and how to load esint
232 /// revision tracking for this buffer ?
234 /** This param decides whether change tracking marks should be used
235 * in output (irrespective of how these marks are actually defined;
236 * for instance, they may differ for DVI and PDF generation)
239 /// Time ago we agreed that this was a buffer property [ale990407]
240 std::string parentname;
244 /// the author list for the document
245 AuthorList & authors();
246 AuthorList const & authors() const;
248 /// map of the file's author IDs to buffer author IDs
249 std::vector<unsigned int> author_map;
251 std::string const dvips_options() const;
253 std::string const paperSizeName() const;
254 /// set up if and how babel is called
255 std::string const babelCall(std::string const & lang_opts) const;
256 /// set up the document fonts
257 std::string const loadFonts(std::string const & rm,
258 std::string const & sf, std::string const & tt,
259 bool const & sc, bool const & osf,
260 int const & sfscale, int const & ttscale) const;
261 /// path of the current buffer
262 std::string filepath;
263 /// get the appropriate cite engine (natbib handling)
264 biblio::CiteEngine getEngine() const;
267 void setCiteEngine(biblio::CiteEngine const);
270 /** Use the Pimpl idiom to hide those member variables that would otherwise
271 * drag in other header files.
276 static Impl * clone(Impl const *);
277 static void destroy(Impl *);
279 support::copied_ptr<Impl, MemoryTraits> pimpl_;
282 biblio::CiteEngine cite_engine_;