2 /* This file is part of
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2001 The LyX Team.
10 * ====================================================== */
12 #ifndef LYXTEXTCLASS_H
13 #define LYXTEXTCLASS_H
19 #include "lyxlayout.h"
21 #include "support/types.h"
35 typedef std::vector<LyXLayout> LayoutList;
37 typedef LayoutList::const_iterator const_iterator;
40 LyXTextClass (string const & = string(),
41 string const & = string(),
42 string const & = string());
45 const_iterator begin() const { return layoutlist.begin(); }
47 const_iterator end() const { return layoutlist.end(); }
50 bool Read(string const & filename, bool merge = false);
52 void readOutputType(LyXLex &);
54 void readMaxCounter(LyXLex &);
56 void readClassOptions(LyXLex &);
58 bool hasLayout(string const & name) const;
61 LyXLayout const & GetLayout(string const & vname) const;
64 LyXLayout & GetLayout(string const & vname);
66 /// Sees to that the textclass structure has been loaded
70 string const & name() const { return name_; }
72 string const & latexname() const { return latexname_; }
74 string const & description() const { return description_; }
76 string const & opt_fontsize() const { return opt_fontsize_; }
78 string const & opt_pagestyle() const { return opt_pagestyle_; }
80 string const & options() const { return options_; }
82 string const & pagestyle() const { return pagestyle_; }
84 string const & preamble() const { return preamble_; }
86 /// Packages that are already loaded by the class
98 bool provides(Provides p) const { return provides_ & p; }
101 unsigned int columns() const { return columns_; }
110 PageSides sides() const { return sides_; }
112 int secnumdepth() const { return secnumdepth_; }
114 int tocdepth() const { return tocdepth_; }
117 OutputType outputType() const { return outputType_; }
120 LyXFont const & defaultfont() const;
122 /// Text that dictates how wide the left margin is on the screen
123 string const & leftmargin() const;
125 /// Text that dictates how wide the right margin is on the screen
126 string const & rightmargin() const;
128 int maxcounter() const { return maxcounter_; }
130 lyx::layout_type numLayouts() const { return layoutlist.size(); }
132 LyXLayout const & operator[](lyx::layout_type i) const {
133 return layoutlist[i];
137 bool delete_layout(string const &);
139 bool do_readStyle(LyXLex &, LyXLayout &);
146 /// Specific class options
147 string opt_fontsize_;
149 string opt_pagestyle_;
159 unsigned int columns_;
167 OutputType outputType_;
168 /** Base font. The paragraph and layout fonts are resolved against
169 this font. This has to be fully instantiated. Attributes
170 LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
173 LyXFont defaultfont_;
174 /// Text that dictates how wide the left margin is on the screen
177 /// Text that dictates how wide the right margin is on the screen
180 int maxcounter_; // add approp. signedness
183 LayoutList layoutlist;
185 /// Has this layout file been loaded yet?
191 void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
193 p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
198 std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);