]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetEnvironment.cpp
Inset::addToToc(): change signature. Use DocIterator instead of ParConstIterator...
[lyx.git] / src / insets / InsetEnvironment.cpp
index 91237537fd5b993c53a68b1e7003a0ba05e3638f..4dba48eb3e2411c0df0f696b9466a7000bc7038d 100644 (file)
 
 #include "InsetEnvironment.h"
 
+#include "Buffer.h"
 #include "BufferParams.h"
-#include "gettext.h"
-#include "Paragraph.h"
+#include "Layout.h"
 #include "OutputParams.h"
 #include "output_latex.h"
 #include "TexRow.h"
+#include "TextClass.h"
 
+#include "support/gettext.h"
 
-namespace lyx {
+using namespace std;
 
-using std::string;
-using std::auto_ptr;
-using std::ostream;
+namespace lyx {
 
 
-InsetEnvironment::InsetEnvironment
-               (BufferParams const & bp, string const & name)
-       : InsetText(bp), layout_(bp.getLyXTextClass()[name]), name_(from_utf8(name))
+InsetEnvironment::InsetEnvironment(Buffer const & buf, docstring const & name)
+       : InsetText(buf), layout_(buf.params().documentClass()[name]), name_(name)
 {
        setAutoBreakRows(true);
        setDrawFrame(true);
 }
 
 
-InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
-       : InsetText(in), layout_(in.layout_)
-{}
-
-
-auto_ptr<Inset> InsetEnvironment::doClone() const
-{
-       return auto_ptr<Inset>(new InsetEnvironment(*this));
-}
-
-
-void InsetEnvironment::write(Buffer const & buf, ostream & os) const
+void InsetEnvironment::write(ostream & os) const
 {
-       os << "Environment " << to_utf8(insetName()) << "\n";
-       InsetText::write(buf, os);
+       os << "Environment " << to_utf8(name()) << "\n";
+       InsetText::write(os);
 }
 
 
-void InsetEnvironment::read(Buffer const & buf, Lexer & lex)
+void InsetEnvironment::read(Lexer & lex)
 {
-       InsetText::read(buf, lex);
+       InsetText::read(lex);
 }
 
 
-docstring const InsetEnvironment::editMessage() const
+docstring InsetEnvironment::editMessage() const
 {
-       return _("Opened Environment Inset: ") + insetName();
+       return _("Opened Environment Inset: ") + name();
 }
 
 
-int InsetEnvironment::latex(Buffer const & buf, odocstream & os,
-                            OutputParams const & runparams) const
+int InsetEnvironment::latex(odocstream & os,
+                           OutputParams const & runparams) const
 {
        // FIXME UNICODE
-       os << from_utf8(layout_->latexheader);
+       os << from_utf8(layout_.latexheader);
        TexRow texrow;
-       latexParagraphs(buf, paragraphs(), os, texrow, runparams,
-                       layout_->latexparagraph);
+       latexParagraphs(buffer(), text_, os, texrow, runparams,
+                       layout_.latexparagraph);
        // FIXME UNICODE
-       os << from_utf8(layout_->latexfooter);
+       os << from_utf8(layout_.latexfooter);
        return texrow.rows();
 }
 
 
-int InsetEnvironment::plaintext(Buffer const & buf, odocstream & os,
-                                OutputParams const & runparams) const
+int InsetEnvironment::plaintext(odocstream & os,
+                               OutputParams const & runparams) const
 {
-       os << '[' << to_utf8(insetName()) << ":\n";
-       InsetText::plaintext(buf, os, runparams);
+       os << '[' << to_utf8(name()) << ":\n";
+       InsetText::plaintext(os, runparams);
        os << "\n]";
 
        return PLAINTEXT_NEWLINE + 1; // one char on a separate line
 }
 
 
-Layout_ptr const & InsetEnvironment::layout() const
+Layout const & InsetEnvironment::layout() const
 {
        return layout_;
 }