]> git.lyx.org Git - lyx.git/blob - src/LaTeXFeatures.h
update build instructions (Qt 4.2.2 etc.)
[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 "outputparams.h"
18 #include "support/docstring.h"
19
20 #include <set>
21 #include <list>
22 #include <map>
23 #include <string>
24
25
26 namespace lyx {
27
28 class Buffer;
29 class BufferParams;
30 class 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(Buffer const &, BufferParams const &,
49                       OutputParams const &);
50         /// The packages needed by the document
51         std::string const getPackages() const;
52         /// The macros definitions needed by the document
53         std::string const getMacros() const;
54         ///
55         std::string const getBabelOptions() const;
56         /// The definitions needed by the document's textclass
57         docstring const getTClassPreamble() const;
58         /// The sgml definitions needed by the document (docbook)
59         docstring const getLyXSGMLEntities() const;
60         /// The SGML Required to include the files added with includeFile();
61         docstring const getIncludedFiles(std::string const & fname) const;
62         /// Include a file for use with the SGML entities
63         void includeFile(docstring const & key, std::string const & name);
64         /// The float definitions.
65         void getFloatDefinitions(std::ostream & os) const;
66         /// Print requirements to lyxerr
67         void showStruct() const;
68         ///
69         void addPreambleSnippet(std::string const &);
70         /// Provide a string name-space to the requirements
71         void require(std::string const & name);
72         /// Which of the required packages are installed?
73         static void getAvailable();
74         /// Is the package required?
75         bool isRequired(std::string const & name) const;
76         /// Is the (required) package available?
77         bool isAvailable(std::string const & name) const;
78         ///
79         void useFloat(std::string const & name);
80         ///
81         void useLanguage(Language const *);
82         ///
83         bool hasLanguages() const;
84         ///
85         std::string getLanguages() const;
86         ///
87         std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
88         ///
89         void useLayout(std::string const & lyt);
90         ///
91         Buffer const & buffer() const;
92         ///
93         void setBuffer(Buffer const &);
94         ///
95         BufferParams const & bufferParams() const;
96         /// the return value is dependent upon both LyXRC and LaTeXFeatures.
97         bool useBabel() const;
98         /// Runparams that will be used for exporting this file.
99         OutputParams const & runparams() const { return runparams_; }
100
101 private:
102         std::list<std::string> usedLayouts_;
103
104         /// Static preamble bits from the external material insets
105         typedef std::list<std::string> FeaturesList;
106         ///
107         FeaturesList features_;
108         ///
109         FeaturesList preamble_snippets_;
110         /// The available (required) packages
111         typedef std::list<std::string> PackagesList;
112         ///
113         static PackagesList packages_;
114         ///
115         typedef std::set<Language const *> LanguageList;
116         ///
117         LanguageList UsedLanguages_;
118         ///
119         typedef std::set<std::string> UsedFloats;
120         ///
121         UsedFloats usedFloats_;
122         ///
123         typedef std::map<docstring , std::string> FileMap;
124         ///
125         FileMap IncludedFiles_;
126         /** Buffer of the file being processed.
127          *  This may be a child buffer of the to-be-exported file and
128          *  therefore may not be the buffer that belongs to params_.
129          *  Only needed by InsetInclude::validate().
130          */
131         Buffer const * buffer_;
132         ///
133         BufferParams const & params_;
134         /** Some insets need to know details about the to-be-produced file
135          *  in validate().
136          */
137         OutputParams const & runparams_;
138 };
139
140
141 } // namespace lyx
142
143 #endif