]> git.lyx.org Git - lyx.git/blob - src/LaTeXFeatures.h
cleanup some debug messages
[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 class 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         /// Which of the required packages are installed?
66         static void getAvailable();
67         /// Is the package required?
68         bool isRequired(std::string const & name) const;
69         /// Is the (required) package available?
70         bool isAvailable(std::string const & name) const;
71         ///
72         void useFloat(std::string const & name);
73         ///
74         void useLanguage(Language const *);
75         ///
76         bool hasLanguages() const;
77         ///
78         std::string getLanguages() const;
79         ///
80         std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
81         ///
82         void useLayout(std::string const & lyt);
83         ///
84         Buffer const & buffer() const;
85         ///
86         void setBuffer(Buffer const &);
87         ///
88         BufferParams const & bufferParams() const;
89         /// the return value is dependent upon both LyXRC and LaTeXFeatures.
90         bool useBabel() const;
91         ///
92         bool nice() const { return nice_; };
93
94 private:
95         std::list<std::string> usedLayouts_;
96
97         /// Static preamble bits from the external material insets
98         typedef std::list<std::string> FeaturesList;
99         ///
100         FeaturesList features_;
101         ///
102         FeaturesList preamble_snippets_;
103         /// The available (required) packages
104         typedef std::list<std::string> PackagesList;
105         ///
106         static PackagesList packages_;
107         ///
108         typedef std::set<Language const *> LanguageList;
109         ///
110         LanguageList UsedLanguages_;
111         ///
112         typedef std::set<std::string> UsedFloats;
113         ///
114         UsedFloats usedFloats_;
115         ///
116         typedef std::map<std::string , std::string> FileMap;
117         ///
118         FileMap IncludedFiles_;
119         /** Buffer of the file being processed.
120          *  This may be a child buffer of the to-be-exported file and
121          *  therefore may not be the buffer that belongs to params_.
122          *  Only needed by InsetInclude::validate().
123          */
124         Buffer const * buffer_;
125         ///
126         BufferParams const & params_;
127         /** If we are writing a nice LaTeX file or not.
128          *  Only needed by InsetInclude::validate().
129          */
130         bool nice_;
131 };
132
133 #endif