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;
80 bool forceParDirectionSwitch() const { return true; }
83 void setCaptionType(std::string const & type);
85 docstring layoutName() const;
87 docstring toolTip(BufferView const & bv, int x, int y) const;
89 void write(std::ostream & os) const;
91 void read(Lexer & lex);
93 void validate(LaTeXFeatures & features) const;
95 InsetCode lyxCode() const { return FLOAT_CODE; }
97 void latex(otexstream &, OutputParams const &) const;
99 int plaintext(odocstringstream & ods, OutputParams const & op,
100 size_t max_length = INT_MAX) const;
102 int docbook(odocstream &, OutputParams const &) const;
104 docstring xhtml(XHTMLStream &, OutputParams const &) const;
106 bool insetAllowed(InsetCode) const;
107 /** returns false if, when outputing LaTeX, font changes should
108 be closed before generating this inset. This is needed for
109 insets that may contain several paragraphs */
110 bool inheritFont() const { return false; }
112 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
114 bool hasSubCaptions(ParIterator const & it) const;
116 void doDispatch(Cursor & cur, FuncRequest & cmd);
118 Inset * clone() const { return new InsetFloat(*this); }
119 /// Is the content of this inset part of the immediate (visible) text sequence?
120 bool isPartOfTextSequence() const { return false; }
122 TexString getCaption(OutputParams const &) const;
124 std::string getAlignment() const;
126 InsetFloatParams params_;
132 #endif // INSET_FLOAT_H