2003-10-27 12:41:26 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file insetline.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 "insetline.h"
|
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "LColor.h"
|
|
|
|
|
#include "lyxtext.h"
|
|
|
|
|
#include "metricsinfo.h"
|
|
|
|
|
#include "LaTeXFeatures.h"
|
2005-09-09 12:49:21 +00:00
|
|
|
|
#include "outputparams.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
|
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
using frontend::Painter;
|
2006-06-20 08:39:16 +00:00
|
|
|
|
|
2003-10-27 12:41:26 +00:00
|
|
|
|
using std::endl;
|
|
|
|
|
using std::ostream;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::read(Buffer const &, LyXLex &)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing to read */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::write(Buffer const &, ostream & os) const
|
|
|
|
|
{
|
2004-08-16 11:27:51 +00:00
|
|
|
|
os << "\n\\lyxline\n";
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
dim.asc = 3;
|
|
|
|
|
dim.des = 3;
|
|
|
|
|
dim.wid = mi.base.textwidth;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool const changed = dim_ != dim;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return changed;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
|
|
|
|
pi.pain.line(x, y, x + dim_.wid, y, LColor::topline, Painter::line_solid,
|
|
|
|
|
Painter::line_thick);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetLine::latex(Buffer const &, odocstream & os,
|
2007-02-15 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
2006-10-19 16:51:30 +00:00
|
|
|
|
os << "\\lyxline{\\"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(runparams.local_font->latexSize()) << '}';
|
2003-10-27 12:41:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetLine::plaintext(Buffer const &, odocstream & os,
|
2007-02-15 22:27:45 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
2007-02-15 22:27:45 +00:00
|
|
|
|
os << "\n-------------------------------------------\n";
|
2007-02-20 17:52:41 +00:00
|
|
|
|
return PLAINTEXT_NEWLINE;
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
|
int InsetLine::docbook(Buffer const &, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
os << '\n';
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::validate(LaTeXFeatures & features) const
|
|
|
|
|
{
|
|
|
|
|
features.require("lyxline");
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|