]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
progress on buffer-reference-in-insets. beware of instabilities...
[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(std::ostream & os) const;
55         ///
56         void read(Lexer & lex);
57         ///
58         void validate(LaTeXFeatures & features) const;
59         ///
60         InsetCode lyxCode() const { return FLOAT_CODE; }
61         ///
62         bool isMacroScope() const { return true; }
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         bool  showInsetDialog(BufferView *) const;
83         ///
84         InsetFloatParams const & params() const { return params_; }
85         ///
86         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
87         // Update the counters of this inset and of its contents
88         void updateLabels(ParIterator const &);
89 protected:
90         virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
91 private:
92         ///
93         virtual Inset * clone() const;
94         ///
95         InsetFloatParams params_;
96         ///
97         docstring name_;
98 };
99
100
101 class InsetFloatMailer : public MailInset {
102 public:
103         ///
104         InsetFloatMailer(InsetFloat & inset);
105         ///
106         virtual Inset & inset() const { return inset_; }
107         ///
108         virtual std::string const & name() const { return name_; }
109         ///
110         virtual std::string const inset2string(Buffer const &) const;
111         ///
112         static void string2params(std::string const &, InsetFloatParams &);
113         ///
114         static std::string const params2string(InsetFloatParams const &);
115 private:
116         ///
117         static std::string const name_;
118         ///
119         InsetFloat & inset_;
120 };
121
122
123 } // namespace lyx
124
125 #endif