* 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"
namespace lyx {
-
class InsetFloatParams {
public:
///
- InsetFloatParams() : wide(false), sideways(false) {}
+ InsetFloatParams() : wide(false), sideways(false), subfloat(false) {}
///
void write(std::ostream & os) const;
///
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 InsetCollapsable
+{
public:
///
- InsetFloat(BufferParams const &, std::string const &);
+ InsetFloat(Buffer *, std::string const &);
///
~InsetFloat();
+
///
- docstring insetName() const { return name_; }
+ static void string2params(std::string const &, InsetFloatParams &);
///
- void write(Buffer const & buf, std::ostream & os) const;
+ static std::string params2string(InsetFloatParams const &);
///
- void read(Buffer const & buf, Lexer & lex);
+ void setWide(bool w, bool update_label = true);
///
- void validate(LaTeXFeatures & features) const;
+ void setSideways(bool s, bool update_label = true);
///
- Inset::Code lyxCode() const { return Inset::FLOAT_CODE; }
+ void setSubfloat(bool s, bool update_label = true);
///
- virtual bool wide() const { return false; }
+ void setNewLabel();
///
- int latex(Buffer const &, odocstream &,
- OutputParams const &) const;
+ InsetFloatParams const & params() const { return params_; }
+private:
///
- int plaintext(Buffer const &, odocstream &,
- OutputParams const &) const;
+ docstring name() const;
///
- int docbook(Buffer const &, odocstream &,
- OutputParams const &) const;
+ docstring toolTip(BufferView const & bv, int x, int y) const;
///
- virtual docstring const editMessage() const;
+ void write(std::ostream & os) 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 read(Lexer & lex);
///
- void wide(bool w, BufferParams const &);
+ void validate(LaTeXFeatures & features) const;
///
- void sideways(bool s, BufferParams const &);
+ InsetCode lyxCode() const { return FLOAT_CODE; }
///
- void addToToc(TocList &, Buffer const &) const;
+ int latex(odocstream &, OutputParams const &) const;
///
- bool showInsetDialog(BufferView *) const;
+ int plaintext(odocstream &, OutputParams const &) const;
///
- InsetFloatParams const & params() const { return params_; }
+ int docbook(odocstream &, OutputParams const &) const;
///
- bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
-protected:
- virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-private:
+ docstring xhtml(XHTMLStream &, OutputParams const &) const;
///
- virtual std::auto_ptr<Inset> doClone() const;
- ///
- InsetFloatParams params_;
- ///
- docstring name_;
-};
-
-
-class InsetFloatMailer : public MailInset {
-public:
- ///
- InsetFloatMailer(InsetFloat & inset);
+ 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; }
///
- virtual Inset & inset() const { return inset_; }
+ bool showInsetDialog(BufferView *) const;
///
- virtual std::string const & name() const { return name_; }
+ bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
+ // Update the counters of this inset and of its contents
+ void updateLabels(ParIterator const &, bool);
///
- 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); }
///
- static std::string const params2string(InsetFloatParams const &);
-private:
+ docstring getCaption(OutputParams const &) const;
///
- static std::string const name_;
+ InsetFloatParams params_;
///
- InsetFloat & inset_;
+ docstring name_;
};
} // namespace lyx
-#endif
+#endif // INSET_FLOAT_H