2003-10-27 12:41:26 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetLine.cpp
|
2003-10-27 12:41:26 +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
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetLine.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
|
|
|
|
|
#include "debug.h"
|
2007-04-29 23:33:02 +00:00
|
|
|
|
#include "Text.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-04-26 04:41:58 +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::ostream;
|
|
|
|
|
|
|
|
|
|
|
2007-04-26 11:30:54 +00:00
|
|
|
|
void InsetLine::read(Buffer const &, Lexer &)
|
2003-10-27 12:41:26 +00:00
|
|
|
|
{
|
|
|
|
|
/* 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void 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;
|
2007-09-25 07:07:11 +00:00
|
|
|
|
// Cache the inset dimension.
|
|
|
|
|
setDimCache(mi, dim);
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsetLine::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
2007-09-25 07:07:11 +00:00
|
|
|
|
Dimension const dim = dimension(*pi.base.bv);
|
2007-10-25 12:41:02 +00:00
|
|
|
|
pi.pain.line(x, y, x + dim.wid, y, Color_topline,
|
2007-09-21 20:39:47 +00:00
|
|
|
|
Painter::line_solid, Painter::line_thick);
|
2003-10-27 12:41:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetLine::latex(Buffer const &, odocstream & os,
|
2007-05-28 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-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) 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
|