]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsConverter.h
dont use pragma impementation and interface anymore
[lyx.git] / src / graphics / GraphicsConverter.h
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.
6  *
7  *  \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS
10  *
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).
15  */
16
17 #ifndef GRAPHICSCONVERTER_H
18 #define GRAPHICSCONVERTER_H
19
20 #include "LString.h"
21 #include <boost/signals/signal1.hpp>
22 #include <boost/scoped_ptr.hpp>
23 #include <boost/utility.hpp>
24
25 namespace grfx {
26
27 class Converter : boost::noncopyable {
28 public:
29         /// Can the conversion be performed?
30         static bool isReachable(string const & from_format_name,
31                                 string const & to_format_name);
32
33         /** One Converter per conversion ensures that the (hidden) signal
34          *  is always connected to the expected slot.
35          */
36         Converter(string const & from_file,   string const & to_file_base,
37                   string const & from_format, string const & to_format);
38
39         /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
40         ~Converter();
41
42         /// We are explicit about when we begin the conversion process.
43         void startConversion() const;
44
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.
48          */
49         typedef boost::signal1<void, bool>::slot_type slot_type;
50         ///
51         boost::signals::connection connect(slot_type const &) const;
52
53         /** If the conversion is succesful, this returns the name of the
54          *  resulting file.
55          *  If conversion fails or has not been completed, however, it
56          *  returns an empty string.
57          */
58         string const & convertedFile() const;
59
60 private:
61         /// Use the Pimpl idiom to hide the internals.
62         class Impl;
63
64         /// The pointer never changes although *pimpl_'s contents may.
65         boost::scoped_ptr<Impl> const pimpl_;
66 };
67
68 } // namespace grfx
69
70 #endif // GRAPHICSCONVERTER_H