]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewedInset.h
The std::string mammoth path.
[lyx.git] / src / graphics / PreviewedInset.h
index 85760603f93e846513873e73575321f8f24f95fe..991853b67fae9d8d09e8780b0ac3561f68a4c0d5 100644 (file)
@@ -1,27 +1,28 @@
 // -*- C++ -*-
 /**
- *  \file PreviewedInset.h
+ * \file PreviewedInset.h
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
  * \author Angus Leeming
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  *
- *  grfx::PreviewedInset is an abstract base class that can help insets to
- *  generate previews. The daughter class must instantiate three small
- *  methods. The Inset would own an instance of this daughter class.
+ * lyx::graphics::PreviewedInset is an abstract base class that can help
+ * 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 {
@@ -35,14 +36,12 @@ public:
        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.
@@ -58,29 +57,29 @@ 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.
-       Inset * inset() const { return &inset_; }
+       InsetOld const & inset() const;
        ///
        BufferView * view() const;
 
 private:
-       /** This method is connected to the grfx::PreviewLoader::imageReady
-        *  signal.
-        */
+       /// This method is connected to the PreviewLoader::imageReady signal.
        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_;
@@ -88,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