scramble email addresses
[lyx.git] / src / LaTeXFeatures.h
blob878b466797505646ba5c9e564c7f544416b8b1fb
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.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
13 #ifndef LATEXFEATURES_H
14 #define LATEXFEATURES_H
17 #include "OutputParams.h"
18 #include "support/docstring.h"
20 #include <set>
21 #include <list>
22 #include <map>
23 #include <string>
26 namespace lyx {
28 class Buffer;
29 class BufferParams;
30 class Language;
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).
36 * i.e require("amssymb")
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.cpp and Paragraph.cpp
43 * when you do so.
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 (required) package available?
75 static bool isAvailable(std::string const & name);
76 /// Has the package been required?
77 bool isRequired(std::string const & name) const;
78 /* Is it necessary to load the package? This is true if
79 isRequired is true and the feature is not provided by the
80 textclass.
82 bool mustProvide(std::string const & name) const;
83 ///
84 void useFloat(std::string const & name);
85 ///
86 void useLanguage(Language const *);
87 ///
88 bool hasLanguages() const;
89 ///
90 std::string getLanguages() const;
91 ///
92 std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
93 ///
94 void useLayout(docstring const & lyt);
95 ///
96 Buffer const & buffer() const;
97 ///
98 void setBuffer(Buffer const &);
99 ///
100 BufferParams const & bufferParams() const;
101 /// the return value is dependent upon both LyXRC and LaTeXFeatures.
102 bool useBabel() const;
103 /// Runparams that will be used for exporting this file.
104 OutputParams const & runparams() const { return runparams_; }
106 private:
107 std::list<docstring> usedLayouts_;
109 /// Static preamble bits from the external material insets
110 typedef std::list<std::string> FeaturesList;
112 FeaturesList features_;
114 FeaturesList preamble_snippets_;
115 /// The available (required) packages
116 typedef std::list<std::string> PackagesList;
118 static PackagesList packages_;
120 typedef std::set<Language const *> LanguageList;
121 /// used languages (only those that are supported by babel)
122 LanguageList UsedLanguages_;
124 typedef std::set<std::string> UsedFloats;
126 UsedFloats usedFloats_;
128 typedef std::map<docstring , std::string> FileMap;
130 FileMap IncludedFiles_;
131 /** Buffer of the file being processed.
132 * This may be a child buffer of the to-be-exported file and
133 * therefore may not be the buffer that belongs to params_.
134 * Only needed by InsetInclude::validate().
136 Buffer const * buffer_;
138 BufferParams const & params_;
139 /** Some insets need to know details about the to-be-produced file
140 * in validate().
142 OutputParams const & runparams_;
146 } // namespace lyx
148 #endif