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;
78 LyXAlignment contentAlignment() const;
81 void setCaptionType(std::string const & type);
83 docstring layoutName() const;
85 docstring toolTip(BufferView const & bv, int x, int y) const;
87 void write(std::ostream & os) const;
89 void read(Lexer & lex);
91 void validate(LaTeXFeatures & features) const;
93 InsetCode lyxCode() const { return FLOAT_CODE; }
95 void latex(otexstream &, OutputParams const &) const;
97 int plaintext(odocstringstream & ods, OutputParams const & op,
98 size_t max_length = INT_MAX) const;
100 int docbook(odocstream &, OutputParams const &) const;
102 docstring xhtml(XHTMLStream &, OutputParams const &) const;
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; }
110 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
112 bool hasSubCaptions(ParIterator const & it) const;
114 void doDispatch(Cursor & cur, FuncRequest & cmd);
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; }
120 TexString getCaption(OutputParams const &) const;
122 std::string getAlignment() const;
124 InsetFloatParams params_;
130 #endif // INSET_FLOAT_H