Private(Paragraph * owner, Layout const & layout);
/// "Copy constructor"
Private(Private const &, Paragraph * owner);
+ /// Copy constructor from \p beg to \p end
+ Private(Private const &, Paragraph * owner, pos_type beg, pos_type end);
///
void insertChar(pos_type pos, char_type c, Change const & change);
}
+Paragraph::Private::Private(Private const & p, Paragraph * owner,
+ pos_type beg, pos_type end)
+ : owner_(owner), inset_owner_(p.inset_owner_),
+ insetlist_(p.insetlist_, beg, end),
+ params_(p.params_), changes_(p.changes_),
+ begin_of_body_(p.begin_of_body_), words_(p.words_),
+ layout_(p.layout_)
+{
+ id_ = paragraph_id++;
+ if (beg >= pos_type(p.text_.size()))
+ return;
+ text_ = p.text_.substr(beg, end - beg);
+
+ FontList::const_iterator fcit = fontlist_.begin();
+ FontList::const_iterator fend = fontlist_.end();
+ for (; fcit != fend; ++fcit) {
+ if (fcit->pos() < beg)
+ continue;
+ if (fcit->pos() >= end) {
+ // Add last entry in the fontlist_.
+ fontlist_.set(text_.size() - 1, fcit->font());
+ break;
+ }
+ // Add a new entry in the fontlist_.
+ fontlist_.set(fcit->pos() - beg, fcit->font());
+ }
+}
+
+
bool Paragraph::isChanged(pos_type start, pos_type end) const
{
LASSERT(start >= 0 && start <= size(), /**/);
}
+Paragraph::Paragraph(Paragraph const & par, pos_type beg, pos_type end)
+ : itemdepth(par.itemdepth),
+ d(new Paragraph::Private(*par.d, this, beg, end))
+{
+ registerWords();
+}
+
+
Paragraph & Paragraph::operator=(Paragraph const & par)
{
// needed as we will destroy the private part before copying it
bool asdefault = forcePlainLayout();
Layout const & style = asdefault ?
- bparams.documentClass().emptyLayout() :
+ bparams.documentClass().plainLayout() :
*d->layout_;
// Current base font for all inherited font changes, without any
void Paragraph::setPlainOrDefaultLayout(DocumentClass const & tclass)
{
if (usePlainLayout())
- setLayout(tclass.emptyLayout());
+ setLayout(tclass.plainLayout());
else
setLayout(tclass.defaultLayout());
}
}
+void Paragraph::setBuffer(Buffer & b)
+{
+ d->insetlist_.setBuffer(b);
+}
+
+
Inset * Paragraph::releaseInset(pos_type pos)
{
Inset * inset = d->insetlist_.release(pos);