]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.h
changelogs
[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
17
18 struct InsetNoteParams {
19         enum Type {
20                 Note,
21                 Comment,
22                 Greyedout
23         };
24         /// \c type defaults to Note
25         InsetNoteParams();
26         ///
27         void write(std::ostream & os) const;
28         ///
29         void read(LyXLex & lex);
30         ///
31         Type type;
32 };
33
34
35 /** The PostIt note inset, and other annotations
36
37 */
38 class InsetNote : public InsetCollapsable {
39 public:
40         ///
41         InsetNote(BufferParams const &, std::string const &);
42         ///
43         ~InsetNote();
44         ///
45         std::string const editMessage() const;
46         ///
47         InsetOld::Code lyxCode() const { return InsetOld::NOTE_CODE; }
48         ///
49         void write(Buffer const &, std::ostream &) const;
50         ///
51         void read(Buffer const & buf, LyXLex & lex);
52         ///
53         void setButtonLabel();
54         /// show the note dialog
55         bool showInsetDialog(BufferView * bv) const;
56         ///
57         int latex(Buffer const &, std::ostream &,
58                OutputParams const &) const;
59         ///
60         int linuxdoc(Buffer const &, std::ostream &,
61                OutputParams const &) const;
62         ///
63         int docbook(Buffer const &, std::ostream &,
64                OutputParams const &) const;
65         ///
66         int plaintext(Buffer const &, std::ostream &,
67                OutputParams const &) const;
68         ///
69         void validate(LaTeXFeatures &) const;
70         ///
71         InsetNoteParams const & params() const { return params_; }
72 protected:
73         InsetNote(InsetNote const &);
74         ///
75         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
76 private:
77         friend class InsetNoteParams;
78
79         virtual std::auto_ptr<InsetBase> doClone() const;
80
81         /// used by the constructors
82         void init();
83         ///
84         InsetNoteParams params_;
85 };
86
87
88 #include "mailinset.h"
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 #endif