]> git.lyx.org Git - features.git/commitdiff
Properly implement IsTocCaption for Arguments in standard TOC
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 29 Dec 2017 10:51:24 +0000 (11:51 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 29 Dec 2017 10:51:24 +0000 (11:51 +0100)
Fixes: #10631
Candidate for 2.3.x.

12 files changed:
lib/layouts/apa.layout
lib/layouts/beamer.layout
lib/layouts/europecv.layout
lib/layouts/isprs.layout
lib/layouts/simplecv.layout
lib/layouts/stdsections.inc
lib/layouts/svcommon.inc
lib/layouts/tufte-book.layout
lib/layouts/tufte-handout.layout
src/insets/InsetArgument.cpp
src/insets/InsetArgument.h
src/insets/InsetText.cpp

index d771973ccfe69be1f5dcaf92f10d215150733400..a421c4e492d43027380b2f69888ebca0847e6dea 100644 (file)
@@ -309,7 +309,7 @@ Style Section
          Series              Bold
          Size                Huge
        EndFont
-               TocLevel 1
+       TocLevel              1
 End
 
 
@@ -319,7 +319,7 @@ Style Subsection
          Series              Bold
          Size                Larger
        EndFont
-               TocLevel 2
+       TocLevel              2
 End
 
 
@@ -329,7 +329,7 @@ Style Subsubsection
          Series              Bold
          Size                Large
        EndFont
-               TocLevel 3
+       TocLevel              3
 End
 
 
@@ -339,7 +339,7 @@ Style Paragraph
          Series              Bold
          Size                Normal
        EndFont
-               TocLevel 4
+       TocLevel              4
 End
 
 
@@ -350,7 +350,7 @@ Style Subparagraph
          Size                Normal
          Shape               Italic
        EndFont
-               TocLevel 5
+       TocLevel 5
 End
 
 
index fef205a96a56cd833a250351c815d40dd01dea47..589d1ea000fdbf4444f48d220f7af02ac43c9b02 100644 (file)
@@ -216,6 +216,7 @@ Style Part
     LabelString    "Short Title|S"
     Tooltip        "The part as it appears in the table of contents/running headers"
     InsertCotext   1
+    IsTocCaption   1
   EndArgument
   NeedProtect      1
   NextNoIndent     1
@@ -270,6 +271,7 @@ Style Section
     LabelString    "Short Title|S"
     Tooltip        "The section as it appears in the table of contents/running headers"
     InsertCotext   1
+    IsTocCaption   1
   EndArgument
   Font
     Family         Roman
@@ -331,6 +333,7 @@ Style Subsection
     LabelString    "Short Title|S"
     Tooltip        "The subsection as it appears in the table of contents/running headers"
     InsertCotext   1
+    IsTocCaption   1
   EndArgument
   Font
     Family         Roman
@@ -392,6 +395,7 @@ Style Subsubsection
     LabelString    "Short Title|S"
     Tooltip        "The subsubsection as it appears in the table of contents/running headers"
     InsertCotext   1
+    IsTocCaption   1
   EndArgument
   Font
     Family         Roman
@@ -481,6 +485,7 @@ Style Frame
       Size         largest
     EndFont
     AutoInsert     1
+    IsTocCaption   1
   EndArgument
   AutoNests 
        Standard,Itemize,Enumerate,Description,FrameTitle,FrameSubtitle,Column,
index 141f78707ec3c71204b9ae9711820e0480923f3a..cc30eecba4f2213fa8c717bf4bf37d69ef39826a 100644 (file)
@@ -136,7 +136,8 @@ Style Section
        Argument 1
          LabelString   "Short Title|S"
          Tooltip       "The title as it appears in the header"
-         InsertCotext   1
+         InsertCotext  1
+         IsTocCaption  1
        EndArgument
        ParSkip         0.4
        TopSep          1.3
index f75bca09dc89af25d0829d7e82c6a90e7db1e73a..d0ca792cae6774027f1b2e533b5bcd0a4c8e9a6b 100644 (file)
@@ -153,7 +153,7 @@ Style Section
    Series              Bold
    Size                Normal
   EndFont
-       TocLevel 1
+  TocLevel 1
 End
 
 # Subsection style definition
@@ -163,7 +163,7 @@ Style Subsection
    Series              Bold
    Size                Normal
   EndFont
-       TocLevel 2
+  TocLevel 2
 End
 
 # Subsubsection style definition
@@ -173,7 +173,7 @@ Style Subsubsection
    Series              Bold
    Size                Normal
   EndFont
-       TocLevel 3
+  TocLevel 3
 End
 
 # Section* style definition
index 09b175846b3e499219be419e3ae1ea40290a1792..0a13f23ccf40ccf1855a134078554f48c559b9c0 100644 (file)
@@ -46,11 +46,12 @@ Style Section
          Family              Sans
          Series              Bold
        EndFont
-               TocLevel 1
+       TocLevel 1
        Argument 1
                LabelString   "Short Title|S"
                Tooltip       "The section as it appears in the table of contents/running headers"
                InsertCotext   1
+               IsTocCaption   1
        EndArgument
 End
 
index 0705e4504176e67dcde048a761f5625994a571fa..e7a0292632428c09c2890b67c88caf5751812906 100644 (file)
@@ -32,6 +32,7 @@ Style Part
                LabelString   "Short Title|S"
                Tooltip       "The part as it appears in the table of contents/running headers"
                InsertCotext  1
+               IsTocCaption  1
        EndArgument
        Font
          Series              Bold
@@ -63,6 +64,7 @@ Style Chapter
                LabelString   "Short Title|S"
                Tooltip       "The chapter as it appears in the table of contents/running headers"
                InsertCotext  1
+               IsTocCaption  1
        EndArgument
        Font
          Series              Bold
@@ -93,6 +95,7 @@ Style Section
                LabelString   "Short Title|S"
                Tooltip       "The section as it appears in the table of contents/running headers"
                InsertCotext  1
+               IsTocCaption  1
        EndArgument
        Font
          Series              Bold
index 6ebb40eed3377c4d6d1a381c24e9d166e27a9d8d..d370adaa7a863119e06fdfaeca4c77759798086b 100644 (file)
@@ -140,6 +140,7 @@ Style PartBacktext
          Mandatory     1
          LabelString   "Part Title"
          Tooltip       "Title of this part"
+         IsTocCaption  1
        EndArgument
        Preamble
          \newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}
