]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewedInset.h
The std::string mammoth path.
[lyx.git] / src / graphics / PreviewedInset.h
index 31c6691faa607a85b33fd68733e35fc1b3e654cd..991853b67fae9d8d09e8780b0ac3561f68a4c0d5 100644 (file)
@@ -9,19 +9,20 @@
  * 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 "support/std_string.h"
 #include <boost/signals/trackable.hpp>
 #include <boost/signals/connection.hpp>
 
-class InsetOld;
+class Buffer;
 class BufferView;
+class InsetOld;
+
 
 namespace lyx {
 namespace graphics {
@@ -35,14 +36,12 @@ public:
        static bool activated();
 
        ///
-       PreviewedInset(InsetOld & 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.
@@ -58,11 +57,13 @@ public:
        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.
-       InsetOld * inset() const { return &inset_; }
+       InsetOld const & inset() const;
        ///
        BufferView * view() const;
 
@@ -71,14 +72,14 @@ private:
        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;
 
        ///
        InsetOld & inset_;
        ///
-       string snippet_;
+       std::string snippet_;
 
        /// We don't own this. Cached for efficiency reasons.
        mutable PreviewImage const * pimage_;
@@ -86,6 +87,20 @@ private:
        boost::signals::connection connection_;
 };
 
+
+inline
+PreviewImage const * PreviewedInset::pimage() const
+{
+       return pimage_;
+}
+
+
+inline
+InsetOld const & PreviewedInset::inset() const
+{
+       return inset_;
+}
+
 } // namespace graphics
 } // namespace lyx