2003-03-13 10:06:11 +00:00
|
|
|
|
/**
|
2007-04-28 20:44:46 +00:00
|
|
|
|
* \file InsetEnvironment.cpp
|
2003-03-13 10:06:11 +00:00
|
|
|
|
* 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>
|
|
|
|
|
|
2007-04-28 20:44:46 +00:00
|
|
|
|
#include "InsetEnvironment.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2008-03-04 22:28:18 +00:00
|
|
|
|
#include "Buffer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "BufferParams.h"
|
2007-09-29 20:02:32 +00:00
|
|
|
|
#include "Layout.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "OutputParams.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
|
#include "output_latex.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "TexRow.h"
|
2007-11-07 23:25:08 +00:00
|
|
|
|
#include "TextClass.h"
|
2003-03-13 10:06:11 +00:00
|
|
|
|
|
2008-03-04 22:28:18 +00:00
|
|
|
|
#include "support/gettext.h"
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
using namespace std;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
2006-09-09 18:52:00 +00:00
|
|
|
|
|
2003-03-13 10:06:11 +00:00
|
|
|
|
|
2008-03-04 22:28:18 +00:00
|
|
|
|
InsetEnvironment::InsetEnvironment(Buffer const & buf, docstring const & name)
|
|
|
|
|
: InsetText(buf), layout_(buf.params().documentClass()[name]), name_(name)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2003-09-16 10:01:29 +00:00
|
|
|
|
setAutoBreakRows(true);
|
2004-08-14 15:55:22 +00:00
|
|
|
|
setDrawFrame(true);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void InsetEnvironment::write(ostream & os) const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2007-04-30 14:39:09 +00:00
|
|
|
|
os << "Environment " << to_utf8(name()) << "\n";
|
2008-02-27 20:43:16 +00:00
|
|
|
|
InsetText::write(os);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
|
void InsetEnvironment::read(Lexer & lex)
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2008-02-27 20:43:16 +00:00
|
|
|
|
InsetText::read(lex);
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
|
docstring InsetEnvironment::editMessage() const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2007-04-30 14:39:09 +00:00
|
|
|
|
return _("Opened Environment Inset: ") + name();
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int InsetEnvironment::latex(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2003-03-13 10:06:11 +00:00
|
|
|
|
{
|
2006-10-19 16:51:30 +00:00
|
|
|
|
// FIXME UNICODE
|
2008-03-06 20:01:30 +00:00
|
|
|
|
os << from_utf8(layout_.latexheader);
|
2003-05-19 07:12:09 +00:00
|
|
|
|
TexRow texrow;
|
2008-02-27 20:43:16 +00:00
|
|
|
|
latexParagraphs(buffer(), text_, os, texrow, runparams,
|
2008-03-06 20:01:30 +00:00
|
|
|
|
layout_.latexparagraph);
|
2006-10-19 16:51:30 +00:00
|
|
|
|
// FIXME UNICODE
|
2008-03-06 20:01:30 +00:00
|
|
|
|
os << from_utf8(layout_.latexfooter);
|
2003-05-19 07:12:09 +00:00
|
|
|
|
return texrow.rows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-27 20:43:16 +00:00
|
|
|
|
int InsetEnvironment::plaintext(odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2007-02-16 10:05:30 +00:00
|
|
|
|
{
|
2007-04-30 14:39:09 +00:00
|
|
|
|
os << '[' << to_utf8(name()) << ":\n";
|
2008-02-27 20:43:16 +00:00
|
|
|
|
InsetText::plaintext(os, runparams);
|
2007-02-16 10:05:30 +00:00
|
|
|
|
os << "\n]";
|
|
|
|
|
|
2007-02-20 17:52:41 +00:00
|
|
|
|
return PLAINTEXT_NEWLINE + 1; // one char on a separate line
|
2007-02-16 10:05:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-03-06 20:01:30 +00:00
|
|
|
|
Layout const & InsetEnvironment::layout() const
|
2003-05-19 07:12:09 +00:00
|
|
|
|
{
|
|
|
|
|
return layout_;
|
2003-03-13 10:06:11 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|