X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=62b5873b9024520e4eb570dad802bf1cce77a3bc;hb=88e5e5fd345c280b0927ad84785657cbc9e55f77;hp=21abf3be595e5fb734c58ff77116e9136f81491a;hpb=d3e30f8d9b68d51141290c7f4888040e9cfbaffa;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 21abf3be59..62b5873b90 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -4,26 +4,29 @@ * 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; /// @@ -33,94 +36,95 @@ public: /// 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 params_str); /// - InsetFloat(BufferParams const &, std::string const &); + static void string2params(std::string const &, InsetFloatParams &); /// - ~InsetFloat(); + static std::string params2string(InsetFloatParams const &); /// - docstring name() const { return name_; } + void setWide(bool w, bool update_label = true); /// - void write(Buffer const & buf, std::ostream & os) const; + void setSideways(bool s, bool update_label = true); /// - void read(Buffer const & buf, Lexer & lex); + void setSubfloat(bool s, bool update_label = true); /// - void validate(LaTeXFeatures & features) const; + void setNewLabel(); /// - Inset::Code lyxCode() const { return Inset::FLOAT_CODE; } + InsetFloatParams const & params() const { return params_; } /// - virtual bool wide() const { return false; } + bool allowsCaptionVariation(std::string const &) const; /// - int latex(Buffer const &, odocstream &, - OutputParams const &) const; + LyXAlignment contentAlignment() 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(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 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; /// - bool showInsetDialog(BufferView *) const; + InsetCode lyxCode() const { return FLOAT_CODE; } /// - InsetFloatParams const & params() const { return params_; } + void latex(otexstream &, OutputParams const &) const; /// - bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; -protected: - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -private: + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - virtual std::auto_ptr doClone() const; + int docbook(odocstream &, OutputParams const &) const; /// - InsetFloatParams params_; - /// - docstring name_; -}; - - -class InsetFloatMailer : public MailInset { -public: - /// - InsetFloatMailer(InsetFloat & inset); + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - virtual Inset & 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); } + /// Is the content of this inset part of the immediate (visible) text sequence? + bool isPartOfTextSequence() const { return false; } /// - static std::string const name_; + TexString getCaption(OutputParams const &) const; /// - InsetFloat & inset_; + std::string getAlignment() const; + + InsetFloatParams params_; }; } // namespace lyx -#endif +#endif // INSET_FLOAT_H