*
* \author Angus Leeming
* \author Martin Vermeer
+ * \author Uwe Stöhr
*
* Full author contact details are available in file CREDITS.
*/
#ifndef INSETBOX_H
#define INSETBOX_H
-#include "InsetCollapsable.h"
-#include "LyXLength.h"
-#include "MailInset.h"
+#include "InsetCollapsible.h"
+
+#include "support/Length.h"
namespace lyx {
-class InsetBoxParams {
+class InsetBoxParams
+{
public:
///
- InsetBoxParams(std::string const &);
+ explicit InsetBoxParams(std::string const &);
///
void write(std::ostream & os) const;
///
void read(Lexer & lex);
+
///
std::string type;
- /// Use a parbox (true) or minipage (false)
+ /// Is there a parbox?
bool use_parbox;
+ /// Is there a makebox?
+ bool use_makebox;
/// Do we have an inner parbox or minipage to format paragraphs to
/// columnwidth?
bool inner_box;
///
- LyXLength width;
- /// "special" widths, see usrguide.dvi §3.5
+ Length width;
+ /// "special" widths, see usrguide.dvi §3.5
std::string special;
///
char pos;
///
char inner_pos;
///
- LyXLength height;
+ Length height;
///
std::string height_special;
+ ///
+ Length thickness;
+ ///
+ Length separation;
+ ///
+ Length shadowsize;
+ ///
+ std::string framecolor;
+ ///
+ std::string backgroundcolor;
};
-/** The fbox/fancybox inset
-*/
-class InsetBox : public InsetCollapsable {
+///////////////////////////////////////////////////////////////////////
+//
+// The fbox/fancybox inset
+//
+///////////////////////////////////////////////////////////////////////
+
+
+class InsetBox : public InsetCollapsible
+{
public:
///
- InsetBox(BufferParams const &, std::string const &);
+ enum BoxType {
+ Frameless,
+ Boxed,
+ Framed,
+ ovalbox,
+ Ovalbox,
+ Shadowbox,
+ Shaded,
+ Doublebox
+ };
///
- ~InsetBox();
+ InsetBox(Buffer *, std::string const &);
+
///
- virtual docstring const editMessage() const;
+ static std::string params2string(InsetBoxParams const &);
///
- InsetBase::Code lyxCode() const { return InsetBase::BOX_CODE; }
+ static void string2params(std::string const &, InsetBoxParams &);
///
- void write(Buffer const &, std::ostream &) const;
+ InsetBoxParams const & params() const { return params_; }
+
+ /// \name Public functions inherited from Inset class
+ //@{
///
- void read(Buffer const & buf, Lexer & lex);
+ InsetCode lyxCode() const override { return BOX_CODE; }
///
- void setButtonLabel();
+ docstring layoutName() const override;
///
- bool metrics(MetricsInfo &, Dimension &) const;
- /// show the Box dialog
- bool showInsetDialog(BufferView * bv) const;
+ void write(std::ostream &) const override;
///
- bool display() const { return false; }
+ void read(Lexer & lex) override;
///
- bool forceDefaultParagraphs(idx_type) const;
+ void metrics(MetricsInfo &, Dimension &) const override;
///
- bool neverIndent(Buffer const &) const { return true; }
+ ColorCode backgroundColor(PainterInfo const &) const override;
///
- bool noFontChange() const { return true; }
+ LyXAlignment contentAlignment() const override;
///
- int latex(Buffer const &, odocstream &, OutputParams const &) const;
+ bool allowParagraphCustomization(idx_type = 0) const override { return !forcePlainLayout(); }
///
- int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
+ bool allowMultiPar() const override;
///
- int docbook(Buffer const &, odocstream &, OutputParams const &) const;
+ bool forcePlainLayout(idx_type = 0) const override;
///
- void validate(LaTeXFeatures &) const;
+ bool needsCProtection(bool const maintext = false,
+ bool const fragile = false) const override;
///
- InsetBoxParams const & params() const { return params_; }
+ bool neverIndent() const override { return true; }
///
- bool getStatus(LCursor &, FuncRequest const &, FuncStatus &) const;
+ bool inheritFont() const override { return false; }
///
- enum BoxType {
- Frameless,
- Boxed,
- ovalbox,
- Ovalbox,
- Shadowbox,
- Doublebox
- };
-protected:
- InsetBox(InsetBox const &);
- virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
- /// Is the width forced to some value?
- virtual bool hasFixedWidth() const;
-private:
- friend class InsetBoxParams;
-
- virtual std::auto_ptr<InsetBase> doClone() const;
-
- /// used by the constructors
- void init();
+ void latex(otexstream &, OutputParams const &) const override;
///
- InsetBoxParams params_;
-};
-
-
-class InsetBoxMailer : public MailInset {
-public:
+ int plaintext(odocstringstream & ods, OutputParams const & op,
+ size_t max_length = INT_MAX) const override;
///
- InsetBoxMailer(InsetBox & inset);
+ void docbook(XMLStream &, OutputParams const &) const override;
///
- virtual InsetBase & inset() const { return inset_; }
+ docstring xhtml(XMLStream &, OutputParams const &) const override;
///
- virtual std::string const & name() const { return name_; }
+ void validate(LaTeXFeatures &) const override;
///
- virtual std::string const inset2string(Buffer const &) const;
+ bool hasFixedWidth() const override;
///
- static std::string const params2string(InsetBoxParams const &);
+ std::string contextMenuName() const override;
+ //@}
+
+ /// \name Public functions inherited from InsetCollapsible class
+ //@{
///
- static void string2params(std::string const &, InsetBoxParams &);
+ void setButtonLabel() override;
+ //@}
-private:
+protected:
+ /// \name Protected functions inherited from Inset class
+ //@{
///
- static std::string const name_;
+ bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
///
- InsetBox & inset_;
-};
+ void doDispatch(Cursor & cur, FuncRequest & cmd) override;
+ ///
+ Inset * clone() const override { return new InsetBox(*this); }
+ //@}
+
+private:
+ /// used by the constructors
+ void init();
+ ///
+ friend class InsetBoxParams;
+ InsetBoxParams params_;
+};
} // namespace lyx
-#endif // INSET_BOX_H
+#endif // INSETBOX_H