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"
31 void InsetNote::init()
33 LyXFont font(LyXFont::ALL_SANE);
35 font.setColor(LColor::note);
37 setBackgroundColor(LColor::note);
43 InsetNote::InsetNote()
50 InsetNote::InsetNote(InsetNote const & in, bool same_id)
51 : InsetCollapsable(in, same_id)
57 Inset * InsetNote::clone(Buffer const &, bool same_id) const
59 return new InsetNote(*const_cast<InsetNote *>(this), same_id);
63 // This constructor is used for reading old InsetInfo
64 InsetNote::InsetNote(Buffer const * buf, string const & contents,
66 : InsetCollapsable(collapsed)
70 Paragraph * par = inset.paragraph();
71 Paragraph::pos_type pos = 0;
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 buf->insertStringAsLines(par, pos, font, strip(contents, '\n'));
83 string const InsetNote::editMessage() const
85 return _("Opened Note Inset");
89 void InsetNote::write(Buffer const *buf, ostream & os) const
91 os << getInsetName() << "\n";
92 InsetCollapsable::write(buf, os);