1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 *======================================================*/
13 #pragma implementation
16 #include "insetmarginal.h"
19 #include "BufferView.h"
22 #include "support/LOstream.h"
27 InsetMarginal::InsetMarginal() : InsetCollapsable()
29 setLabel(_("margin"));
30 LyXFont font(LyXFont::ALL_SANE);
33 font.setColor(LColor::footnote);
35 setAutoCollapse(false);
36 setInsetName("Marginal");
40 Inset * InsetMarginal::Clone() const
42 InsetMarginal * result = new InsetMarginal;
45 result->collapsed = collapsed;
50 char const * InsetMarginal::EditMessage() const
52 return _("Opened Marginal Note Inset");
56 int InsetMarginal::Latex(Buffer const * buf,
57 ostream & os, bool fragile, bool fp) const
59 os << "\\marginpar{%" << endl;
61 int i = InsetText::Latex(buf, os, fragile, fp);
68 bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset)
70 if (!InsertInsetAllowed(inset))
73 return InsetText::InsertInset(bv, inset);
77 bool InsetMarginal::InsertInsetAllowed(Inset * inset) const
79 if ((inset->LyxCode() == Inset::FOOT_CODE) ||
80 (inset->LyxCode() == Inset::MARGIN_CODE)) {
87 LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
88 LyXParagraph * p, int pos) const
90 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
91 fn.decSize().decSize();