Fix another old outliner bug (#9375)

Parts, chapters and sections have different LabelTypes, but this does
not mean they cannot be transformed into each other while doing
OUTLINE_IN/OUT

Not sure why the labeltype check is here anyway, but let's keep it.
This commit is contained in:
Juergen Spitzmueller 2023-02-22 16:33:37 +01:00
parent 41d95a45d9
commit 8fd1aaa46e
2 changed files with 8 additions and 3 deletions

View File

@ -292,6 +292,11 @@ public:
|| labeltype == LABEL_CENTERED || labeltype == LABEL_CENTERED
|| labeltype == LABEL_BIBLIO; || labeltype == LABEL_BIBLIO;
} }
bool isNumHeadingLabelType() const {
return labeltype == LABEL_ABOVE
|| labeltype == LABEL_CENTERED
|| labeltype == LABEL_STATIC;
}
/// ///
bool addToToc() const { return add_to_toc_; } bool addToToc() const { return add_to_toc_; }
/// ///

View File

@ -570,11 +570,11 @@ static void outline(OutlineOp mode, Cursor & cur, Text * text)
DocumentClass const & tc = buf.params().documentClass(); DocumentClass const & tc = buf.params().documentClass();
int const newtoclevel = int const newtoclevel =
(mode == OutlineIn ? toclevel + 1 : toclevel - 1); (mode == OutlineIn ? toclevel + 1 : toclevel - 1);
LabelType const oldlabeltype = start->layout().labeltype;
for (auto const & lay : tc) { for (auto const & lay : tc) {
if (lay.toclevel == newtoclevel && if (lay.toclevel == newtoclevel
lay.labeltype == oldlabeltype) { && lay.isNumHeadingLabelType()
&& start->layout().isNumHeadingLabelType()) {
start->setLayout(lay); start->setLayout(lay);
break; break;
} }