]> git.lyx.org Git - lyx.git/blob - src/graphics/PreviewImage.h
Merge branch 'master' into biblatex2
[lyx.git] / src / graphics / PreviewImage.h
1 // -*- C++ -*-
2 /**
3  * \file PreviewImage.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
12 #ifndef PREVIEWIMAGE_H
13 #define PREVIEWIMAGE_H
14
15 #include "support/strfwd.h"
16
17 namespace lyx {
18
19 namespace support { class FileName; }
20
21 class Dimension;
22
23 namespace graphics {
24
25 class Cache;
26 class PreviewLoader;
27 class Image;
28
29 class PreviewImage {
30 public:
31         /** ascent = height * ascent_frac
32          *  descent = height * (1 - ascent_frac)
33          */
34         PreviewImage(PreviewLoader & parent,
35                      std::string const & latex_snippet,
36                      support::FileName const & bitmap_file,
37                      double ascent_frac);
38         ///
39         ~PreviewImage();
40
41         ///
42         std::string const & snippet() const;
43         ///
44         Dimension dim() const;
45
46         /** If the image is not yet loaded (WaitingToLoad), then this method
47          *  triggers that.
48          */
49         Image const * image() const;
50         ///
51         support::FileName const & filename() const;
52
53         PreviewLoader & previewLoader() const;
54
55 private:
56         /// Use the Pimpl idiom to hide the internals.
57         class Impl;
58         /// The pointer never changes although *pimpl_'s contents may.
59         Impl * const pimpl_;
60 };
61
62 } // namespace graphics
63 } // namespace lyx
64
65 #endif // PREVIEWIMAGE_H