3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetHFill.h"
15 #include "MetricsInfo.h"
17 #include "frontends/Painter.h"
19 #include "support/gettext.h"
27 InsetHFill::InsetHFill()
28 : InsetCommand(InsetCommandParams(HFILL_CODE), std::string())
32 CommandInfo const * InsetHFill::findInfo(std::string const & /* cmdName */)
34 static const char * const paramnames[] = {""};
35 static const CommandInfo info = {0, paramnames, 0};
40 Inset * InsetHFill::clone() const
42 return new InsetHFill;
46 void InsetHFill::metrics(MetricsInfo &, Dimension & dim) const
48 // The metrics for this inset are calculated externally in
49 // \c TextMetrics::computeRowMetrics. Those are dummy value:
50 dim = Dimension(10, 10, 10);
54 void InsetHFill::draw(PainterInfo & pi, int x, int y) const
56 Dimension const dim = Inset::dimension(*pi.base.bv);
58 int const x1 = x + dim.wid - 2;
59 int const y0 = y + dim.des;
60 int const y1 = y - dim.asc;
62 pi.pain.line(x0, y1, x0, y0, Color_added_space);
63 pi.pain.line(x0, y, x1, y, Color_added_space,
64 frontend::Painter::line_onoffdash);
65 pi.pain.line(x1, y1, x1, y0, Color_added_space);
69 docstring const InsetHFill::getScreenLabel(Buffer const &) const
71 return _("Horizontal Fill");
75 int InsetHFill::plaintext(Buffer const &, odocstream & os,
76 OutputParams const &) const
83 int InsetHFill::docbook(Buffer const &, odocstream & os,
84 OutputParams const &) const
91 void InsetHFill::write(Buffer const &, std::ostream & os) const
97 bool InsetHFill::isSpace() const