]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
The markDirty() and fitCursor() changes
[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
21 struct InsetFloatParams {
22         ///
23         InsetFloatParams() : wide(false) {}
24         ///
25         void write(std::ostream & os) const;
26         ///
27         void read(LyXLex & lex);
28         ///
29         string type;
30         ///
31         string placement;
32         ///
33         bool wide;
34 };
35
36
37 /** The float inset
38
39 */
40 class InsetFloat : public InsetCollapsable {
41 public:
42         ///
43         InsetFloat(BufferParams const &, string const &);
44         ///
45         InsetFloat(InsetFloat const &, bool same_id = false);
46         ///
47         ~InsetFloat();
48         ///
49         virtual dispatch_result localDispatch(FuncRequest const & cmd); 
50         ///
51         void write(Buffer const * buf, std::ostream & os) const;
52         ///
53         void read(Buffer const * buf, LyXLex & lex);
54         ///
55         void validate(LaTeXFeatures & features) const;
56         ///
57         Inset * clone(Buffer const &, bool same_id = false) const;
58         ///
59         Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
60         ///
61         int latex(Buffer const *, std::ostream &, bool fragile, bool fp) const;
62         ///
63         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
64         ///
65         string const editMessage() const;
66         ///
67         bool insetAllowed(Inset::Code) const;
68         /** returns true if, when outputing LaTeX, font changes should
69             be closed before generating this inset. This is needed for
70             insets that may contain several paragraphs */
71         bool noFontChange() const { return true; }
72         ///
73         string const & type() const;
74         ///
75         void placement(string const & p);
76         ///
77         string const & placement() const;
78         ///
79         void wide(bool w, BufferParams const &);
80         ///
81         bool wide() const;
82         ///
83         void addToToc(toc::TocList &, Buffer const *) const;
84         ///
85         bool  showInsetDialog(BufferView *) const;
86         ///
87         InsetFloatParams const & params() const { return params_; }
88         
89 private:
90         ///
91         InsetFloatParams params_;
92 };
93
94
95 #include "mailinset.h"
96
97
98 class InsetFloatMailer : public MailInset {
99 public:
100         ///
101         InsetFloatMailer(InsetFloat & inset);
102         ///
103         virtual InsetBase & inset() const { return inset_; }
104         ///
105         virtual string const & name() const { return name_; }
106         ///
107         virtual string const inset2string() const;
108         ///
109         static void string2params(string const &, InsetFloatParams &);
110         ///
111         static string const params2string(InsetFloatParams const &);
112 private:
113         ///
114         static string const name_;
115         ///
116         InsetFloat & inset_;
117 };
118
119 #endif