]> git.lyx.org Git - lyx.git/blob - src/insets/InsetNote.h
Loop refactoring
[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 INSET_NOTE_H
13 #define INSET_NOTE_H
14
15 #include "InsetCollapsible.h"
16
17
18 namespace lyx {
19
20 class InsetNoteParams
21 {
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 /////////////////////////////////////////////////////////////////////////
40 //
41 // InsetNote
42 //
43 /////////////////////////////////////////////////////////////////////////
44
45 /// The PostIt note inset, and other annotations
46 class InsetNote : public InsetCollapsible
47 {
48 public:
49         ///
50         InsetNote(Buffer *, std::string const &);
51         ///
52         ~InsetNote();
53         ///
54         static std::string params2string(InsetNoteParams const &);
55         ///
56         static void string2params(std::string const &, InsetNoteParams &);
57         ///
58         InsetNoteParams const & params() const { return params_; }
59 private:
60         ///
61         InsetCode lyxCode() const override { return NOTE_CODE; }
62         ///
63         docstring layoutName() const override;
64         /** returns false if, when outputting LaTeX, font changes should
65             be closed before generating this inset. This is needed for
66             insets that may contain several paragraphs */
67         bool inheritFont() const override { return params_.type == InsetNoteParams::Note; }
68         /// Is the content of this inset part of the output document?
69         bool producesOutput() const override
70                 { return params_.type == InsetNoteParams::Greyedout; }
71         ///
72         bool allowSpellCheck() const override;
73         ///
74         FontInfo getFont() const override;
75         ///
76         void write(std::ostream &) const override;
77         ///
78         void read(Lexer & lex) override;
79         /// show the note dialog
80         bool showInsetDialog(BufferView * bv) const override;
81         ///
82         bool isMacroScope() const override;
83         ///
84         void latex(otexstream &, OutputParams const &) const override;
85         ///
86         int plaintext(odocstringstream & ods, OutputParams const & op,
87                       size_t max_length = INT_MAX) const override;
88         ///
89         void docbook(XMLStream &, OutputParams const &) const override;
90         ///
91         docstring xhtml(XMLStream &, OutputParams const &) const override;
92         ///
93         void validate(LaTeXFeatures &) const override;
94         ///
95         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
96         ///
97         void doDispatch(Cursor & cur, FuncRequest & cmd) override;
98         ///
99         Inset * clone() const override { return new InsetNote(*this); }
100         /// used by the constructors
101         void init();
102         ///
103         std::string contextMenuName() const override;
104         ///
105         friend class InsetNoteParams;
106
107         ///
108         InsetNoteParams params_;
109 };
110
111 } // namespace lyx
112
113 #endif // INSET_NOTE_H