+
+ --level;
+}
+
+
+bool LaTeXFeatures::isRequired(string const & name) const
+{
+ return find(features_.begin(), features_.end(), name) != features_.end();
+}
+
+
+void LaTeXFeatures::addExternalPreamble(string const & preamble)
+{
+ FeaturesList::const_iterator begin = preamble_snippets_.begin();
+ FeaturesList::const_iterator end = preamble_snippets_.end();
+ if (find(begin, end, preamble) == end)
+ preamble_snippets_.push_back(preamble);
+}
+
+
+void LaTeXFeatures::useFloat(string const & name)
+{
+ usedFloats_.insert(name);
+ // We only need float.sty if we use non builtin floats, or if we
+ // use the "H" modifier. This includes modified table and
+ // figure floats. (Lgb)
+ Floating const & fl = params_.getLyXTextClass().floats().getType(name);
+ if (!fl.type().empty() && !fl.builtin()) {
+ require("float");
+ }
+}
+
+
+void LaTeXFeatures::useLanguage(Language const * lang)
+{
+ UsedLanguages_.insert(lang);
+}
+
+
+void LaTeXFeatures::includeFile(string const & key, string const & name)
+{
+ IncludedFiles_[key] = name;
+}
+
+
+bool LaTeXFeatures::hasLanguages() const
+{
+ return !UsedLanguages_.empty();
+}
+
+
+string LaTeXFeatures::getLanguages() const
+{
+ ostringstream languages;
+
+ for (LanguageList::const_iterator cit =
+ UsedLanguages_.begin();
+ cit != UsedLanguages_.end();
+ ++cit)
+ languages << (*cit)->babel() << ',';
+ return languages.str();
+}
+
+
+set<string> LaTeXFeatures::getEncodingSet(string const & doc_encoding) const
+{
+ set<string> encodings;
+ LanguageList::const_iterator it = UsedLanguages_.begin();
+ LanguageList::const_iterator end = UsedLanguages_.end();
+ for (; it != end; ++it)
+ if ((*it)->encoding()->LatexName() != doc_encoding)
+ encodings.insert((*it)->encoding()->LatexName());
+ return encodings;
+}
+
+namespace {
+
+char const * simplefeatures[] = {
+ "array",
+ "verbatim",
+ "longtable",
+ "rotating",
+ "latexsym",
+ "pifont",
+ "subfigure",
+ "floatflt",
+ "varioref",
+ "prettyref",
+ "float",
+ "wasy",
+ "dvipost",
+ "fancybox",
+ "calc",
+};
+
+int const nb_simplefeatures = sizeof(simplefeatures) / sizeof(char const *);
+