]> git.lyx.org Git - lyx.git/blob - src/lyxtextclass.h
Look for mathed xpms. Doesn't do anything yet due to lack of workable XPMs
[lyx.git] / src / lyxtextclass.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 LYXTEXTCLASS_H
13 #define LYXTEXTCLASS_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "lyxlayout.h"
20 #include "LString.h"
21 #include "lyxlayout_ptr_fwd.h"
22 #include "FloatList.h"
23
24 #include "support/types.h"
25
26 #include <vector>
27
28 class LyXLex;
29
30 ///
31 class LyXTextClass {
32 public:
33         ///
34         typedef std::vector<LyXLayout_ptr> LayoutList;
35         ///
36         typedef LayoutList::const_iterator const_iterator;
37         ///
38         explicit
39         LyXTextClass (string const & = string(),
40                       string const & = string(),
41                       string const & = string());
42
43         ///
44         const_iterator begin() const { return layoutlist_.begin(); }
45         ///
46         const_iterator end() const { return layoutlist_.end(); }
47
48         ///
49         bool Read(string const & filename, bool merge = false);
50         ///
51         void readOutputType(LyXLex &);
52         ///
53         void readMaxCounter(LyXLex &);
54         ///
55         void readClassOptions(LyXLex &);
56         ///
57         bool hasLayout(string const & name) const;
58
59         ///
60         LyXLayout_ptr const & operator[](string const & vname) const;
61
62         /// Sees to that the textclass structure has been loaded
63         bool load() const;
64
65         /// the list of floats defined in the class
66         FloatList & floats();
67         /// the list of floats defined in the class
68         FloatList const & floats() const;
69
70         ///
71         string const defaultLayoutName() const;
72         ///
73         LyXLayout_ptr const & defaultLayout() const;
74         ///
75         string const & name() const;
76         ///
77         string const & latexname() const;
78         ///
79         string const & description() const;
80         ///
81         string const & opt_fontsize() const;
82         ///
83         string const & opt_pagestyle() const;
84         ///
85         string const & options() const;
86         ///
87         string const & pagestyle() const;
88         ///
89         string const & preamble() const;
90
91         /// Packages that are already loaded by the class
92         enum Provides {
93                 ///
94                 nothing = 0,
95                 ///
96                 amsmath = 1,
97                 ///
98                 makeidx = 2,
99                 ///
100                 url = 4,
101                 ///
102                 natbib = 8
103         };
104         ///
105         bool provides(Provides p) const;
106
107         ///
108         unsigned int columns() const;
109         ///
110         enum PageSides {
111                 ///
112                 OneSide,
113                 ///
114                 TwoSides
115         };
116         ///
117         PageSides sides() const;
118         ///
119         int secnumdepth() const;
120         ///
121         int tocdepth() const;
122
123         ///
124         OutputType outputType() const;
125
126         ///
127         LyXFont const & defaultfont() const;
128
129         /// Text that dictates how wide the left margin is on the screen
130         string const & leftmargin() const;
131
132         /// Text that dictates how wide the right margin is on the screen
133         string const & rightmargin() const;
134         ///
135         int maxcounter() const;
136         ///
137         int size() const;
138 private:
139         ///
140         bool delete_layout(string const &);
141         ///
142         bool do_readStyle(LyXLex &, LyXLayout &);
143         ///
144         string name_;
145         ///
146         string latexname_;
147         ///
148         string description_;
149         /// Specific class options
150         string opt_fontsize_;
151         ///
152         string opt_pagestyle_;
153         ///
154         string options_;
155         ///
156         string pagestyle_;
157         ///
158         string defaultlayout_;
159         ///
160         string preamble_;
161         ///
162         Provides provides_;
163         ///
164         unsigned int columns_;
165         ///
166         PageSides sides_;
167         ///
168         int secnumdepth_;
169         ///
170         int tocdepth_;
171         ///
172         OutputType outputType_;
173         /** Base font. The paragraph and layout fonts are resolved against
174             this font. This has to be fully instantiated. Attributes
175             LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
176             extremely illegal.
177         */
178         LyXFont defaultfont_;
179         /// Text that dictates how wide the left margin is on the screen
180         string leftmargin_;
181
182         /// Text that dictates how wide the right margin is on the screen
183         string rightmargin_;
184         ///
185         int maxcounter_; // add approp. signedness
186
187         ///
188         LayoutList layoutlist_;
189
190         ///
191         FloatList floatlist_;
192
193         /// Has this layout file been loaded yet?
194         mutable bool loaded;
195 };
196
197
198 ///
199 inline
200 void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
201 {
202         p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
203 }
204
205
206 ///
207 std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);
208
209 #endif