]> git.lyx.org Git - lyx.git/blob - src/insets/InsetWrap.h
3256b03d84f6766010b7d13a793878fa1495105e
[lyx.git] / src / insets / InsetWrap.h
1 // -*- C++ -*-
2 /**
3  * \file InsetWrap.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Dekel Tsur
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef INSETWRAP_H
13 #define INSETWRAP_H
14
15 #include "InsetCollapsable.h"
16 #include "Length.h"
17 #include "MailInset.h"
18
19
20 namespace lyx {
21
22
23 class InsetWrapParams {
24 public:
25         ///
26         void write(std::ostream &) const;
27         ///
28         void read(Lexer &);
29
30         ///
31         std::string type;
32         ///
33         int lines;
34         ///
35         std::string placement;
36         ///
37         Length overhang;
38         ///
39         Length width;
40 };
41
42
43 /** The wrap inset
44  */
45 class InsetWrap : public InsetCollapsable {
46 public:
47         ///
48         InsetWrap(BufferParams const &, std::string const &);
49         ///
50         ~InsetWrap();
51         ///
52         void write(std::ostream & os) const;
53         ///
54         void read(Lexer & lex);
55         ///
56         void draw(PainterInfo & pi, int x, int y) const;
57         ///
58         void validate(LaTeXFeatures & features) const;
59         ///
60         InsetCode lyxCode() const { return WRAP_CODE; }
61         ///
62         bool isMacroScope() const { return true; }
63         ///
64         int latex(odocstream &, OutputParams const &) const;
65         ///
66         int plaintext(odocstream &, OutputParams const &) const;
67         ///
68         int docbook(odocstream &, OutputParams const &) const;
69         ///
70         docstring editMessage() const;
71         ///
72         bool insetAllowed(InsetCode) const;
73         ///
74         bool showInsetDialog(BufferView *) const;
75         ///
76         InsetWrapParams const & params() const { return params_; }
77         ///
78         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
79         // Update the counters of this inset and of its contents
80         void updateLabels(ParIterator const &);
81 protected:
82         ///
83         void doDispatch(Cursor & cur, FuncRequest & cmd);
84         ///
85         docstring name() const { return name_; }
86 private:
87         Inset * clone() const;
88
89         ///
90         InsetWrapParams params_;
91         ///
92         docstring name_;
93 };
94
95
96 class InsetWrapMailer : public MailInset {
97 public:
98         ///
99         InsetWrapMailer(InsetWrap & inset);
100         ///
101         virtual Inset & inset() const { return inset_; }
102         ///
103         virtual std::string const & name() const { return name_; }
104         ///
105         virtual std::string const inset2string(Buffer const &) const;
106         ///
107         static void string2params(std::string const &, InsetWrapParams &);
108         ///
109         static std::string const params2string(InsetWrapParams const &);
110 private:
111         ///
112         static std::string const name_;
113         ///
114         InsetWrap & inset_;
115 };
116
117
118 } // namespace lyx
119
120 #endif