1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 1998 The LyX Team.
8 * ======================================================
14 #pragma implementation
17 #include "insetnote.h"
22 #include "BufferView.h"
24 #include "insets/insettext.h"
25 #include "support/LOstream.h"
26 #include "support/lstrings.h"
32 void InsetNote::init()
34 LyXFont font(LyXFont::ALL_SANE);
36 font.setColor(LColor::note);
38 setBackgroundColor(LColor::notebg);
44 InsetNote::InsetNote(BufferParams const & bp)
45 : InsetCollapsable(bp)
51 InsetNote::InsetNote(InsetNote const & in, bool same_id)
52 : InsetCollapsable(in, same_id)
58 Inset * InsetNote::clone(Buffer const &, bool same_id) const
60 return new InsetNote(*const_cast<InsetNote *>(this), same_id);
64 // This constructor is used for reading old InsetInfo
65 InsetNote::InsetNote(Buffer const * buf, string const & contents,
67 : InsetCollapsable(buf->params, collapsed)
71 Paragraph * par = inset.paragraph();
72 LyXFont font(LyXFont::ALL_INHERIT, buf->params.language);
74 // Since XForms doesn't support RTL, we can assume that old notes
75 // in RTL documents are written in English.
76 if (font.language()->RightToLeft())
77 font.setLanguage(default_language);
79 lyx::pos_type pos = 0;
80 buf->insertStringAsLines(par, pos, font, strip(contents, "\n"));
84 string const InsetNote::editMessage() const
86 return _("Opened Note Inset");
90 void InsetNote::write(Buffer const *buf, ostream & os) const
92 os << getInsetName() << "\n";
93 InsetCollapsable::write(buf, os);