2 /* This file is part of*
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1995 Matthias Ettrich
8 * Copyright 1995-2000 The LyX Team.
10 * ====================================================== */
12 #ifndef EXTERNALTEMPLATE_H
13 #define EXTERNALTEMPLATE_H
22 #include <boost/utility.hpp>
27 struct ExternalTemplate {
28 /// What is the name of this template in the LyX format?
30 /// What will the button in the GUI say?
34 /// A file extension regular expression for the file browser
36 /// What command should be executed to view the file?
38 /// What command should be executed to edit the file?
40 /// Should we do automatic production of the output?
41 bool automaticProduction;
42 /// This is the information needed to support a specific output format
43 struct FormatTemplate {
44 /// The text that should be inserted into the exported file
46 /// The shell command to produce a resulting file
48 /// What features does this external inset require?
50 /// What should be inserted into the preamble
53 void readFormat(LyXLex &);
54 /// This constructor has to default a command for safety reasons!
58 void readTemplate(LyXLex &);
60 typedef std::map<string, FormatTemplate> Formats;
64 void dumpFormats(std::ostream &) const;
66 /// We have to have default commands for safety reasons!
73 A singleton class that manages the external inset templates
75 class ExternalTemplateManager : boost::noncopyable {
77 /// Map from the LyX name of the template to the template structure
78 typedef std::map<string, ExternalTemplate> Templates;
80 static ExternalTemplateManager & get();
81 Templates & getTemplates();
82 Templates const & getTemplates() const;
83 /// return the template by LyX name
84 ExternalTemplate const & getTemplateByName(const string & name);
86 ExternalTemplateManager();
87 void readTemplates(string const & path);
88 void dumpTemplates() const;