mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
Fix bug #7230. Changes at r36974 had not been done properly. But this is
better than what we had, anyway, since we do not calculate the tocstring unless we need it. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37190 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
b8d6c10e6c
commit
ee351906e0
@ -698,8 +698,8 @@ void InsetText::addToToc(DocIterator const & cdit)
|
|||||||
for (pit_type pit = 0; pit != pend; ++pit) {
|
for (pit_type pit = 0; pit != pend; ++pit) {
|
||||||
Paragraph const & par = pars[pit];
|
Paragraph const & par = pars[pit];
|
||||||
dit.pit() = pit;
|
dit.pit() = pit;
|
||||||
// the string that goes to the toc (could be the optarg)
|
// if we find an optarg, we'll save it for use later.
|
||||||
docstring tocstring;
|
InsetText * arginset = 0;
|
||||||
InsetList::const_iterator it = par.insetList().begin();
|
InsetList::const_iterator it = par.insetList().begin();
|
||||||
InsetList::const_iterator end = par.insetList().end();
|
InsetList::const_iterator end = par.insetList().end();
|
||||||
for (; it != end; ++it) {
|
for (; it != end; ++it) {
|
||||||
@ -707,16 +707,22 @@ void InsetText::addToToc(DocIterator const & cdit)
|
|||||||
dit.pos() = it->pos;
|
dit.pos() = it->pos;
|
||||||
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
|
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
|
||||||
inset.addToToc(dit);
|
inset.addToToc(dit);
|
||||||
if (inset.lyxCode() == ARG_CODE && tocstring.empty())
|
if (inset.lyxCode() == ARG_CODE)
|
||||||
inset.asInsetText()->text().forToc(tocstring, TOC_ENTRY_LENGTH);
|
arginset = inset.asInsetText();
|
||||||
}
|
}
|
||||||
// now the toc entry for the paragraph
|
// now the toc entry for the paragraph
|
||||||
int const toclevel = par.layout().toclevel;
|
int const toclevel = par.layout().toclevel;
|
||||||
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
|
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
|
||||||
dit.pos() = 0;
|
|
||||||
// insert this into the table of contents
|
// insert this into the table of contents
|
||||||
if (tocstring.empty())
|
docstring tocstring;
|
||||||
|
if (arginset) {
|
||||||
|
tocstring = par.labelString();
|
||||||
|
if (!tocstring.empty())
|
||||||
|
tocstring += ' ';
|
||||||
|
arginset->text().forToc(tocstring, TOC_ENTRY_LENGTH);
|
||||||
|
} else
|
||||||
par.forToc(tocstring, TOC_ENTRY_LENGTH);
|
par.forToc(tocstring, TOC_ENTRY_LENGTH);
|
||||||
|
dit.pos() = 0;
|
||||||
toc.push_back(TocItem(dit, toclevel - min_toclevel,
|
toc.push_back(TocItem(dit, toclevel - min_toclevel,
|
||||||
tocstring, tocstring));
|
tocstring, tocstring));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user