]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNote.h
Forgot to restore this before committing 18494. This fixes bug 3725.
[lyx.git] / src / insets / InsetNote.h
1 // -*- C++ -*-
2 /**
3  * \file InsetNote.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETNOTE_H
13 #define INSETNOTE_H
14
15 #include "InsetCollapsable.h"
16 #include "MailInset.h"
17
18
19 namespace lyx {
20
21 class InsetNoteParams {
22 public:
23         enum Type {
24                 Note,
25                 Comment,
26                 Greyedout,
27                 Framed,
28                 Shaded
29         };
30         /// \c type defaults to Note
31         InsetNoteParams();
32         ///
33         void write(std::ostream & os) const;
34         ///
35         void read(Lexer & lex);
36         ///
37         Type type;
38 };
39
40
41 /** The PostIt note inset, and other annotations
42
43 */
44 class InsetNote : public InsetCollapsable {
45 public:
46         ///
47         InsetNote(BufferParams const &, std::string const &);
48         ///
49         ~InsetNote();
50         ///
51         virtual docstring const editMessage() const;
52         ///
53         Inset::Code lyxCode() const { return Inset::NOTE_CODE; }
54         ///
55         docstring name() const { return from_ascii("Note"); }
56         /// framed and shaded notes are displayed
57         virtual DisplayType display() const;
58         ///
59         void write(Buffer const &, std::ostream &) const;
60         ///
61         void read(Buffer const & buf, Lexer & lex);
62         ///
63         void setButtonLabel();
64         /// show the note dialog
65         bool showInsetDialog(BufferView * bv) const;
66         ///
67         int latex(Buffer const &, odocstream &, OutputParams const &) const;
68         ///
69         int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
70         ///
71         int docbook(Buffer const &, odocstream &, OutputParams const &) const;
72         ///
73         void validate(LaTeXFeatures &) const;
74         ///
75         InsetNoteParams const & params() const { return params_; }
76         ///
77         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
78 protected:
79         InsetNote(InsetNote const &);
80         ///
81         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
82 private:
83         friend class InsetNoteParams;
84
85         virtual std::auto_ptr<Inset> doClone() const;
86
87         /// used by the constructors
88         void init();
89         ///
90         InsetNoteParams params_;
91 };
92
93
94 class InsetNoteMailer : public MailInset {
95 public:
96         ///
97         InsetNoteMailer(InsetNote & inset);
98         ///
99         virtual Inset & inset() const { return inset_; }
100         ///
101         virtual std::string const & name() const { return name_; }
102         ///
103         virtual std::string const inset2string(Buffer const &) const;
104         ///
105         static std::string const params2string(InsetNoteParams const &);
106         ///
107         static void string2params(std::string const &, InsetNoteParams &);
108
109 private:
110         ///
111         static std::string const name_;
112         ///
113         InsetNote & inset_;
114 };
115
116
117 } // namespace lyx
118
119 #endif