]> git.lyx.org Git - lyx.git/blob - src/insets/insetwrap.h
* Buffer
[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 "lyxlength.h"
17 #include "mailinset.h"
18 #include "TocBackend.h"
19
20
21 namespace lyx {
22
23
24 class InsetWrapParams {
25 public:
26         ///
27         void write(std::ostream &) const;
28         ///
29         void read(LyXLex &);
30
31         ///
32         std::string type;
33         ///
34         std::string placement;
35         ///
36         LyXLength width;
37 };
38
39
40 /** The wrap inset
41  */
42 class InsetWrap : public InsetCollapsable {
43 public:
44         ///
45         InsetWrap(BufferParams const &, std::string const &);
46         ///
47         ~InsetWrap();
48         ///
49         void write(Buffer const & buf, std::ostream & os) const;
50         ///
51         void read(Buffer const & buf, LyXLex & lex);
52         ///
53         void validate(LaTeXFeatures & features) const;
54         ///
55         InsetBase::Code lyxCode() const { return InsetBase::WRAP_CODE; }
56         ///
57         int latex(Buffer const &, odocstream &,
58                   OutputParams const &) const;
59         ///
60         int docbook(Buffer const &, odocstream &,
61                     OutputParams const &) const;
62         ///
63         virtual docstring const editMessage() const;
64         ///
65         bool insetAllowed(InsetBase::Code) const;
66         ///
67         void addToToc(TocBackend::TocList &, Buffer const &) const;
68         ///
69         bool showInsetDialog(BufferView *) const;
70         ///
71         InsetWrapParams const & params() const { return params_; }
72         ///
73         bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
74 protected:
75         ///
76         virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
77 private:
78         virtual std::auto_ptr<InsetBase> doClone() const;
79
80         ///
81         InsetWrapParams params_;
82 };
83
84
85 class InsetWrapMailer : public MailInset {
86 public:
87         ///
88         InsetWrapMailer(InsetWrap & inset);
89         ///
90         virtual InsetBase & inset() const { return inset_; }
91         ///
92         virtual std::string const & name() const { return name_; }
93         ///
94         virtual std::string const inset2string(Buffer const &) const;
95         ///
96         static void string2params(std::string const &, InsetWrapParams &);
97         ///
98         static std::string const params2string(InsetWrapParams const &);
99 private:
100         ///
101         static std::string const name_;
102         ///
103         InsetWrap & inset_;
104 };
105
106
107 } // namespace lyx
108
109 #endif