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 "InsetCaptionable.h"
24 class InsetFloatParams
28 InsetFloatParams() : type("senseless"), placement("document"), alignment("document"),
29 wide(false), sideways(false), subfloat(false) {}
31 void write(std::ostream & os) const;
33 void read(Lexer & lex);
37 std::string placement;
39 std::string alignment;
50 /////////////////////////////////////////////////////////////////////////
54 /////////////////////////////////////////////////////////////////////////
56 /// Used for "floating" objects like tables, figures etc.
57 class InsetFloat : public InsetCaptionable
60 InsetFloat(Buffer * buffer, std::string const & params_str);
62 static void string2params(std::string const &, InsetFloatParams &);
64 static std::string params2string(InsetFloatParams const &);
66 void setWide(bool w, bool update_label = true);
68 void setSideways(bool s, bool update_label = true);
70 void setSubfloat(bool s, bool update_label = true);
74 InsetFloatParams const & params() const { return params_; }
76 bool allowsCaptionVariation(std::string const &) const override;
78 LyXAlignment contentAlignment() const override;
80 bool forceParDirectionSwitch() const override { return true; }
83 void setCaptionType(std::string const & type) override;
85 docstring layoutName() const override;
87 docstring toolTip(BufferView const & bv, int x, int y) const override;
89 void write(std::ostream & os) const override;
91 void read(Lexer & lex) override;
93 void validate(LaTeXFeatures & features) const override;
95 InsetCode lyxCode() const override { return FLOAT_CODE; }
97 void latex(otexstream &, OutputParams const &) const override;
99 int plaintext(odocstringstream & ods, OutputParams const & op,
100 size_t max_length = INT_MAX) const override;
102 void docbook(XMLStream &, OutputParams const &) const override;
104 docstring xhtml(XMLStream &, OutputParams const &) const override;
106 bool insetAllowed(InsetCode) const override;
108 bool inheritFont() const override { return false; }
110 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
112 bool hasSubCaptions(ParIterator const & it) const override;
114 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
116 Inset * clone() const override { return new InsetFloat(*this); }
117 /// Is the content of this inset part of the immediate (visible) text sequence?
118 bool isPartOfTextSequence() const override { return false; }
120 TexString getCaption(OutputParams const &) const;
122 std::string getAlignment() const;
124 CtObject getCtObject(OutputParams const &) const override;
126 InsetFloatParams params_;
132 #endif // INSET_FLOAT_H