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
11 * Full author contact details are available in file CREDITS.
17 #include "InsetCollapsible.h"
19 #include "support/Length.h"
28 explicit InsetBoxParams(std::string const &);
30 void write(std::ostream & os) const;
32 void read(support::Lexer & lex);
36 /// Is there a parbox?
38 /// Is there a makebox?
40 /// Do we have an inner parbox or minipage to format paragraphs to
45 /// "special" widths, see usrguide.dvi §3.5
56 std::string height_special;
64 std::string framecolor;
66 std::string backgroundcolor;
71 ///////////////////////////////////////////////////////////////////////
73 // The fbox/fancybox inset
75 ///////////////////////////////////////////////////////////////////////
78 class InsetBox : public InsetCollapsible
93 InsetBox(Buffer *, std::string const &);
96 static std::string params2string(InsetBoxParams const &);
98 static void string2params(std::string const &, InsetBoxParams &);
100 InsetBoxParams const & params() const { return params_; }
102 /// \name Public functions inherited from Inset class
105 InsetCode lyxCode() const override { return BOX_CODE; }
107 docstring layoutName() const override;
109 void write(std::ostream &) const override;
111 void read(support::Lexer & lex) override;
113 void metrics(MetricsInfo &, Dimension &) const override;
115 ColorCode backgroundColor(PainterInfo const &) const override;
117 LyXAlignment contentAlignment() const override;
119 bool allowParagraphCustomization(idx_type = 0) const override { return !forcePlainLayout(); }
121 bool allowMultiPar() const override;
123 bool forcePlainLayout(idx_type = 0) const override;
125 bool needsCProtection(bool const maintext = false,
126 bool const fragile = false) const override;
128 bool neverIndent() const override { return true; }
130 void latex(otexstream &, OutputParams const &) const override;
132 int plaintext(odocstringstream & ods, OutputParams const & op,
133 size_t max_length = INT_MAX) const override;
135 void docbook(XMLStream &, OutputParams const &) const override;
137 docstring xhtml(XMLStream &, OutputParams const &) const override;
139 void validate(LaTeXFeatures &) const override;
141 bool hasFixedWidth() const override;
143 std::string contextMenuName() const override;
146 /// \name Public functions inherited from InsetCollapsible class
149 void setButtonLabel() override;
153 /// \name Protected functions inherited from Inset class
156 bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
158 void doDispatch(Cursor & cur, FuncRequest & cmd) override;
160 Inset * clone() const override { return new InsetBox(*this); }
164 /// used by the constructors
167 std::string const getFrameColor(bool const gui = false) const;
169 std::string const getBackgroundColor() const;
171 bool useFColorBox() const;
174 friend class InsetBoxParams;
175 InsetBoxParams params_;