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
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSETBOX_H
|
|
|
|
#define INSETBOX_H
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCollapsable.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
|
|
|
///
|
|
|
|
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;
|
|
|
|
/// Use a parbox (true) or minipage (false)
|
|
|
|
bool use_parbox;
|
|
|
|
/// 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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-03-27 07:26:37 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// The fbox/fancybox inset
|
|
|
|
//
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
class InsetBox : public InsetCollapsable
|
|
|
|
{
|
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
|
|
|
///
|
2008-03-04 22:28:18 +00:00
|
|
|
InsetBox(Buffer const &, std::string const &);
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
|
|
|
~InsetBox();
|
2008-03-27 07:26:37 +00:00
|
|
|
///
|
|
|
|
static std::string params2string(InsetBoxParams const &);
|
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetBoxParams &);
|
2008-03-05 00:21:05 +00:00
|
|
|
private:
|
|
|
|
///
|
|
|
|
friend class InsetBoxParams;
|
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
|
|
|
///
|
2007-12-04 09:25:50 +00:00
|
|
|
docstring name() const;
|
|
|
|
///
|
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
|
|
|
///
|
|
|
|
void setButtonLabel();
|
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
/// show the Box dialog
|
|
|
|
bool showInsetDialog(BufferView * bv) const;
|
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
DisplayType display() const { return Inline; }
|
2003-11-10 09:06:48 +00:00
|
|
|
///
|
2008-10-05 10:22:53 +00:00
|
|
|
bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
|
2008-03-19 16:21:33 +00:00
|
|
|
///
|
2008-07-10 17:41:52 +00:00
|
|
|
bool forcePlainLayout(idx_type = 0) const;
|
2005-12-05 15:03:38 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
bool neverIndent() const { return true; }
|
2005-12-05 15:03:38 +00:00
|
|
|
///
|
2006-06-09 12:10:49 +00:00
|
|
|
bool noFontChange() const { return true; }
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2003-10-07 07:42:15 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) 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
|
|
|
///
|
2009-06-12 17:23:17 +00:00
|
|
|
docstring xhtml(odocstream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2003-10-07 07:42:15 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
|
|
|
///
|
|
|
|
InsetBoxParams const & params() const { return params_; }
|
2003-10-13 02:10:45 +00:00
|
|
|
///
|
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);
|
2006-12-29 11:52:01 +00:00
|
|
|
/// Is the width forced to some value?
|
2008-03-05 00:21:05 +00:00
|
|
|
bool hasFixedWidth() const;
|
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetBox(*this); }
|
2003-10-07 07:42:15 +00:00
|
|
|
/// used by the constructors
|
|
|
|
void init();
|
2008-03-24 13:33:48 +00:00
|
|
|
///
|
2008-03-27 07:26:37 +00:00
|
|
|
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
2008-03-05 00:21:05 +00:00
|
|
|
|
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
|