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"
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.C and paragraph.C
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;
55 std::string const getBabelOptions() const;
56 /// The definitions needed by the document's textclass
57 std::string 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;
69 void addExternalPreamble(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;
79 void useFloat(std::string const & name);
81 void useLanguage(Language const *);
83 bool hasLanguages() const;
85 std::string getLanguages() const;
87 std::set<std::string> getEncodingSet(std::string const & doc_encoding) const;
89 void useLayout(std::string const & lyt);
91 Buffer const & buffer() const;
93 void setBuffer(Buffer const &);
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_; }
102 std::list<std::string> usedLayouts_;
104 /// Static preamble bits from the external material insets
105 typedef std::list<std::string> FeaturesList;
107 FeaturesList features_;
109 FeaturesList preamble_snippets_;
110 /// The available (required) packages
111 typedef std::list<std::string> PackagesList;
113 static PackagesList packages_;
115 typedef std::set<Language const *> LanguageList;
117 LanguageList UsedLanguages_;
119 typedef std::set<std::string> UsedFloats;
121 UsedFloats usedFloats_;
123 typedef std::map<docstring , std::string> FileMap;
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().
131 Buffer const * buffer_;
133 BufferParams const & params_;
134 /** Some insets need to know details about the to-be-produced file
137 OutputParams const & runparams_;