4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
8 * \author Martin Vermeer
10 * Full author contact details are available in file CREDITS.
16 #include "InsetCollapsable.h"
18 #include "MailInset.h"
23 class InsetBoxParams {
26 InsetBoxParams(std::string const &);
28 void write(std::ostream & os) const;
30 void read(Lexer & lex);
33 /// Use a parbox (true) or minipage (false)
35 /// Do we have an inner parbox or minipage to format paragraphs to
40 /// "special" widths, see usrguide.dvi ยง3.5
51 std::string height_special;
55 /** The fbox/fancybox inset
58 class InsetBox : public InsetCollapsable {
72 InsetBox(Buffer const &, std::string const &);
77 friend class InsetBoxParams;
78 friend class InsetBoxMailer;
80 docstring editMessage() const;
82 InsetCode lyxCode() const { return BOX_CODE; }
84 docstring name() const;
86 void write(std::ostream &) const;
88 void read(Lexer & lex);
90 void setButtonLabel();
92 void metrics(MetricsInfo &, Dimension &) const;
93 /// show the Box dialog
94 bool showInsetDialog(BufferView * bv) const;
96 DisplayType display() const { return Inline; }
98 virtual bool allowParagraphCustomization(idx_type = 0)
99 { return forceEmptyLayout(); }
101 virtual bool forceEmptyLayout(idx_type = 0) const;
103 bool neverIndent() const { return true; }
105 bool noFontChange() const { return true; }
107 int latex(odocstream &, OutputParams const &) const;
109 int plaintext(odocstream &, OutputParams const &) const;
111 int docbook(odocstream &, OutputParams const &) const;
113 void validate(LaTeXFeatures &) const;
115 InsetBoxParams const & params() const { return params_; }
117 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
119 void doDispatch(Cursor & cur, FuncRequest & cmd);
120 /// Is the width forced to some value?
121 bool hasFixedWidth() const;
123 Inset * clone() const { return new InsetBox(*this); }
124 /// used by the constructors
127 virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
130 InsetBoxParams params_;
134 class InsetBoxMailer : public MailInset {
137 InsetBoxMailer(InsetBox & inset);
139 virtual Inset & inset() const { return inset_; }
141 virtual std::string const & name() const { return name_; }
143 virtual std::string const inset2string(Buffer const &) const;
145 static std::string const params2string(InsetBoxParams const &);
147 static void string2params(std::string const &, InsetBoxParams &);
151 static std::string const name_;
159 #endif // INSET_BOX_H