ParagraphList::iterator finish = start;
ParagraphList::iterator const end = pars.end();
- DocumentClass const & tc = buf.params().documentClass();
-
int const thistoclevel = buf.text().getTocLevel(distance(bgn, start));
int toclevel;
toclevel = buf.text().getTocLevel(distance(bgn, start));
if (toclevel == Layout::NOT_IN_TOC)
continue;
+
+ DocumentClass const & tc = buf.params().documentClass();
DocumentClass::const_iterator lit = tc.begin();
DocumentClass::const_iterator len = tc.end();
+ int const newtoclevel =
+ (mode == OutlineIn ? toclevel + 1 : toclevel - 1);
+ LabelType const oldlabeltype = start->layout().labeltype;
+
for (; lit != len; ++lit) {
- if (lit->toclevel == (mode == OutlineIn ?
- toclevel + 1 : toclevel - 1) &&
- start->layout().labeltype == lit->labeltype) {
+ if (lit->toclevel == newtoclevel &&
+ lit->labeltype == oldlabeltype) {
start->setLayout(*lit);
break;
}
cur.screenUpdateFlags(Update::FitCursor);
break;
- case LFUN_INSET_SELECT_ALL:
- if (cur.depth() == 1 || !cur.selection() || !cur.selBegin().at_begin()
- || !cur.selEnd().at_end()) {
- needsUpdate |= cur.selHandle(false);
- needsUpdate |= cursorTop(cur);
- needsUpdate |= cur.selHandle(true);
- needsUpdate |= cursorBottom(cur);
- } else
- cur.undispatched();
- cur.screenUpdateFlags(Update::FitCursor);
- break;
-
case LFUN_CHAR_FORWARD:
case LFUN_CHAR_FORWARD_SELECT:
//LYXERR0(" LFUN_CHAR_FORWARD[SEL]:\n" << cur);
case LFUN_CAPTION_INSERT: {
code = CAPTION_CODE;
string arg = cmd.getArg(0);
- bool varia = arg != "LongTableNoNumber";
- if (cur.depth() > 0) {
- if (&cur[cur.depth() - 1].inset())
- varia = cur[cur.depth() - 1].inset().allowsCaptionVariation(arg);
- }
+ bool varia = arg != "LongTableNoNumber"
+ && cur.inset().allowsCaptionVariation(arg);
// not allowed in description items,
// and in specific insets
enable = !inDescriptionItem(cur)
case LFUN_INSET_END:
case LFUN_INSET_BEGIN_SELECT:
case LFUN_INSET_END_SELECT:
- case LFUN_INSET_SELECT_ALL:
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_DOWN:
case LFUN_LINE_BEGIN: