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