2003-10-07 07:42:15 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetBox.h
|
2003-10-07 07:42:15 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
* \author Martin Vermeer
|
2015-05-11 19:30:32 +00:00
|
|
|
* \author Uwe Stöhr
|
2003-10-07 07:42:15 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSETBOX_H
|
|
|
|
#define INSETBOX_H
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
#include "InsetCollapsible.h"
|
2007-04-28 12:58:49 +00:00
|
|
|
#include "Length.h"
|
2003-10-07 07:42:15 +00:00
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
class InsetBoxParams
|
|
|
|
{
|
2005-01-19 15:03:31 +00:00
|
|
|
public:
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2019-09-17 21:06:18 +00:00
|
|
|
explicit InsetBoxParams(std::string const &);
|
2003-10-13 02:10:45 +00:00
|
|
|
///
|
2003-10-07 07:42:15 +00:00
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
2007-04-26 11:30:54 +00:00
|
|
|
void read(Lexer & lex);
|
2008-03-27 07:26:37 +00:00
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
|
|
|
std::string type;
|
2010-07-03 13:14:15 +00:00
|
|
|
/// Is there a parbox?
|
2003-10-07 07:42:15 +00:00
|
|
|
bool use_parbox;
|
2010-07-03 13:14:15 +00:00
|
|
|
/// Is there a makebox?
|
|
|
|
bool use_makebox;
|
2003-10-07 07:42:15 +00:00
|
|
|
/// Do we have an inner parbox or minipage to format paragraphs to
|
|
|
|
/// columnwidth?
|
|
|
|
bool inner_box;
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
Length width;
|
2008-11-14 15:58:50 +00:00
|
|
|
/// "special" widths, see usrguide.dvi §3.5
|
2003-10-07 07:42:15 +00:00
|
|
|
std::string special;
|
|
|
|
///
|
|
|
|
char pos;
|
|
|
|
///
|
|
|
|
char hor_pos;
|
|
|
|
///
|
|
|
|
char inner_pos;
|
|
|
|
///
|
2007-04-28 12:58:49 +00:00
|
|
|
Length height;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
|
|
|
std::string height_special;
|
2015-05-11 19:30:32 +00:00
|
|
|
///
|
|
|
|
Length thickness;
|
|
|
|
///
|
|
|
|
Length separation;
|
|
|
|
///
|
|
|
|
Length shadowsize;
|
2015-05-16 01:22:37 +00:00
|
|
|
///
|
|
|
|
std::string framecolor;
|
|
|
|
///
|
|
|
|
std::string backgroundcolor;
|
2003-10-07 07:42:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// The fbox/fancybox inset
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
class InsetBox : public InsetCollapsible
|
2008-03-27 07:26:37 +00:00
|
|
|
{
|
2003-10-07 07:42:15 +00:00
|
|
|
public:
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
|
|
|
enum BoxType {
|
|
|
|
Frameless,
|
|
|
|
Boxed,
|
|
|
|
Framed,
|
|
|
|
ovalbox,
|
|
|
|
Ovalbox,
|
|
|
|
Shadowbox,
|
|
|
|
Shaded,
|
|
|
|
Doublebox
|
|
|
|
};
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetBox(Buffer *, std::string const &);
|
2011-10-29 15:34:06 +00:00
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2008-03-27 07:26:37 +00:00
|
|
|
static std::string params2string(InsetBoxParams const &);
|
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetBoxParams &);
|
2010-02-07 20:28:41 +00:00
|
|
|
///
|
|
|
|
InsetBoxParams const & params() const { return params_; }
|
2011-10-29 15:34:06 +00:00
|
|
|
|
|
|
|
/// \name Public functions inherited from Inset class
|
|
|
|
//@{
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return BOX_CODE; }
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2011-03-28 22:33:04 +00:00
|
|
|
docstring layoutName() const;
|
2007-12-04 09:25:50 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void read(Lexer & lex);
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2012-11-30 16:11:07 +00:00
|
|
|
ColorCode backgroundColor(PainterInfo const &) const;
|
|
|
|
///
|
2015-10-23 09:16:21 +00:00
|
|
|
LyXAlignment contentAlignment() const;
|
|
|
|
///
|
2008-10-05 10:22:53 +00:00
|
|
|
bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
|
2008-03-19 16:21:33 +00:00
|
|
|
///
|
2015-03-30 21:12:39 +00:00
|
|
|
bool allowMultiPar() const;
|
|
|
|
///
|
2008-07-10 17:41:52 +00:00
|
|
|
bool forcePlainLayout(idx_type = 0) const;
|
2005-12-05 15:03:38 +00:00
|
|
|
///
|
2018-04-30 07:06:15 +00:00
|
|
|
bool needsCProtection(bool const maintext = false,
|
|
|
|
bool const fragile = false) const;
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
bool neverIndent() const { return true; }
|
2011-10-29 15:34:06 +00:00
|
|
|
///
|
2011-02-22 19:41:04 +00:00
|
|
|
bool inheritFont() const { return false; }
|
2006-06-09 12:10:49 +00:00
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2019-05-09 23:35:40 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2003-10-07 07:42:15 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
///
|
2011-10-29 15:34:06 +00:00
|
|
|
bool hasFixedWidth() const;
|
|
|
|
///
|
|
|
|
std::string contextMenuName() const;
|
|
|
|
//@}
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
/// \name Public functions inherited from InsetCollapsible class
|
2011-10-29 15:34:06 +00:00
|
|
|
//@{
|
|
|
|
///
|
|
|
|
void setButtonLabel();
|
|
|
|
//@}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/// \name Protected functions inherited from Inset class
|
|
|
|
//@{
|
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
2005-04-22 08:57:22 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetBox(*this); }
|
2011-10-29 15:34:06 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
private:
|
2003-10-07 07:42:15 +00:00
|
|
|
/// used by the constructors
|
|
|
|
void init();
|
2008-03-05 00:21:05 +00:00
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2011-10-29 15:34:06 +00:00
|
|
|
friend class InsetBoxParams;
|
2003-10-07 07:42:15 +00:00
|
|
|
InsetBoxParams params_;
|
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
#endif // INSETBOX_H
|