X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finsetert.h;h=77f81aef220a049bcaf6f5d780c4770c5c28c2d8;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=3ab24e0cdc6b1fc23efe479396cd7afc07e378aa;hpb=c10dfd15cd79499dd23f161d8f1716c00a143e09;p=lyx.git diff --git a/src/insets/insetert.h b/src/insets/insetert.h index 3ab24e0cdc..77f81aef22 100644 --- a/src/insets/insetert.h +++ b/src/insets/insetert.h @@ -1,26 +1,23 @@ // -*- C++ -*- -/* This file is part of - * ====================================================== +/** + * \file insetert.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor + * \author Jürgen Vigna + * \author Lars Gullik Bjønnes * - * Copyright 1998 The LyX Team. - * - *====================================================== + * 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" + -#include +namespace lyx { /** A collapsable text inset for LaTeX insertions. @@ -36,123 +33,87 @@ class Language; class InsetERT : public InsetCollapsable { public: /// - enum ERTStatus { - Open, - Collapsed, - Inlined - }; - /// - InsetERT(BufferParams const &, bool collapsed = false); - /// - InsetERT(InsetERT const &, bool same_id = false); - /// - Inset * clone(Buffer const &, bool same_id = false) const; + InsetERT(BufferParams const &, CollapseStatus status = Open); +#if 0 /// InsetERT(BufferParams const &, - Language const *, string const & contents, bool collapsed); + Language const *, std::string const & contents, CollapseStatus status); +#endif /// ~InsetERT(); /// - Inset::Code lyxCode() const { return Inset::ERT_CODE; } - /// - void read(Buffer const * buf, LyXLex & lex); + InsetBase::Code lyxCode() const { return InsetBase::ERT_CODE; } /// - void write(Buffer const * buf, std::ostream & os) const; + void write(Buffer const & buf, std::ostream & os) const; /// - string const editMessage() const; + void read(Buffer const & buf, LyXLex & lex); /// - bool insertInset(BufferView *, Inset *); + virtual docstring const editMessage() const; /// - bool insetAllowed(Inset::Code) const { return false; } + bool insetAllowed(InsetBase::Code code) const; /// - void setFont(BufferView *, LyXFont const &, - bool toggleall = false, bool selectall = false); + int latex(Buffer const &, odocstream &, + OutputParams const &) const; /// - void edit(BufferView *, int, int, mouse_button::state); + int plaintext(Buffer const &, odocstream &, + OutputParams const & runparams) const; /// - void edit(BufferView * bv, bool front = true); - /// - EDITABLE editable() const; - /// - boost::signal0 hideDialog; - /// - void insetButtonPress(BufferView *, int x, int y, mouse_button::state button); - /// - bool insetButtonRelease(BufferView * bv, int x, int y, mouse_button::state button); - /// - void insetMotionNotify(BufferView *, int x, int y, mouse_button::state state); - /// - int latex(Buffer const *, std::ostream &, bool fragile, - bool free_spc) const; - /// - int ascii(Buffer const *, - std::ostream &, int linelen = 0) const; - /// - int linuxdoc(Buffer const *, std::ostream &) const; - /// - int docbook(Buffer const *, std::ostream &, bool mixcont) const; + int docbook(Buffer const &, odocstream &, + OutputParams const & runparams) const; /// void validate(LaTeXFeatures &) const {} /// - UpdatableInset::RESULT localDispatch(BufferView *, FuncRequest const &); + bool metrics(MetricsInfo &, Dimension &) const; /// - bool checkInsertChar(LyXFont &); + void draw(PainterInfo & pi, int x, int y) const; /// - // this are needed here because of the label/inlined functionallity + bool showInsetDialog(BufferView *) const; /// - bool needFullRow() const { return status_ == Open; } + void getDrawFont(LyXFont &) const; /// - bool isOpen() const { return status_ == Open || status_ == Inlined; } + 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 &); /// - bool inlined() const { return status_ == Inlined; } + virtual void doDispatch(LCursor & cur, FuncRequest & cmd); /// - ERTStatus status() const { return status_; } + bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus &) const; +private: + virtual std::auto_ptr doClone() const; /// - void open(BufferView *); + void init(); /// - void close(BufferView *) const; + void setButtonLabel(); /// - bool allowSpellcheck() { return false; } + bool allowSpellCheck() const { return false; } +}; - WordLangTuple const - selectNextWordToSpellcheck(BufferView *, float &) const; - /// - int ascent(BufferView *, LyXFont const &) const; + +class InsetERTMailer : public MailInset { +public: /// - int descent(BufferView *, LyXFont const &) const; + InsetERTMailer(InsetERT & inset); /// - int width(BufferView *, LyXFont const &) const; + virtual InsetBase & inset() const { return inset_; } /// - void draw(BufferView *, const LyXFont &, int , float &, bool) const; - /// set the status of the inset - void status(BufferView *, ERTStatus const st) const; + virtual std::string const & name() const { return name_; } /// - bool showInsetDialog(BufferView *) const; - /// - void getDrawFont(LyXFont &) const; + virtual std::string const inset2string(Buffer const &) const; /// - bool forceDefaultParagraphs(Inset const *) const { - return true; - } + static void string2params(std::string const &, + InsetCollapsable::CollapseStatus &); /// - int getMaxWidth(BufferView *, UpdatableInset const *) const; - /// - void update(BufferView *, LyXFont const &, bool =false); - + static std::string const params2string(InsetCollapsable::CollapseStatus); private: /// - void init(); - /// - string const get_new_label() const; - /// - void setButtonLabel() const; + static std::string const name_; /// - void set_latex_font(BufferView *); - /// update status on button - void updateStatus(BufferView *, bool = false) const; - - /// - mutable ERTStatus status_; + InsetERT & inset_; }; + +} // namespace lyx + #endif