]> git.lyx.org Git - lyx.git/blob - src/insets/insetwrap.h
Enable the external inset to handle unknown templates gracefully.
[lyx.git] / src / insets / insetwrap.h
1 /**
2  * \file insetwrap.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Dekel Tsur
7  *
8  * Full author contact details are available in file CREDITS
9  */
10
11 #ifndef InsetWrap_H
12 #define InsetWrap_H
13
14
15 #include "insetcollapsable.h"
16 #include "toc.h"
17 #include "lyxlength.h"
18
19
20 struct InsetWrapParams {
21         ///
22         void write(std::ostream &) const;
23         ///
24         void read(LyXLex &);
25
26         ///
27         string type;
28         ///
29         string placement;
30         ///
31         LyXLength width;
32 };
33
34
35 /** The wrap inset
36  */
37 class InsetWrap : public InsetCollapsable {
38 public:
39         ///
40         InsetWrap(BufferParams const &, string const &);
41         ///
42         ~InsetWrap();
43         ///
44         virtual dispatch_result localDispatch(FuncRequest const & cmd);
45         ///
46         void write(Buffer const * buf, std::ostream & os) const;
47         ///
48         void read(Buffer const * buf, LyXLex & lex);
49         ///
50         void validate(LaTeXFeatures & features) const;
51         ///
52         Inset * clone() const;
53         ///
54         Inset::Code lyxCode() const { return Inset::WRAP_CODE; }
55         ///
56         int latex(Buffer const *, std::ostream &,
57                   LatexRunParams const &) const;
58         ///
59         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
60         ///
61         string const editMessage() const;
62         ///
63         bool insetAllowed(Inset::Code) const;
64         ///
65         int getMaxWidth(BufferView *, UpdatableInset const *) const;
66         ///
67         void addToToc(toc::TocList &, Buffer const *) const;
68         ///
69         bool  showInsetDialog(BufferView *) const;
70         ///
71         int latexTextWidth(BufferView *) const;
72         ///
73         InsetWrapParams const & params() const { return params_; }
74 private:
75         ///
76         InsetWrapParams params_;
77 };
78
79
80
81 #include "mailinset.h"
82
83
84 class InsetWrapMailer : public MailInset {
85 public:
86         ///
87         InsetWrapMailer(InsetWrap & inset);
88         ///
89         virtual InsetBase & inset() const { return inset_; }
90         ///
91         virtual string const & name() const { return name_; }
92         ///
93         virtual string const inset2string() const;
94         ///
95         static void string2params(string const &, InsetWrapParams &);
96         ///
97         static string const params2string(InsetWrapParams const &);
98 private:
99         ///
100         static string const name_;
101         ///
102         InsetWrap & inset_;
103 };
104
105 #endif