mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +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"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The part as it appears in the table of contents/running headers"
|
Tooltip "The part as it appears in the table of contents/running headers"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
NeedProtect 1
|
NeedProtect 1
|
||||||
NextNoIndent 1
|
NextNoIndent 1
|
||||||
@ -270,6 +271,7 @@ Style Section
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Family Roman
|
Family Roman
|
||||||
@ -331,6 +333,7 @@ Style Subsection
|
|||||||
LabelString "Short Title|S"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The subsection as it appears in the table of contents/running headers"
|
Tooltip "The subsection as it appears in the table of contents/running headers"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Family Roman
|
Family Roman
|
||||||
@ -392,6 +395,7 @@ Style Subsubsection
|
|||||||
LabelString "Short Title|S"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The subsubsection as it appears in the table of contents/running headers"
|
Tooltip "The subsubsection as it appears in the table of contents/running headers"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Family Roman
|
Family Roman
|
||||||
@ -481,6 +485,7 @@ Style Frame
|
|||||||
Size largest
|
Size largest
|
||||||
EndFont
|
EndFont
|
||||||
AutoInsert 1
|
AutoInsert 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ Style Section
|
|||||||
LabelString "Short Title|S"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The title as it appears in the header"
|
Tooltip "The title as it appears in the header"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
ParSkip 0.4
|
ParSkip 0.4
|
||||||
TopSep 1.3
|
TopSep 1.3
|
||||||
|
@ -51,6 +51,7 @@ Style Section
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
End
|
End
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ Style Part
|
|||||||
LabelString "Short Title|S"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The part as it appears in the table of contents/running headers"
|
Tooltip "The part as it appears in the table of contents/running headers"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
@ -63,6 +64,7 @@ Style Chapter
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
@ -93,6 +95,7 @@ Style Section
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
|
@ -140,6 +140,7 @@ Style PartBacktext
|
|||||||
Mandatory 1
|
Mandatory 1
|
||||||
LabelString "Part Title"
|
LabelString "Part Title"
|
||||||
Tooltip "Title of this part"
|
Tooltip "Title of this part"
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Preamble
|
Preamble
|
||||||
\newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}
|
\newenvironment{svmultpartbacktext}[1]{\begin{partbacktext}
|
||||||
|
@ -83,6 +83,7 @@ Style Chapter
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
@ -111,6 +112,7 @@ Style Section
|
|||||||
LabelString "Short Title|S"
|
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
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
|
@ -40,6 +40,7 @@ Style Part
|
|||||||
LabelString "Short Title|S"
|
LabelString "Short Title|S"
|
||||||
Tooltip "The part as it appears in the table of contents/running headers"
|
Tooltip "The part as it appears in the table of contents/running headers"
|
||||||
InsertCotext 1
|
InsertCotext 1
|
||||||
|
IsTocCaption 1
|
||||||
EndArgument
|
EndArgument
|
||||||
Font
|
Font
|
||||||
Series Bold
|
Series Bold
|
||||||
|
@ -43,7 +43,7 @@ InsetArgument::InsetArgument(Buffer * buf, string const & name)
|
|||||||
: InsetCollapsible(buf), name_(name), labelstring_(docstring()),
|
: InsetCollapsible(buf), name_(name), labelstring_(docstring()),
|
||||||
font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
|
font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
|
||||||
pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false),
|
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;
|
decoration_ = (*lait).second.decoration;
|
||||||
pass_thru_chars_ = (*lait).second.pass_thru_chars;
|
pass_thru_chars_ = (*lait).second.pass_thru_chars;
|
||||||
pass_thru_local_ = false;
|
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
|
// empty if AddToToc is not set
|
||||||
caption_of_toc_ = insetlayout
|
caption_of_toc_ = insetlayout
|
||||||
? it.inset().getLayout().tocType()
|
? it.inset().getLayout().tocType()
|
||||||
: it.paragraph().layout().tocType();
|
: it.paragraph().layout().tocType();
|
||||||
|
}
|
||||||
|
|
||||||
switch ((*lait).second.passthru) {
|
switch ((*lait).second.passthru) {
|
||||||
case PT_INHERITED:
|
case PT_INHERITED:
|
||||||
|
@ -69,6 +69,8 @@ public:
|
|||||||
///
|
///
|
||||||
bool isPassThru() const { return pass_thru_; }
|
bool isPassThru() const { return pass_thru_; }
|
||||||
///
|
///
|
||||||
|
bool isTocCaption() const { return is_toc_caption_; }
|
||||||
|
///
|
||||||
bool resetFontEdit() const { return false; }
|
bool resetFontEdit() const { return false; }
|
||||||
//@}
|
//@}
|
||||||
/// \name Public functions inherited from InsetCollapsible class
|
/// \name Public functions inherited from InsetCollapsible class
|
||||||
@ -113,6 +115,8 @@ private:
|
|||||||
bool pass_thru_;
|
bool pass_thru_;
|
||||||
///
|
///
|
||||||
docstring pass_thru_chars_;
|
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.
|
/// The type of Toc this is the caption of, empty otherwise.
|
||||||
std::string caption_of_toc_;
|
std::string caption_of_toc_;
|
||||||
|
|
||||||
|
@ -870,12 +870,14 @@ void InsetText::iterateForToc(DocIterator const & cdit, bool output_active,
|
|||||||
addtotoc_stack.push({pit, end});
|
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;
|
InsetArgument const * arginset = nullptr;
|
||||||
for (auto const & table : par.insetList()) {
|
for (auto const & table : par.insetList()) {
|
||||||
dit.pos() = table.pos;
|
dit.pos() = table.pos;
|
||||||
table.inset->addToToc(dit, doing_output, utype, backend);
|
table.inset->addToToc(dit, doing_output, utype, backend);
|
||||||
if (InsetArgument const * x = table.inset->asInsetArgument())
|
if (InsetArgument const * x = table.inset->asInsetArgument())
|
||||||
|
if (x->isTocCaption())
|
||||||
arginset = x;
|
arginset = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user