3 * \file ExternalTemplate.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup Nielsen
9 * Full author contact details are available in file CREDITS.
12 #ifndef EXTERNALTEMPLATE_H
13 #define EXTERNALTEMPLATE_H
15 #include <boost/utility.hpp>
28 /// We have to have default commands for safety reasons!
31 void readTemplate(LyXLex &);
33 void dumpFormats(std::ostream &) const;
35 /// What is the name of this template in the LyX format?
37 /// What will the button in the GUI say?
41 /** The format of the input file. Can be "*", in which case we try and
42 * ascertain the format from the contents of the file.
44 std::string inputFormat;
45 /// A file extension regular expression for the file browser
46 std::string fileRegExp;
47 /// What command should be executed to edit the file?
48 std::string editCommand;
49 /// Should we do automatic production of the output?
50 bool automaticProduction;
52 /// This is the information needed to support a specific output format
56 void readFormat(LyXLex &);
58 /// The text that should be inserted into the exported file
60 /// The filename of the resulting file
61 std::string updateResult;
62 /// The format of this file.
63 std::string updateFormat;
64 /// What features does this external inset require?
65 std::string requirement;
66 /// A collection of preamble snippets identified by name.
67 std::vector<std::string> preambleNames;
70 typedef std::map<std::string, Format> Formats;
77 * A singleton class that manages the external inset templates
79 class TemplateManager : boost::noncopyable {
81 /// Map from the LyX name of the template to the template structure
82 typedef std::map<std::string, Template> Templates;
83 /** Map from the LyX name of the preamble definition to the preamble
86 typedef std::map<std::string, std::string> PreambleDefs;
88 static TemplateManager & get();
90 Templates const & getTemplates() const;
91 /** return the template by LyX name.
92 * If it isn't found, return 0.
94 Template const * getTemplateByName(std::string const & name) const;
95 /** return the preamble definition by LyX name.
96 * If it isn't found, return an empty std::string.
98 std::string const getPreambleDefByName(std::string const & name) const;
101 void readTemplates(std::string const & path);
102 void dumpTemplates(std::ostream &) const;
103 void dumpPreambleDefs(std::ostream &) const;
106 PreambleDefs preambledefs;
109 } // namespace external
112 #endif // EXTERNALTEMPLATE_H