]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
cf50e2a53cfa1d4eeb06fe6a597b750240c2ba21
[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(BufferParams 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         bool isMacroScope() const { return true; }
65         ///
66         int latex(odocstream &, OutputParams const &) const;
67         ///
68         int plaintext(odocstream &, OutputParams const &) const;
69         ///
70         int docbook(odocstream &, OutputParams const &) const;
71         ///
72         docstring editMessage() const;
73         ///
74         bool insetAllowed(InsetCode) const;
75         /** returns true if, when outputing LaTeX, font changes should
76             be closed before generating this inset. This is needed for
77             insets that may contain several paragraphs */
78         bool noFontChange() const { return true; }
79         ///
80         void wide(bool w, BufferParams const &);
81         ///
82         void sideways(bool s, BufferParams const &);
83         ///
84         void subfloat(bool s, BufferParams const &);
85         ///
86         bool  showInsetDialog(BufferView *) const;
87         ///
88         InsetFloatParams const & params() const { return params_; }
89         ///
90         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
91         // Update the counters of this inset and of its contents
92         void updateLabels(ParIterator const &);
93 protected:
94         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
95 private:
96         ///
97         virtual Inset * clone() const;
98         ///
99         docstring getCaption(OutputParams const &) const;
100         ///
101         InsetFloatParams params_;
102         ///
103         docstring name_;
104 };
105
106
107 class InsetFloatMailer : public MailInset {
108 public:
109         ///
110         InsetFloatMailer(InsetFloat & inset);
111         ///
112         virtual Inset & inset() const { return inset_; }
113         ///
114         virtual std::string const & name() const { return name_; }
115         ///
116         virtual std::string const inset2string(Buffer const &) const;
117         ///
118         static void string2params(std::string const &, InsetFloatParams &);
119         ///
120         static std::string const params2string(InsetFloatParams const &);
121 private:
122         ///
123         static std::string const name_;
124         ///
125         InsetFloat & inset_;
126 };
127
128
129 } // namespace lyx
130
131 #endif