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