2003-03-13 10:06:11 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/**
|
|
|
|
|
* \file insetenv.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "insetenv.h"
|
|
|
|
|
#include "gettext.h"
|
|
|
|
|
#include "lyxtextclass.h"
|
2003-05-19 07:12:09 +00:00
|
|
|
|
#include "paragraph_funcs.h"
|
2003-03-13 10:06:11 +00:00
|
|
|
|
#include "lyxlayout.h"
|
|
|
|
|
#include "bufferparams.h"
|
|
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
|
using std::endl;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2003-03-13 10:06:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InsetEnvironment::InsetEnvironment
|
|
|
|
|
(BufferParams const & bp, string const & name)
|
2003-05-19 07:12:09 +00:00
|
|
|
|
: InsetText(bp), layout_(bp.getLyXTextClass()[name])
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
|
|
|
|
setInsetName(name);
|
2003-04-25 15:28:41 +00:00
|
|
|
|
autoBreakRows = true;
|
|
|
|
|
drawFrame_ = ALWAYS;
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetEnvironment::InsetEnvironment(InsetEnvironment const & in)
|
|
|
|
|
: InsetText(in), layout_(in.layout_)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetEnvironment::clone() const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetEnvironment(*this));
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetEnvironment::write(Buffer const * buf, ostream & os) const
|
|
|
|
|
{
|
2003-03-13 11:42:12 +00:00
|
|
|
|
os << "Environment " << getInsetName() << "\n";
|
2003-04-25 15:28:41 +00:00
|
|
|
|
InsetText::write(buf, os);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetEnvironment::read(Buffer const * buf, LyXLex & lex)
|
|
|
|
|
{
|
2003-04-25 15:28:41 +00:00
|
|
|
|
InsetText::read(buf, lex);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const InsetEnvironment::editMessage() const
|
|
|
|
|
{
|
|
|
|
|
return _("Opened Environment Inset: ") + getInsetName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-22 18:59:10 +00:00
|
|
|
|
int InsetEnvironment::latex(Buffer const * buf, ostream & os,
|
2003-05-23 08:59:47 +00:00
|
|
|
|
LatexRunParams const & runparams) const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2003-05-19 07:12:09 +00:00
|
|
|
|
os << layout_->latexheader;
|
|
|
|
|
TexRow texrow;
|
2003-05-22 22:44:30 +00:00
|
|
|
|
latexParagraphs(buf, paragraphs, os, texrow, runparams,
|
|
|
|
|
layout_->latexparagraph);
|
2003-05-19 07:12:09 +00:00
|
|
|
|
os << layout_->latexfooter;
|
|
|
|
|
return texrow.rows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LyXLayout_ptr const & InsetEnvironment::layout() const
|
|
|
|
|
{
|
|
|
|
|
return layout_;
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|