]> git.lyx.org Git - lyx.git/blob - src/bufferparams.h
Fix bug 886 and others not reported related with the document paper size.
[lyx.git] / src / bufferparams.h
1 // -*- C++ -*-
2 /**
3  * \file bufferparams.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef BUFFERPARAMS_H
16 #define BUFFERPARAMS_H
17
18 #include "lyxtextclass.h"
19 #include "paper.h"
20
21 #include "insets/insetquotes.h"
22
23 #include "support/copied_ptr.h"
24 #include "support/types.h"
25
26 #include <vector>
27
28
29 class AuthorList;
30 class BranchList;
31 class Bullet;
32 class LyXLex;
33 class LatexFeatures;
34 class Spacing;
35 class TexRow;
36 class VSpace;
37 class Language;
38
39
40 namespace lyx {
41 namespace biblio {
42
43 enum CiteEngine {
44         ENGINE_BASIC,
45         ENGINE_NATBIB_AUTHORYEAR,
46         ENGINE_NATBIB_NUMERICAL,
47         ENGINE_JURABIB
48 };
49
50 class CiteEngine_enum {
51         CiteEngine val_;
52 public:
53         CiteEngine_enum(CiteEngine val) : val_(val) {}
54         operator CiteEngine() const{ return val_; }
55 };
56
57 } // namespace biblio
58 } // namespace lyx
59
60
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
64  *  is in public.
65  */
66 class BufferParams {
67 public:
68         ///
69         enum PARSEP {
70                 ///
71                 PARSEP_INDENT,
72                 ///
73                 PARSEP_SKIP
74         };
75         ///
76         BufferParams();
77         ~BufferParams();
78
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);
81
82         ///
83         void writeFile(std::ostream &) const;
84
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...
88          */
89         bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
90
91         ///
92         void useClassDefaults();
93
94         ///
95         bool hasClassDefaults() const;
96
97         ///
98         VSpace const & getDefSkip() const;
99
100         ///
101         void setDefSkip(VSpace const & vs);
102
103         /** Wether paragraphs are separated by using a indent like in
104          *  articles or by using a little skip like in letters.
105          */
106         PARSEP paragraph_separation;
107         ///
108         InsetQuotes::quote_language quotes_language;
109         ///
110         InsetQuotes::quote_times quotes_times;
111         ///
112         std::string fontsize;
113         ///
114         lyx::textclass_type textclass;
115         ///
116         LyXTextClass const & getLyXTextClass() const;
117
118         /* this are for the PaperLayout */
119         /// the papersize
120         PAPER_SIZE papersize;
121         /// a special paperpackage .sty-file
122         PAPER_PACKAGES paperpackage;
123         ///
124         PAPER_ORIENTATION orientation;
125         /// use custom margins
126         bool use_geometry;
127         ///
128         std::string paperwidth;
129         ///
130         std::string paperheight;
131         ///
132         std::string leftmargin;
133         ///
134         std::string topmargin;
135         ///
136         std::string rightmargin;
137         ///
138         std::string bottommargin;
139         ///
140         std::string headheight;
141         ///
142         std::string headsep;
143         ///
144         std::string footskip;
145
146         /* some LaTeX options */
147         /// The graphics driver
148         std::string graphicsDriver;
149         ///
150         std::string fonts;
151         ///
152         Spacing & spacing();
153         Spacing const & spacing() const;
154         ///
155         int secnumdepth;
156         ///
157         int tocdepth;
158         ///
159         Language const * language;
160         /// BranchList:
161         BranchList & branchlist();
162         BranchList const & branchlist() const;
163         ///
164         std::string inputenc;
165         ///
166         std::string preamble;
167         ///
168         std::string options;
169         ///
170         std::string float_placement;
171         ///
172         unsigned int columns;
173         ///
174         LyXTextClass::PageSides sides;
175         ///
176         std::string pagestyle;
177         /// \param index should lie in the range 0 <= \c index <= 3.
178         Bullet & temp_bullet(lyx::size_type index);
179         Bullet const & temp_bullet(lyx::size_type index) const;
180         /// \param index should lie in the range 0 <= \c index <= 3.
181         Bullet & user_defined_bullet(lyx::size_type index);
182         Bullet const & user_defined_bullet(lyx::size_type index) const;
183         ///
184         void readPreamble(LyXLex &);
185         ///
186         void readLanguage(LyXLex &);
187         ///
188         void readGraphicsDriver(LyXLex &);
189         ///
190         void readBullets(LyXLex &);
191         ///
192         void readBulletsLaTeX(LyXLex &);
193
194         /// use AMS package, not, or auto
195         enum AMS {
196                 AMS_OFF,
197                 AMS_AUTO,
198                 AMS_ON
199         };
200         AMS use_amsmath;
201         ///
202         lyx::biblio::CiteEngine cite_engine;
203         ///
204         bool use_bibtopic;
205         /// revision tracking for this buffer ?
206         bool tracking_changes;
207         /** This param decides if change tracking marks should be output
208          *  (using the dvipost package) or if the current "state" of the
209          *  document should be output instead. Since dvipost needs dvi
210          *  specials, it only works with dvi/ps output (the param will be
211          *  ignored with other output flavors and disabled when dbipost is
212          *  not installed).
213          */
214         bool output_changes;
215         /// Time ago we agreed that this was a buffer property [ale990407]
216         std::string parentname;
217         ///
218         bool compressed;
219
220         /// the author list for the document
221         AuthorList & authors();
222         AuthorList const & authors() const;
223
224         /// map of the file's author IDs to buffer author IDs
225         std::vector<int> author_map;
226         ///
227         std::string const dvips_options() const;
228         ///
229         std::string const paperSizeName() const;
230         ///
231         std::string const babelCall(std::string const & lang_opts) const;
232
233 private:
234         /** Use the Pimpl idiom to hide those member variables that would otherwise
235          *  drag in other header files.
236          */
237         class Impl;
238         class MemoryTraits {
239         public:
240                 static Impl * clone(Impl const *);
241                 static void destroy(Impl *);
242         };
243         lyx::support::copied_ptr<Impl, MemoryTraits> pimpl_;
244 };
245
246 #endif