]> git.lyx.org Git - lyx.git/blob - src/bufferparams.h
Alfredo's second patch
[lyx.git] / src / bufferparams.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef BUFFERPARAMS_H
13 #define BUFFERPARAMS_H
14
15 #include "LString.h"
16 #include "vspace.h"
17 #include "Spacing.h"
18 #include "Bullet.h"
19 #include "lyxtextclass.h"
20 #include "LaTeXFeatures.h"
21 #include "texrow.h"
22 #include "author.h"
23
24 #include "insets/insetquotes.h"
25
26 #include <boost/array.hpp>
27 #include <vector>
28
29 class LyXLex;
30 class LatexFeatures;
31 class TexRow;
32 struct Language;
33
34 /** Buffer parameters.
35    This class contains all the parameters for this a buffer uses. Some
36    work needs to be done on this class to make it nice. Now everything
37    is in public.
38 */
39 class BufferParams {
40 public:
41         ///
42         enum PAPER_SIZE {
43                 ///
44                 PAPER_DEFAULT,
45                 ///
46                 PAPER_USLETTER,
47                 ///
48                 PAPER_LEGALPAPER,
49                 ///
50                 PAPER_EXECUTIVEPAPER,
51                 ///
52                 PAPER_A3PAPER,
53                 ///
54                 PAPER_A4PAPER,
55                 ///
56                 PAPER_A5PAPER,
57                 ///
58                 PAPER_B5PAPER
59         };
60         ///
61         enum PAPER_PACKAGES {
62                 ///
63                 PACKAGE_NONE,
64                 ///
65                 PACKAGE_A4,
66                 ///
67                 PACKAGE_A4WIDE,
68                 ///
69                 PACKAGE_WIDEMARGINSA4
70         };
71         ///
72         enum VMARGIN_PAPER_TYPE {
73                 ///
74                 VM_PAPER_DEFAULT,
75                 ///
76                 VM_PAPER_CUSTOM,
77                 ///
78                 VM_PAPER_USLETTER,
79                 ///
80                 VM_PAPER_USLEGAL,
81                 ///
82                 VM_PAPER_USEXECUTIVE,
83                 ///
84                 VM_PAPER_A3,
85                 ///
86                 VM_PAPER_A4,
87                 ///
88                 VM_PAPER_A5,
89                 ///
90                 VM_PAPER_B3,
91                 ///
92                 VM_PAPER_B4,
93                 ///
94                 VM_PAPER_B5
95         };
96         ///
97         enum PARSEP {
98                 ///
99                 PARSEP_INDENT,
100                 ///
101                 PARSEP_SKIP
102         };
103         ///
104         enum PAPER_ORIENTATION {
105                 ///
106                 ORIENTATION_PORTRAIT,
107                 ///
108                 ORIENTATION_LANDSCAPE
109         };
110         ///
111         BufferParams();
112
113         /// read a header token, if unrecognised, return it or an unknown class name
114         string const readToken(LyXLex & lex, string const & token);
115
116         ///
117         void writeFile(std::ostream &) const;
118
119         ///
120         void writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
121
122         ///
123         void setPaperStuff();
124
125         ///
126         void useClassDefaults();
127
128         ///
129         bool hasClassDefaults() const;
130
131         ///
132         VSpace const & getDefSkip() const { return defskip; }
133
134         ///
135         void setDefSkip(VSpace const & vs) { defskip = vs; }
136
137         /** Wether paragraphs are separated by using a indent like in
138           articles or by using a little skip like in letters.
139           */
140         PARSEP paragraph_separation;
141         ///
142         InsetQuotes::quote_language quotes_language;
143         ///
144         InsetQuotes::quote_times quotes_times;
145         ///
146         string fontsize;
147         ///
148         lyx::textclass_type textclass;
149         ///
150         LyXTextClass const & getLyXTextClass() const;
151
152         /* this are for the PaperLayout */
153         /// the general papersize (papersize2 or paperpackage
154         char papersize; // add apprip. signedness
155         ///  the selected Geometry papersize
156         char papersize2; // add approp. signedness
157         /// a special paperpackage .sty-file
158         char paperpackage; // add approp. signedness
159         ///
160         PAPER_ORIENTATION orientation; // add approp. signedness
161         ///
162         bool use_geometry;
163         ///
164         string paperwidth;
165         ///
166         string paperheight;
167         ///
168         string leftmargin;
169         ///
170         string topmargin;
171         ///
172         string rightmargin;
173         ///
174         string bottommargin;
175         ///
176         string headheight;
177         ///
178         string headsep;
179         ///
180         string footskip;
181
182         /* some LaTeX options */
183         /// The graphics driver
184         string graphicsDriver;
185         ///
186         string fonts;
187         ///
188         Spacing spacing;
189         ///
190         int secnumdepth;
191         ///
192         int tocdepth;
193         ///
194         Language const * language;
195         ///
196         string inputenc;
197         ///
198         string preamble;
199         ///
200         string options;
201         ///
202         string float_placement;
203         ///
204         unsigned int columns;
205         ///
206         LyXTextClass::PageSides sides;
207         ///
208         string pagestyle;
209         ///
210         boost::array<Bullet, 4> temp_bullets;
211         ///
212         boost::array<Bullet, 4> user_defined_bullets;
213         ///
214         void readPreamble(LyXLex &);
215         ///
216         void readLanguage(LyXLex &);
217         ///
218         void readGraphicsDriver(LyXLex &);
219
220         /// use AMS package, not, or auto
221         enum AMS {
222                 AMS_OFF,
223                 AMS_AUTO,
224                 AMS_ON
225         };
226         AMS use_amsmath;
227         ///
228         bool use_natbib;
229         ///
230         bool use_numerical_citations;
231         /// revision tracking for this buffer ?
232         bool tracking_changes;
233         /// Time ago we agreed that this was a buffer property [ale990407]
234         string parentname;
235
236         /// map of the file's author IDs to buffer author IDs
237         std::vector<int> author_map;
238
239 private:
240         /// the author list
241         AuthorList authorlist;
242
243         ///
244         friend class Buffer;
245         /** This is the amount of space used for paragraph_separation "skip",
246           and for detached paragraphs in "indented" documents.
247         */
248         VSpace defskip;
249 };
250
251 #endif