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 * ====================================================== */
31 Format(string const & n, string const & e, string const & p,
32 string const & s, string const & v) :
33 name(n), extension(e), prettyname(p), shortcut(s),
48 string const getname() const {
56 Command(Format const * f, Format const * t, string const & c)
57 : from(f), to(t), command(c), importer(false),
58 latex(false), original_dir(false), need_aux(false) {}
65 /// The converter is used for importing
67 /// The converter is latex or its derivatives
69 /// Do we need to run the converter in the original directory?
71 /// This converter needs the .aux files
73 /// If the converter put the result in a directory, then result_dir
74 /// is the name of the directory
76 /// If the converter put the result in a directory, then result_file
77 /// is the name of the main file in that directory
79 /// Command to convert the program output to a LaTeX log file format
81 /// Backends in which the converter is not used
82 std::vector<string> disable;
84 /// Used by the BFS algorithm
86 /// Used by the BFS algorithm
87 std::vector<Command>::iterator previous;
93 Format const * format;
99 FormatPair(Format const * f1, Format const * f2, string c)
100 : format(f1), from(f2), command(c) {}
107 typedef std::map<string, Format> FormatList;
109 void Add(string const & name);
111 void Add(string const & name, string const & extension,
112 string const & prettyname, string const & shortcut);
114 void SetViewer(string const & name, string const & command);
116 bool View(Buffer const * buffer, string const & filename,
117 string const & format_name);
119 Format * GetFormat(string const & name);
121 string const PrettyName(string const & name);
123 string const Extension(string const & name);
125 std::vector<Format> const GetAllFormats() const;
136 void Add(string const & from, string const & to,
137 string const & command, string const & flags);
140 std::vector<FormatPair> const GetReachableTo(string const & target);
143 std::vector<FormatPair> const
144 GetReachable(string const & from, bool only_viewable);
147 bool IsReachable(string const & from, string const & to);
150 bool Convert(Buffer const * buffer,
151 string const & from_file, string const & to_file_base,
152 string const & from_format, string const & to_format,
153 string const & using_format, string & to_file);
156 bool Convert(Buffer const * buffer,
157 string const & from_file, string const & to_file_base,
158 string const & from_format, string const & to_format,
159 string const & using_format = string());
162 string const SplitFormat(string const & str, string & format);
165 string const dvi_papersize(Buffer const * buffer);
168 string const dvips_options(Buffer const * buffer);
174 std::vector<Command> const GetAllCommands();
178 bool scanLog(Buffer const * buffer, string const & command,
179 string const & filename);
182 bool runLaTeX(Buffer const * buffer, string const & command);
185 std::vector<Command> commands;
188 string latex_command;
191 extern Formats formats;
192 extern Formats system_formats;