commit a716fb96b534475759799b195a7edaeb049fbcf6
Author: Juergen Spitzmueller <sp...@lyx.org>
Date:   Tue May 14 13:37:29 2024 +0200

    NeedCProtect -1 also for InsetLayouts
---
 lib/layouts/beamer.layout  |  7 +++++++
 src/insets/InsetLayout.cpp | 12 ++++++++++--
 src/insets/InsetLayout.h   |  4 ++++
 src/insets/InsetText.cpp   |  2 ++
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/lib/layouts/beamer.layout b/lib/layouts/beamer.layout
index 42b9989dfa..cdc379e53d 100644
--- a/lib/layouts/beamer.layout
+++ b/lib/layouts/beamer.layout
@@ -1578,6 +1578,7 @@ InsetLayout Flex:Only
   EndArgument
   ResetsFont       true
   CustomPars       false
+  NeedCProtect     -1
 End
 
 InsetLayout Flex:Uncover
@@ -1599,6 +1600,7 @@ InsetLayout Flex:Uncover
   EndArgument
   ResetsFont       true
   CustomPars       false
+  NeedCProtect     -1
 End
 
 InsetLayout Flex:Visible
@@ -1620,6 +1622,7 @@ InsetLayout Flex:Visible
   EndArgument
   ResetsFont       true
   CustomPars       false
+  NeedCProtect     -1
 End
 
 InsetLayout Flex:Invisible
@@ -1641,6 +1644,7 @@ InsetLayout Flex:Invisible
   EndArgument
   ResetsFont       true
   CustomPars       false
+  NeedCProtect     -1
 End
 
 InsetLayout Flex:Alternative
@@ -1668,6 +1672,7 @@ InsetLayout Flex:Alternative
   EndArgument
   ResetsFont       true
   CustomPars       false
+  NeedCProtect     -1
 End
 
 InsetLayout Flex:Beamer_Note
@@ -1703,6 +1708,7 @@ InsetLayout Flex:ArticleMode
    LabelString     Article
    MultiPar        true
    ResetsFont      true
+   NeedCProtect    -1
 End
 
 InsetLayout Flex:PresentationMode
@@ -1714,6 +1720,7 @@ InsetLayout Flex:PresentationMode
    LabelString     Presentation
    MultiPar        true
    ResetsFont      true
+   NeedCProtect    -1
 End
 
 
diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
index 2b45119f2c..69f5ac4113 100644
--- a/src/insets/InsetLayout.cpp
+++ b/src/insets/InsetLayout.cpp
@@ -405,9 +405,17 @@ bool InsetLayout::read(Lexer & lex, TextClass const & 
tclass,
                case IL_NEEDPROTECT:
                        lex >> needprotect_;
                        break;
-               case IL_NEEDCPROTECT:
-                       lex >> needcprotect_;
+               case IL_NEEDCPROTECT: {
+                       string val;
+                       lex >> val;
+                       nocprotect_ = false;
+                       needcprotect_ = false;
+                       if (val == "-1")
+                               nocprotect_ = true;
+                       else if (val == "1" || val == "true")
+                               needcprotect_ = true;
                        break;
+               }
                case IL_NEEDMBOXPROTECT:
                        lex >> needmboxprotect_;
                        break;
diff --git a/src/insets/InsetLayout.h b/src/insets/InsetLayout.h
index c879e41f51..36a3c91bbf 100644
--- a/src/insets/InsetLayout.h
+++ b/src/insets/InsetLayout.h
@@ -223,6 +223,8 @@ public:
        bool isNeedProtect() const { return needprotect_; }
        ///
        bool needsCProtect() const { return needcprotect_; }
+       ///
+       bool noCProtect() const { return nocprotect_; }
        /// Protection of some elements such as \ref and \cite
        /// in \mbox (needed by commands building on soul or ulem)
        bool isNeedMBoxProtect() const { return needmboxprotect_; }
@@ -419,6 +421,8 @@ private:
        ///
        bool needcprotect_ = false;
        ///
+       bool nocprotect_ = false;
+       ///
        bool needmboxprotect_ = false;
        /// should the contents be written to TOC strings?
        bool intoc_ = false;
diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp
index 284e466fe4..6df4d8eca8 100644
--- a/src/insets/InsetText.cpp
+++ b/src/insets/InsetText.cpp
@@ -551,6 +551,8 @@ void InsetText::latex(otexstream & os, OutputParams const & 
runparams) const
                rp.pass_thru_chars += il.passThruChars();
        if (!il.noPassThruChars().empty())
                rp.no_pass_thru_chars += il.noPassThruChars();
+       if (il.noCProtect())
+               rp.no_cprotect = true;
        if (!il.newlineCmd().empty())
                rp.newlinecmd = il.newlineCmd();
        rp.par_begin = 0;
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to