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 void InsetMarginal::Write(Buffer const * buf, ostream & os) const
42 os << getInsetName() << "\n";
43 InsetCollapsable::Write(buf, os);
47 Inset * InsetMarginal::Clone() const
49 InsetMarginal * result = new InsetMarginal;
52 result->collapsed = collapsed;
57 char const * InsetMarginal::EditMessage() const
59 return _("Opened Marginal Note Inset");
63 int InsetMarginal::Latex(Buffer const * buf,
64 ostream & os, bool fragile, bool fp) const
66 os << "\\marginpar{%\n";
68 int i = InsetText::Latex(buf, os, fragile, fp);
75 bool InsetMarginal::InsertInset(BufferView * bv, Inset * inset)
77 if (!InsertInsetAllowed(inset))
80 return InsetText::InsertInset(bv, inset);
84 bool InsetMarginal::InsertInsetAllowed(Inset * inset) const
86 if ((inset->LyxCode() == Inset::FOOT_CODE) ||
87 (inset->LyxCode() == Inset::MARGIN_CODE)) {
94 LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
95 LyXParagraph * p, int pos) const
97 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
98 fn.decSize().decSize();