]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.h
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[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(LyXLex & 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         InsetBase::Code lyxCode() const { return InsetBase::NOTE_CODE; }
54         ///
55         void write(Buffer const &, std::ostream &) const;
56         ///
57         void read(Buffer const & buf, LyXLex & lex);
58         ///
59         void setButtonLabel();
60         /// show the note dialog
61         bool showInsetDialog(BufferView * bv) const;
62         ///
63         int latex(Buffer const &, odocstream &, OutputParams const &) const;
64         ///
65         int docbook(Buffer const &, odocstream &, OutputParams const &) const;
66         ///
67         int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
68         ///
69         void validate(LaTeXFeatures &) const;
70         ///
71         InsetNoteParams const & params() const { return params_; }
72         ///
73         bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
74 protected:
75         InsetNote(InsetNote const &);
76         ///
77         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
78 private:
79         friend class InsetNoteParams;
80
81         virtual std::auto_ptr<InsetBase> doClone() const;
82
83         /// used by the constructors
84         void init();
85         ///
86         InsetNoteParams params_;
87 };
88
89
90 class InsetNoteMailer : public MailInset {
91 public:
92         ///
93         InsetNoteMailer(InsetNote & inset);
94         ///
95         virtual InsetBase & inset() const { return inset_; }
96         ///
97         virtual std::string const & name() const { return name_; }
98         ///
99         virtual std::string const inset2string(Buffer const &) const;
100         ///
101         static std::string const params2string(InsetNoteParams const &);
102         ///
103         static void string2params(std::string const &, InsetNoteParams &);
104
105 private:
106         ///
107         static std::string const name_;
108         ///
109         InsetNote & inset_;
110 };
111
112
113 } // namespace lyx
114
115 #endif