]> git.lyx.org Git - lyx.git/commitdiff
Table cells are insets, but not from the point of view of DocIterators
authorRichard Heck <rgheck@lyx.org>
Mon, 24 Feb 2014 19:36:13 +0000 (14:36 -0500)
committerRichard Heck <rgheck@lyx.org>
Wed, 26 Feb 2014 01:54:29 +0000 (20:54 -0500)
and Cursors. So just calling InsetText::addToToc for the cells causes
problems, because InsetText::addToToc then adds the cell inset itself
as part of the DocIterator. This then leads to assertions, such as bug

The solution is to refactor InsetText::addToToc so that we can call the
iterating part without adding the inset.

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h
src/insets/InsetText.cpp
src/insets/InsetText.h

index f89c34a285e62a3c44f389ab56362388d4c44e17..60a0157cb3056dc33b15cf557a691ebb4334349d 100644 (file)
@@ -3432,6 +3432,12 @@ docstring InsetTableCell::asString(bool intoInsets)
 }
 
 
+void InsetTableCell::addToToc(DocIterator const & di, bool output_active) const
+{
+       InsetText::iterateForToc(di, output_active);
+}
+
+
 docstring InsetTableCell::xhtml(XHTMLStream & xs, OutputParams const & rp) const
 {
        if (!isFixedWidth)
index 1fed9bea174b96c1701d91c4085decfa146e2276..4b1cf83673867472b95ed41c1e88d76ed4a8aeb3 100644 (file)
@@ -70,6 +70,8 @@ public:
        docstring asString(bool intoInsets = true);
        ///
        docstring xhtml(XHTMLStream &, OutputParams const &) const;
+       ///
+       void addToToc(DocIterator const & di, bool output_active) const;
 private:
        /// unimplemented
        InsetTableCell();
index 3dccd746cc957c46554f4068a70c943259609855..5f44052b4521d65173fa2170caabda945e61f112 100644 (file)
@@ -815,6 +815,13 @@ void InsetText::addToToc(DocIterator const & cdit, bool output_active) const
 {
        DocIterator dit = cdit;
        dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
+       iterateForToc(dit, output_active);
+}
+
+
+void InsetText::iterateForToc(DocIterator const & cdit, bool output_active) const
+{
+       DocIterator dit = cdit;
        Toc & toc = buffer().tocBackend().toc("tableofcontents");
 
        BufferParams const & bufparams = buffer_->params();
index d16d41a249fe74cf0c2b2063415f0682042ba274..7343ee5899273c3a34382c2abb5a9fde9384baaa 100644 (file)
@@ -217,6 +217,8 @@ protected:
        docstring getCaptionText(OutputParams const &) const;
        ///
        docstring getCaptionHTML(OutputParams const &) const;
+       ///
+       void iterateForToc(DocIterator const & cdit, bool output_active) const;
 private:
        ///
        bool drawFrame_;