]> git.lyx.org Git - lyx.git/blob - src/insets/InsetFloat.h
Revert "Do not crash is release mode if we stumble across an unrealized font."
[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 class InsetFloatParams
22 {
23 public:
24         ///
25         InsetFloatParams() : type("senseless"), wide(false), sideways(false), subfloat(false) {}
26         ///
27         void write(std::ostream & os) const;
28         ///
29         void read(Lexer & lex);
30         ///
31         std::string type;
32         ///
33         std::string placement;
34         /// span columns
35         bool wide;
36         ///
37         bool sideways;
38         ///
39         bool subfloat;
40 };
41
42
43
44 /////////////////////////////////////////////////////////////////////////
45 //
46 // InsetFloat
47 //
48 /////////////////////////////////////////////////////////////////////////
49
50 /// Used for "floating" objects like tables, figures etc.
51 class InsetFloat : public InsetCaptionable
52 {
53 public:
54         InsetFloat(Buffer * buffer, std::string params_str);
55         ///
56         static void string2params(std::string const &, InsetFloatParams &);
57         ///
58         static std::string params2string(InsetFloatParams const &);
59         ///
60         void setWide(bool w, bool update_label = true);
61         ///
62         void setSideways(bool s, bool update_label = true);
63         ///
64         void setSubfloat(bool s, bool update_label = true);
65         ///
66         void setNewLabel();
67         ///
68         InsetFloatParams const & params() const { return params_; }
69         ///
70         bool allowsCaptionVariation(std::string const &) const;
71 private:
72         ///
73         void setCaptionType(std::string const & type);
74         ///
75         docstring layoutName() const;
76         ///
77         docstring toolTip(BufferView const & bv, int x, int y) const;
78         ///
79         void write(std::ostream & os) const;
80         ///
81         void read(Lexer & lex);
82         ///
83         void validate(LaTeXFeatures & features) const;
84         ///
85         InsetCode lyxCode() const { return FLOAT_CODE; }
86         ///
87         void latex(otexstream &, OutputParams const &) const;
88         ///
89         int plaintext(odocstringstream & ods, OutputParams const & op,
90                       size_t max_length = INT_MAX) const;
91         ///
92         int docbook(odocstream &, OutputParams const &) const;
93         ///
94         docstring xhtml(XHTMLStream &, OutputParams const &) const;
95         ///
96         bool insetAllowed(InsetCode) const;
97         /** returns false 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 inheritFont() const { return false; }
101         ///
102         bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
103         ///
104         bool hasSubCaptions(ParIterator const & it) const;
105         ///
106         void doDispatch(Cursor & cur, FuncRequest & cmd);
107         ///
108         Inset * clone() const { return new InsetFloat(*this); }
109         ///
110         docstring getCaption(OutputParams const &) const;
111         ///
112         void getCaption(otexstream & os, OutputParams const & runparams) const;
113
114         InsetFloatParams params_;
115 };
116
117
118 } // namespace lyx
119
120 #endif // INSET_FLOAT_H