]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBox.h
This patch introduces an optional argument to Buffer::updateLabels(), so
[lyx.git] / src / insets / InsetBox.h
index 3f3b43b73f7d2f06b75a905993feab0bb36c1438..83ba43403e07129dd5270eb6446a85970aa820f6 100644 (file)
 
 #include "InsetCollapsable.h"
 #include "Length.h"
-#include "MailInset.h"
 
 
 namespace lyx {
 
-class InsetBoxParams {
+class InsetBoxParams
+{
 public:
        ///
        InsetBoxParams(std::string const &);
@@ -28,6 +28,7 @@ public:
        void write(std::ostream & os) const;
        ///
        void read(Lexer & lex);
+
        ///
        std::string type;
        /// Use a parbox (true) or minipage (false)
@@ -37,7 +38,7 @@ public:
        bool inner_box;
        ///
        Length width;
-       /// "special" widths, see usrguide.dvi §3.5
+       /// "special" widths, see usrguide.dvi Â§3.5
        std::string special;
        ///
        char pos;
@@ -52,43 +53,71 @@ public:
 };
 
 
-/** The fbox/fancybox inset
 
-*/
-class InsetBox : public InsetCollapsable {
+///////////////////////////////////////////////////////////////////////
+//
+// The fbox/fancybox inset
+//
+///////////////////////////////////////////////////////////////////////
+
+
+class InsetBox : public InsetCollapsable
+{
 public:
        ///
-       InsetBox(BufferParams const &, std::string const &);
+       enum BoxType {
+               Frameless,
+               Boxed,
+               Framed,
+               ovalbox,
+               Ovalbox,
+               Shadowbox,
+               Shaded,
+               Doublebox
+       };
+       ///
+       InsetBox(Buffer *, std::string const &);
        ///
        ~InsetBox();
        ///
-       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 &);
+private:
+       ///
+       friend class InsetBoxParams;
        ///
-       void write(Buffer const &, std::ostream &) const;
+       InsetCode lyxCode() const { return BOX_CODE; }
        ///
-       void read(Buffer const & buf, Lexer & lex);
+       docstring name() const;
+       ///
+       void write(std::ostream &) const;
+       ///
+       void read(Lexer & lex);
        ///
        void setButtonLabel();
        ///
-       bool metrics(MetricsInfo &, Dimension &) const;
+       void metrics(MetricsInfo &, Dimension &) const;
        /// show the Box dialog
        bool showInsetDialog(BufferView * bv) const;
        ///
-       bool display() const { return false; }
+       DisplayType display() const { return Inline; }
        ///
-       bool forceDefaultParagraphs(idx_type) const;
+       bool allowParagraphCustomization(idx_type = 0) const { return !forcePlainLayout(); }
        ///
-       bool neverIndent(Buffer const &) const { return true; }
+       bool forcePlainLayout(idx_type = 0) const;
+       ///
+       bool neverIndent() const { return true; }
        ///
        bool noFontChange() const { return true; }
        ///
-       int latex(Buffer const &, odocstream &, OutputParams const &) const;
+       int latex(odocstream &, OutputParams const &) const;
+       ///
+       int plaintext(odocstream &, OutputParams const &) const;
        ///
-       int plaintext(Buffer const &, odocstream &, OutputParams const &) const;
+       int docbook(odocstream &, OutputParams const &) const;
        ///
-       int docbook(Buffer const &, odocstream &, OutputParams const &) const;
+       docstring xhtml(XHTMLStream &, OutputParams const &) const;
        ///
        void validate(LaTeXFeatures &) const;
        ///
@@ -96,54 +125,20 @@ public:
        ///
        bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
        ///
-       enum BoxType {
-               Frameless,
-               Boxed,
-               ovalbox,
-               Ovalbox,
-               Shadowbox,
-               Doublebox
-       };
-protected:
-       InsetBox(InsetBox const &);
-       virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
+       void doDispatch(Cursor & 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;
-
+       bool hasFixedWidth() const;
+       ///
+       Inset * clone() const { return new InsetBox(*this); }
        /// used by the constructors
        void init();
        ///
-       InsetBoxParams params_;
-};
-
+       docstring contextMenu(BufferView const & bv, int x, int y) const;
 
-class InsetBoxMailer : public MailInset {
-public:
        ///
-       InsetBoxMailer(InsetBox & inset);
-       ///
-       virtual InsetBase & inset() const { return inset_; }
-       ///
-       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_;
+       InsetBoxParams params_;
 };
 
-
 } // namespace lyx
 
-#endif // INSET_BOX_H
+#endif // INSETBOX_H