X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=f146e11fac20ba989028b59a421d214eb9d1156f;hb=e4c46abeb7385960c9dd42494e3c7c1f3e699b56;hp=7ab9ed336a3a0272e43097a9b6ab6c39a4fcb2b6;hpb=39e79d8602920eefe36e898c9f415afb979521b2;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 7ab9ed336a..f146e11fac 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -4,26 +4,28 @@ * 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"), wide(false), sideways(false), subfloat(false) {} /// void write(std::ostream & os) const; /// @@ -32,93 +34,88 @@ public: std::string type; /// std::string placement; - /// + /// 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 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, Lexer & 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; +private: /// - int plaintext(Buffer const &, odocstream &, - OutputParams const &) const; + void setCaptionType(std::string const & type); /// - int docbook(Buffer const &, odocstream &, - OutputParams const &) const; + docstring layoutName() const; /// - virtual docstring const editMessage() const; + docstring toolTip(BufferView const & bv, int x, int y) const; /// - 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; } + void write(std::ostream & os) const; /// - void wide(bool w, BufferParams const &); + void read(Lexer & lex); /// - void sideways(bool s, BufferParams const &); + void validate(LaTeXFeatures & features) const; /// - void addToToc(TocList &, Buffer const &) const; + InsetCode lyxCode() const { return FLOAT_CODE; } /// - bool showInsetDialog(BufferView *) const; + void latex(otexstream &, OutputParams const &) const; /// - InsetFloatParams const & params() const { return params_; } + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const; -protected: - virtual void doDispatch(LCursor & cur, FuncRequest & cmd); -private: - virtual std::auto_ptr doClone() const; - - /// - InsetFloatParams params_; -}; - - -class InsetFloatMailer : public MailInset { -public: + int docbook(odocstream &, OutputParams const &) const; /// - InsetFloatMailer(InsetFloat & inset); + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - virtual InsetBase & inset() const { return inset_; } + bool insetAllowed(InsetCode) const; + /** returns false if, when outputing LaTeX, font changes should + be closed before generating this inset. This is needed for + insets that may contain several paragraphs */ + bool inheritFont() const { return false; } /// - virtual std::string const & name() const { return name_; } + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - virtual std::string const inset2string(Buffer const &) const; + bool hasSubCaptions(ParIterator const & it) const; /// - static void string2params(std::string const &, InsetFloatParams &); + void doDispatch(Cursor & cur, FuncRequest & cmd); /// - static std::string const params2string(InsetFloatParams const &); -private: + Inset * clone() const { return new InsetFloat(*this); } /// - static std::string const name_; - /// - InsetFloat & inset_; + TexString getCaption(OutputParams const &) const; + + InsetFloatParams params_; }; } // namespace lyx -#endif +#endif // INSET_FLOAT_H