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