]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsConverter.h
partial framebox support
[lyx.git] / src / graphics / GraphicsConverter.h
1 // -*- C++ -*-
2 /**
3  *  \file GraphicsConverter.h
4  *  Copyright 2002 the LyX Team
5  *  Read the file COPYING
6  *
7  *  \author Angus Leeming <leeming@lyx.org>
8  *
9  *  The controller of a conversion process from file AA of format A to
10  *  file BB of format B.
11  *  Once finished, a signal is emitted to inform any listeners (connected
12  *  through the connect() method).
13  */
14
15 #ifndef GRAPHICSCONVERTER_H
16 #define GRAPHICSCONVERTER_H
17
18 #ifdef __GNUG__
19 #pragma interface
20 #endif
21
22 #include "LString.h"
23 #include <boost/signals/signal1.hpp>
24 #include <boost/scoped_ptr.hpp>
25 #include <boost/utility.hpp>
26
27 namespace grfx {
28
29 class Converter : boost::noncopyable {
30 public:
31         /// Can the conversion be performed?
32         static bool isReachable(string const & from_format_name,
33                                 string const & to_format_name);
34
35         /** One Converter per conversion ensures that the (hidden) signal
36          *  is always connected to the expected slot.
37          */
38         Converter(string const & from_file,   string const & to_file_base,
39                   string const & from_format, string const & to_format);
40
41         /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
42         ~Converter();
43
44         /// We are explicit about when we begin the conversion process.
45         void startConversion() const;
46
47         /** Connect and you'll be informed when the conversion process has
48          *  finished.
49          *  If the conversion is succesful, then the listener is passed \c true.
50          */
51         typedef boost::signal1<void, bool>::slot_type slot_type;
52         ///
53         boost::signals::connection connect(slot_type const &) const;
54
55         /** If the conversion is succesful, this returns the name of the
56          *  resulting file.
57          *  If conversion fails or has not been completed, however, it
58          *  returns an empty string.
59          */
60         string const & convertedFile() const;
61
62 private:
63         /// Use the Pimpl idiom to hide the internals.
64         class Impl;
65
66         /// The pointer never changes although *pimpl_'s contents may.
67         boost::scoped_ptr<Impl> const pimpl_;
68 };
69
70 } // namespace grfx
71
72 #endif // GRAPHICSCONVERTER_H