]> git.lyx.org Git - features.git/commitdiff
Add Inset::isEnvironment()
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 10 Apr 2023 06:09:32 +0000 (08:09 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 10 Apr 2023 06:09:32 +0000 (08:09 +0200)
This usually returns InsetLayout::isEnvironment(), but listings has
specific conditions (depending on whether it is inline or not)

src/insets/Inset.h
src/insets/InsetListings.h

index fd55d69215ae05c947582207369500942a0000b6..fa9214d705870652563de1424c3af14de51925e4 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef INSETBASE_H
 #define INSETBASE_H
 
+#include "InsetLayout.h"
 #include "ColorCode.h"
 #include "InsetCode.h"
 #include "LayoutEnums.h"
@@ -601,6 +602,8 @@ public:
        virtual void acceptChanges() {}
        /// reject the changes within the inset
        virtual void rejectChanges() {}
+       ///
+       virtual bool isEnvironment() const { return getLayout().latextype() == InsetLaTeXType::ENVIRONMENT; }
 
        ///
        virtual bool needsCProtection(bool const, bool const) const { return false; }
index 9d4eeb1d449029bbffdb28b6cac1324101479fdc..080b7b788224f26d8f33ce4a772138d4d197ec41 100644 (file)
@@ -38,6 +38,8 @@ public:
        static void string2params(std::string const &, InsetListingsParams &);
        ///
        static std::string params2string(InsetListingsParams const &);
+       ///
+       bool isEnvironment() const { return !params().isInline(); }
 private:
        ///
        bool isLabeled() const override { return true; }