*
* \author Angus Leeming
*
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
*
* lyx::graphics::PreviewedInset is an abstract base class that can help
- * insets to generate previews. The daughter class must instantiate three small
+ * insets to generate previews. The daughter class must instantiate two small
* methods. The Inset would own an instance of this daughter class.
*/
#ifndef PREVIEWEDINSET_H
#define PREVIEWEDINSET_H
-#include "LString.h"
#include <boost/signals/trackable.hpp>
#include <boost/signals/connection.hpp>
-class Inset;
+class Buffer;
class BufferView;
+class InsetOld;
+
namespace lyx {
namespace graphics {
static bool activated();
///
- PreviewedInset(Inset & inset) : inset_(inset), pimage_(0) {}
- ///
- virtual ~PreviewedInset() {}
+ PreviewedInset(InsetOld & inset);
/** Find the PreviewLoader, add a LaTeX snippet to it and
* start the loading process.
*/
- void generatePreview();
+ void generatePreview(Buffer const &);
/** Add a LaTeX snippet to the PreviewLoader but do not start the
* loading process.
bool previewReady() const;
/// If !previewReady() returns 0.
- PreviewImage const * pimage() const { return pimage_; }
+ PreviewImage const * pimage() const;
protected:
+ ///
+ virtual ~PreviewedInset() {}
/// Allow the daughter classes to cast up to the parent inset.
- Inset * inset() const { return &inset_; }
+ InsetOld const & inset() const;
///
BufferView * view() const;
void imageReady(PreviewImage const &) const;
/// Does the owning inset want a preview?
- virtual bool previewWanted() const = 0;
+ virtual bool previewWanted(Buffer const &) const = 0;
/// a wrapper to Inset::latex
- virtual string const latexString() const = 0;
+ virtual std::string const latexString(Buffer const &) const = 0;
///
- Inset & inset_;
+ InsetOld & inset_;
///
- string snippet_;
+ std::string snippet_;
/// We don't own this. Cached for efficiency reasons.
mutable PreviewImage const * pimage_;
boost::signals::connection connection_;
};
+
+inline
+PreviewImage const * PreviewedInset::pimage() const
+{
+ return pimage_;
+}
+
+
+inline
+InsetOld const & PreviewedInset::inset() const
+{
+ return inset_;
+}
+
} // namespace graphics
} // namespace lyx