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"
|
|
|
|
|
#include "lyxlayout.h"
|
|
|
|
|
#include "bufferparams.h"
|
|
|
|
|
#include "support/LOstream.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using std::ostream;
|
|
|
|
|
using std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InsetEnvironment::InsetEnvironment
|
|
|
|
|
(BufferParams const & bp, string const & name)
|
2003-04-25 15:28:41 +00:00
|
|
|
|
: InsetText(bp)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2003-04-25 15:28:41 +00:00
|
|
|
|
//setLabel(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
|
|
|
|
// needs more stuff in lyxlayout. coming in later patches.
|
|
|
|
|
//LyXTextClass const & tc = bp.getLyXTextClass();
|
|
|
|
|
//LyXLayout_ptr const & layout = tc.getEnv(name);
|
|
|
|
|
//header_ = layout->latexheader;
|
|
|
|
|
//footer_ = layout->latexfooter;
|
2003-03-13 11:42:12 +00:00
|
|
|
|
header_ = "\\begin{" + name + "}";
|
|
|
|
|
footer_ = "\\end{" + name + "}";
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InsetEnvironment::InsetEnvironment(InsetEnvironment const & in, bool same_id)
|
2003-04-25 15:28:41 +00:00
|
|
|
|
: InsetText(in, same_id), header_(in.header_), footer_(in.footer_)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inset * InsetEnvironment::clone(Buffer const &, bool same_id) const
|
|
|
|
|
{
|
|
|
|
|
return new InsetEnvironment(*this, same_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int InsetEnvironment::latex(Buffer const * buf,
|
|
|
|
|
ostream & os, bool fragile, bool fp) const
|
|
|
|
|
{
|
|
|
|
|
os << header_;
|
2003-04-25 15:28:41 +00:00
|
|
|
|
int i = InsetText::latex(buf, os, fragile, fp);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
os << footer_;
|
|
|
|
|
return i;
|
|
|
|
|
}
|