X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFloat.h;h=62b5873b9024520e4eb570dad802bf1cce77a3bc;hb=88e5e5fd345c280b0927ad84785657cbc9e55f77;hp=1313484f62bd8a4c37f5f30991b04459f011dd6c;hpb=76dc2c0d3002db400f4826e6f3b3e8bf84f830f4;p=lyx.git diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index 1313484f62..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,17 +46,43 @@ 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); + /// + static void string2params(std::string const &, InsetFloatParams &); + /// + static std::string params2string(InsetFloatParams const &); /// - InsetFloat(Buffer const &, std::string const &); + void setWide(bool w, bool update_label = true); /// - ~InsetFloat(); + void setSideways(bool s, bool update_label = true); /// - docstring name() const { return name_; } + void setSubfloat(bool s, bool update_label = true); + /// + void setNewLabel(); + /// + InsetFloatParams const & params() const { return params_; } + /// + bool allowsCaptionVariation(std::string const &) const; + /// + LyXAlignment contentAlignment() const; +private: + /// + void setCaptionType(std::string const & type); + /// + docstring layoutName() const; + /// + docstring toolTip(BufferView const & bv, int x, int y) const; /// void write(std::ostream & os) const; /// @@ -61,69 +92,39 @@ public: /// InsetCode lyxCode() const { return FLOAT_CODE; } /// - int latex(odocstream &, OutputParams const &) const; + void latex(otexstream &, OutputParams const &) const; /// - int plaintext(odocstream &, OutputParams const &) const; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; /// int docbook(odocstream &, OutputParams const &) const; /// - docstring editMessage() const; + docstring xhtml(XHTMLStream &, OutputParams const &) const; /// bool insetAllowed(InsetCode) const; - /** returns true if, when outputing LaTeX, font changes should + /** 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 noFontChange() const { return true; } - /// - void wide(bool w, BufferParams const &); - /// - void sideways(bool s, BufferParams const &); - /// - void subfloat(bool s, BufferParams const &); - /// - bool showInsetDialog(BufferView *) const; - /// - InsetFloatParams const & params() const { return params_; } -private: + bool inheritFont() const { return false; } /// bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; - // Update the counters of this inset and of its contents - void updateLabels(ParIterator const &); + /// + bool hasSubCaptions(ParIterator const & it) const; /// void doDispatch(Cursor & cur, FuncRequest & cmd); /// 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; } /// - docstring getCaption(OutputParams const &) const; - /// - InsetFloatParams params_; + TexString getCaption(OutputParams const &) const; /// - docstring name_; -}; - + std::string getAlignment() const; -class InsetFloatMailer : public MailInset { -public: - /// - InsetFloatMailer(InsetFloat & inset); - /// - virtual Inset & inset() const { return inset_; } - /// - virtual std::string const & name() const { return name_; } - /// - virtual std::string const inset2string(Buffer const &) const; - /// - static void string2params(std::string const &, InsetFloatParams &); - /// - static std::string const params2string(InsetFloatParams const &); -private: - /// - static std::string const name_; - /// - InsetFloat & inset_; + InsetFloatParams params_; }; } // namespace lyx -#endif +#endif // INSET_FLOAT_H