From 8fd1aaa46ea85dde9a0b19b427b72b406605a4d2 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 22 Feb 2023 16:33:37 +0100 Subject: [PATCH] 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. --- src/Layout.h | 5 +++++ src/Text3.cpp | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Layout.h b/src/Layout.h index 6efc5129f9..6581155007 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -292,6 +292,11 @@ public: || labeltype == LABEL_CENTERED || labeltype == LABEL_BIBLIO; } + bool isNumHeadingLabelType() const { + return labeltype == LABEL_ABOVE + || labeltype == LABEL_CENTERED + || labeltype == LABEL_STATIC; + } /// bool addToToc() const { return add_to_toc_; } /// diff --git a/src/Text3.cpp b/src/Text3.cpp index 148b1d4f8b..d077dde7d2 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -570,11 +570,11 @@ static void outline(OutlineOp mode, Cursor & cur, Text * text) DocumentClass const & tc = buf.params().documentClass(); int const newtoclevel = (mode == OutlineIn ? toclevel + 1 : toclevel - 1); - LabelType const oldlabeltype = start->layout().labeltype; for (auto const & lay : tc) { - if (lay.toclevel == newtoclevel && - lay.labeltype == oldlabeltype) { + if (lay.toclevel == newtoclevel + && lay.isNumHeadingLabelType() + && start->layout().isNumHeadingLabelType()) { start->setLayout(lay); break; } -- 2.39.5