2003-03-13 10:06:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* \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
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-03-13 10:06:11 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "insetenv.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "bufferparams.h"
|
2003-03-13 10:06:11 +00:00
|
|
|
|
#include "gettext.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "paragraph.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
|
#include "output_latex.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "texrow.h"
|
2003-03-13 10:06:11 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2003-09-05 09:01:27 +00:00
|
|
|
|
using std::ostream;
|
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-09-16 10:01:29 +00:00
|
|
|
|
setAutoBreakRows(true);
|
|
|
|
|
setDrawFrame(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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
|
void InsetEnvironment::write(Buffer const & buf, ostream & os) const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-28 07:41:31 +00:00
|
|
|
|
void InsetEnvironment::read(Buffer const & buf, LyXLex & lex)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
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-08-28 07:41:31 +00:00
|
|
|
|
int InsetEnvironment::latex(Buffer const & buf, ostream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams 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-12-01 13:35:49 +00:00
|
|
|
|
latexParagraphs(buf, paragraphs(), os, texrow, runparams,
|
2003-05-22 22:44:30 +00:00
|
|
|
|
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
|
|
|
|
}
|