]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetExternal.h
Fix GRAPHICS_EDIT of InsetGraphics
[lyx.git] / src / insets / InsetExternal.h
index b23c3f9c4f236181354cf422e93aa0467f43ce9e..97c4b7a44088c42bfb0d30c5df3b65a6e0e7d466 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "Inset.h"
 #include "ExternalTransforms.h"
+#include "EmbeddedFiles.h"
 
 #include "support/FileName.h"
 #include "support/Translator.h"
@@ -69,7 +70,7 @@ public:
        InsetExternalParams();
 
        void write(Buffer const &, std::ostream &) const;
-       bool read(Buffer const &, LyXLex &);
+       bool read(Buffer const &, Lexer &);
 
        /// The name of the tempfile used for manipulations.
        support::FileName const & tempname() const { return tempname_(); }
@@ -79,7 +80,7 @@ public:
        std::string const & templatename() const { return templatename_; }
 
        /// The external file.
-       support::DocFileName filename;
+       EmbeddedFile filename;
        /// How the inset is to be displayed by LyX.
        external::DisplayType display;
        /// The scale of the displayed graphic (if shown).
@@ -104,35 +105,34 @@ private:
 class RenderBase;
 
 ///
-class InsetExternal : public InsetOld, public boost::signals::trackable
+class InsetExternal : public Inset, public boost::signals::trackable
 {
 public:
        InsetExternal();
        ///
-       virtual ~InsetExternal();
+       ~InsetExternal();
        ///
-       virtual InsetBase::Code lyxCode() const { return EXTERNAL_CODE; }
+       void setBuffer(Buffer & buffer);
        ///
-       virtual EDITABLE editable() const { return IS_EDITABLE; }
+       InsetCode lyxCode() const { return EXTERNAL_CODE; }
+       ///
+       EDITABLE editable() const { return IS_EDITABLE; }
 
        ///
-       bool metrics(MetricsInfo &, Dimension &) const;
+       void metrics(MetricsInfo &, Dimension &) const;
        ///
        void draw(PainterInfo & pi, int x, int y) const;
        ///
-       virtual void write(Buffer const &, std::ostream &) const;
+       void write(std::ostream &) const;
        ///
-       virtual void read(Buffer const &, LyXLex & lex);
+       void read(Lexer & lex);
 
        /// \returns the number of rows (\n's) of generated code.
-       int latex(Buffer const &, odocstream &,
-                 OutputParams const &) const;
+       int latex(odocstream &, OutputParams const &) const;
        ///
-       int plaintext(Buffer const &, odocstream &,
-                     OutputParams const &) const;
+       int plaintext(odocstream &, OutputParams const &) const;
        ///
-       int docbook(Buffer const &, odocstream &,
-                   OutputParams const &) const;
+       int docbook(odocstream &, OutputParams const &) const;
 
        /// Update needed features for this inset.
        virtual void validate(LaTeXFeatures & features) const;
@@ -140,20 +140,25 @@ public:
        ///
        InsetExternalParams const & params() const;
        ///
-       void setParams(InsetExternalParams const &, Buffer const &);
+       void setParams(InsetExternalParams const &);
        ///
        void addPreview(graphics::PreviewLoader &) const;
        ///
-       void edit(LCursor & cur, bool left);
+       void edit(Cursor & cur, bool front, EntryDirection entry_from);
+       ///
+       bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
+       /// external file can be embedded
+       void registerEmbeddedFiles(EmbeddedFileList &) const;
        ///
-       bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
+       void updateEmbeddedFile(EmbeddedFile const &);
 
 protected:
        InsetExternal(InsetExternal const &);
        ///
-       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
+       void doDispatch(Cursor & cur, FuncRequest & cmd);
 private:
-       virtual std::auto_ptr<InsetBase> doClone() const;
+       ///
+       Inset * clone() const { return new InsetExternal(*this); }
 
        /** This method is connected to the graphics loader, so we are
         *  informed when the image has been loaded.
@@ -177,7 +182,7 @@ public:
        ///
        InsetExternalMailer(InsetExternal & inset);
        ///
-       virtual InsetBase & inset() const { return inset_; }
+       virtual Inset & inset() const { return inset_; }
        ///
        virtual std::string const & name() const { return name_; }
        ///