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