// -*- C++ -*-
-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
+/**
+ * \file insetert.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * Copyright 1998 The LyX Team.
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
*
- *======================================================
+ * Full author contact details are available in file CREDITS.
*/
-// The pristine updatable inset: Text
-
#ifndef INSETERT_H
#define INSETERT_H
-#ifdef __GNUG__
-#pragma interface
-#endif
-
#include "insetcollapsable.h"
+#include "mailinset.h"
+
+
+namespace lyx {
/** A collapsable text inset for LaTeX insertions.
-
+
To write full ert (including styles and other insets) in a given
- space.
+ space.
+
+ Note that collapsed_ encompasses both the inline and collapsed button
+ versions of this inset.
*/
+
+class Language;
+
class InsetERT : public InsetCollapsable {
public:
///
- InsetERT();
- ///
- InsetERT(InsetERT const &, bool same_id = false);
+ InsetERT(BufferParams const &, CollapseStatus status = Open);
+#if 0
///
- Inset * clone(Buffer const &, bool same_id = false) const;
+ InsetERT(BufferParams const &,
+ Language const *, std::string const & contents, CollapseStatus status);
+#endif
///
- InsetERT(string const & contents, bool collapsed);
+ ~InsetERT();
///
- Inset::Code lyxCode() const { return Inset::ERT_CODE; }
+ InsetBase::Code lyxCode() const { return InsetBase::ERT_CODE; }
///
- void read(Buffer const * buf, LyXLex & lex);
+ void write(Buffer const & buf, std::ostream & os) const;
///
- void write(Buffer const * buf, std::ostream & os) const;
+ void read(Buffer const & buf, LyXLex & lex);
///
- string const editMessage() const;
+ virtual docstring const editMessage() const;
///
- bool insertInset(BufferView *, Inset *);
+ bool insetAllowed(InsetBase::Code code) const;
///
- bool insetAllowed(Inset::Code) const { return false; }
+ int latex(Buffer const &, odocstream &,
+ OutputParams const &) const;
///
- void setFont(BufferView *, LyXFont const &,
- bool toggleall = false, bool selectall = false);
+ int plaintext(Buffer const &, odocstream &,
+ OutputParams const & runparams) const;
///
- void edit(BufferView *, int, int, unsigned int);
+ int docbook(Buffer const &, odocstream &,
+ OutputParams const & runparams) const;
///
- void edit(BufferView * bv, bool front = true);
+ void validate(LaTeXFeatures &) const {}
///
- void insetButtonRelease(BufferView * bv, int x, int y, int button);
+ bool metrics(MetricsInfo &, Dimension &) const;
///
- int latex(Buffer const *, std::ostream &, bool fragile,
- bool free_spc) const;
+ void draw(PainterInfo & pi, int x, int y) const;
///
- int ascii(Buffer const *,
- std::ostream &, int linelen = 0) const;
+ bool showInsetDialog(BufferView *) const;
///
- int linuxdoc(Buffer const *, std::ostream &) const;
+ void getDrawFont(LyXFont &) const;
///
- int docBook(Buffer const *, std::ostream &) const;
+ bool forceDefaultParagraphs(idx_type) const { return true; }
+ /// should paragraph indendation be ommitted in any case?
+ bool neverIndent(Buffer const &) const { return true; }
+protected:
+ InsetERT(InsetERT const &);
///
- UpdatableInset::RESULT localDispatch(BufferView *, kb_action,
- string const &);
+ virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
///
- bool checkInsertChar(LyXFont &);
-
+ bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const;
private:
+ virtual std::auto_ptr<InsetBase> doClone() const;
///
void init();
///
- string const get_new_label() const;
- ///
void setButtonLabel();
+ ///
+ bool allowSpellCheck() const { return false; }
};
+
+class InsetERTMailer : public MailInset {
+public:
+ ///
+ InsetERTMailer(InsetERT & inset);
+ ///
+ virtual InsetBase & inset() const { return inset_; }
+ ///
+ virtual std::string const & name() const { return name_; }
+ ///
+ virtual std::string const inset2string(Buffer const &) const;
+ ///
+ static void string2params(std::string const &,
+ InsetCollapsable::CollapseStatus &);
+ ///
+ static std::string const params2string(InsetCollapsable::CollapseStatus);
+private:
+ ///
+ static std::string const name_;
+ ///
+ InsetERT & inset_;
+};
+
+
+} // namespace lyx
+
#endif