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"
28 /** The packages and commands that a buffer needs. This class
29 * contains a list<string>. Each of the LaTeX packages that a buffer needs
30 * should be added with void require(string const & name).
32 * i.e require("amssymb")
34 * To add support you should only need to require() the package name as
35 * packages which don't have special requirements are handled automatically.
36 * If your new package does need special consideration you'll need to alter
37 * string const getPackages() const;
38 * Remember to update the validate function in buffer.C and paragraph.C
44 LaTeXFeatures(Buffer const &, BufferParams const &,
45 OutputParams const &);
46 /// The packages needed by the document
47 std::string const getPackages() const;
48 /// The macros definitions needed by the document
49 std::string const getMacros() const;
51 std::string const getBabelOptions() const;
52 /// The definitions needed by the document's textclass
53 std::string const getTClassPreamble() const;
54 /// The sgml definitions needed by the document (docbook)
55 std::string const getLyXSGMLEntities() const;
56 /// The SGML Required to include the files added with includeFile();
57 std::string const getIncludedFiles(std::string const & fname) const;
58 /// Include a file for use with the SGML entities
59 void includeFile(std::string const & key, std::string const & name);
60 /// The float definitions.
61 void getFloatDefinitions(std::ostream & os) const;
62 /// Print requirements to lyxerr
63 void showStruct() const;
65 void addExternalPreamble(std::string const &);
66 /// Provide a string name-space to the requirements
67 void require(std::string const & name);
68 /// Which of the required packages are installed?
69 static void getAvailable();
70 /// Is the package required?
71 bool isRequired(std::string const & name) const;
72 /// Is the (required) package available?
73 bool isAvailable(std::string const & name) const;
75 void useFloat(std::string const & name);
77 void useLanguage(Language const *);
79 bool hasLanguages() const;
81 std::string getLanguages() const;
83 std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
85 void useLayout(std::string const & lyt);
87 Buffer const & buffer() const;
89 void setBuffer(Buffer const &);
91 BufferParams const & bufferParams() const;
92 /// the return value is dependent upon both LyXRC and LaTeXFeatures.
93 bool useBabel() const;
94 /// Runparams that will be used for exporting this file.
95 OutputParams const & runparams() const { return runparams_; }
98 std::list<std::string> usedLayouts_;
100 /// Static preamble bits from the external material insets
101 typedef std::list<std::string> FeaturesList;
103 FeaturesList features_;
105 FeaturesList preamble_snippets_;
106 /// The available (required) packages
107 typedef std::list<std::string> PackagesList;
109 static PackagesList packages_;
111 typedef std::set<Language const *> LanguageList;
113 LanguageList UsedLanguages_;
115 typedef std::set<std::string> UsedFloats;
117 UsedFloats usedFloats_;
119 typedef std::map<std::string , std::string> FileMap;
121 FileMap IncludedFiles_;
122 /** Buffer of the file being processed.
123 * This may be a child buffer of the to-be-exported file and
124 * therefore may not be the buffer that belongs to params_.
125 * Only needed by InsetInclude::validate().
127 Buffer const * buffer_;
129 BufferParams const & params_;
130 /** Some insets need to know details about the to-be-produced file
133 OutputParams const & runparams_;