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
19 #include <boost/utility.hpp>
24 struct ExternalTemplate {
25 /// What is the name of this template in the LyX format?
27 /// What will the button in the GUI say?
31 /// A file extension regular expression for the file browser
33 /// What command should be executed to view the file?
35 /// What command should be executed to edit the file?
37 /// Should we do automatic production of the output?
38 bool automaticProduction;
39 /// This is the information needed to support a specific output format
40 struct FormatTemplate {
41 /// The text that should be inserted into the exported file
43 /// The shell command to produce a resulting file
45 /// The filename of the resulting file
47 /// What features does this external inset require?
49 /// What should be inserted into the preamble
52 void readFormat(LyXLex &);
53 /// This constructor has to default a command for safety reasons!
57 void readTemplate(LyXLex &);
59 typedef std::map<string, FormatTemplate> Formats;
63 void dumpFormats(std::ostream &) const;
65 /// We have to have default commands for safety reasons!
72 A singleton class that manages the external inset templates
74 class ExternalTemplateManager : boost::noncopyable {
76 /// Map from the LyX name of the template to the template structure
77 typedef std::map<string, ExternalTemplate> Templates;
79 static ExternalTemplateManager & get();
80 Templates & getTemplates();
81 Templates const & getTemplates() const;
82 /// return the template by LyX name
83 ExternalTemplate const & getTemplateByName(const string & name);
85 ExternalTemplateManager();
86 void readTemplates(string const & path);
87 void dumpTemplates() const;