]> git.lyx.org Git - lyx.git/blob - src/LaTeXFeatures.h
c3d62de312b60008994785b162e7b917d799c597
[lyx.git] / src / LaTeXFeatures.h
1 // -*- C++ -*-
2 /**
3  * \file LaTeXFeatures.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef LATEXFEATURES_H
14 #define LATEXFEATURES_H
15
16
17 #include <set>
18 #include <list>
19 #include <map>
20 #include <string>
21
22 class Buffer;
23 class BufferParams;
24 struct Language;
25
26 /** The packages and commands that a buffer needs. This class
27     contains a list<string>.  Each of the LaTeX packages that a buffer needs
28     should be added with void require(string const & name).
29
30     i.e require("amssymb")
31
32     To add support you should only need to require() the package name as
33     packages which don't have special requirements are handled automatically.
34     If your new package does need special consideration you'll need to alter
35     string const getPackages() const;
36     Remember to update the validate function in buffer.C and paragraph.C
37     when you do so.
38 */
39 class LaTeXFeatures {
40 public:
41         ///
42         LaTeXFeatures(Buffer const &, BufferParams const &, bool);
43         /// The packages needed by the document
44         std::string const getPackages() const;
45         /// The macros definitions needed by the document
46         std::string const getMacros() const;
47         ///
48         std::string const getBabelOptions() const;
49         /// The definitions needed by the document's textclass
50         std::string const getTClassPreamble() const;
51         /// The sgml definitions needed by the document (dobook/linuxdoc)
52         std::string const getLyXSGMLEntities() const;
53         /// The SGML Required to include the files added with includeFile();
54         std::string const getIncludedFiles(std::string const & fname) const;
55         /// Include a file for use with the SGML entities
56         void includeFile(std::string const & key, std::string const & name);
57         /// The float definitions.
58         void getFloatDefinitions(std::ostream & os) const;
59         /// Print requirements to lyxerr
60         void showStruct() const;
61         ///
62         void addExternalPreamble(std::string const &);
63         /// Provide a string name-space to the requirements
64         void require(std::string const & name);
65         /// Is the package required?
66         bool isRequired(std::string const & name) const;
67         ///
68         void useFloat(std::string const & name);
69         ///
70         void useLanguage(Language const *);
71         ///
72         bool hasLanguages() const;
73         ///
74         std::string getLanguages() const;
75         ///
76         std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
77         ///
78         void useLayout(std::string const & lyt);
79         ///
80         Buffer const & buffer() const;
81         ///
82         BufferParams const & bufferParams() const;
83         /// the return value is dependent upon both LyXRC and LaTeXFeatures.
84         bool useBabel() const;
85         ///
86         bool nice() const { return nice_; };
87
88 private:
89         std::list<std::string> usedLayouts_;
90
91         /// Static preamble bits from the external material insets
92         typedef std::list<std::string> FeaturesList;
93         ///
94         FeaturesList features_;
95         ///
96         FeaturesList preamble_snippets_;
97         ///
98         typedef std::set<Language const *> LanguageList;
99         ///
100         LanguageList UsedLanguages_;
101         ///
102         typedef std::set<std::string> UsedFloats;
103         ///
104         UsedFloats usedFloats_;
105         ///
106         typedef std::map<std::string , std::string> FileMap;
107         ///
108         FileMap IncludedFiles_;
109         ///
110         Buffer const & buffer_;
111         ///
112         BufferParams const & params_;
113         /** If we are writing a nice LaTeX file or not.
114          *  Only needed by InsetInclude::validate().
115          */
116         bool nice_;
117 };
118
119 #endif