X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=62b5873b9024520e4eb570dad802bf1cce77a3bc;hb=88e5e5fd345c280b0927ad84785657cbc9e55f77;hp=34c5a28020fffca9ae338416ed269c39987206b8;hpb=a694476ac68fd56c23eace194e9e6ac5b2a5cac5;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 34c5a28020..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), subfloat(false) {} + InsetFloatParams() : type("senseless"), placement("document"), alignment("document"), + wide(false), sideways(false), subfloat(false) {} /// void write(std::ostream & os) const; /// @@ -33,6 +36,8 @@ public: /// std::string placement; /// + std::string alignment; + /// span columns bool wide; /// bool sideways; @@ -41,91 +46,85 @@ public: }; -/** 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(Buffer const &, std::string const &); - /// - ~InsetFloat(); - /// - docstring name() const { return name_; } - /// - void write(std::ostream & os) const; + static void string2params(std::string const &, InsetFloatParams &); /// - void read(Lexer & lex); + static std::string params2string(InsetFloatParams const &); /// - void validate(LaTeXFeatures & features) const; + void setWide(bool w, bool update_label = true); /// - InsetCode lyxCode() const { return FLOAT_CODE; } + void setSideways(bool s, bool update_label = true); /// - bool isMacroScope() const { return true; } + void setSubfloat(bool s, bool update_label = true); /// - int latex(odocstream &, OutputParams const &) const; + void setNewLabel(); /// - int plaintext(odocstream &, OutputParams const &) const; - /// - int docbook(odocstream &, OutputParams const &) const; + InsetFloatParams const & params() const { return params_; } /// - docstring editMessage() const; + bool allowsCaptionVariation(std::string const &) const; /// - bool insetAllowed(InsetCode) 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; } + LyXAlignment contentAlignment() const; +private: /// - void wide(bool w, BufferParams const &); + void setCaptionType(std::string const & type); /// - void sideways(bool s, BufferParams const &); + docstring layoutName() const; /// - void subfloat(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; - // Update the counters of this inset and of its contents - void updateLabels(ParIterator const &); -protected: - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -private: + void validate(LaTeXFeatures & features) const; /// - virtual Inset * clone() const; + InsetCode lyxCode() const { return FLOAT_CODE; } /// - docstring getCaption(OutputParams const &) const; + void latex(otexstream &, OutputParams const &) const; /// - InsetFloatParams params_; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - docstring name_; -}; - - -class InsetFloatMailer : public MailInset { -public: + int docbook(odocstream &, OutputParams const &) const; /// - 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