]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetenv.C
* In the process of fixing the math background color bug, this commit transfer backgr...
[lyx.git] / src / insets / insetenv.C
index a8e7a13575baea2f9d2d4b1490145f1885f72e7d..53926417e0ba4f313a4fe9235508f82d718acb06 100644 (file)
 #include "bufferparams.h"
 #include "gettext.h"
 #include "paragraph.h"
+#include "outputparams.h"
 #include "output_latex.h"
 #include "texrow.h"
 
 
-using lyx::docstring;
-using lyx::odocstream;
+namespace lyx {
 
 using std::string;
 using std::auto_ptr;
@@ -31,7 +31,7 @@ InsetEnvironment::InsetEnvironment
                (BufferParams const & bp, string const & name)
        : InsetText(bp), layout_(bp.getLyXTextClass()[name])
 {
-       setInsetName(name);
+       setInsetName(from_utf8(name));
        setAutoBreakRows(true);
        setDrawFrame(true);
 }
@@ -50,7 +50,7 @@ auto_ptr<InsetBase> InsetEnvironment::doClone() const
 
 void InsetEnvironment::write(Buffer const & buf, ostream & os) const
 {
-       os << "Environment " << getInsetName() << "\n";
+       os << "Environment " << to_utf8(getInsetName()) << "\n";
        InsetText::write(buf, os);
 }
 
@@ -63,26 +63,39 @@ void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
 
 docstring const InsetEnvironment::editMessage() const
 {
-       // FIXME UNICODE
-       return _("Opened Environment Inset: ") + lyx::from_utf8(getInsetName());
+       return _("Opened Environment Inset: ") + getInsetName();
 }
 
 
 int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
-                           OutputParams const & runparams) const
+                            OutputParams const & runparams) const
 {
        // FIXME UNICODE
-       os << lyx::from_utf8(layout_->latexheader);
+       os << from_utf8(layout_->latexheader);
        TexRow texrow;
        latexParagraphs(buf, paragraphs(), os, texrow, runparams,
                        layout_->latexparagraph);
        // FIXME UNICODE
-       os << lyx::from_utf8(layout_->latexfooter);
+       os << from_utf8(layout_->latexfooter);
        return texrow.rows();
 }
 
 
+int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
+                                OutputParams const & runparams) const
+{
+       os << '[' << to_utf8(getInsetName()) << ":\n";
+       InsetText::plaintext(buf, os, runparams);
+       os << "\n]";
+
+       return PLAINTEXT_NEWLINE + 1; // one char on a separate line
+}
+
+
 LyXLayout_ptr const & InsetEnvironment::layout() const
 {
        return layout_;
 }
+
+
+} // namespace lyx