]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
InsetInfo: enable inset dissolve
[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 "InsetCaptionable.h"
17
18
19 namespace lyx {
20
21 struct TexString;
22
23
24 class InsetFloatParams
25 {
26 public:
27         ///
28         InsetFloatParams() : type("senseless"), placement("document"), alignment("document"),
29                 wide(false), sideways(false), subfloat(false) {}
30         ///
31         void write(std::ostream & os) const;
32         ///
33         void read(Lexer & lex);
34         ///
35         std::string type;
36         ///
37         std::string placement;
38         ///
39         std::string alignment;
40         /// span columns
41         bool wide;
42         ///
43         bool sideways;
44         ///
45         bool subfloat;
46 };
47
48
49
50 /////////////////////////////////////////////////////////////////////////
51 //
52 // InsetFloat
53 //
54 /////////////////////////////////////////////////////////////////////////
55
56 /// Used for "floating" objects like tables, figures etc.
57 class InsetFloat : public InsetCaptionable
58 {
59 public:
60         InsetFloat(Buffer * buffer, std::string params_str);
61         ///
62         static void string2params(std::string const &, InsetFloatParams &);
63         ///
64         static std::string params2string(InsetFloatParams const &);
65         ///
66         void setWide(bool w, bool update_label = true);
67         ///
68         void setSideways(bool s, bool update_label = true);
69         ///
70         void setSubfloat(bool s, bool update_label = true);
71         ///
72         void setNewLabel();
73         ///
74         InsetFloatParams const & params() const { return params_; }
75         ///
76         bool allowsCaptionVariation(std::string const &) const;
77         ///
78         LyXAlignment contentAlignment() const;
79 private:
80         ///
81         void setCaptionType(std::string const & type);
82         ///
83         docstring layoutName() const;
84         ///
85         docstring toolTip(BufferView const & bv, int x, int y) const;
86         ///
87         void write(std::ostream & os) const;
88         ///
89         void read(Lexer & lex);
90         ///
91         void validate(LaTeXFeatures & features) const;
92         ///
93         InsetCode lyxCode() const { return FLOAT_CODE; }
94         ///
95         void latex(otexstream &, OutputParams const &) const;
96         ///
97         int plaintext(odocstringstream & ods, OutputParams const & op,
98                       size_t max_length = INT_MAX) const;
99         ///
100         int docbook(odocstream &, OutputParams const &) const;
101         ///
102         docstring xhtml(XHTMLStream &, OutputParams const &) const;
103         ///
104         bool insetAllowed(InsetCode) const;
105         /** returns false if, when outputing LaTeX, font changes should
106             be closed before generating this inset. This is needed for
107             insets that may contain several paragraphs */
108         bool inheritFont() const { return false; }
109         ///
110         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
111         ///
112         bool hasSubCaptions(ParIterator const & it) const;
113         ///
114         void doDispatch(Cursor & cur, FuncRequest & cmd);
115         ///
116         Inset * clone() const { return new InsetFloat(*this); }
117         /// Is the content of this inset part of the immediate (visible) text sequence?
118         bool isPartOfTextSequence() const { return false; }
119         ///
120         TexString getCaption(OutputParams const &) const;
121         ///
122         std::string getAlignment() const;
123
124         InsetFloatParams params_;
125 };
126
127
128 } // namespace lyx
129
130 #endif // INSET_FLOAT_H