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