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 19:53:13 +01:00
|
|
|
#include "InsetCaptionable.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2002-05-29 16:21:03 +00:00
|
|
|
|
2016-10-18 00:54:37 +02:00
|
|
|
struct TexString;
|
2016-09-24 00:49:00 +02:00
|
|
|
|
|
|
|
|
2015-09-01 17:08:35 +01:00
|
|
|
class InsetFloatParams
|
|
|
|
{
|
2005-01-19 15:03:31 +00:00
|
|
|
public:
|
2003-03-05 17:56:47 +00:00
|
|
|
///
|
2018-05-10 20:15:11 +02:00
|
|
|
InsetFloatParams() : type("senseless"), placement("document"), alignment("document"),
|
|
|
|
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;
|
2018-05-10 20:15:11 +02:00
|
|
|
///
|
|
|
|
std::string alignment;
|
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 19:53:13 +01:00
|
|
|
class InsetFloat : public InsetCaptionable
|
2008-03-27 22:26:24 +00:00
|
|
|
{
|
2000-06-28 13:35:52 +00:00
|
|
|
public:
|
2019-09-16 00:43:35 +02:00
|
|
|
InsetFloat(Buffer * buffer, std::string const & 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 18:29:02 +01:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
bool allowsCaptionVariation(std::string const &) const override;
|
2018-05-11 15:31:04 +02:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
LyXAlignment contentAlignment() const override;
|
2019-11-19 13:37:44 +01:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
bool forceParDirectionSwitch() const override { return true; }
|
2008-03-27 22:26:24 +00:00
|
|
|
private:
|
2015-09-02 19:53:13 +01:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void setCaptionType(std::string const & type) override;
|
2003-03-05 19:46:08 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
docstring layoutName() const override;
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
docstring toolTip(BufferView const & bv, int x, int y) const override;
|
2008-04-10 09:22:49 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void write(std::ostream & os) const override;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void read(Lexer & lex) override;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void validate(LaTeXFeatures & features) const override;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
InsetCode lyxCode() const override { return FLOAT_CODE; }
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void latex(otexstream &, OutputParams const &) const override;
|
2007-02-16 08:15:16 +00:00
|
|
|
///
|
2013-03-08 14:52:18 -05:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
2020-10-01 10:42:11 +03:00
|
|
|
size_t max_length = INT_MAX) const override;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const override;
|
2001-03-23 08:37:44 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const override;
|
2009-06-19 12:49:08 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
bool insetAllowed(InsetCode) const override;
|
Run codespell on src/insets
Command was
codespell -w -i 3 -S Makefile.in -L mathed,afe,tthe,ue,fro,uint,larg,alph,te,thes,alle,Claus,pres,pass-thru src/insets/
2020-06-25 23:46:16 +02:00
|
|
|
/** returns false if, when outputting 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 */
|
2020-10-01 10:42:11 +03:00
|
|
|
bool inheritFont() const override { return false; }
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
|
2015-09-01 17:08:35 +01:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
bool hasSubCaptions(ParIterator const & it) const override;
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd) override;
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
2020-10-01 10:42:11 +03:00
|
|
|
Inset * clone() const override { return new InsetFloat(*this); }
|
2016-12-27 12:06:54 +01:00
|
|
|
/// Is the content of this inset part of the immediate (visible) text sequence?
|
2020-10-01 10:42:11 +03:00
|
|
|
bool isPartOfTextSequence() const override { return false; }
|
2000-07-15 23:51:46 +00:00
|
|
|
///
|
2016-09-24 00:49:00 +02:00
|
|
|
TexString getCaption(OutputParams const &) const;
|
2018-05-11 15:31:04 +02:00
|
|
|
///
|
|
|
|
std::string getAlignment() const;
|
2019-12-28 13:43:17 +01:00
|
|
|
///
|
2020-11-30 01:03:35 +02:00
|
|
|
CtObject getCtObject(OutputParams const &) const override;
|
2015-10-13 23:51:50 +01:00
|
|
|
|
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
|