]> git.lyx.org Git - lyx.git/blob - src/bufferparams.h
The Gtk patch.
[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 "LString.h"
19 #include "vspace.h"
20 #include "Spacing.h"
21 #include "Bullet.h"
22 #include "lyxtextclass.h"
23 #include "LaTeXFeatures.h"
24 #include "texrow.h"
25 #include "author.h"
26 #include "paper.h"
27 #include "BranchList.h"
28
29 #include "insets/insetquotes.h"
30
31 #include <boost/array.hpp>
32 #include <vector>
33
34 class LyXLex;
35 class LatexFeatures;
36 class TexRow;
37 struct Language;
38
39 /** Buffer parameters.
40    This class contains all the parameters for this a buffer uses. Some
41    work needs to be done on this class to make it nice. Now everything
42    is in public.
43 */
44 class BufferParams {
45 public:
46         ///
47         enum PARSEP {
48                 ///
49                 PARSEP_INDENT,
50                 ///
51                 PARSEP_SKIP
52         };
53         ///
54         BufferParams();
55
56         /// read a header token, if unrecognised, return it or an unknown class name
57         string const readToken(LyXLex & lex, string const & token);
58
59         ///
60         void writeFile(std::ostream &) const;
61
62         /** \returns true if the babel package is used (interogates
63             the BufferParams and a LyXRC variable).
64             This returned value can then be passed to the insets...
65          */
66         bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
67
68         ///
69         void setPaperStuff();
70
71         ///
72         void useClassDefaults();
73
74         ///
75         bool hasClassDefaults() const;
76
77         ///
78         VSpace const & getDefSkip() const { return defskip; }
79
80         ///
81         void setDefSkip(VSpace const & vs) { defskip = vs; }
82
83         /** Wether paragraphs are separated by using a indent like in
84           articles or by using a little skip like in letters.
85           */
86         PARSEP paragraph_separation;
87         ///
88         InsetQuotes::quote_language quotes_language;
89         ///
90         InsetQuotes::quote_times quotes_times;
91         ///
92         string fontsize;
93         ///
94         lyx::textclass_type textclass;
95         ///
96         LyXTextClass const & getLyXTextClass() const;
97
98         /* this are for the PaperLayout */
99         /// the general papersize (papersize2 or paperpackage
100         PAPER_SIZE papersize;
101         ///  the selected Geometry papersize
102         VMARGIN_PAPER_TYPE papersize2;
103         /// a special paperpackage .sty-file
104         PAPER_PACKAGES paperpackage;
105         ///
106         PAPER_ORIENTATION orientation;
107         ///
108         bool use_geometry;
109         ///
110         string paperwidth;
111         ///
112         string paperheight;
113         ///
114         string leftmargin;
115         ///
116         string topmargin;
117         ///
118         string rightmargin;
119         ///
120         string bottommargin;
121         ///
122         string headheight;
123         ///
124         string headsep;
125         ///
126         string footskip;
127
128         /* some LaTeX options */
129         /// The graphics driver
130         string graphicsDriver;
131         ///
132         string fonts;
133         ///
134         Spacing spacing;
135         ///
136         int secnumdepth;
137         ///
138         int tocdepth;
139         ///
140         Language const * language;
141         /// BranchList:
142         BranchList branchlist;
143         ///
144         string inputenc;
145         ///
146         string preamble;
147         ///
148         string options;
149         ///
150         string float_placement;
151         ///
152         unsigned int columns;
153         ///
154         LyXTextClass::PageSides sides;
155         ///
156         string pagestyle;
157         ///
158         boost::array<Bullet, 4> temp_bullets;
159         ///
160         boost::array<Bullet, 4> user_defined_bullets;
161         ///
162         void readPreamble(LyXLex &);
163         ///
164         void readLanguage(LyXLex &);
165         ///
166         void readGraphicsDriver(LyXLex &);
167
168         /// use AMS package, not, or auto
169         enum AMS {
170                 AMS_OFF,
171                 AMS_AUTO,
172                 AMS_ON
173         };
174         AMS use_amsmath;
175         ///
176         bool use_natbib;
177         ///
178         bool use_numerical_citations;
179         /// revision tracking for this buffer ?
180         bool tracking_changes;
181         /// Time ago we agreed that this was a buffer property [ale990407]
182         string parentname;
183         ///
184         bool compressed;
185
186         /// map of the file's author IDs to buffer author IDs
187         std::vector<int> author_map;
188         ///
189         string const dvips_options() const;
190         ///
191         string const paperSizeName() const;
192
193 private:
194         /// the author list
195         AuthorList authorlist;
196
197         ///
198         friend class Buffer;
199         /** This is the amount of space used for paragraph_separation "skip",
200           and for detached paragraphs in "indented" documents.
201         */
202         VSpace defskip;
203 };
204
205 #endif