1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 * ======================================================
14 #pragma implementation
17 #include "insetmarginal.h"
20 #include "BufferView.h"
23 #include "support/LOstream.h"
28 InsetMarginal::InsetMarginal()
31 setLabel(_("margin"));
32 LyXFont font(LyXFont::ALL_SANE);
35 font.setColor(LColor::footnote);
37 setAutoCollapse(false);
38 setInsetName("Marginal");
42 void InsetMarginal::Write(Buffer const * buf, ostream & os) const
44 os << getInsetName() << "\n";
45 InsetCollapsable::Write(buf, os);
49 Inset * InsetMarginal::Clone() const
51 InsetMarginal * result = new InsetMarginal;
54 result->collapsed = collapsed;
59 char const * InsetMarginal::EditMessage() const
61 return _("Opened Marginal Note Inset");
65 int InsetMarginal::Latex(Buffer const * buf,
66 ostream & os, bool fragile, bool fp) const
68 os << "\\marginpar{%\n";
70 int i = InsetText::Latex(buf, os, fragile, fp);
77 bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset)
79 if (!InsertInsetAllowed(inset))
82 return InsetText::InsertInset(bv, inset);
86 bool InsetMarginal::InsertInsetAllowed(Inset * inset) const
88 if ((inset->LyxCode() == Inset::FOOT_CODE) ||
89 (inset->LyxCode() == Inset::MARGIN_CODE)) {
96 LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
97 LyXParagraph * p, int pos) const
99 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
100 fn.decSize().decSize();