3 * \file GraphicsConverter.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
11 * The controller of a conversion process from file AA of format A to
12 * file BB of format B.
13 * Once finished, a signal is emitted to inform any listeners (connected
14 * through the connect() method).
17 #ifndef GRAPHICSCONVERTER_H
18 #define GRAPHICSCONVERTER_H
20 #include "support/signals.h"
25 namespace support { class FileName; }
31 /// Can the conversion be performed?
32 static bool isReachable(std::string const & from_format_name,
33 std::string const & to_format_name);
35 /** One Converter per conversion ensures that the (hidden) signal
36 * is always connected to the expected slot.
38 Converter(support::FileName const & doc_fname,
39 support::FileName const & from_file, std::string const & to_file_base,
40 std::string const & from_format, std::string const & to_format);
42 /// Needed for the pimpl
45 /// We are explicit about when we begin the conversion process.
46 void startConversion() const;
48 /** Connect and you'll be informed when the conversion process has
50 * If the conversion is successful, then the listener is passed \c true.
51 * The connection is closed when this is destroyed.
53 typedef signals2::signal<void(bool)> sig_type;
54 typedef sig_type::slot_type slot_type;
56 signals2::connection connect(slot_type const &) const;
58 /** If the conversion is successful, this returns the name of the
60 * If conversion fails or has not been completed, however, it
61 * returns an empty string.
63 support::FileName const & convertedFile() const;
67 Converter(Converter const &);
68 void operator=(Converter const &);
70 /// Use the Pimpl idiom to hide the internals.
72 /// The pointer never changes although *pimpl_'s contents may.
76 } // namespace graphics
79 #endif // GRAPHICSCONVERTER_H