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"
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "MailInset.h"
|
2003-10-07 07:42:15 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class InsetBoxParams {
|
|
|
|
|
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);
|
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;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
/// "special" widths, see usrguide.dvi <20>3.5
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** The fbox/fancybox inset
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
class InsetBox : public InsetCollapsable {
|
|
|
|
|
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-05 00:21:05 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
friend class InsetBoxParams;
|
|
|
|
|
friend class InsetBoxMailer;
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring editMessage() const;
|
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-03-19 16:21:33 +00:00
|
|
|
|
virtual bool allowParagraphCustomization(idx_type = 0)
|
|
|
|
|
{ return forceEmptyLayout(); }
|
|
|
|
|
///
|
|
|
|
|
virtual bool forceEmptyLayout(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
|
|
|
|
///
|
|
|
|
|
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
|
|
|
|
///
|
|
|
|
|
virtual 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_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InsetBoxMailer : public MailInset {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
InsetBoxMailer(InsetBox & inset);
|
|
|
|
|
///
|
2007-04-29 13:39:47 +00:00
|
|
|
|
virtual Inset & inset() const { return inset_; }
|
2003-10-07 07:42:15 +00:00
|
|
|
|
///
|
|
|
|
|
virtual std::string const & name() const { return name_; }
|
|
|
|
|
///
|
|
|
|
|
virtual std::string const inset2string(Buffer const &) const;
|
|
|
|
|
///
|
|
|
|
|
static std::string const params2string(InsetBoxParams const &);
|
|
|
|
|
///
|
|
|
|
|
static void string2params(std::string const &, InsetBoxParams &);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
///
|
|
|
|
|
static std::string const name_;
|
|
|
|
|
///
|
|
|
|
|
InsetBox & inset_;
|
|
|
|
|
};
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2003-10-07 07:42:15 +00:00
|
|
|
|
#endif // INSET_BOX_H
|