]> git.lyx.org Git - lyx.git/blob - src/insets/InsetWrap.h
f56bbf19878cca2879f8b0a7dda5292602be74fc
[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         std::string placement;
34         ///
35         Length width;
36 };
37
38
39 /** The wrap inset
40  */
41 class InsetWrap : public InsetCollapsable {
42 public:
43         ///
44         InsetWrap(BufferParams const &, std::string const &);
45         ///
46         ~InsetWrap();
47         ///
48         void write(Buffer const & buf, std::ostream & os) const;
49         ///
50         void read(Buffer const & buf, Lexer & lex);
51         ///
52         void validate(LaTeXFeatures & features) const;
53         ///
54         Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
55         ///
56         int latex(Buffer const &, odocstream &,
57                   OutputParams const &) const;
58         ///
59         int plaintext(Buffer const &, odocstream &,
60                       OutputParams const &) const;
61         ///
62         int docbook(Buffer const &, odocstream &,
63                     OutputParams const &) const;
64         ///
65         virtual docstring const editMessage() const;
66         ///
67         bool insetAllowed(Inset::Code) const;
68         ///
69         bool showInsetDialog(BufferView *) const;
70         ///
71         InsetWrapParams const & params() const { return params_; }
72         ///
73         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
74         // Update the counters of this inset and of its contents
75         virtual void updateLabels(Buffer const &, ParIterator const &);
76 protected:
77         ///
78         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
79         ///
80         virtual docstring name() const { return name_; }
81 private:
82         virtual Inset * clone() const;
83
84         ///
85         InsetWrapParams params_;
86         ///
87         docstring name_;
88 };
89
90
91 class InsetWrapMailer : public MailInset {
92 public:
93         ///
94         InsetWrapMailer(InsetWrap & inset);
95         ///
96         virtual Inset & inset() const { return inset_; }
97         ///
98         virtual std::string const & name() const { return name_; }
99         ///
100         virtual std::string const inset2string(Buffer const &) const;
101         ///
102         static void string2params(std::string const &, InsetWrapParams &);
103         ///
104         static std::string const params2string(InsetWrapParams const &);
105 private:
106         ///
107         static std::string const name_;
108         ///
109         InsetWrap & inset_;
110 };
111
112
113 } // namespace lyx
114
115 #endif