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