]> git.lyx.org Git - lyx.git/blob - src/insets/InsetWrap.h
rename/merge LyXLength related stuff
[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         InsetBase::Code lyxCode() const { return InsetBase::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(InsetBase::Code) const;
68         ///
69         void addToToc(TocList &, Buffer const &) const;
70         ///
71         bool showInsetDialog(BufferView *) const;
72         ///
73         InsetWrapParams const & params() const { return params_; }
74         ///
75         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
76 protected:
77         ///
78         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
79 private:
80         virtual std::auto_ptr<InsetBase> doClone() const;
81
82         ///
83         InsetWrapParams params_;
84 };
85
86
87 class InsetWrapMailer : public MailInset {
88 public:
89         ///
90         InsetWrapMailer(InsetWrap & inset);
91         ///
92         virtual InsetBase & inset() const { return inset_; }
93         ///
94         virtual std::string const & name() const { return name_; }
95         ///
96         virtual std::string const inset2string(Buffer const &) const;
97         ///
98         static void string2params(std::string const &, InsetWrapParams &);
99         ///
100         static std::string const params2string(InsetWrapParams const &);
101 private:
102         ///
103         static std::string const name_;
104         ///
105         InsetWrap & inset_;
106 };
107
108
109 } // namespace lyx
110
111 #endif