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