]> git.lyx.org Git - lyx.git/blob - src/graphics/Previews.h
Modify the headers of files in src/graphics as discussed on the list.
[lyx.git] / src / graphics / Previews.h
1 // -*- C++ -*-
2 /**
3  *  \file Previews.h
4  *  Read the file COPYING
5  *
6  * \author Angus Leeming 
7  *
8  * Full author contact details available in file CREDITS
9  *
10  *  grfx::Previews is a singleton class that stores the grfx::PreviewLoader
11  *  for each buffer requiring one.
12  */
13
14 #ifndef PREVIEWS_H
15 #define PREVIEWS_H
16
17 #ifdef __GNUG__
18 #pragma interface
19 #endif
20
21 #include "LString.h"
22 #include <boost/utility.hpp>
23 #include <boost/scoped_ptr.hpp>
24
25 class Buffer;
26
27 namespace grfx {
28
29 class PreviewLoader;
30
31 class Previews : boost::noncopyable {
32 public:
33         /// a wrapper for lyxrc.preview
34         static bool activated();
35
36         /// This is a singleton class. Get the instance.
37         static Previews & get();
38
39         /** Returns the PreviewLoader for this buffer.
40          *  Used by individual insets to update their own preview.
41          *  We assert that (buffer != 0) but do not pass a Buffer &
42          *  so that insets do not need to #include buffer.h
43          */
44         PreviewLoader & loader(Buffer const * buffer) const;
45
46         /** Called from the Buffer d-tor.
47          *  If (buffer == 0), does nothing.
48          */
49         void removeLoader(Buffer const * buffer) const;
50
51         /** For a particular buffer, initiate the generation of previews
52          *  for each and every snippetof LaTeX that's of interest with
53          *  a single forked process.
54          *  If (buffer == 0), does nothing.
55          */
56         void generateBufferPreviews(Buffer const & buffer) const;
57
58 private:
59         /** Make the c-tor, d-tor private so we can control how many objects
60          *  are instantiated.
61          */
62         Previews();
63         ///
64         ~Previews();
65
66         /// Use the Pimpl idiom to hide the internals.
67         class Impl;
68         /// The pointer never changes although *pimpl_'s contents may.
69         boost::scoped_ptr<Impl> const pimpl_;
70 };
71
72 } // namespace grfx
73
74 #endif // PREVIEWS_H