} // namespace anon
+bool Text::empty() const
+{
+ return pars_.empty() || (pars_.size() == 1 && pars_[0].empty()
+ // FIXME: Should we consider the labeled type as empty too?
+ && pars_[0].layout()->labeltype == LABEL_NO_LABEL);
+}
+
double Text::spacing(Buffer const & buffer,
Paragraph const & par) const
/// constructor
explicit Text();
+ /// \return true if there's no content at all.
+ /// \warning a non standard layout on an empty paragraph doesn't
+ // count as empty.
+ bool empty() const;
+
///
Font getFont(Buffer const & buffer, Paragraph const & par,
pos_type pos) const;
}
+// FIXME: buf should should be const because updateLabels() modifies
+// the contents of the paragraphs.
void updateLabels(Buffer const & buf, bool childonly)
{
Buffer const * const master = buf.getMasterBuffer();
textclass.counters().reset();
}
+ Buffer & cbuf = const_cast<Buffer &>(buf);
+
+ if (buf.text().empty()) {
+ // FIXME: we don't call continue with updateLabels() here because
+ // it crashes on newly created documents. But the TocBackend needs to
+ // be initialised nonetheless so we update the tocBackend manually.
+ cbuf.tocBackend().update();
+ return;
+ }
+
// do the real work
ParIterator parit = par_iterator_begin(buf.inset());
updateLabels(buf, parit);
- Buffer & cbuf = const_cast<Buffer &>(buf);
cbuf.tocBackend().update();
if (!childonly)
cbuf.structureChanged();