]> git.lyx.org Git - features.git/commitdiff
* InsetXXX::addToToc(): properly use passed ParConstIterator.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 15 Feb 2008 08:39:58 +0000 (08:39 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 15 Feb 2008 08:39:58 +0000 (08:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23015 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetFoot.cpp
src/insets/InsetInclude.cpp
src/insets/InsetIndex.cpp
src/insets/InsetMarginal.cpp
src/insets/InsetNote.cpp

index fe26f80870feca35498d3c979863dde089abe4a1..cfc902a21a34b0f0aacd72ad04329e23e1bd2c28 100644 (file)
@@ -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.
index 768806451aeeec6c6cd4aff4bf119ffb8fd88ba7..fd3be13253a395174ecde09e3a7d412d6559206f 100644 (file)
@@ -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<docstring>(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;
        }
index 074c0489d431f060b56004047e4e6c126c965300..925d8618e72d311272c1ad4dd3889a421c814ff6 100644 (file)
@@ -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;
index 511071e4b2bb07d6641f6158382d3bcf06aa8381..f48d95925d391eccbe3964e2d45d3dd61098c866 100644 (file)
@@ -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;
index babe2bf651b39c3887463f27b1f2eaafcf34bc7d..118c045dc220b6aa9a5c69e167661315c5fb9773 100644 (file)
@@ -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;