]> git.lyx.org Git - lyx.git/blob - src/LaTeXFeatures.h
layout as string
[lyx.git] / src / LaTeXFeatures.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 LATEXFEATURES_H
13 #define LATEXFEATURES_H
14
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "support/types.h"
21
22 #include "LString.h"
23
24 #include <vector>
25 #include <set>
26 #include <list>
27 #include <map>
28
29 class BufferParams; 
30 struct Language;
31
32 /** The packages and commands that a buffer needs. This class
33     contains a list<string>.  Each of the LaTeX packages that a buffer needs
34     should be added with void require(string const & name).
35
36     i.e require("amssymb")
37
38     To add support you should only need to require() the package name as 
39     packages which don't have special requirements are handled automatically.
40     If your new package does need special consideration you'll need to alter
41     string const getPackages() const;
42     Remember to update the validate function in buffer.C and paragraph.C 
43     when you do so.
44 */
45 class LaTeXFeatures {
46 public:
47         ///
48         LaTeXFeatures(BufferParams const &);
49         /// The packages needed by the document
50         string const getPackages() const;
51         /// The macros definitions needed by the document
52         string const getMacros() const;
53         /// The definitions needed by the document's textclass
54         string const getTClassPreamble() const;
55         /// The sgml definitions needed by the document (dobook/linuxdoc)
56         string const getLyXSGMLEntities() const;
57         /// The SGML Required to include the files added with includeFile();
58         string const getIncludedFiles(string const & fname) const;
59         /// Include a file for use with the SGML entities
60         void includeFile(string const & key, string const & name);
61         /// The float definitions.
62         void getFloatDefinitions(std::ostream & os) const;
63         /// Print requirements to lyxerr
64         void showStruct() const;
65         /// 
66         void addExternalPreamble(string const &);
67         /// Provide a string name-space to the requirements
68         void require(string const & name);
69         /// Is the package required?
70         bool isRequired(string const & name) const;
71         ///
72         void useFloat(string const & name);
73         ///
74         void useLanguage(Language const *);
75         ///
76         bool hasLanguages();
77         ///
78         string getLanguages() const;
79         ///
80         std::set<string> getEncodingSet(string const & doc_encoding);
81         ///
82         void useLayout(string const & lyt);
83         ///
84         BufferParams const & bufferParams() const;
85         ///
86
87 private:
88         string externalPreambles;
89
90         std::set<string> layout;
91
92         /// Static preamble bits from the external material insets
93
94
95         typedef std::list<string> FeaturesList;
96         ///
97         FeaturesList features;
98         ///
99         typedef std::set<Language const *> LanguageList;
100         ///
101         LanguageList UsedLanguages;
102         ///
103         typedef std::set<string> UsedFloats;
104         ///
105         UsedFloats usedFloats;
106         ///
107         typedef std::map<string , string> FileMap;
108         ///
109         FileMap IncludedFiles;
110         ///
111         ///
112         BufferParams const & params;
113 };
114
115 #endif