index d29e86ee15feab10cc9fa2864305432aaf6055a4..9ffc0e5ec5dab651fc84e47afbc40ced81067bc4 100644 (file)
@@ -81,8 +81,9 @@ Style Chapter
        RefPrefix               chap
        Argument 1
          LabelString   "Short Title|S"
-         Tooltip               "The chapter as it appears in the table of contents/running headers"
+         Tooltip       "The chapter as it appears in the table of contents/running headers"
          InsertCotext  1
+         IsTocCaption  1
        EndArgument
        Font
          Series                Bold
@@ -109,8 +110,9 @@ Style Section
        RefPrefix               sec
        Argument 1
          LabelString   "Short Title|S"
-         Tooltip               "The section as it appears in the table of contents/running headers"
+         Tooltip       "The section as it appears in the table of contents/running headers"
          InsertCotext  1
+         IsTocCaption  1
        EndArgument
        Font
          Series                Bold
index 507e4a9411735bf34a2687a0d12fb6b37df474a5..dc1c4acad48c0abe8739222da5cc993d63d53fbe 100644 (file)
@@ -39,7 +39,8 @@ Style Part
        Argument 1
          LabelString   "Short Title|S"
          Tooltip       "The part as it appears in the table of contents/running headers"
-         InsertCotext   1
+         InsertCotext  1
+         IsTocCaption  1
        EndArgument
        Font
          Series        Bold
index a3cf1c5202971fd76cb2529dcf67cb5fb93028be..df1344e6267a5537bcc4e972ea4b0afacb83133f 100644 (file)
@@ -43,7 +43,7 @@ InsetArgument::InsetArgument(Buffer * buf, string const & name)
     : InsetCollapsible(buf), name_(name), labelstring_(docstring()),
       font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
       pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false),
-      pass_thru_chars_(docstring())
+      pass_thru_chars_(docstring()), is_toc_caption_(false)
 {}
 
 
@@ -119,11 +119,13 @@ void InsetArgument::updateBuffer(ParIterator const & it, UpdateType utype)
                decoration_ = (*lait).second.decoration;
                pass_thru_chars_ = (*lait).second.pass_thru_chars;
                pass_thru_local_ = false;
-               if (lait->second.is_toc_caption)
+               if (lait->second.is_toc_caption) {
+                       is_toc_caption_ = true;
                        // empty if AddToToc is not set
                        caption_of_toc_ = insetlayout
                                ? it.inset().getLayout().tocType()
                                : it.paragraph().layout().tocType();
+               }
 
                switch ((*lait).second.passthru) {
                        case PT_INHERITED:
index 9fff93b4e12034199eb56c73f7287406956ace00..2bd0578f28cee35284fa14e77bb6b7c54669f856 100644 (file)
@@ -69,6 +69,8 @@ public:
        ///
        bool isPassThru() const { return pass_thru_; }
        ///
+       bool isTocCaption() const { return is_toc_caption_; }
+       ///
        bool resetFontEdit() const { return false; }
        //@}
        /// \name Public functions inherited from InsetCollapsible class
@@ -113,6 +115,8 @@ private:
        bool pass_thru_;
        ///
        docstring pass_thru_chars_;
+       /// Does this argument provide content for the TOC?
+       bool is_toc_caption_;
        /// The type of Toc this is the caption of, empty otherwise.
        std::string caption_of_toc_;
 
index 4cc7a0af9e5a4cd41bdb89c5ec682375b8f3f17c..b19b3841ae6689ea0776c2dffd66ab172aec976e 100644 (file)
@@ -870,13 +870,15 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active,
                        addtotoc_stack.push({pit, end});
                }
 
-               // if we find an optarg, we'll save it for use later.
+               // If we find an InsetArgument that is supposed to provide the TOC caption,
+               // we'll save it for use later.
                InsetArgument const * arginset = nullptr;
                for (auto const & table : par.insetList()) {
                        dit.pos() = table.pos;
                        table.inset->addToToc(dit, doing_output, utype, backend);
                        if (InsetArgument const * x = table.inset->asInsetArgument())
-                               arginset = x;
+                               if (x->isTocCaption())
+                                       arginset = x;
                }
 
                // End custom AddToToc in paragraph layouts