]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.h
Clean-up of the Note, Branch mailer interface.
[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         ///
20         void write(std::ostream & os) const;
21         ///
22         void read(LyXLex & lex);
23         ///
24         std::string type;
25 };
26
27
28 /** The PostIt note inset, and other annotations
29
30 */
31 class InsetNote : public InsetCollapsable {
32 public:
33         ///
34         InsetNote(BufferParams const &, std::string const &);
35         /// Copy constructor
36         InsetNote(InsetNote const &);
37         ///
38         ~InsetNote();
39         ///
40         virtual std::auto_ptr<InsetBase> clone() const;
41         ///
42         std::string const editMessage() const;
43         ///
44         InsetOld::Code lyxCode() const { return InsetOld::NOTE_CODE; }
45         ///
46         void write(Buffer const &, std::ostream &) const;
47         ///
48         void read(Buffer const & buf, LyXLex & lex);
49         ///
50         void setButtonLabel();
51         /// show the note dialog
52         bool showInsetDialog(BufferView * bv) const;
53         ///
54         int latex(Buffer const &, std::ostream &,
55                OutputParams const &) const;
56         ///
57         int linuxdoc(Buffer const &, std::ostream &,
58                OutputParams const &) const;
59         ///
60         int docbook(Buffer const &, std::ostream &,
61                OutputParams const &) const;
62         ///
63         int plaintext(Buffer const &, std::ostream &,
64                OutputParams const &) const;
65         ///
66         void validate(LaTeXFeatures &) const;
67         ///
68         InsetNoteParams const & params() const { return params_; }
69 protected:
70         ///
71         virtual
72         DispatchResult
73         priv_dispatch(FuncRequest const &, idx_type &, pos_type &);
74 private:
75         friend class InsetNoteParams;
76
77         /// used by the constructors
78         void init();
79         ///
80         InsetNoteParams params_;
81 };
82
83
84 #include "mailinset.h"
85
86 class InsetNoteMailer : public MailInset {
87 public:
88         ///
89         InsetNoteMailer(InsetNote & inset);
90         ///
91         virtual InsetBase & inset() const { return inset_; }
92         ///
93         virtual std::string const & name() const { return name_; }
94         ///
95         virtual std::string const inset2string(Buffer const &) const;
96         ///
97         static std::string const params2string(InsetNoteParams const &);
98         ///
99         static void string2params(std::string const &, InsetNoteParams &);
100
101 private:
102         ///
103         static std::string const name_;
104         ///
105         InsetNote & inset_;
106 };
107
108 #endif