X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=53c584c40abe974ad74e0c4bc3cb5046dd272053;hb=9176e60b7bcab3e355521a86ddb4c2778cd9b29e;hp=18251f9dcc9cf73992ce6e584b5b4995fc870c8f;hpb=2640b2122838b7025b8494fb378b8927fca75831;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 18251f9dcc..53c584c40a 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,96 +36,99 @@ 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 const & params_str); /// - InsetFloat(BufferParams const &, std::string const &); - /// - ~InsetFloat(); + static void string2params(std::string const &, InsetFloatParams &); /// - docstring name() const { return name_; } + 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); /// - Inset::Code lyxCode() const { return Inset::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; /// - int plaintext(Buffer const &, odocstream &, - OutputParams const &) const; + LyXAlignment contentAlignment() const; /// - int docbook(Buffer const &, odocstream &, - OutputParams const &) const; + bool forceParDirectionSwitch() const { return true; } +private: /// - virtual docstring const editMessage() const; + void setCaptionType(std::string const & type); /// - 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; } + docstring layoutName() const; /// - void wide(bool w, BufferParams const &); + docstring toolTip(BufferView const & bv, int x, int y) const; /// - void sideways(bool s, BufferParams const &); + void write(std::ostream & os) const; /// - void addToToc(TocList &, Buffer const &) const; + void read(Lexer & lex); /// - bool showInsetDialog(BufferView *) const; + void validate(LaTeXFeatures & features) const; /// - InsetFloatParams const & params() const { return params_; } + InsetCode lyxCode() const { return FLOAT_CODE; } /// - bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; -protected: - virtual void doDispatch(Cursor & cur, FuncRequest & cmd); -private: + void latex(otexstream &, OutputParams const &) const; /// - virtual std::auto_ptr doClone() const; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// - InsetFloatParams params_; + int docbook(odocstream &, OutputParams const &) const; /// - docstring name_; -}; - - -class InsetFloatMailer : public MailInset { -public: + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// - InsetFloatMailer(InsetFloat & 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 Inset & inset() const { return inset_; } + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; /// - virtual std::string const & name() const { return name_; } + bool hasSubCaptions(ParIterator const & it) const; /// - virtual std::string const inset2string(Buffer const &) const; + void doDispatch(Cursor & cur, FuncRequest & cmd); /// - static void string2params(std::string const &, InsetFloatParams &); + 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 params2string(InsetFloatParams const &); -private: + TexString getCaption(OutputParams const &) const; /// - static std::string const name_; + std::string getAlignment() const; /// - InsetFloat & inset_; + OutputParams::CtObject CtObject(OutputParams const &) const { return OutputParams::CT_OMITOBJECT; } + + InsetFloatParams params_; }; } // namespace lyx -#endif +#endif // INSET_FLOAT_H