using support::bformat;
+InsetCaption::InsetCaption(InsetCaption const & ic)
+ : InsetText(ic), textclass_(ic.textclass_)
+{
+ setAutoBreakRows(true);
+ setDrawFrame(true);
+ setFrameColor(Color::captionframe);
+}
+
InsetCaption::InsetCaption(BufferParams const & bp)
- : InsetText(bp), textclass_(bp.getLyXTextClass())
+ : InsetText(bp), textclass_(bp.getTextClass())
{
setAutoBreakRows(true);
setDrawFrame(true);
}
-void InsetCaption::addToToc(TocList & toclist, Buffer const & buf) const
+void InsetCaption::addToToc(TocList & toclist, Buffer const & buf, ParConstIterator &) const
{
if (type_.empty())
return;
int const width_offset = TEXT_TO_INSET_OFFSET / 2;
mi.base.textwidth -= width_offset;
- computeFullLabel();
+ computeFullLabel(*mi.base.bv->buffer());
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
// add some space to separate the label from the inset text
int InsetCaption::latex(Buffer const & buf, odocstream & os,
- OutputParams const & runparams_in) const
+ OutputParams const & runparams_in) const
{
// This is a bit too simplistic to take advantage of
// caption options we must add more later. (Lgb)
int InsetCaption::plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
- computeFullLabel();
+ computeFullLabel(buf);
os << '[' << full_label_ << "\n";
InsetText::plaintext(buf, os, runparams);
int InsetCaption::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret;
os << "<title>";
}
-void InsetCaption::computeFullLabel() const
+int InsetCaption::getArgument(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ return InsetText::latex(buf, os, runparams);
+}
+
+
+int InsetCaption::getOptArg(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
+{
+ return latexOptArgInsets(buf, paragraphs()[0], os, runparams, 1);
+}
+
+
+void InsetCaption::computeFullLabel(Buffer const & buf) const
{
if (type_.empty())
- full_label_ = _("Senseless!!! ");
+ full_label_ = buf.B_("Senseless!!! ");
else {
docstring const number = convert<docstring>(counter_);
- docstring label = custom_label_.empty()? _(type_): custom_label_;
+ docstring label = custom_label_.empty()? buf.B_(type_): custom_label_;
full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
}
}