]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewedInset.h
The std::string mammoth path.
[lyx.git] / src / graphics / PreviewedInset.h
index a3d80525f22159682916d51737cc7a79c90c6912..991853b67fae9d8d09e8780b0ac3561f68a4c0d5 100644 (file)
@@ -1,34 +1,31 @@
 // -*- 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
 
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-#include "LString.h"
-#include <boost/weak_ptr.hpp>
 #include <boost/signals/trackable.hpp>
 #include <boost/signals/connection.hpp>
 
-class Inset;
+class Buffer;
 class BufferView;
+class InsetOld;
+
 
-namespace grfx {
+namespace lyx {
+namespace graphics {
 
 class PreviewImage;
 class PreviewLoader;
@@ -39,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.
@@ -62,34 +57,29 @@ public:
        bool previewReady() const;
 
        /// If !previewReady() returns 0.
-       PreviewImage const * pimage() const { return pimage_; }
-
-       ///
-       void setView(BufferView *);
+       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 { return view_.get(); }
+       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_;
-       ///
-       string snippet_;
+       InsetOld & inset_;
        ///
-       boost::weak_ptr<BufferView> view_;
+       std::string snippet_;
 
        /// We don't own this. Cached for efficiency reasons.
        mutable PreviewImage const * pimage_;
@@ -97,7 +87,21 @@ private:
        boost::signals::connection connection_;
 };
 
-} // namespace grfx
 
+inline
+PreviewImage const * PreviewedInset::pimage() const
+{
+       return pimage_;
+}
+
+
+inline
+InsetOld const & PreviewedInset::inset() const
+{
+       return inset_;
+}
+
+} // namespace graphics
+} // namespace lyx
 
 #endif // PREVIEWEDINSET_H