2000-06-28 13:35:52 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetFloat.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Vigna
|
|
|
|
* \author Lars Gullik Bjønnes
|
2000-06-28 13:35:52 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2000-06-28 13:35:52 +00:00
|
|
|
*/
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#ifndef INSET_FLOAT_H
|
|
|
|
#define INSET_FLOAT_H
|
2000-06-28 13:35:52 +00:00
|
|
|
|
2015-09-02 18:53:13 +00:00
|
|
|
#include "InsetCaptionable.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2002-05-29 16:21:03 +00:00
|
|
|
|
2015-09-01 16:08:35 +00:00
|
|
|
class InsetFloatParams
|
|
|
|
{
|
2005-01-19 15:03:31 +00:00
|
|
|
public:
|
2003-03-05 17:56:47 +00:00
|
|
|
///
|
2015-09-02 18:53:13 +00:00
|
|
|
InsetFloatParams() : type("senseless"), wide(false), sideways(false), subfloat(false) {}
|
2003-03-05 17:56:47 +00:00
|
|
|
///
|
2003-03-05 19:46:08 +00:00
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void read(Lexer & lex);
|
2003-03-05 19:46:08 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string type;
|
2003-03-05 17:56:47 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
std::string placement;
|
2008-05-31 12:28:16 +00:00
|
|
|
/// span columns
|
2003-03-05 17:56:47 +00:00
|
|
|
bool wide;
|
2004-03-29 11:38:39 +00:00
|
|
|
///
|
|
|
|
bool sideways;
|
2008-03-02 11:30:50 +00:00
|
|
|
///
|
|
|
|
bool subfloat;
|
2003-03-05 17:56:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// InsetFloat
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/// Used for "floating" objects like tables, figures etc.
|
2015-09-02 18:53:13 +00:00
|
|
|
class InsetFloat : public InsetCaptionable
|
2008-03-27 22:26:24 +00:00
|
|
|
{
|
2000-06-28 13:35:52 +00:00
|
|
|
public:
|
2010-02-10 17:33:39 +00:00
|
|
|
InsetFloat(Buffer * buffer, std::string params_str);
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetFloatParams &);
|
|
|
|
///
|
|
|
|
static std::string params2string(InsetFloatParams const &);
|
|
|
|
///
|
2009-07-13 12:56:20 +00:00
|
|
|
void setWide(bool w, bool update_label = true);
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
2009-07-13 12:56:20 +00:00
|
|
|
void setSideways(bool s, bool update_label = true);
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
2009-07-13 12:56:20 +00:00
|
|
|
void setSubfloat(bool s, bool update_label = true);
|
2008-08-19 14:56:12 +00:00
|
|
|
///
|
2009-07-13 12:56:20 +00:00
|
|
|
void setNewLabel();
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
|
|
|
InsetFloatParams const & params() const { return params_; }
|
2012-12-30 17:29:02 +00:00
|
|
|
///
|
2013-03-22 21:23:38 +00:00
|
|
|
bool allowsCaptionVariation(std::string const &) const;
|
2008-03-27 22:26:24 +00:00
|
|
|
private:
|
2015-09-02 18:53:13 +00:00
|
|
|
///
|
|
|
|
void setCaptionType(std::string const & type);
|
2003-03-05 19:46:08 +00:00
|
|
|
///
|
2011-03-28 22:33:04 +00:00
|
|
|
docstring layoutName() const;
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2008-04-10 09:22:49 +00:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const;
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void validate(LaTeXFeatures & features) const;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return FLOAT_CODE; }
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2007-02-16 08:15:16 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2001-03-23 08:37:44 +00:00
|
|
|
///
|
2009-11-30 17:20:37 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-06-19 12:49:08 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
bool insetAllowed(InsetCode) const;
|
2011-02-22 19:41:04 +00:00
|
|
|
/** returns false if, when outputing LaTeX, font changes should
|
2002-12-01 22:59:25 +00:00
|
|
|
be closed before generating this inset. This is needed for
|
|
|
|
insets that may contain several paragraphs */
|
2011-02-22 19:41:04 +00:00
|
|
|
bool inheritFont() const { return false; }
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
2015-09-01 16:08:35 +00:00
|
|
|
///
|
2015-09-02 18:53:13 +00:00
|
|
|
bool hasSubCaptions(ParIterator const & it) const;
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetFloat(*this); }
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2008-03-02 11:30:50 +00:00
|
|
|
docstring getCaption(OutputParams const &) const;
|
|
|
|
///
|
2015-10-13 22:51:50 +00:00
|
|
|
void getCaption(otexstream & os, OutputParams const & runparams) const;
|
|
|
|
|
2003-03-05 17:56:47 +00:00
|
|
|
InsetFloatParams params_;
|
2000-06-28 13:35:52 +00:00
|
|
|
};
|
|
|
|
|
2003-03-05 19:46:08 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
#endif // INSET_FLOAT_H
|