]> git.lyx.org Git - lyx.git/blob - src/graphics/PreviewImage.h
Use UTF8 for LaTeX export.
[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 <boost/scoped_ptr.hpp>
16 #include <string>
17
18 namespace lyx {
19 namespace graphics {
20
21 class PreviewLoader;
22 class Image;
23
24 class PreviewImage {
25 public:
26         /** ascent = height * ascent_frac
27          *  descent = height * (1 - ascent_frac)
28          */
29         PreviewImage(PreviewLoader & parent,
30                      std::string const & latex_snippet,
31                      std::string const & bitmap_file,
32                      double ascent_frac);
33         ///
34         ~PreviewImage();
35
36         ///
37         std::string const & snippet() const;
38         ///
39         int ascent() const;
40         ///
41         int descent() const;
42         ///
43         int width() 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 private:
51         /// Use the Pimpl idiom to hide the internals.
52         class Impl;
53         /// The pointer never changes although *pimpl_'s contents may.
54         boost::scoped_ptr<Impl> const pimpl_;
55 };
56
57 } // namespace graphics
58 } // namespace lyx
59
60 #endif // PREVIEWIMAGE_H