]> git.lyx.org Git - lyx.git/blob - src/insets/insetnote.h
Introduce wide streams. This fixes the remaining problems of plain text
[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 class InsetNoteParams {
19 public:
20         enum Type {
21                 Note,
22                 Comment,
23                 Greyedout,
24                 Framed,
25                 Shaded
26         };
27         /// \c type defaults to Note
28         InsetNoteParams();
29         ///
30         void write(std::ostream & os) const;
31         ///
32         void read(LyXLex & lex);
33         ///
34         Type type;
35 };
36
37
38 /** The PostIt note inset, and other annotations
39
40 */
41 class InsetNote : public InsetCollapsable {
42 public:
43         ///
44         InsetNote(BufferParams const &, std::string const &);
45         ///
46         ~InsetNote();
47         ///
48         virtual lyx::docstring const editMessage() const;
49         ///
50         InsetBase::Code lyxCode() const { return InsetBase::NOTE_CODE; }
51         ///
52         void write(Buffer const &, std::ostream &) const;
53         ///
54         void read(Buffer const & buf, LyXLex & lex);
55         ///
56         void setButtonLabel();
57         /// show the note dialog
58         bool showInsetDialog(BufferView * bv) const;
59         ///
60         int latex(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 &, lyx::odocstream &,
67                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 #include "mailinset.h"
91
92 class InsetNoteMailer : public MailInset {
93 public:
94         ///
95         InsetNoteMailer(InsetNote & inset);
96         ///
97         virtual InsetBase & inset() const { return inset_; }
98         ///
99         virtual std::string const & name() const { return name_; }
100         ///
101         virtual std::string const inset2string(Buffer const &) const;
102         ///
103         static std::string const params2string(InsetNoteParams const &);
104         ///
105         static void string2params(std::string const &, InsetNoteParams &);
106
107 private:
108         ///
109         static std::string const name_;
110         ///
111         InsetNote & inset_;
112 };
113
114 #endif