{
int const width_offset = TEXT_TO_INSET_OFFSET / 2;
mi.base.textwidth -= width_offset;
- if (type_.empty())
- full_label_ = _("Senseless!!! ");
- else {
- docstring const number = convert<docstring>(counter_);
- docstring label = custom_label_.empty()? _(type_): custom_label_;
- full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
- }
+
+ computeFullLabel();
+
labelwidth_ = theFontMetrics(mi.base.font).width(full_label_);
// add some space to separate the label from the inset text
labelwidth_ += 2 * TEXT_TO_INSET_OFFSET;
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
{
- os << full_label_ << ' ';
- return InsetText::plaintext(buf, os, runparams);
+ computeFullLabel();
+
+ os << '[' << full_label_ << "\n";
+ InsetText::plaintext(buf, os, runparams);
+ os << "\n]";
+
+ return 1 + runparams.linelen; // one char on a separate line
}
int InsetCaption::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
int ret;
os << "<title>";
}
+void InsetCaption::computeFullLabel() const
+{
+ if (type_.empty())
+ full_label_ = _("Senseless!!! ");
+ else {
+ docstring const number = convert<docstring>(counter_);
+ docstring label = custom_label_.empty()? _(type_): custom_label_;
+ full_label_ = bformat(from_ascii("%1$s %2$s:"), label, number);
+ }
+}
+
+
auto_ptr<InsetBase> InsetCaption::doClone() const
{
return auto_ptr<InsetBase>(new InsetCaption(*this));
///
virtual bool wide() const { return false; }
///
- virtual int latex(Buffer const & buf, odocstream & os,
- OutputParams const &) const;
+ int latex(Buffer const & buf, odocstream & os,
+ OutputParams const &) const;
///
int plaintext(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
int docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const;
+ OutputParams const & runparams) const;
///
void setCount(int c) { counter_ = c; }
///
void addToToc(TocList &, Buffer const &) const;
private:
+ ///
+ void computeFullLabel() const;
///
virtual std::auto_ptr<InsetBase> doClone() const;
///