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-06-20 08:39:16 +00:00
|
|
|
|
using lyx::frontend::Painter;
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
|
|
|
{
|
|
|
|
|
dim.asc = 3;
|
|
|
|
|
dim.des = 3;
|
|
|
|
|
dim.wid = mi.base.textwidth;
|
|
|
|
|
dim_ = dim;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int InsetLine::latex(Buffer const &, ostream & os,
|
2005-09-09 11:04:53 +00:00
|
|
|
|
OutputParams const & runparams) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
2005-09-09 11:04:53 +00:00
|
|
|
|
os << "\\lyxline{\\" << runparams.local_font->latexSize() << '}';
|
2003-10-27 12:41:26 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-11-05 12:06:20 +00:00
|
|
|
|
int InsetLine::plaintext(Buffer const &, ostream & os,
|
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
os << "-------------------------------------------";
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int InsetLine::linuxdoc(Buffer const &, std::ostream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
os << '\n';
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-10-31 18:45:43 +00:00
|
|
|
|
int InsetLine::docbook(Buffer const &, std::ostream & 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");
|
|
|
|
|
}
|