]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetmarginal.C
use more specific smart_ptr headers
[lyx.git] / src / insets / insetmarginal.C
index b4aa735602644e5ab46ad291ac3763b7574276b7..a62b85144cca2f21863d2392f79fbd45b339f7e2 100644 (file)
@@ -1,8 +1,8 @@
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
- *      
+ *
  *          Copyright 1998 The LyX Team.
  *
  * ======================================================
 #include "debug.h"
 
 
-InsetMarginal::InsetMarginal()
-       : InsetFootlike()
+using std::ostream;
+
+
+InsetMarginal::InsetMarginal(BufferParams const & bp)
+       : InsetFootlike(bp)
+{
+       setLabel(_("margin"));
+       setInsetName("Marginal");
+}
+
+
+InsetMarginal::InsetMarginal(InsetMarginal const & in, bool same_id)
+       : InsetFootlike(in, same_id)
 {
        setLabel(_("margin"));
        setInsetName("Marginal");
@@ -34,13 +45,7 @@ InsetMarginal::InsetMarginal()
 
 Inset * InsetMarginal::clone(Buffer const &, bool same_id) const
 {
-       InsetMarginal * result = new InsetMarginal;
-       result->inset.init(&inset, same_id);
-       
-       result->collapsed = collapsed;
-       if (same_id)
-               result->id_ = id_;
-       return result;
+       return new InsetMarginal(*const_cast<InsetMarginal *>(this), same_id);
 }
 
 
@@ -51,22 +56,12 @@ string const InsetMarginal::editMessage() const
 
 
 int InsetMarginal::latex(Buffer const * buf,
-                        std::ostream & os, bool fragile, bool fp) const
+                        ostream & os, bool fragile, bool fp) const
 {
        os << "%\n\\marginpar{";
-       
+
        int const i = inset.latex(buf, os, fragile, fp);
        os << "%\n}";
-       
-       return i + 2;
-}
-
 
-bool InsetMarginal::insertInsetAllowed(Inset * in) const
-{
-       if ((in->lyxCode() == Inset::FOOT_CODE) ||
-           (in->lyxCode() == Inset::MARGIN_CODE)) {
-               return false;
-       }
-       return true;
+       return i + 2;
 }