mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Fix bug #7166: Insets that shouldn't appear in the TOC were included. From now on use AS_STR_INTOC as an option for Paragraph::asString() for insets that should not be included in the strings for the TOC, like IndexInset.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36969 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8b88c3edde
commit
8adcffff0c
@ -2928,8 +2928,11 @@ docstring Paragraph::asString(pos_type beg, pos_type end, int options) const
|
|||||||
|| (c == '\n' && (options & AS_STR_NEWLINES)))
|
|| (c == '\n' && (options & AS_STR_NEWLINES)))
|
||||||
os.put(c);
|
os.put(c);
|
||||||
else if (c == META_INSET && (options & AS_STR_INSETS)) {
|
else if (c == META_INSET && (options & AS_STR_INSETS)) {
|
||||||
getInset(i)->toString(os);
|
Inset const * inset = getInset(i);
|
||||||
if (getInset(i)->asInsetMath())
|
if ((options & AS_STR_INTOC) && !inset->isInToc())
|
||||||
|
continue;
|
||||||
|
inset->toString(os);
|
||||||
|
if (inset->asInsetMath())
|
||||||
os << " ";
|
os << " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3578,7 +3581,7 @@ SpellChecker::Result Paragraph::spellCheck(pos_type & from, pos_type & to,
|
|||||||
if (from == to || from >= size())
|
if (from == to || from >= size())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
docstring word = asString(from, to, AS_STR_INSETS + AS_STR_SKIPDELETE);
|
docstring word = asString(from, to, AS_STR_INSETS | AS_STR_SKIPDELETE);
|
||||||
Language * lang = d->getSpellLanguage(from);
|
Language * lang = d->getSpellLanguage(from);
|
||||||
|
|
||||||
wl = WordLangTuple(word, lang);
|
wl = WordLangTuple(word, lang);
|
||||||
|
@ -102,7 +102,8 @@ enum AsStringParameter
|
|||||||
AS_STR_LABEL = 1, ///< Prefix with paragraph label.
|
AS_STR_LABEL = 1, ///< Prefix with paragraph label.
|
||||||
AS_STR_INSETS = 2, ///< Go into insets.
|
AS_STR_INSETS = 2, ///< Go into insets.
|
||||||
AS_STR_NEWLINES = 4, ///< Get also newline characters.
|
AS_STR_NEWLINES = 4, ///< Get also newline characters.
|
||||||
AS_STR_SKIPDELETE = 8 ///< Skip deleted text in change tracking.
|
AS_STR_SKIPDELETE = 8, ///< Skip deleted text in change tracking.
|
||||||
|
AS_STR_INTOC = 16 ///< Skip insets that are not supposed to go into the TOC
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ bool TocBackend::updateItem(DocIterator const & dit)
|
|||||||
*static_cast<InsetArgument&>(inset).paragraphs().begin();
|
*static_cast<InsetArgument&>(inset).paragraphs().begin();
|
||||||
if (!par.labelString().empty())
|
if (!par.labelString().empty())
|
||||||
tocstring = par.labelString() + ' ';
|
tocstring = par.labelString() + ' ';
|
||||||
tocstring += inset_par.asString(AS_STR_INSETS);
|
tocstring += inset_par.asString(AS_STR_INSETS | AS_STR_INTOC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ bool TocBackend::updateItem(DocIterator const & dit)
|
|||||||
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
|
||||||
&& tocstring.empty())
|
&& tocstring.empty())
|
||||||
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
|
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS | AS_STR_INTOC);
|
||||||
|
|
||||||
const_cast<TocItem &>(*toc_item).str_ = tocstring;
|
const_cast<TocItem &>(*toc_item).str_ = tocstring;
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ void InsetText::addToToc(DocIterator const & cdit)
|
|||||||
*static_cast<InsetArgument&>(inset).paragraphs().begin();
|
*static_cast<InsetArgument&>(inset).paragraphs().begin();
|
||||||
if (!par.labelString().empty())
|
if (!par.labelString().empty())
|
||||||
tocstring = par.labelString() + ' ';
|
tocstring = par.labelString() + ' ';
|
||||||
tocstring += insetpar.asString(AS_STR_INSETS);
|
tocstring += insetpar.asString(AS_STR_INSETS | AS_STR_INTOC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -722,7 +722,7 @@ void InsetText::addToToc(DocIterator const & cdit)
|
|||||||
dit.pos() = 0;
|
dit.pos() = 0;
|
||||||
// insert this into the table of contents
|
// insert this into the table of contents
|
||||||
if (tocstring.empty())
|
if (tocstring.empty())
|
||||||
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS);
|
tocstring = par.asString(AS_STR_LABEL | AS_STR_INSETS | AS_STR_INTOC);
|
||||||
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