X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=e05f5678e2f2311dcc189248c47d9902d2ba4d8d;hb=9762ba5d388e8a81a6e58c464b635ca4cf48cbfa;hp=21abf3be595e5fb734c58ff77116e9136f81491a;hpb=d3e30f8d9b68d51141290c7f4888040e9cfbaffa;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 21abf3be59..e05f5678e2 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,95 +34,90 @@ 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 &); - /// - ~InsetFloat(); - /// - docstring name() const { return name_; } - /// - void write(Buffer const & buf, std::ostream & os) const; - /// - void read(Buffer const & buf, Lexer & lex); + static void string2params(std::string const &, InsetFloatParams &); /// - void validate(LaTeXFeatures & features) const; + static std::string params2string(InsetFloatParams const &); /// - Inset::Code lyxCode() const { return Inset::FLOAT_CODE; } + void setWide(bool w, bool update_label = true); /// - virtual bool wide() const { return false; } + void setSideways(bool s, bool update_label = true); /// - int latex(Buffer const &, odocstream &, - OutputParams const &) const; + void setSubfloat(bool s, bool update_label = true); /// - int plaintext(Buffer const &, odocstream &, - OutputParams const &) const; + void setNewLabel(); /// - int docbook(Buffer const &, odocstream &, - OutputParams const &) const; + InsetFloatParams const & params() const { return params_; } /// - virtual docstring const editMessage() const; + bool allowsCaptionVariation(std::string const &) const; +private: /// - bool insetAllowed(Inset::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 setCaptionType(std::string const & type); /// - void wide(bool w, BufferParams const &); + docstring layoutName() const; /// - void sideways(bool s, BufferParams const &); + docstring toolTip(BufferView const & bv, int x, int y) const; /// - bool showInsetDialog(BufferView *) const; + void write(std::ostream & os) const; /// - InsetFloatParams const & params() const { return params_; } + void read(Lexer & lex); /// - bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; -protected: - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -private: + void validate(LaTeXFeatures & features) const; /// - virtual std::auto_ptr doClone() const; + InsetCode lyxCode() const { return FLOAT_CODE; } /// - InsetFloatParams params_; + void latex(otexstream &, OutputParams const &) const; /// - docstring name_; -}; - - -class InsetFloatMailer : public MailInset { -public: + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - InsetFloatMailer(InsetFloat & inset); + int docbook(odocstream &, OutputParams const &) const; /// - virtual Inset & inset() const { return inset_; } + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - virtual std::string const & name() const { return name_; } + 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 inset2string(Buffer const &) const; + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - static void string2params(std::string const &, InsetFloatParams &); + bool hasSubCaptions(ParIterator const & it) const; /// - static std::string const params2string(InsetFloatParams const &); -private: + void doDispatch(Cursor & cur, FuncRequest & cmd); /// - static std::string const name_; + Inset * clone() const { return new InsetFloat(*this); } + /// Is the content of this inset part of the immediate (visible) text sequence? + bool isPartOfTextSequence() const { return false; } /// - InsetFloat & inset_; + TexString getCaption(OutputParams const &) const; + + InsetFloatParams params_; }; } // namespace lyx -#endif +#endif // INSET_FLOAT_H