]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsConverter.h
redraw fix 1.
[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 <a.leeming@ic.ac.uk>
8  *
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
14  *  an empty string.
15  */
16
17 #ifndef GRAPHICSCONVERTER_H
18 #define GRAPHICSCONVERTER_H
19
20 #ifdef __GNUG__
21 #pragma interface
22 #endif
23
24 #include "LString.h"
25 #include <boost/signals/signal1.hpp>
26 #include <boost/scoped_ptr.hpp>
27 #include <boost/utility.hpp>
28
29 namespace grfx {
30
31 class Converter : boost::noncopyable {
32 public:
33         /// Can the conversion be performed?
34         static bool isReachable(string const & from_format_name,
35                                 string const & to_format_name);
36
37         /** One Converter per conversion ensures that finishedConversion
38          *  is always connected to the expected slot.
39          */
40         Converter(string const & from_file,   string const & to_file_base,
41                   string const & from_format, string const & to_format);
42
43         /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
44         ~Converter();
45
46         /// We are explicit about when we begin the conversion process.
47         void startConversion();
48
49         /** At the end of the conversion process inform the outside world
50          *  by emitting a signal.
51          */
52         typedef boost::signal1<void, bool> SignalType;
53         ///
54         SignalType finishedConversion;
55         
56         /** If the convsion is succesful (finishedConversion returns \c true),
57          *  this returns the name of the resulting file.
58          *  If conversion fails, however, it 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