mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Properly implement IsTocCaption for Arguments in standard TOC
Fixes: #10631
Candidate for 2.3.x.
(cherry picked from commit 3a4b233dbd
)
This commit is contained in:
parent
4f865d0f4d
commit
438b067b5a
@ -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
|
||||
End
|
||||
|
||||
|
@ -137,6 +137,7 @@ Style Section
|
||||
LabelString "Short Title|S"
|
||||
Tooltip "The title as it appears in the header"
|
||||
InsertCotext 1
|
||||
IsTocCaption 1
|
||||
EndArgument
|
||||
ParSkip 0.4
|
||||
TopSep 1.3
|
||||
|
@ -51,6 +51,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
|
||||
End
|
||||
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -83,6 +83,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
|
||||
@ -111,6 +112,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
|
||||
|
@ -40,6 +40,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
|
||||
|
@ -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:
|
||||
|
@ -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_;
|
||||
|
||||
|
@ -870,12 +870,14 @@ 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())
|
||||
if (x->isTocCaption())
|
||||
arginset = x;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user