2002-07-05 21:24:15 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2003-08-23 00:17:00 +00:00
|
|
|
* \file PreviewImage.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-05 21:24:15 +00:00
|
|
|
*
|
2002-12-01 22:59:25 +00:00
|
|
|
* \author Angus Leeming
|
2002-09-05 11:31:30 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-07-05 21:24:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PREVIEWIMAGE_H
|
|
|
|
#define PREVIEWIMAGE_H
|
|
|
|
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-10-07 06:45:25 +00:00
|
|
|
#include <string>
|
2002-07-05 21:24:15 +00:00
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace lyx {
|
2006-11-26 21:30:39 +00:00
|
|
|
|
|
|
|
namespace support { class FileName; }
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
namespace graphics {
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
class PreviewLoader;
|
|
|
|
class Image;
|
|
|
|
|
|
|
|
class PreviewImage {
|
|
|
|
public:
|
|
|
|
/** ascent = height * ascent_frac
|
|
|
|
* descent = height * (1 - ascent_frac)
|
|
|
|
*/
|
|
|
|
PreviewImage(PreviewLoader & parent,
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & latex_snippet,
|
2006-11-26 21:30:39 +00:00
|
|
|
support::FileName const & bitmap_file,
|
2002-07-05 21:24:15 +00:00
|
|
|
double ascent_frac);
|
|
|
|
///
|
|
|
|
~PreviewImage();
|
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string const & snippet() const;
|
2002-07-05 21:24:15 +00:00
|
|
|
///
|
|
|
|
int ascent() const;
|
|
|
|
///
|
|
|
|
int descent() const;
|
|
|
|
///
|
|
|
|
int width() const;
|
2002-07-15 11:08:46 +00:00
|
|
|
|
|
|
|
/** If the image is not yet loaded (WaitingToLoad), then this method
|
|
|
|
* triggers that.
|
|
|
|
*/
|
2003-02-26 11:41:23 +00:00
|
|
|
Image const * image() const;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
class Impl;
|
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
|
|
|
boost::scoped_ptr<Impl> const pimpl_;
|
|
|
|
};
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
} // namespace graphics
|
|
|
|
} // namespace lyx
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
#endif // PREVIEWIMAGE_H
|