]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetref.h
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetref.h
index a64e02d27e64a008f8e6d0b91f403c934f06de6f..a616a08e28a95403b517956897c9cdb45951901c 100644 (file)
@@ -1,89 +1,75 @@
 // -*- C++ -*-
-/* This file is part of*
- * ======================================================
+/**
+ * \file insetref.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *           LyX, The Document Processor
- *      
- *         Copyright (C) 1997 LyX Team (this file was created this year)
- * 
- *======================================================*/
+ * \author José Matos
+ *
+ * Full author contact details are available in file CREDITS.
+ */
 
-#ifndef _INSET_REF_H
-#define _INSET_REF_H
-
-#ifdef __GNUG__
-#pragma interface
-#endif
+#ifndef INSET_REF_H
+#define INSET_REF_H
 
 #include "insetcommand.h"
-#include "buffer.h"
 
-struct LaTeXFeatures;
 
-/** The reference inset  
- */
-class InsetRef: public InsetCommand {
+namespace lyx {
+
+
+/// The reference inset
+class InsetRef : public InsetCommand {
 public:
-        ///
-        enum Ref_Flags {
+       struct type_info {
                ///
-               REF,
+               std::string latex_name;
                ///
-               PAGE_REF
+               std::string gui_name;
+               ///
+               std::string short_gui_name;
        };
-       
-       ///
-       InsetRef(): InsetCommand("ref") { flag = InsetRef::REF; }
+       static type_info types[];
        ///
-       InsetRef(string const &, Buffer*);
+       static int getType(std::string const & name);
        ///
-       InsetRef(InsetCommand const&, Buffer*);
-       ///
-       ~InsetRef();
-        ///
-        Inset* Clone() { return new InsetRef (getCommand(), master); }
+       static std::string const & getName(int type);
+
+
+       InsetRef(InsetCommandParams const &, Buffer const &);
+
        ///
-       Inset::Code LyxCode() const { return Inset::REF_CODE; }
+       docstring const getScreenLabel(Buffer const &) const;
        ///
-       void Edit(int, int);
+       EDITABLE editable() const { return IS_EDITABLE; }
        ///
-       unsigned char Editable() const {
-               return 1;
-       }
-        ///
-       bool Display() const { return false; }
+       Code lyxCode() const { return REF_CODE; }
        ///
-       string getScreenLabel() const;
+       bool display() const { return false; }
        ///
-       InsetRef::Ref_Flags getFlag() { return flag; }
+       int latex(Buffer const &, odocstream &, OutputParams const &) const;
        ///
-       void setFlag(InsetRef::Ref_Flags f) { flag = f; }
-        ///
-        void gotoLabel();
+       int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
        ///
-       int Latex(FILE *file, signed char fragile);
+       int docbook(Buffer const &, odocstream &, OutputParams const &) const;
+       /// the string that is passed to the TOC
+       virtual int textString(Buffer const &, odocstream &,
+               OutputParams const &) const;
        ///
-       int Latex(string &file, signed char fragile);
-       ///
-       int Linuxdoc(string &file);
+       void validate(LaTeXFeatures & features) const;
+protected:
+       InsetRef(InsetRef const &);
+
        ///
-       int DocBook(string &file);
+       virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
 private:
-       /// This function escapes 8-bit characters
-       string escape(string const &) const;
+       virtual std::auto_ptr<InsetBase> doClone() const {
+               return std::auto_ptr<InsetBase>(new InsetRef(*this));
+       }
        ///
-        Ref_Flags flag;
-        ///
-       Buffer *master;
+       bool isLatex;
 };
 
-
-inline
-void InsetRef::gotoLabel()
-{
-    if (master) {
-       master->gotoLabel(getContents());
-    }
-}
+} // namespace lyx
 
 #endif