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 {
52 string const getprettyname() const {
60 Command(Format const * f, Format const * t, string const & c)
61 : from(f), to(t), command(c), importer(false),
62 latex(false), original_dir(false), need_aux(false) {}
69 /// The converter is used for importing
71 /// The converter is latex or its derivatives
73 /// Do we need to run the converter in the original directory?
75 /// This converter needs the .aux files
77 /// If the converter put the result in a directory, then result_dir
78 /// is the name of the directory
80 /// If the converter put the result in a directory, then result_file
81 /// is the name of the main file in that directory
83 /// Command to convert the program output to a LaTeX log file format
85 /// Backends in which the converter is not used
86 std::vector<string> disable;
88 /// Used by the BFS algorithm
90 /// Used by the BFS algorithm
91 std::vector<Command>::iterator previous;
93 std::pair<string, string> const getFromToPrettyname() const {
94 return std::pair<string, string>(from->prettyname,
102 Format const * format;
108 FormatPair(Format const * f1, Format const * f2, string c)
109 : format(f1), from(f2), command(c) {}
116 typedef std::map<string, Format> FormatList;
118 void Add(string const & name);
120 void Add(string const & name, string const & extension,
121 string const & prettyname, string const & shortcut);
123 void SetViewer(string const & name, string const & command);
125 bool View(Buffer const * buffer, string const & filename,
126 string const & format_name);
128 Format * GetFormat(string const & name);
130 string const PrettyName(string const & name);
132 string const Extension(string const & name);
134 std::vector<Format> const GetAllFormats() const;
145 void Add(string const & from, string const & to,
146 string const & command, string const & flags);
149 std::vector<FormatPair> const GetReachableTo(string const & target);
152 std::vector<FormatPair> const
153 GetReachable(string const & from, bool only_viewable);
156 bool IsReachable(string const & from, string const & to);
159 bool Convert(Buffer const * buffer,
160 string const & from_file, string const & to_file_base,
161 string const & from_format, string const & to_format,
162 string const & using_format, string & to_file);
165 bool Convert(Buffer const * buffer,
166 string const & from_file, string const & to_file_base,
167 string const & from_format, string const & to_format,
168 string const & using_format = string());
171 string const SplitFormat(string const & str, string & format);
174 string const dvi_papersize(Buffer const * buffer);
177 string const dvips_options(Buffer const * buffer);
183 std::vector<Command> const GetAllCommands();
187 bool scanLog(Buffer const * buffer, string const & command,
188 string const & filename);
191 bool runLaTeX(Buffer const * buffer, string const & command);
194 std::vector<Command> commands;
197 string latex_command;
200 extern Formats formats;
201 extern Formats system_formats;