]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
Cosmetics.
[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 "MailInset.h"
18
19
20 namespace lyx {
21
22
23 class InsetFloatParams {
24 public:
25         ///
26         InsetFloatParams() : wide(false), sideways(false), subfloat(false) {}
27         ///
28         void write(std::ostream & os) const;
29         ///
30         void read(Lexer & lex);
31         ///
32         std::string type;
33         ///
34         std::string placement;
35         ///
36         bool wide;
37         ///
38         bool sideways;
39         ///
40         bool subfloat;
41 };
42
43
44 /** The float inset
45
46 */
47 class InsetFloat : public InsetCollapsable {
48 public:
49         ///
50         InsetFloat(Buffer const &, std::string const &);
51         ///
52         ~InsetFloat();
53         ///
54         docstring name() const { return name_; }
55         ///
56         void write(std::ostream & os) const;
57         ///
58         void read(Lexer & lex);
59         ///
60         void validate(LaTeXFeatures & features) const;
61         ///
62         InsetCode lyxCode() const { return FLOAT_CODE; }
63         ///
64         int latex(odocstream &, OutputParams const &) const;
65         ///
66         int plaintext(odocstream &, OutputParams const &) const;
67         ///
68         int docbook(odocstream &, OutputParams const &) const;
69         ///
70         docstring editMessage() const;
71         ///
72         bool insetAllowed(InsetCode) const;
73         /** returns true if, when outputing LaTeX, font changes should
74             be closed before generating this inset. This is needed for
75             insets that may contain several paragraphs */
76         bool noFontChange() const { return true; }
77         ///
78         void wide(bool w, BufferParams const &);
79         ///
80         void sideways(bool s, BufferParams const &);
81         ///
82         void subfloat(bool s, BufferParams const &);
83         ///
84         bool showInsetDialog(BufferView *) const;
85         ///
86         InsetFloatParams const & params() const { return params_; }
87 private:
88         ///
89         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
90         // Update the counters of this inset and of its contents
91         void updateLabels(ParIterator const &);
92         ///
93         void doDispatch(Cursor & cur, FuncRequest & cmd);
94         ///
95         Inset * clone() const { return new InsetFloat(*this); }
96         ///
97         docstring getCaption(OutputParams const &) const;
98         ///
99         InsetFloatParams params_;
100         ///
101         docstring name_;
102 };
103
104
105 class InsetFloatMailer : public MailInset {
106 public:
107         ///
108         InsetFloatMailer(InsetFloat & inset);
109         ///
110         virtual Inset & inset() const { return inset_; }
111         ///
112         virtual std::string const & name() const { return name_; }
113         ///
114         virtual std::string const inset2string(Buffer const &) const;
115         ///
116         static void string2params(std::string const &, InsetFloatParams &);
117         ///
118         static std::string const params2string(InsetFloatParams const &);
119 private:
120         ///
121         static std::string const name_;
122         ///
123         InsetFloat & inset_;
124 };
125
126
127 } // namespace lyx
128
129 #endif