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