]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetref.h
Introduce wide streams. This fixes the remaining problems of plain text
[lyx.git] / src / insets / insetref.h
index af85500a30867572a6541be306dad139ecf1949f..35550dde373f8fd1cf14612302bd44d8b422d0de 100644 (file)
@@ -1,88 +1,72 @@
 // -*- 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
-
 #include "insetcommand.h"
-#include "buffer.h"
 
-struct LaTeXFeatures;
 
-/** The reference inset  
- */
-class InsetRef: public InsetCommand {
+/// 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; }
-       ///
-       InsetRef(string const &, Buffer *);
-       ///
-       InsetRef(InsetCommand const &, Buffer *);
+       static type_info types[];
        ///
-       ~InsetRef();
-        ///
-        Inset * Clone() { return new InsetRef (getCommand(), master); }
+       static int getType(std::string const & name);
        ///
-       Inset::Code LyxCode() const { return Inset::REF_CODE; }
+       static std::string const & getName(int type);
+
+
+       InsetRef(InsetCommandParams const &, Buffer const &);
+
        ///
-       void Edit(int, int);
+       lyx::docstring const getScreenLabel(Buffer const &) const;
        ///
-       unsigned char Editable() const {
-               return 1;
-       }
-        ///
-       bool Display() const { return false; }
+       EDITABLE editable() const { return IS_EDITABLE; }
        ///
-       string getScreenLabel() const;
+       InsetBase::Code lyxCode() const { return InsetBase::REF_CODE; }
        ///
-       InsetRef::Ref_Flags getFlag() { return flag; }
+       bool display() const { return false; }
        ///
-       void setFlag(InsetRef::Ref_Flags f) { flag = f; }
-        ///
-        void gotoLabel();
+       int latex(Buffer const &, std::ostream &,
+                 OutputParams const &) const;
        ///
-       int Latex(FILE * file, signed char fragile);
+       int plaintext(Buffer const &, lyx::odocstream &,
+                 OutputParams const &) const;
        ///
-       int Latex(string & file, signed char fragile);
+       int docbook(Buffer const &, std::ostream &,
+                   OutputParams const &) const;
+       /// the string that is passed to the TOC
+       virtual int textString(Buffer const &, lyx::odocstream &,
+               OutputParams const &) const;
        ///
-       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());
-    }
-}
 #endif