]> git.lyx.org Git - lyx.git/blob - src/insets/InsetWrap.h
* src/insets/InsetWrap.{cpp,h}:
[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 validate(LaTeXFeatures & features) const;
57         ///
58         InsetCode lyxCode() const { return WRAP_CODE; }
59         ///
60         bool isMacroScope() const { return true; }
61         ///
62         int latex(odocstream &, OutputParams const &) const;
63         ///
64         int plaintext(odocstream &, OutputParams const &) const;
65         ///
66         int docbook(odocstream &, OutputParams const &) const;
67         ///
68         docstring editMessage() const;
69         ///
70         bool insetAllowed(InsetCode) const;
71         ///
72         bool showInsetDialog(BufferView *) const;
73         ///
74         InsetWrapParams const & params() const { return params_; }
75         ///
76         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
77         // Update the counters of this inset and of its contents
78         void updateLabels(ParIterator const &);
79 protected:
80         ///
81         void doDispatch(Cursor & cur, FuncRequest & cmd);
82         ///
83         docstring name() const { return name_; }
84 private:
85         Inset * clone() const;
86
87         ///
88         InsetWrapParams params_;
89         ///
90         docstring name_;
91 };
92
93
94 class InsetWrapMailer : public MailInset {
95 public:
96         ///
97         InsetWrapMailer(InsetWrap & inset);
98         ///
99         virtual Inset & inset() const { return inset_; }
100         ///
101         virtual std::string const & name() const { return name_; }
102         ///
103         virtual std::string const inset2string(Buffer const &) const;
104         ///
105         static void string2params(std::string const &, InsetWrapParams &);
106         ///
107         static std::string const params2string(InsetWrapParams const &);
108 private:
109         ///
110         static std::string const name_;
111         ///
112         InsetWrap & inset_;
113 };
114
115
116 } // namespace lyx
117
118 #endif