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"
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 /// read a header token, if unrecognised, return it or an unknown class name
64 std::string const readToken(LyXLex & lex, std::string const & token);
67 void writeFile(std::ostream &) const;
69 /** \returns true if the babel package is used (interogates
70 * the BufferParams and a LyXRC variable).
71 * This returned value can then be passed to the insets...
73 bool writeLaTeX(odocstream &, LaTeXFeatures &, TexRow &) const;
76 void useClassDefaults();
79 bool hasClassDefaults() const;
82 VSpace const & getDefSkip() const;
85 void setDefSkip(VSpace const & vs);
87 /** Wether paragraphs are separated by using a indent like in
88 * articles or by using a little skip like in letters.
90 PARSEP paragraph_separation;
92 InsetQuotes::quote_language quotes_language;
94 InsetQuotes::quote_times quotes_times;
98 textclass_type textclass;
100 LyXTextClass const & getLyXTextClass() const;
102 /// returns the main font for the buffer (document)
103 LyXFont const getFont() const;
105 /* this are for the PaperLayout */
107 PAPER_SIZE papersize;
109 PAPER_ORIENTATION orientation;
110 /// use custom margins
113 std::string paperwidth;
115 std::string paperheight;
117 std::string leftmargin;
119 std::string topmargin;
121 std::string rightmargin;
123 std::string bottommargin;
125 std::string headheight;
129 std::string footskip;
131 /* some LaTeX options */
132 /// The graphics driver
133 std::string graphicsDriver;
135 std::string fontsRoman;
137 std::string fontsSans;
139 std::string fontsTypewriter;
140 /// the default family (rm, sf, tt)
141 std::string fontsDefaultFamily;
142 /// use expert Small Caps
144 /// use Old Style Figures
146 /// the scale factor of the sf font
148 /// the scale factor of the tt font
149 int fontsTypewriterScale;
152 Spacing const & spacing() const;
158 Language const * language;
160 BranchList & branchlist();
161 BranchList const & branchlist() const;
163 * The input encoding for LaTeX. This can be one of
164 * - \c auto: find out the input encoding from the used languages
165 * - \c default: ditto
166 * - any encoding supported by the inputenc package
167 * The encoding of the LyX file is always utf8 and has nothing to
168 * do with this setting.
169 * The difference between \c auto and \c default is that \c auto also
170 * causes loading of the inputenc package, while \c default does not.
171 * \c default will not work unless the user takes additional measures
172 * (such as using special environments like the CJK environment from
174 * \c default can be seen as an unspecified 8bit encoding, since LyX
175 * does not interpret it in any way apart from display on screen.
177 std::string inputenc;
178 /// The main encoding used by this buffer for LaTeX output.
179 /// Individual pieces of text can use different encodings.
180 Encoding const & encoding() const;
182 std::string preamble;
186 std::string float_placement;
188 unsigned int columns;
190 LyXTextClass::PageSides sides;
192 std::string pagestyle;
193 /// \param index should lie in the range 0 <= \c index <= 3.
194 Bullet & temp_bullet(size_type index);
195 Bullet const & temp_bullet(size_type index) const;
196 /// \param index should lie in the range 0 <= \c index <= 3.
197 Bullet & user_defined_bullet(size_type index);
198 Bullet const & user_defined_bullet(size_type index) const;
200 void readPreamble(LyXLex &);
202 void readLanguage(LyXLex &);
204 void readGraphicsDriver(LyXLex &);
206 void readBullets(LyXLex &);
208 void readBulletsLaTeX(LyXLex &);
210 /// Whether to load a package such as amsmath or esint.
211 /// The enum values must not be changed (file format!)
213 /// Don't load the package. For experts only.
215 /// Load the package if needed (recommended)
217 /// Always load the package (e.g. if the document contains
218 /// some ERT that needs the package)
221 /// Whether and how to load amsmath
223 /// Whether and how to load esint
227 /// revision tracking for this buffer ?
229 /** This param decides whether change tracking marks should be output
230 * (using the dvipost package) or if the current "state" of the
231 * document should be output instead. Since dvipost needs dvi
232 * specials, it only works with dvi/ps output (the param will be
233 * ignored with other output flavors and disabled when dvipost is
237 /// Time ago we agreed that this was a buffer property [ale990407]
238 std::string parentname;
242 /// the author list for the document
243 AuthorList & authors();
244 AuthorList const & authors() const;
246 /// map of the file's author IDs to buffer author IDs
247 std::vector<unsigned int> author_map;
249 std::string const dvips_options() const;
251 std::string const paperSizeName() const;
253 std::string const babelCall(std::string const & lang_opts) const;
254 /// set up the document fonts
255 std::string const loadFonts(std::string const & rm,
256 std::string const & sf, std::string const & tt,
257 bool const & sc, bool const & osf,
258 int const & sfscale, int const & ttscale) const;
259 /// path of the current buffer
260 std::string filepath;
261 /// get the appropriate cite engine (natbib handling)
262 biblio::CiteEngine getEngine() const;
265 void setCiteEngine(biblio::CiteEngine const);
268 /** Use the Pimpl idiom to hide those member variables that would otherwise
269 * drag in other header files.
274 static Impl * clone(Impl const *);
275 static void destroy(Impl *);
277 support::copied_ptr<Impl, MemoryTraits> pimpl_;
280 biblio::CiteEngine cite_engine_;