-/* This file is part of
- * ======================================================
- *
- * LyX, The Document Processor
- *
- * Copyright 1998 The LyX Team.
+/**
+ * \file insetmarginal.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- *======================================================*/
+ * \author Jürgen Vigna
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "insetmarginal.h"
+
#include "gettext.h"
-#include "lyxfont.h"
-#include "BufferView.h"
-#include "Painter.h"
-#include "lyxtext.h"
-#include "support/LOstream.h"
+#include "paragraph.h"
+
+#include "support/std_ostream.h"
+
+namespace lyx {
+
+using std::string;
+using std::auto_ptr;
using std::ostream;
-using std::endl;
-InsetMarginal::InsetMarginal() : InsetCollapsable()
+
+InsetMarginal::InsetMarginal(BufferParams const & bp)
+ : InsetFootlike(bp)
{
setLabel(_("margin"));
- LyXFont font(LyXFont::ALL_SANE);
- font.decSize();
- font.decSize();
- font.setColor(LColor::footnote);
- setLabelFont(font);
- setAutoCollapse(false);
- setInsetName("Marginal");
+ setInsetName(from_ascii("Marginal"));
}
-Inset * InsetMarginal::Clone() const
+InsetMarginal::InsetMarginal(InsetMarginal const & in)
+ : InsetFootlike(in)
{
- InsetMarginal * result = new InsetMarginal;
- result->init(this);
-
- result->collapsed = collapsed;
- return result;
+ setLabel(_("margin"));
+ setInsetName(from_ascii("Marginal"));
}
-char const * InsetMarginal::EditMessage() const
+auto_ptr<InsetBase> InsetMarginal::doClone() const
{
- return _("Opened Marginal Note Inset");
+ return auto_ptr<InsetBase>(new InsetMarginal(*this));
}
-int InsetMarginal::Latex(Buffer const * buf,
- ostream & os, bool fragile, bool fp) const
+docstring const InsetMarginal::editMessage() const
{
- os << "\\marginpar{%" << endl;
-
- int i = InsetText::Latex(buf, os, fragile, fp);
- os << "}%" << endl;
-
- return i + 2;
+ return _("Opened Marginal Note Inset");
}
-bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset)
+int InsetMarginal::latex(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
{
- if (!InsertInsetAllowed(inset))
- return false;
-
- return InsetText::InsertInset(bv, inset);
+ os << "%\n\\marginpar{";
+ int const i = InsetText::latex(buf, os, runparams);
+ os << "%\n}";
+ return i + 2;
}
-
-bool InsetMarginal::InsertInsetAllowed(Inset * inset) const
+int InsetMarginal::docbook(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
{
- if ((inset->LyxCode() == Inset::FOOT_CODE) ||
- (inset->LyxCode() == Inset::MARGIN_CODE)) {
- return false;
- }
- return true;
+ os << "<note role=\"margin\">";
+ int const i = InsetText::docbook(buf, os, runparams);
+ os << "</note>";
+
+ return i;
}
-LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
- LyXParagraph * p, int pos) const
-{
- LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
- fn.decSize().decSize();
- return fn;
-}
+} // namespace lyx