3 * \file GraphicsConverter.h
4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
7 * \author Angus Leeming <leeming@lyx.org>
9 * The controller of a conversion process from file AA of format A to
10 * file BB of format B.
11 * Once finished, the signal finishdConversion is emitted to inform the
12 * instigator where to find file BB.
13 * If the conversion is unsuccessful, then finishedConversion will pass
17 #ifndef GRAPHICSCONVERTER_H
18 #define GRAPHICSCONVERTER_H
25 #include <boost/signals/signal1.hpp>
26 #include <boost/scoped_ptr.hpp>
27 #include <boost/utility.hpp>
31 class Converter : boost::noncopyable {
33 /// Can the conversion be performed?
34 static bool isReachable(string const & from_format_name,
35 string const & to_format_name);
37 /** One Converter per conversion ensures that finishedConversion
38 * is always connected to the expected slot.
40 Converter(string const & from_file, string const & to_file_base,
41 string const & from_format, string const & to_format);
43 /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
46 /// We are explicit about when we begin the conversion process.
47 void startConversion() const;
49 /** Connect and you'll be informed when the conversion process has
51 * If the conversion is succesful, then the slot is passed \c true.
53 typedef boost::signal1<void, bool>::slot_type slot_type;
55 boost::signals::connection connect(slot_type const &) const;
57 /** If the conversion is succesful, this returns the name of the
59 * If conversion fails or has not been completed, however, it
60 * returns an empty string.
62 string const & convertedFile() const;
65 /// Use the Pimpl idiom to hide the internals.
68 /// The pointer never changes although *pimpl_'s contents may.
69 boost::scoped_ptr<Impl> const pimpl_;
74 #endif // GRAPHICSCONVERTER_H