]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
4e74486d40025a547e31bea3d7766155df4dd687
[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 #include "insetcollapsable.h"
17 #include "toc.h"
18
19
20 struct InsetFloatParams {
21         ///
22         InsetFloatParams() : wide(false) {}
23         ///
24         void write(std::ostream & os) const;
25         ///
26         void read(LyXLex & lex);
27         ///
28         string type;
29         ///
30         string placement;
31         ///
32         bool wide;
33 };
34
35
36 /** The float inset
37
38 */
39 class InsetFloat : public InsetCollapsable {
40 public:
41         ///
42         InsetFloat(BufferParams const &, string const &);
43         ///
44         InsetFloat(InsetFloat const &, bool same_id = false);
45         ///
46         ~InsetFloat();
47         ///
48         virtual dispatch_result localDispatch(FuncRequest const & cmd); 
49         ///
50         void write(Buffer const * buf, std::ostream & os) const;
51         ///
52         void read(Buffer const * buf, LyXLex & lex);
53         ///
54         void validate(LaTeXFeatures & features) const;
55         ///
56         Inset * clone(Buffer const &, bool same_id = false) const;
57         ///
58         Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
59         ///
60         int latex(Buffer const *, std::ostream &,
61                   LatexRunParams const &) 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         void wide(bool w, BufferParams const &);
74         ///
75         void addToToc(toc::TocList &, Buffer const *) const;
76         ///
77         bool  showInsetDialog(BufferView *) const;
78         ///
79         InsetFloatParams const & params() const { return params_; }
80         
81 private:
82         ///
83         InsetFloatParams params_;
84 };
85
86
87 #include "mailinset.h"
88
89
90 class InsetFloatMailer : public MailInset {
91 public:
92         ///
93         InsetFloatMailer(InsetFloat & inset);
94         ///
95         virtual InsetBase & inset() const { return inset_; }
96         ///
97         virtual string const & name() const { return name_; }
98         ///
99         virtual string const inset2string() const;
100         ///
101         static void string2params(string const &, InsetFloatParams &);
102         ///
103         static string const params2string(InsetFloatParams const &);
104 private:
105         ///
106         static string const name_;
107         ///
108         InsetFloat & inset_;
109 };
110
111 #endif