]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetenv.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / insetenv.C
index aeeb5f07c5b7362cf48521aefa2f1a3e38aaf26b..fd2d2cca4fecf2f374c78977f9afed1094a5f72c 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /**
  * \file insetenv.C
  * This file is part of LyX, the document processor.
@@ -6,32 +5,34 @@
  *
  * \author André Pönitz
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "insetenv.h"
-#include "gettext.h"
-#include "lyxtextclass.h"
-#include "paragraph_funcs.h"
-#include "lyxlayout.h"
+
 #include "bufferparams.h"
-#include "support/LOstream.h"
-#include "debug.h"
+#include "gettext.h"
+#include "paragraph.h"
+#include "output_latex.h"
+#include "texrow.h"
 
 
+namespace lyx {
+
+using std::string;
+using std::auto_ptr;
 using std::ostream;
-using std::endl;
 
 
 InsetEnvironment::InsetEnvironment
                (BufferParams const & bp, string const & name)
        : InsetText(bp), layout_(bp.getLyXTextClass()[name])
 {
-       setInsetName(name);
-       autoBreakRows = true;
-       drawFrame_ = ALWAYS;
+       setInsetName(from_utf8(name));
+       setAutoBreakRows(true);
+       setDrawFrame(true);
 }
 
 
@@ -40,50 +41,41 @@ InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
 {}
 
 
-// InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
-//     : InsetText(in, same_id), layout_(in.layout_)
-// {}
-
-
-Inset * InsetEnvironment::clone(Buffer const &) const
+auto_ptr<InsetBase> InsetEnvironment::doClone() const
 {
-       return new InsetEnvironment(*this);
+       return auto_ptr<InsetBase>(new InsetEnvironment(*this));
 }
 
 
-// Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
-// {
-//     return new InsetEnvironment(*this, same_id);
-// }
-
-
-void InsetEnvironment::write(Buffer const * buf, ostream & os) const
+void InsetEnvironment::write(Buffer const & buf, ostream & os) const
 {
-       os << "Environment " << getInsetName() << "\n";
+       os << "Environment " << to_utf8(getInsetName()) << "\n";
        InsetText::write(buf, os);
 }
 
 
-void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
+void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
 {
        InsetText::read(buf, lex);
 }
 
 
-string const InsetEnvironment::editMessage() const
+docstring const InsetEnvironment::editMessage() const
 {
        return _("Opened Environment Inset: ") + getInsetName();
 }
 
 
-int InsetEnvironment::latex(Buffer const * buf, ostream & os,
-                           LatexRunParams const & runparams) const
+int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
+                           OutputParams const & runparams) const
 {
-       os << layout_->latexheader;
+       // FIXME UNICODE
+       os << from_utf8(layout_->latexheader);
        TexRow texrow;
-       latexParagraphs(buf, paragraphs, os, texrow, runparams,
+       latexParagraphs(buf, paragraphs(), os, texrow, runparams,
                        layout_->latexparagraph);
-       os << layout_->latexfooter;
+       // FIXME UNICODE
+       os << from_utf8(layout_->latexfooter);
        return texrow.rows();
 }
 
@@ -92,3 +84,6 @@ LyXLayout_ptr const & InsetEnvironment::layout() const
 {
        return layout_;
 }
+
+
+} // namespace lyx