From d8ee26ec6c1c687ab4ab6bc637cebb5d51b36e5e Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 15 Feb 2008 08:39:58 +0000 Subject: [PATCH] * InsetXXX::addToToc(): properly use passed ParConstIterator. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23015 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetFoot.cpp | 6 ++++-- src/insets/InsetInclude.cpp | 6 +++--- src/insets/InsetIndex.cpp | 6 ++++-- src/insets/InsetMarginal.cpp | 6 ++++-- src/insets/InsetNote.cpp | 6 ++++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index fe26f80870..cfc902a21a 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -75,9 +75,11 @@ void InsetFoot::updateLabels(Buffer const & buf, ParIterator const & it) } -void InsetFoot::addToToc(TocList & toclist, Buffer const & buf, ParConstIterator const &) const +void InsetFoot::addToToc(TocList & toclist, Buffer const & buf, + ParConstIterator const & cpit) const { - ParConstIterator pit = par_const_iterator_begin(*this); + ParConstIterator pit = cpit; + pit.push_back(*this); Toc & toc = toclist["footnote"]; // FIXME: we probably want the footnote number too. diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 768806451a..fd3be13253 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -854,7 +854,7 @@ void InsetInclude::addPreview(graphics::PreviewLoader & ploader) const void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer, - ParConstIterator const & pit) const + ParConstIterator const & cpit) const { if (isListings(params())) { InsetListingsParams p(to_utf8(params()["lstparams"])); @@ -864,8 +864,8 @@ void InsetInclude::addToToc(TocList & toclist, Buffer const & buffer, Toc & toc = toclist["listing"]; docstring const str = convert(toc.size() + 1) + ". " + from_utf8(caption); - // This inset does not have a valid ParConstIterator - // so it has to use the iterator of its parent paragraph + ParConstIterator pit = cpit; + pit.push_back(*this); toc.push_back(TocItem(pit, 0, str)); return; } diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index 074c0489d4..925d8618e7 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -61,9 +61,11 @@ void InsetIndex::write(Buffer const & buf, ostream & os) const } -void InsetIndex::addToToc(TocList & toclist, Buffer const & buf, ParConstIterator const &) const +void InsetIndex::addToToc(TocList & toclist, Buffer const & buf, + ParConstIterator const & cpit) const { - ParConstIterator pit = par_const_iterator_begin(*this); + ParConstIterator pit = cpit; + pit.push_back(*this); Toc & toc = toclist["index"]; docstring str; diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp index 511071e4b2..f48d95925d 100644 --- a/src/insets/InsetMarginal.cpp +++ b/src/insets/InsetMarginal.cpp @@ -79,9 +79,11 @@ int InsetMarginal::docbook(Buffer const & buf, odocstream & os, } -void InsetMarginal::addToToc(TocList & toclist, Buffer const &/* buf*/, ParConstIterator const &) const +void InsetMarginal::addToToc(TocList & toclist, Buffer const &/* buf*/, + ParConstIterator const & cpit) const { - ParConstIterator pit = par_const_iterator_begin(*this); + ParConstIterator pit = cpit; + pit.push_back(*this); Toc & toc = toclist["marginalnote"]; docstring str; diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index babe2bf651..118c045dc2 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -220,9 +220,11 @@ void InsetNote::updateLabels(Buffer const & buf, ParIterator const & it) } -void InsetNote::addToToc(TocList & toclist, Buffer const & /*buf*/, ParConstIterator const &) const +void InsetNote::addToToc(TocList & toclist, Buffer const & /*buf*/, + ParConstIterator const & cpit) const { - ParConstIterator pit = par_const_iterator_begin(*this); + ParConstIterator pit = cpit; + pit.push_back(*this); Toc & toc = toclist["note"]; docstring str; -- 2.39.2