X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetNote.h;h=9df1a501a29c75ba12c7ebc3c8f13517f7f4d3c4;hb=2746fdf7ddbde99d9396a4ea83942e9f572abbb9;hp=a17889aba4d173e8ac93e5b0f965a81bfe516f96;hpb=4ba4d701f798488c098ecbc740c3020ed514cd96;p=lyx.git diff --git a/src/insets/InsetNote.h b/src/insets/InsetNote.h index a17889aba4..9df1a501a2 100644 --- a/src/insets/InsetNote.h +++ b/src/insets/InsetNote.h @@ -9,23 +9,21 @@ * Full author contact details are available in file CREDITS. */ -#ifndef INSETNOTE_H -#define INSETNOTE_H +#ifndef INSET_NOTE_H +#define INSET_NOTE_H -#include "InsetCollapsable.h" -#include "MailInset.h" +#include "InsetCollapsible.h" namespace lyx { -class InsetNoteParams { +class InsetNoteParams +{ public: enum Type { Note, Comment, - Greyedout, - Framed, - Shaded + Greyedout }; /// \c type defaults to Note InsetNoteParams(); @@ -38,84 +36,80 @@ public: }; -/** The PostIt note inset, and other annotations +///////////////////////////////////////////////////////////////////////// +// +// InsetNote +// +///////////////////////////////////////////////////////////////////////// -*/ -class InsetNote : public InsetCollapsable { +/// The PostIt note inset, and other annotations +class InsetNote : public InsetCollapsible +{ public: /// - InsetNote(BufferParams const &, std::string const &); + InsetNote(Buffer *, std::string const &); /// ~InsetNote(); /// - virtual docstring const editMessage() const; + static std::string params2string(InsetNoteParams const &); /// - Inset::Code lyxCode() const { return Inset::NOTE_CODE; } + static void string2params(std::string const &, InsetNoteParams &); /// - docstring name() const { return from_ascii("Note"); } - /// framed and shaded notes are displayed - virtual DisplayType display() const; + InsetNoteParams const & params() const { return params_; } +private: /// - void write(Buffer const &, std::ostream &) const; + InsetCode lyxCode() const { return NOTE_CODE; } /// - void read(Buffer const & buf, Lexer & lex); + docstring layoutName() const; /// - void setButtonLabel(); + DisplayType display() const; + /** returns false if, when outputing LaTeX, font changes should + be closed before generating this inset. This is needed for + insets that may contain several paragraphs */ + bool inheritFont() const { return params_.type == InsetNoteParams::Note; } + /// Is the content of this inset part of the output document? + bool producesOutput() const + { return params_.type == InsetNoteParams::Greyedout; } /// - virtual Color_color backgroundColor() const; - /// show the note dialog - bool showInsetDialog(BufferView * bv) const; + bool allowSpellCheck() const; /// - int latex(Buffer const &, odocstream &, OutputParams const &) const; + FontInfo getFont() const; /// - int plaintext(Buffer const &, odocstream &, OutputParams const &) const; + void write(std::ostream &) const; /// - int docbook(Buffer const &, odocstream &, OutputParams const &) const; + void read(Lexer & lex); + /// show the note dialog + bool showInsetDialog(BufferView * bv) const; /// - void validate(LaTeXFeatures &) const; + bool isMacroScope() const; /// - InsetNoteParams const & params() const { return params_; } + void latex(otexstream &, OutputParams const &) const; /// - bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; -protected: - InsetNote(InsetNote const &); + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -private: - friend class InsetNoteParams; - - virtual std::auto_ptr doClone() const; - - /// used by the constructors - void init(); + int docbook(odocstream &, OutputParams const &) const; /// - InsetNoteParams params_; -}; - - -class InsetNoteMailer : public MailInset { -public: + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - InsetNoteMailer(InsetNote & inset); + void validate(LaTeXFeatures &) const; /// - virtual Inset & inset() const { return inset_; } + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - virtual std::string const & name() const { return name_; } + void doDispatch(Cursor & cur, FuncRequest & cmd); /// - virtual std::string const inset2string(Buffer const &) const; + Inset * clone() const { return new InsetNote(*this); } + /// used by the constructors + void init(); /// - static std::string const params2string(InsetNoteParams const &); + std::string contextMenuName() const; /// - static void string2params(std::string const &, InsetNoteParams &); + friend class InsetNoteParams; -private: - /// - static std::string const name_; /// - InsetNote & inset_; + InsetNoteParams params_; }; - } // namespace lyx -#endif +#endif // INSET_NOTE_H