]> git.lyx.org Git - lyx.git/blob - src/graphics/PreviewImage.h
Do not redefine \jobname for previews
[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 PreviewLoader;
26 class Image;
27
28 class PreviewImage {
29 public:
30         /** ascent = height * ascent_frac
31          *  descent = height * (1 - ascent_frac)
32          */
33         PreviewImage(PreviewLoader & parent,
34                      std::string const & latex_snippet,
35                      support::FileName const & bitmap_file,
36                      double ascent_frac);
37         ///
38         ~PreviewImage();
39
40         ///
41         std::string const & snippet() const;
42         ///
43         Dimension dim() const;
44
45         /** If the image is not yet loaded (WaitingToLoad), then this method
46          *  triggers that.
47          */
48         Image const * image() const;
49         ///
50         support::FileName const & filename() const;
51
52         PreviewLoader & previewLoader() const;
53
54 private:
55         /// Use the Pimpl idiom to hide the internals.
56         class Impl;
57         /// The pointer never changes although *pimpl_'s contents may.
58         Impl * const pimpl_;
59 };
60
61 } // namespace graphics
62 } // namespace lyx
63
64 #endif // PREVIEWIMAGE_H