Let OUTLINE functions jump from section to part if there is no chapter

Fixes #12938
This commit is contained in:
Juergen Spitzmueller 2023-10-21 13:48:50 +02:00
parent 946d87c261
commit 2b33da5944

View File

@ -3903,8 +3903,20 @@ void outline(OutlineOp mode, Cursor & cur, bool local)
continue;
DocumentClass const & tc = buf.params().documentClass();
int const newtoclevel =
(mode == OutlineIn ? toclevel + 1 : toclevel - 1);
int newtoclevel = -1;
if (mode == OutlineIn) {
if (toclevel == -1 && tc.getTOCLayout().toclevel > 0)
// we are at part but don't have a chapter
newtoclevel = tc.getTOCLayout().toclevel;
else
newtoclevel = toclevel + 1;
} else {
if (tc.getTOCLayout().toclevel == toclevel && tc.min_toclevel() < toclevel)
// we are at highest level, but there is still part
newtoclevel = tc.min_toclevel();
else
newtoclevel = toclevel - 1;
}
bool found = false;
for (auto const & lay : tc) {
@ -3939,8 +3951,20 @@ void outline(OutlineOp mode, Cursor & cur, bool local)
continue;
DocumentClass const & tc = buf.params().documentClass();
int const newtoclevel =
(mode == OutlineIn ? toclevel + 1 : toclevel - 1);
int newtoclevel = -1;
if (mode == OutlineIn) {
if (toclevel == -1 && tc.getTOCLayout().toclevel > 0)
// we are at part but don't have a chapter
newtoclevel = tc.getTOCLayout().toclevel;
else
newtoclevel = toclevel + 1;
} else {
if (tc.getTOCLayout().toclevel == toclevel && tc.min_toclevel() < toclevel)
// we are at highest level, but there is still part
newtoclevel = tc.min_toclevel();
else
newtoclevel = toclevel - 1;
}
for (auto const & lay : tc) {
if (lay.toclevel == newtoclevel