+ case LFUN_LAYOUT:
+ {
+ // Derive layout number from given argument (string)
+ // and current buffer's textclass (number). */
+ LyXTextClassList::ClassList::size_type tclass =
+ buffer->params.textclass;
+ std::pair <bool, LyXTextClass::size_type> layout =
+ textclasslist.NumberOfLayout(tclass, arg);
+
+ // If the entry is obsolete, use the new one instead.
+ if (layout.first) {
+ string obs = textclasslist.Style(tclass,layout.second).
+ obsoleted_by();
+ if (!obs.empty())
+ layout = textclasslist.NumberOfLayout(tclass, obs);
+ }
+
+ // see if we found the layout number:
+ if (!layout.first) {
+ string msg = string(N_("Layout ")) + arg + N_(" not known");
+
+ bv->owner()->getMiniBuffer()->Set(msg);
+ break;
+ }
+
+ if (current_layout != layout.second) {
+ bv->text->SetLayout(cursor, selection_start_cursor,
+ selection_end_cursor, layout.second);
+ bv->owner()->getToolbar()->combox->select(cursor.par->GetLayout()+1);
+ UpdateLocal(bv, true);
+ }
+ }
+ break;