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