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
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).
30 * i.e require("amssymb")
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
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;
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;
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;
72 void useFloat(std::string const & name);
74 void useLanguage(Language const *);
76 bool hasLanguages() const;
78 std::string getLanguages() const;
80 std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
82 void useLayout(std::string const & lyt);
84 Buffer const & buffer() const;
86 void setBuffer(Buffer const &);
88 BufferParams const & bufferParams() const;
89 /// the return value is dependent upon both LyXRC and LaTeXFeatures.
90 bool useBabel() const;
92 bool nice() const { return nice_; };
95 std::list<std::string> usedLayouts_;
97 /// Static preamble bits from the external material insets
98 typedef std::list<std::string> FeaturesList;
100 FeaturesList features_;
102 FeaturesList preamble_snippets_;
103 /// The available (required) packages
104 typedef std::list<std::string> PackagesList;
106 static PackagesList packages_;
108 typedef std::set<Language const *> LanguageList;
110 LanguageList UsedLanguages_;
112 typedef std::set<std::string> UsedFloats;
114 UsedFloats usedFloats_;
116 typedef std::map<std::string , std::string> FileMap;
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().
124 Buffer const * buffer_;
126 BufferParams const & params_;
127 /** If we are writing a nice LaTeX file or not.
128 * Only needed by InsetInclude::validate().