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