]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNote.h
more border tweaks
[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(Buffer const &, std::string const &);
46         ///
47         ~InsetNote();
48         ///
49         InsetNoteParams const & params() const { return params_; }
50 private:
51         ///
52         docstring editMessage() const;
53         ///
54         InsetCode lyxCode() const { return NOTE_CODE; }
55         ///
56         docstring name() const;
57         ///
58         virtual DisplayType display() const;
59         ///
60         bool noFontChange() const { return params_.type != InsetNoteParams::Note; }
61         ///
62         void write(std::ostream &) const;
63         ///
64         void read(Lexer & lex);
65         ///
66         void setButtonLabel();
67         /// show the note dialog
68         bool showInsetDialog(BufferView * bv) const;
69         ///
70         bool isMacroScope() const;
71         ///
72         int latex(odocstream &, OutputParams const &) const;
73         ///
74         int plaintext(odocstream &, OutputParams const &) const;
75         ///
76         int docbook(odocstream &, OutputParams const &) const;
77         ///
78         void validate(LaTeXFeatures &) const;
79         ///
80         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
81         // Update the counters of this inset and of its contents
82         void updateLabels(ParIterator const &);
83         ///
84         void addToToc(ParConstIterator const &) const;
85         ///
86         void doDispatch(Cursor & cur, FuncRequest & cmd);
87         ///
88         Inset * clone() const { return new InsetNote(*this); }
89         /// used by the constructors
90         void init();
91         ///
92         virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
93         ///
94         friend class InsetNoteParams;
95
96         ///
97         InsetNoteParams params_;
98 };
99
100
101 class InsetNoteMailer : public MailInset {
102 public:
103         ///
104         InsetNoteMailer(InsetNote & inset);
105         ///
106         virtual Inset & inset() const { return inset_; }
107         ///
108         virtual std::string const & name() const { return name_; }
109         ///
110         virtual std::string const inset2string(Buffer const &) const;
111         ///
112         static std::string const params2string(InsetNoteParams const &);
113         ///
114         static void string2params(std::string const &, InsetNoteParams &);
115
116 private:
117         ///
118         static std::string const name_;
119         ///
120         InsetNote & inset_;
121 };
122
123
124 } // namespace lyx
125
126 #endif