Consider the case where there is not any layout name.
[lyx.git] / src / graphics / GraphicsConverter.h
blob30021cbf1afc28a1371b551c96476954ed9c54d3
1 // -*- C++ -*-
2 /**
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 <boost/scoped_ptr.hpp>
21 #include <boost/signal.hpp>
22 #include <boost/utility.hpp>
24 namespace lyx {
25 namespace graphics {
27 class Converter : boost::noncopyable {
28 public:
29 /// Can the conversion be performed?
30 static bool isReachable(std::string const & from_format_name,
31 std::string const & to_format_name);
33 /** One Converter per conversion ensures that the (hidden) signal
34 * is always connected to the expected slot.
36 Converter(std::string const & from_file, std::string const & to_file_base,
37 std::string const & from_format, std::string const & to_format);
39 /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
40 ~Converter();
42 /// We are explicit about when we begin the conversion process.
43 void startConversion() const;
45 /** Connect and you'll be informed when the conversion process has
46 * finished.
47 * If the conversion is succesful, then the listener is passed \c true.
49 typedef boost::signal<void(bool)> sig_type;
50 typedef sig_type::slot_type slot_type;
51 ///
52 boost::signals::connection connect(slot_type const &) const;
54 /** If the conversion is succesful, this returns the name of the
55 * resulting file.
56 * If conversion fails or has not been completed, however, it
57 * returns an empty string.
59 std::string const & convertedFile() const;
61 private:
62 /// Use the Pimpl idiom to hide the internals.
63 class Impl;
65 /// The pointer never changes although *pimpl_'s contents may.
66 boost::scoped_ptr<Impl> const pimpl_;
69 } // namespace graphics
70 } // namespace lyx
72 #endif // GRAPHICSCONVERTER_H