// -*- 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 {
+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;
};
-
+ static type_info types[];
///
- InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
+ static int getType(std::string const & name);
///
- InsetRef(string const &, Buffer *);
+ static std::string const & getName(int type);
+
+
+ InsetRef(InsetCommandParams const &, Buffer const &);
+
///
- InsetRef(InsetCommand const &, Buffer *);
- ///
- Inset * Clone() const {
- return new InsetRef (getCommand(), master);
- }
+ docstring const getScreenLabel(Buffer const &) const;
///
- Inset::Code LyxCode() const { return Inset::REF_CODE; }
+ EDITABLE editable() const { return IS_EDITABLE; }
///
- void Edit(int, int);
+ Code lyxCode() const { return REF_CODE; }
///
- unsigned char Editable() const {
- return 1;
- }
- ///
bool display() const { return false; }
///
- string getScreenLabel() const;
+ int latex(Buffer const &, odocstream &, OutputParams const &) const;
///
- InsetRef::Ref_Flags getFlag() { return flag; }
+ int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
///
- void setFlag(InsetRef::Ref_Flags f) { flag = f; }
- ///
- void gotoLabel();
+ 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(ostream &, signed char fragile) const;
- ///
- int Latex(string & file, signed char fragile) const;
- ///
- int Linuxdoc(string & file) const;
+ void validate(LaTeXFeatures & features) const;
+protected:
+ InsetRef(InsetRef const &);
+
///
- int DocBook(string & file) const;
+ 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;
};
+} // namespace lyx
-inline
-void InsetRef::gotoLabel()
-{
- if (master) {
- master->getUser()->gotoLabel(getContents());
- }
-}
#endif