if (layoutname.empty())
layoutname = tclass.defaultLayoutName();
- if (par.forceEmptyLayout()) {
+ if (par.forcePlainLayout()) {
// in this case only the empty layout is allowed
- layoutname = tclass.emptyLayoutName();
- } else if (par.useEmptyLayout()) {
+ layoutname = tclass.plainLayoutName();
+ } else if (par.usePlainLayout()) {
// in this case, default layout maps to empty layout
if (layoutname == tclass.defaultLayoutName())
- layoutname = tclass.emptyLayoutName();
+ layoutname = tclass.plainLayoutName();
} else {
// otherwise, the empty layout maps to the default
- if (layoutname == tclass.emptyLayoutName())
+ if (layoutname == tclass.plainLayoutName())
layoutname = tclass.defaultLayoutName();
}
- bool hasLayout = tclass.hasLayout(layoutname);
-
- if (!hasLayout) {
- errorList.push_back(ErrorItem(_("Unknown layout"),
- bformat(_("Layout '%1$s' does not exist in textclass '%2$s'\nTrying to use the default instead.\n"),
- layoutname, from_utf8(tclass.name())), par.id(), 0, par.size()));
- layoutname = par.useEmptyLayout() ?
- tclass.emptyLayoutName() :
- tclass.defaultLayoutName();
- }
+ // When we apply an unknown layout to a document, we add this layout to the textclass
+ // of this document. For example, when you apply class article to a beamer document,
+ // all unknown layouts such as frame will be added to document class article so that
+ // these layouts can keep their original names.
+ tclass.addLayoutIfNeeded(layoutname);
par.setLayout(bp.documentClass()[layoutname]);
} else if (token == "\\backslash") {
par.appendChar('\\', font, change);
} else if (token == "\\LyXTable") {
- auto_ptr<Inset> inset(new InsetTabular(buf));
+ auto_ptr<Inset> inset(new InsetTabular(const_cast<Buffer &>(buf)));
inset->read(lex);
par.insertInset(par.size(), inset.release(), font, change);
} else if (token == "\\lyxline") {
if (sensitive) {
if (cur.pos() == 0)
// set to standard-layout
- //FIXME Check if this should be emptyLayout() in some cases
+ //FIXME Check if this should be plainLayout() in some cases
pars_[cpit].applyLayout(tclass.defaultLayout());
else
// set to standard-layout
- //FIXME Check if this should be emptyLayout() in some cases
+ //FIXME Check if this should be plainLayout() in some cases
pars_[next_par].applyLayout(tclass.defaultLayout());
}
cursorForward(cur);
else {
cur.resetAnchor();
- cur.selection() = true;
+ cur.setSelection(true);
cursorForwardOneWord(cur);
cur.setSelection();
cutSelection(cur, true, false);
cursorBackward(cur);
else {
cur.resetAnchor();
- cur.selection() = true;
+ cur.setSelection(true);
cursorBackwardOneWord(cur);
cur.setSelection();
cutSelection(cur, true, false);
}
// otherwise reset to default
- cur.paragraph().setEmptyOrDefaultLayout(bufparams.documentClass());
+ cur.paragraph().setPlainOrDefaultLayout(bufparams.documentClass());
return true;
}
// or the empty layout.
else if (par.layout() == prevpar.layout()
|| tclass.isDefaultLayout(par.layout())
- || tclass.isEmptyLayout(par.layout())) {
+ || tclass.isPlainLayout(par.layout())) {
cur.recordUndo(ATOMIC_UNDO, prevcur.pit());
mergeParagraph(bufparams, plist, prevcur.pit());
needsUpdate = true;
}
-bool Text::dissolveInset(Cursor & cur) {
- LASSERT(this == cur.text(), /**/);
+bool Text::dissolveInset(Cursor & cur)
+{
+ LASSERT(this == cur.text(), return false);
if (isMainText(cur.bv().buffer()) || cur.inset().nargs() != 1)
return false;
cur.recordUndoInset();
- cur.mark() = false;
+ cur.setMark(false);
cur.selHandle(false);
// save position
pos_type spos = cur.pos();
lex.pushToken(token);
Paragraph par;
+ par.setInsetOwner(insetPtr);
par.params().depth(depth);
par.setFont(0, Font(inherit_font, buf.params().language));
- par.setInsetOwner(insetPtr);
pars_.push_back(par);
// FIXME: goddamn InsetTabular makes us pass a Buffer
}
// Returns the current font and depth as a message.
-docstring Text::currentState(Cursor & cur)
+docstring Text::currentState(Cursor const & cur) const
{
LASSERT(this == cur.text(), /**/);
Buffer & buf = cur.buffer();
}
-docstring Text::getPossibleLabel(Cursor & cur) const
+docstring Text::getPossibleLabel(Cursor const & cur) const
{
pit_type pit = cur.pit();