X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FText3.cpp;h=4c99c15774707dfe432fed950f1eae836d5185d4;hb=10be0c43f20a27a1e6af82241ad5ec6b5cad3eca;hp=20885ddc664f6f65c37bc677118d5bea1faf6c92;hpb=e52a38549328a58b6fe8efeecef21a71fb9c8d65;p=lyx.git diff --git a/src/Text3.cpp b/src/Text3.cpp index 20885ddc66..4c99c15774 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -345,8 +345,6 @@ static void outline(OutlineOp mode, Cursor & cur) 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; @@ -417,12 +415,17 @@ static void outline(OutlineOp mode, Cursor & cur) 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; } @@ -2629,11 +2632,8 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, 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)