]> git.lyx.org Git - lyx.git/blob - src/bufferparams.h
fix arabtex-related problems (bug 1225 and bug 1404)
[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 struct Language;
38
39
40 /** Buffer parameters.
41  *  This class contains all the parameters for this a buffer uses. Some
42  *  work needs to be done on this class to make it nice. Now everything
43  *  is in public.
44  */
45 class BufferParams {
46 public:
47         ///
48         enum PARSEP {
49                 ///
50                 PARSEP_INDENT,
51                 ///
52                 PARSEP_SKIP
53         };
54         ///
55         BufferParams();
56         ~BufferParams();
57
58         /// read a header token, if unrecognised, return it or an unknown class name
59         std::string const readToken(LyXLex & lex, std::string const & token);
60
61         ///
62         void writeFile(std::ostream &) const;
63
64         /** \returns true if the babel package is used (interogates
65          *  the BufferParams and a LyXRC variable).
66          *  This returned value can then be passed to the insets...
67          */
68         bool writeLaTeX(std::ostream &, LaTeXFeatures &, TexRow &) const;
69
70         ///
71         void setPaperStuff();
72
73         ///
74         void useClassDefaults();
75
76         ///
77         bool hasClassDefaults() const;
78
79         ///
80         VSpace const & getDefSkip() const;
81
82         ///
83         void setDefSkip(VSpace const & vs);
84
85         /** Wether paragraphs are separated by using a indent like in
86          *  articles or by using a little skip like in letters.
87          */
88         PARSEP paragraph_separation;
89         ///
90         InsetQuotes::quote_language quotes_language;
91         ///
92         InsetQuotes::quote_times quotes_times;
93         ///
94         std::string fontsize;
95         ///
96         lyx::textclass_type textclass;
97         ///
98         LyXTextClass const & getLyXTextClass() const;
99
100         /* this are for the PaperLayout */
101         /// the general papersize (papersize2 or paperpackage
102         PAPER_SIZE papersize;
103         ///  the selected Geometry papersize
104         VMARGIN_PAPER_TYPE papersize2;
105         /// a special paperpackage .sty-file
106         PAPER_PACKAGES paperpackage;
107         ///
108         PAPER_ORIENTATION orientation;
109         ///
110         bool use_geometry;
111         ///
112         std::string paperwidth;
113         ///
114         std::string paperheight;
115         ///
116         std::string leftmargin;
117         ///
118         std::string topmargin;
119         ///
120         std::string rightmargin;
121         ///
122         std::string bottommargin;
123         ///
124         std::string headheight;
125         ///
126         std::string headsep;
127         ///
128         std::string footskip;
129
130         /* some LaTeX options */
131         /// The graphics driver
132         std::string graphicsDriver;
133         ///
134         std::string fonts;
135         ///
136         Spacing & spacing();
137         Spacing const & spacing() const;
138         ///
139         int secnumdepth;
140         ///
141         int tocdepth;
142         ///
143         Language const * language;
144         /// BranchList:
145         BranchList & branchlist();
146         BranchList const & branchlist() const;
147         ///
148         std::string inputenc;
149         ///
150         std::string preamble;
151         ///
152         std::string options;
153         ///
154         std::string float_placement;
155         ///
156         unsigned int columns;
157         ///
158         LyXTextClass::PageSides sides;
159         ///
160         std::string pagestyle;
161         /// \param index should lie in the range 0 <= \c index <= 3.
162         Bullet & temp_bullet(lyx::size_type index);
163         Bullet const & temp_bullet(lyx::size_type index) const;
164         /// \param index should lie in the range 0 <= \c index <= 3.
165         Bullet & user_defined_bullet(lyx::size_type index);
166         Bullet const & user_defined_bullet(lyx::size_type index) const;
167         ///
168         void readPreamble(LyXLex &);
169         ///
170         void readLanguage(LyXLex &);
171         ///
172         void readGraphicsDriver(LyXLex &);
173
174         /// use AMS package, not, or auto
175         enum AMS {
176                 AMS_OFF,
177                 AMS_AUTO,
178                 AMS_ON
179         };
180         AMS use_amsmath;
181         ///
182         bool use_natbib;
183         ///
184         bool use_numerical_citations;
185         ///
186         bool use_jurabib;
187         ///
188         bool use_bibtopic;
189         /// revision tracking for this buffer ?
190         bool tracking_changes;
191         /// Time ago we agreed that this was a buffer property [ale990407]
192         std::string parentname;
193         ///
194         bool compressed;
195
196         /// the author list for the document
197         AuthorList & authors();
198         AuthorList const & authors() const;
199
200         /// map of the file's author IDs to buffer author IDs
201         std::vector<int> author_map;
202         ///
203         std::string const dvips_options() const;
204         ///
205         std::string const paperSizeName() const;
206         ///
207         std::string const babelCall(std::string const & lang_opts) const;
208
209 private:
210         /** Use the Pimpl idiom to hide those member variables that would otherwise
211          *  drag in other header files.
212          */
213         class Impl;
214         struct MemoryTraits {
215                 static Impl * clone(Impl const *);
216                 static void destroy(Impl *);
217         };
218         lyx::support::copied_ptr<Impl, MemoryTraits> pimpl_;
219 };
220
221 #endif