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