]> git.lyx.org Git - lyx.git/blob - src/insets/insetfloat.h
fix #832
[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 &, bool fragile, bool fp) const;
61         ///
62         int docbook(Buffer const *, std::ostream &, bool mixcont) const;
63         ///
64         string const editMessage() const;
65         ///
66         bool insetAllowed(Inset::Code) const;
67         /** returns true if, when outputing LaTeX, font changes should
68             be closed before generating this inset. This is needed for
69             insets that may contain several paragraphs */
70         bool noFontChange() const { return true; }
71         ///
72         void wide(bool w, BufferParams const &);
73         ///
74         void addToToc(toc::TocList &, Buffer const *) const;
75         ///
76         bool  showInsetDialog(BufferView *) const;
77         ///
78         InsetFloatParams const & params() const { return params_; }
79         
80 private:
81         ///
82         InsetFloatParams params_;
83 };
84
85
86 #include "mailinset.h"
87
88
89 class InsetFloatMailer : public MailInset {
90 public:
91         ///
92         InsetFloatMailer(InsetFloat & inset);
93         ///
94         virtual InsetBase & inset() const { return inset_; }
95         ///
96         virtual string const & name() const { return name_; }
97         ///
98         virtual string const inset2string() const;
99         ///
100         static void string2params(string const &, InsetFloatParams &);
101         ///
102         static string const params2string(InsetFloatParams const &);
103 private:
104         ///
105         static string const name_;
106         ///
107         InsetFloat & inset_;
108 };
109
110 #endif