]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNote.h
1d51ee74d18488186acdb830d5b09136b627b40a
[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         };
28         /// \c type defaults to Note
29         InsetNoteParams();
30         ///
31         void write(std::ostream & os) const;
32         ///
33         void read(Lexer & lex);
34         ///
35         Type type;
36 };
37
38
39 /** The PostIt note inset, and other annotations
40
41 */
42 class InsetNote : public InsetCollapsable {
43 public:
44         ///
45         InsetNote(BufferParams const &, std::string const &);
46         ///
47         ~InsetNote();
48         ///
49         virtual docstring const editMessage() const;
50         ///
51         InsetCode lyxCode() const { return NOTE_CODE; }
52         ///
53         docstring name() const;
54         ///
55         virtual DisplayType display() const;
56         ///
57         void write(Buffer const &, std::ostream &) const;
58         ///
59         void read(Buffer const & buf, Lexer & lex);
60         ///
61         void setButtonLabel();
62         /// show the note dialog
63         bool showInsetDialog(BufferView * bv) const;
64         ///
65         bool isMacroScope(Buffer const & buf) 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         // Update the counters of this inset and of its contents
79         virtual void updateLabels(Buffer const &, ParIterator const &);
80 protected:
81         InsetNote(InsetNote const &);
82         ///
83         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
84 private:
85         friend class InsetNoteParams;
86
87         virtual Inset * clone() const;
88
89         /// used by the constructors
90         void init();
91         ///
92         InsetNoteParams params_;
93 };
94
95
96 class InsetNoteMailer : public MailInset {
97 public:
98         ///
99         InsetNoteMailer(InsetNote & inset);
100         ///
101         virtual Inset & inset() const { return inset_; }
102         ///
103         virtual std::string const & name() const { return name_; }
104         ///
105         virtual std::string const inset2string(Buffer const &) const;
106         ///
107         static std::string const params2string(InsetNoteParams const &);
108         ///
109         static void string2params(std::string const &, InsetNoteParams &);
110
111 private:
112         ///
113         static std::string const name_;
114         ///
115         InsetNote & inset_;
116 };
117
118
119 } // namespace lyx
120
121 #endif