4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
8 * \author Lars Gullik Bjønnes
10 * Full author contact details are available in file CREDITS.
16 #include "InsetCollapsable.h"
21 class InsetFloatParams {
24 InsetFloatParams() : wide(false), sideways(false), subfloat(false) {}
26 void write(std::ostream & os) const;
28 void read(Lexer & lex);
32 std::string placement;
43 /////////////////////////////////////////////////////////////////////////
47 /////////////////////////////////////////////////////////////////////////
49 /// Used for "floating" objects like tables, figures etc.
50 class InsetFloat : public InsetCollapsable
54 InsetFloat(Buffer * buffer, std::string params_str);
57 static void string2params(std::string const &, InsetFloatParams &);
59 static std::string params2string(InsetFloatParams const &);
61 void setWide(bool w, bool update_label = true);
63 void setSideways(bool s, bool update_label = true);
65 void setSubfloat(bool s, bool update_label = true);
69 InsetFloatParams const & params() const { return params_; }
71 bool allowsCaptionVariation() const { return !params_.subfloat; }
74 docstring layoutName() const;
76 docstring toolTip(BufferView const & bv, int x, int y) const;
78 void write(std::ostream & os) const;
80 void read(Lexer & lex);
82 void validate(LaTeXFeatures & features) const;
84 InsetCode lyxCode() const { return FLOAT_CODE; }
86 void latex(otexstream &, OutputParams const &) const;
88 int plaintext(odocstringstream & ods, OutputParams const & op,
89 size_t max_length = INT_MAX) const;
91 int docbook(odocstream &, OutputParams const &) const;
93 docstring xhtml(XHTMLStream &, OutputParams const &) const;
95 bool insetAllowed(InsetCode) const;
96 /** returns false if, when outputing LaTeX, font changes should
97 be closed before generating this inset. This is needed for
98 insets that may contain several paragraphs */
99 bool inheritFont() const { return false; }
101 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
102 // Update the counters of this inset and of its contents
103 void updateBuffer(ParIterator const &, UpdateType);
105 void doDispatch(Cursor & cur, FuncRequest & cmd);
107 Inset * clone() const { return new InsetFloat(*this); }
109 docstring getCaption(OutputParams const &) const;
111 InsetFloatParams params_;
117 #endif // INSET_FLOAT_H