]> git.lyx.org Git - lyx.git/blob - src/lyxtextclasslist.h
bug 183
[lyx.git] / src / lyxtextclasslist.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 LYXTEXTCLASSLIST_H
13 #define LYXTEXTCLASSLIST_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "support/types.h"
20
21 #include <boost/utility.hpp>
22
23 #include "LString.h"
24
25 #include <vector>
26
27 class LyXTextClass;
28 class LyXLayout;
29
30 /// Reads the style files
31 extern void LyXSetStyle();
32
33 ///
34 class LyXTextClassList : boost::noncopyable {
35 public:
36         ///
37         typedef std::vector<LyXTextClass> ClassList;
38         ///
39         typedef ClassList::const_iterator const_iterator;
40         ///
41         const_iterator begin() const { return classlist.begin(); }
42         ///
43         const_iterator end() const { return classlist.end(); }
44         
45         /// Gets layout structure from layout number and textclass number
46         LyXLayout const & Style(lyx::textclass_type textclass,
47                                 lyx::layout_type layout) const;
48
49         /// Gets layout number from textclass number and layout name
50         std::pair<bool, lyx::layout_type> const
51         NumberOfLayout(lyx::textclass_type textclass, string const & name) const;
52
53         /// Gets a layout name from layout number and textclass number
54         string const &
55         NameOfLayout(lyx::textclass_type textclass, lyx::layout_type layout) const;
56
57         /** Gets textclass number from name.
58             Returns -1 if textclass name does not exist
59         */
60         std::pair<bool, lyx::textclass_type> const
61         NumberOfClass(string const & textclass) const;
62
63         ///
64         string const & NameOfClass(lyx::textclass_type number) const;
65
66         ///
67         string const & LatexnameOfClass(lyx::textclass_type number) const;
68
69         ///
70         string const & DescOfClass(lyx::textclass_type number) const;
71
72         ///
73         LyXTextClass const & TextClass(lyx::textclass_type textclass) const;
74
75         /** Read textclass list.
76             Returns false if this fails
77         */
78         bool Read();
79
80         /** Load textclass.
81             Returns false if this fails
82         */
83         bool Load(lyx::textclass_type number) const;
84 private:
85         ///
86         mutable ClassList classlist;
87         ///
88         void Add (LyXTextClass const &);
89 };
90
91 /// 
92 extern LyXTextClassList textclasslist;
93
94 #endif