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-26 17:34:20 +00:00
|
|
|
|
#include "Color.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "LyXText.h"
|
|
|
|
|
#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::endl;
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2007-04-26 17:34:20 +00:00
|
|
|
|
pi.pain.line(x, y, x + dim_.wid, y, Color::topline, Painter::line_solid,
|
2003-10-27 12:41:26 +00:00
|
|
|
|
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-24 17:18:13 +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
|