]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
Fix bug #6919 by splitting Inset::noFontChange() into inheritFont() and
[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 * buffer, std::string params_str);
55
56         ///
57         static void string2params(std::string const &, InsetFloatParams &);
58         ///
59         static std::string params2string(InsetFloatParams const &);
60         ///
61         void setWide(bool w, bool update_label = true);
62         ///
63         void setSideways(bool s, bool update_label = true);
64         ///
65         void setSubfloat(bool s, bool update_label = true);
66         ///
67         void setNewLabel();
68         ///
69         InsetFloatParams const & params() const { return params_; }
70 private:
71         ///
72         docstring name() const;
73         ///
74         docstring toolTip(BufferView const & bv, int x, int y) const;
75         ///
76         void write(std::ostream & os) const;
77         ///
78         void read(Lexer & lex);
79         ///
80         void validate(LaTeXFeatures & features) const;
81         ///
82         InsetCode lyxCode() const { return FLOAT_CODE; }
83         ///
84         void latex(otexstream &, OutputParams const &) const;
85         ///
86         int plaintext(odocstream &, OutputParams const &) const;
87         ///
88         int docbook(odocstream &, OutputParams const &) const;
89         ///
90         docstring xhtml(XHTMLStream &, OutputParams const &) const;
91         ///
92         bool insetAllowed(InsetCode) const;
93         /** returns false if, when outputing LaTeX, font changes should
94             be closed before generating this inset. This is needed for
95             insets that may contain several paragraphs */
96         bool inheritFont() const { return false; }
97         ///
98         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
99         // Update the counters of this inset and of its contents
100         void updateBuffer(ParIterator const &, UpdateType);
101         ///
102         void doDispatch(Cursor & cur, FuncRequest & cmd);
103         ///
104         Inset * clone() const { return new InsetFloat(*this); }
105         ///
106         docstring getCaption(OutputParams const &) const;
107         ///
108         InsetFloatParams params_;
109 };
110
111
112 } // namespace lyx
113
114 #endif // INSET_FLOAT_H