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 "insets/insettext.h"
24 #include "support/LOstream.h"
29 InsetMarginal::InsetMarginal()
32 setLabel(_("margin"));
33 LyXFont font(LyXFont::ALL_SANE);
36 font.setColor(LColor::footnote);
38 setAutoCollapse(false);
39 setInsetName("Marginal");
43 void InsetMarginal::Write(Buffer const * buf, ostream & os) const
45 os << getInsetName() << "\n";
46 InsetCollapsable::Write(buf, os);
50 Inset * InsetMarginal::Clone() const
52 InsetMarginal * result = new InsetMarginal;
53 result->inset->init(inset);
55 result->collapsed = collapsed;
60 char const * InsetMarginal::EditMessage() const
62 return _("Opened Marginal Note Inset");
66 int InsetMarginal::Latex(Buffer const * buf,
67 ostream & os, bool fragile, bool fp) const
69 os << "\\marginpar{%\n";
71 int i = inset->Latex(buf, os, fragile, fp);
78 bool InsetMarginal::InsertInset(BufferView * bv, Inset * in)
80 if (!InsertInsetAllowed(in))
83 return inset->InsertInset(bv, in);
87 bool InsetMarginal::InsertInsetAllowed(Inset * in) const
89 if ((in->LyxCode() == Inset::FOOT_CODE) ||
90 (in->LyxCode() == Inset::MARGIN_CODE)) {
97 LyXFont InsetMarginal::GetDrawFont(BufferView * bv,
98 LyXParagraph * p, int pos) const
100 LyXFont fn = getLyXText(bv)->GetFont(bv->buffer(), p, pos);
101 fn.decSize().decSize();