commit 8fd1aaa46ea85dde9a0b19b427b72b406605a4d2
Author: Juergen Spitzmueller <[email protected]>
Date:   Wed Feb 22 16:33:37 2023 +0100

    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 6efc512..6581155 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 148b1d4..d077dde 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;
                                        }
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to