pars.erase(boost::next(pars.begin(), par_offset + 1));
}
-// Initialization of the counter for the paragraph id's,
-//
-// FIXME: There should be a more intelligent way to generate and use the
-// paragraph ids per buffer instead a global static counter for all InsetText
-// in the running program.
-static int paragraph_id = -1;
Text::Text(InsetText * owner, bool use_default_layout)
: owner_(owner), autoBreakRows_(false), undo_counter_(0)
{
pars_.push_back(Paragraph());
Paragraph & par = pars_.back();
- par.setId(++paragraph_id);
par.setInsetOwner(owner);
DocumentClass const & dc = owner->buffer().params().documentClass();
if (use_default_layout)
pars_ = text.pars_;
ParagraphList::iterator const end = pars_.end();
ParagraphList::iterator it = pars_.begin();
- for (; it != end; ++it) {
- it->setId(++paragraph_id);
+ for (; it != end; ++it)
it->setInsetOwner(owner);
- }
}
DocumentClass const & tclass = cur.buffer()->params().documentClass();
Layout const & layout = cpar.layout();
- // this is only allowed, if the current paragraph is not empty
- // or caption and if it has not the keepempty flag active
- if (cur.lastpos() == 0 && !cpar.allowEmpty() &&
- layout.labeltype != LABEL_SENSITIVE)
+ if (cur.lastpos() == 0 && !cpar.allowEmpty()) {
+ if (changeDepthAllowed(cur, DEC_DEPTH))
+ changeDepth(cur, DEC_DEPTH);
+ else
+ setLayout(cur, tclass.defaultLayoutName());
return;
+ }
// a layout change may affect also the following paragraph
recUndo(cur, cur.pit(), undoSpan(cur.pit()) - 1);