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 "lyxlayout_ptr_fwd.h"
22 #include "FloatList.h"
24 #include "support/types.h"
26 #include <boost/shared_ptr.hpp>
37 typedef std::vector<LyXLayout_ptr> LayoutList;
39 typedef LayoutList::const_iterator const_iterator;
42 LyXTextClass(string const & = string(),
43 string const & = string(),
44 string const & = string());
47 const_iterator begin() const { return layoutlist_.begin(); }
49 const_iterator end() const { return layoutlist_.end(); }
52 bool Read(string const & filename, bool merge = false);
54 void readOutputType(LyXLex &);
56 void readMaxCounter(LyXLex &);
58 void readClassOptions(LyXLex &);
60 void readFloat(LyXLex &);
62 void readCounter(LyXLex &);
64 bool hasLayout(string const & name) const;
67 LyXLayout_ptr const & operator[](string const & vname) const;
69 /// Sees to that the textclass structure has been loaded
72 /// the list of floats defined in the class
74 /// the list of floats defined in the class
75 FloatList const & floats() const;
76 /// The Counters present in this textclass.
77 Counters & counters() const;
79 string const & defaultLayoutName() const;
81 LyXLayout_ptr const & defaultLayout() const;
83 string const & name() const;
85 string const & latexname() const;
87 string const & description() const;
89 string const & opt_fontsize() const;
91 string const & opt_pagestyle() const;
93 string const & options() const;
95 string const & pagestyle() const;
97 string const & preamble() const;
99 /// Packages that are already loaded by the class
113 bool provides(Provides p) const;
116 unsigned int columns() const;
125 PageSides sides() const;
127 int secnumdepth() const;
129 int tocdepth() const;
132 OutputType outputType() const;
135 LyXFont const & defaultfont() const;
137 /// Text that dictates how wide the left margin is on the screen
138 string const & leftmargin() const;
140 /// Text that dictates how wide the right margin is on the screen
141 string const & rightmargin() const;
143 int maxcounter() const;
148 bool delete_layout(string const &);
150 bool do_readStyle(LyXLex &, LyXLayout &);
157 /// Specific class options
158 string opt_fontsize_;
160 string opt_pagestyle_;
166 string defaultlayout_;
172 unsigned int columns_;
180 OutputType outputType_;
181 /** Base font. The paragraph and layout fonts are resolved against
182 this font. This has to be fully instantiated. Attributes
183 LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
186 LyXFont defaultfont_;
187 /// Text that dictates how wide the left margin is on the screen
190 /// Text that dictates how wide the right margin is on the screen
193 int maxcounter_; // add approp. signedness
196 LayoutList layoutlist_;
199 FloatList floatlist_;
202 boost::shared_ptr<Counters> ctrs_;
204 /// Has this layout file been loaded yet?
211 void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
213 p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
218 std::ostream & operator<<(std::ostream & os, LyXTextClass::PageSides p);