* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Jürgen Vigna
- * \author Lars Gullik Bjønnes
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
-#ifndef INSETFLOAT_H
-#define INSETFLOAT_H
+#ifndef INSET_FLOAT_H
+#define INSET_FLOAT_H
-#include "InsetCollapsable.h"
-#include "MailInset.h"
+#include "InsetCaptionable.h"
namespace lyx {
+struct TexString;
-class InsetFloatParams {
+
+class InsetFloatParams
+{
public:
///
- InsetFloatParams() : wide(false), sideways(false) {}
+ InsetFloatParams() : type("senseless"), placement("document"), alignment("document"),
+ wide(false), sideways(false), subfloat(false) {}
///
void write(std::ostream & os) const;
///
- void read(LyXLex & lex);
+ void read(Lexer & lex);
///
std::string type;
///
std::string placement;
///
+ std::string alignment;
+ /// span columns
bool wide;
///
bool sideways;
+ ///
+ bool subfloat;
};
-/** The float inset
-*/
-class InsetFloat : public InsetCollapsable {
+/////////////////////////////////////////////////////////////////////////
+//
+// InsetFloat
+//
+/////////////////////////////////////////////////////////////////////////
+
+/// Used for "floating" objects like tables, figures etc.
+class InsetFloat : public InsetCaptionable
+{
public:
+ InsetFloat(Buffer * buffer, std::string const & params_str);
///
- InsetFloat(BufferParams const &, std::string const &);
+ static void string2params(std::string const &, InsetFloatParams &);
///
- ~InsetFloat();
+ static std::string params2string(InsetFloatParams const &);
///
- void write(Buffer const & buf, std::ostream & os) const;
+ void setWide(bool w, bool update_label = true);
///
- void read(Buffer const & buf, LyXLex & lex);
+ void setSideways(bool s, bool update_label = true);
///
- void validate(LaTeXFeatures & features) const;
+ void setSubfloat(bool s, bool update_label = true);
///
- InsetBase::Code lyxCode() const { return InsetBase::FLOAT_CODE; }
+ void setNewLabel();
///
- virtual bool wide() const { return false; }
+ InsetFloatParams const & params() const { return params_; }
///
- int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ bool allowsCaptionVariation(std::string const &) const override;
///
- int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ LyXAlignment contentAlignment() const override;
///
- int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ bool forceParDirectionSwitch() const override { return true; }
+private:
///
- virtual docstring const editMessage() const;
+ void setCaptionType(std::string const & type) override;
///
- bool insetAllowed(InsetBase::Code) const;
- /** returns true if, when outputing LaTeX, font changes should
- be closed before generating this inset. This is needed for
- insets that may contain several paragraphs */
- bool noFontChange() const { return true; }
+ docstring layoutName() const override;
///
- void wide(bool w, BufferParams const &);
+ docstring toolTip(BufferView const & bv, int x, int y) const override;
///
- void sideways(bool s, BufferParams const &);
+ void write(std::ostream & os) const override;
///
- void addToToc(TocList &, Buffer const &) const;
+ void read(Lexer & lex) override;
///
- bool showInsetDialog(BufferView *) const;
+ void validate(LaTeXFeatures & features) const override;
///
- InsetFloatParams const & params() const { return params_; }
+ InsetCode lyxCode() const override { return FLOAT_CODE; }
///
- bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
-protected:
- virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
-private:
- virtual std::auto_ptr<InsetBase> doClone() const;
-
+ void latex(otexstream &, OutputParams const &) const override;
///
- InsetFloatParams params_;
-};
-
-
-class InsetFloatMailer : public MailInset {
-public:
+ int plaintext(odocstringstream & ods, OutputParams const & op,
+ size_t max_length = INT_MAX) const override;
///
- InsetFloatMailer(InsetFloat & inset);
+ void docbook(XMLStream &, OutputParams const &) const override;
///
- virtual InsetBase & inset() const { return inset_; }
+ docstring xhtml(XMLStream &, OutputParams const &) const override;
///
- virtual std::string const & name() const { return name_; }
+ bool insetAllowed(InsetCode) const override;
///
- virtual std::string const inset2string(Buffer const &) const;
+ bool inheritFont() const override { return false; }
///
- static void string2params(std::string const &, InsetFloatParams &);
+ bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
///
- static std::string const params2string(InsetFloatParams const &);
-private:
+ bool hasSubCaptions(ParIterator const & it) const override;
+ ///
+ void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false) override;
///
- static std::string const name_;
+ void doDispatch(Cursor & cur, FuncRequest & cmd) override;
///
- InsetFloat & inset_;
+ Inset * clone() const override { return new InsetFloat(*this); }
+ /// Is the content of this inset part of the immediate (visible) text sequence?
+ bool isPartOfTextSequence() const override { return false; }
+ ///
+ TexString getCaption(OutputParams const &) const;
+ ///
+ std::string getAlignment() const;
+ ///
+ CtObject getCtObject(OutputParams const &) const override;
+
+ InsetFloatParams params_;
};
} // namespace lyx
-#endif
+#endif // INSET_FLOAT_H