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
21 #include <boost/signals/signal1.hpp>
22 #include <boost/scoped_ptr.hpp>
23 #include <boost/utility.hpp>
28 class Converter : boost::noncopyable {
30 /// Can the conversion be performed?
31 static bool isReachable(string const & from_format_name,
32 string const & to_format_name);
34 /** One Converter per conversion ensures that the (hidden) signal
35 * is always connected to the expected slot.
37 Converter(string const & from_file, string const & to_file_base,
38 string const & from_format, string const & to_format);
40 /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
43 /// We are explicit about when we begin the conversion process.
44 void startConversion() const;
46 /** Connect and you'll be informed when the conversion process has
48 * If the conversion is succesful, then the listener is passed \c true.
50 typedef boost::signal1<void, bool>::slot_type slot_type;
52 boost::signals::connection connect(slot_type const &) const;
54 /** If the conversion is succesful, this returns the name of the
56 * If conversion fails or has not been completed, however, it
57 * returns an empty string.
59 string const & convertedFile() const;
62 /// Use the Pimpl idiom to hide the internals.
65 /// The pointer never changes although *pimpl_'s contents may.
66 boost::scoped_ptr<Impl> const pimpl_;
69 } // namespace graphics
72 #endif // GRAPHICSCONVERTER_H