]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
4f1328da02de44f6752b284bb00d8dabffdff3ca
[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 InsetCaption;
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         /// span columns
36         bool wide;
37         ///
38         bool sideways;
39         ///
40         bool subfloat;
41 };
42
43
44
45 /////////////////////////////////////////////////////////////////////////
46 //
47 // InsetFloat
48 //
49 /////////////////////////////////////////////////////////////////////////
50
51 /// Used for "floating" objects like tables, figures etc.
52 class InsetFloat : public InsetCollapsable
53 {
54 public:
55         ///
56         InsetFloat(Buffer const &, std::string const &);
57         ///
58         ~InsetFloat();
59
60         ///
61         static void string2params(std::string const &, InsetFloatParams &);
62         ///
63         static std::string params2string(InsetFloatParams const &);
64         ///
65         void setWide(bool w, BufferParams const &, bool update_label = true);
66         ///
67         void setSideways(bool s, BufferParams const &, bool update_label = true);
68         ///
69         void setSubfloat(bool s, BufferParams const &, bool update_label = true);
70         ///
71         void setNewLabel(BufferParams const &);
72         ///
73         InsetFloatParams const & params() const { return params_; }
74 private:
75         ///
76         docstring name() const;
77         ///
78         docstring toolTip(BufferView const & bv, int x, int y) const;
79         ///
80         void write(std::ostream & os) const;
81         ///
82         void read(Lexer & lex);
83         ///
84         void validate(LaTeXFeatures & features) const;
85         ///
86         InsetCode lyxCode() const { return FLOAT_CODE; }
87         ///
88         int latex(odocstream &, OutputParams const &) const;
89         ///
90         int plaintext(odocstream &, OutputParams const &) const;
91         ///
92         int docbook(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         docstring getCaptionText(OutputParams const &) const;
115         ///
116         InsetCaption const * getCaptionInset() const;
117         ///
118         InsetFloatParams params_;
119         ///
120         docstring name_;
121 };
122
123
124 } // namespace lyx
125
126 #endif // INSET_FLOAT_H