]> git.lyx.org Git - lyx.git/blob - src/insets/insetwrap.h
unify API for insets export
[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 &,
59                     LatexRunParams const &) const;
60         ///
61         std::string const editMessage() const;
62         ///
63         bool insetAllowed(InsetOld::Code) const;
64         ///
65         void addToToc(lyx::toc::TocList &, Buffer const &) const;
66         ///
67         bool  showInsetDialog(BufferView *) const;
68         ///
69         int latexTextWidth(BufferView *) const;
70         ///
71         InsetWrapParams const & params() const { return params_; }
72 protected:
73         ///
74         virtual
75         DispatchResult
76         priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &);
77 private:
78         ///
79         InsetWrapParams params_;
80 };
81
82
83
84 #include "mailinset.h"
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 #endif