]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
Move the float dialog to the new scheme.
[lyx.git] / src / insets / insetfloat.h
1 // -*- C++ -*-
2 /**
3  * \file insetfloat.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  *
10  * Full author contact details are available in file CREDITS
11  */
12
13 #ifndef InsetFloat_H
14 #define InsetFloat_H
15
16
17 #include "insetcollapsable.h"
18 #include "toc.h"
19
20 class Painter;
21
22 struct InsetFloatParams {
23         ///
24         InsetFloatParams() : placement("htbp"), wide(false) {}
25         ///
26         void write(std::ostream & os) const;
27         ///
28         void read(LyXLex & lex);
29         ///
30         string type;
31         ///
32         string placement;
33         ///
34         bool wide;
35 };
36
37
38 /** The float inset
39
40 */
41 class InsetFloat : public InsetCollapsable {
42 public:
43         ///
44         InsetFloat(BufferParams const &, string const &);
45         ///
46         InsetFloat(InsetFloat const &, bool same_id = false);
47         ///
48         ~InsetFloat();
49
50         ///
51         virtual dispatch_result localDispatch(FuncRequest const & cmd); 
52
53         ///
54         void write(Buffer const * buf, std::ostream & os) const;
55         ///
56         void read(Buffer const * buf, LyXLex & lex);
57         ///
58         void validate(LaTeXFeatures & features) const;
59         ///
60         Inset * clone(Buffer const &, bool same_id = false) const;
61         ///
62         Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
63         ///
64         int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
65         ///
66         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
67         ///
68         string const editMessage() const;
69         ///
70         bool insetAllowed(Inset::Code) const;
71         /** returns true if, when outputing LaTeX, font changes should
72             be closed before generating this inset. This is needed for
73             insets that may contain several paragraphs */
74         bool noFontChange() const { return true; }
75         ///
76         string const & type() const;
77         ///
78         void placement(string const & p);
79         ///
80         string const & placement() const;
81         ///
82         void wide(bool w, BufferParams const &);
83         ///
84         bool wide() const;
85         ///
86         void addToToc(toc::TocList &, Buffer const *) const;
87         ///
88         bool  showInsetDialog(BufferView *) const;
89         ///
90         InsetFloatParams const & params() const { return params_; }
91         
92 private:
93         ///
94         InsetFloatParams params_;
95 };
96
97
98 #include "mailinset.h"
99
100
101 class InsetFloatMailer : public MailInset {
102 public:
103         ///
104         InsetFloatMailer(InsetFloat & inset);
105         ///
106         virtual Inset & inset() const { return inset_; }
107         ///
108         virtual string const & name() const { return name_; }
109         ///
110         virtual string const inset2string() const;
111         ///
112         static void string2params(string const &, InsetFloatParams &);
113         ///
114         static string const params2string(string const & name,
115                                           InsetFloatParams const &);
116 private:
117         ///
118         string const name_;
119         ///
120         InsetFloat & inset_;
121 };
122
123 #endif